QuantLib: FireflyAlgorithm Class Reference

A free/open-source library for quantitative finance Reference manual - version 1.20

Classes | Public Member Functions | Protected Attributes | Friends | List of all members
FireflyAlgorithm Class Reference

`#include <ql/experimental/math/fireflyalgorithm.hpp>`

Inheritance diagram for FireflyAlgorithm:
[legend]

## Classes
class | Intensity
| Base intensity class. More...
class | RandomWalk
| Base Random Walk class. More...

## Public Member Functions
| FireflyAlgorithm (Size M, const ext::shared_ptr< Intensity > &intensity, const ext::shared_ptr< RandomWalk > &randomWalk, Size Mde=0, Real mutationFactor=1.0, Real crossoverFactor=0.5, unsigned long seed=SeedGenerator::instance().get())
void | startState (Problem &P, const EndCriteria &endCriteria)
EndCriteria::Type | minimize (Problem &P, const EndCriteria &endCriteria)
| minimize the optimization problem P

## Protected Attributes
std::vector< Array > | x_
std::vector< Array > | xI_
std::vector< Array > | xRW_
std::vector< std::pair< Real, Size > > | values_
Array | lX_
Array | uX_
Real | mutation_
Real | crossover_
Size | M_
Size | N_
Size | Mde_
Size | Mfa_
ext::shared_ptr< Intensity > | intensity_
ext::shared_ptr< RandomWalk > | randomWalk_
variate_integer | drawIndex_
MersenneTwisterUniformRng | rng_

## Friends
class | RandomWalk
class | Intensity

## Detailed Description

The main process is as follows: M individuals are used to explore the N-dimensional parameter space: \( X_{i}^k = (X_{i, 1}^k, X_{i, 2}^k, \ldots, X_{i, N}^k) \) is the kth-iteration for the ith-individual. X is updated via the rule

\[ X_{i, j}^{k+1} = X_{i, j}^k + I(X^k)_{i,j} + RandomWalk_{i,j}^k \]

The intensity function I(X) should be monotonic The optimization stops either because the number of iterations has been reached or because the stationary function value limit has been reached.

The current implementation extends the normal Firefly Algorithm with a differential evolution (DE) optimizer according to: Afnizanfaizal Abdullah, et al. "A New Hybrid Firefly Algorithm for Complex and Nonlinear Problem". Volume 151 of the series Advances in Intelligent and Soft Computing pp 673-680, 2012. http://link.springer.com/chapter/10.1007%2F978-3-642-28765-7_81

In effect this implementation provides a fully fledged DE global optimizer as well. The Firefly Algorithm was easy to combine with DE because it already contained a step where the current solutions are sorted. The population is then divided into two subpopulations based on their order. The subpopulation with the best results are updated via the firefly algorithm. The worse subpopulation is updated via the DE operator:

\[ Y^{k+1} = X_{best}^k + F(X_{r1}^k - X_{r2}^k) \]

and

\[ X_{i,j}^{k+1} = Y_{i,j}^{k+1}\ \text{if} R_{i,j} <= C \]

\[ X_{i,j}^{k+1} = X_{i,j}^{k+1}\ \text{otherwise} \]

where C is the crossover constant, and R is a random uniformly distributed number.

Examples
  GlobalOptimizer.cpp.