PanmicticPopulation

interface PanmicticPopulation<V, F> : Population<V, F>

PanmicticPopulation - specific Population of PanmicticGA based on Array of Chromosome.

V - value of Chromosome

F - fitness value of Chromosome

This population supports:

Structure of population with PanmicticGA.elitism = 2, size = 9 and buffer = 7:

| EC | EC | C | C | C | C | C | C | C | size ? | ? | ? | ? | ? | ? | ? | maxSize

EC - elite active chromosome

C - active chromosome

? - free space with generated not active chromosome (Be accurate these chromosome can be not evaluated, that's why they '?').

Creates with population functions.

See also

Properties

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

The best Chromosome in Population by fitness.

Link copied to clipboard
abstract val buffer: Int

The amount of reserved space in a population. Can be immutable for PanmicticPopulation see PanmicticEvolveScope.resize. Usually used if the evolutionary strategy involves increasing the population size.

Link copied to clipboard
abstract var factory: PopulationFactory<V, F>

PopulationFactory for this population. Creates new Chromosome.

Link copied to clipboard

Return indices range for Population

Link copied to clipboard
abstract val initialized: Boolean

True if population is initialized and ready to evolve.

Link copied to clipboard
Link copied to clipboard
abstract val maxSize: Int

Maximum population size: size + buffer

Link copied to clipboard
abstract val name: String

Name of population, default value = DEFAULT_POPULATION_NAME

Link copied to clipboard
abstract override val size: Int

Current size of population. Can be immutable for PanmicticPopulation see PanmicticEvolveScope.resize.

Link copied to clipboard
val <V, F> Population<V, F>.worst: Chromosome<V, F>?

The worst Chromosome in Population by fitness.

Functions

Link copied to clipboard
abstract override fun clone(newName: String): PanmicticPopulation<V, F>

Override clone method to return PanmicticPopulation

Link copied to clipboard
inline fun <V, F> Population<V, F>.cloneOf(index: Int): Chromosome<V, F>

Return clone of Chromosome with index in Population

Link copied to clipboard
abstract fun copyOf(): Array<Chromosome<V, F>>

Creates array with chromosomes copied from Population.

Link copied to clipboard
inline fun <V, F> Population<V, F>.copyOfRange(fromIndex: Int, toIndex: Int): Array<Chromosome<V, F>>

Creates copy of Population as an array by range

Link copied to clipboard
abstract operator fun get(index: Int): Chromosome<V, F>
abstract fun get(): Array<Chromosome<V, F>>

Get population as an array.

Link copied to clipboard
inline fun Population<*, *>.isEmpty(): Boolean

Returns true if the population is empty (contains no chromosomes), false otherwise.

Link copied to clipboard
abstract operator fun iterator(): Iterator<Chromosome<V, F>>
Link copied to clipboard
inline fun <V, F> Population<V, F>.randomWithIndices(count: Int, random: Random): Pair<Array<Chromosome<V, F>>, IntArray>

Creates Array with randomly selected chromosomes from source array

Link copied to clipboard
inline fun <V, F> Population<V, F>.reset(random: Random, start: Int = 0, end: Int = size)

Reset population with factory.

Link copied to clipboard
abstract fun resize(newSize: Int? = null, newBuffer: Int? = null)

Set new sizes of population.

Link copied to clipboard
abstract operator fun set(index: Int, chromosome: Chromosome<V, F>)

Set Chromosome with index

abstract fun set(population: Array<Chromosome<V, F>>)

Set new population.

Link copied to clipboard
abstract fun sort(ascending: Boolean = false): Array<Chromosome<V, F>>

Sort population (Chromosome is Comparable) in descending order by default.