Unfit  3.1.1
Data fitting and optimization software
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
Unfit::Options Class Reference

#include <Options.hpp>

Public Member Functions

 Options ()
 
void ResetOptions ()
 
double GetCostTolerance () const noexcept
 
void SetCostTolerance (double tolerance)
 
double GetDegenerateTolerance () const noexcept
 
void SetDegenerateTolerance (double tolerance)
 
double GetGeometricTolerance () const noexcept
 
void SetGeometricTolerance (double tolerance)
 
double GetAlpha () const noexcept
 
void SetAlpha (double alpha)
 
double GetBeta () const noexcept
 
void SetBeta (double beta)
 
double GetDelta () const noexcept
 
void SetDelta (double delta)
 
double GetGamma () const noexcept
 
void SetGamma (double gamma)
 
double GetEpsilon () const noexcept
 
void SetEpsilon (double epsilon)
 
void SetTau (double tau)
 
double GetTau () const noexcept
 
unsigned GetMaxFunctionEvaluations () const noexcept
 
void SetMaxFunctionEvaluations (unsigned max_func_evals)
 
unsigned GetMaxIterations () const noexcept
 
void SetMaxIterations (unsigned max_iters)
 
void GetNelderMeadStepSizes (double &alpha, double &beta, double &delta, double &gamma)
 
void SetNelderMeadStepSizes (double alpha, double beta, double delta, double gamma)
 
unsigned GetOutputLevel () const noexcept
 
void SetOutputLevel (unsigned output_level)
 
unsigned GetCostNormType () const noexcept
 
void SetCostNormType (unsigned cost_norm_type)
 
bool GetUseAdaptiveParameters () const noexcept
 
void SetUseAdaptiveParameters (bool adaptive)
 
unsigned GetPopulationSize () const noexcept
 
void SetPopulationSize (unsigned pop_size)
 
bool GetUserSetPopulationSize () const noexcept
 
unsigned GetRandomSeed () const noexcept
 
void SetRandomSeed (unsigned seed)
 
unsigned GetStrategy () const noexcept
 
void SetStrategy (unsigned strategy)
 
double GetCrossOver () const noexcept
 
void SetCrossOver (double cross_over)
 
double GetWeightingFactor () const noexcept
 
void SetWeightingFactor (double weighting_factor)
 
bool GetAddInitialToPopulation () const noexcept
 
void SetAddInitialToPopulation (bool add_initial)
 
bool GetUseBroydenUpdates () const noexcept
 
void SetUseBroydenUpdates (bool use_broyden)
 
unsigned GetElitism () const noexcept
 
void SetElitism (unsigned elite)
 
double GetSurvivalRate () const noexcept
 
void SetSurvivalRate (double rate)
 
bool GetUseHardBounds () const noexcept
 
void SetUseHardBounds (bool use_hard_bounds)
 
bool GetUserSetPopulation () const noexcept
 
void SetUserSetPopulation (bool has_set_population)
 
bool GetUseMultiThreaded () const noexcept
 
void SetUseMultiThreaded (bool use_multi_threaded)
 
double GetTemperature () const noexcept
 
void SetTemperature (double temperature)
 
double GetStepReductionFactor () const noexcept
 
void SetStepReductionFactor (double step_factor)
 
double GetTemperatureReductionFactor () const noexcept
 
void SetTemperatureReductionFactor (double temperature_factor)
 
int GetNumberOfCycles () const noexcept
 
void SetNumberOfCycles (int num_cycles)
 
int GetNumberOfTemperatureLoops () const noexcept
 
void SetNumberOfTemperatureLoops (int num_temperature_loops)
 

Private Attributes

unsigned max_function_evaluations_
 
unsigned max_iterations_
 
unsigned output_level_
 
unsigned cost_norm_type_
 
double cost_tolerance_
 
double degenerate_tolerance_
 
double geometric_tolerance_
 
double alpha_
 
double beta_
 
double delta_
 
double gamma_
 
double epsilon_
 
double tau_
 
bool use_adaptive_
 
unsigned population_size_
 
unsigned seed_
 
unsigned strategy_
 
double weighting_factor_
 
double cross_over_
 
unsigned elitism_
 
double survival_rate_
 
bool user_has_set_population_size_
 
bool user_has_set_population_
 
bool use_broyden_updates_
 
bool add_initial_to_population_
 
bool use_hard_bounds_
 
bool use_multi_threaded_
 
double temperature_
 
double step_reduction_factor_
 
double temperature_reduction_factor_
 
int num_cycles_
 
int num_temperature_loops_
 

Static Private Attributes

static constexpr unsigned default_max_function_evaluations_ = 100000
 
static constexpr unsigned default_max_iterations_ = 10000
 
