freneticlib.core.mutation.abstract_operators

Module Contents

Classes

AbstractMutationOperator

Abstract parent of all mutation operators.

AbstractMutator

A container class for the mutation operators.

class freneticlib.core.mutation.abstract_operators.AbstractMutationOperator[source]

Bases: abc.ABC

Abstract parent of all mutation operators.

abstract __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.

__str__()[source]

Return str(self).

is_applicable(test) bool[source]

Check if test can be mutated.

Parameters:

test – The road (in a given representation).

Returns:

Whether the mutation operator is applicable.

Return type:

(bool)

class freneticlib.core.mutation.abstract_operators.AbstractMutator(operators: List[Callable])[source]

Bases: abc.ABC

A container class for the mutation operators.

abstract __call__(representation: freneticlib.representations.abstract_representation.RoadRepresentation, test) List[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.

get_all()[source]

Return all operators.