UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
optim.hpp
1 /* abstract_optim.hpp */
2 /* $Id: abstract_optim.hpp,v 1.1 2008/09/23 15:52:28 urij Exp $ */
3 #ifndef __abstract_optim_hpp
4 #define __abstract_optim_hpp
5 
6 #ifdef GE_BUILD
7 #include <residual.hpp>
8 #else
9 #include <mth/residual.hpp>
10 #endif
11 
12 //-----------------------------------------------------------------------------------------------------------------
15 {
16 public:
17 
19  struct SpaceElem
20  {
21  SpaceElem(double ixmn, double ixmx, double idx) :
22  xmn(ixmn), xmx(ixmx), dx(idx){};
23 
24  double xmn;
25  double xmx;
26  double dx;
27  };
28 
30  typedef std::vector<SpaceElem> Space;
31 
32  AbstractOptim(const AbstractOptim::Space &space) : m_space(space){};
33 
34  virtual ~AbstractOptim(){};
35 
37  virtual bool minimize(const AbstractResidual &res, std::vector<double> &x) const = 0;
38 
40  void setSpace(const Space &space){m_space = space;}
41 
43  Space& space(){return m_space;}
44 
45 protected:
46 
47  Space m_space;
48 };
49 
50 
51 //-----------------------------------------------------------------------------------------------------------------
53 class FoolOptim : public AbstractOptim
54 {
55 public:
56 
58 
59  virtual ~FoolOptim(){};
60 
62  bool minimize(const AbstractResidual &res, std::vector<double> &x) const;
63 };
64 
65 #endif /* __abstract_optim_hpp */
Definition: residual.hpp:9
double xmn
Definition: optim.hpp:22
std::vector< SpaceElem > Space
Definition: optim.hpp:30
double dx
Definition: optim.hpp:26
bool minimize(const AbstractResidual &res, std::vector< double > &x) const
Definition: optim.hpp:14
Definition: optim.hpp:19
Definition: optim.hpp:53
virtual bool minimize(const AbstractResidual &res, std::vector< double > &x) const =0
void setSpace(const Space &space)
Definition: optim.hpp:40
double xmx
Definition: optim.hpp:25
Space & space()
Definition: optim.hpp:43