Constraints
Constraint — a bound on a numeric calculation that the solver must satisfy.
- class ConstraintType(*values)[source]
Constraint operator.
- Values:
EQUALITY: The expression must equal the bound. INEQUALITY: The expression must lie within the lower/upper bounds.
- EQUALITY = 'equality'
- INEQUALITY = 'inequality'
- class Constraint(constraint)[source]
A bound on a numeric
Calculationthat the solver must respect.Construct via
ModelConfiguration.add_constraint(); configure via the chainedset_*methods. Default type isConstraintType.INEQUALITYwithupper_bound = 0and inclusive bounds.- set_lower_bound(lower_bound)[source]
Set the lower bound. Pass a literal,
Calculation, orParameter.- Return type:
- set_upper_bound(upper_bound)[source]
Set the upper bound. See
set_lower_bound()for accepted types.- Return type:
- set_lower_bound_inclusive(lower_bound_inclusive)[source]
Toggle inclusive/exclusive comparison on the lower bound.
- Return type:
- set_upper_bound_inclusive(upper_bound_inclusive)[source]
Toggle inclusive/exclusive comparison on the upper bound.
- Return type:
- set_hard_score(hard_score)[source]
Set the per-violation penalty applied to the solver’s hard score.
- Return type: