Shortcuts

macop.operators.continuous.mutators

Mutation implementations for continuous solution

class macop.operators.continuous.mutators.PolynomialMutation(interval)[source]

Bases: macop.operators.base.Mutation

Polynomial Mutation implementation for continuous solution

kind

{KindOperator} – specify the kind of operator

Example:

>>> # import of solution and polynomial mutation operator
>>> from macop.solutions.continuous import ContinuousSolution
>>> from macop.operators.continuous.mutators import PolynomialMutation
>>> solution = ContinuousSolution.random(5, (-2, 2))
>>> list(solution.data)
[-0.50183952461055, 1.8028572256396647, 0.9279757672456204, 0.3946339367881464, -1.375925438230254]
>>> mutator = PolynomialMutation(interval=(-2, 2))
>>> mutation_solution = mutator.apply(solution)
>>> list(mutation_solution.data)
[-0.50183952461055, 1.8028572256396647, 0.9279757672456204, 0.3946339367881464, -1.375925438230254]
apply(solution)[source]

Create new solution based on solution passed as parameter

Parameters

solution – {Solution} – the solution to use for generating new solution

Returns

new generated solution

Return type

{Solution}

setAlgo(algo)
Keep into operator reference of the whole algorithm

The reason is to better manage operator instance

Parameters

algo – {Algorithm} – the algorithm reference runned