Table of Contents

Class SimulatedAnnealing<TRng>

Namespace
NanoQL.Numerics
Assembly
NanoQL.dll

Simulated annealing: Numerical Recipes in C (second edition), Chapter 10.9, with the original exit criterion in f(x) replaced by one in x (as the simplex method's).

public sealed class SimulatedAnnealing<TRng> : OptimizationMethod where TRng : class, IRng

Type Parameters

TRng

The generator of the thermal fluctuations, whose samples are uniform in (0, 1).

Inheritance
SimulatedAnnealing<TRng>
Inherited Members

Remarks

Immutable: it holds a copy of the generator it is given, and each minimization draws from a copy of that, so a second minimization repeats the first's draws, where QuantLib's continues its generator's stream (Divergences/SimulatedAnnealingTests.cs). The generator is required: QuantLib's default, a Mersenne Twister seeded from the clock, is refused.

A vertex whose value is NaN enters the simplex at the largest double, where QuantLib's guard on the initial vertices tests the previous trial's value instead (left from an earlier minimization, or unset) and so lets the NaN in; the vertices a contraction moves are guarded alike, which QuantLib's leaves out.

Constructors

SimulatedAnnealing(double, double, double, int, TRng)

Initializes a new instance of the SimulatedAnnealing<TRng> class that reduces the temperature T by a factor of (1 − ε) after m moves.

public SimulatedAnnealing(double lambda, double T0, double epsilon, int m, TRng rng)

Parameters

lambda double

The characteristic length of the initial simplex.

T0 double

The initial temperature.

epsilon double

The temperature's reduction factor ε.

m int

The number of moves between reductions, not negative.

rng TRng

The generator, which it copies.

Exceptions

ArgumentOutOfRangeException

m is negative.

SimulatedAnnealing(double, double, int, double, TRng)

Initializes a new instance of the SimulatedAnnealing<TRng> class that budgets a total of K moves and sets the temperature T to the initial temperature times (1 − k/K)^α, with k 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.

public SimulatedAnnealing(double lambda, double T0, int K, double alpha, TRng rng)

Parameters

lambda double

The characteristic length of the initial simplex.

T0 double

The initial temperature.

K int

The budget of moves, not negative.

alpha double

The temperature's exponent α.

rng TRng

The generator, which it copies.

Exceptions

ArgumentOutOfRangeException

K is negative.

Methods

MinimizeCore(ProblemState, EndCriteria)

The method's algorithm, QuantLib's minimize: minimizes from the state's current value.

protected override EndCriteriaType MinimizeCore(ProblemState P, EndCriteria ec)

Parameters

P ProblemState

The working state, which the minimization changes.

ec EndCriteria

Returns

EndCriteriaType

The end criterion met.