CellularPopulation

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

CellularPopulation - specific Population of CellularGA based on Array of Chromosome.

V - value of Chromosome

F - fitness value of Chromosome

This population supports:

Structure of population with CellularPopulation.dimens = Dimens.rectangle(length = 4, width = 3) (CellularPopulation.size = 4 * 3 = 12):

        0    1    2    3
0 [0] [1] [2] [3]
1 [4] [5] [6] [7]
2 [8] [9] [10] [11]

NOTE Kgal use toroidal coordinates for neighborhoods, for example: the cell with index 3 and VonNeumann(radius = 1) neighborhood the neighbors are the cells with indices: 2, 11, 0, 7

Creates with population functions.

See also

toroidalShapeIndicesFilter

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 dimens: Dimens

Dimens for cellular population. Define space and its boundaries for the population and, accordingly, population size. This space determines the position of the chromosomes relative to each other.

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 name: String

Name of population, default value = DEFAULT_POPULATION_NAME

Link copied to clipboard
abstract val size: Int

Current size of population.

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): CellularPopulation<V, F>

Override clone method to return CellularPopulation

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 operator fun set(index: Int, chromosome: Chromosome<V, F>)

Set Chromosome with index

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

Set new population.