JijModeling 1.10.1 Release Notes#
Fixed an issue where the interpreter would fail to evaluate summation and product expressions if they included conditional statements referencing another index variable within their indexing sets. In previous versions (<= 1.10.0), applying conditions to one index in a summation that depended on another index in the same summation scope would cause an InterpreterError
. This has now been resolved, allowing conditions within complex multi-index summations to be evaluated correctly.
import jijmodeling as jm
n = jm.Placeholder("n")
m = jm.Placeholder("m")
x = jm.BinaryVar("x", shape=(n, m))
i = jm.Element("i", belong_to=(0, n))
j = jm.Element("j", belong_to=(0, m))
problem = jm.Problem("problem")
# Previously, the following summation would fail because it includes a condition
# on j that depends on i, both defined within the same summation scope.
problem += jm.sum([i, (j, j != i)], x[i, j])
interpreter = jm.Interpreter({"n": 3, "m": 2})
try:
# Before 1.10.1, this would raise an InterpreterError.
# Now, it evaluates successfully.
interpreter.eval_problem(problem)
except jm.InterpreterError as e:
print("InterpreterError:", e)
InterpreterError: Unbound element 'j' is used