freneticlib.core.mutation.exploiters

Module Contents

Classes

SplitAndSwap

Returns by spliting the road in half and putting the second part in front of the first one.

ReverseTest

Reverses the road.

FlipSign

Flips the signs of the road.

KappaFlipSign

Flips the signs of the road, but only curvature (e.g. when road points are kappa-step tuples).

Exploiter

A container class for the exploitation operators.

class freneticlib.core.mutation.exploiters.SplitAndSwap[source]

Bases: freneticlib.core.mutation.abstract_operators.AbstractMutationOperator

Returns 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.AbstractMutationOperator

Reverses 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.AbstractMutationOperator

Flips 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.AbstractMutationOperator

Flips 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.AbstractMutator

A container class for the exploitation operators.

By default, ReverseTest, SplitAndSwap and FlipSign are used, if none are provided on instantiation.