CellularEvolveScope

CellularEvolveScope - specific EvolveScope for CellularGA.

V - value of Chromosome

F - fitness value of Chromosome

Creates with CellularEvolveScope().

See also

Properties

Link copied to clipboard
val <V, F> EvolveScope<V, F>.best: Chromosome<V, F>?

The best Chromosome in Population by fitness. Uses a StatisticsConfig.guaranteedSorted for optimization, except in the case of a call from DistributedEvolveScope.

Link copied to clipboard

The best fitness of Chromosome in Population. Uses a StatisticsConfig.guaranteedSorted for optimization, except in the case of a call from DistributedEvolveScope.

Link copied to clipboard

Cellular type for CellularGA.

Link copied to clipboard
abstract var elitism: Boolean

Flag for elitism in CellularGA.

Link copied to clipboard

Population Factory of GA.

Link copied to clipboard

Flag to stop evolution process cause stop condition has been worked.

Link copied to clipboard

Flag to stop evolution process cause the max iteration has been reached.

Link copied to clipboard
abstract var fitnessFunction: (V) -> F

Fitness function - a function that evaluates the quality or "fitness" of each individual (chromosome) in a population. The fitness function determines how well a particular solution matches the target problem. It can be changed.

Link copied to clipboard

Cached neighborhood relevance flag. If false recalculate cache with cacheNeighborhood.

Link copied to clipboard
abstract val iteration: Int

Current iteration of genetic algorithm.

Link copied to clipboard
@get:JvmName(name = "getMeanDouble")
val EvolveScope<*, Double>.mean: Double
@get:JvmName(name = "getMeanInt")
val EvolveScope<*, Int>.mean: Double
@get:JvmName(name = "getMeanLong")
val EvolveScope<*, Long>.mean: Double

Mean fitness value of chromosomes in Population

Link copied to clipboard
@get:JvmName(name = "getMedianDouble")
val EvolveScope<*, Double>.median: Double
@get:JvmName(name = "getMedianInt")
val EvolveScope<*, Int>.median: Double
@get:JvmName(name = "getMedianLong")
val EvolveScope<*, Long>.median: Double

Median fitness value of chromosomes in Population

Link copied to clipboard

Population Name of GA.

Link copied to clipboard

Neighborhood for CellularGA.

Link copied to clipboard

Actual cache for neighbor's indices (in a projection one-dimensional array) in CellularGA for each cell. Calculating neighbors indices is expensive for each iteration; cached values are stored in this property.

Link copied to clipboard

Store parallelism configuration for GA. Determines genetic operators process.

Link copied to clipboard
abstract override val population: CellularPopulation<V, F>

Override base population as CellularPopulation for CellularGA.

Link copied to clipboard
abstract val random: Random

Random associated with GA. Defines a pseudorandom number generator for predictive calculations.

Link copied to clipboard
val EvolveScope<*, *>.size: Int

Population Size of GA.

Link copied to clipboard

Statistics configuration associated with GA.

Link copied to clipboard
abstract val store: MutableMap<String, Any?>

Store serves to synchronize between iterations of GA.

Link copied to clipboard

Duration between current and previous iteration.

Link copied to clipboard
abstract val timeStore: TimeStore

Store for all TimeMarkers of GA.

Link copied to clipboard

The worst Chromosome in Population by fitness. Uses a StatisticsConfig.guaranteedSorted for optimization, except in the case of a call from DistributedEvolveScope.

Link copied to clipboard

The worst fitness of Chromosome in Population. Uses a StatisticsConfig.guaranteedSorted for optimization, except in the case of a call from DistributedEvolveScope.

Functions

Link copied to clipboard
inline suspend fun <V, F> CellularEvolveScope<V, F>.asynchronousExecute(updatePolicy: UpdatePolicy, crossinline cellEvolution: (chromosome: Chromosome<V, F>, neighbors: Array<Chromosome<V, F>>, random: Random) -> Chromosome<V, F>)
Link copied to clipboard

Creates Statistic for best fitness of Chromosome in Population.

Link copied to clipboard
Link copied to clipboard
fun <V, F> CellularEvolveScope<V, F>.CellEvolveScope(cellChromosome: Chromosome<V, F>, neighbors: Array<Chromosome<V, F>>, random: Random): CellEvolveScope<V, F>

Creates an instance of CellEvolveScope.

Link copied to clipboard
abstract suspend fun emitStat(value: StatisticNote<Any?>)
Link copied to clipboard
inline suspend fun <V, F> EvolveScope<V, F>.evaluateAll(start: Int, end: Int, parallelismLimit: Int, crossinline fitnessFunction: (V) -> F)

Base evaluates function for all chromosomes in Population by fitnessFunction

Link copied to clipboard
suspend fun <V, F> CellularEvolveScope<V, F>.evaluationAll(parallelismLimit: Int = parallelismConfig.workersCount, fitnessFunction: (V) -> F = this.fitnessFunction)
Link copied to clipboard
inline suspend fun <V, F> CellularEvolveScope<V, F>.evolveCells(crossinline evolution: CellEvolveScope<V, F>.() -> Unit)

