UNPKG

@alenaksu/neatjs

Version:

NEAT (Neuroevolution of Augmenting Topologies) implementation in JavaScript

50 lines (49 loc) 1.38 kB
import { Organism } from './Organism'; import { Population } from './Population'; import { NEATConfig } from '../types'; export declare class Species { /** * The organisms of the species */ organisms: Array<Organism>; /** * Representative of the species (random) */ specimen?: Organism; /** * Mark the species for extinction */ extinct: boolean; /** * Species' age */ age: number; /** * Age from last improvement */ ageOfLastImprovement: number; /** * Max fitness ever */ maxFitness: number; /** * Average fitness */ averageFitness: number; /** * Number of expected offspring in proportion to the sum of adjusted fitnesses */ expectedOffspring: number; addOrganism(organism: Organism): void; removeOrganism(organism: Organism): void; getSpecimen(): Organism; getChampion(): Organism; adjustFitness(config: NEATConfig): void; /** * Perform mating and mutation to form next generation. * The sorted_species is ordered to have best species in the beginning. * Returns list of baby organisms as a result of reproduction of all organisms in this species. * @param generation */ reproduce(config: NEATConfig, generation: number, population: Population, sortedSpecies: Species[]): void; }