Structural deformable models
StructTable.cpp
Go to the documentation of this file.
1 #include <fstream>
2 #include <iomanip>
3 #include <set>
4 #include <algorithm>
5 #include <iterator>
6 #include <fxkeys.h>
7 #include "Brain.h"
8 #include "DMatrix.h"
9 #include "DMatrixLinAlg.h"
10 #include "utils.h"
11 #include "StructTable.h"
12 #include "Searcher.h"
13 
14 using namespace std;
15 
16 //---------------------------------------------------------------------------
17 
18 StructTable::StructTable(Brain& brain, const string& filename)
19 {
20  m_TMarks.clear();
21  m_TMarks.resize(TM_LAST, 0.0f);
22  attachBrain(brain);
23  load(filename);
24 }
25 
27 {
28  clear();
29 }
30 
32 {
33  m_Structs.clear();
34  m_CurStruct.clear();
35  m_Time = 0;
36  m_State = 0;
37  m_TMarks.clear();
38  m_TMarks.resize(TM_LAST, 0.0f);
39  m_BestPath.clear();
40  m_Interpretations.clear();
41 }
42 
44 {
45  return m_Brain->getSensorData().shared_from_base<Dataset>();
46 }
47 
49 { return (SensorCollection*) &m_Brain->getSensors(); }
50 
52 {
53  for(map<string,MStructure>::iterator si = m_Structs.begin();
54  si != m_Structs.end(); si++)
55  {
56  si->second.getModel().reattachSensors();
57  }
58 }
59 
61 {
62  for(map<string,MStructure>::iterator si = m_Structs.begin();
63  si != m_Structs.end(); si++)
64  {
65  si->second.getModel().adaptDataScale();
66  }
67 }
68 
69 bool StructTable::load(const string& filename)
70 {
71  if(filename.empty()) return false;
72  cout << "loading " << filename << endl;
73  ParseFile is(filename);
74  if(is) m_FileName = filename;
75  return read(is);
76 }
77 
79 {
80  if(is) {
81  clear();
82  m_Path = is.getPath();
83  MStructure cstructure("", this);
84  while(is) {
85  if(cstructure.read(is)) {
86  if(cstructure) m_Structs[cstructure.getName()] = cstructure;
87  } else if(!readInterpreations(is))
88  is.setParseError(
89  string("error reading structure table. ") +
90  "(A structure has to begin with struct <name>)");
91  }
92  connectSubSuper();
93  evalRelations();
94  }
95  if(is.error()) { cerr << is.getErrorMsg() << endl; return false; }
96  return true;
97 }
98 
100 {
101  m_Interpretations.clear();
102  bool readon = true, allright = false;
103  while(is.getNextLine() && readon) {
104  if(is.getKey() == "interpretations") allright = true;
105  else if(!allright) { is.pushLine(); return false; }
106  else if(is.getKey() == "end") readon = false;
107  else {
108  set<string>& elements = m_Interpretations[is.getKey()];
109  istringstream slist(is.getValue());
110  slist >> ws;
111  while(slist) {
112  string structure; slist >> structure;
113  if(structure.empty()) break;
114  elements.insert(structure);
115  slist >> ws;
116  }
117  if(elements.empty())
118  is.setParseError("error reading structure interpretation");
119  }
120  }
121  return true;
122 }
123 
124 void StructTable::write(ostream &os) const
125 {
126  for(map<string,MStructure>::const_iterator si = m_Structs.begin();
127  si != m_Structs.end(); si++)
128  {
129  si->second.write(os);
130  }
131  if(!m_Interpretations.empty()) {
132  os << "interpretations" << endl;
133  for(map<string,set<string> >::const_iterator ip =
134  m_Interpretations.begin(); ip != m_Interpretations.end(); ip++)
135  {
136  os << " " << ip->first;
137  for(set<string>::const_iterator sp = ip->second.begin();
138  sp != ip->second.end(); sp++)
139  os << " " << *sp;
140  os << endl;
141  }
142  os << "end" << endl << endl;
143  }
144 }
145 
146 bool StructTable::hasStructure(const std::string& sname) const
147 {
148  return m_Structs.find(sname) != m_Structs.end();
149 }
150 
151 const MStructure& StructTable::getStructure(const std::string& sname) const
152 {
153  return m_Structs.find(sname)->second;
154 }
155 
157 {
158  static MStructure nostruc;
159  if(m_Structs.empty()) return nostruc;
160  if(m_CurStruct.empty()) {
161  m_CurStruct = m_Structs.begin()->first;
162  return m_Structs.begin()->second;
163  }
164  map<string,MStructure>::iterator st = m_Structs.find(m_CurStruct);
165  if(st == m_Structs.end()) {
166  m_CurStruct = m_Structs.begin()->first;
167  return m_Structs.begin()->second;
168  }
169  if(dir > 0) {
170  st++;
171  if(st == m_Structs.end()) {
172  if(wrap) st = m_Structs.begin();
173  else { m_CurStruct.clear(); return nostruc; }
174  }
175  m_CurStruct = st->first;
176  } else if(dir < 0) {
177  if(st == m_Structs.begin()) {
178  if(wrap) st = m_Structs.end();
179  else { m_CurStruct.clear(); return nostruc; }
180  }
181  st--;
182  m_CurStruct = st->first;
183  }
184  return st->second;
185 }
186 
188 {
189 // int ret = matlabCall(string("addpath ")+m_Path + ", antpca");
190 // DUMP(ret);
191  for(map<string,MStructure>::iterator si = m_Structs.begin();
192  si != m_Structs.end(); si++)
193  {
194  si->second.buildAllStats();
195  }
196  //rebuildExpMaps();
197 }
198 
200 {
201  for(map<string,MStructure>::iterator si = m_Structs.begin();
202  si != m_Structs.end(); si++)
203  si->second.rebuildExpMap();
204 }
205 
207 {
208  for(map<string,MStructure>::iterator si = m_Structs.begin();
209  si != m_Structs.end(); si++)
210  si->second.refSubSuper(true); // just clear super-list
211  for(map<string,MStructure>::iterator si = m_Structs.begin();
212  si != m_Structs.end(); si++)
213  si->second.refSubSuper(); // update super-list of substructs
214 }
215 
217 {
218  Point2D dir(0,0);
219  DMatrixf::iterator el = mat.getData().begin();
220  for(dword ind=0; ind<mat.size(); ind++, el++)
221  dir += Point2D(1,0).rotate(*el);
222  float avgdir = dir.angle();
223  el = mat.getData().begin();
224  for(dword ind=0; ind<mat.size(); ind++, el++)
225  *el = mapAnglePI(*el, avgdir);
226  return mat;
227 }
228 
229 bool StructTable::triggerTest(int mx, int my, int what)
230 {
231  switch(what)
232  {
233  case KEY_t:
234  rebuildExpMaps();
235  break;
236  case KEY_g:
237  evalRelations();
238  break;
239  case KEY_n:
240  {
241  for(map<string,MStructure>::iterator si = m_Structs.begin();
242  si != m_Structs.end(); si++)
243  si->second.buildMasterModel();
244  }
245  break;
246  case KEY_v:
247  {
248  findBestConnection();
249 // for(map<string,MStructure>::iterator si = m_Structs.begin();
250 // si != m_Structs.end(); si++)
251 // si->second.verifyWinnerRating();
252  }
253  break;
254  case KEY_c:
255  //m_TMarks[TM_TIMEOUT] = m_Time + 10;
256  m_State = m_State ^ ST_RESULT;
257  break;
258  case KEY_u:
259  cout << "starting structure search" << endl;
260  startSearch();
261  break;
262  case KEY_i:
263  cout << "stopping structure search" << endl;
264  startSearch(false);
265  break;
266  default:
267  {
268  if(what == KEY_h) {
269  m_State&=~ST_RUN;
270  } if(what == KEY_s) {
271  m_State^=ST_RUN;
272  } else if(what == KEY_r) {
273  m_Time=0;
274  m_TMarks[TM_UPDEM] = m_TMarks[TM_TIMEOUT] = 0;
275  m_BestPath.clear();
276  }
277  bool ret=false;
278  for(map<string,MStructure>::iterator si = m_Structs.begin();
279  si != m_Structs.end(); si++)
280  ret = si->second.m_Searcher.triggerTest(mx,my,what);
281  return ret;
282  }
283  }
284  return true;
285 }
286 
287 void StructTable::startSearch(bool dostart)
288 {
289  if(dostart) {
290  m_State|=ST_RUN;
291  m_State&=~(ST_DONE|ST_TIMEOUT);
292  m_Time=0;
293  m_TMarks[TM_UPDEM] = m_TMarks[TM_TIMEOUT] = 0;
294  m_BestPath.clear();
295  m_IPaths.clear();
296  } else m_State &= ~ST_RUN;
297  for(map<string,MStructure>::iterator si = m_Structs.begin();
298  si != m_Structs.end(); si++)
299  {
300  if(dostart) si->second.m_Searcher.clear();
301  si->second.m_Searcher.startSearch(dostart);
302  }
303 }
304 
306 {
307  bool dotimeout=false;
308  bool ret=true;
309  if((m_State&ST_DONE)) return true;
310  if((m_State&ST_RUN) == 0) return false;
311  if(m_Time == 0) {
312 //initialize
313  for(map<string,MStructure>::iterator si = m_Structs.begin();
314  si != m_Structs.end(); si++)
315  si->second.buildMasterModel();
316  m_TMarks[TM_TIMEOUT] = m_Time + getSearchPara().m_EvolveCycle*3000;
317  }
318  if(dotimeout && m_TMarks[TM_TIMEOUT] - m_Time <= 0) {
319 //finalize
320  m_State &= ~ST_RUN;
321  m_State |= ST_RESULT;
322  ret = false;
323  } else {
324  bool doupdate = m_TMarks[TM_UPDEM] - m_Time <= 0;
325  if(doupdate) { //pre update
326  rebuildExpMaps();
327  m_TMarks[TM_UPDEM] = m_Time + getSearchPara().m_EvolveCycle;
328  }
329  for(map<string,MStructure>::iterator si = m_Structs.begin();
330  si != m_Structs.end(); si++)
331  {
332  if(doupdate) si->second.m_Searcher.evolve();
333  ret &= si->second.stepSearch(dt);
334  }
335  if(doupdate) findBestConnection();
336  }
337  m_Time += dt;
338  if(ret) {
339  m_State |= ST_DONE;
340  cout << "search terminated after " << m_Time << " seconds." << endl;
341  }
342  return ret;
343 }
344 
345 bool StructTable::showNextIP(int dir) const
346 {
347  bool ret = true;
348  Interpretations::const_iterator cip = m_Interpretations.find(m_CurIP);
349  if(cip == m_Interpretations.end()) {
350  if(m_Interpretations.empty()) {
351  m_CurIP.clear();
352  return false;
353  }
354  cip = m_Interpretations.begin();
355  }
356  if(dir == 1) {
357  cip++;
358  if(cip==m_Interpretations.end()) {
359  cip = m_Interpretations.begin();
360  ret = false;
361  }
362  } else if(dir > 1) {
363  cip = m_Interpretations.end(); cip--;
364  } else if(dir == -1) {
365  if(cip==m_Interpretations.begin()) {
366  cip = m_Interpretations.end();
367  ret = false;
368  }
369  cip--;
370  } else if(dir < -1) {
371  cip = m_Interpretations.begin();
372  }
373  m_CurIP = cip->first;
374  return ret;
375 }
376 
377 void StructTable::draw() const
378 {
379  const string& ipname = getShownIP();
380  map<string,StructPath>::const_iterator spath = m_IPaths.find(ipname);
381  for(map<string,MStructure>::const_iterator si = m_Structs.begin();
382  si != m_Structs.end(); si++)
383  {
384  if((m_State & ST_RESULT) == 0) si->second.m_Searcher.draw();
385  if(spath != m_IPaths.end()) {
386  StructPath::const_iterator wi = spath->second.find(si->first);
387  if(wi != spath->second.end()) {
388  const Winner *nw = si->second.getWinner(wi->second);
389  if(nw && nw->m_Model) {
390  glColor3f(1,.1,0);
391  glLineWidth(4.0f);
392  nw->m_Model->draw();
393  }
394  }
395  }
396  }
397 }
398 
399 
401 {
402  if(m_Structs.empty()) return m_BestPath.m_Goodness;
403  m_BestPath.unprotectWinners(*this);
404  m_BestPath.clear();
405  for(map<string,MStructure>::iterator si = m_Structs.begin();
406  si != m_Structs.end(); si++)
407  {
408  si->second.verifyWinnerRating();
409  }
410 
411  m_IPaths.clear();
412  for(Interpretations::const_iterator ip=m_Interpretations.begin();
413  ip != m_Interpretations.end(); ip++)
414  { // for each interpretation
415  cout << "scanning interpretation " << ip->first << endl;
416  m_NodePaths.clear();
417  for(map<string,MStructure>::iterator si = m_Structs.begin();
418  si != m_Structs.end(); si++)
419  { // for each structure
420  MStructure& st = si->second;
421  StructPath bestpath;
422  const map<dword,Winner>& winners = st.getSearcher().getWinList();
423  for(map<dword,Winner>::const_iterator wi = winners.begin();
424  wi != winners.end(); wi++)
425  { // for each winner in current structure
426  StructPath path;
427  path.blockOtherPaths(ip->second, *this);
428  findBestConnection(path, wi->second);
429  if(path.m_Goodness > bestpath.m_Goodness)
430  {
431  bestpath = path;
432  }
433  }
434  if(bestpath.m_Goodness > m_IPaths[ip->first].m_Goodness)
435  {
436  m_IPaths[ip->first] = bestpath;
437  }
438  cout << " best cost for " << si->first << ": "
439  << bestpath.m_Goodness
440  << " (" << bestpath.getRelGoodness() << ") " << endl;
441  //<< " length: "<<bestpath.size()<<endl;
442  }
443  if(m_IPaths[ip->first].getRelGoodness() > m_BestPath.getRelGoodness())
444  {
445  m_BestPath = m_IPaths[ip->first];
446  m_BestIP = ip->first;
447  }
448  }
449  cout << "best interpretation is " << m_BestIP << endl;
450  m_BestPath.protectWinners(*this);
451  m_BestPath.print(cout, *this);
452 // DUMP(m_BestPath.m_Goodness);
453 // DUMP(m_BestPath.size());
454 // cout << "showing path" << endl;
455 // for(StructPath::const_iterator ps=m_BestPath.begin();
456 // ps != m_BestPath.end(); ps++)
457 // {
458 // cout << ps->first << ": " << ps->second.m_BestRating << endl;
459 // }
460  return m_BestPath.getRelGoodness();
461 }
462 
464  const Winner& winner) const
465 {
466  if(winner.m_WinnerID == Winner::WID_EMPTY) { TRACE0; return false; }
467  const string& csname = winner.m_StructName;
468  if(csname.empty()) { TRACE0; return false; }
469  if(path[csname] != Winner::WID_EMPTY) {
470  return false; // termination criterion
471  }
472  if(winner.m_WinnerID == Winner::WID_FRAME) {
473  path[csname] = winner.m_WinnerID;
474  return true; // confirm, but don't add goodness
475  }
476  NodePaths &np = m_NodePaths[csname];
477  NodePaths::const_iterator wpath = np.find(winner.m_WinnerID);
478  if(wpath != np.end()) { // we already have this path!
479  path.merge(wpath->second);
480  return true;
481  }
482  StructPath &bestpath = np[winner.m_WinnerID];
483  bestpath = path.branch();
484 
485  const MStructure& cstruct = getStructure(csname);
486  bestpath[csname] = winner.m_WinnerID;
487  bestpath.m_Goodness += cstruct.getWeight()
488  *winner.m_Model->getQualityOfFit();
489  //* cstruct.m_Searcher.relativeQOF(winner.m_Model->getQualityOfFit());
490  bestpath.m_Maxness += cstruct.getWeight();
491 
492  for(Winner::Ratings::const_iterator wr = winner.m_Ratings.begin();
493  wr != winner.m_Ratings.end(); wr++)
494  { // for each rating structure
495  map<string,MStructure>::const_iterator sti =
496  m_Structs.find(wr->first);
497  if(sti != m_Structs.end()) {
498  const MStructure& refstruct = sti->second;
499  const SubStructure& subs =
500  refstruct.m_SubStructures.find(csname)->second;
501  StructPath spath = bestpath;
502  for(map<dword,float>::const_iterator wi = wr->second.begin();
503  wi != wr->second.end(); wi++)
504  {
505  const Winner* nextWinner = refstruct.getWinner(wi->first);
506  StructPath cpath = spath;
507  if(nextWinner && wi->second > subs.m_RateTH) {
508  if(findBestConnection(cpath, *nextWinner)) {
509  cpath.m_Goodness += subs.m_RateWeight*wi->second;
510  cpath.m_Maxness += subs.m_RateWeight;
511  }
512  }
513  if(cpath.m_Goodness > bestpath.m_Goodness)
514  bestpath = cpath;
515  }
516  }
517  }
518  path.merge(bestpath);
519  return true;
520 }
521 
522 //----------------------------------------------------------------------------
523 StructPath::StructPath() : m_Goodness(0.f), m_Maxness(0.f),
524  m_WinnersProtected(false)
525 {}
526 
528 {
529  operator=(rhs);
530 }
531 
533 {
534  //unprotectWinners();
535 }
536 
538 {
539  if(this != &rhs) {
540  map<string,dword>::operator=(rhs);
541  m_Goodness = rhs.m_Goodness;
543  m_Maxness = rhs.m_Maxness;
544  }
545  return *this;
546 }
547 
549 {
550  map<string,dword>::clear();
551  m_Goodness = 0.0f;
552  m_Maxness = 0.f;
553  m_WinnersProtected = false;
554 }
555 
557 {
558  iterator wi = find(struc.getName());
559  if(wi != end() && wi->second) {
560  Winner* winner = (Winner*)struc.getWinner(wi->second);
561  if(!winner) wi->second = 0;
562  return winner;
563  } else return NULL;
564 }
565 
566 const Winner* StructPath::getWinner(const MStructure& struc) const
567 {
568  const_iterator wi = find(struc.getName());
569  if(wi != end() && wi->second)
570  {
571  const Winner* winner = struc.getWinner(wi->second);
572  if(!winner) (dword&)(wi->second) = 0;
573  return winner;
574  } else return NULL;
575 }
576 
578 {
579  if(m_WinnersProtected) return;
580  for(iterator wi = begin(); wi != end(); wi++)
581  {
582  if(wi->second>=Winner::WID_FIRST &&
583  wi->second<=Winner::WID_LAST) {
584  Winner* winner = (Winner*)structs.getStructs()[wi->first]
585  .getWinner(wi->second);
586  if(winner && winner->m_Model) {
587  winner->m_Model->setFlags(Model::ST_NODEL);
588  } else wi->second = 0;
589  }
590  }
591  m_WinnersProtected = true;
592 }
593 
595 {
596  if(!m_WinnersProtected) return;
597  for(iterator wi = begin(); wi != end(); wi++)
598  {
599  if(wi->second>=Winner::WID_FIRST &&
600  wi->second<=Winner::WID_LAST) {
601  Winner* winner = (Winner*)structs.getStructs()[wi->first]
602  .getWinner(wi->second);
603  if(winner && winner->m_Model) {
605  } else wi->second = 0;
606  }
607  }
608  m_WinnersProtected = false;
609 }
610 
611 void StructPath::blockOtherPaths(const set<string>& freepath,
612  const StructTable& structs)
613 {
614  for(map<string,MStructure>::const_iterator
615  st = structs.getStructs().begin();
616  st != structs.getStructs().end(); st++)
617  {
618  if(freepath.find(st->second.getName()) == freepath.end())
619  operator[](st->second.getName()) = Winner::WID_BLOCKED;
620  }
621  m_WinnersProtected = false;
622 }
623 
624 ostream& StructPath::print(ostream& os, const StructTable& structs) const
625 {
626  os << setw(10);
627  os << "path goodness: " << m_Goodness << " ("
628  << getRelGoodness() << ")" << endl;
629  for(const_iterator wi = begin(); wi != end(); wi++)
630  {
631  if(wi->second != Winner::WID_EMPTY &&
632  wi->second != Winner::WID_BLOCKED)
633  {
634  os << " " << wi->first;
635  const MStructure& st = structs.getStructure(wi->first);
636  const Winner* winner = st.getWinner(wi->second);
637  if(winner) {
638  if(winner->m_Model)
639  os << "\t ("<< st.getWeight() <<") * "
640  << winner->m_Model->getQualityOfFit() << endl;
641  else os << "\t (no model)"<<endl;
642  for(const_iterator ri = begin(); ri != end(); ri++)
643  {
644  float rating = winner->getConnection(ri->first,
645  ri->second);
646  if(rating>=0.f) {
647  if(st.hasSupStruct(ri->first)) {
648  const SubStructure& subs =
649  st.getSupStruct(ri->first);
650  os << " <--[" << ri->first
651  << "\t] = ("<<subs.m_RateWeight<<") * "
652  << rating << endl;
653  }
654  }
655  }
656  os << " (best: " << winner->m_BestRating << ")" << endl;
657  } else os << " (deleted)"<< endl;
658  }
659  }
660  os << setw(0) << flush;
661  return os;
662 }
663 
665 {
666  StructPath bp(*this);
667  for(iterator wi = bp.begin(); wi != bp.end(); wi++)
668  if(wi->second != Winner::WID_EMPTY) wi->second = Winner::WID_BLOCKED;
669  bp.m_Goodness = 0.f; bp.m_Maxness = 0.f;
670  return bp;
671 }
672 
674 {
675  for(const_iterator wi = mp.begin(); wi != mp.end(); wi++)
676  if(wi->second != Winner::WID_EMPTY &&
677  wi->second != Winner::WID_BLOCKED)
678  operator[](wi->first) = wi->second;
680 }
void rebuildExpMaps()
void clear()
Definition: StructTable.cpp:31
bool read(ParseFile &is)
Definition: StructTable.cpp:78
std::shared_ptr< Dataset > dataset_ptr
Definition: types_fwd.h:19
std::string m_StructName
Definition: ExpMap.h:38
#define NULL
Definition: simpletypes.h:9
void startSearch(bool dostart=true)
void merge(const StructPath &mp)
float getQualityOfFit() const
Definition: Model.cpp:1204
std::map< dword, Winner > & getWinList()
Definition: Searcher.h:30
std::map< std::string, SubStructure > m_SubStructures
Definition: MStruct.h:122
const Winner * getWinner(dword wid) const
Definition: MStruct.cpp:80
std::map< std::string, MStructure > & getStructs()
Definition: StructTable.h:71
void evalRelations()
bool triggerTest(int mx, int my, int what)
Winner * getWinner(MStructure &struc)
float findBestConnection()
STL namespace.
float m_Goodness
goodness of path
Definition: StructTable.h:42
float getRelGoodness() const
Definition: StructTable.h:37
const std::string & getValue() const
Definition: ParseFile.h:57
bool error() const
Definition: ParseFile.h:50
float m_RateWeight
Definition: MStruct.h:47
bool m_WinnersProtected
Definition: StructTable.h:45
bool hasStructure(const std::string &sname) const
bool stepSearch(float dt)
Model * m_Model
Definition: ExpMap.h:36
const Searcher & getSearcher() const
Definition: MStruct.h:73
bool load(const std::string &filename)
Definition: StructTable.cpp:69
bool showNextIP(int dir=1) const
std::map< dword, StructPath > NodePaths
Definition: StructTable.h:52
float m_RateTH
Definition: MStruct.h:47
float m_BestRating
Definition: ExpMap.h:39
float angle(const Point2D &rhs=Point2D(1, 0)) const
Definition: Point.h:93
SensorCollection * getSensors()
Definition: StructTable.cpp:48
const std::string & getPath() const
Definition: ParseFile.h:52
void blockOtherPaths(const std::set< std::string > &freepath, const StructTable &structs)
std::ostream & print(std::ostream &os, const StructTable &structs) const
const std::string & getKey() const
Definition: ParseFile.h:56
float getWeight() const
Definition: MStruct.h:70
float getConnection(const std::string &sname, dword wid) const
Definition: ExpMap.cpp:313
Definition: Brain.h:27
dword & unsetFlags(dword flags)
Definition: Model.h:199
StructPath & operator=(const StructPath &rhs)
Definition: ExpMap.h:10
float m_EvolveCycle
time in seconds for one evolution cycle
Definition: Searcher.h:172
const Point2D rotate(float angle) const
Definition: Point.h:211
SearcherParams & getSearchPara()
Definition: Searcher.h:194
unsigned long dword
Definition: simpletypes.h:6
static DMatrixf & adjustByAvgDir(DMatrixf &mat)
#define TRACE0
Definition: common.h:26
const std::string & getName() const
Definition: MStruct.h:63
dword size() const
Definition: DMatrix.h:44
void unprotectWinners(StructTable &structs)
Definition: Data.h:21
void draw(bool drawPoints=false) const
Draw using OpenGL.
Definition: Model.cpp:542
void write(std::ostream &os) const
void adaptDataScale()
Definition: StructTable.cpp:60
dword m_WinnerID
Definition: ExpMap.h:37
void setParseError(const std::string &msg="")
Definition: ParseFile.h:80
void connectSubSuper()
StructPath branch() const
std::vector< float >::iterator iterator
Definition: DMatrix.h:16
std::string getErrorMsg() const
Definition: ParseFile.h:85
void clear()
dword & setFlags(dword flags)
Definition: Model.h:198
Ratings m_Ratings
Definition: ExpMap.h:40
Definition: Point.h:16
const MStructure & getStructure(const std::string &sname) const
float mapAnglePI(float a)
Definition: mathutil.h:107
float m_Maxness
maximum goodness
Definition: StructTable.h:43
void pushLine(const std::string &line)
Definition: ParseFile.h:74
MStructure & getNextStruct(int dir=1, bool wrap=true)
bool readInterpreations(ParseFile &is)
Definition: StructTable.cpp:99
bool hasSupStruct(const std::string sname) const
Definition: MStruct.h:85
void protectWinners(StructTable &structs)
const SubStructure & getSupStruct(const std::string sname) const
Definition: MStruct.h:83
const bool getNextLine()
Definition: ParseFile.h:59
void draw() const
bool read(ParseFile &is)
Definition: MStruct.cpp:94
std::vector< T > & getData()
Definition: DMatrix.h:48
void reattachSensors()
Definition: StructTable.cpp:51
StructTable(Brain &brain, const std::string &filename=std::string())
Definition: StructTable.cpp:18
dataset_ptr getDataset()
Definition: StructTable.cpp:43