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)[source]#
- Attributes:
- n_gen
Methods
advance
ask
finalize
has_next
infill
next
result
run
setup
tell
- class pymoo.core.sampling.Sampling[source]#
This abstract class represents any sampling strategy that can be used to create an initial population or an initial search point.
Methods
do
- class pymoo.core.selection.Selection(**kwargs)[source]#
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
- class pymoo.core.mutation.Mutation(prob=1.0, prob_var=None, **kwargs)[source]#
Methods
do
get_prob_var
- class pymoo.core.crossover.Crossover(n_parents, n_offsprings, prob=0.9, **kwargs)[source]#
Methods
do
- class pymoo.core.termination.Termination[source]#
Methods
update(algorithm)Provide the termination criterion a current status of the algorithm to update the perc.
do_continue
has_terminated
terminate
- class pymoo.core.indicator.Indicator(**kwargs)[source]#
Methods
__call__(F, *args, **kwargs)Call self as a function.
do
- class pymoo.core.population.Population(individuals=[])[source]#
Methods
apply
collect
create
empty
get
has
merge
new
set
- class pymoo.core.individual.Individual(config: dict | None = None, **kwargs: Any)[source]#
Constructor for the
Invididualclass.- Parameters:
- configdict, None
A dictionary of configuration metadata. If
None, use a class-dependent default configuration.- kwargsAny
Additional keyword arguments containing data which is to be stored in the
Individual.
- Attributes:
CVGet the constraint violation vector for an individual by either reading it from the cache or calculating it.
FGet the objective function vector for an individual.
FEASGet whether an individual is feasible for each constraint.
GGet the inequality constraint vector for an individual.
HGet the equality constraint vector for an individual.
XGet the decision vector for an individual.
cvConvenience property.
dFGet the objective function vector first derivatives for an individual.
dGGet the inequality constraint(s) first derivatives for an individual.
dHGet the equality constraint(s) first derivatives for an individual.
ddFGet the objective function vector second derivatives for an individual.
ddGGet the inequality constraint(s) second derivatives for an individual.
ddHGet the equality constraint(s) second derivatives for an individual.
fConvenience property.
feasConvenience property.
feasibleDeprecated.
xConvenience property.
Methods
copy([other, deep])Copy an individual.
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: ndarray#
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: ndarray#
Get the objective function vector for an individual.
- Returns:
- outnp.ndarray
The objective function vector for the individual.
- property FEAS: ndarray#
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: ndarray#
Get the inequality constraint vector for an individual.
- Returns:
- outnp.ndarray
The inequality constraint vector for the individual.
- property H: ndarray#
Get the equality constraint vector for an individual.
- Returns:
- outnp.ndarray
The equality constraint vector for the individual.
- property X: ndarray#
Get the decision vector for an individual.
- Returns:
- outnp.ndarray
The decision variable for the individual.
- copy(other: Individual | None = None, deep: bool = True) Individual[source]#
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: float | None#
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: ndarray#
Get the objective function vector first derivatives for an individual.
- Returns:
- outnp.ndarray
The objective function vector first derivatives for the individual.
- property dG: ndarray#
Get the inequality constraint(s) first derivatives for an individual.
- Returns:
- outnp.ndarray
The inequality constraint(s) first derivatives for the individual.
- property dH: ndarray#
Get the equality constraint(s) first derivatives for an individual.
- Returns:
- outnp.ndarray
The equality constraint(s) first derivatives for the individual.
- property ddF: ndarray#
Get the objective function vector second derivatives for an individual.
- Returns:
- outnp.ndarray
The objective function vector second derivatives for the individual.
- property ddG: ndarray#
Get the inequality constraint(s) second derivatives for an individual.
- Returns:
- outnp.ndarray
The inequality constraint(s) second derivatives for the individual.
- property ddH: ndarray#
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[source]#
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: float#
Convenience property. Get the first objective function value for an individual.
- Returns:
- outfloat
The first objective function value for the individual.
- property feas: bool#
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: ndarray#
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: str) tuple | object[source]#
Get the values for one or more keys for an individual.
- Parameters:
- keysstr
Keys for which to get values.
- Returns:
- outtuple, object
If more than one key provided, return a
tupleof retrieved values. If a single key provided, return the retrieved value.
- has(key: str) bool[source]#
Determine whether an individual has a provided key or not.
- Parameters:
- keystr
The key for which to test.
- Returns:
- outbool
Whether the
Individualhas the provided key.
- new() Individual[source]#
Create a new instance of this class.
- Returns:
- outIndividual
A new instance of an
Individual.
- reset(data: bool = True) None[source]#
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) Individual[source]#
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
Individualfor which values were set.