platypus.operators module
- class BitFlip(probability=1)
Bases:
MutationBit-flip mutation for binary encodings.
Parameters
- probabilityint or float
The probability of flipping an individual bit. If the value is an int, then the probability is divided by the number of bits.
- class CompoundMutation(*mutators)
Bases:
MutationCombines two or more mutation operators.
Parameters
- mutatorslist of Mutation
The mutation operators to combine, which are applied sequentially in the order provided.
- class CompoundOperator(*variators)
Bases:
VariatorCombines two or more variation operators.
Parameters
- variatorslist of Variator
The variation operators to combine, which are applied sequentially in the order provided.
- class DifferentialEvolution(crossover_rate=0.1, step_size=0.5)
Bases:
VariatorDifferential evolution (DE) operator.
Parameters
- crossover_ratefloat
The crossover rate.
- step_sizefloat
The step size.
- class GAOperator(variation, mutation)
Bases:
VariatorGenetic algorithm operator combining crossover and mutation.
Parameters
- variationVariator
The crossover operator.
- mutationVariator
The mutation operator.
- class HUX(probability=1.0)
Bases:
VariatorHalf-uniform crossover for binary encodings.
Parameters
- probabilityfloat
The probability of applying this operator.
- class InjectedPopulation(solutions)
Bases:
GeneratorGenerator for injecting solutions into the initial population.
Any remaining slots in the initial population will be filled with random solutions generated in the same manner as
RandomGenerator.Parameters
- solutionsiterable of Solution
The solutions to inject into the pouplation.
- class Insertion(probability=0.3)
Bases:
MutationInsertion mutation for permutations.
Removes the value at a random index and inserts it in a new, random location. This differs slighly from
Swapin that only one element is relocated.Parameters
- probabilityfloat
The probability of applying this operator.
- class Multimethod(algorithm, variators, update_frequency=100)
Bases:
VariatorMultimethod variation.
Given a list of variation operators and their assigned probabilities, picks an operator at random each time
evolve()is called. The probabilities initiall start out at1 / len(variators), but adapts over time to favor operators producing more offspring that survive to future generations.Parameters
- algorithmAlgorithm
The algorithm using this operator.
- variatorslist of Variator
The variators to include.
- update_frequencyint
Controls how frequently the probabilities change.
- class NonUniformMutation(probability, perturbation, max_iterations, algorithm)
Bases:
MutationNon-uniform mutation used by OMOPSO.
Parameters
- probabilityfloat
Probability of applying this operator.
- perturbationfloat
Controls the magnitude of the mutation.
- max_iterationsint
The maximum number of iterations that OMOPSO is expected to run, which is used to decrease the magnitude of mutations over time.
- algorithmAlgorithm
A reference to the OMOPSO instance.
- class PCX(nparents=10, noffspring=2, eta=0.1, zeta=0.1)
Bases:
VariatorParent-centric crossover (PCX).
Parameters
- nparentsint
The number of parents.
- noffspringint
The number of offspring produced.
- etafloat
Parameter controlling the shape of the resulting distribution.
- zetafloat
Parameter controlling the shape of the resulting distribution.
- class PM(probability=1, distribution_index=20.0)
Bases:
MutationPolynomial mutation (PM).
Parameters
- probabilityfloat
Probability of applying this operator to a decision variable.
- distribution_indexfloat
Controls the distribution of this operator. Larger values tend to produce offspring nearer the parent.
- class PMX(probability=1.0)
Bases:
VariatorPartially mapped crossover (PMX) for permutations.
Parameters
- probabilityfloat
The probability of applying this operator.
- class Replace(probability=0.3)
Bases:
MutationReplace mutation for subsets.
Selects a random element in the subset and replaces it with a different element.
Parameters
- probabilityfloat
The probability of applying this operator.
- class SBX(probability=1.0, distribution_index=15.0)
Bases:
VariatorSimulated binary crossover (SBX).
Parameters
- probabilityfloat
Probability of applying this operator to a decision variable.
- distribution_indexfloat
Controls the distribution of this operator. Larger values tend to produce offspring nearer the parent.
- class SPX(nparents=10, noffspring=2, expansion=None)
Bases:
VariatorSimplex crossover (SPX).
Parameters
- nparentsint
The number of parents.
- noffspringint
The number of offspring produced.
- expansionfloat
Parameter controlling the shape of the resulting distribution.
- class SSX(probability=1.0)
Bases:
VariatorSubset crossover.
Randomly swaps elements from the two parent subsets.
Parameters
- probabilityfloat
The probability of applying this operator.
- class Swap(probability=0.3)
Bases:
MutationSwap mutation for permutations.
Randomly picks two indices in the permutation and swaps their values.
Parameters
- probabilityfloat
The probability of applying this operator.
- class TournamentSelector(tournament_size=2, dominance=<platypus.core.ParetoDominance object>)
Bases:
SelectorTournament selection.
Parameters
- tournament_sizeint
The size of the tournament, typically 2.
- dominanceDominance
The dominance criteria for selecting the winner of the tournament.
- class UM(probability=1)
Bases:
MutationUniform mutation (UM).
Parameters
- probabilityfloat
Probability of applying this operator to a decision variable.
- class UNDX(nparents=10, noffspring=2, zeta=0.5, eta=0.35)
Bases:
VariatorUnimodal normal distribution crossover (UNDX).
Parameters
- nparentsint
The number of parents.
- noffspringint
The number of offspring produced.
- zetafloat
Parameter controlling the shape of the resulting distribution.
- etafloat
Parameter controlling the shape of the resulting distribution.