platypus.algorithms module

class AbstractGeneticAlgorithm(problem, population_size=100, generator=<platypus.operators.RandomGenerator object>, **kwargs)

Bases: Algorithm

Abstract class for genetic algorithms.

Generally speaking, genetic algorithms follow these steps:

  1. Initialization, where the population is filled with random solutions.

  2. Mating selection, where the parents for mating are selected using some preference.

  3. Recombination, where any crossover or mutation operators are applied to produce offspring.

  4. Survival selection, where the content of the next generation is selected.

Subclasses can implement the initialze() and iterate() methods. However, when running an algorithm, users should simply call the run() method.

The initialize() method is called exactly once on the first call to step() to initialize the population. The default implementation produces a random population, but can be extended to perform any other required initialization.

The iterate() method performs one iteration of the algorithm. Typically this means performing mating selection, recombination and survival selection, either for the entire population or a subset. Each invocation should produce and evaluate at least one offspring to ensure forward progress (and avoid getting stuck in an infinite loop).

Parameters

problemProblem

The problem to optimize.

population_sizeint

The size of the population.

generatorGenerator

The method for generating the initial population.

add_extension(extension)

Adds an extension.

Extensions add functionality to an algorithm at specific points during a run. If multiple extensions are added, they are run in reverse order. That is, the last extension added is the first to run.

Parameters

extensionExtension

The extension to add.

remove_extension(extension)

Removes an extension.

Parameters

extensionExtension or Type

The extension or type of extension to remove.

run(condition, callback=None)

Runs this algorithm until the termination condition is reached.

Parameters

conditionint or TerminationCondition

The termination condition. Providing an integer value is converted into the MaxEvaluations condition.

callbackCallable, optional

Callback function that is invoked after every iteration. The callback is passed this algorithm instance.

class CMAES(problem, offspring_size=100, cc=None, cs=None, damps=None, ccov=None, ccovsep=None, sigma=None, diagonal_iterations=0, indicator='crowding', initial_search_point=None, check_consistency=False, epsilons=None, **kwargs)

Bases: Algorithm

Covariance matrix adaption evolution strategy (CMA-ES).

add_extension(extension)

Adds an extension.

Extensions add functionality to an algorithm at specific points during a run. If multiple extensions are added, they are run in reverse order. That is, the last extension added is the first to run.

Parameters

extensionExtension

The extension to add.

remove_extension(extension)

Removes an extension.

Parameters

extensionExtension or Type

The extension or type of extension to remove.

run(condition, callback=None)

Runs this algorithm until the termination condition is reached.

Parameters

conditionint or TerminationCondition

The termination condition. Providing an integer value is converted into the MaxEvaluations condition.

callbackCallable, optional

Callback function that is invoked after every iteration. The callback is passed this algorithm instance.

class EpsMOEA(problem, epsilons, population_size=100, generator=<platypus.operators.RandomGenerator object>, selector=<platypus.operators.TournamentSelector object>, variator=None, **kwargs)

Bases: AbstractGeneticAlgorithm

\epsilon-MOEA.

Uses an epsilon-dominance archive to bound the size of the archive. Additionally, mating occurs between a member of the population and a member of the archive.

See EpsilonBoxArchive for more details on epsilon dominance.

Parameters

problemProblem

The problem to optimize.

epsilonslist of float

The epsilon values.

population_sizeint

The size of the population.

generatorGenerator

The method for generating the initial population.

selectorSelector

The method for selecting parents for mating.

variatorVariator, optional

The variator used during mating to produce offspring. If None, the default variator configured in PlatypusConfig is selected.

add_extension(extension)

Adds an extension.

Extensions add functionality to an algorithm at specific points during a run. If multiple extensions are added, they are run in reverse order. That is, the last extension added is the first to run.

Parameters

extensionExtension

The extension to add.

remove_extension(extension)

Removes an extension.

Parameters

extensionExtension or Type

The extension or type of extension to remove.

run(condition, callback=None)

Runs this algorithm until the termination condition is reached.

Parameters

conditionint or TerminationCondition

The termination condition. Providing an integer value is converted into the MaxEvaluations condition.

callbackCallable, optional

Callback function that is invoked after every iteration. The callback is passed this algorithm instance.

class EpsNSGAII(problem, epsilons, population_size=100, generator=<platypus.operators.RandomGenerator object>, selector=<platypus.operators.TournamentSelector object>, variator=None, **kwargs)

