Model

class pymoo.core.algorithm.Algorithm(termination=None, output=None, display=None, callback=None, archive=None, return_least_infeasible=False, save_history=False, verbose=False, seed=None, evaluator=None, **kwargs)
Attributes
n_gen

Methods

advance

ask

finalize

has_next

infill

next

result

run

setup

tell

class pymoo.core.sampling.Sampling

This abstract class represents any sampling strategy that can be used to create an initial population or an initial search point.

Methods

do(problem, n_samples, **kwargs)

Sample new points with problem information if necessary.

do(problem, n_samples, **kwargs)

Sample new points with problem information if necessary.

Parameters
problemProblem

The problem to which points should be sampled. (lower and upper bounds, discrete, binary, …)

n_samplesint

Number of samples

Returns
popPopulation

The output population after sampling

class pymoo.core.selection.Selection(**kwargs)

This class is used to select parents for the mating or other evolutionary operators. Several strategies can be used to increase the selection pressure.

Methods

do(problem, pop, n_select, n_parents[, to_pop])

Choose from the population new individuals to be selected.

do(problem, pop, n_select, n_parents, to_pop=True, **kwargs)

Choose from the population new individuals to be selected.

Parameters
problem: class

The problem to be solved. Provides information such as lower and upper bounds or feasibility conditions for custom crossovers.

popPopulation

The population which should be selected from. Some criteria from the design or objective space might be used for the selection. Therefore, only the number of individual might be not enough.

n_selectint

Number of individuals to select.

n_parentsint

Number of parents needed to create an offspring.

to_popbool

Whether IF(!) the implementation returns only indices, it should be converted to individuals.

Returns
parentslist

List of parents to be used in the crossover

class pymoo.core.mutation.Mutation(prob=1.0, prob_var=None, **kwargs)

Methods

do

get_prob_var

class pymoo.core.crossover.Crossover(n_parents, n_offsprings, prob=0.9, **kwargs)

Methods

do

class pymoo.core.survival.Survival(filter_infeasible=True)

Methods

do

class pymoo.core.termination.Termination

Methods

update(algorithm)

Provide the termination criterion a current status of the algorithm to update the perc.

do_continue

has_terminated

terminate

update(algorithm)

Provide the termination criterion a current status of the algorithm to update the perc.

Parameters
algorithmobject

The algorithm object which is used to determine whether a run has terminated.

class pymoo.core.indicator.Indicator(**kwargs)

Methods

__call__(F, *args, **kwargs)

Call self as a function.

do

class pymoo.core.population.Population(individuals=[])

Methods

apply

collect

create

empty

get

has

merge

new

set

class pymoo.core.individual.Individual(config: Optional[dict] = None, **kwargs: dict)

Constructor for the Invididual class.

Parameters
configdict, None

A dictionary of configuration metadata. If None, use a class-dependent default configuration.

kwargsdict

Additional keyword arguments containing data which is to be stored in the Individual.

Attributes
CV

Get the constraint violation vector for an individual by either reading it from the cache or calculating it.

F

Get the objective function vector for an individual.

FEAS

Get whether an individual is feasible for each constraint.

G

Get the inequality constraint vector for an individual.

H

Get the equality constraint vector for an individual.

X

Get the decision vector for an individual.

cv

Convenience property.

dF

Get the objective function vector first derivatives for an individual.

dG

Get the inequality constraint(s) first derivatives for an individual.

dH

Get the equality constraint(s) first derivatives for an individual.

ddF

Get the objective function vector second derivatives for an individual.

ddG

Get the inequality constraint(s) second derivatives for an individual.

ddH

Get the equality constraint(s) second derivatives for an individual.

f

Convenience property.

feas

Convenience property.

feasible

Deprecated.

x

Convenience property.

Methods

copy([other, deep])

Copy an individual.

default_config()

Get default constraint violation configuration settings.

duplicate(key, new_key)

Duplicate a key to a new key.

get(*keys)

Get the values for one or more keys for an individual.

has(key)

Determine whether an individual has a provided key or not.

new()

Create a new instance of this class.

reset([data])

Reset the value of objective(s), inequality constraint(s), equality constraint(s), their first and second derivatives, the constraint violation, and the metadata to empty values.

set(key, value)

Set an individual’s data or metadata based on a key and value.

set_by_dict(**kwargs)

