VonNeumann

data class VonNeumann(val radius: Int) : CellularNeighborhood

Defines Von Neumann neighborhood with radius 0.

Example for Von Neumann neighborhood with radius = 1:

X   X   X   X   X
X X N X X
X N C N X
X X N X X
X X X X X

Where C - target chromosome, N - neighbors for current target chromosomes, X - other chromosomes in population.

See also

Constructors

Link copied to clipboard
constructor(radius: Int)

Properties

Link copied to clipboard
val radius: Int

Functions

Link copied to clipboard
open override fun neighborsCount(dimenCount: Int): Int

Calculates the neighbor chromosomes count depending on the dimension count of CellularPopulation.dimens.

Link copied to clipboard
open override fun neighborsIndicesMatrix(dimens: Dimens): Pair<IntArray, Array<IntArray>>

Calculates universal matrix for neighbor's indices depending on the CellularPopulation.dimens. To calculate actual coordinates of neighbors for a target cell, need to sum coordinates from the universal matrix with the target cell coordinates.