Bases: NSGAII

Epsilon-dominance NSGA-II (\epsilon-NSGA-II).

Extends NSGA-II to use an epsilon-dominance archive to track the best solutions found during search. This is essentially a form of elitism for multi-objective problems.

Parameters

problemProblem

The problem to optimize.

epsilonslist of float

The epsilons used to configure the epsilon-dominance archive.

population_sizeint

The size of the population.

generatorGenerator

The method for generating the initial population.

selectorSelector

The method for selecting parents for mating.

variatorVariator, optional

The variator used during mating to produce offspring. If None, the default variator configured in PlatypusConfig is selected.

add_extension(extension)

Adds an extension.

Extensions add functionality to an algorithm at specific points during a run. If multiple extensions are added, they are run in reverse order. That is, the last extension added is the first to run.

Parameters

extensionExtension

The extension to add.

remove_extension(extension)

Removes an extension.

Parameters

extensionExtension or Type

The extension or type of extension to remove.

run(condition, callback=None)

Runs this algorithm until the termination condition is reached.

Parameters

conditionint or TerminationCondition

The termination condition. Providing an integer value is converted into the MaxEvaluations condition.

callbackCallable, optional

Callback function that is invoked after every iteration. The callback is passed this algorithm instance.

class EvolutionaryStrategy(problem, population_size=100, offspring_size=100, generator=<platypus.operators.RandomGenerator object>, comparator=<platypus.core.ParetoDominance object>, variator=None, **kwargs)

Bases: SingleObjectiveAlgorithm

Single-objective evolutionary strategy (ES).

Parameters

problemProblem

The problem to optimize.

population_sizeint

The size of the population.

offspring_sizeint

The number of offspring to generate each iteration.

generatorGenerator

The method for generating the initial population.

comparatorDominance

The dominance criteria for ranking solutions.

variatorVariator, optional

The variator used during mating to produce offspring. Must have an arity of 1. If None, the default mutation configured in PlatypusConfig is selected.

add_extension(extension)

Adds an extension.

Extensions add functionality to an algorithm at specific points during a run. If multiple extensions are added, they are run in reverse order. That is, the last extension added is the first to run.

Parameters

extensionExtension

The extension to add.

remove_extension(extension)

Removes an extension.

Parameters

extensionExtension or Type

The extension or type of extension to remove.

run(condition, callback=None)

Runs this algorithm until the termination condition is reached.

Parameters

conditionint or TerminationCondition

The termination condition. Providing an integer value is converted into the MaxEvaluations condition.

callbackCallable, optional

Callback function that is invoked after every iteration. The callback is passed this algorithm instance.

class GDE3(problem, population_size=100, generator=<platypus.operators.RandomGenerator object>, variator=<platypus.operators.DifferentialEvolution object>, **kwargs)

Bases: AbstractGeneticAlgorithm

Generalized differential evolution (GDE3).

Only supporting real-valued problems, GDE3 uses differential evolution to evolve the population.

Parameters

problemProblem

The problem to optimize.

population_sizeint

The size of the population.

generatorGenerator

The method for generating the initial population.

variatorVariator

The variator used during mating to produce offspring. Must use the differential evolution operator.

add_extension(extension)

Adds an extension.

Extensions add functionality to an algorithm at specific points during a run. If multiple extensions are added, they are run in reverse order. That is, the last extension added is the first to run.

Parameters

extensionExtension

The extension to add.

remove_extension(extension)

Removes an extension.

Parameters

extensionExtension or Type

The extension or type of extension to remove.

run(condition, callback=None)

Runs this algorithm until the termination condition is reached.

Parameters

conditionint or TerminationCondition

The termination condition. Providing an integer value is converted into the MaxEvaluations condition.

callbackCallable, optional

Callback function that is invoked after every iteration. The callback is passed this algorithm instance.

class GeneticAlgorithm(problem, population_size=100, offspring_size=100, generator=<platypus.operators.RandomGenerator object>, selector=<platypus.operators.TournamentSelector object>, comparator=<platypus.core.ParetoDominance object>, variator=None, **kwargs)

Bases: SingleObjectiveAlgorithm

Single-objective genetic algorithm (GA).

A genetic algorithm is a generational algorithm that evolves a population of solutions. Each iteration, some number of offspring are produced by applying the given selection and variation operators. Then, the combined population of parents and offspring are ranked according to the comparison operator and truncated.