static constexpr unsigned default_output_level_ = 0
 
static constexpr unsigned default_cost_norm_type_ = 2
 
static constexpr double default_cost_tolerance_ = 1e-12
 
static constexpr double default_degenerate_tolerance_ = 1e-8
 
static constexpr double default_geometric_tolerance_ = 1e-4
 
static constexpr double default_alpha_ = 1.0
 
static constexpr double default_beta_ = 2.0
 
static constexpr double default_delta_ = 0.5
 
static constexpr double default_epsilon_ = 1e-12
 
static constexpr double default_gamma_ = 0.5
 
static constexpr double default_tau_ = 1e-3
 
static constexpr bool default_use_adaptive_ = false
 
static constexpr unsigned default_population_size_ = 20
 
static constexpr unsigned default_seed_ = 0
 
static constexpr unsigned default_strategy_ = 1
 
static constexpr double default_weighting_factor_ = 0.8
 
static constexpr double default_cross_over_ = 0.9
 
static constexpr unsigned default_elitism_ = 1
 
static constexpr double default_survival_rate_ = 0.5
 
static constexpr bool default_user_has_set_population_size_ = false
 
static constexpr bool default_user_has_set_population_ = false
 
static constexpr bool default_use_broyden_updates_ = true
 
static constexpr bool default_add_initial_to_population_ = false
 
static constexpr bool default_use_hard_bounds_ = false
 
static constexpr bool default_use_multi_threaded_ = false
 
static constexpr double default_temperature_ = 1000.0
 
static constexpr double default_step_reduction_factor_ = 0.9
 
static constexpr double default_temperature_reduction_factor_ = 0.5
 
static constexpr int default_num_cycles_ = 20
 
static constexpr int default_num_temperature_loops_ = 5
 

Detailed Description

This class is designed to handle all of the optimization options for Unfit. The model is that all options should be here, so as to provide a uniform interface to setting an option from any optimization method. The drawback is that some options may not be valid for some methods, but if someone sets an option that is not relevant, it will have no effect. In the future it may be a good idea to warn the user if an option will do nothing for their chosen optimization algorithm.

Constructor & Destructor Documentation

◆ Options()

Unfit::Options::Options ( )

Set all of the optimization options to their default values

Member Function Documentation

◆ GetAddInitialToPopulation()

bool Unfit::Options::GetAddInitialToPopulation ( ) const
noexcept

Returns whether or not the initial coordinates should form part of the initial population for Differential Evolution. The default is no (false).

Returns
true if the passed in coordinates should be added to the population

◆ GetAlpha()

double Unfit::Options::GetAlpha ( ) const
noexcept

Get the value of the alpha parameter. It will be algorithm specific as to whether this is used and as to what it actually checks. In the NelderMead algorithm this scales the reflect operation.

Returns
The value of alpha

◆ GetBeta()

double Unfit::Options::GetBeta ( ) const
noexcept

Get the value of the beta parameter. It will be algorithm specific as to whether this is used and as to what it actually checks. In the NelderMead algorithm this scales the expand operation.

Returns
The value of beta

◆ GetCostNormType()

unsigned Unfit::Options::GetCostNormType ( ) const
noexcept

Gets the current norm type used for calculating the cost of the current parameter estimate. The default is the L2 norm (sum of squared error) because that is what Levenberg-Marquardt requires. The other option is the L1 norm (sum of absolute errors).

Returns
The current norm level: 1 = using the L1 norm, 2 = using L2

◆ GetCostTolerance()

double Unfit::Options::GetCostTolerance ( ) const
noexcept

Get the value of the cost tolerance which controls the termination of the optimization based on the value of the user-supplied cost function.

Returns
The value of cost tolerance

◆ GetCrossOver()

double Unfit::Options::GetCrossOver ( ) const
noexcept

Get the cross over probability (CR) used by the differential evolution algorithm

Returns
the cross over probability

◆ GetDegenerateTolerance()

double Unfit::Options::GetDegenerateTolerance ( ) const
noexcept

Get the value of the degenerate tolerance. At the moment this is only used in the Nelder-Mead algorithm to check the size of the simplex. If all of the points become colinear then we need to restart with a new simplex. This parameter controls how colinear the vertices can be before a restart is required.

Returns
The value of degenerate tolerance

◆ GetDelta()

double Unfit::Options::GetDelta ( ) const
noexcept

Get the value of the delta parameter. It will be algorithm specific as to whether this is used and as to what it actually checks. In the NelderMead algorithm this scales the shrink operation. This is the size of the finite difference step used to approximate the jacobian matrix in the LevenbergMarquardt algorithm.

Returns
The value of delta

◆ GetElitism()

unsigned Unfit::Options::GetElitism ( ) const
noexcept

