CADETProcess.optimization.OptimizationProblem.add_nonlinear_constraint#
- OptimizationProblem.add_nonlinear_constraint(nonlincon: Callable, name: str | None = None, n_nonlinear_constraints: int | None = 1, bad_metrics: float | list[float] | None = None, evaluation_objects: int | list | object | None = -1, bounds: float | list[float] | None = 0, comparison_operator: str | None = 'le', labels: str | None = None, requires: Evaluator | list | None = None, *args: tuple | None, **kwargs: dict | None) None[source]#
Add nonliner constraint function to optimization problem.
- Parameters:
- nonlincontp.Callable
Nonlinear constraint function.
- namestr, optional
Name of the nonlinear constraint.
- n_nonlinear_constraintsint, optional
Number of metrics returned by nonlinear constraint function. The default is 1.
- bad_metricsfloat or list of floats, optional
Value which is returned when evaluation fails.
- evaluation_objects{EvaluationObject, None, -1, list}
EvaluationObjects which are evaluated by objective. If None, no EvaluationObject is used. If -1, all EvaluationObjects are used.
- boundsscalar or list of scalars, optional
Upper limits of constraint function. If only one value is given, the same value is assumed for all constraints. The default is 0.
- comparison_operator{‘ge’, ‘le’}, optional
Comparator to define whether metric should be greater or equal to, or less than or equal to the specified bounds. The default is ‘le’ (lower or equal).
- labelsstr, optional
Names of the individual metrics.
- requires{None, Evaluator, list}, optional
Evaluators used for preprocessing. If None, no preprocessing is required. The default is None.
- argstuple, optional
Additional arguments for nonlinear constraint function.
- kwargsdict, optional
Additional keyword arguments for nonlinear constraint function.
- Raises:
- TypeError
If nonlinear constraint function is not callable.
- CADETProcessError
If EvaluationObject is not found. If Evaluator is not found.
Warning
If nonlinear constraint with same name already exists.