Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
o2scl::mmin_constr< func_t, dfunc_t, hfunc_t, vec_t > Class Template Referenceabstract

Constrained multidimensional minimization (OOL) [abstract base]. More...

#include <mmin_constr.h>

Inheritance diagram for o2scl::mmin_constr< func_t, dfunc_t, hfunc_t, vec_t >:
o2scl::mmin_base< func_t, dfunc_t, vec_t >

Public Member Functions

virtual int allocate (const size_t n)
 Allocate memory.
 
virtual int restart ()
 Restart the minimizer.
 
virtual int set (func_t &fn, dfunc_t &dfn, vec_t &init)
 Set the function, the gradient, and the initial guess.
 
virtual int set_hess (func_t &fn, dfunc_t &dfn, hfunc_t &hfn, vec_t &init)
 Set the function, the gradient, the Hessian product, and the initial guess.
 
virtual int set_constraints (size_t nc, vec_t &lower, vec_t &upper)
 Set the constraints.
 
virtual int iterate ()=0
 Perform an iteration.
 
virtual int is_optimal ()=0
 See if we're finished.
 
virtual int mmin (size_t nvar, vec_t &xx, double &fmin, func_t &ff)
 Calculate the minimum min of func w.r.t. the array x of size nvar. More...
 
virtual int mmin_hess (size_t nvar, vec_t &xx, double &fmin, func_t &ff, dfunc_t &df, hfunc_t &hf)
 Calculate the minimum min of ff w.r.t. the array x of size nvar with gradient df and hessian vector product hf.
 
virtual int mmin_de (size_t nvar, vec_t &xx, double &fmin, func_t &ff, dfunc_t &df)
 Calculate the minimum min of func w.r.t. the array x of size nvar with gradient dfunc.
 
const char * type ()
 Return string denoting type ("mmin_constr")
 
- Public Member Functions inherited from o2scl::mmin_base< func_t, dfunc_t, vec_t >
int set_verbose_stream (std::ostream &out, std::istream &in)
 Set streams for verbose I/O. More...
 
template<class vec2_t >
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 (const mmin_base< func_t, dfunc_t, vec_t > &mb)
 Copy constructor.
 
mmin_base< func_t, dfunc_t, vec_t > & operator= (const mmin_base< func_t, dfunc_t, vec_t > &mb)
 Copy constructor from operator=.
 

Protected Member Functions

void shrink (const size_t nind, gsl_vector_uint *Ind, const vec_t &V)
 Shrink vector V from the full to the reduced space.
 
void expand (const size_t nind, gsl_vector_uint *Ind, const vec_t &V)
 Expand vector V from the reduced to the full space.
 
double calc_f (const size_t nind, gsl_vector_uint *Ind, vec_t &X, vec_t &Xc)
 Evaluate the objective function from the reduced space.
 
int calc_g (const size_t nind, gsl_vector_uint *Ind, vec_t &X, vec_t &Xc, vec_t &G)
 Compute gradient in the reduced space.
 
int calc_Hv (const size_t nind, gsl_vector_uint *Ind, vec_t &X, vec_t &Xc, vec_t &V, vec_t &Hv)
 Evaluate a hessian times a vector from the reduced space. More...
 

Protected Attributes

double f
 The current function value.
 
double size
 Desc.
 
vec_t x
 The current minimum vector.
 
vec_t gradient
 The current gradient vector.
 
vec_t dx
 Desc.
 
size_t fcount
 Number of function evaluations.
 
size_t gcount
 Number of gradient evaluations.
 
size_t hcount
 Number of Hessian evaluations.
 
size_t dim
 Number of parameters.
 
size_t nconstr
 Number of constraints.
 
func_t * func
 User-supplied function.
 
dfunc_t * dfunc
 Gradient function.
 
hfunc_t * hfunc
 Hessian function.
 
vec_t L
 Lower bound constraints.
 
vec_t U
 Upper bound constraints.
 
bool requires_hess
 If true, the algorithm requires the hessian vector product.
 
- Protected Attributes inherited from o2scl::mmin_base< func_t, dfunc_t, vec_t >
std::ostream * outs
 Stream for verbose output.
 
std::istream * ins
 Stream for verbose input.
 

Private Member Functions

 mmin_constr (const mmin_constr< func_t, dfunc_t, hfunc_t, vec_t > &)
 
mmin_constr< func_t, dfunc_t, hfunc_t, vec_t > & operator= (const mmin_constr< func_t, dfunc_t, hfunc_t, vec_t > &)
 

Additional Inherited Members

- Public Attributes inherited from o2scl::mmin_base< func_t, dfunc_t, vec_t >
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".
 

Detailed Description

template<class func_t, class dfunc_t = func_t, class hfunc_t = func_t, class vec_t = boost::numeric::ublas::vector<double>>
class o2scl::mmin_constr< func_t, dfunc_t, hfunc_t, vec_t >

Idea for Future:

Implement automatic computations of gradient and Hessian

Construct a more difficult example for the "examples" directory

Finish mmin() interface

Implement a direct computation of the hessian as the jacobian of the gradient

Definition at line 78 of file mmin_constr.h.

Member Function Documentation

◆ calc_Hv()

template<class func_t, class dfunc_t = func_t, class hfunc_t = func_t, class vec_t = boost::numeric::ublas::vector<double>>
int o2scl::mmin_constr< func_t, dfunc_t, hfunc_t, vec_t >::calc_Hv ( const size_t  nind,
gsl_vector_uint *  Ind,
vec_t &  X,
vec_t &  Xc,
vec_t &  V,
vec_t &  Hv 
)
inlineprotected

Expand to full space

Definition at line 214 of file mmin_constr.h.

◆ mmin()

template<class func_t, class dfunc_t = func_t, class hfunc_t = func_t, class vec_t = boost::numeric::ublas::vector<double>>
virtual int o2scl::mmin_constr< func_t, dfunc_t, hfunc_t, vec_t >::mmin ( size_t  nvar,
vec_t &  xx,
double &  fmin,
func_t &  ff 
)
inlinevirtual
Note
This is unimplemented.

Implements o2scl::mmin_base< func_t, dfunc_t, vec_t >.

Definition at line 347 of file mmin_constr.h.


The documentation for this class was generated from the following file:

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).