Skip to content

Commit 4b774e1

Browse files
authored
Release 1.10.0 (#13)
Added a release note for JijModeling 1.10.0.
1 parent 067bc6c commit 4b774e1

11 files changed

+382
-38
lines changed

docs/_toc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ parts:
2424
chapters:
2525
- file: releases/jijmodeling-1.8.0
2626
- file: releases/jijmodeling-1.9.0
27+
- file: releases/jijmodeling-1.10.0
19.1 KB
Loading
20.9 KB
Loading
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# JijModeling 1.10.0 Release Notes\n",
8+
"\n",
9+
"JijModeling 1.10.0 provides critical bug fixes and feature enhancements to improve the stability and functionality of the library.\n",
10+
"\n",
11+
"## Feature Enhancements\n",
12+
"\n",
13+
"### `Interpreter` 1-hot Constraint Detection\n",
14+
"\n",
15+
"The `Interpreter` now identifies 1-hot constraints during constraint evaluation in the following form:\n",
16+
"\n",
17+
"$$\n",
18+
"\\sum_{i=1}^{n} x_i = 1, \\quad x_i \\in \\{0, 1\\}\n",
19+
"$$\n",
20+
"\n",
21+
"This enhancement provides hints to improve solver performance for compatible solvers. Detected constraints can be accessed via the `constraint_hints` property in `ommx.v1.Instance`."
22+
]
23+
},
24+
{
25+
"cell_type": "code",
26+
"execution_count": null,
27+
"metadata": {},
28+
"outputs": [],
29+
"source": [
30+
"import jijmodeling as jm\n",
31+
"\n",
32+
"n = jm.Placeholder(\"n\")\n",
33+
"x = jm.BinaryVar(\"x\", shape=(n,))\n",
34+
"i = jm.Element(\"i\", belong_to=(0,n))\n",
35+
"\n",
36+
"problem = jm.Problem(\"problem\")\n",
37+
"# Add 1-hot constraint\n",
38+
"problem += jm.Constraint(\"onehot\", jm.sum(i, x[i]) == 1)\n",
39+
"\n",
40+
"interpreter = jm.Interpreter({\"n\": 3})\n",
41+
"instance = interpreter.eval_problem(problem)\n",
42+
"\n",
43+
"# Display detected constraint information\n",
44+
"print(instance.raw.constraint_hints)"
45+
]
46+
},
47+
{
48+
"cell_type": "markdown",
49+
"metadata": {},
50+
"source": [
51+
"Future updates will enable the detection of various constraints, including SOS1/SOS2 and n-hot constraints.\n",
52+
"\n",
53+
"### Further Improvements in Type Hints\n",
54+
"\n",
55+
"Type hinting across submodules has been significantly improved to resolve Pyright errors that previously occurred. This improvement leverages advancements in `pyo3-stub-gen` ([see](https://github.com/Jij-Inc/pyo3-stub-gen/releases/tag/0.6.1)) to ensure seamless type checking in submodules.\n",
56+
"\n",
57+
"Prior to this release, type errors were common in submodules:\n",
58+
"\n",
59+
"![image.png](./assets/jijmodeling-1.10.0_01.png)\n",
60+
"\n",
61+
"These issues are now resolved, ensuring a more robust developer experience:\n",
62+
"\n",
63+
"![image.png](./assets/jijmodeling-1.10.0_02.png)\n",
64+
"\n",
65+
"## Bug Fixes\n",
66+
"\n",
67+
"### Fixed `ndim` Calculation for Jagged Arrays\n",
68+
"\n",
69+
"This release resolves a logic error in calculating the ndim (number of dimensions) for jagged arrays. The bug caused errors during Interpreter initialization and prevented evaluation of instances loaded through the MIPLIB loader."
70+
]
71+
},
72+
{
73+
"cell_type": "code",
74+
"execution_count": null,
75+
"metadata": {},
76+
"outputs": [],
77+
"source": [
78+
"import jijmodeling as jm\n",
79+
"\n",
80+
"# Load MIPLIB instance \"air05\"\n",
81+
"dataset = jm.dataset.Miplib()\n",
82+
"problem, instance_data = dataset.load(\"air05\")\n",
83+
"\n",
84+
"try:\n",
85+
" # In jijmodeling <= 1.9.0, either of these two lines would raise an InterpreterError\n",
86+
" interpreter = jm.Interpreter(instance_data)\n",
87+
" interpreter.eval_problem(problem)\n",
88+
"except jm.InterpreterError as e:\n",
89+
" print(f\"InterpreterError: {e}\")"
90+
]
91+
},
92+
{
93+
"cell_type": "markdown",
94+
"metadata": {},
95+
"source": [
96+
"### Corrected Arithmetic Assignment Operator Behavior (`+=`) for Objective Functions\n",
97+
"\n",
98+
"A long-standing issue with the `+=` operator for objective functions has been fixed. Previously, adding to an existing objective would overwrite the original instead of appending to it."
99+
]
100+
},
101+
{
102+
"cell_type": "code",
103+
"execution_count": null,
104+
"metadata": {},
105+
"outputs": [],
106+
"source": [
107+
"import jijmodeling as jm\n",
108+
"\n",
109+
"x = jm.BinaryVar(\"x\")\n",
110+
"y = jm.BinaryVar(\"y\")\n",
111+
"\n",
112+
"problem = jm.Problem(\"problem\")\n",
113+
"# Add x to objective function\n",
114+
"problem += x\n",
115+
"# Add y to objective function\n",
116+
"problem += y\n",
117+
"\n",
118+
"# In jijmodeling <= 1.9.0, the objective function would be y instead of x + y\n",
119+
"assert jm.is_same(problem.objective, x + y)"
120+
]
121+
},
122+
{
123+
"cell_type": "markdown",
124+
"metadata": {},
125+
"source": [
126+
"## Changelog\n",
127+
"\n",
128+
"### Bug Fixes\n",
129+
"\n",
130+
"- Fixed incorrect `ndim` calculation for jagged arrays, ensuring seamless `Interpreter` initialization and MIPLIB loader evaluation.\n",
131+
"\n",
132+
"- Resolved behavior of the `+=` operator to properly append terms to existing objective functions.\n",
133+
"\n",
134+
"### Feature Enhancements\n",
135+
"\n",
136+
"- 1-Hot Constraint Detection:\n",
137+
" Supported constraints must adhere to the following form:\n",
138+
" $\n",
139+
" \\displaystyle \\sum_{i=1}^{n} x_i = 1, \\quad x_i \\in \\{0, 1\\}\n",
140+
" $\n",
141+
" \n",
142+
" - Left-hand side: exactly one summation symbol.\n",
143+
" - Summation operand: a single binary variable with an index.\n",
144+
" - Constraint type: equality.\n",
145+
" - Right-hand side: a NumberLit with value of 1.\n",
146+
"- Resolved Pyright errors in submodules by improving type hint support through `pyo3-stub-gen` enhancements."
147+
]
148+
}
149+
],
150+
"metadata": {
151+
"kernelspec": {
152+
"display_name": ".venv",
153+
"language": "python",
154+
"name": "python3"
155+
},
156+
"language_info": {
157+
"codemirror_mode": {
158+
"name": "ipython",
159+
"version": 3
160+
},
161+
"file_extension": ".py",
162+
"mimetype": "text/x-python",
163+
"name": "python",
164+
"nbconvert_exporter": "python",
165+
"pygments_lexer": "ipython3",
166+
"version": "3.10.12"
167+
}
168+
},
169+
"nbformat": 4,
170+
"nbformat_minor": 2
171+
}

