2 // --- coding: latin_1 ---
5 // creation : 2007-03-30.16.58.42
8 // Copyright © 2007 Commissariat à l'Energie Atomique
9 // par Gilles ARNAUD (DM2S/SFME/LETR)
10 // C.E. Saclay; Bat 454; 91191 GIF/YVETTE CEDEX; France
11 // Tel: 01 69 08 38 86; Fax : 33 1 69 08 85 68
12 // Gilles.Arnaud@cea.fr
15 // particules du simplex
17 //___________________________________________________________________
42 start = (Solution *) NULL;
43 courant = (std::vector<double> *) NULL;
44 baryc = (std::vector<double> *) NULL;
45 minim = (std::vector<double> *) NULL;
60 Solution *Point::inform(std::vector<double> &obj)
64 res = (Solution *) NULL;
70 res = new Solution(*courant, obj);
73 if (obj[0] > (*start->obj)[0]) {
87 start = new Solution(*courant, obj);
92 if (obj[0] > (*start->obj)[0]) {
102 start = (Solution *) NULL;
109 res = new Solution(*courant, obj);
113 if (obj[0] > (*start->obj)[0]) {
126 res = new Solution(*courant, obj);
134 res = new Solution(*courant, obj);
137 std::cout << "pbl inform" << std::endl ;
143 void Point::mute(Solution &pt, std::vector<double> &bary, std::vector<double> &minm)
145 std::vector<double> *tmp;
158 void Point::reinit(void)
163 std::vector<double> *Point::next(void)
170 courant = rnd->gen();
173 courant = symetrique(*start->param, *baryc);
176 courant = symetrique(*baryc, *start->param);
179 courant = milieu(*baryc, *start->param);
182 courant = milieu(*minim, *start->param);
186 std::cout << "pbl next" << std::endl ;
190 for (i=0; i<size; i++) {
191 dd = (*courant)[0] - (*baryc)[0];
199 return (std::vector<double> *) NULL;
205 std::vector<double> *Point::symetrique(std::vector<double> &pt, std::vector<double> ¢r)
209 std::vector<double> *res;
213 for (i=0; i<size; i++) {
214 tmp = (centr[i]-pt[i] > 0.0) ?
215 (1.0 - centr[i]) / (centr[i] - pt[i]) :
216 centr[i] / (pt[i] - centr[i]) ;
217 coef = (coef < tmp) ? coef : tmp ;
220 res = new std::vector<double>(size);
221 for (i=0; i<size; i++)
222 (*res)[i] = centr[i] + coef * (centr[i] - pt[i]);
226 std::vector<double> *Point::milieu(std::vector<double> &un, std::vector<double> &deux)
229 std::vector<double> *res;
231 res = new std::vector<double>(size);
232 for (i=0; i<size; i++)
233 (*res)[i] = (un[i] + deux[i])/2.0;