optimizer.h
Go to the documentation of this file.
1 
19 #ifndef __INC_OPTIMIZER
20 #define __INC_OPTIMIZER
21 
22 #include <log.h>
23 #include <frame.h>
24 #include <configuration.h>
25 #include <datapairs.h>
26 #include <value_setter.h>
27 #include <optimizer_goal.h>
32 #include <optimizer_container.h>
33 
34 namespace robotLibPbD {
35 
37 {
38  public:
39  std::vector<std::vector<std::pair<std::string, CMatrix> > > timelineOfPoses;
40 
41  std::vector<std::pair<std::string, CMatrix> > allPoses;
42  std::vector<std::pair<std::string, CMatrix> > optimizedPoses;
43  std::vector<double> values;
44  double result;
45 
46  void clear();
47 };
48 
50 {
51  protected:
52  std::vector<ValueSetter> valueSetters;
53  std::vector<double> result;
54 
55  std::vector<OptimizerContainer> data;
56  std::vector<OptimizerGoalGlobal*> globalFunctions;
57  std::vector<OptimizerGoal*> functions;
60  //unsigned int trimming;
61  std::vector<std::vector<double> > examples;
62  std::vector<double> distances;
63  unsigned int counter;
64  double trim;
65  unsigned int examplesMax, iterations;
66  unsigned int dofs;
67  unsigned int counterMod, trimming;
68  bool useRandom, useShowResult, doQuit;
69  double resultValue, epsilon;
70 
71  void setValue(double *x);
72  bool writeToFile(std::string filename, std::string buffer);
73  std::string readFromFile(std::string filename);
74  void setData(std::vector<double> &values);
75  void callback(int nparam, double *x, double *fj);
76 
77  bool isEqual(std::vector<double> &first, std::vector<double> &second, double eps = 0.1);
78 
79  void loadData(std::string filename, unsigned int startId = 0);
80  void loadDofs(std::string filename);
81  void loadGoals(std::string filename);
82  void loadValueSetters(std::string filename);
83 
84  int getValue(TiXmlElement *node, std::string item);
85  void reset();
86 
87  public:
88  COptimizer() : counter(0), trim(0.0), examplesMax(100000),dofs(0),counterMod(10000),useRandom(false),useShowResult(false),doQuit(false),epsilon(1.0e-8) {}
89 
90  static void rosenbrockCallback(int nparam, double *x, double *fj, void *extraparams);
91 
92  void load(std::string cfg, std::string data, unsigned int start = 0);
93 
94  virtual std::string generateOutput();
95 
96  void run(const std::vector<double> &initialValues);
97 
98  void setEpsilon(double eps) { this->epsilon = eps; }
99  void setTrimming(double trim) { this->trim = trim; }
100  void setIterations(unsigned int iterations) { this->iterations = iterations; }
101  void setRandomStart(bool useRandom) { this->useRandom = useRandom; }
102  void setQuit(bool doQuit) { this->doQuit = doQuit; }
103  void setDataMax(unsigned int examplesMax) { this->examplesMax = examplesMax; }
104  void setShowResult(bool useShowResult) { this->useShowResult = useShowResult; }
105  void setShowModulo(unsigned int counterMod) { this->counterMod = counterMod; }
106 
107  bool getResult(COptimizerResult &out);
108 };
109 
110 };
111 
112 #endif
std::vector< std::vector< double > > examples
Definition: optimizer.h:61
CFrameContainer frames
Definition: optimizer.h:58
void setShowModulo(unsigned int counterMod)
Definition: optimizer.h:105
std::vector< std::pair< std::string, CMatrix > > optimizedPoses
Definition: optimizer.h:42
std::vector< std::vector< std::pair< std::string, CMatrix > > > timelineOfPoses
Definition: optimizer.h:39
void setIterations(unsigned int iterations)
Definition: optimizer.h:100
std::vector< double > values
Definition: optimizer.h:43
unsigned int trimming
Definition: optimizer.h:67
unsigned int iterations
Definition: optimizer.h:65
std::vector< double > result
Definition: optimizer.h:53
Data Storage Class (Attribute-Value Pairs)
Definition: datapairs.h:33
void setRandomStart(bool useRandom)
Definition: optimizer.h:101
void setQuit(bool doQuit)
Definition: optimizer.h:102
void setEpsilon(double eps)
Definition: optimizer.h:98
unsigned int counter
Definition: optimizer.h:63
unsigned int dofs
Definition: optimizer.h:66
void setDataMax(unsigned int examplesMax)
Definition: optimizer.h:103
void setTrimming(double trim)
Definition: optimizer.h:99
void setShowResult(bool useShowResult)
Definition: optimizer.h:104
std::vector< ValueSetter > valueSetters
Definition: optimizer.h:52
std::vector< double > distances
Definition: optimizer.h:62
std::vector< std::pair< std::string, CMatrix > > allPoses
Definition: optimizer.h:41
std::vector< OptimizerGoalGlobal * > globalFunctions
Definition: optimizer.h:56
std::vector< OptimizerContainer > data
Definition: optimizer.h:55
std::vector< OptimizerGoal * > functions
Definition: optimizer.h:57


asr_kinematic_chain_optimizer
Author(s): Aumann Florian, Heller Florian, Jäkel Rainer, Wittenbeck Valerij
autogenerated on Mon Jun 10 2019 12:35:36