gsl_mmin_simp Class Template Reference

#include <gsl_mmin_simp.h>

Inheritance diagram for gsl_mmin_simp:

multi_min< param_t, func_t, func_t, vec_t > gsl_mmin_simp_b

Detailed Description

template<class param_t, class func_t = multi_funct<param_t>, class vec_t = ovector_view>
class gsl_mmin_simp< param_t, func_t, vec_t >

Multidimensional minimization by the Simplex method (GSL).

Todo:
Not properly generalized to non-GSL vectors (to do this, I'll have to store the simplex as a vec_t array rather than a gsl_matrix). Right now, this only works with vec_t = ovector_view.
Todo:
Add a minimize function which allows specification of the entire simplex.
Todo:
Gracefully ensure memory allocation and deallocation is performed automatically.
Todo:
Test mmin_twovec().
Todo:
Document how set() chooses the simplex from the initial guess and step size

Definition at line 49 of file gsl_mmin_simp.h.


Public Member Functions

virtual int mmin (size_t nn, vec_t &xx, double &fmin, param_t &pa, func_t &ufunc)
 Calculate the minimum min of func w.r.t the array x of size nvar.
virtual int mmin_twovec (size_t nn, vec_t &xx, vec_t &xx2, double &fmin, param_t &pa, func_t &ufunc)
 Calculate the minimum min of func w.r.t the array x of size nvar, using xx and xx2 to specify the simplex.
virtual int allocate (size_t n)
 Allocate the memory.
virtual int free ()
 Free the allocated memory.
virtual int set (func_t &ufunc, param_t &pa, vec_t &ax, vec_t &step_size)
 Set the function and initial guess.
virtual int iterate ()
 Perform an iteration.
virtual int print_iter (size_t nv, vec_t &xx, double y, int iter, double value, double limit, std::string comment)
 Print out iteration information.
virtual const char * type ()
 Return string denoting type("gsl_mmin_simp").

Data Fields

double initial_step
 The initial stepsize (default 1.0).
int print_simplex
 Print simplex information in print_iter() (default 0).

Protected Member Functions

virtual double move_corner (const double coeff, const simp_state_t *state, size_t corner, gsl_vector *xc, func_t &f, size_t nvar, param_t &pa)
 Move a corner of a simplex.
virtual int contract_by_best (simp_state_t *state, size_t best, gsl_vector *xc, func_t &f, size_t nvar, param_t &pa)
 Contract the simplex towards the best point.

Protected Attributes

size_t dim
 Number of variables to be minimized over.
gsl_vector * x
 Present minimum vector.
double fval
 Function value at minimum.
func_t * func
 Function.
param_t * params
 Parameters.
bool set_called
 True if set() has been called.
double size
 Size of simplex.
simp_state_t lstate
 Simplex state storage.

Member Function Documentation

virtual double move_corner ( const double  coeff,
const simp_state_t state,
size_t  corner,
gsl_vector *  xc,
func_t &  f,
size_t  nvar,
param_t &  pa 
) [inline, protected, virtual]

Move a corner of a simplex.

Moves a simplex corner scaled by coeff (negative value represents mirroring by the middle point of the "other" corner points) and gives new corner in xc and function value at xc as a return value.

Definition at line 65 of file gsl_mmin_simp.h.

virtual int contract_by_best ( simp_state_t state,
size_t  best,
gsl_vector *  xc,
func_t &  f,
size_t  nvar,
param_t &  pa 
) [inline, protected, virtual]

Contract the simplex towards the best point.

Function contracts the simplex in respect to best valued corner. All corners besides the best corner are moved.

The vector, xc, is used as work space.

Definition at line 105 of file gsl_mmin_simp.h.

virtual int print_iter ( size_t  nv,
vec_t &  xx,
double  y,
int  iter,
double  value,
double  limit,
std::string  comment 
) [inline, virtual]

Print out iteration information.

Depending on the value of the variable verbose, this prints out the iteration information. If verbose=0, then no information is printed, while if verbose>1, then after each iteration, the present values of x and y are output to std::cout along with the iteration number. If verbose>=2 then each iteration waits for a character.

Definition at line 525 of file gsl_mmin_simp.h.


Field Documentation

int print_simplex

Print simplex information in print_iter() (default 0).

If this is 1 and verbose is greater than 0, then print_iter() will print the function values at all the simplex points.

Definition at line 179 of file gsl_mmin_simp.h.


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

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page