DistributedConfigScope

class DistributedConfigScope<V, F>(factory: PopulationFactory<V, F>, var fitnessFunction: (V) -> F, populationName: String, children: List<GA<V, F>>) : AbstractConfigScope<V, F, DistributedEvolveScope<V, F>> , DistributedConfig<V, F>

Implementation of DistributedConfig based on AbstractConfigScope. Params factory and fitnessFunction are considered mandatory.

Parameters

factory

default population factory for child GAs

fitnessFunction

default fitness function for evaluation step

populationName
children

child GA of DistributedGA

Constructors

Link copied to clipboard
constructor(factory: PopulationFactory<V, F>, fitnessFunction: (V) -> F, populationName: String, children: List<GA<V, F>>)

Properties

Link copied to clipboard
abstract val afterEvolution: suspend DistributedEvolveScope<V, F>.() -> Unit

Callback after evolution process. Executed at launch when GA.state is going to be State.FINISHED.

Link copied to clipboard

Launch all child GAs with launchChildren operator.

Link copied to clipboard
abstract val beforeEvolution: suspend DistributedEvolveScope<V, F>.() -> Unit

Callback before evolution process. Executed only once at launch if GA.iteration is 0.

Link copied to clipboard
open override val children: MutableList<GA<V, F>>

Child GAs of DistributedGA. Mutable with add and removeAt.

Link copied to clipboard
open override var enabledSharedStatistic: Boolean

Shared statistics: DistributedGA is collector for each child statistics - statistics of DistributedGA includes all statistics of children.

Link copied to clipboard
open override var evolution: suspend DistributedEvolveScope<V, F>.() -> Unit

Main evolution process.

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

Parallelism configuration associated with GA.

Link copied to clipboard
open override val population: DistributedPopulation<V, F>

Override base population as DistributedPopulation for DistributedGA.

Link copied to clipboard

Special container for creating and adding children to DistributedConfig.

Link copied to clipboard
abstract var random: Random

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

Link copied to clipboard

Statistics configuration associated with GA.

Link copied to clipboard
abstract val timeStore: TimeStore

Store for all TimeMarkers of GA.

Functions

Link copied to clipboard
open override fun add(ga: GA<V, F>)

Adds the GA to the end of children.

open override fun add(index: Int, ga: GA<V, F>)

Inserts a GA into children at the specified index.

Link copied to clipboard
fun <V, F> DistributedConfigScope<V, F>.after(afterEvolution: suspend DistributedEvolveScope<V, F>.() -> Unit)

Callback after evolution process which will be invoked when GA.state is going to be State.FINISHED.

Link copied to clipboard
fun <V, F> DistributedConfigScope<V, F>.before(beforeEvolution: suspend DistributedEvolveScope<V, F>.() -> Unit)

Callback before evolution process which will be invoked if GA.iteration is 0.

Link copied to clipboard
inline fun <V, F> DistributedConfig<V, F>.cGA(population: CellularPopulation<V, F>, noinline fitnessFunction: (V) -> F? = null, config: CellularConfigScope<V, F>.() -> Unit): CellularGA<V, F>

Creates CellularGA as child for DistributedGA using Distributed Inheritance (see DistributedConfig) with Kotlin DSL.

Link copied to clipboard
inline fun <V, F> DistributedConfig<V, F>.cGAs(count: Int, crossinline population: DistributedPopulationMultiFactory.() -> CellularPopulation<V, F>, crossinline fitnessFunction: (index: Int) -> (V) -> F = { this.fitnessFunction }, config: CellularConfigScope<V, F>.(index: Int) -> Unit): List<CellularGA<V, F>>

Creates CellularGAs as children for DistributedGA using Distributed Inheritance (see DistributedConfig) with Kotlin DSL.

Link copied to clipboard
fun <V, F> DistributedConfigScope<V, F>.evolve(useDefault: Boolean = true, evolution: suspend DistributedEvolveScope<V, F>.() -> Unit)

Applies evolutionary strategy for DistributedGA (The most famous type of DistributedGA is the Island Generic Algorithm) as evolution function in DistributedEvolveScope that includes the process of launching child GAs (DistributedGA.children) and processes of interaction between subpopulations.

Link copied to clipboard

Creates ParallelismConfig with ParallelismConfigScope and apply it to the current Config.

Creates ParallelismConfig with ParallelismConfigScope and apply it to the current DistributedConfig.

Link copied to clipboard
inline fun <V, F> DistributedConfig<V, F>.pGA(population: PanmicticPopulation<V, F>, noinline fitnessFunction: (V) -> F? = null, config: PanmicticConfigScope<V, F>.() -> Unit): PanmicticGA<V, F>

Creates PanmicticGA as child for DistributedGA using Distributed Inheritance (see DistributedConfig) with Kotlin DSL.

Link copied to clipboard
inline fun <V, F> DistributedConfig<V, F>.pGAs(count: Int, crossinline population: DistributedPopulationMultiFactory.() -> PanmicticPopulation<V, F>, crossinline fitnessFunction: (index: Int) -> (V) -> F = { this.fitnessFunction }, config: PanmicticConfigScope<V, F>.(index: Int) -> Unit): List<PanmicticGA<V, F>>

Creates PanmicticGAs as children for DistributedGA using Distributed Inheritance (see DistributedConfig) with Kotlin DSL.

Link copied to clipboard
fun <V, F> DistributedConfig<V, F>.population(dimens: Dimens, name: String? = null, factory: PopulationFactory<V, F>? = null): CellularPopulation<V, F>
fun <V, F> DistributedConfig<V, F>.population(dimens: Dimens, population: Array<Chromosome<V, F>>, name: String? = null, factory: PopulationFactory<V, F>? = null): CellularPopulation<V, F>

Creates CellularPopulation as subpopulation for DistributedGA using Distributed Inheritance (see DistributedConfig).

fun <V, F> DistributedConfig<V, F>.population(population: Array<Chromosome<V, F>>, buffer: Int = 0, name: String? = null, factory: PopulationFactory<V, F>? = null): PanmicticPopulation<V, F>
fun <V, F> DistributedConfig<V, F>.population(size: Int, buffer: Int = 0, name: String? = null, factory: PopulationFactory<V, F>? = null): PanmicticPopulation<V, F>

Creates PanmicticPopulation as subpopulation for DistributedGA using Distributed Inheritance (see DistributedConfig).

Link copied to clipboard
open override fun removeAt(index: Int): GA<V, F>

Removes a GA at the specified index from children.

Link copied to clipboard

Creates StatisticsConfig with StatisticsConfigScope and apply it to the current Config.

Link copied to clipboard
open operator fun GA<V, F>.unaryPlus(): GA<V, F>

Unary operator for adding GA to children.

open operator fun List<GA<V, F>>.unaryPlus(): List<GA<V, F>>

Unary operator for adding list of GAs to children.