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 Attributes | List of all members
HybridSimulatedAnnealing< Sampler, Probability, Temperature, Reannealing > Class Template Reference

#include <hybridsimulatedannealing.hpp>

+ Inheritance diagram for HybridSimulatedAnnealing< Sampler, Probability, Temperature, Reannealing >:
+ Collaboration diagram for HybridSimulatedAnnealing< Sampler, Probability, Temperature, Reannealing >:

Public Types

enum  LocalOptimizeScheme { NoLocalOptimize , EveryNewPoint , EveryBestPoint }
 
enum  ResetScheme { NoResetScheme , ResetToBestPoint , ResetToOrigin }
 

Public Member Functions

 HybridSimulatedAnnealing (const Sampler &sampler, const Probability &probability, Temperature temperature, const Reannealing &reannealing=ReannealingTrivial(), Real startTemperature=200.0, Real endTemperature=0.01, Size reAnnealSteps=50, ResetScheme resetScheme=ResetToBestPoint, Size resetSteps=150, ext::shared_ptr< OptimizationMethod > localOptimizer=ext::shared_ptr< OptimizationMethod >(), LocalOptimizeScheme optimizeScheme=EveryBestPoint)
 
EndCriteria::Type minimize (Problem &P, const EndCriteria &endCriteria) 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 Attributes

Sampler sampler_
 
Probability probability_
 
Temperature temperature_
 
Reannealing reannealing_
 
Real startTemperature_
 
Real endTemperature_
 
Size reAnnealSteps_
 
ResetScheme resetScheme_
 
Size resetSteps_
 
ext::shared_ptr< OptimizationMethodlocalOptimizer_
 
LocalOptimizeScheme optimizeScheme_
 

Detailed Description

template<class Sampler, class Probability, class Temperature, class Reannealing = ReannealingTrivial>
class QuantLib::HybridSimulatedAnnealing< Sampler, Probability, Temperature, Reannealing >

Method is fairly straightforward: 1) Sampler provides a probability density (based on current value) for the parameters. Each iteration a new draw is made from it to find a new point 2) Probability determines whether the new point, obtained from Sampler, is accepted or not 3) Temperature is a schedule T(k) for the iteration k, which affects the Sampler and Probability 4) Reannealing is a departure from the traditional Boltzmann Annealing method: it rescales the iteration k independently for each dimension so as to improve convergence

The hybrid in the name is because one can provide it a local optimizer for use whenever any new best point is found or at every accepted point, in which case is used is chose by the user.

Class Sampler must implement the following interface:

void operator()(Array &newPoint, const Array &currentPoint, const Array &temp) const;
1-D array used in linear algebra.
Definition: array.hpp:52

Class Probability must implement the following interface:

bool operator()(Real currentValue, Real newValue, const Array &temp) const;
QL_REAL Real
real number
Definition: types.hpp:50

Class Temperature must implement the following interface:

void operator()(Array &newTemp, const Array &currTemp, const Array &steps) const;

Class Reannealing must implement the following interface:

void operator()(Array & steps, const Array &currentPoint,
Real aCurrentValue, const Array & currTemp) const;
Examples
GlobalOptimizer.cpp.

Definition at line 67 of file hybridsimulatedannealing.hpp.

Member Enumeration Documentation

◆ LocalOptimizeScheme

Enumerator
NoLocalOptimize 
EveryNewPoint 
EveryBestPoint 

Definition at line 69 of file hybridsimulatedannealing.hpp.

◆ ResetScheme

Enumerator
NoResetScheme 
ResetToBestPoint 
ResetToOrigin 

Definition at line 74 of file hybridsimulatedannealing.hpp.

Constructor & Destructor Documentation

◆ HybridSimulatedAnnealing()

HybridSimulatedAnnealing ( const Sampler &  sampler,
const Probability probability,
Temperature  temperature,
const Reannealing &  reannealing = ReannealingTrivial(),
Real  startTemperature = 200.0,
Real  endTemperature = 0.01,
Size  reAnnealSteps = 50,
ResetScheme  resetScheme = ResetToBestPoint,
Size  resetSteps = 150,
ext::shared_ptr< OptimizationMethod localOptimizer = ext::shared_ptr<OptimizationMethod>(),
LocalOptimizeScheme  optimizeScheme = EveryBestPoint 
)

Definition at line 80 of file hybridsimulatedannealing.hpp.

Member Function Documentation

◆ minimize()

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

minimize the optimization problem P

Implements OptimizationMethod.

Definition at line 120 of file hybridsimulatedannealing.hpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ sampler_

Sampler sampler_
private

Definition at line 106 of file hybridsimulatedannealing.hpp.

◆ probability_

Probability probability_
private

Definition at line 107 of file hybridsimulatedannealing.hpp.

◆ temperature_

Temperature temperature_
private

Definition at line 108 of file hybridsimulatedannealing.hpp.

◆ reannealing_

Reannealing reannealing_
private

Definition at line 109 of file hybridsimulatedannealing.hpp.

◆ startTemperature_

Real startTemperature_
private

Definition at line 110 of file hybridsimulatedannealing.hpp.

◆ endTemperature_

Real endTemperature_
private

Definition at line 111 of file hybridsimulatedannealing.hpp.

◆ reAnnealSteps_

Size reAnnealSteps_
private

Definition at line 112 of file hybridsimulatedannealing.hpp.

◆ resetScheme_

ResetScheme resetScheme_
private

Definition at line 113 of file hybridsimulatedannealing.hpp.

◆ resetSteps_

Size resetSteps_
private

Definition at line 114 of file hybridsimulatedannealing.hpp.

◆ localOptimizer_

ext::shared_ptr<OptimizationMethod> localOptimizer_
private

Definition at line 115 of file hybridsimulatedannealing.hpp.

◆ optimizeScheme_

LocalOptimizeScheme optimizeScheme_
private

Definition at line 116 of file hybridsimulatedannealing.hpp.