Elite chromosomes are immune from the mutation process associated with the Genetic Algorithm optimisation technique. This returns the number of elite chromosomes.

Returns
The number of elite chromosomes

◆ GetEpsilon()

double Unfit::Options::GetEpsilon ( ) const
noexcept

This method returns the value of epsilon, which is used in the Levenberg Marquardt algorithm as a convergence measure for the gradients at each iteration. If none of the gradients are larger than epsilon we have convergence.

Returns
the value of epsilon

◆ GetGamma()

double Unfit::Options::GetGamma ( ) const
noexcept

Get the value of the gamma parameter. It will be algorithm specific as to whether this is used and as to what it actually checks. In the NelderMead algorithm this scales the contract operations.

Returns
The value of gamma

◆ GetGeometricTolerance()

double Unfit::Options::GetGeometricTolerance ( ) const
noexcept

Get the value of the geometric tolerance which controls the termination of the optimization based on a metric related to the size of the problem space. It will be algorithm specific as to whether this is used and as to what it actually checks.

Returns
The value of geometric tolerance

◆ GetMaxFunctionEvaluations()

unsigned Unfit::Options::GetMaxFunctionEvaluations ( ) const
noexcept

Get the maximum number of function evaluations (calls to the cost function) for the optimization problem. The optimization will terminate if the maximum number of function evaluations is reached before convergence.

Returns
Maximum number of function evaluations

◆ GetMaxIterations()

unsigned Unfit::Options::GetMaxIterations ( ) const
noexcept

Get the maximum number of iterations for the optimization problem. The optimization will terminate if the maximum number of iterations is reached before convergence.

Returns
Maximum number of iterations

◆ GetNelderMeadStepSizes()

void Unfit::Options::GetNelderMeadStepSizes ( double &  alpha,
double &  beta,
double &  delta,
double &  gamma 
)

Get the step sizes for the NelderMead algorithm. The alpha parameter scales the reflect operation, the beta parameter scales the expand operation, the delta parameter scales the shrink operation and the gamma parameter scales the contract operations. The design of the interface is such that you can get the parameters, change one or more, then pass them back in to set them without having to expose the user to the added complexity of something like a tuple.

Parameters
alphaScales the reflect operation (default 1.0)
betaScales the expand operation (default 2.0)
deltaScales the shrink operation (default 0.5)
gammaScales the contract operation (default 0.5)

◆ GetNumberOfCycles()

int Unfit::Options::GetNumberOfCycles ( ) const
noexcept

Returns the number of cycles to be used in Simulated Annealing. The default value is 20

Returns
The number of cycles

◆ GetNumberOfTemperatureLoops()

int Unfit::Options::GetNumberOfTemperatureLoops ( ) const
noexcept

Returns the number of temperature loops to be used in Simulated Annealing. The default value is 5

Returns
The number of temperature loops

◆ GetOutputLevel()

unsigned Unfit::Options::GetOutputLevel ( ) const
noexcept

Gets the current level of output. This may be algorithm specific, but in general 0 = no output; 1 = iteration counter only; 2 = iteration by iteration information; 3+ = same as 2, plus additional output (e.g. final result).

Returns
The current level of output

◆ GetPopulationSize()

unsigned Unfit::Options::GetPopulationSize ( ) const
noexcept

Returns the size of the population used in the GeneticAlgorithm or DifferentialEvolution solution method.

Returns
The size of the population

◆ GetRandomSeed()

unsigned Unfit::Options::GetRandomSeed ( ) const
noexcept

Gets the seed to be used by the random number engine used by Genetic Algorithm and Differential Evolution.

Returns
The seed for the random number generator

◆ GetStepReductionFactor()

double Unfit::Options::GetStepReductionFactor ( ) const
noexcept

Returns the step reduction factor to be used to reduce the step size after each temperature loop in Simulated Annealing. The default value is 0.9

Returns
The step reduction factor

◆ GetStrategy()

unsigned Unfit::Options::GetStrategy ( ) const
noexcept

Get the current strategy used by the differential evolution algorithm (range = 1-10).

Returns
the strategy to adopt for differential evolution

◆ GetSurvivalRate()

double Unfit::Options::GetSurvivalRate ( ) const
noexcept

For Genetic Algorithms, in each generation, part of the population survives and part is replaced. This method gets the proportion of chromosomes that survive at each generation.

Returns
The proportion of the population that survives in each generation

◆ GetTau()

double Unfit::Options::GetTau ( ) const
noexcept

Set the value of the tau parameter. It will be algorithm specific as to whether this is used and as to what it actually checks. In the Levenberg Marquardt algorithm tau scales the initial damping parameter mu.

Returns
The value of tau

◆ GetTemperature()