Unique genetic operator for CellularGA performs an evolutionary strategy evolution for cells in CellularPopulation. The execution process is carried out depending on the CellularType.

Link copied to clipboard
inline fun <V, F> CellularEvolveScope<V, F>.executeCellEvolution(random: Random, index: Int, target: Array<Chromosome<V, F>>, crossinline cellEvolution: (chromosome: Chromosome<V, F>, neighbors: Array<Chromosome<V, F>>, random: Random) -> Chromosome<V, F>)

Executes cellEvolution for cell in CellularEvolveScope.population with index and set result to target.

Link copied to clipboard

If Population is not initialized - Fills a Population with randomly generated Chromosomes by Population.factory.

Link copied to clipboard
inline suspend fun EvolveScope<*, *>.parallelProcess(parallelismLimit: Int, startIteration: Int, endIteration: Int, crossinline action: suspend (iteration: Int, random: Random) -> Unit)

Iterative parallel process action from startIteration to endIteration.

inline suspend fun EvolveScope<*, *>.parallelProcess(parallelismLimit: Int, startIteration: Int, endIteration: Int, step: Int, crossinline action: suspend (iteration: Int, random: Random) -> Unit)

Iterative parallel process action from startIteration to endIteration with step.

Link copied to clipboard
inline suspend fun <V, F> CellularEvolveScope<V, F>.process(crossinline action: suspend (iteration: Int, random: Random) -> Unit)

Executes action with process for CellularGA.

inline fun EvolveScope<*, *>.process(parallelismLimit: Int, sequential: () -> Unit, parallel: () -> Unit)

Process action with sequential or parallel mode.

inline suspend fun EvolveScope<*, *>.process(parallelismLimit: Int, startIteration: Int, endIteration: Int, crossinline action: suspend (iteration: Int, random: Random) -> Unit)

Iterative process action from startIteration to endIteration.

inline suspend fun EvolveScope<*, *>.process(parallelismLimit: Int, startIteration: Int, endIteration: Int, step: Int, crossinline action: suspend (iteration: Int, random: Random) -> Unit)

Iterative process action from startIteration to endIteration with step.

Link copied to clipboard
inline fun EvolveScope<*, *>.randomByChance(chance: Double, action: () -> Unit)

Execute action with probability chance (0.0 < 1.0)

Link copied to clipboard
fun <V, F> CellularEvolveScope<V, F>.replaceWithElitism(population: Array<Chromosome<V, F>>, index: Int, old: Chromosome<V, F>, new: Chromosome<V, F>)

Executes replacing old chromosome with new when:

Link copied to clipboard
inline fun <V, F> EvolveScope<V, F>.shake(percent: Double): Pair<Int, Int>

Shake percent*100% population with Population.reset function.

fun <V, F> EvolveScope<V, F>.shake(from: Int, to: Int)

Shake population with Population.reset function.

Link copied to clipboard

Creates Statistic for size of Population

Link copied to clipboard
suspend fun EvolveScope<*, *>.stat(statistic: Statistic<Any?>)
@JvmName(name = "statValue")
suspend fun EvolveScope<*, *>.stat(pair: Pair<String, Any?>)
@JvmName(name = "statRegister")
suspend fun EvolveScope<*, *>.stat(pair: Pair<String, () -> Any?>)
suspend fun EvolveScope<*, *>.stat(name: String, value: Any?)
suspend fun EvolveScope<*, *>.stat(vararg statistics: Statistic<Any?>)
@JvmName(name = "statValue")
suspend fun EvolveScope<*, *>.stat(vararg pairs: Pair<String, Any?>)
@JvmName(name = "statRegister")
suspend fun EvolveScope<*, *>.stat(vararg pairs: Pair<String, () -> Any?>)
inline suspend fun EvolveScope<*, *>.stat(name: String, registrar: () -> Any?)

Creates SingleStatisticNote and send it to GA.statisticsProvider Use registrar function

Link copied to clipboard
inline fun <V, F> EvolveScope<V, F>.stopBy(stopCondition: EvolveScope<V, F>.() -> Boolean)

Stop and finish GA if stopCondition return true.

inline fun <V, F> EvolveScope<V, F>.stopBy(maxIteration: Int = Int.MAX_VALUE)

Stop and finish GA if iteration more or equal to maxIteration.

inline fun <V, F> EvolveScope<V, F>.stopBy(maxIteration: Int = Int.MAX_VALUE, stopCondition: EvolveScope<V, F>.() -> Boolean)

Stop and finish GA if:

Link copied to clipboard
inline suspend fun <V, F> CellularEvolveScope<V, F>.synchronousExecute(crossinline cellEvolution: (chromosome: Chromosome<V, F>, neighbors: Array<Chromosome<V, F>>, random: Random) -> Chromosome<V, F>)

Executes CellularType.Synchronous mode (creating temp target population) for CellularGA.

Link copied to clipboard
Link copied to clipboard

Creates Statistic for worst fitness of Chromosome in Population.