PermutationIndividual
Models & Types · AiDotNet.Genetics
Represents an individual encoded as a permutation, suitable for problems like TSP.
Implements: IEvolvable<PermutationGene, double>
Constructors
| Constructor | Summary |
|---|---|
PermutationIndividual(ICollection<PermutationGene> genes) |
Creates a permutation individual with the specified genes. |
PermutationIndividual(int size, Random random) |
Creates a new permutation individual with a random permutation of the specified size. |
Methods
| Method | Summary |
|---|---|
ICollection<PermutationGene> GetGenes() |
|
IEvolvable<PermutationGene, double> Clone() |
|
ValueTuple<PermutationIndividual, PermutationIndividual> OrderCrossover(PermutationIndividual other, Random random) |
Applies the Order Crossover (OX) operator. |
double GetFitness() |
|
int[] GetPermutation() |
Gets the permutation as an array of indices. |
void InversionMutation(Random random) |
Applies the inversion mutation by reversing a random subsequence. |
void SetFitness(double fitness) |
|
void SetGenes(ICollection<PermutationGene> genes) |
|
void SwapMutation(Random random) |
Applies a swap mutation by swapping two random positions. |