|
| std::vector< double > | mutate (const std::vector< std::vector< double > > &population, size_t targetIndex, double F, const std::vector< double > &bestVector, MersenneTwister &mt, double lowerBound, double upperBound) override |
| | Generates a mutant vector using DE/best/2 strategy.
|
|
virtual | ~Mutation ()=default |
| | Virtual destructor for safe polymorphic deletion.
|
|
| std::vector< size_t > | getSubset (size_t populationSize, size_t subsetSize, size_t source, MersenneTwister &mt) |
| | Selects a random subset of population indices, excluding a source index.
|
◆ mutate()
| std::vector< double > Best2::mutate |
( |
const std::vector< std::vector< double > > & | population, |
|
|
size_t | targetIndex, |
|
|
double | F, |
|
|
const std::vector< double > & | bestVector, |
|
|
MersenneTwister & | mt, |
|
|
double | lowerBound, |
|
|
double | upperBound ) |
|
inlineoverridevirtual |
Generates a mutant vector using DE/best/2 strategy.
Applies the formula: mutant = best + F * (r1 - r2) + F * (r3 - r4) where r1, r2, r3, r4 are four randomly selected distinct individuals.
- Parameters
-
| [in] | population | Current population of solutions |
| [in] | targetIndex | Index of the target individual (excluded from selection) |
| [in] | F | Differential weight; typical range 0.5-1.0 |
| [in] | bestVector | The best solution found so far (used as base) |
| [in,out] | mt | Random number generator for selection |
| [in] | lowerBound | Lower domain bound |
| [in] | upperBound | Upper domain bound |
- Returns
- Mutant vector with all values clamped to [lowerBound, upperBound]
Implements Mutation.
The documentation for this class was generated from the following file:
- src/opti_py/cpp/include/opti_py/Optimizer/DifferentialEvolution/Mutation/Best2.h