Class Offspring
- Namespace
- Evolutionary
- Assembly
- Evolutionary.dll
Provides operators for the Offspring<TIndividual> class.
public static class Offspring
- Inheritance
-
Offspring
- Inherited Members
Methods
AddChildren<TIndividual>(Offspring<TIndividual>, IEnumerable<TIndividual>)
Returns a new offspring with the given children appended to the existing children.
public static Offspring<TIndividual> AddChildren<TIndividual>(this Offspring<TIndividual> offspring, IEnumerable<TIndividual> children)
Parameters
offspringOffspring<TIndividual>The offspring.
childrenIEnumerable<TIndividual>The children to add.
Returns
- Offspring<TIndividual>
The modified offspring.
Type Parameters
TIndividualThe individuals type.
Eagerly<TIndividual>(Offspring<TIndividual>)
Forces the children to be evaluated eagerly. By default the children are evaluated lazily; hence repeating an operation on the children would also repeat all the preceding operations.
public static Offspring<TIndividual> Eagerly<TIndividual>(this Offspring<TIndividual> offspring)
Parameters
offspringOffspring<TIndividual>The offspring.
Returns
- Offspring<TIndividual>
The modified offspring.
Type Parameters
TIndividualThe individuals type.
Mutate<TIndividual>(Offspring<TIndividual>, int, Func<TIndividual, Random, TIndividual>)
Adds count children that are created by mutating
randomly selected parents.
public static Offspring<TIndividual> Mutate<TIndividual>(this Offspring<TIndividual> offspring, int count, Func<TIndividual, Random, TIndividual> mutate)
Parameters
offspringOffspring<TIndividual>The offspring.
countintThe number of children to create.
mutateFunc<TIndividual, Random, TIndividual>A function that receives a parent and the random number generator, and returns a mutated child.
Returns
- Offspring<TIndividual>
The modified offspring.
Type Parameters
TIndividualThe individuals type.
Recombine<TIndividual>(Offspring<TIndividual>, int, Func<TIndividual, TIndividual, Random, IEnumerable<TIndividual>>)
Adds count children that are created by recombining
pairs of randomly selected parents.
public static Offspring<TIndividual> Recombine<TIndividual>(this Offspring<TIndividual> offspring, int count, Func<TIndividual, TIndividual, Random, IEnumerable<TIndividual>> recombine)
Parameters
offspringOffspring<TIndividual>The offspring.
countintThe number of children to create.
recombineFunc<TIndividual, TIndividual, Random, IEnumerable<TIndividual>>A function that receives two parents and the random number generator, and returns one or more children.
Returns
- Offspring<TIndividual>
The modified offspring.
Type Parameters
TIndividualThe individuals type.
Recombine<TIndividual>(Offspring<TIndividual>, int, Func<TIndividual, TIndividual, Random, TIndividual>)
Adds count children that are created by recombining
pairs of randomly selected parents.
public static Offspring<TIndividual> Recombine<TIndividual>(this Offspring<TIndividual> offspring, int count, Func<TIndividual, TIndividual, Random, TIndividual> recombine)
Parameters
offspringOffspring<TIndividual>The offspring.
countintThe number of children to create.
recombineFunc<TIndividual, TIndividual, Random, TIndividual>A function that receives two parents and the random number generator, and returns a new child.
Returns
- Offspring<TIndividual>
The modified offspring.
Type Parameters
TIndividualThe individuals type.
SelectElite<TIndividual>(Offspring<TIndividual>, int)
Adds the count best individuals of the parent
population to the children (elitism). The best individuals are never
lost by the following selection.
public static Offspring<TIndividual> SelectElite<TIndividual>(this Offspring<TIndividual> offspring, int count)
Parameters
Returns
- Offspring<TIndividual>
The modified offspring.
Type Parameters
TIndividualThe individuals type.
SelectSurvivors<TIndividual>(Offspring<TIndividual>, int)
Reduces the children to the count best individuals.
The children are sorted by their fitness.
public static Offspring<TIndividual> SelectSurvivors<TIndividual>(this Offspring<TIndividual> offspring, int count)
Parameters
Returns
- Offspring<TIndividual>
The modified offspring.
Type Parameters
TIndividualThe individuals type.
ToPopulation<TIndividual>(Offspring<TIndividual>)
Converts the offspring into a new population. The individuals of the new population are sorted by their fitness.
public static Population<TIndividual> ToPopulation<TIndividual>(this Offspring<TIndividual> offspring)
Parameters
offspringOffspring<TIndividual>The offspring.
Returns
- Population<TIndividual>
The new population.
Type Parameters
TIndividualThe individuals type.
WithChildren<TIndividual>(Offspring<TIndividual>, IEnumerable<TIndividual>)
Returns a new offspring with the given children. The previous children are replaced.
public static Offspring<TIndividual> WithChildren<TIndividual>(this Offspring<TIndividual> offspring, IEnumerable<TIndividual> children)
Parameters
offspringOffspring<TIndividual>The offspring.
childrenIEnumerable<TIndividual>The children.
Returns
- Offspring<TIndividual>
The modified offspring.
Type Parameters
TIndividualThe individuals type.