E-MD0009 — Invalid non-finite decision variable bound
Error Type |
|
|---|---|
Phase |
declaring a decision variable |
Python exception |
|
Message
The {bound} bound of decision variable `{name}` is `{value}`, which is not a valid {bound} bound.
`NaN` is never a valid bound. `+inf` is only valid as an upper bound and `-inf` is only valid as a lower bound.
Possible fix: use a finite {bound} bound.
({name} is the decision variable’s name; {bound} is lower or upper; {value} is NaN, +inf, or -inf)
Cause
A decision variable was declared with a numeric constant bound that cannot define a feasible interval:
NaNas either bound+infas the lower bound-infas the upper bound
+inf as an upper bound and -inf as a lower bound are allowed: they mean the variable is unbounded on that side.
This check applies to constant numbers given at declaration time. Bounds that are placeholders or other expressions are checked later, when the model is evaluated with instance data; see E-CE0204.
Fix
Replace the quoted bound with a finite number. To leave a side unbounded, use -inf as the lower bound or +inf as the upper bound:
import jijmodeling as jm
problem = jm.Problem("example")
# Raises E-MD0009: `+inf` is not a valid lower bound
# x = problem.ContinuousVar("x", lower_bound=float("inf"), upper_bound=10.0)
# Raises E-MD0009: `NaN` is never a valid bound
# y = problem.ContinuousVar("y", lower_bound=0.0, upper_bound=float("nan"))
x = problem.ContinuousVar("x", lower_bound=0.0, upper_bound=float("inf"))
y = problem.ContinuousVar("y", lower_bound=float("-inf"), upper_bound=10.0)