JijModeling 2.3.2 Release Notes#

Bugfixes#

Major performance improvement in constraint detection#

Constraint detection has been significantly accelerated. Models that previously did not finish even after an hour can now complete within one second. If you disabled constraint detection by setting constraint_detection=False in jijmodeling.Problem.eval() or jijmodeling.Compiler.eval_problem() for performance reasons, try running them again with constraint detection enabled by omitting the constraint_detection option.

NamedExpr can now be specified directly as a shape#

In previous versions, defining a one-dimensional array whose length was a NamedExpr by specifying it directly as the shape, as shown below, resulted in an error:

import jijmodeling as jm

problem = jm.Problem("Test Problem")
w = problem.Float("w", ndim=1)
N = problem.NamedExpr("N", w.len_at(0))
v = problem.Float("v", shape=N)  # Errors!
Invalid comprehension syntax detected! Perhaps you used comprehension syntax outside decorator API, or used Python's builtin `sum` function etc., instead of `jijmodeling.sum`?

Starting with this release, the following now works without issue:

import jijmodeling as jm

problem = jm.Problem("Test Problem")
w = problem.Float("w", ndim=1)
N = problem.NamedExpr("N", w.len_at(0))
v = problem.Float("v", shape=N)
x = problem.BinaryVar("x", shape=N)

problem
\[\begin{array}{rl} \text{Problem}\colon &\text{Test Problem}\\\displaystyle \min &\displaystyle 0\\&\\\text{where}&\\&\text{Decision Variables:}\\&\qquad \begin{alignedat}{2}x&\in \mathop{\mathrm{Array}}\left[N;\left\{0, 1\right\}\right]&\quad &1\text{-dim binary variable}\\\end{alignedat}\\&\\&\text{Placeholders:}\\&\qquad \begin{alignedat}{2}v&\in \mathop{\mathrm{Array}}\left[N;\mathbb{R}\right]&\quad &1\text{-dimensional array of placeholders with elements in }\mathbb{R}\\w&\in \mathop{\mathrm{Array}}\left[(-);\mathbb{R}\right]&\quad &1\text{-dimensional array of placeholders with elements in }\mathbb{R}\\\end{alignedat}\\&\\&\text{Named Expressions:}\\&\qquad \begin{alignedat}{2}N&=\mathop{\mathtt{len\_{}at}}\left(w,0\right)&\quad &\in \mathbb{N}\\\end{alignedat}\end{array} \]

Other Changes#

  • Added a type hint for the -= operator of DecoratedProblem.