35 #ifndef AIMS_OPTIMIZATION_DETERMINISTIC_H 36 #define AIMS_OPTIMIZATION_DETERMINISTIC_H 51 template <
class T,
int D>
56 int maxIter = 100000,
int stability = 1,
57 bool verbose =
false )
59 _maxIter( maxIter ), _stability( stability ),
74 template <
class T,
int D>
inline 80 T eval, new_eval, old_eval, err;
82 old_eval = eval = new_eval = this->
_func.eval( p );
83 int iter=0, cntStab = 0, k;
86 for ( k = 0; k < D; k++ )
88 new_eval = this->
_func.eval( new_p );
89 if ( new_eval < eval )
95 if ( ( err = fabs( eval - old_eval ) ) < this->
_error )
107 <<
" stab=" << cntStab
108 <<
" objective=" << eval
113 ASSERT( iter != _maxIter );
115 while ( cntStab != _stability );
DetermOptimizer(const ObjectiveFunc< T, D > &func, T error, int maxIter=100000, int stability=1, bool verbose=false)
double UniformRandom()
Uniform distribution between 0.0 and 1.0.
AimsVector< T, D > doit(const AimsVector< T, D > &pinit, const AimsVector< T, D > &deltaP)
const ObjectiveFunc< T, D > & _func
virtual ~DetermOptimizer()