Problem#
- class pybrops.opt.prob.Problem.Problem(n_var=-1, n_obj=1, n_ieq_constr=0, n_eq_constr=0, xl=None, xu=None, vtype=None, vars=None, elementwise=False, elementwise_func=<class 'pymoo.core.problem.ElementwiseEvaluationFunction'>, elementwise_runner=<pymoo.core.problem.LoopedElementwiseEvaluation object>, requires_kwargs=False, replace_nan_values_by=None, exclude_from_serialization=None, callback=None, strict=True, **kwargs)[source]#
Bases:
Problem
A semi-abstract base class for representing all optimization problems. This basal semi-abstract class extends the PyMOO Problem class.
The general formulation for an optimization problem should be:
\[\min_{\mathbf{x}} \mathbf{w_F \odot F(x)}\]Such that:
\[ \begin{align}\begin{aligned}\mathbf{w_G \odot G(x) \leq 0}\\\mathbf{w_H \odot H(x) = 0}\end{aligned}\end{align} \]- A user must implement the following abstract methods in derivatives:
__init__
evalfn
_evaluate
Notes
It is possible to call the constructor of this semi-abstract from a derived class.
- Parameters:
n_var (int) – Number of Variables
n_obj (int) – Number of Objectives
n_ieq_constr (int) – Number of Inequality Constraints
n_eq_constr (int) – Number of Equality Constraints
xl (np.array, float, int) – Lower bounds for the variables. if integer all lower bounds are equal.
xu (np.array, float, int) – Upper bounds for the variable. if integer all upper bounds are equal.
vtype (type) – The variable type. So far, just used as a type hint.
Methods
bounds
do
Evaluate a candidate solution for the given Problem.
evaluate
has_bounds
has_constraints
ideal_point
nadir_point
name
pareto_front
pareto_set
Attributes
A callback function to be called after every evaluation.
Type of the variable to be evaluated.
Decision space boundaries.
Lower boundary of the decision space.
Upper boundary of the decision space.
Whether the evaluation function should be run elementwise.
A class that creates the function that evaluates a single individual.
A function that runs the function that evaluates a single individual.
Equality constraint violation function weights.
attributes which are excluded from being serialized.
Inequality constraint violation function weights.
n_constr
n_eq_constr.
Number of inequality constraints.
Number of objectives.
Number of decision variables.
Number of decision variables.
Number of equality constraint violations.
Number of inequality constraint violation functions.
Number of objectives.
Objective function weights.
replace_nan_values_by.
Whether the shapes are checked strictly.
Variables provided in their explicit form.
The variable type.
Lower boundary of the decision space.
Upper boundary of the decision space.
- property callback: Callable | None#
A callback function to be called after every evaluation.
- property data: dict#
Type of the variable to be evaluated.
- property decn_space: ndarray | None#
Decision space boundaries.
- property decn_space_lower: ndarray | None#
Lower boundary of the decision space.
- property decn_space_upper: ndarray | None#
Upper boundary of the decision space.
- property elementwise: bool#
Whether the evaluation function should be run elementwise.
- property elementwise_func: type#
A class that creates the function that evaluates a single individual.
- property elementwise_runner: Callable#
A function that runs the function that evaluates a single individual.
- property eqcv_wt: ndarray#
Equality constraint violation function weights.
- abstract evalfn(x, *args, **kwargs)[source]#
Evaluate a candidate solution for the given Problem.
This calculates three vectors which are to be minimized:
\[\mathbf{v_{obj}} = \mathbf{w_{obj} \odot F_{obj}(x)} \ \mathbf{v_{ineqcv}} = \mathbf{w_{ineqcv} \odot G_{ineqcv}(x)} \ \mathbf{v_{eqcv}} = \mathbf{w_{eqcv} \odot H_{eqcv}(x)}\]- Parameters:
x (numpy.ndarray) – A candidate solution vector of shape
(ndecn,)
.args (tuple) – Additional non-keyword arguments.
kwargs (dict) – Additional keyword arguments.
- Returns:
out – A tuple
(obj, ineqcv, eqcv)
.Where:
obj
is a numpy.ndarray of shape(nobj,)
that containsobjective function evaluations.
ineqcv
is a numpy.ndarray of shape(nineqcv,)
that containsinequality constraint violation values.
eqcv
is a numpy.ndarray of shape(neqcv,)
that containsequality constraint violation values.
- Return type:
tuple
- property exclude_from_serialization: Iterable | None#
attributes which are excluded from being serialized.
- property ineqcv_wt: ndarray#
Inequality constraint violation function weights.
- property n_eq_constr: Integral#
n_eq_constr.
- property n_ieq_constr: Integral#
Number of inequality constraints.
- property n_obj: Integral#
Number of objectives.
- property n_var: Integral#
Number of decision variables.
- property ndecn: Integral#
Number of decision variables.
- property neqcv: Integral#
Number of equality constraint violations.
- property nineqcv: Integral#
Number of inequality constraint violation functions.
- property nobj: Integral#
Number of objectives.
- property obj_wt: ndarray#
Objective function weights.
- property replace_nan_values_by: Real | None#
replace_nan_values_by.
- property strict: bool#
Whether the shapes are checked strictly.
- property vars: Container | None#
Variables provided in their explicit form.
- property vtype: type | None#
The variable type. So far, just used as a type hint.
- property xl: ndarray | None#
Lower boundary of the decision space.
- property xu: ndarray | None#
Upper boundary of the decision space.