double Unfit::Options::GetTemperature ( ) const
noexcept

Returns the initial temperature (in Kelvin) to be used in the first iteration for Simulated Annealing algorithm. The default initial temperature is 1000.

Returns
The initial annealing temperature

◆ GetTemperatureReductionFactor()

double Unfit::Options::GetTemperatureReductionFactor ( ) const
noexcept

Returns the temperature reduction factor to be used to reduce temperature after each temperature loop in Simulated Annealing. The default value is 0.5

Returns
The temperature reduction factor

◆ GetUseAdaptiveParameters()

bool Unfit::Options::GetUseAdaptiveParameters ( ) const
noexcept

Get a boolean which states whether or not the algorithm is currently using adaptive parameters.

Returns
True if adaptive parameters are used, otherwise false

◆ GetUseBroydenUpdates()

bool Unfit::Options::GetUseBroydenUpdates ( ) const
noexcept

Returns whether or not we are using Broyden rank one updates for the Levenberg Marquart algorithm. The default is yes (true).

Returns
true if using Broyden rank one updates, otherwise false

◆ GetUseHardBounds()

bool Unfit::Options::GetUseHardBounds ( ) const
noexcept

For Differential Evolution, this returns whether or not the specified bounds are strictly enforced. If false, the solution can be outside the specified bounds.

Returns
Whether or not hard bounds are in use

◆ GetUseMultiThreaded()

bool Unfit::Options::GetUseMultiThreaded ( ) const
noexcept

Returns whether or not the algorithms in Unfit run multi-threaded or on a single thread (parallel or serial execution).

Returns
True if using multi-threaded code, false otherwise

◆ GetUserSetPopulation()

bool Unfit::Options::GetUserSetPopulation ( ) const
noexcept

Returns whether or not the user has provided a population to the optimizer.

Returns
True if a population has been given, false otherwise

◆ GetUserSetPopulationSize()

bool Unfit::Options::GetUserSetPopulationSize ( ) const
noexcept

For both GeneticAlgorithm and DifferentialEvolution, the default population size is determined by the code. If a user wants to override this then we need to set a flag. Call this method to determine if the user has set their own population size.

Returns
true if the user has specified a population size, otherwise false

◆ GetWeightingFactor()

double Unfit::Options::GetWeightingFactor ( ) const
noexcept

Get the differential weighting factor (F) used by the differential evolution algorithm

Returns
the differential weighting factor

◆ ResetOptions()

void Unfit::Options::ResetOptions ( )

Resets all of the optimization options to their default values

◆ SetAddInitialToPopulation()

void Unfit::Options::SetAddInitialToPopulation ( bool  add_initial)

Choose whether or not the initial coordinates should form part of the initial population for Differential Evolution. The default is no (false).

Parameters
add_initialtrue if the passed in coordinates should be included in the population

◆ SetAlpha()

void Unfit::Options::SetAlpha ( double  alpha)

Set the value of the alpha parameter. It will be algorithm specific as to whether this is used and as to what it actually checks. In the NelderMead algorithm this scales the reflect operation. If you are using NelderMead you should use SetNelderMeadStepSizes as this does not check the input is in keeping with the NelderMead constraints.

Parameters
alphaThe value of alpha

◆ SetBeta()

void Unfit::Options::SetBeta ( double  beta)

Set the value of the beta parameter. It will be algorithm specific as to whether this is used and as to what it actually checks. In the NelderMead algorithm this scales the expand operation. If you are using NelderMead you should use SetNelderMeadStepSizes as this does not check the input is in keeping with the NelderMead constraints.

Parameters
betaThe value of beta

◆ SetCostNormType()

void Unfit::Options::SetCostNormType ( unsigned  cost_norm_type)

Sets the desired norm type for for calculating the cost of the current parameter estimate. The default is the L2 norm (sum of squared error) because that is what Levenberg-Marquardt requires. The other option is the L1 norm (sum of absolute errors). Although the other optimisers will use the L1 norm if you ask them to, Levenberg-Marquardt always has to use L2.

Parameters
cost_norm_typeSet to 1 to use the L1 norm, or 2 for the L2 norm

◆ SetCostTolerance()

void Unfit::Options::SetCostTolerance ( double  tolerance)

Set the value of the cost tolerance which controls the termination of the optimization based on the value of the user-supplied cost function. The tolerance must be positive, and anything else will be ignored.

Parameters
toleranceThe value of cost tolerance

◆ SetCrossOver()

void Unfit::Options::SetCrossOver ( double  cross_over)

Set the cross over probability (CR) to be used by the differential evolution algorithm. This determines how likely it is that a population member will evolve.

Parameters
cross_overthe cross over probability

◆ SetDegenerateTolerance()

