|
OptiPy
|
Implements the DE/rand/2 mutation strategy. More...
#include <Rand2.h>
Public Member Functions | |
| 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/rand/2 strategy. | |
| Public Member Functions inherited from Mutation | |
| virtual | ~Mutation ()=default |
| Virtual destructor for safe polymorphic deletion. | |
Additional Inherited Members | |
| Protected Member Functions inherited from Mutation | |
| 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. | |
Implements the DE/rand/2 mutation strategy.
Strategy: DE/rand/2 (Random-2)
An extremely exploratory mutation strategy that applies two independent difference vectors to a random base. This creates maximum variation and is most robust to premature convergence at the cost of slow optimization.
Formula:
\[ v_i(t) = x_{r0}(t) + F \cdot (x_{r1}(t) - x_{r2}(t)) + F \cdot (x_{r3}(t) - x_{r4}(t)) \]
Where:
Algorithm:
Characteristics:
Exploration: Extreme
Exploitation: Minimal
Robustness: Outstanding
Convergence Speed: Very slow
Population Size Requirements:
Parameter Recommendations:
Comparison with Other Strategies:
| Strategy | Base | Differences | Exploration | Convergence |
|---|---|---|---|---|
| Rand1 | Random | 1 | Very High | Very Slow |
| Best1 | Best | 1 | Very Low | Very Fast |
| Rand2 | Random | 2 | Extreme | Extremely Slow |
| Best2 | Best | 2 | Moderate | Moderate |
| RandBest1 | Hybrid | 1 | Moderate | Moderate |
Use Cases:
Avoid When:
Computational Considerations:
Cost Factors:
When It Pays Off:
Implementation Details:
The implementation uses two independent difference vectors:
Complexity:
Time: O(dimension) Space: O(dimension) for the mutant vector
Example Usage:
Typical Performance Profile:
Historical Context:
DE/rand/2 provides the theoretical maximum exploration within the DE framework. While rarely the best choice for a specific problem, it serves as a robustness baseline and is valuable for problems with unknown structure.
|
inlineoverridevirtual |
Generates a mutant vector using DE/rand/2 strategy.
Applies the formula: mutant = r0 + F * (r1 - r2) + F * (r3 - r4) where r0, r1, r2, r3, r4 are five randomly selected distinct individuals.
| [in] | population | Current population of solutions |
| [in] | targetIndex | Index of the target individual (excluded from selection) |
| [in] | F | Differential weight; typical range 0.4-0.8 |
| [in] | bestVector | Best solution (unused by Rand2, but required by interface) |
| [in,out] | mt | Random number generator for selection |
| [in] | lowerBound | Lower domain bound |
| [in] | upperBound | Upper domain bound |
Implements Mutation.