Model#
- class pymoo.core.algorithm.Algorithm(termination: Termination | str | tuple[str, ...] | None = None, output: str | None = None, display: Display | None = None, callback: Callback | None = None, archive: Archive | None = None, return_least_infeasible: bool = False, save_history: bool = False, verbose: bool = False, seed: int | None = None, evaluator: Evaluator | None = None, **kwargs)[source]#
- class pymoo.core.sampling.Sampling[source]#
Initialize a Sampling operator.
This abstract class represents any sampling strategy that can be used to create an initial population or an initial search point.
- class pymoo.core.mutation.Mutation(prob=1.0, prob_var=None, **kwargs)[source]#
Base class for mutation operators.
- class pymoo.core.survival.Survival(filter_infeasible: bool = True)[source]#
Initialize survival operator.
- Parameters:
filter_infeasible – Whether to separate feasible from infeasible solutions.
- class pymoo.core.population.Population(individuals: Individual | list[Individual] | None = None)[source]#
- class pymoo.core.individual.Individual(config: dict | None = None, **kwargs: Any)[source]#
Constructor for the Individual class.
- Parameters:
config – A dictionary of configuration metadata. If None, uses a class-dependent default.
kwargs – Additional keyword arguments containing data to store in the Individual.
- property CV: ndarray#
Get the constraint violation vector from cache or calculate it.
- Returns:
The constraint violation vector for the individual.
- Return type:
np.ndarray
- property F: ndarray#
Get the objective function vector for an individual.
- Returns:
The objective function vector for the individual.
- Return type:
np.ndarray
- property FEAS: ndarray#
Get whether an individual is feasible for each constraint.
- Returns:
An array of feasibility flags for each constraint.
- Return type:
np.ndarray
- property G: ndarray#
Get the inequality constraint vector for an individual.
- Returns:
The inequality constraint vector for the individual.
- Return type:
np.ndarray
- property H: ndarray#
Get the equality constraint vector for an individual.
- Returns:
The equality constraint vector for the individual.
- Return type:
np.ndarray
- property X: ndarray#
Get the decision vector for an individual.
- Returns:
The decision variable for the individual.
- Return type:
np.ndarray
- copy(other: Individual | None = None, deep: bool = True) Individual[source]#
Copy an individual.
- Parameters:
other – The individual to copy. If None, assumed to be self.
deep – Whether to deep copy the individual.
- Returns:
A copy of the individual.
- Return type:
- property cv: float | None#
Get the first constraint violation value for an individual.
- Returns:
The first constraint violation value for the individual.
- Return type:
float or None
- property dF: ndarray#
Get the objective function first derivatives for an individual.
- Returns:
The first derivatives of the objective function vector.
- Return type:
np.ndarray
- property dG: ndarray#
Get the inequality constraint first derivatives for an individual.
- Returns:
The first derivatives of the inequality constraints.
- Return type:
np.ndarray
- property dH: ndarray#
Get the equality constraint first derivatives for an individual.
- Returns:
The first derivatives of the equality constraints.
- Return type:
np.ndarray
- property ddF: ndarray#
Get the objective function second derivatives for an individual.
- Returns:
The second derivatives of the objective function vector.
- Return type:
np.ndarray
- property ddG: ndarray#
Get the inequality constraint second derivatives for an individual.
- Returns:
The second derivatives of the inequality constraints.
- Return type:
np.ndarray
- property ddH: ndarray#
Get the equality constraint second derivatives for an individual.
- Returns:
The second derivatives of the equality constraints.
- Return type:
np.ndarray
- default_config() dict#
Get default constraint violation configuration settings.
- Returns:
A dictionary of default constraint violation settings.
- Return type:
- duplicate(key: str, new_key: str) None[source]#
Duplicate a key to a new key.
- Parameters:
key – Name of the key to duplicate.
new_key – Name of the key to which to duplicate the original key.
- property f: float#
Get the first objective function value for an individual.
- Returns:
The first objective function value for the individual.
- Return type:
- property feas: bool#
Get whether an individual is feasible for the first constraint.
- Returns:
Whether the individual is feasible for the first constraint.
- Return type:
- property feasible: ndarray#
Get whether an individual is feasible for each constraint.
Deprecated. Use FEAS instead.
- Returns:
An array of feasibility flags for each constraint.
- Return type:
np.ndarray
- has(key: str) bool[source]#
Determine whether an individual has a provided key.
- Parameters:
key – The key for which to test.
- Returns:
Whether the Individual has the provided key.
- Return type:
- new() Individual[source]#
Create a new instance of this class.
- Returns:
A new instance of an Individual.
- Return type:
- reset(data: bool = True) None[source]#
Reset objectives, constraints, derivatives, and violation values.
Resets all objective values, inequality/equality constraints, their first and second derivatives, constraint violations, and metadata to empty values.
- Parameters:
data – Whether to reset metadata associated with the Individual.
- set(key: str, value: object) Individual[source]#
Set an individual’s data or metadata based on a key and value.
- Parameters:
key – Key of the data for which to set.
value – Value of the data for which to set.
- Returns:
A reference to the Individual for which values were set.
- Return type: