freneticlib.core.mutation.mutators
Module Contents
Classes
Mutation operator for removing a range of road points from the front of the test |
|
Mutation operator for removing a range of road points from the back of the road. |
|
Mutation operator for removing a random road points of the road. |
|
Mutation operator for adding random road points at the end of the road. |
|
Mutation operator for replacing random road points replaced with new ones. |
|
Mutation operator for altering random road points by multiplying with a factor. |
|
Value mutation operator for the |
|
Default Mutator, applies all operators approach. |
|
The default mutator which implements the Frenetic approach. |
- class freneticlib.core.mutation.mutators.RemoveFront(remove_at_least: int = 1, remove_at_most: int = 5, min_length_for_operator: int = 10)[source]
Bases:
freneticlib.core.mutation.abstract_operators.AbstractMutationOperatorMutation operator for removing a range of road points from the front of the test
- Parameters:
remove_at_least (int) – Minimum number of road points to remove.
remove_at_most (int) – Maximum number of road points to remove.
min_length_for_operator (int) – Minimum number of road points required for application.
- __call__(representation: freneticlib.representations.abstract_representation.RoadRepresentation, test)[source]
Returns a copy of the road by removing a range of road points from the front of the road.
- Parameters:
representation (RoadRepresentation) – The road representation used in this search.
test – The road (in a given representation).
- Returns:
The mutated road.
- class freneticlib.core.mutation.mutators.RemoveBack(remove_at_least: int = 1, remove_at_most: int = 5, min_length_for_operator: int = 10)[source]
Bases:
freneticlib.core.mutation.abstract_operators.AbstractMutationOperatorMutation operator for removing a range of road points from the back of the road.
- Parameters:
remove_at_least (int) – Minimum number of road points to remove.
remove_at_most (int) – Maximum number of road points to remove.
min_length_for_operator (int) – Minimum number of road points required for application.
- __call__(representation: freneticlib.representations.abstract_representation.RoadRepresentation, test)[source]
Returns a copy of the road by removing a range of road points from the back of the road.
- Parameters:
representation (RoadRepresentation) – The road representation used in this search.
test – The road (in a given representation).
- Returns:
The mutated road.
- class freneticlib.core.mutation.mutators.RemoveRandom(remove_at_least: int = 1, remove_at_most: int = 5, min_length_for_operator: int = 10)[source]
Bases:
freneticlib.core.mutation.abstract_operators.AbstractMutationOperatorMutation operator for removing a random road points of the road.
- Parameters:
remove_at_least (int) – Minimum number of road points to remove.
remove_at_most (int) – Maximum number of road points to remove.
min_length_for_operator (int) – Minimum number of road points required for application.
- __call__(representation: freneticlib.representations.abstract_representation.RoadRepresentation, test)[source]
Returns a copy of the road by removing random road points.
- Parameters:
representation (RoadRepresentation) – The road representation used in this search.
test – The road (in a given representation).
- Returns:
The mutated road.
- class freneticlib.core.mutation.mutators.AddBack(add_at_least: int = 1, add_at_most: int = 5)[source]
Bases:
freneticlib.core.mutation.abstract_operators.AbstractMutationOperatorMutation operator for adding random road points at the end of the road.
- Parameters:
add_at_least (int) – Minimum number of road points to add.
add_at_most (int) – Maximum number of road points to add.
- __call__(representation: freneticlib.representations.abstract_representation.RoadRepresentation, test)[source]
Returns a copy of the road with new road points added at the back of the road.
- Parameters:
representation (RoadRepresentation) – The road representation used in this search.
test – The road (in a given representation).
- Returns:
The mutated road.
- class freneticlib.core.mutation.mutators.ReplaceRandom(replace_at_least: int = 1, replace_at_most: int = 5)[source]
Bases:
freneticlib.core.mutation.abstract_operators.AbstractMutationOperatorMutation operator for replacing random road points replaced with new ones.
- Parameters:
replace_at_least (int) – Minimum number of road points to add.
replace_at_most (int) – Maximum number of road points to add.
- __call__(representation: freneticlib.representations.abstract_representation.RoadRepresentation, test)[source]
Returns a copy of the road with random road points replaced with new ones.
- Parameters:
representation (RoadRepresentation) – The road representation used in this search.
test – The road (in a given representation).
- Returns:
The mutated road.
- class freneticlib.core.mutation.mutators.AlterValues(mutation_factor_low: float = 0.9, mutation_factor_high: float = 1.1, mutation_chance: float = 0.1)[source]
Bases:
freneticlib.core.mutation.abstract_operators.AbstractMutationOperatorMutation operator for altering random road points by multiplying with a factor.
- Parameters:
mutation_factor_low (float) – Minimum factor to apply to a road point.
mutation_factor_high (float) – Maximum factor to apply to a road point.
mutation_chance (float) – The mutation chance for each road point.
- __call__(representation: freneticlib.representations.abstract_representation.RoadRepresentation, test)[source]
Returns a copy of the road with random road points altered by a random factor.
- Parameters:
representation (RoadRepresentation) – The road representation used in this search.
test – The road (in a given representation).
- Returns:
The mutated road.
- class freneticlib.core.mutation.mutators.KappaStepAlterValues(mutation_factor_low: float = 0.9, mutation_factor_high: float = 1.1, mutation_chance: float = 0.1)[source]
Bases:
AlterValuesValue mutation operator for the
KappaRepresentation. It alters random road points and the steps by multiplying with a factor.- Parameters:
mutation_factor_low (float) – Minimum factor to apply to a road point.
mutation_factor_high (float) – Maximum factor to apply to a road point.
mutation_chance (float) – The mutation chance for each road point.
- __call__(representation: freneticlib.representations.abstract_representation.RoadRepresentation, test)[source]
Returns a copy of the road with random road points altered by a random factor.
- Parameters:
representation (RoadRepresentation) – The road representation used in this search.
test – The road (in a given representation).
- Returns:
The mutated road.
- class freneticlib.core.mutation.mutators.StandardMutator(mutation_operators: List[freneticlib.core.mutation.abstract_operators.AbstractMutationOperator] = None)[source]
Bases:
freneticlib.core.mutation.abstract_operators.AbstractMutatorDefault Mutator, applies all operators approach.
- Parameters:
mutation_operators (List[AbstractMutationOperator]) – The operators used for mutation.
- __call__(representation: freneticlib.representations.abstract_representation.RoadRepresentation, parent)[source]
Create a new road by combining road points from two parents.
- Parameters:
representation (RoadRepresentation) – The road representation used in this search.
test – The parent to be mutated.
- Returns:
(List) The mutated tests.
- class freneticlib.core.mutation.mutators.FreneticMutator(mutation_operators: List[freneticlib.core.mutation.abstract_operators.AbstractMutationOperator] = None, exploitation_operators: List[freneticlib.core.mutation.abstract_operators.AbstractMutationOperator] = None)[source]
Bases:
freneticlib.core.mutation.abstract_operators.AbstractMutatorThe default mutator which implements the Frenetic approach.
It distinguishes between exploration and exploitation.
- Parameters:
mutation_operators (List[AbstractMutationOperator]) – The operators used for mutation.
exploitation_operators (List[AbstractMutationOperator]) – The operators used for exploration
- __call__(representation: freneticlib.representations.abstract_representation.RoadRepresentation, parent)[source]
Create a new road by combining road points from two parents.
- Parameters:
representation (RoadRepresentation) – The road representation used in this search.
test – The parent to be mutated.
- Returns:
(List) The mutated tests.