27#ifndef quantlib_optimization_fireflyalgorithm_hpp
28#define quantlib_optimization_fireflyalgorithm_hpp
85 ext::shared_ptr<Intensity> intensity,
86 ext::shared_ptr<RandomWalk> randomWalk,
88 Real mutationFactor = 1.0,
89 Real crossoverFactor = 0.5,
96 std::vector<std::pair<Real, Size> >
values_;
118 const std::vector<Array> *
x_;
119 const std::vector<std::pair<Real, Size> > *
values_;
125 for (
Size i = 0; i <
N_; i++) {
126 Real diff = x[i] -
y[i];
185 const std::vector<Array> *
x_;
186 const std::vector<std::pair<Real, Size> > *
values_;
206 template <
class Distribution>
1-D array used in linear algebra.
DecreasingGaussianWalk(Real sigma, Real delta=0.9, unsigned long seed=SeedGenerator::instance().get())
void walkImpl(Array &xRW) override
void init(FireflyAlgorithm *fa) override
DistributionRandomWalk(Distribution dist, Real delta=0.9, unsigned long seed=SeedGenerator::instance().get())
void walkImpl(Array &xRW) override
void init(FireflyAlgorithm *fa) override
IsotropicRandomWalk< Distribution, std::mt19937 > walkRandom_
Criteria to end optimization process:
Real intensityImpl(Real valueX, Real valueY, Real d) override
ExponentialIntensity(Real beta0, Real betaMin, Real gamma)
void init(FireflyAlgorithm *fa)
virtual ~Intensity()=default
const std::vector< std::pair< Real, Size > > * values_
virtual Real intensityImpl(Real valueX, Real valueY, Real distance)=0
Real distance(const Array &x, const Array &y) const
std::vector< Array > * xI_
const std::vector< Array > * x_
void findBrightest()
find brightest firefly for each firefly
const std::vector< std::pair< Real, Size > > * values_
const std::vector< Array > * x_
virtual void init(FireflyAlgorithm *fa)
std::vector< Array > * xRW_
virtual ~RandomWalk()=default
virtual void walkImpl(Array &xRW)=0
void walk()
perform random walk
std::vector< std::pair< Real, Size > > values_
std::uniform_int_distribution< QuantLib::Size > distribution_
ext::shared_ptr< Intensity > intensity_
void startState(Problem &P, const EndCriteria &endCriteria)
MersenneTwisterUniformRng rng_
std::vector< Array > xRW_
EndCriteria::Type minimize(Problem &P, const EndCriteria &endCriteria) override
minimize the optimization problem P
ext::shared_ptr< RandomWalk > randomWalk_
GaussianWalk(Real sigma, Real delta=0.9, unsigned long seed=SeedGenerator::instance().get())
Inverse Square Intensity.
Real intensityImpl(Real valueX, Real valueY, Real d) override
InverseLawSquareIntensity(Real beta0, Real betaMin)
Levy Flight distribution.
LevyFlightWalk(Real alpha, Real xm=0.5, Real delta=0.9, unsigned long seed=SeedGenerator::instance().get())
Abstract class for constrained optimization method.
Constrained optimization problem.
static SeedGenerator & instance()
access to the unique instance
Abstract constraint class.
std::size_t Size
size of a container
Levy Flight, aka Pareto Type I, distribution.
Abstract optimization problem class.