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

Differential Evolution configuration object. More...

#include <differentialevolution.hpp>

+ Inheritance diagram for DifferentialEvolution:
+ Collaboration diagram for DifferentialEvolution:

Classes

struct  Candidate
 
class  Configuration
 

Public Types

enum  Strategy {
  Rand1Standard , BestMemberWithJitter , CurrentToBest2Diffs , Rand1DiffWithPerVectorDither ,
  Rand1DiffWithDither , EitherOrWithOptimalRecombination , Rand1SelfadaptiveWithRotation
}
 
enum  CrossoverType { Normal , Binomial , Exponential }
 

Public Member Functions

 DifferentialEvolution (const Configuration &configuration=Configuration())
 
EndCriteria::Type minimize (Problem &p, const EndCriteria &endCriteria) override
 minimize the optimization problem P More...
 
const Configurationconfiguration () const
 
- 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

void fillInitialPopulation (std::vector< Candidate > &population, const Problem &p) const
 
void getCrossoverMask (std::vector< Array > &crossoverMask, std::vector< Array > &invCrossoverMask, const Array &mutationProbabilities) const
 
Array getMutationProbabilities (const std::vector< Candidate > &population) const
 
void adaptSizeWeights () const
 
void adaptCrossover () const
 
void calculateNextGeneration (std::vector< Candidate > &population, Problem &costFunction) const
 
Array rotateArray (Array inputArray) const
 
void crossover (const std::vector< Candidate > &oldPopulation, std::vector< Candidate > &population, const std::vector< Candidate > &mutantPopulation, const std::vector< Candidate > &mirrorPopulation, Problem &costFunction) const
 

Private Attributes

Configuration configuration_
 
Array upperBound_
 
Array lowerBound_
 
Array currGenSizeWeights_
 
Array currGenCrossover_
 
Candidate bestMemberEver_
 
MersenneTwisterUniformRng rng_
 

Detailed Description

Differential Evolution configuration object.

The algorithm and strategy names are taken from here:

Price, K., Storn, R., 1997. Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces. Journal of Global Optimization, Kluwer Academic Publishers, 1997, Vol. 11, pp. 341 - 359.

There are seven basic strategies for creating mutant population currently implemented. Three basic crossover types are also available.

Future development: 1) base element type to be extracted 2) L differences to be used instead of fixed number 3) various weights distributions for the differences (dither etc.) 4) printFullInfo parameter usage to track the algorithm

Warning:
This was reported to fail tests on Mac OS X 10.8.4.

OptimizationMethod using Differential Evolution algorithm

Examples
GlobalOptimizer.cpp.

Definition at line 59 of file differentialevolution.hpp.

Member Enumeration Documentation

◆ Strategy

enum Strategy
Enumerator
Rand1Standard 
BestMemberWithJitter 
CurrentToBest2Diffs 
Rand1DiffWithPerVectorDither 
Rand1DiffWithDither 
EitherOrWithOptimalRecombination 
Rand1SelfadaptiveWithRotation 

Definition at line 61 of file differentialevolution.hpp.

◆ CrossoverType

Enumerator
Normal 
Binomial 
Exponential 

Definition at line 70 of file differentialevolution.hpp.

Constructor & Destructor Documentation

◆ DifferentialEvolution()

DifferentialEvolution ( const Configuration configuration = Configuration())

Definition at line 163 of file differentialevolution.hpp.

Member Function Documentation

◆ minimize()

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

minimize the optimization problem P

Implements OptimizationMethod.

Definition at line 47 of file differentialevolution.cpp.

+ Here is the call graph for this function:

◆ configuration()

const Configuration & configuration ( ) const

Definition at line 168 of file differentialevolution.hpp.

+ Here is the caller graph for this function:

◆ fillInitialPopulation()

void fillInitialPopulation ( std::vector< Candidate > &  population,
const Problem p 
) const
private

Definition at line 378 of file differentialevolution.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCrossoverMask()

void getCrossoverMask ( std::vector< Array > &  crossoverMask,
std::vector< Array > &  invCrossoverMask,
const Array mutationProbabilities 
) const
private

Definition at line 308 of file differentialevolution.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMutationProbabilities()

Array getMutationProbabilities ( const std::vector< Candidate > &  population) const
private

Definition at line 323 of file differentialevolution.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ adaptSizeWeights()

void adaptSizeWeights ( ) const
private

Definition at line 356 of file differentialevolution.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ adaptCrossover()

void adaptCrossover ( ) const
private

Definition at line 370 of file differentialevolution.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateNextGeneration()

void calculateNextGeneration ( std::vector< Candidate > &  population,
Problem costFunction 
) const
private

Definition at line 109 of file differentialevolution.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rotateArray()

Array rotateArray ( Array  inputArray) const
private

Definition at line 351 of file differentialevolution.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ crossover()

void crossover ( const std::vector< Candidate > &  oldPopulation,
std::vector< Candidate > &  population,
const std::vector< Candidate > &  mutantPopulation,
const std::vector< Candidate > &  mirrorPopulation,
Problem costFunction 
) const
private

Definition at line 259 of file differentialevolution.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ configuration_

Configuration configuration_
private

Definition at line 173 of file differentialevolution.hpp.

◆ upperBound_

Array upperBound_
private

Definition at line 174 of file differentialevolution.hpp.

◆ lowerBound_

Array lowerBound_
private

Definition at line 174 of file differentialevolution.hpp.

◆ currGenSizeWeights_

Array currGenSizeWeights_
mutableprivate

Definition at line 175 of file differentialevolution.hpp.

◆ currGenCrossover_

Array currGenCrossover_
private

Definition at line 175 of file differentialevolution.hpp.

◆ bestMemberEver_

Candidate bestMemberEver_
private

Definition at line 176 of file differentialevolution.hpp.

◆ rng_

Definition at line 177 of file differentialevolution.hpp.