This implementation keeps track of the fittest individual in the population, ensuring it always survives to the next generation.

Parameters

problemProblem

The problem to optimize.

population_sizeint

The size of the population.

offspring_sizeint

The number of offspring to generate each iteration.

generatorGenerator

The method for generating the initial population.

selectorSelector

The method for selecting parents for mating.

comparatorDominance

The dominance criteria for ranking solutions.

variatorVariator, optional

The variator used during mating to produce offspring. If None, the default variator configured in PlatypusConfig is selected.

Attributes

fittestSolution

The fittest solution found thus far.

add_extension(extension)

Adds an extension.

Extensions add functionality to an algorithm at specific points during a run. If multiple extensions are added, they are run in reverse order. That is, the last extension added is the first to run.

Parameters

extensionExtension

The extension to add.

remove_extension(extension)

Removes an extension.

Parameters

extensionExtension or Type

The extension or type of extension to remove.

run(condition, callback=None)

Runs this algorithm until the termination condition is reached.

Parameters

conditionint or TerminationCondition

The termination condition. Providing an integer value is converted into the MaxEvaluations condition.

callbackCallable, optional

Callback function that is invoked after every iteration. The callback is passed this algorithm instance.

class IBEA(problem, population_size=100, generator=<platypus.operators.RandomGenerator object>, fitness_evaluator=<platypus.core.HypervolumeFitnessEvaluator object>, fitness_comparator=<platypus.core.AttributeDominance object>, variator=None, **kwargs)

Bases: AbstractGeneticAlgorithm

Indicator-based evolutionary algorithm (IBEA).

Uses a FitnessEvaluator to measure the fitness of solutions, typically based on hypervolume.

Parameters

problemProblem

The problem to optimize.

population_sizeint

The size of the population.

generatorGenerator

The method for generating the initial population.

fitness_evaluatorFitnessEvaluator

The method for computing the fitness of solutions. Default uses hypervolume.

fitness_comparatorDominance

The domnance criteria using the fitness value.

variatorVariator

The variator used during mating to produce offspring. If None, the default variator configured in PlatypusConfig is selected.

add_extension(extension)

Adds an extension.

Extensions add functionality to an algorithm at specific points during a run. If multiple extensions are added, they are run in reverse order. That is, the last extension added is the first to run.

Parameters

extensionExtension

The extension to add.

remove_extension(extension)

Removes an extension.

Parameters

extensionExtension or Type

The extension or type of extension to remove.

run(condition, callback=None)

Runs this algorithm until the termination condition is reached.

Parameters

conditionint or TerminationCondition

The termination condition. Providing an integer value is converted into the MaxEvaluations condition.

callbackCallable, optional

Callback function that is invoked after every iteration. The callback is passed this algorithm instance.

class MOEAD(problem, neighborhood_size=10, generator=<platypus.operators.RandomGenerator object>, variator=None, delta=0.8, eta=1, update_utility=None, weight_generator=<function random_weights>, scalarizing_function=<function chebyshev>, **kwargs)

Bases: AbstractGeneticAlgorithm

Multiobjective evolutionary algorithm with decomposition (MOEA/D).

add_extension(extension)

Adds an extension.

Extensions add functionality to an algorithm at specific points during a run. If multiple extensions are added, they are run in reverse order. That is, the last extension added is the first to run.

Parameters

extensionExtension

The extension to add.

remove_extension(extension)

Removes an extension.

Parameters

extensionExtension or Type

The extension or type of extension to remove.

run(condition, callback=None)

Runs this algorithm until the termination condition is reached.

Parameters

conditionint or TerminationCondition

The termination condition. Providing an integer value is converted into the MaxEvaluations condition.

callbackCallable, optional

Callback function that is invoked after every iteration. The callback is passed this algorithm instance.

class NSGAII(problem, population_size=100, generator=<platypus.operators.RandomGenerator object>, selector=<platypus.operators.TournamentSelector object>, variator=None, archive=None, **kwargs)

Bases: AbstractGeneticAlgorithm

Non-dominated sorting genetic algorithm (NSGA-II).

Most notably, NSGA-II uses non-dominated sorting during survival selection to assign rank and crowding distance values to solutions. The next generation is filled with solutions with lower ranks. When selecting from the last rank, solutions with larger crowding distances (more diverse) are preferred.

See nondominated_sort() for more details on non-dominated sorting.

Parameters

