Class AgentGenerator<ChromosomeType, FitnessType>Abstract

Description

Creates new agents.

Type Parameters

Hierarchy

  • AgentGenerator

Constructors

  • new AgentGenerator<ChromosomeType, FitnessType>(): AgentGenerator<ChromosomeType, FitnessType>

Methods

  • createAgentFromGenome(genome: Genome<ChromosomeType>): Agent<ChromosomeType, FitnessType>
  • Description

    Creates a new agent from its genome.

    Parameters

    • genome: Genome<ChromosomeType>

    Returns Agent<ChromosomeType, FitnessType>

  • createInitialPopulation(): Agent<ChromosomeType, FitnessType>[]
  • Description

    Creates a random initial population of agents.

    Returns Agent<ChromosomeType, FitnessType>[]

  • createPopulation(currentPopulation: Agent<ChromosomeType, FitnessType>[], survivors: Agent<ChromosomeType, FitnessType>[], children: Agent<ChromosomeType, FitnessType>[], nextGeneration: number): Agent<ChromosomeType, FitnessType>[]
  • Description

    Creates a new group of agents.

    The default behaviour is merging the survivors, children and a group of random agents until the size of the current population is reached.

    This method can be overridden to create a different behaviour.

    Returns

    The new population of agents.

    Parameters

    • currentPopulation: Agent<ChromosomeType, FitnessType>[]

      The current population of agents ordered by fitness.

    • survivors: Agent<ChromosomeType, FitnessType>[]

      The survivors of the current generation.

    • children: Agent<ChromosomeType, FitnessType>[]

      The children generated in the current generation.

    • nextGeneration: number

      The next generation number.

    Returns Agent<ChromosomeType, FitnessType>[]

  • createRandomAgent(): Agent<ChromosomeType, FitnessType>
  • Description

    Creates a new agent with random genes.

    Returns Agent<ChromosomeType, FitnessType>

Generated using TypeDoc