Xmipp
v3.23.11-Nereus
|
#include <numerical_tools.h>
Public Member Functions | |
DESolver (int dim, int popSize) | |
Empty constructor. More... | |
DESolver (const DESolver &)=delete | |
DESolver & | operator= (const DESolver &)=delete |
virtual | ~DESolver (void) |
Destructor. More... | |
void | Setup (double min[], double max[], int deStrategy, double diffScale, double crossoverProb) |
Setup() must be called before solve to set min, max, strategy etc. More... | |
virtual bool | Solve (int maxGenerations) |
virtual double | EnergyFunction (double testSolution[], bool &bAtSolution)=0 |
int | Dimension () const |
Return dimension. More... | |
int | Population () const |
Return population. More... | |
double | Energy () const |
Call these functions after Solve() to get results. More... | |
double * | Solution (void) |
Return best solution. More... | |
int | Generations () const |
Return the number of generations. More... | |
Protected Member Functions | |
void | SelectSamples (int candidate, int *r1, int *r2=nullptr, int *r3=nullptr, int *r4=nullptr, int *r5=nullptr) |
Protected Attributes | |
int | nDim |
int | nPop |
int | generations |
int | strategy |
StrategyFunction | calcTrialSolution |
double | scale |
double | probability |
double | trialEnergy |
double | bestEnergy |
double * | trialSolution |
double * | bestSolution |
double * | popEnergy |
double * | population |
Differential evolution class. For further information visit: http://www.icsi.berkeley.edu/~storn/code.html Example of use:
Definition at line 312 of file numerical_tools.h.
DESolver::DESolver | ( | int | dim, |
int | popSize | ||
) |
|
delete |
|
virtual |
|
inline |
Return dimension.
Definition at line 344 of file numerical_tools.h.
|
inline |
Call these functions after Solve() to get results.
Definition at line 356 of file numerical_tools.h.
|
pure virtual |
EnergyFunction must be overridden for problem to solve testSolution[] is nDim array for a candidate solution setting bAtSolution = true indicates solution is found and Solve() immediately returns true.
Implemented in WedgeSolver, and EulerSolver.
|
inline |
|
inline |
Return population.
Definition at line 350 of file numerical_tools.h.
|
protected |
Definition at line 749 of file numerical_tools.cpp.
void DESolver::Setup | ( | double | min[], |
double | max[], | ||
int | deStrategy, | ||
double | diffScale, | ||
double | crossoverProb | ||
) |
Setup() must be called before solve to set min, max, strategy etc.
Definition at line 417 of file numerical_tools.cpp.
|
inline |
|
virtual |
Solve() returns true if EnergyFunction() returns true. Otherwise it runs maxGenerations generations and returns false.
Definition at line 488 of file numerical_tools.cpp.
|
protected |
Definition at line 391 of file numerical_tools.h.
|
protected |
Definition at line 394 of file numerical_tools.h.
|
protected |
Definition at line 386 of file numerical_tools.h.
|
protected |
Definition at line 383 of file numerical_tools.h.
|
protected |
Definition at line 381 of file numerical_tools.h.
|
protected |
Definition at line 382 of file numerical_tools.h.
|
protected |
Definition at line 395 of file numerical_tools.h.
|
protected |
Definition at line 396 of file numerical_tools.h.
|
protected |
Definition at line 388 of file numerical_tools.h.
|
protected |
Definition at line 387 of file numerical_tools.h.
|
protected |
Definition at line 385 of file numerical_tools.h.
|
protected |
Definition at line 390 of file numerical_tools.h.
|
protected |
Definition at line 393 of file numerical_tools.h.