problemProblem

The problem to optimize.

population_sizeint

The size of the population.

generatorGenerator

The method for generating the initial population.

selectorSelector

The method for selecting parents for mating.

variatorVariator, optional

The variator used during mating to produce offspring. If None, the default variator configured in PlatypusConfig is selected.

archiveArchive, optional

The archive to store the best solutions found during optimization.

add_extension(extension)

Adds an extension.

Extensions add functionality to an algorithm at specific points during a run. If multiple extensions are added, they are run in reverse order. That is, the last extension added is the first to run.

Parameters

extensionExtension

The extension to add.

remove_extension(extension)

Removes an extension.

Parameters

extensionExtension or Type

The extension or type of extension to remove.

run(condition, callback=None)

Runs this algorithm until the termination condition is reached.

Parameters

conditionint or TerminationCondition

The termination condition. Providing an integer value is converted into the MaxEvaluations condition.

callbackCallable, optional

Callback function that is invoked after every iteration. The callback is passed this algorithm instance.

class NSGAIII(problem, divisions_outer, divisions_inner=0, generator=<platypus.operators.RandomGenerator object>, selector=<platypus.operators.TournamentSelector object>, variator=None, **kwargs)

Bases: AbstractGeneticAlgorithm

Non-dominated sorting genetic algorithm with reference ponts (NSGA-III).

Replaces NSGA-II’s crowding distance-based selection with one using reference points. At a high level, the advantage of reference points is two-fold. First, they can provide a better distribution of points, especially on problems with many objectives where most solutions tend to be non-dominated. Second, the reference points can be selected to target specific regions of interest.

Parameters

problemProblem

The problem to optimize.

divisions_outerint

The number of divisions. When divisions_inner is non-zero, this represents the number of outer divisions.

divisions_innerint

The number of inner divisions.

generatorGenerator

The method for generating the initial population.

selectorSelector

The method for selecting parents for mating.

variatorVariator

The variator used during mating to produce offspring. Must use the differential evolution operator.

add_extension(extension)

Adds an extension.

Extensions add functionality to an algorithm at specific points during a run. If multiple extensions are added, they are run in reverse order. That is, the last extension added is the first to run.

Parameters

extensionExtension

The extension to add.

remove_extension(extension)

Removes an extension.

Parameters

extensionExtension or Type

The extension or type of extension to remove.

run(condition, callback=None)

Runs this algorithm until the termination condition is reached.

Parameters

conditionint or TerminationCondition

The termination condition. Providing an integer value is converted into the MaxEvaluations condition.

callbackCallable, optional

Callback function that is invoked after every iteration. The callback is passed this algorithm instance.

class OMOPSO(problem, epsilons, swarm_size=100, leader_size=100, generator=<platypus.operators.RandomGenerator object>, mutation_probability=0.1, mutation_perturbation=0.5, max_iterations=100, **kwargs)

Bases: ParticleSwarm

Multi-objective particle swarm optimizer (OMOPSO).

Notably, OMOPSO introduces a uniform and non-uniform mutation operator that are applied to offspring. The non-uniform operator scales itself based on the maximum number of iterations, reducing the magnitude of mutations as the run progresses.

Parameters

problemProblem

The problem to optimize.

epsilonslist of float

The epsilons controlling the size of the epsilon-dominance archive.

swarm_sizeint

The size of the swarm (synonymous to a population).

leader_sizeint

The number of leaders to track (synonymous to an archive).

generatorGenerator

The method for generating the initial population.

mutation_probabilityfloat

The probability of mutation.

mutation_perturbationfloat

Controls the distribution of offspring produced by mutation.

max_iterationsint

The maximum number of iterations you expect to run this algorithm. This controls how quickly the non-uniform mutation scales.

add_extension(extension)

Adds an extension.

Extensions add functionality to an algorithm at specific points during a run. If multiple extensions are added, they are run in reverse order. That is, the last extension added is the first to run.

Parameters

extensionExtension

The extension to add.

remove_extension(extension)

Removes an extension.

Parameters

extensionExtension or Type

The extension or type of extension to remove.

run(condition, callback=None)

Runs this algorithm until the termination condition is reached.

Parameters

conditionint or TerminationCondition

The termination condition. Providing an integer value is converted into the MaxEvaluations condition.

callbackCallable, optional

Callback function that is invoked after every iteration. The callback is passed this algorithm instance.

