freneticlib.core.mutation.exploiters
Module Contents
Classes
Returns by spliting the road in half and putting the second part in front of the first one. |
|
Reverses the road. |
|
Flips the signs of the road. |
|
Flips the signs of the road, but only curvature (e.g. when road points are kappa-step tuples). |
|
A container class for the exploitation operators. |
- class freneticlib.core.mutation.exploiters.SplitAndSwap[source]
Bases:
freneticlib.core.mutation.abstract_operators.AbstractMutationOperatorReturns by spliting the road in half and putting the second part in front of the first one.
e.g.
[A, B, C, D, E, F, G]–>[D, E, F, G, A, B, C]- __call__(representation: freneticlib.representations.abstract_representation.RoadRepresentation, test)[source]
Returns a new road by altering the original.
- Parameters:
representation (RoadRepresentation) – The road representation used in this search.
test – The road to be mutated (in an acceptable representation).
- Returns:
The mutated road.
- class freneticlib.core.mutation.exploiters.ReverseTest[source]
Bases:
freneticlib.core.mutation.abstract_operators.AbstractMutationOperatorReverses the road.
e.g.
[A, B, C, D, E, F, G]–>[G, F, E, D, C, B, A]- __call__(representation: freneticlib.representations.abstract_representation.RoadRepresentation, test)[source]
Returns a new road by altering the original.
- Parameters:
representation (RoadRepresentation) – The road representation used in this search.
test – The road to be mutated (in an acceptable representation).
- Returns:
The mutated road.
- class freneticlib.core.mutation.exploiters.FlipSign[source]
Bases:
freneticlib.core.mutation.abstract_operators.AbstractMutationOperatorFlips the signs of the road.
e.g.
[A, -B, -C, D, E, -F, G]–>[-A, B, C, -D, -E, F, -G]- __call__(representation: freneticlib.representations.abstract_representation.RoadRepresentation, test)[source]
Returns a new road by altering the original.
- Parameters:
representation (RoadRepresentation) – The road representation used in this search.
test – The road to be mutated (in an acceptable representation).
- Returns:
The mutated road.
- class freneticlib.core.mutation.exploiters.KappaFlipSign[source]
Bases:
freneticlib.core.mutation.abstract_operators.AbstractMutationOperatorFlips the signs of the road, but only curvature (e.g. when road points are kappa-step tuples).
- __call__(representation: freneticlib.representations.abstract_representation.RoadRepresentation, test)[source]
Returns a new road by altering the original.
- Parameters:
representation (RoadRepresentation) – The road representation used in this search.
test – The road to be mutated (in an acceptable representation).
- Returns:
The mutated road.
- class freneticlib.core.mutation.exploiters.Exploiter(operators: List[freneticlib.core.mutation.abstract_operators.AbstractMutationOperator] = None)[source]
Bases:
freneticlib.core.mutation.abstract_operators.AbstractMutatorA container class for the exploitation operators.
By default,
ReverseTest,SplitAndSwapandFlipSignare used, if none are provided on instantiation.