void Unfit::Options::SetDegenerateTolerance ( double  tolerance)

Set the value of the degenerate tolerance. At the moment this is only used in the Nelder-Mead algorithm to check the size of the simplex. If all of the points become colinear then we need to restart with a new simplex. This parameter controls how colinear the vertices can be before a restart is required. The tolerance must be positive, and anything else will be ignored.

Parameters
toleranceThe value of degenerate tolerance

◆ SetDelta()

void Unfit::Options::SetDelta ( double  delta)

Set the value of the delta parameter. It will be algorithm specific as to whether this is used and as to what it actually checks. In the NelderMead algorithm this scales the shrink operation. If you are using NelderMead you should use SetNelderMeadStepSizes as this does not check the input is in keeping with the NelderMead constraints. This is the size of the finite difference step used to approximate the jacobian matrix in the LevenbergMarquardt algorithm.

Parameters
deltaThe value of delta

◆ SetElitism()

void Unfit::Options::SetElitism ( unsigned  elite)

Elite chromosomes are immune from the mutation process associated with the Genetic Algorithm optimisation technique. This sets the number of elite chromosomes.

Parameters
eliteThe number of elite chromosomes

◆ SetEpsilon()

void Unfit::Options::SetEpsilon ( double  epsilon)

This method sets the value of epsilon, which is used in the Levenberg Marquardt algorithm as a convergence measure for the gradients at each iteration. If none of the gradients are larger than epsilon we have convergence.

Parameters
epsilonthe intended value of epsilon

◆ SetGamma()

void Unfit::Options::SetGamma ( double  gamma)

Set the value of the gamma parameter. It will be algorithm specific as to whether this is used and as to what it actually checks. In the NelderMead algorithm this scales the contract operations. If you are using NelderMead you should use SetNelderMeadStepSizes as this does not check the input is in keeping with the NelderMead constraints.

Parameters
gammaThe value of gamma

◆ SetGeometricTolerance()

void Unfit::Options::SetGeometricTolerance ( double  tolerance)

Set the value of the geometric tolerance which controls the termination of the optimization based on a metric related to the size of the problem space. It will be algorithm specific as to whether this is used and as to what it actually checks. The tolerance must be positive, and anything else will be ignored.

Parameters
toleranceThe value of geometric tolerance

◆ SetMaxFunctionEvaluations()

void Unfit::Options::SetMaxFunctionEvaluations ( unsigned  max_func_evals)

Set the maximum number of function evaluations (calls to the cost function) for the optimization problem. The optimization will terminate if the maximum number of function evaluations is reached before convergence.

Parameters
max_func_evalsMaximum number of function evaluations

◆ SetMaxIterations()

void Unfit::Options::SetMaxIterations ( unsigned  max_iters)

Set the maximum number of iterations for the optimization problem. The optimization will terminate if the maximum number of iterations is reached before convergence.

Parameters
max_itersMaximum number of iterations

◆ SetNelderMeadStepSizes()

void Unfit::Options::SetNelderMeadStepSizes ( double  alpha,
double  beta,
double  delta,
double  gamma 
)

Set the step sizes for the NelderMead algorithm. If you are not using the NelderMead algorithm then setting these options will have no effect. The alpha parameter scales the reflect operation, the beta parameter scales the expand operation, the delta parameter scales the shrink operation and the gamma parameter scales the contract operations. To ensure normal operations, it is enforced that 0 < gamma, delta < 1, and that gamma < alpha < beta. If this is not the case then the set operation will fail and the parameters will remain unchanged.

Parameters
alphaScales the reflect operation (default 1.0)
betaScales the expand operation (default 2.0)
deltaScales the shrink operation (default 0.5)
gammaScales the contract operation (default 0.5)

◆ SetNumberOfCycles()

void Unfit::Options::SetNumberOfCycles ( int  num_cycles)

Sets the number of cycles to be used in Simulated Annealing.

Parameters
num_cyclesThe number of cycles

◆ SetNumberOfTemperatureLoops()

void Unfit::Options::SetNumberOfTemperatureLoops ( int  num_temperature_loops)

Sets the number of temperature loops to be used in Simulated Annealing.

Parameters
num_temperature_loopsThe number of temperature loops

◆ SetOutputLevel()

void Unfit::Options::SetOutputLevel ( unsigned  output_level)

Set the desired level of output. This may be algorithm specific, but in general 0 = no output; 1 = iteration counter only; 2 = iteration by iteration information; 3+ = same as 2, plus additional output (e.g. final result).

Parameters
output_levelThe selected level of output

◆ SetPopulationSize()

void Unfit::Options::SetPopulationSize ( unsigned  pop_size)

