GSLSimplexMinimizer< dim > Class Template Reference#

DiFfRG: DiFfRG::GSLSimplexMinimizer< dim > Class Template Reference
DiFfRG
Discretization Framework for functional Renormalization Group flows

Minimizer using the Nelder-Mead simplex algorithm from GSL. More...

#include <minimization.hh>

Inheritance diagram for DiFfRG::GSLSimplexMinimizer< dim >:
DiFfRG::AbstractMinimizer< dim >

Public Member Functions

 GSLSimplexMinimizer (const FUN &f, const double abs_tol=1e-4, const int max_iter=1000)
 Construct a new GSLSimplexMinimizer object.
 
void set_step_size (const double step_size)
 Set the initial step size for the minimization.
 
void set_x0 (const std::array< double, dim > &x0)
 Set the initial guess for the minimization.
 
void set_f_target (const double f_target)
 Stop as soon as the objective falls to or below this value.
 
double get_min_value () const
 Objective value at the point returned by minimize(). NaN before it ran.
 
bool converged () const
 Whether the search met its criterion: the f-target if one was set, otherwise the simplex-size test. False when it stopped because the simplex collapsed short of the target or the iteration cap was hit – in both cases minimize() still returns the best point found.
 
const std::string & get_stop_reason () const
 Why the search stopped, for logging.
 
- Public Member Functions inherited from DiFfRG::AbstractMinimizer< dim >
 AbstractMinimizer (const FUN &f, const double abs_tol=1e-4, const int max_iter=1000)
 Construct a new AbstractMinimizer object.
 
void set_abs_tol (const double abs_tol)
 Set the absolute tolerance for the minimization.
 
void set_max_iter (const uint max_iter)
 Set the maximum number of iterations.
 
uint get_iter () const
 Get the number of iterations used in the last minimization.
 
std::array< double, dim > minimize ()
 Perform the minimization.
 

Static Public Member Functions

static double gsl_wrap (const gsl_vector *v, void *params)
 

Protected Member Functions

virtual std::array< double, dim > minimize_impl () override
 
- Protected Member Functions inherited from DiFfRG::AbstractMinimizer< dim >

Protected Attributes

std::array< double, dim > x0
 
double step_size
 
double f_target = std::numeric_limits<double>::quiet_NaN()
 
double min_value = std::numeric_limits<double>::quiet_NaN()
 
bool m_converged = false
 
std::string stop_reason
 
- Protected Attributes inherited from DiFfRG::AbstractMinimizer< dim >
FUN f
 
double abs_tol
 
uint max_iter
 
uint iter
 

Private Types

using FUN = AbstractMinimizer<dim>::FUN
 

Additional Inherited Members

- Protected Types inherited from DiFfRG::AbstractMinimizer< dim >
using FUN = std::function<double(const std::array<double, dim> &)>
 

Detailed Description

template<int dim>
class DiFfRG::GSLSimplexMinimizer< dim >

Minimizer using the Nelder-Mead simplex algorithm from GSL.

Template Parameters
dimDimension of the minimization problem.

Member Typedef Documentation

◆ FUN

template<int dim>
using DiFfRG::GSLSimplexMinimizer< dim >::FUN = AbstractMinimizer<dim>::FUN
private

Constructor & Destructor Documentation

◆ GSLSimplexMinimizer()

template<int dim>
DiFfRG::GSLSimplexMinimizer< dim >::GSLSimplexMinimizer ( const FUN & f,
const double abs_tol = 1e-4,
const int max_iter = 1000 )
inline

Construct a new GSLSimplexMinimizer object.

Parameters
fObjective function to minimize. Must take a std::array<double, dim> as input and return a double.
abs_tolAbsolute tolerance for the minimization.
max_iterMaximum number of iterations.

Member Function Documentation

◆ converged()

template<int dim>
bool DiFfRG::GSLSimplexMinimizer< dim >::converged ( ) const
inline

Whether the search met its criterion: the f-target if one was set, otherwise the simplex-size test. False when it stopped because the simplex collapsed short of the target or the iteration cap was hit – in both cases minimize() still returns the best point found.

◆ get_min_value()

template<int dim>
double DiFfRG::GSLSimplexMinimizer< dim >::get_min_value ( ) const
inline

Objective value at the point returned by minimize(). NaN before it ran.

◆ get_stop_reason()

template<int dim>
const std::string & DiFfRG::GSLSimplexMinimizer< dim >::get_stop_reason ( ) const
inline

Why the search stopped, for logging.

◆ gsl_wrap()

template<int dim>
static double DiFfRG::GSLSimplexMinimizer< dim >::gsl_wrap ( const gsl_vector * v,
void * params )
inlinestatic

◆ minimize_impl()

template<int dim>
virtual std::array< double, dim > DiFfRG::GSLSimplexMinimizer< dim >::minimize_impl ( )
inlineoverrideprotectedvirtual

◆ set_f_target()

template<int dim>
void DiFfRG::GSLSimplexMinimizer< dim >::set_f_target ( const double f_target)
inline

Stop as soon as the objective falls to or below this value.

The simplex-size test alone answers "has the search stopped moving", which is a statement about the parameter space and says nothing about whether the answer is any good. When the objective is a calibrated quantity – an RMS residual, say – a target on IT is the meaningful criterion, and the size test degrades to a give-up condition. NaN (the default) disables this and restores pure size-based convergence.

◆ set_step_size()

template<int dim>
void DiFfRG::GSLSimplexMinimizer< dim >::set_step_size ( const double step_size)
inline

Set the initial step size for the minimization.

Parameters
step_sizeInitial step size.

◆ set_x0()

template<int dim>
void DiFfRG::GSLSimplexMinimizer< dim >::set_x0 ( const std::array< double, dim > & x0)
inline

Set the initial guess for the minimization.

Parameters
x0Initial guess.

Member Data Documentation

◆ f_target

template<int dim>
double DiFfRG::GSLSimplexMinimizer< dim >::f_target = std::numeric_limits<double>::quiet_NaN()
protected

◆ m_converged

template<int dim>
bool DiFfRG::GSLSimplexMinimizer< dim >::m_converged = false
protected

◆ min_value

template<int dim>
double DiFfRG::GSLSimplexMinimizer< dim >::min_value = std::numeric_limits<double>::quiet_NaN()
protected

◆ step_size

template<int dim>
double DiFfRG::GSLSimplexMinimizer< dim >::step_size
protected

◆ stop_reason

template<int dim>
std::string DiFfRG::GSLSimplexMinimizer< dim >::stop_reason
protected

◆ x0

template<int dim>
std::array<double, dim> DiFfRG::GSLSimplexMinimizer< dim >::x0
protected

The documentation for this class was generated from the following file:
  • /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/common/minimization.hh