11 using namespace gplib;
18 GeneralGA(LocalPropagation, LocalPopulation, LocalTranscribe,
19 IndObjective, nthreads), InitTemperature(1.0),
20 AnnealingGeneration(1), AnnealingRatio(1.0)
38 InitTemperature = InitT;
39 AnnealingGeneration = AnnealG;
40 AnnealingRatio = AnnealR;
47 const int popsize = LocalPopulation.
GetPopsize();
49 gplib::rvec CurrentMisFit;
52 if (iterationnumber < AnnealingGeneration)
55 T = InitTemperature / AnnealingRatio;
57 for (
int i = 0; i < popsize; ++i)
59 CurrentMisFit = column(LocalMisFit, i);
60 Probabilities(i) = exp(-ublas::sum(CurrentMisFit) / T);
61 sum += Probabilities(i);
63 const double factor = 1. / sum;
64 for (
int i = 0; i < popsize; ++i)
65 Probabilities(i) *= factor;
The base class for the population of a genetic algorithm, implements storage and access functions...
ublas::vector< double > tprobabilityv
GeneralPopulation *const Population
A pointer to an object holding the population.
const float T[frequenzen]
void SetProbabilities(const tprobabilityv &LocalProb)
virtual void CalcProbabilities(const int iterationnumber, gplib::rmat &LocalMisFit, GeneralPopulation &LocalPopulation)
Calculate the selection probabilities given the iterationnumber, misfit and population to store the r...
The base class for genetic algorithm propagation methods.
General Transcribe base class for genetic algorithm parameter transcription.
virtual void Elitism(const int iterationnumber)
The implementation of Elitism for the AnnealingGA, in this case this function has no effect...
General genetic algorithm class.
int GetBestIndex()
The index of the best population member.
const tprobabilityv & GetProbabilities() const
void SetParams(const double InitT, const int AnnealG, const double AnnealR)
Set the parameters for the annealing process.
std::vector< boost::shared_ptr< GeneralObjective > > tObjectiveVector