Set the size of the population used by GeneticAlgorithm and DifferentialEvolution. The minimum population size is three for GA and six for DE, and if you try to set a number less than this these minimums will be imposed. The default is to use 10x the number of unknowns.

Parameters
pop_sizeThe intended size of the population

◆ SetRandomSeed()

void Unfit::Options::SetRandomSeed ( unsigned  seed)

Sets the seed to be used by the random number engine used by Genetic Algorithm and Differential Evolution. Note that value of 0 and 1 generates the same set of values.

Parameters
seedThe seed for the random number generator

◆ SetStepReductionFactor()

void Unfit::Options::SetStepReductionFactor ( double  step_factor)

Sets the step reduction factor to be used to reduce the step size after each temperature loop in Simulated Annealing.

Parameters
step_factorThe factor to reduce step size

◆ SetStrategy()

void Unfit::Options::SetStrategy ( unsigned  strategy)

Choose amongst the 10 strategies (numbered 1-10) for the vector combinations at each iteration for the differential evolution algorithm. Different strategies can work better or worse for different problems. The default is 1, which seems to work for our test problems.

Parameters
strategythe strategy to adopt for differential evolution

◆ SetSurvivalRate()

void Unfit::Options::SetSurvivalRate ( double  rate)

For Genetic Algorithms, in each generation, part of the population survives and part is replaced. This method sets the proportion of chromosomes that survive at each generation. This should be between zero and one, with the caveat that a minimum of two chromosomes must survive in any given generation, to produce offspring for the next. Therefore, if you set the value to zero, two will still survive. If you set it to one, then the only change between one generation and the next will be the mutation component.

Parameters
rateThe fraction of the population that survives in a generation

◆ SetTau()

void Unfit::Options::SetTau ( double  tau)

Set the value of the tau parameter. It will be algorithm specific as to whether this is used and as to what it actually checks. In the Levenberg Marquardt algorithm tau scales the initial damping parameter mu. Here tau must be positive and any negative input will be ignored.

Parameters
tauThe value of tau

◆ SetTemperature()

void Unfit::Options::SetTemperature ( double  temperature)

Sets the initial temperature (in Kelvin) to be used in the first iteration for Simulated Annealing algorithm.

Parameters
temperatureThe initial temperature (>0)

◆ SetTemperatureReductionFactor()

void Unfit::Options::SetTemperatureReductionFactor ( double  temperature_factor)

Sets the temperature reduction factor to be used to reduce temperature after each temperature loop in Simulated Annealing.

Parameters
temperature_factorThe factor to reduce temperature

◆ SetUseAdaptiveParameters()

void Unfit::Options::SetUseAdaptiveParameters ( bool  adaptive)

Set the maximum number of iterations for the optimization problem. The optimization will terminate if the maximum number of iterations is reached before convergence.

Parameters
adaptiveSet to true if adaptive parameters are wanted, or turn them off by passing false

◆ SetUseBroydenUpdates()

void Unfit::Options::SetUseBroydenUpdates ( bool  use_broyden)

Choose whether or not we are using Broyden rank one updates for the Levenberg Marquart algorithm. The default is yes (true).

Parameters
use_broydentrue if using Broyden rank one updates, otherwise false

◆ SetUseHardBounds()

void Unfit::Options::SetUseHardBounds ( bool  use_hard_bounds)

For Differential Evolution, this sets whether or not the specified bounds are strictly enforced. If false, the solution can be outside the specified bounds (bounds are then essentially only used to generate the initial populations). If true, the solution must lie within the same bounds that were used to generate the population.

Parameters
use_hard_boundsWhether or not hard bounds are in use

◆ SetUseMultiThreaded()

void Unfit::Options::SetUseMultiThreaded ( bool  use_multi_threaded)

Sets whether or not the algorithms in Unfit run multi-threaded or on a single thread (parallel or serial execution).

Parameters
use_multi_threadedTrue if using multi-threaded code, false otherwise

◆ SetUserSetPopulation()

void Unfit::Options::SetUserSetPopulation ( bool  has_set_population)

Sets whether or not the user has provided a population to the optimizer.

Parameters
has_set_populationTrue if a population is given, false otherwise

◆ SetWeightingFactor()

void Unfit::Options::SetWeightingFactor ( double  weighting_factor)

Set the differential weighting factor (F) to be used by the differential evolution algorithm. This is used as a weight when combining different population vectors.

Parameters
weighting_factorthe differential weighting factor

Member Data Documentation

◆ add_initial_to_population_

bool Unfit::Options::add_initial_to_population_
private

If true, the initial coordinates passed in to FindMin are included in the initial population. If false, all population members are randomly generated. (Currently only implemented for Differential Evolution)

◆ alpha_

double Unfit::Options::alpha_
private

Used as a scale for the reflect operation for the NelderMead algorithm. Used as initial guess for the step size in the steepest descent algorithm

