constraint_function_factory
- desdeo_problem.problem.constraint_function_factory(lhs, rhs, operator)[source]
A function that creates an evaluator.
This function creates an evaluator to be used with the ScalarConstraint class. Constraints should be formulated in a way where all the mathematical expression are on the left hand side, and the constants on the right hand side.
- Parameters:
lhs (Callable) – The left hand side of the constraint. Should be a callable function representing a mathematical expression.
rhs (float) – The right hand side of a constraint. Represents the right hand side of the constraint.
operator (str) – The kind of constraint. Can be ‘==’, ‘<’, ‘>’.
- Returns:
A function that can be called to evaluate the rhs and which returns representing how the constraint is obeyed. A negative value represent a violation of the constraint and a positive value an agreement with the constraint. The absolute value of the float is a direct indicator how the constraint is violated/agdreed with.
- Return type:
Callable
- Raises:
ValueError – The supplied operator is not supported.