Multidimensional minimizer fixing some parameters and varying others. More...
#include <mmin_fix.h>
This class allows one to min a function after having fixed some of the parameters. The parameters which should be fixed are specified through a bool
vector. This class performs the extra bookkeeping associated with reordering the parameters and performs the minimization with a separate minimizer object. This class is most useful for minimization problems which do not use information about the gradient.
The number of trials used in the minimizer can be specified in the data member of the parent class mmin_base::ntrial associated with the o2scl::mmin_fix_params object. Similarly for the verbosity parameter in mmin_base::verbose, the absolute tolerance in mmin_base::tol_abs, and the relative tolerance in mmin_base::tol_abs. These values are copied to the minimizer used by mmin_fix_params::mmin() during each call. After the minimizer is called, the value of mmin_base::ntrial associated with the mmin_fix_params object is filled with the last number of trials required for the last minimization.
See an example for the usage of this class in Minimizer fixing variables .
Definition at line 74 of file mmin_fix.h.
Public Types | |
typedef boost::numeric::ublas::vector< double > | ubvector |
typedef mmin_base< mmin_fix_params< func_t, vec_t >, mmin_fix_params< func_t, vec_t >, vec_t > | base_mmin_t |
The generic minimizer type. | |
typedef mmin_simp2< mmin_fix_params< func_t, vec_t >, vec_t > | def_mmin_t |
The default minimizer type. | |
Public Member Functions | |
mmin_fix_params () | |
Specify the member function pointer. | |
virtual int | mmin (size_t nvar, vec_t &x, double &fmin, func_t &func) |
Calculate the minimum min of func w.r.t. the array x of size nvar . | |
template<class bool_vec_t > | |
void | set_fix (size_t n, bool_vec_t &fix) |
template<class bool_vec_t > | |
int | mmin_fix (size_t nvar, ubvector &x, double &fmin, bool_vec_t &fix, multi_funct &func) |
Calculate the minimum of func while fixing some parameters as specified in fix . More... | |
int | set_mmin (base_mmin_t &min) |
Change the base minimizer. | |
virtual double | operator() (size_t nv, const vec_t &x) |
The new function to send to the minimizer. | |
![]() | |
mmin_base (const mmin_base< func_t, func_t, vec_t > &mb) | |
Copy constructor. | |
int | set_verbose_stream (std::ostream &out, std::istream &in) |
Set streams for verbose I/O. More... | |
virtual int | mmin_de (size_t nvar, vec_t &x, double &fmin, func_t &func, func_t &dfunc) |
Calculate the minimum min of func w.r.t. the array x of size nvar with gradient dfunc . | |
int | print_iter (size_t nv, vec2_t &x, double y, int iter, double value, double limit, std::string comment) |
Print out iteration information. More... | |
const char * | type () |
Return string denoting type ("mmin_base") | |
mmin_base< func_t, func_t, vec_t > & | operator= (const mmin_base< func_t, func_t, vec_t > &mb) |
Copy constructor from operator=. | |
Public Attributes | |
def_mmin_t | def_mmin |
The default base minimizer. | |
![]() | |
int | verbose |
Output control. | |
int | ntrial |
Maximum number of iterations. | |
double | tol_rel |
Function value tolerance. | |
double | tol_abs |
The independent variable tolerance. | |
int | last_ntrial |
The number of iterations for in the most recent minimization. | |
bool | err_nonconv |
If true, call the error handler if the routine does not "converge". | |
Protected Attributes | |
base_mmin_t * | mmp |
The minimizer. | |
func_t * | funcp |
The user-specified function. | |
size_t | unv |
The user-specified number of variables. | |
size_t | nv_new |
The new number of variables. | |
std::vector< bool > | fixp |
Specify which parameters to fix. | |
vec_t * | xp |
The user-specified initial vector. | |
![]() | |
std::ostream * | outs |
Stream for verbose output. | |
std::istream * | ins |
Stream for verbose input. | |
Private Member Functions | |
mmin_fix_params (const mmin_fix_params &) | |
mmin_fix_params & | operator= (const mmin_fix_params &) |
|
inline |
If all of entries fix[0], fix[1], ... fix[nvar-1]
are true, then this function assumes all of the parameters are fixed and that there is no minimization to be performed. In this case, it will return 0 for success without calling the error handler.
Definition at line 168 of file mmin_fix.h.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).