◆ beta_

double Unfit::Options::beta_
private

Used as a scale for the expand operation in the NelderMead algorithm. Used as Armijo rule factor in the steepest descent algorithm.

◆ cost_norm_type_

unsigned Unfit::Options::cost_norm_type_
private

Specify the norm type, L2 (default) or L1, for cost calculations

◆ cost_tolerance_

double Unfit::Options::cost_tolerance_
private

The tolerance for the convergence of the cost function. This represents the epsilon parameter in the Levenberg-Marquardt algorithm.

◆ cross_over_

double Unfit::Options::cross_over_
private

Sets the cross over for the DE algorithm (sometimes called CR)

◆ default_add_initial_to_population_

constexpr bool Unfit::Options::default_add_initial_to_population_ = false
staticprivate

By default, the program will generate the whole population for DE

◆ default_alpha_

constexpr double Unfit::Options::default_alpha_ = 1.0
staticprivate

Default value of the parameter alpha

◆ default_beta_

constexpr double Unfit::Options::default_beta_ = 2.0
staticprivate

Default value of the parameter beta

◆ default_cost_norm_type_

constexpr unsigned Unfit::Options::default_cost_norm_type_ = 2
staticprivate

Default norm type for cost calculation, L2

◆ default_cost_tolerance_

constexpr double Unfit::Options::default_cost_tolerance_ = 1e-12
staticprivate

Default tolerance for the convergence of the cost function

◆ default_cross_over_

constexpr double Unfit::Options::default_cross_over_ = 0.9
staticprivate

Default cross over for the DE algorithm (sometimes called CR)

◆ default_degenerate_tolerance_

constexpr double Unfit::Options::default_degenerate_tolerance_ = 1e-8
staticprivate

Default tolerance for Nelder-Mead to check vertex colinearity

◆ default_delta_

constexpr double Unfit::Options::default_delta_ = 0.5
staticprivate

Default scale the shrink operation for the NelderMead algorithm

◆ default_elitism_

constexpr unsigned Unfit::Options::default_elitism_ = 1
staticprivate

Sets the number of chromosomes immune from mutation

◆ default_epsilon_

constexpr double Unfit::Options::default_epsilon_ = 1e-12
staticprivate

Default convergence tolerance for the increment vector in LM

◆ default_gamma_

constexpr double Unfit::Options::default_gamma_ = 0.5
staticprivate

Default scale the contract operation for the NelderMead algorithm

◆ default_geometric_tolerance_

constexpr double Unfit::Options::default_geometric_tolerance_ = 1e-4
staticprivate

Default tolerance for the convergence of the solution space

◆ default_max_function_evaluations_

constexpr unsigned Unfit::Options::default_max_function_evaluations_ = 100000
staticprivate

Default maximum number of function evaluations before termination

◆ default_max_iterations_

constexpr unsigned Unfit::Options::default_max_iterations_ = 10000
staticprivate

Default maximum number of iterations before termination

◆ default_num_cycles_

constexpr int Unfit::Options::default_num_cycles_ = 20
staticprivate

Default number of cycles for the SA algorithm

◆ default_num_temperature_loops_

constexpr int Unfit::Options::default_num_temperature_loops_ = 5
staticprivate

Default number of temperature loops for the SA algorithm

◆ default_output_level_

constexpr unsigned Unfit::Options::default_output_level_ = 0
staticprivate

Default output level for the optimization

◆ default_population_size_

constexpr unsigned Unfit::Options::default_population_size_ = 20
staticprivate

Default size of the population for the GA and DE algorithms

◆ default_seed_

constexpr unsigned Unfit::Options::default_seed_ = 0
staticprivate

Default seed for the random number generators in GA and DE

◆ default_step_reduction_factor_

constexpr double Unfit::Options::default_step_reduction_factor_ = 0.9
staticprivate

Default step reduction factor for the SA algorithm

◆ default_strategy_

constexpr unsigned Unfit::Options::default_strategy_ = 1
staticprivate

Default strategy for the DE algorithm

◆ default_survival_rate_

constexpr double Unfit::Options::default_survival_rate_ = 0.5
staticprivate

Sets the proportion of chromosomes that survive each generation

◆ default_tau_

constexpr double Unfit::Options::default_tau_ = 1e-3
staticprivate

Default scale the initial damping parameter (mu) in LevenbergMarquardt

◆ default_temperature_

constexpr double Unfit::Options::default_temperature_ = 1000.0
staticprivate

Default initial temperature for the SA algorithm

◆ default_temperature_reduction_factor_

constexpr double Unfit::Options::default_temperature_reduction_factor_ = 0.5
staticprivate

Default temperature reduction factor for the SA algorithm

