SG++-Doxygen-Documentation
sgpp::optimization::optimizer::MultiStart Class Reference

Meta optimization algorithm calling local algorithm multiple times. More...

#include <MultiStart.hpp>

Inheritance diagram for sgpp::optimization::optimizer::MultiStart:
sgpp::optimization::optimizer::UnconstrainedOptimizer

Public Member Functions

void clone (std::unique_ptr< UnconstrainedOptimizer > &clone) const override
 
const std::vector< size_t > & getHistoryOfInnerIterations () const
 
size_t getPopulationSize () const
 
 MultiStart (const ScalarFunction &f, size_t maxFcnEvalCount=DEFAULT_MAX_FCN_EVAL_COUNT, size_t populationSize=0)
 Constructor. More...
 
 MultiStart (const UnconstrainedOptimizer &optimizer, size_t maxFcnEvalCount=DEFAULT_MAX_FCN_EVAL_COUNT, size_t populationSize=0)
 Constructor with custom optimization algorithm. More...
 
 MultiStart (const MultiStart &other)
 Copy constructor. More...
 
void optimize () override
 Pure virtual method for optimization of the objective function. More...
 
void setPopulationSize (size_t populationSize)
 
 ~MultiStart () override
 Destructor. More...
 
- Public Member Functions inherited from sgpp::optimization::optimizer::UnconstrainedOptimizer
const base::DataMatrixgetHistoryOfOptimalPoints () const
 
const base::DataVectorgetHistoryOfOptimalValues () const
 
size_t getN () const
 
ScalarFunctiongetObjectiveFunction () const
 
const base::DataVectorgetOptimalPoint () const
 
double getOptimalValue () const
 
const base::DataVectorgetStartingPoint () const
 
void setN (size_t N)
 
void setStartingPoint (const base::DataVector &startingPoint)
 
 UnconstrainedOptimizer (const ScalarFunction &f, size_t N=DEFAULT_N)
 Constructor. More...
 
 UnconstrainedOptimizer (const UnconstrainedOptimizer &other)
 Copy constructor. More...
 
virtual ~UnconstrainedOptimizer ()
 Destructor. More...
 

Static Public Attributes

static const size_t DEFAULT_MAX_FCN_EVAL_COUNT = 1000
 default maximal number of function evaluations More...
 
- Static Public Attributes inherited from sgpp::optimization::optimizer::UnconstrainedOptimizer
static const size_t DEFAULT_N = 1000
 default maximal number of iterations or function evaluations More...
 

Protected Member Functions

void initialize (size_t populationSize)
 Initializes populationSize. More...
 

Protected Attributes

NelderMead defaultOptimizer
 default optimization algorithm More...
 
std::vector< size_t > kHist
 search history (inner iterations) More...
 
std::unique_ptr< UnconstrainedOptimizeroptimizer
 optimization algorithm More...
 
size_t populationSize
 number of individual points More...
 
- Protected Attributes inherited from sgpp::optimization::optimizer::UnconstrainedOptimizer
std::unique_ptr< ScalarFunctionf
 objective function More...
 
base::DataVector fHist
 search history vector (optimal values) More...
 
double fOpt
 result of optimization (optimal function value) More...
 
size_t N
 maximal number of iterations or function evaluations More...
 
base::DataVector x0
 starting point More...
 
base::DataMatrix xHist
 search history matrix (optimal points) More...
 
base::DataVector xOpt
 result of optimization (location of optimum) More...
 

Detailed Description

Meta optimization algorithm calling local algorithm multiple times.

MultiStart generates a random population of a given number of starting points, and then runs a local optimization algorithm for each of the starting point. The best point wins.

Constructor & Destructor Documentation

◆ MultiStart() [1/3]

sgpp::optimization::optimizer::MultiStart::MultiStart ( const ScalarFunction f,
size_t  maxFcnEvalCount = DEFAULT_MAX_FCN_EVAL_COUNT,
size_t  populationSize = 0 
)

Constructor.

By default, Nelder-Mead is used as optimization algorithm.

Parameters
fobjective function
maxFcnEvalCountmaximal number of function evaluations
populationSizenumber of individual points (default: \(\min(10d, 100)\))

References sgpp::optimization::optimizer::NelderMead::clone(), defaultOptimizer, initialize(), and optimizer.

Referenced by clone().

◆ MultiStart() [2/3]

sgpp::optimization::optimizer::MultiStart::MultiStart ( const UnconstrainedOptimizer optimizer,
size_t  maxFcnEvalCount = DEFAULT_MAX_FCN_EVAL_COUNT,
size_t  populationSize = 0 
)

Constructor with custom optimization algorithm.

The current values of the optimizer's N and starting point properties will not be used.

Parameters
optimizeroptimization algorithm and objective function
maxFcnEvalCountmaximal number of function evaluations
populationSizenumber of individual points (default: \(\min(10d, 100)\))

References sgpp::optimization::optimizer::UnconstrainedOptimizer::clone(), and initialize().

◆ MultiStart() [3/3]

