QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
SimulatedAnnealing< RNG > Class Template Reference

Simulated Annealing. More...

#include <simulatedannealing.hpp>

+ Inheritance diagram for SimulatedAnnealing< RNG >:
+ Collaboration diagram for SimulatedAnnealing< RNG >:

Public Types

enum  Scheme { ConstantFactor , ConstantBudget }
 

Public Member Functions

 SimulatedAnnealing (const Real lambda, const Real T0, const Real epsilon, const Size m, const RNG &rng=RNG())
 
 SimulatedAnnealing (const Real lambda, const Real T0, const Size K, const Real alpha, const RNG &rng=RNG())
 
EndCriteria::Type minimize (Problem &P, const EndCriteria &ec) override
 minimize the optimization problem P More...
 
- Public Member Functions inherited from OptimizationMethod
virtual ~OptimizationMethod ()=default
 
virtual EndCriteria::Type minimize (Problem &P, const EndCriteria &endCriteria)=0
 minimize the optimization problem P More...
 

Private Member Functions

Real simplexSize ()
 
void amotsa (Problem &, Real)
 

Private Attributes

const Scheme scheme_
 
const Real lambda_
 
const Real T0_
 
const Real epsilon_
 
const Real alpha_
 
const Size K_
 
const RNG rng_
 
Real T_
 
std::vector< Arrayvertices_
 
Array values_
 
Array sum_
 
Integer i_
 
Integer ihi_
 
Integer ilo_
 
Integer j_
 
Integer m_
 
Integer n_
 
Real fac1_
 
Real fac2_
 
Real yflu_
 
Real rtol_
 
Real swap_
 
Real yhi_
 
Real ylo_
 
Real ynhi_
 
Real ysave_
 
Real yt_
 
Real ytry_
 
Real yb_
 
Real tt_
 
Array pb_
 
Array ptry_
 
Size iteration_
 
Size iterationT_
 

Detailed Description

template<class RNG = MersenneTwisterUniformRng>
class QuantLib::SimulatedAnnealing< RNG >

Simulated Annealing.

Class RNG must implement the following interface:

RNG::sample_type RNG::next() const;
Examples
GlobalOptimizer.cpp.

Definition at line 46 of file simulatedannealing.hpp.

Member Enumeration Documentation

◆ Scheme

enum Scheme
Enumerator
ConstantFactor 
ConstantBudget 

Definition at line 50 of file simulatedannealing.hpp.

Constructor & Destructor Documentation

◆ SimulatedAnnealing() [1/2]

SimulatedAnnealing ( const Real  lambda,
const Real  T0,
const Real  epsilon,
const Size  m,
const RNG &  rng = RNG() 
)

reduce temperature T by a factor of \( (1-\epsilon) \) after m moves

Definition at line 56 of file simulatedannealing.hpp.

◆ SimulatedAnnealing() [2/2]

SimulatedAnnealing ( const Real  lambda,
const Real  T0,
const Size  K,
const Real  alpha,
const RNG &  rng = RNG() 
)

budget a total of K moves, set temperature T to the initial temperature times \( ( 1 - k/K )^\alpha \) with k being the total number of moves so far. After K moves the temperature is guaranteed to be zero, after that the optimization runs like a deterministic simplex algorithm.

Definition at line 68 of file simulatedannealing.hpp.

Member Function Documentation

◆ minimize()

EndCriteria::Type minimize ( Problem P,
const EndCriteria endCriteria 
)
overridevirtual

minimize the optimization problem P

Implements OptimizationMethod.

Definition at line 141 of file simulatedannealing.hpp.

+ Here is the call graph for this function:

◆ simplexSize()

Real simplexSize
private

Definition at line 96 of file simulatedannealing.hpp.

+ Here is the call graph for this function:

◆ amotsa()

void amotsa ( Problem P,
Real  fac 
)
private

Definition at line 111 of file simulatedannealing.hpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ scheme_

const Scheme scheme_
private

Definition at line 77 of file simulatedannealing.hpp.

◆ lambda_

const Real lambda_
private

Definition at line 78 of file simulatedannealing.hpp.

◆ T0_

const Real T0_
private

Definition at line 78 of file simulatedannealing.hpp.

◆ epsilon_

const Real epsilon_
private

Definition at line 78 of file simulatedannealing.hpp.

◆ alpha_

const Real alpha_
private

Definition at line 78 of file simulatedannealing.hpp.

◆ K_

const Size K_
private

Definition at line 79 of file simulatedannealing.hpp.

◆ rng_

const RNG rng_
private

Definition at line 80 of file simulatedannealing.hpp.

◆ T_

Real T_
private

Definition at line 85 of file simulatedannealing.hpp.

◆ vertices_

std::vector<Array> vertices_
private

Definition at line 86 of file simulatedannealing.hpp.

◆ values_

Array values_
private

Definition at line 87 of file simulatedannealing.hpp.

◆ sum_

Array sum_
private

Definition at line 87 of file simulatedannealing.hpp.

◆ i_

Integer i_
private

Definition at line 88 of file simulatedannealing.hpp.

◆ ihi_

Integer ihi_
private

Definition at line 88 of file simulatedannealing.hpp.

◆ ilo_

Integer ilo_
private

Definition at line 88 of file simulatedannealing.hpp.

◆ j_

Integer j_
private

Definition at line 88 of file simulatedannealing.hpp.

◆ m_

Integer m_
private

Definition at line 88 of file simulatedannealing.hpp.

◆ n_

Integer n_
private

Definition at line 88 of file simulatedannealing.hpp.

◆ fac1_

Real fac1_
private

Definition at line 89 of file simulatedannealing.hpp.

◆ fac2_

Real fac2_
private

Definition at line 89 of file simulatedannealing.hpp.

◆ yflu_

Real yflu_
private

Definition at line 89 of file simulatedannealing.hpp.

◆ rtol_

Real rtol_
private

Definition at line 90 of file simulatedannealing.hpp.

◆ swap_

Real swap_
private

Definition at line 90 of file simulatedannealing.hpp.

◆ yhi_

Real yhi_
private

Definition at line 90 of file simulatedannealing.hpp.

◆ ylo_

Real ylo_
private

Definition at line 90 of file simulatedannealing.hpp.

◆ ynhi_

Real ynhi_
private

Definition at line 90 of file simulatedannealing.hpp.

◆ ysave_

Real ysave_
private

Definition at line 90 of file simulatedannealing.hpp.

◆ yt_

Real yt_
private

Definition at line 90 of file simulatedannealing.hpp.

◆ ytry_

Real ytry_
private

Definition at line 90 of file simulatedannealing.hpp.

◆ yb_

Real yb_
private

Definition at line 90 of file simulatedannealing.hpp.

◆ tt_

Real tt_
private

Definition at line 90 of file simulatedannealing.hpp.

◆ pb_

Array pb_
private

Definition at line 91 of file simulatedannealing.hpp.

◆ ptry_

Array ptry_
private

Definition at line 91 of file simulatedannealing.hpp.

◆ iteration_

Size iteration_
private

Definition at line 92 of file simulatedannealing.hpp.

◆ iterationT_

Size iterationT_
private

Definition at line 92 of file simulatedannealing.hpp.