◆ default_use_adaptive_

constexpr bool Unfit::Options::default_use_adaptive_ = false
staticprivate

Default is to not use adaptive parameters

◆ default_use_broyden_updates_

constexpr bool Unfit::Options::default_use_broyden_updates_ = true
staticprivate

By default, the program will use Broyden rank one updates for LM

◆ default_use_hard_bounds_

constexpr bool Unfit::Options::default_use_hard_bounds_ = false
staticprivate

By default, the program allows solutions outside the set bounds for DE

◆ default_use_multi_threaded_

constexpr bool Unfit::Options::default_use_multi_threaded_ = false
staticprivate

By default, the program will run everything on one thread

◆ default_user_has_set_population_

constexpr bool Unfit::Options::default_user_has_set_population_ = false
staticprivate

By default, the program will generate a population

◆ default_user_has_set_population_size_

constexpr bool Unfit::Options::default_user_has_set_population_size_ = false
staticprivate

By default, the program will try to choose a population size

◆ default_weighting_factor_

constexpr double Unfit::Options::default_weighting_factor_ = 0.8
staticprivate

Default weighting factor for the DE algorithm (sometimes called F)

◆ degenerate_tolerance_

double Unfit::Options::degenerate_tolerance_
private

A tolerance for Nelder-Mead to check the colinearity of the vertices

◆ delta_

double Unfit::Options::delta_
private

Scales the shrink operation for the NelderMead algorithm. This is the size of the finite difference step used to approximate the jacobian matrix in the LevenbergMarquardt algorithm.

◆ elitism_

unsigned Unfit::Options::elitism_
private

Sets the number of chromosomes immune from mutation

◆ epsilon_

double Unfit::Options::epsilon_
private

Sets the convergence tolerance for the increment vector in LM

◆ gamma_

double Unfit::Options::gamma_
private

Scales the contract operation for the NelderMead algorithm

◆ geometric_tolerance_

double Unfit::Options::geometric_tolerance_
private

A tolerance for the convergence of the solution space

◆ max_function_evaluations_

unsigned Unfit::Options::max_function_evaluations_
private

Maximum number of function evaluations permitted before termination

◆ max_iterations_

unsigned Unfit::Options::max_iterations_
private

Maximum number of iterations permitted before termination

◆ num_cycles_

int Unfit::Options::num_cycles_
private

Sets the number of cycles for the SA algorithm

◆ num_temperature_loops_

int Unfit::Options::num_temperature_loops_
private

Sets the number of temperature loops for the SA algorithm

◆ output_level_

unsigned Unfit::Options::output_level_
private

Specify the amount of output to write out during the optimization

◆ population_size_

unsigned Unfit::Options::population_size_
private

Sets the size of the population for the GA and DE algorithms

◆ seed_

unsigned Unfit::Options::seed_
private

Sets the seed for the random number generators in GA and DE

◆ step_reduction_factor_

double Unfit::Options::step_reduction_factor_
private

Sets the step reduction factor for the SA algorithm

◆ strategy_

unsigned Unfit::Options::strategy_
private

Sets the strategy for the DE algorithm (1-10)

◆ survival_rate_

double Unfit::Options::survival_rate_
private

Sets the proportion of chromosomes that survive each generation

◆ tau_

double Unfit::Options::tau_
private

Scales the initial damping parameter (mu) in LevenbergMarquardt

◆ temperature_

double Unfit::Options::temperature_
private

Sets the initial temperature for the SA algorithm

◆ temperature_reduction_factor_

double Unfit::Options::temperature_reduction_factor_
private

Sets the temperature reduction factor for the SA algorithm

◆ use_adaptive_

bool Unfit::Options::use_adaptive_
private

Sets whether or not adaptive parameters are to be used

◆ use_broyden_updates_

bool Unfit::Options::use_broyden_updates_
private

If true, the Levenberg Marquardt algorithm will use Broyden rank one updates to minimise cost-function calls. If false gradients are always calculated using finite differences.

◆ use_hard_bounds_

bool Unfit::Options::use_hard_bounds_
private

Whether or not the solution can lie outside the specified bounds. Currently only implemented for Differential Evolution.

◆ use_multi_threaded_

bool Unfit::Options::use_multi_threaded_
private

Whether or not to use a multi-threaded implementation of the algorithms, where available.

◆ user_has_set_population_

bool Unfit::Options::user_has_set_population_
private

True if the user has set the population themselves, otherwise false

◆ user_has_set_population_size_

bool Unfit::Options::user_has_set_population_size_
private

True if the user has set the population size themselves, otherwise false

◆ weighting_factor_

double Unfit::Options::weighting_factor_
private

Sets the weighting factor for the DE algorithm (sometimes called F)


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