sgpp::optimization::optimizer::MultiStart::MultiStart ( const MultiStart other)

Copy constructor.

Parameters
otheroptimizer to be copied

References initialize(), optimizer, and populationSize.

◆ ~MultiStart()

sgpp::optimization::optimizer::MultiStart::~MultiStart ( )
override

Destructor.

Member Function Documentation

◆ clone()

void sgpp::optimization::optimizer::MultiStart::clone ( std::unique_ptr< UnconstrainedOptimizer > &  clone) const
overridevirtual
Parameters
[out]clonepointer to cloned object

Implements sgpp::optimization::optimizer::UnconstrainedOptimizer.

References MultiStart().

◆ getHistoryOfInnerIterations()

const std::vector< size_t > & sgpp::optimization::optimizer::MultiStart::getHistoryOfInnerIterations ( ) const
Returns
vector in which the k-th entry indicates the number of inner iterations in the k-th (outer) iteration, empty vector on error

References kHist.

◆ getPopulationSize()

size_t sgpp::optimization::optimizer::MultiStart::getPopulationSize ( ) const
Returns
number of individual points

References populationSize.

◆ initialize()

void sgpp::optimization::optimizer::MultiStart::initialize ( size_t  populationSize)
protected

Initializes populationSize.

Parameters
populationSizenumber of individual points (zero to use default value)

References sgpp::optimization::optimizer::UnconstrainedOptimizer::f.

Referenced by MultiStart().

◆ optimize()

void sgpp::optimization::optimizer::MultiStart::optimize ( )
overridevirtual

Pure virtual method for optimization of the objective function.

The result of the optimization process can be obtained by member functions, e.g., getOptimalPoint() and getOptimalValue().

Implements sgpp::optimization::optimizer::UnconstrainedOptimizer.

References sgpp::base::DataVector::append(), sgpp::base::DataMatrix::appendRow(), sgpp::optimization::Printer::disableStatusPrinting(), sgpp::optimization::Printer::enableStatusPrinting(), sgpp::optimization::optimizer::UnconstrainedOptimizer::f, sgpp::optimization::optimizer::UnconstrainedOptimizer::fHist, sgpp::optimization::optimizer::UnconstrainedOptimizer::fOpt, sgpp::optimization::optimizer::UnconstrainedOptimizer::getHistoryOfOptimalPoints(), sgpp::optimization::RandomNumberGenerator::getInstance(), sgpp::optimization::Printer::getInstance(), sgpp::optimization::Printer::getMutex(), sgpp::base::DataMatrix::getNrows(), sgpp::optimization::optimizer::UnconstrainedOptimizer::getOptimalPoint(), sgpp::optimization::optimizer::UnconstrainedOptimizer::getOptimalValue(), sgpp::optimization::RandomNumberGenerator::getUniformRN(), sgpp::optimization::Printer::isStatusPrintingEnabled(), kHist, sgpp::optimization::MutexType::lock(), sgpp::optimization::optimizer::UnconstrainedOptimizer::N, sgpp::optimization::optimizer::UnconstrainedOptimizer::optimize(), optimizer, populationSize, sgpp::optimization::Printer::printStatusBegin(), sgpp::optimization::Printer::printStatusEnd(), sgpp::optimization::Printer::printStatusUpdate(), sgpp::base::DataMatrix::resize(), sgpp::optimization::optimizer::UnconstrainedOptimizer::setN(), sgpp::optimization::optimizer::UnconstrainedOptimizer::setStartingPoint(), sgpp::optimization::MutexType::unlock(), sgpp::optimization::optimizer::UnconstrainedOptimizer::x0, sgpp::optimization::optimizer::UnconstrainedOptimizer::xHist, and sgpp::optimization::optimizer::UnconstrainedOptimizer::xOpt.

Referenced by sgpp::datadriven::BayesianOptimization::main().

◆ setPopulationSize()

void sgpp::optimization::optimizer::MultiStart::setPopulationSize ( size_t  populationSize)
Parameters
populationSizenumber of individual points

References populationSize.

Member Data Documentation

◆ DEFAULT_MAX_FCN_EVAL_COUNT

const size_t sgpp::optimization::optimizer::MultiStart::DEFAULT_MAX_FCN_EVAL_COUNT = 1000
static

default maximal number of function evaluations

◆ defaultOptimizer

NelderMead sgpp::optimization::optimizer::MultiStart::defaultOptimizer
protected

default optimization algorithm

Referenced by MultiStart().

◆ kHist

std::vector<size_t> sgpp::optimization::optimizer::MultiStart::kHist
protected

search history (inner iterations)

Referenced by getHistoryOfInnerIterations(), and optimize().

◆ optimizer

std::unique_ptr<UnconstrainedOptimizer> sgpp::optimization::optimizer::MultiStart::optimizer
protected

optimization algorithm

Referenced by MultiStart(), and optimize().

◆ populationSize

size_t sgpp::optimization::optimizer::MultiStart::populationSize
protected

number of individual points

Referenced by getPopulationSize(), MultiStart(), optimize(), and setPopulationSize().


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