class PAES(problem, divisions=8, capacity=100, generator=<platypus.operators.RandomGenerator object>, variator=None, **kwargs)

Bases: AbstractGeneticAlgorithm

Pareto archived evolutionary strategy (PAES).

Uses an adaptive grid archive to maintain a set of diverse solutions. See AdaptiveGridArchive for more details.

Parameters

problemProblem

The problem to optimize.

divisionsint

The number of divisions used by the adaptive grid archive.

capacityint

The maximum capacity of the adaptive grid archive.

generatorGenerator

The method for generating the initial population.

variatorVariator

The variator used during mating to produce offspring. If None, the default variator configured in PlatypusConfig is selected.

add_extension(extension)

Adds an extension.

Extensions add functionality to an algorithm at specific points during a run. If multiple extensions are added, they are run in reverse order. That is, the last extension added is the first to run.

Parameters

extensionExtension

The extension to add.

remove_extension(extension)

Removes an extension.

Parameters

extensionExtension or Type

The extension or type of extension to remove.

run(condition, callback=None)

Runs this algorithm until the termination condition is reached.

Parameters

conditionint or TerminationCondition

The termination condition. Providing an integer value is converted into the MaxEvaluations condition.

callbackCallable, optional

Callback function that is invoked after every iteration. The callback is passed this algorithm instance.

class PESA2(problem, population_size=100, divisions=8, capacity=100, generator=<platypus.operators.RandomGenerator object>, variator=None, **kwargs)

Bases: AbstractGeneticAlgorithm

Pareto envelope-based selection algorithm (PESA2).

Uses an adaptive grid archive to maintain a set of diverse solutions. See AdaptiveGridArchive for more details.

Parameters

problemProblem

The problem to optimize.

population_sizeint

The size of the population.

divisionsint

The number of divisions used by the adaptive grid archive.

capacityint

The maximum capacity of the adaptive grid archive.

generatorGenerator

The method for generating the initial population.

variatorVariator

The variator used during mating to produce offspring. If None, the default variator configured in PlatypusConfig is selected.

add_extension(extension)

Adds an extension.

Extensions add functionality to an algorithm at specific points during a run. If multiple extensions are added, they are run in reverse order. That is, the last extension added is the first to run.

Parameters

extensionExtension

The extension to add.

remove_extension(extension)

Removes an extension.

Parameters

extensionExtension or Type

The extension or type of extension to remove.

run(condition, callback=None)

Runs this algorithm until the termination condition is reached.

Parameters

conditionint or TerminationCondition

The termination condition. Providing an integer value is converted into the MaxEvaluations condition.

callbackCallable, optional

Callback function that is invoked after every iteration. The callback is passed this algorithm instance.

class ParticleSwarm(problem, swarm_size=100, leader_size=100, generator=<platypus.operators.RandomGenerator object>, mutate=None, leader_comparator=<platypus.core.AttributeDominance object>, dominance=<platypus.core.ParetoDominance object>, fitness=None, larger_preferred=True, fitness_getter=<function fitness_key>, **kwargs)

Bases: Algorithm

Abstract class for particle swarm optimization (PSO) algorithms.

Parameters

problemProblem

The problem to optimize.

swarm_sizeint

The size of the swarm (synonymous to a population).

leader_sizeint

The number of leaders to track (synonymous to an archive).

generatorGenerator

The method for generating the initial population.

mutateVariator

The mutation used during mating to produce offspring. Must have an arity of 1.

leader_comparatorDominance

The dominance criteria for selecting leaders.

dominanceDominance

The dominance criteria for ranking solutions.

fitnessCallable

Function for measuring the fitness of solutions.

larger_preferredboolean

Indicates if larger or smaller fitness values are preferred.

fitness_getterCallable

Function to read the fitness value assigned to solutions.

add_extension(extension)

Adds an extension.

Extensions add functionality to an algorithm at specific points during a run. If multiple extensions are added, they are run in reverse order. That is, the last extension added is the first to run.

Parameters

extensionExtension

The extension to add.

remove_extension(extension)

Removes an extension.

Parameters

extensionExtension or Type

The extension or type of extension to remove.

run(condition, callback=None)

Runs this algorithm until the termination condition is reached.

Parameters

conditionint or TerminationCondition

The termination condition. Providing an integer value is converted into the MaxEvaluations condition.

callbackCallable, optional

Callback function that is invoked after every iteration. The callback is passed this algorithm instance.

