evolve
Applies evolutionary strategy
for PanmicticGA (Classical Genetic Algorithm) as evolution function in PanmicticEvolveScope that includes the process of changing the population for one iteration.
evolutionary strategy
of PanmicticGA is applied to chromosomes within the entire population and can be separated into stages:selection
→crossover
→mutation
→evaluation
.
When PanmicticGA starts to evolve, its creates an infinite loop
for your evolutionary strategy
function. There are 3 main actions that occur in this loop:
Increment GA.iteration by one
Execute evolution
Check stops (If any stop rule is active - breaks infinite loop)
EXTRA INFORMATION
:
Thus, the evolution function corresponds to one iteration of the genetic algorithm. However, thanks to EvolveScope, this function has the ability to change dynamically depending on various conditions, which makes it easy to create unique, flexible evolution strategies, for example:
create a dependence of the mutation chance on the iteration (see example)
create evolutionary stages (e.g. depending on iteration) that will describe different evolutionary strategies (use different genetic operators)
create absolutely unique genetic operators - the entire population is at your complete disposal!
calculate, compare, change!
Example of creating base evolutionary strategy
with evolve function:
// init PanmicticGA
pGA(
// configure population and fitnessFunction
) {
// set ga's configuration here
// set evolutionary strategy with evolve
evolve { (this = PanmicticEvolveScope)
val currentIteration = iteration
selTournament(size = 3, parallelismLimit = NO_PARALLELISM)
cxOnePoint(chance = 0.8)
mutFlipBit(chance = 0.2, flipBitChance = 0.01 * iteration)
evaluation()
// Be sure to remember to set the stopping conditions
stopBy(maxIteration = 50) { bestFitness == 100 }
}
}