en/_toc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ parts:
1818
chapters:
1919
- file: releases/jijmodeling-1.8.0
2020
- file: releases/jijmodeling-1.9.0
21+
- file: releases/jijmodeling-1.10.0
19.1 KB
Loading
20.9 KB
Loading

en/releases/jijmodeling-1.10.0.ipynb

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# JijModeling 1.10.0 Release Notes\n",
8+
"\n",
9+
"JijModeling 1.10.0 provides critical bug fixes and feature enhancements to improve the stability and functionality of the library.\n",
10+
"\n",
11+
"## Feature Enhancements\n",
12+
"\n",
13+
"### `Interpreter` 1-hot Constraint Detection\n",
14+
"\n",
15+
"The `Interpreter` now identifies 1-hot constraints during constraint evaluation in the following form:\n",
16+
"\n",
17+
"$$\n",
18+
"\\sum_{i=1}^{n} x_i = 1, \\quad x_i \\in \\{0, 1\\}\n",
19+
"$$\n",
20+
"\n",
21+
"This enhancement provides hints to improve solver performance for compatible solvers. Detected constraints can be accessed via the `constraint_hints` property in `ommx.v1.Instance`."
22+
]
23+
},
24+
{
25+
"cell_type": "code",
26+
"execution_count": null,
27+
"metadata": {},
28+
"outputs": [],
29+
"source": [
30+
"import jijmodeling as jm\n",
31+
"\n",
32+
"n = jm.Placeholder(\"n\")\n",
33+
"x = jm.BinaryVar(\"x\", shape=(n,))\n",
34+
"i = jm.Element(\"i\", belong_to=(0,n))\n",
35+
"\n",
36+
"problem = jm.Problem(\"problem\")\n",
37+
"# Add 1-hot constraint\n",
38+
"problem += jm.Constraint(\"onehot\", jm.sum(i, x[i]) == 1)\n",
39+
"\n",
40+
"interpreter = jm.Interpreter({\"n\": 3})\n",
41+
"instance = interpreter.eval_problem(problem)\n",
42+
"\n",
43+
"# Display detected constraint information\n",
44+
"print(instance.raw.constraint_hints)"
45+
]
46+
},
47+
{
48+
"cell_type": "markdown",
49+
"metadata": {},
50+
"source": [
51+
"Future updates will enable the detection of various constraints, including SOS1/SOS2 and n-hot constraints.\n",
52+
"\n",
53+
"### Further Improvements in Type Hints\n",
54+
"\n",
55+
"Type hinting across submodules has been significantly improved to resolve Pyright errors that previously occurred. This improvement leverages advancements in `pyo3-stub-gen` ([see](https://github.com/Jij-Inc/pyo3-stub-gen/releases/tag/0.6.1)) to ensure seamless type checking in submodules.\n",
56+
"\n",
57+
"Prior to this release, type errors were common in submodules:\n",
58+
"\n",
59+
"![image.png](./assets/jijmodeling-1.10.0_01.png)\n",
60+
"\n",
61+
"These issues are now resolved, ensuring a more robust developer experience:\n",
62+
"\n",
63+
"![image.png](./assets/jijmodeling-1.10.0_02.png)\n",
64+
"\n",
65+
"## Bug Fixes\n",
66+
"\n",
67+
"### Fixed `ndim` Calculation for Jagged Arrays\n",
68+
"\n",
69+
"This release resolves a logic error in calculating the ndim (number of dimensions) for jagged arrays. The bug caused errors during Interpreter initialization and prevented evaluation of instances loaded through the MIPLIB loader."
70+
]
71+
},
72+
{
73+
"cell_type": "code",
74+
"execution_count": null,
75+
"metadata": {},
76+
"outputs": [],
77+
"source": [
78+
"import jijmodeling as jm\n",
79+
"\n",
80+
"# Load MIPLIB instance \"air05\"\n",
81+
"dataset = jm.dataset.Miplib()\n",
82+
"problem, instance_data = dataset.load(\"air05\")\n",
83+
"\n",
84+
"try:\n",
85+
" # In jijmodeling <= 1.9.0, either of these two lines would raise an InterpreterError\n",
86+
" interpreter = jm.Interpreter(instance_data)\n",
87+
" interpreter.eval_problem(problem)\n",
88+
"except jm.InterpreterError as e:\n",
89+
" print(f\"InterpreterError: {e}\")"
90+
]
91+
},
92+
{
93+
"cell_type": "markdown",
94+
"metadata": {},
95+
"source": [
96+
"### Corrected Arithmetic Assignment Operator Behavior (`+=`) for Objective Functions\n",
97+
"\n",
98+
"A long-standing issue with the `+=` operator for objective functions has been fixed. Previously, adding to an existing objective would overwrite the original instead of appending to it."
99+
]
100+
},
101+
{
102+
"cell_type": "code",
103+
"execution_count": null,
104+
"metadata": {},
105+
"outputs": [],
106+
"source": [
107+
"import jijmodeling as jm\n",
108+
"\n",
109+
"x = jm.BinaryVar(\"x\")\n",
110+
"y = jm.BinaryVar(\"y\")\n",
111+
"\n",
112+
"problem = jm.Problem(\"problem\")\n",
113+
"# Add x to objective function\n",
114+
"problem += x\n",
115+
"# Add y to objective function\n",
116+
"problem += y\n",
117+
"\n",
118+
"# In jijmodeling <= 1.9.0, the objective function would be y instead of x + y\n",
119+
"assert jm.is_same(problem.objective, x + y)"
120+
]
121+
},
122+
{
123+
"cell_type": "markdown",
124+
"metadata": {},
125+
"source": [
126+
"## Changelog\n",
127+
"\n",
128+
"### Bug Fixes\n",
129+
"\n",
130+
"- Fixed incorrect `ndim` calculation for jagged arrays, ensuring seamless `Interpreter` initialization and MIPLIB loader evaluation.\n",
131+
"\n",
132+
"- Resolved behavior of the `+=` operator to properly append terms to existing objective functions.\n",
133+
"\n",
134+
"### Feature Enhancements\n",
135+
"\n",
136+
"- 1-Hot Constraint Detection:\n",
137+
" Supported constraints must adhere to the following form:\n",
138+
" $\n",
139+
" \\displaystyle \\sum_{i=1}^{n} x_i = 1, \\quad x_i \\in \\{0, 1\\}\n",
140+
" $\n",
141+
" \n",
142+
" - Left-hand side: exactly one summation symbol.\n",
143+
" - Summation operand: a single binary variable with an index.\n",
144+
" - Constraint type: equality.\n",
145+
" - Right-hand side: a NumberLit with value of 1.\n",
146+
"- Resolved Pyright errors in submodules by improving type hint support through `pyo3-stub-gen` enhancements."
147+
]
148+
}
149+
],
150+
"metadata": {
151+
"kernelspec": {
152+
"display_name": ".venv",
153+
"language": "python",
154+
"name": "python3"
155+
},
156+
"language_info": {
157+
"codemirror_mode": {
158+
"name": "ipython",
159+
"version": 3
160+
},
161+
"file_extension": ".py",
162+
"mimetype": "text/x-python",
163+
"name": "python",
164+
"nbconvert_exporter": "python",
165+
"pygments_lexer": "ipython3",
166+
"version": "3.10.12"
167+
}
168+
},
169+
"nbformat": 4,
170+
"nbformat_minor": 2
171+
}

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[project]
22
name = "jijmodeling-tutorial"
3-
version = "1.9.0"
3+
version = "1.10.0"
44
description = "Tutorial for JijModeling"
55
readme = "README.md"
66
requires-python = ">=3.9, <3.12" # jijmodeling does not support Python 3.12 yet
77
dependencies = [
8-
"jijmodeling >= 1.9.0, < 1.10.0",
8+
"jijmodeling >= 1.10.0, < 1.11.0",
99
"jijmodeling-transpiler>=0.6.15",
1010
"ommx >= 1.4.1, < 2.0.0",
1111
"ommx-pyscipopt-adapter >= 1.4.2, < 2.0.0",

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ iniconfig==2.0.0
2929
# via pytest
3030
jij-cimod==1.6.2
3131
# via openjij
32-
jijmodeling==1.9.0
32+
jijmodeling==1.10.0
3333
# via
3434
# jijmodeling-tutorial (pyproject.toml)
3535
# jijmodeling-transpiler
@@ -52,7 +52,7 @@ numpy==1.26.4
5252
# pyarrow
5353
# pyqubo
5454
# scipy
55-
ommx==1.4.2
55+
ommx==1.5.1
5656
# via
5757
# jijmodeling-tutorial (pyproject.toml)
5858
# jijmodeling

0 commit comments

Comments
 (0)