Set an individual’s data or metadata using values in a dictionary.

property CV

Get the constraint violation vector for an individual by either reading it from the cache or calculating it.

Returns
outnp.ndarray

The constraint violation vector for an individual.

property F

Get the objective function vector for an individual.

Returns
outnp.ndarray

The objective function vector for the individual.

property FEAS

Get whether an individual is feasible for each constraint.

Returns
outnp.ndarray

An array containing whether each constraint is feasible for an individual.

property G

Get the inequality constraint vector for an individual.

Returns
outnp.ndarray

The inequality constraint vector for the individual.

property H

Get the equality constraint vector for an individual.

Returns
outnp.ndarray

The equality constraint vector for the individual.

property X

Get the decision vector for an individual.

Returns
outnp.ndarray

The decision variable for the individual.

copy(other: Optional[pymoo.core.individual.Individual] = None, deep: bool = True)pymoo.core.individual.Individual

Copy an individual.

Parameters
otherIndividual, None

The individual to copy. If None, assumed to be self.

deepbool

Whether to deep copy the individual.

Returns
outIndividual

A copy of the individual.

property cv

Convenience property. Get the first constraint violation value for an individual by either reading it from the cache or calculating it.

Returns
outfloat, None

The constraint violation vector for an individual.

property dF

Get the objective function vector first derivatives for an individual.

Returns
outnp.ndarray

The objective function vector first derivatives for the individual.

property dG

Get the inequality constraint(s) first derivatives for an individual.

Returns
outnp.ndarray

The inequality constraint(s) first derivatives for the individual.

property dH

Get the equality constraint(s) first derivatives for an individual.

Returns
outnp.ndarray

The equality constraint(s) first derivatives for the individual.

property ddF

Get the objective function vector second derivatives for an individual.

Returns
outnp.ndarray

The objective function vector second derivatives for the individual.

property ddG

Get the inequality constraint(s) second derivatives for an individual.

Returns
outnp.ndarray

The inequality constraint(s) second derivatives for the individual.

property ddH

Get the equality constraint(s) second derivatives for an individual.

Returns
outnp.ndarray

The equality constraint(s) second derivatives for the individual.

default_config()dict

Get default constraint violation configuration settings.

Returns
outdict

A dictionary of default constraint violation settings.

duplicate(key: str, new_key: str)None

Duplicate a key to a new key.

Parameters
keystr

Name of the key to duplicated.

new_keystr

Name of the key to which to duplicate the original key.

property f

Convenience property. Get the first objective function value for an individual.

Returns
outfloat

The first objective function value for the individual.

property feas

Convenience property. Get whether an individual is feasible for the first constraint.

Returns
outbool

Whether an individual is feasible for the first constraint.

property feasible

Deprecated. Get whether an individual is feasible for each constraint.

Returns
outnp.ndarray

An array containing whether each constraint is feasible for an individual.

get(*keys: Tuple[str, ])Union[tuple, object]

Get the values for one or more keys for an individual.

Parameters
keystuple

A tuple of keys for which to get values.

Returns
outtuple, object

If more than one key provided, return a tuple of retrieved values. If a single key provided, return the retrieved value.

has(key: str)bool

Determine whether an individual has a provided key or not.

Parameters
keystr

The key for which to test.

Returns
outbool

Whether the Individual has the provided key.

new()pymoo.core.individual.Individual

Create a new instance of this class.

Returns
outIndividual

A new instance of an Individual.

reset(data: bool = True)None

Reset the value of objective(s), inequality constraint(s), equality constraint(s), their first and second derivatives, the constraint violation, and the metadata to empty values.

Parameters
databool

Whether to reset metadata associated with the Individiual.

set(key: str, value: object)pymoo.core.individual.Individual

Set an individual’s data or metadata based on a key and value.

Parameters
keystr

Key of the data for which to set.

valueobject

Value of the data for which to set.

Returns
outIndividual

A reference to the Individual for which values were set.

set_by_dict(**kwargs: dict)None

Set an individual’s data or metadata using values in a dictionary.

Parameters
kwargsdict

Keyword arguments defining the data to set.

property x

Convenience property. Get the decision vector for an individual.

Returns
outnp.ndarray

The decision variable for the individual.

class pymoo.core.result.Result

The resulting object of an optimization run.

Attributes
cv
f
feas