Structural deformable models
Searcher.cpp
Go to the documentation of this file.
1 #include <GL/gl.h>
2 #include <fxkeys.h>
3 #include <functional>
4 #include <algorithm>
5 #include "ParseFile.h"
6 #include "Searcher.h"
7 #include "utils.h"
8 using namespace std;
9 
10 //----------------------------------------------------------------------------
11 #define SRCH_CYCLE_T 1.0f
12 #define SRCH_MAXPOP 250
13 
14 #define SRCH_NCLUSTERS 60
15 #define SRCH_NEW_SPAWNS 100
16 #define SRCH_NEW_SPAWNS_THRED 0.90f
17 #define SRCH_CLUSTERTH 0.6f
18 #define SRCH_CLUSTERDPOS 0.3f
19 #define SRCH_CLUSTERDMELT 0.05f
20 #define SRCH_CLUSTERDSCALE 0.3f
21 #define SRCH_CLUSTERDDIR 0.5f
22 #define SRCH_RELBINDIST 0.75f
23 
24 #define SRCH_MUTATE_SPAWNS 0
25 #define SRCH_MUTATE_THRED 0.99f
26 #define SRCH_MUTATE_RATE 0.3f
27 #define SRCH_MUTATE_HL 30
28 #define SRCH_MUTATE_PDIR 0.5f
29 #define SRCH_MUTATE_PPOS 0.4f
30 #define SRCH_MUTATE_PNOISE 0.2f
31 #define SRCH_MUTATE_NOISERATE 0.1f
32 #define SRCH_MUTATE_PPROP 0.3f
33 #define SRCH_MUTATE_PROPRATE 0.5f
34 
35 #define SRCH_RATINGTH 0.001f
36 #define SRCH_SHAPEWEIGHT 0.1f
37 #define SRCH_SCALESTD 1.f
38 
39 #define PARA_PCTH 0.05f
40 #define PARA_PDIST 0
41 #define PARA_SOLVER 0
42 #define PARA_MAXSHOOT 100
43 
44 //-----------------------------------------------------------------------------
45 namespace std {
46  template <>
47  struct greater<Model*>
48  {
49  bool operator()(Model* const& lhs, Model* const& rhs) const {
50  if(!lhs || !rhs) return true; //should we do that?
51  return lhs->getQualityOfFit() > rhs->getQualityOfFit();
52  }
53  };
54 };
55 
56 class NMerge : public binary_function<Model*, Model*, bool> {
57 public:
58  NMerge( float maxd, enum Model::DistType dtype = Model::DIST_XYS) :
59  m_DType(dtype), m_MaxD(maxd) {};
60  bool operator() (const Model* lhs, const Model* rhs) const {
61  if(lhs && rhs) {
62  if(lhs == rhs) return true;
63  else {
64  register float dist = lhs->distance(*rhs, m_DType);
65 // cout << lhs << " merge " << rhs << " dist = " << dist
66 // << " > " << m_MaxD << endl;
67  return dist > m_MaxD;
68  }
69  } else return true;
70  }
71  const enum Model::DistType m_DType;
72  const float m_MaxD;
73 };
74 
75 //-----------------------------------------------------------------------------
76 Searcher::Searcher() : m_NPop(0), m_Time(0), m_Mode(MODE_PAUSE),
77  m_NextWinID(Winner::WID_FIRST),
78  m_ShapeWeight(SRCH_SHAPEWEIGHT)
79 {
80  m_EvolveT = 0.0f;
83 }
84 
86 {
87  operator=(rhs);
88 }
89 
91 {
92  clear();
93 }
94 
96 {
97  if(&rhs == this) return *this;
98  clear();
100  m_AvgWinner = rhs.m_AvgWinner;
101  m_StdWinner = rhs.m_StdWinner;
102  m_EMap = rhs.m_EMap;
103  for(list<Model*>::const_iterator gi=rhs.m_Population.begin();
104  gi != rhs.m_Population.end(); gi++)
105  {
106  m_Population.push_back(new Model(**gi));
107  }
108  m_NPop = rhs.m_NPop;
109  m_Bins = rhs.m_Bins;
110  m_BinsX, m_BinsY = rhs.m_BinsX;
111  m_BinDist = rhs.m_BinDist;
112  m_Time = rhs.m_Time;
113  m_PosMax = rhs.m_PosMax;
114  m_PosMin = rhs.m_PosMin;
115  m_PosRange = rhs.m_PosRange;
116  m_Mode = rhs.m_Mode;
117  m_EvolveT = rhs.m_EvolveT;
119  m_NextWinID = rhs.m_NextWinID;
122  updateWinList();
123  return *this;
124 }
125 
127  m_BinsX = m_BinsY = 0;
128  m_Bins.clear();
129  for(list<Model*>::iterator gi=m_Population.begin();
130  gi != m_Population.end(); gi++)
131  {
132  delete *gi;
133  }
134  m_Population.clear();
136  m_EMap.clear();
137  m_Winners.clear();
138  m_NPop=0;
139  m_Time=0;
140  m_EvolveT=0;
141 }
142 
144  m->m_TimeStamp = m_Time;
145  m->getFlags() = 0;
147  m->setInstCount(1);
148  m_Population.push_back(m);
149  return ++m_NPop;
150 }
151 
152 list<Model*>::iterator& Searcher::remove(list<Model*>::iterator &mi)
153 {
154  if(!(*mi)->hasFlags(Model::ST_NODEL)) {
155  list<Model*>::iterator ci = mi++;
156  delete *ci;
157  m_Population.erase(ci);
158  m_NPop--;
159  }
160  return mi;
161 }
162 
164 {
165  if(m_Mode == MODE_PAUSE) return;
166 //create, mutate, and remove
167  int extrakill=0;
168  float lqof,hqof;
169  getQualityRange(lqof,hqof);
170  double slowlive=0.0;
171  if(m_NPop) {
172  for(list<Model*>::const_iterator m = m_Population.begin();
173  m!=m_Population.end(); m++)
174  {
175  //if((*m)->m_TimeStamp-m_Time > 4&&(*m)->getLiveliness()>slowlive)
176  slowlive += (*m)->getLiveliness();
177  }
178  slowlive /= m_NPop;
179  slowlive *= 0.5;
180  DUMP(slowlive);
181  }
182 
183  //findWinners();
184  if(buildClusters()) {
185  selectWinners();
186  cleanFlags();
187  }
188  //float kill_quality_th = hqof*0.7;
189  list<Model*>::iterator m=m_Population.begin();
190  dword rank = 0;
191  bool pastlast=false;
192  int lamekill=0;
193  m_Winners.clear();
194  Model* lastmodel = !m_Population.empty() ? m_Population.back():NULL;
195  while(m != m_Population.end() && !pastlast)
196  {
197  if(*m == lastmodel) pastlast=true;
198  list<Model*>::iterator nm = m; nm++;
199  //float relq = (hqof-lqof)*kill_quality_th+lqof;
200  //(hqof!=0.0) ? ((*m)->getQualityOfFit()-lqof)/hqof :1;
201  //if(relq > (*m)->getQualityOfFit() && m_NPop>1) {
202  if(rank > getSearchPara().m_MaxPop) {
203  if(m_NPop>1) { remove(m); extrakill++; }
204  } else if((*m)->isWinner()) {
205  PropVec propvec((*m)->getProperties());
206  if(!(*m)->getID()) (*m)->setID(m_NextWinID++);
207  Winner winner(*m);
208  float rating = m_EMap.ratePropVec(propvec, &winner);
209  if(rating < getSearchPara().m_RatingTH &&
210  !(*m)->hasFlags(Model::ST_NODEL)) {
211 // cout << "removing invalid winner " << endl;
212 // DUMP(rating);
213 // DUMP(propvec);
214 // DUMP(propvec.clamp(m_EMap.m_LB, m_EMap.m_UB));
215 // DUMP((*m)->getName());
216  remove(m);
217  m_NextWinID--;
218  } else
219  {
220  m_Winners[winner.m_WinnerID] = winner;
221 // m_Winners.insert(pair<dword,Winner>(winner.m_WinnerID,
222 // winner));
223 //mutate winners
224  float threduce = getSearchPara().m_MutateTHRed;
225  float qth = (*m)->getQualityOfFit()*threduce;
226  int cs=0;
227  int misses=0;
228  const int nspawns = getSearchPara().m_MutateSpawns;
229  while(cs<nspawns) {
230  Model *newmod = &mutate(*(new Model(**m)),m_MutateRate
231  *exp((m_Time/getSearchPara().m_MutateHL)
232  *(-M_LN2)));
233  if(newmod->getQualityOfFit() < qth) {
234  delete newmod;
235  misses++;
236  if(misses%nspawns==0) qth*=threduce;
237  } else {
238  add(newmod);
239  cs++;
240  }
241  }
242  if(misses>nspawns) DUMP(misses)<<" for mutation"<<endl;
243  //nm = m; nm++; // ensure validity of iterator (?)
244  }
245  } else if((*m)->getLiveliness()<slowlive) {
246  remove(m);
247  lamekill++;
248  } else if(m_NPop>1 && (*m)->isLooser() &&
249  (m_Time-(*m)->m_TimeStamp>getSearchPara().m_EvolveCycle*10))
250  {
251  remove(m);
252  }
253  m = nm;
254  rank++;
255  }
256 // DUMP(extrakill);
257 // DUMP(lamekill);
258 //Spawn new instances
259  int cs = 0;
260  float threduce = getSearchPara().m_NSpawnsTHRed;
261  float qth = hqof*threduce; //DEBUG
262  int misses = 0;
263  const int nspawns = m_EMap && m_EMap.m_Integral > 0.00001f
264  ? getSearchPara().m_NSpawns : 0;
265  while(cs<nspawns) {
266  Model *newmod = m_EMap.generateInstance();
267  if(newmod->getQualityOfFit() < qth) {
268  delete newmod;
269  misses++;
270  if(misses%nspawns==0) qth*=threduce;
271  } else {
272  //qth = newmod->getQualityOfFit();
273  //newmod->m_TimeStamp = m_Time; //[Model::TS_CREATE]
274  add(newmod);
275  cs++;
276  }
277  }
278  //if(misses>20) DUMP(misses) << " for distribution" << endl;
280  if(m_NPop > 0 && //(int)m_Winners.size() &&
281  m_EMap.m_Integral < 0.0001f)
282  {
283  m_Mode = MODE_DONE;
284  } else cout << m_Representative.getName() << " searching, integral = "
285  << m_EMap.m_Integral << endl;
286 }
287 
288 bool Searcher::step(float dt)
289 {
290  if(!m_EMap) return true;
291  if(m_Mode == MODE_PAUSE) return false;
292  else if(m_Mode == MODE_DONE) return true;
293 
294  m_Time+=dt;
295  for(list<Model*>::iterator m=m_Population.begin();
296  m != m_Population.end(); m++)
297  {
298  (*m)->updateParticles(dt);
299  }
300  return m_Mode==MODE_DONE; // not yet done
301 }
302 
303 float Searcher::getGeneration(const Model* model) const {
304  return (m_Time - model->m_TimeStamp) / getSearchPara().m_EvolveCycle;
305 }
306 
307 Model& Searcher::mutate(Model& model, float rate) const
308 {
309 #define _PROP_MUTATION_
310 #ifdef _PROP_MUTATION_
311  PropVec prop = model.getProperties();
312  PropVec mutation(0.f);
313  bool same=true;
314  while(same) {
315  if(FRAND1 < getSearchPara().m_MutatePDir){
316  setPropDir(mutation,frand(2*M_PI));
317  same = false;
318  }
319  if(FRAND1 < getSearchPara().m_MutatePPos) {
320  Point pos(0,0);
321  float radius = model.getStdRadius();//*rate;
322  pos += Point2D(radius-frand(2*radius), radius-frand(2*radius));
323  setPropPos(mutation,pos);
324  same = false;
325  }
326  if(FRAND1 < getSearchPara().m_MutatePNoise) {
327  model.addNoise(getSearchPara().m_MutateNoiseRate*rate);
328  same = false;
329  }
330  if(FRAND1 < getSearchPara().m_MutatePProp) {
331  model.adaptProportion(getSearchPara().m_MutatePropRate);
332  same = false;
333  }
334  }
335  model.adaptProperties(prop+(mutation*rate));
336 #else
337  float radius=model.getStdRadius();
338  model.push(Point2D(-radius+frand(2*radius),
339  -radius+frand(2*radius)));
340  model.pushRotate((*m)->getCenter(), -2+frand(4));
341  model.addNoise(0.1);
342 #endif
343  return model;
344 }
345 
347 {
348  if(&em != &m_EMap) m_EMap = em;
349  PropVec ub = m_EMap.getUB();
350  PropVec lb = m_EMap.getLB();
352  m_EMap.setLB(lb); m_EMap.setUB(ub);
353  m_PosMax = getPropPos(ub);
354  m_PosMin = getPropPos(lb);
355  //cout << "pos max=" << m_PosMax << " pos min=" << m_PosMin << endl;
358 
359 }
360 
361 bool Searcher::buildBins(float bindist)
362 {
363  if(m_EMap.getRepresentative().getNNodes() == 0) return false;
364  else if(m_Representative.getNNodes() == 0) {
367  m_StdWinner = 0.f;
369  }
370 //destroy bins
371  m_BinsX = m_BinsY = 0;
372  m_Bins.clear();
373 //initialize bins
374  float radius = getPropScale(m_MinModel);
375  //m_Representative.getStdRadius();
376  if(m_Population.empty() || m_PosRange.sum()==0 || radius<0.001)
377  return false;
378 
379  m_BinDist = bindist != 0.f ? bindist : radius*getSearchPara().m_RelBinDist;
380  m_BinsX = (int)(m_PosRange.x/m_BinDist)+1;
381  m_BinsY = (int)(m_PosRange.y/m_BinDist)+1;
382  m_Bins.resize(m_BinsX*m_BinsY);
383 // cout << m_PosRange << endl;
384 // TRACE("created " << m_BinsX << " in X and " << m_BinsY
385 // << " in Y direction.");
386 //fill bins
387  for(list<Model*>::iterator model = m_Population.begin();
388  model != m_Population.end(); model++)
389  {
390  (*model)->setOldState();
391  (*model)->unsetFlags(Model::ST_MEMBER);
392  (*model)->setShapeWeight(m_ShapeWeight);
393  Point c = (*model)->getCenter();
394  int bx = (int)(c.x/m_BinDist);
395  int by = (int)(c.y/m_BinDist);
396 #define MAXRAD 0
397 #if (MAXRAD>0)
398  for(int px=bx-MAXRAD; px<=bx+MAXRAD; px++) {
399  if(px>=0 && px<=m_BinsX) {
400  for(int py=by-MAXRAD; py<=by+MAXRAD; py++) {
401  bool culled;
402  int index = getBindex(px,py,culled);
403  if(!culled)
404  m_Bins[index].push_back(*model);
405  }
406  }
407  }
408 #else
409  bool culled;
410  int index = getBindex(bx,by,culled);
411  //if(!culled)
412  m_Bins[index].push_back(*model);
413 #endif
414 #undef MAXRAD
415  }
416  return true;
417 }
418 
420 {
421  m_Clusters.clear();
422  m_NClusters = 0;
423  if(!buildBins()) return 0;
424  list<Model*>::iterator model = m_Population.begin();
425  float cqth = (*model)->getQualityOfFit()*getSearchPara().m_ClusterTH;
426  float m_MergeDistMM = getSearchPara().m_ClusterMeltDist;
427  float m_MergeDist;
429  m_MergeDist = m_Representative.getDataScale()*m_MergeDistMM;
430  else m_MergeDist = m_MergeDistMM*100;
431  int nmelt = 0, nmerge = 0;
432  int maxclusters = (int)getSearchPara().m_NClusters;
433  if(maxclusters == 0) maxclusters = numeric_limits<int>::max();
434  while(model != m_Population.end()
435  && (*model)->getQualityOfFit()>cqth
436  && m_NClusters < maxclusters)
437  {
438  if(!(*model)->hasFlags(Model::ST_MEMBER)) {
439 //create new cluster from model
440  m_Clusters.push_back(MBin());
441  m_CurCluster = &m_Clusters.back();
442  m_CurCluster->push_back(*model);
443  (*model)->setFlags(Model::ST_MEMBER);
444  PropVec cprop = (*model)->getPropertiesMM();
445  float mdrot = M_PI*getSearchPara().m_ClusterDDir;
446  float mdscale = getSearchPara().m_ClusterDScale;
447  float mdpos = getPropScale(cprop)*getSearchPara().m_ClusterDPos;
448  m_NClusters++;
449 //scan bins for other cluster members
450  Point c = (*model)->getCenter();
451  int bx = (int)(c.x/m_BinDist);
452  int by = (int)(c.y/m_BinDist);
453  int binradius = (int)ceil(mdpos/m_BinDist);
454  for(int px=bx-binradius; px<=bx+binradius; px++) {
455  if(px>=0 && px<=m_BinsX) {
456  for(int py=by-binradius; py<=by+binradius; py++) {
457  bool culled;
458  int index = getBindex(px,py,culled);
459  if(!culled) {
460  MBin::iterator be = m_Bins[index].begin();
461  while(be != m_Bins[index].end()) {
462  MBin::iterator nextbe = be;
463  nextbe++;
464  if(!(*be)->hasFlags(Model::ST_MEMBER)) {
465  PropVec prop = (*be)->getPropertiesMM();
466  //PropVec pdiff = getPropTF(cprop, prop);
467  float dpos = (getPropPos(cprop)-
468  getPropPos(prop)).norm();
469  float drot = mapAnglePI(getPropDir(cprop)-
470  getPropDir(prop));
471  drot = fabs(drot);
472  float dscale = getPropScale(prop)/
473  getPropScale(cprop);
474  if(dscale>1) dscale = 1-1/dscale;
475  else dscale = 1-dscale;
476  if(dpos < mdpos && drot < mdrot &&
477  dscale < mdscale) {
478  if(dpos < m_MergeDistMM &&
479  (*model)->distance(
480  **be,Model::DIST_CPOINTS)
481  < m_MergeDist)
482  {
483  //too close --> melt
484  (*model)->mergeModel(**be);
485  nmelt++;
486  } else {
487  m_CurCluster->push_back(*be);
488  nmerge++;
489  }
490  (*be)->setFlags(Model::ST_MEMBER);
491  m_Bins[index].erase(be);
492  }
493  } else m_Bins[index].erase(be);
494  be = nextbe;
495  }
496  }
497  }
498  }
499  }
500 // DUMP(cprop);
501 // DUMP((*model)->getQualityOfFit());
502 // DUMP(m_CurCluster->size());
503  }
504  model++;
505  }
506 // DUMP(nmelt);
507 // DUMP(m_MergeDist);
508 // DUMP(nmerge);
509 // DUMP(m_NClusters);
510  return m_NClusters;
511 }
512 
514 {
515  dword m_NBinWinners = 1;
516  for(list< MBin >::iterator cluster = m_Clusters.begin();
517  cluster != m_Clusters.end(); cluster++) {
518  if(!cluster->empty()) {
519  MBin::iterator crep = cluster->begin();
520 //select winners
521  if(!(*crep)->hasFlags(Model::ST_DEL)) {
522  (*crep)->setOldState(false);
523  if(!(*crep)->isWinner()) {
524 // float time = m_Time;
525 // if((*crep)->m_TimeStamp[Model::TS_WIN]!=0)
526 // time = (*crep)->m_TimeStamp[Model::TS_WIN];
527  (*crep)->setWinner(true); //, time);
528  }
529  (*crep)->setLooser(false);
530  crep++;
531  } else TRACE("DELETED CLUSTER WINNER????????");
532 //select rest as loosers
533  while(crep != cluster->end()) {
534  //if((*crep)->isOldState()) {
535  (*crep)->setOldState(false);
536  if((*crep)->isWinner()) (*crep)->setWinner(false);
537  if(!(*crep)->isLooser()) {
538  (*crep)->setLooser(true, m_Time);
539  }
540  crep++;
541  }
542  }
543  } // for each cluster
544 }
545 
547 {
548 //remove loosers -- no, just set flags properly
549  int killcount = 0;
550  int wincount = 0;
551  int mergekill=0;
552  int lowkill=0;
553  Model *prep = *m_Population.begin();
554  m_AvgWinner = 0.f;
555  m_StdWinner = 0.f;
556  m_MinModel = m_MaxModel = prep->getProperties();
557  list<Model*>::iterator model = m_Population.begin();
558  while(model != m_Population.end())
559  {
560  list<Model*>::iterator nm = model; nm++;
561  if((*model)->hasFlags(Model::ST_NODEL)) {
562  (*model)->setFlags(Model::ST_WINNER|Model::ST_MEMBER);
563  (*model)->unsetFlags(Model::ST_LOOSER|Model::ST_OLDSTATE
564  |Model::ST_DEL);
565  }
566  if(!(*model)->hasFlags(Model::ST_MEMBER)) {
567  remove(model);
568  lowkill++;
569  } else if((*model)->hasFlags(Model::ST_DEL)) {
570  //(*model)->unsetFlags(Model::ST_DEL);
571  remove(model);
572  mergekill++;
573  } else {
574  m_MinModel.clampUB((*model)->getProperties());
575  m_MaxModel.clampLB((*model)->getProperties());
576  if((*model)->isOldState()) {
577  (*model)->unsetFlags(Model::ST_WINNER|Model::ST_LOOSER
579  //(*model)->m_TimeStamp[Model::TS_WIN] = 0.0;
580  } else if((*model)->isWinner()) {
581  if(prep->getQualityOfFit() < (*model)->getQualityOfFit())
582  prep = *model;
583  PropVec winprop = (*model)->getProperties();
584  m_AvgWinner += winprop;
585  m_StdWinner += (winprop *= winprop);
586  wincount++;
587  } else { //if((*model)->isLooser()) {
588  if(!(*model)->isLooser())
589  (*model)->setLooser(true, m_Time);
590  //(*model)->m_TimeStamp[Model::TS_WIN] = 0.0;
591  killcount++;
592  }
593  }
594  model = nm;
595  }
596  m_Representative = *prep;
597  if(!wincount) {
599  m_StdWinner = 0.f;
600  } else {
601  m_AvgWinner /= (float)(wincount);
602  m_StdWinner /= (float)(wincount);
603  DUMP(m_AvgWinner);
604  DUMP(m_StdWinner);
607  }
608  DUMP(mergekill);
609  DUMP(lowkill);
610  cout << "representative age: "
611  << m_Time-m_Representative.m_TimeStamp << " s" //[Model::TS_WIN]
612  << " (search time "<<m_Time<<" s)"<<endl;
613  cout << killcount<<" loosers and " << wincount << " winners."<<endl;
614 }
615 
617 {
620  for(list<Model*>::iterator model = m_Population.begin();
621  model != m_Population.end(); model++)
622  {
623  (*model)->reattachSensors();
624  }
625 }
626 
627 int Searcher::distribute(int n, float qth, bool count)
628 /* int n=-1, float qth=0, bool count=false) */
629 {
630  //this function is unused
631  if(m_EMap.getRepresentative().getNNodes() == 0) return -1;
632  else if(m_Representative.getNNodes() == 0) {
635  m_StdWinner = 0.f;
636  }
637  for(int i=0; i<n; i++) {
638  Model *newmod = m_EMap.generateInstance();
639  if(newmod->getQualityOfFit() < qth) {
640  delete newmod;
641  } else {
642  //newmod->m_TimeStamp = m_Time; //[Model::TS_CREATE]
643  add(newmod);
644  }
645  }
646  return n;
647 }
648 
649 void Searcher::getQualityRange(float &lqof, float &hqof,
650  float shapeweight) const
651 {
652  if(m_Population.empty()) {
653  lqof = hqof = 0;
654  return;
655  }
656  bool cw = (shapeweight!=-1);
657  if(cw) (*m_Population.begin())->setShapeWeight(shapeweight);
658  lqof=hqof=(*m_Population.begin())->getQualityOfFit();
659  for(list<Model*>::const_iterator m = m_Population.begin();
660  m!=m_Population.end(); m++)
661  {
662  if(cw) (*m)->setShapeWeight(shapeweight);
663  if((*m)->getQualityOfFit()>hqof) hqof=(*m)->getQualityOfFit();
664  if((*m)->getQualityOfFit()<lqof) lqof=(*m)->getQualityOfFit();
665  }
666 }
667 
669 {
670  map<dword,Winner>::const_iterator wi = m_Winners.find(id);
671  if(wi == m_Winners.end()) return NULL;
672  else return &wi->second;
673 }
674 
675 std::map<dword,Winner>& Searcher::updateWinList()
676 {
677  m_Winners.clear();
678  for(list<Model*>::iterator m = m_Population.begin();
679  m!=m_Population.end(); m++)
680  {
681  if((*m)->isWinner())
682  m_Winners[(*m)->getID()] = Winner(*m);
683  }
684  return m_Winners;
685 }
686 
687 void Searcher::draw() const
688 {
689  glLineWidth(1.0f);
690  for(list<Model*>::const_iterator m = m_Population.begin();
691  m!=m_Population.end(); m++)
692  {
693  if((*m)->isWinner()) {
694  glColor4f(0.1,0.9,0.0,0.7);
695  } else if((*m)->isLooser()) {
696  glColor4f(0.0,0.0,1.0,0.3);
697  } else {
698  glColor4f(0.9,0.9,0.0,0.3);
699  }
700  (*m)->draw();
701  }
702  glLineWidth(3.0f);
703  glColor4f(0.1,0.9,0.0,1.0);
704  for(list<Model*>::const_iterator m = m_Population.begin();
705  m!=m_Population.end(); m++)
706  {
707  if((*m)->isWinner())// && (m_Time-(*m)->m_TimeStamp[Model::TS_WIN])>6)
708  (*m)->draw();
709  }
710  if(!m_Winners.empty()) {
711  glLineWidth(3.0f);
712  glColor4f(1.0f, 0.0f, 0.5f,1.0f);
714  glLineWidth(1.0f);
715  }
716 }
717 
718 void Searcher::startSearch(bool dostart)
719 {
720  if(dostart) {
721  cout << "starting searcher..." << endl;
722  clear();
723  m_Mode = MODE_RUN;
724  updateWinList();
725  } else m_Mode = MODE_PAUSE;
726 }
727 
728 bool Searcher::triggerTest(int mx, int my, int what)
729 {
730  switch(what)
731  {
732  case KEY_r:
733  clear();
734  break;
735  case KEY_s:
736  if(m_Mode == MODE_PAUSE || m_Mode == MODE_DONE) {
737  m_Mode = MODE_RUN;
738  cout << "run" << endl;
739  } else {
740  m_Mode = MODE_PAUSE;
741  cout << "pause" << endl;
742  }
743  break;
744  case KEY_h:
745  cout << m_Representative.getName() <<
747  ? "is done " : "is busy ") << m_EMap.m_Integral << endl;
748  m_Mode = MODE_PAUSE;
749  cout << "now set to rest" << endl;
750  break;
751  case KEY_w:
752  {
753  list<Model*>::iterator model = m_Population.begin();
754  while(model != m_Population.end())
755  {
756  list<Model*>::iterator nm = model; nm++;
757  if(!(*model)->isWinner()) {
758  remove(model);
759  } else {
760  cout << "winner at " << (*model)->getCenter() << " age "
761  << m_Time-(*model)->m_TimeStamp<<" s "
762  << "quality= " << (*model)->getQualityOfFit()
763  << " nmerges = " << (*model)->getInstCount()
764  << " ID = " << (*model)->getID()
765  << endl;
766  }
767  model = nm;
768  }
769  }
770  break;
771  case KEY_F4:
772  {
773  float lqof,hqof;
774  getQualityRange(lqof,hqof);
775  float qth = (lqof+hqof)*0.5;
776  list<Model*>::iterator model = m_Population.begin();
777  while(model != m_Population.end())
778  {
779  list<Model*>::iterator nm = model; nm++;
780  if((*model)->getQualityOfFit() < qth) {
781  remove(model);
782  }
783  model = nm;
784  }
785  }
786  break;
787  default:
788  return false;
789  }
790  updateWinList();
791  return true;
792 }
793 
794 //----------------------------------------------------------------------------
796 
798 {
799  m_EvolveCycle = SRCH_CYCLE_T;
800 
801  m_MaxPop = SRCH_MAXPOP;
802  m_NSpawns = SRCH_NEW_SPAWNS;
803  m_NSpawnsTHRed = SRCH_NEW_SPAWNS_THRED;
804 
806  m_ClusterTH = SRCH_CLUSTERTH;
807  m_ClusterDPos = SRCH_CLUSTERDPOS;
808  m_ClusterDScale = SRCH_CLUSTERDSCALE;
809  m_ClusterDDir = SRCH_CLUSTERDDIR;
810  m_ClusterMeltDist = SRCH_CLUSTERDMELT;
811  m_RelBinDist = SRCH_RELBINDIST;
812 
814  m_MutateHL = SRCH_MUTATE_HL;
815  m_MutateSpawns = SRCH_MUTATE_SPAWNS;
816  m_MutateTHRed = SRCH_MUTATE_THRED;
817  m_MutatePDir = SRCH_MUTATE_PDIR;
818  m_MutatePPos = SRCH_MUTATE_PPOS;
819  m_MutatePNoise = SRCH_MUTATE_PNOISE;
820  m_MutateNoiseRate = SRCH_MUTATE_NOISERATE;
821  m_MutatePProp = SRCH_MUTATE_PPROP;
822  m_MutatePropRate = SRCH_MUTATE_PROPRATE;
823  m_RatingTH = SRCH_RATINGTH;
824  m_ScaleStd = SRCH_SCALESTD;
825  m_PCTH = PARA_PCTH;
826  m_PDist = PARA_PDIST;
827  m_MaxShoot = PARA_MAXSHOOT;
828 
830 }
831 
832 ostream& SearcherParams::write(ostream& os, bool showcomment) const
833 {
834  os << "searcher" << endl;
835  if(m_EvolveCycle != SRCH_CYCLE_T)
836  os<<" evolvecycle "<<m_EvolveCycle<<endl;
837  else if(showcomment) os<<" # evolvecycle "<<m_EvolveCycle<<endl;
838  if(m_MaxPop != SRCH_MAXPOP)
839  os<<" maxpop "<< m_MaxPop<<endl;
840  else if(showcomment) os<<" # maxpop "<<m_MaxPop<<endl;
841  if(m_NSpawns != SRCH_NEW_SPAWNS)
842  os<<" nspawns "<< m_NSpawns<<endl;
843  else if(showcomment) os<<" # nspawns "<<m_NSpawns<<endl;
844  if(m_NSpawnsTHRed != SRCH_NEW_SPAWNS_THRED)
845  os<<" nspawnsthred "<< m_NSpawnsTHRed<<endl;
846  else if(showcomment) os<<" # nspawnsthred "<<m_NSpawnsTHRed<<endl;
848  os<<" nclusters "<< m_NClusters<<endl;
849  else if(showcomment) os<<" # nclusters "<<m_NClusters<<endl;
850  if(m_ClusterTH != SRCH_CLUSTERTH)
851  os<<" clusterth "<< m_ClusterTH<<endl;
852  else if(showcomment) os<<" # clusterth "<<m_ClusterTH<<endl;
853  if(m_ClusterDPos != SRCH_CLUSTERDPOS)
854  os<<" clusterdpos "<< m_ClusterDPos<<endl;
855  else if(showcomment) os<<" # clusterdpos "<<m_ClusterDPos<<endl;
856  if(m_ClusterDScale != SRCH_CLUSTERDSCALE)
857  os<<" clusterdscale "<< m_ClusterDScale<<endl;
858  else if(showcomment) os<<" # clusterdscale "<<m_ClusterDScale<<endl;
859  if(m_ClusterDDir != SRCH_CLUSTERDDIR)
860  os<<" clusterddir "<< m_ClusterDDir<<endl;
861  else if(showcomment) os<<" # clusterddir "<<m_ClusterDDir<<endl;
862  if(m_ClusterMeltDist != SRCH_CLUSTERDMELT)
863  os<<" clustermeltdist "<< m_ClusterMeltDist<<endl;
864  else if(showcomment) os<<" # clustermeltdist "<<m_ClusterMeltDist<<endl;
865  if(m_RelBinDist != SRCH_RELBINDIST)
866  os<<" relbindist "<< m_RelBinDist<<endl;
867  else if(showcomment) os<<" # relbindist "<<m_RelBinDist<<endl;
869  os<<" mutaterate "<< m_MutateRate<<endl;
870  else if(showcomment) os<<" # mutaterate "<<m_MutateRate<<endl;
871  if(m_MutateHL != SRCH_MUTATE_HL)
872  os<<" mutatehl "<< m_MutateHL<<endl;
873  else if(showcomment) os<<" # mutatehl "<<m_MutateHL<<endl;
874  if(m_MutateSpawns != SRCH_MUTATE_SPAWNS)
875  os<<" mutatespawns "<< m_MutateSpawns<<endl;
876  else if(showcomment) os<<" # mutatespawns "<<m_MutateSpawns<<endl;
877  if(m_MutateTHRed != SRCH_MUTATE_THRED)
878  os<<" mutatethred "<< m_MutateTHRed<<endl;
879  else if(showcomment) os<<" # mutatethred "<<m_MutateTHRed<<endl;
880  if(m_MutatePDir != SRCH_MUTATE_PDIR)
881  os<<" mutatepdir "<< m_MutatePDir<<endl;
882  else if(showcomment) os<<" # mutatepdir "<<m_MutatePDir<<endl;
883  if(m_MutatePPos != SRCH_MUTATE_PPOS)
884  os<<" mutateppos "<< m_MutatePPos<<endl;
885  else if(showcomment) os<<" # mutateppos "<<m_MutatePPos<<endl;
886  if(m_MutatePNoise != SRCH_MUTATE_PNOISE)
887  os<<" mutatepnoise "<< m_MutatePNoise<<endl;
888  else if(showcomment) os<<" # mutatepnoise "<<m_MutatePNoise<<endl;
889  if(m_MutateNoiseRate != SRCH_MUTATE_NOISERATE)
890  os<<" mutatenoiserate "<< m_MutateNoiseRate<<endl;
891  else if(showcomment) os<<" # mutatenoiserate "<<m_MutateNoiseRate<<endl;
892  if(m_MutatePProp != SRCH_MUTATE_PPROP)
893  os<<" mutatepprop "<< m_MutatePProp<<endl;
894  else if(showcomment) os<<" # mutatepprop "<<m_MutatePProp<<endl;
895  if(m_MutatePropRate != SRCH_MUTATE_PROPRATE)
896  os<<" mutateproprate "<< m_MutatePropRate<<endl;
897  else if(showcomment) os<<" # mutateproprate "<<m_MutatePropRate<<endl;
899  os<<" shapeweight "<< m_ShapeWeight<<endl;
900  else if(showcomment) os<<" # shapeweight "<<m_ShapeWeight<<endl;
901  if(m_ParaSolver != PARA_SOLVER)
902  os<<" solver "<< m_ParaSolver<<endl;
903  else if(showcomment) os<<" # solver "<<m_ParaSolver<<endl;
904  if(m_RatingTH != SRCH_RATINGTH)
905  os<<" ratingth "<< m_RatingTH<<endl;
906  else if(showcomment) os<<" # ratingth "<<m_RatingTH<<endl;
907  if(m_PCTH != PARA_PCTH)
908  os<<" pcth "<< m_PCTH<<endl;
909  else if(showcomment) os<<" # pcth "<<m_PCTH<<endl;
910  if(m_PDist != PARA_PDIST)
911  os<<" pdist "<< m_PDist<<endl;
912  else if(showcomment) os<<" # pdist "<<m_PDist<<endl;
913  if(m_ScaleStd != SRCH_SCALESTD)
914  os<<" scalestd "<< m_ScaleStd<<endl;
915  else if(showcomment) os<<" # scalestd "<<m_ScaleStd<<endl;
916  if(m_MaxShoot != PARA_MAXSHOOT)
917  os<<" maxshoot "<< m_MaxShoot <<endl;
918  else if(showcomment) os<<" # maxshoot "<<m_MaxShoot<<endl;
919  //if( != ) os << " = " << << endl;
920  os << "end" << endl;
921  return os;
922 }
923 
925 {
926  bool issearcher = false, goon=true;
927  while(goon && is.getNextLine()) {
928  if(is.getKey() == "searcher") issearcher = true;
929  else if(!issearcher) {
930  is.pushLine();
931  return false;
932  } else if(is.getKey() == "evolvecycle") {
933  fromString(is.getValue(), m_EvolveCycle);
934  } else if(is.getKey() == "maxpop") {
935  fromString(is.getValue(), m_MaxPop);
936  } else if(is.getKey() == "nspawns") {
937  fromString(is.getValue(), m_NSpawns);
938  } else if(is.getKey() == "nspawnsthred") {
939  fromString(is.getValue(), m_NSpawnsTHRed);
940  } else if(is.getKey() == "nclusters") {
942  } else if(is.getKey() == "clusterth") {
943  fromString(is.getValue(), m_ClusterTH);
944  } else if(is.getKey() == "clusterdpos") {
945  fromString(is.getValue(), m_ClusterDPos);
946  } else if(is.getKey() == "clusterdscale") {
947  fromString(is.getValue(), m_ClusterDScale);
948  } else if(is.getKey() == "clusterddir") {
949  fromString(is.getValue(), m_ClusterDDir);
950  } else if(is.getKey() == "clustermeltdist") {
951  fromString(is.getValue(), m_ClusterMeltDist);
952  } else if(is.getKey() == "relbindist") {
953  fromString(is.getValue(), m_RelBinDist);
954  } else if(is.getKey() == "mutaterate") {
956  } else if(is.getKey() == "mutatehl") {
957  fromString(is.getValue(), m_MutateHL);
958  } else if(is.getKey() == "mutatespawns") {
959  fromString(is.getValue(), m_MutateSpawns);
960  } else if(is.getKey() == "mutatethred") {
961  fromString(is.getValue(), m_MutateTHRed);
962  } else if(is.getKey() == "mutatepdir") {
963  fromString(is.getValue(), m_MutatePDir);
964  } else if(is.getKey() == "mutateppos") {
965  fromString(is.getValue(), m_MutatePPos);
966  } else if(is.getKey() == "mutatepnoise") {
967  fromString(is.getValue(), m_MutatePNoise);
968  } else if(is.getKey() == "mutatenoiserate") {
969  fromString(is.getValue(), m_MutateNoiseRate);
970  } else if(is.getKey() == "mutatepprop") {
971  fromString(is.getValue(), m_MutatePProp);
972  } else if(is.getKey() == "mutateproprate") {
973  fromString(is.getValue(), m_MutatePropRate);
974  } else if(is.getKey() == "shapeweight") {
976  } else if(is.getKey() == "solver") {
977  fromString(is.getValue(), m_ParaSolver);
978  } else if(is.getKey() == "ratingth") {
979  fromString(is.getValue(), m_RatingTH);
980  } else if(is.getKey() == "pcth") {
981  fromString(is.getValue(), m_PCTH);
982  } else if(is.getKey() == "pdist") {
983  fromString(is.getValue(), m_PDist);
984  } else if(is.getKey() == "scalestd") {
985  fromString(is.getValue(), m_ScaleStd);
986  } else if(is.getKey() == "maxshoot") {
987  fromString(is.getValue(), m_MaxShoot);
988  } else if(is.getKey() == "end") goon = false;
989  }
990  return true;
991 }
dword m_MutateSpawns
number of spawns when mutating a shape
Definition: Searcher.h:177
float m_RelBinDist
distance of bins relative to representative radius
Definition: Searcher.h:170
#define SRCH_CLUSTERDPOS
Definition: Searcher.cpp:18
float m_Integral
Definition: ExpMap.h:67
dword m_Mode
Definition: Searcher.h:80
float m_ClusterMeltDist
maximum Hausdorff distance in mm for melting two shapes
Definition: Searcher.h:169
std::list< Model * >::iterator & remove(std::list< Model * >::iterator &mi)
Definition: Searcher.cpp:152
void startSearch(bool dostart=true)
Definition: Searcher.cpp:718
float m_ShapeWeight
influence of shape deformation on QOF
Definition: Searcher.h:185
#define NULL
Definition: simpletypes.h:9
std::vector< MBin > m_Bins
Definition: Searcher.h:71
float getGeneration(const Model *model) const
Definition: Searcher.cpp:303
#define DUMP(expr)
Definition: common.h:16
bool buildBins(float bindist=0.f)
Definition: Searcher.cpp:361
void setExpectationMap(const ExpectationMap &em)
Definition: Searcher.cpp:346
float getQualityOfFit() const
Definition: Model.cpp:1204
dword m_NextWinID
Definition: Searcher.h:84
T & fromString(const std::string &str, T &v)
Definition: utils.h:67
#define frand(max)
Definition: mathutil.h:48
void clear(bool oldonly=false)
Definition: ExpMap.cpp:141
#define SRCH_CLUSTERTH
Definition: Searcher.cpp:17
const PropVec & getProperties() const
Definition: Model.cpp:1263
float getStdRadius(const Point &center) const
Returns mean squared distance from centroid.
Definition: Model.cpp:1018
Point m_PosMax
Definition: Searcher.h:78
void pushRotate(const Point &c, float angle)
Definition: Model.cpp:954
#define PARA_PDIST
Definition: Searcher.cpp:40
bool triggerTest(int mx, int my, int what)
Definition: Searcher.cpp:728
Model * generateInstance() const
Definition: ExpMap.cpp:184
void setShapeWeight(float shapeweight)
Definition: Searcher.h:46
PropVec m_MaxModel
Definition: Searcher.h:67
void adaptProportion(float ratio)
overall rest lengths sum is adapted to overall edge lengths by ratio
Definition: Model.cpp:1164
void setID(dword id)
Definition: Model.h:84
#define PARA_SOLVER
Definition: Searcher.cpp:41
float y
Definition: Point.h:224
Point2D getPropPos(const PropVec &prop)
Definition: PropVec.h:13
#define TRACE(msg)
Definition: common.h:14
PropVec m_MinModel
Definition: Searcher.h:67
float m_BinDist
Definition: Searcher.h:73
STL namespace.
static void correctLBUB(PropVec &lb, PropVec &ub)
Definition: ExpMap.cpp:193
void getQualityRange(float &lqof, float &hqof, float shapeweight=-1) const
Definition: Searcher.cpp:649
float m_MutateRate
initial mutation rate
Definition: Searcher.h:173
float getPropScale(const PropVec &prop)
Definition: PropVec.h:19
float ratePropVec(const PropVec &prop, Winner *winner=NULL) const
Definition: ExpMap.cpp:107
Point m_PosRange
Definition: Searcher.h:78
bool read(ParseFile &is)
Definition: Searcher.cpp:924
int m_BinsX
Definition: Searcher.h:72
const std::string & getValue() const
Definition: ParseFile.h:57
float m_ShapeWeight
Definition: Searcher.h:85
float m_ClusterDScale
maximum relative difference in scale to cluster representative
Definition: Searcher.h:167
float m_ClusterTH
least quality of cluster relative to the best
Definition: Searcher.h:165
#define SRCH_RATINGTH
Definition: Searcher.cpp:35
dword m_NSpawns
number of new spawned shapes at each cycle
Definition: Searcher.h:161
float m_NSpawnsTHRed
threshold reduction factor for new spawns
Definition: Searcher.h:162
static SearcherParams global
Definition: Searcher.h:159
void evolve()
Definition: Searcher.cpp:163
const float m_MaxD
Definition: Searcher.cpp:72
void reattachSensors()
Definition: Searcher.cpp:616
float m_Time
Definition: Searcher.h:77
PropVec m_StdWinner
Definition: Searcher.h:66
dword & getFlags()
Definition: Model.h:196
#define FRAND1
Definition: mathutil.h:49
#define SRCH_MAXPOP
Definition: Searcher.cpp:12
#define SRCH_CLUSTERDMELT
Definition: Searcher.cpp:19
dword m_NClusters
number of clusters (winners) determined at each cycle
Definition: Searcher.h:164
#define SRCH_CLUSTERDSCALE
Definition: Searcher.cpp:20
std::ostream & write(std::ostream &os, bool showcomment=false) const
Definition: Searcher.cpp:832
~Searcher()
Definition: Searcher.cpp:90
PropVec & setPropDir(PropVec &prop, float dir)
Definition: PropVec.h:28
#define PARA_MAXSHOOT
Definition: Searcher.cpp:42
void reattachSensors()
get sensors from sensor collection
Definition: Model.cpp:616
int getNNodes() const
Definition: Model.h:77
#define SRCH_MUTATE_PROPRATE
Definition: Searcher.cpp:33
bool step(float dt)
Definition: Searcher.cpp:288
PropVec & setPropPos(PropVec &prop, const Point2D &p)
Definition: PropVec.h:16
void clear()
Definition: Searcher.cpp:126
VT & clampUB(const VT &ub)
Definition: VVector.h:247
#define SRCH_NEW_SPAWNS_THRED
Definition: Searcher.cpp:16
float sum() const
returns 1-norm
Definition: Point.h:160
void setUB(const PropVec &ub)
Definition: ExpMap.h:87
float m_MutateTHRed
threshold reduction factor for mutated spawns
Definition: Searcher.h:175
float getPropDir(const PropVec &prop)
Definition: PropVec.h:25
#define SRCH_MUTATE_PNOISE
Definition: Searcher.cpp:30
std::map< dword, Winner > m_Winners
Definition: Searcher.h:83
bool operator()(Model *const &lhs, Model *const &rhs) const
Definition: Searcher.cpp:49
void draw() const
Definition: Searcher.cpp:687
int getBindex(int bx, int by, bool &culled=*((bool *) NULL)) const
Definition: Searcher.h:104
int distribute(int n=-1, float qth=0, bool count=false)
Definition: Searcher.cpp:627
const std::string & getKey() const
Definition: ParseFile.h:56
const Winner * getWinner(dword id) const
Definition: Searcher.cpp:668
#define M_PI
Definition: mathutil.h:9
Definition: ExpMap.h:10
Definition: Model.h:33
NMerge(float maxd, enum Model::DistType dtype=Model::DIST_XYS)
Definition: Searcher.cpp:58
VT & sqrtEach()
Definition: VVector.h:215
#define SRCH_SCALESTD
Definition: Searcher.cpp:37
float m_EvolveCycle
time in seconds for one evolution cycle
Definition: Searcher.h:172
#define SRCH_MUTATE_PPOS
Definition: Searcher.cpp:29
const PropVec & getLB() const
Definition: ExpMap.h:86
Searcher()
Definition: Searcher.cpp:76
#define SRCH_MUTATE_RATE
Definition: Searcher.cpp:26
SearcherParams & getSearchPara()
Definition: Searcher.h:194
std::list< Model * > m_Population
Definition: Searcher.h:69
Point m_PosMin
Definition: Searcher.h:78
unsigned long dword
Definition: simpletypes.h:6
float updateIntegral()
Definition: ExpMap.cpp:167
void adaptProperties(const PropVec &prop)
Definition: Model.cpp:1249
MBin * m_CurCluster
Definition: Searcher.h:76
VT & clampLB(const VT &lb)
Definition: VVector.h:241
void selectWinners()
Definition: Searcher.cpp:513
#define SRCH_CYCLE_T
Definition: Searcher.cpp:11
Model m_Representative
Definition: Searcher.h:65
int m_NClusters
Definition: Searcher.h:75
Model & getRepresentative()
Definition: ExpMap.h:156
#define PARA_PCTH
Definition: Searcher.cpp:39
void draw(bool drawPoints=false) const
Draw using OpenGL.
Definition: Model.cpp:542
#define SRCH_SHAPEWEIGHT
Definition: Searcher.cpp:36
int buildClusters()
Definition: Searcher.cpp:419
#define SRCH_MUTATE_HL
Definition: Searcher.cpp:27
ExpectationMap m_EMap
Definition: Searcher.h:68
int m_BinsY
Definition: Searcher.h:72
float distance(const Model &rhs, enum Model::DistType kind=DIST_POINTS) const
Definition: Model.cpp:1043
std::list< MBin > m_Clusters
Definition: Searcher.h:74
#define SRCH_MUTATE_NOISERATE
Definition: Searcher.cpp:31
dword m_WinnerID
Definition: ExpMap.h:37
const PropVec & getUB() const
Definition: ExpMap.h:85
int add(Model *m)
Definition: Searcher.cpp:143
float m_EvolveT
Definition: Searcher.h:81
#define SRCH_RELBINDIST
Definition: Searcher.cpp:22
int m_NPop
Definition: Searcher.h:70
#define SRCH_MUTATE_SPAWNS
Definition: Searcher.cpp:24
void cleanFlags()
Definition: Searcher.cpp:546
float m_ClusterDDir
maximum difference in direction in $$
Definition: Searcher.h:168
float m_ClusterDPos
maximum distance of shapes in a cluster (relative to shape radius)
Definition: Searcher.h:166
Searcher & operator=(const Searcher &rhs)
Definition: Searcher.cpp:95
void setInstCount(dword ic)
Definition: Model.h:223
dword m_MaxPop
maximum population count
Definition: Searcher.h:163
void clear()
remove and destroy all geometry information (nodes and edges)
Definition: Model.cpp:95
Definition: Point.h:16
#define SRCH_NCLUSTERS
Definition: Searcher.cpp:14
float mapAnglePI(float a)
Definition: mathutil.h:107
DistType
Definition: Model.h:40
PropVec m_AvgWinner
Definition: Searcher.h:66
#define SRCH_NEW_SPAWNS
Definition: Searcher.cpp:15
const std::string & getName() const
Definition: Model.h:81
float m_MutateRate
Definition: Searcher.h:82
Model & mutate(Model &model, float rate=1) const
Definition: Searcher.cpp:307
void pushLine(const std::string &line)
Definition: ParseFile.h:74
std::map< dword, Winner > & updateWinList()
Definition: Searcher.cpp:675
void addNoise(float r)
Definition: Model.cpp:901
#define SRCH_MUTATE_PPROP
Definition: Searcher.cpp:32
#define SRCH_MUTATE_PDIR
Definition: Searcher.cpp:28
float x
Definition: Point.h:224
dword getDataScale() const
Definition: Model.h:204
const bool getNextLine()
Definition: ParseFile.h:59
void setLB(const PropVec &lb)
Definition: ExpMap.h:88
#define SRCH_CLUSTERDDIR
Definition: Searcher.cpp:21
#define SRCH_MUTATE_THRED
Definition: Searcher.cpp:25
#define MAXRAD
float m_TimeStamp
time stamps (see. TTimeStamp)
Definition: Model.h:259
void push(const Point &t)
Definition: Model.cpp:931