class RegionBasedSelector(archive, grid)

Bases: Selector

Region-based selector using density from an adaptive grid archive.

Parameters

archiveAdaptiveGridArchive

The adaptive grid archive

griddict

Mapping from grid indices to solutions.

draw()

Draw a solution at random from the archive.

select(n, population)

Selects N members from the population.

This default implementation operates “with replacement”, meaning solutions can be selected multiple times. Subclasses are allowed to modify this behavior.

Parameters

nint

The number of solutions to select from the population.

population: list of Solution

The population of solutions.

select_one(population)

Selects one of two solutions drawn from the archive based on density.

class SMPSO(problem, swarm_size=100, leader_size=100, generator=<platypus.operators.RandomGenerator object>, max_iterations=100, mutate=None, **kwargs)

Bases: ParticleSwarm

Speed-constrained particle swarm optimizer (SMPSO).

Parameters

problemProblem

The problem to optimize.

swarm_sizeint

The size of the swarm (synonymous to a population).

leader_sizeint

The number of leaders to track (synonymous to an archive).

generatorGenerator

The method for generating the initial population.

max_iterationsint

The maximum number of iterations you expect to run this algorithm. This controls how quickly the non-uniform mutation scales.

mutateVariator

The mutation operator. Must have an arity of 1.

add_extension(extension)

Adds an extension.

Extensions add functionality to an algorithm at specific points during a run. If multiple extensions are added, they are run in reverse order. That is, the last extension added is the first to run.

Parameters

extensionExtension

The extension to add.

remove_extension(extension)

Removes an extension.

Parameters

extensionExtension or Type

The extension or type of extension to remove.

run(condition, callback=None)

Runs this algorithm until the termination condition is reached.

Parameters

conditionint or TerminationCondition

The termination condition. Providing an integer value is converted into the MaxEvaluations condition.

callbackCallable, optional

Callback function that is invoked after every iteration. The callback is passed this algorithm instance.

class SPEA2(problem, population_size=100, generator=<platypus.operators.RandomGenerator object>, variator=None, dominance=<platypus.core.ParetoDominance object>, k=1, **kwargs)

Bases: AbstractGeneticAlgorithm

Improved strength-based Pareto evolutionary algorithm (SPEA2).

SPEA2 uses a novel strengh-based measure of fitness, which is a combination of the number other solutions that are dominated plus a density or crowding distance measure.

Parameters

problemProblem

The problem to optimize.

population_sizeint

The size of the population.

generatorGenerator

The method for generating the initial population.

variatorVariator

The variator used during mating to produce offspring. Must use the differential evolution operator.

dominanceDominance

The dominance criteria for ranking solutions.

kint

Niching parameter specifying that crowding is based on the k-th nearest neighbor.

add_extension(extension)

Adds an extension.

Extensions add functionality to an algorithm at specific points during a run. If multiple extensions are added, they are run in reverse order. That is, the last extension added is the first to run.

Parameters

extensionExtension

The extension to add.

remove_extension(extension)

Removes an extension.

Parameters

extensionExtension or Type

The extension or type of extension to remove.

run(condition, callback=None)

Runs this algorithm until the termination condition is reached.

Parameters

conditionint or TerminationCondition

The termination condition. Providing an integer value is converted into the MaxEvaluations condition.

callbackCallable, optional

Callback function that is invoked after every iteration. The callback is passed this algorithm instance.

class SingleObjectiveAlgorithm(problem, population_size=100, generator=<platypus.operators.RandomGenerator object>, **kwargs)

Bases: AbstractGeneticAlgorithm

Abstract class for single-objective optimization algorithms.

Parameters

problemProblem

The problem to optimize.

population_sizeint

The size of the population.

generatorGenerator

The method for generating the initial population.

add_extension(extension)

Adds an extension.

Extensions add functionality to an algorithm at specific points during a run. If multiple extensions are added, they are run in reverse order. That is, the last extension added is the first to run.

Parameters

extensionExtension

The extension to add.

remove_extension(extension)

Removes an extension.

Parameters

extensionExtension or Type

The extension or type of extension to remove.

run(condition, callback=None)

Runs this algorithm until the termination condition is reached.

Parameters

conditionint or TerminationCondition

The termination condition. Providing an integer value is converted into the MaxEvaluations condition.

callbackCallable, optional

Callback function that is invoked after every iteration. The callback is passed this algorithm instance.