jijmodeling 1.12.0__cp39-cp39-manylinux_2_28_aarch64.whl → 1.12.1__cp39-cp39-manylinux_2_28_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of jijmodeling might be problematic. Click here for more details.

@@ -0,0 +1,54 @@
1
+ Metadata-Version: 2.4
2
+ Name: jijmodeling
3
+ Version: 1.12.1
4
+ Classifier: Development Status :: 5 - Production/Stable
5
+ Classifier: Operating System :: POSIX :: Linux
6
+ Classifier: Operating System :: MacOS
7
+ Classifier: Operating System :: Microsoft :: Windows
8
+ Classifier: Programming Language :: Rust
9
+ Classifier: Programming Language :: Python
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: Implementation :: CPython
17
+ Classifier: License :: Other/Proprietary License
18
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
19
+ Requires-Dist: numpy
20
+ Requires-Dist: pandas
21
+ Requires-Dist: orjson>=3.8.0,<4.0.0
22
+ Requires-Dist: ommx>=1.8.1,<2.0.0
23
+ Requires-Dist: pyright ; extra == 'test'
24
+ Requires-Dist: pytest ; extra == 'test'
25
+ Requires-Dist: hypothesis ; extra == 'test'
26
+ Requires-Dist: twine ; extra == 'test'
27
+ Requires-Dist: pkginfo>=1.10.0 ; extra == 'test'
28
+ Requires-Dist: pytest-snapshot>=0.9.0 ; extra == 'test'
29
+ Provides-Extra: test
30
+ License-File: LICENSE.txt
31
+ Summary: Mathematical modeling tool for optimization problem
32
+ Author: Jij Inc.
33
+ Author-email: info@j-ij.com
34
+ Requires-Python: >=3.9, <3.13
35
+ Description-Content-Type: text/markdown
36
+ Project-URL: Homepage, https://www.jijzept.com
37
+
38
+ # JijModeling
39
+
40
+ [![PyPI version shields.io](https://img.shields.io/pypi/v/jijmodeling.svg)](https://pypi.python.org/pypi/jijmodeling/)
41
+ [![PyPI pyversions](https://img.shields.io/pypi/pyversions/jijmodeling.svg)](https://pypi.python.org/pypi/jijmodeling/)
42
+ [![PyPI implementation](https://img.shields.io/pypi/implementation/jijmodeling.svg)](https://pypi.python.org/pypi/jijmodeling/)
43
+ [![PyPI format](https://img.shields.io/pypi/format/jijmodeling.svg)](https://pypi.python.org/pypi/jijmodeling/)
44
+ [![PyPI license](https://img.shields.io/pypi/l/jijmodeling.svg)](https://pypi.python.org/pypi/jijmodeling/)
45
+ [![PyPI download month](https://img.shields.io/pypi/dm/jijmodeling.svg)](https://pypi.python.org/pypi/jijmodeling/)
46
+
47
+ ## Documentation / ドキュメント
48
+
49
+ For detailed documentation and tutorials, please visit:
50
+ 詳細なドキュメントとチュートリアルは以下をご覧ください:
51
+
52
+ - English documentation: [https://jij-inc.github.io/JijModeling-Tutorials/en/introduction.html](https://jij-inc.github.io/JijModeling-Tutorials/en/introduction.html)
53
+ - 日本語ドキュメント: [https://jij-inc.github.io/JijModeling-Tutorials/ja/introduction.html](https://jij-inc.github.io/JijModeling-Tutorials/ja/introduction.html)
54
+
@@ -1,18 +1,18 @@
1
- jijmodeling-1.12.0.dist-info/METADATA,sha256=hw4muXuIQCABWoyvEhjohNR_tY_WjYCR9xFMNwe0YqE,12944
2
- jijmodeling-1.12.0.dist-info/WHEEL,sha256=6_gQVBYN7UgQgJG99CoTxaOuDh9wZg6Pg2-jj941nic,107
3
- jijmodeling-1.12.0.dist-info/licenses/LICENSE.txt,sha256=T5HdEbP5NWG8fZbvF9pofeteW3HrS30V3_LvtPUHFYM,3400
4
- jijmodeling/range/size.pyi,sha256=qV7OxCU_sHBVrH7Vyf1tOpClQphMlPD3ZzBDLVacRWI,2830
5
- jijmodeling/range/__init__.py,sha256=4HqNNHBnK4H3EDl7nV7crz9EIEr85Uc3APnI6xvz4OQ,529
6
- jijmodeling/range/size.py,sha256=gBwFfLuO4GprRfjVWyCplEvFJri8cxPRtuEd5uXzo7Q,528
7
- jijmodeling/range/__init__.pyi,sha256=VM36FPMICfAW54EAZKIrYFbams01fcCuaSn58MR54Qc,3911
8
- jijmodeling/range/value.pyi,sha256=rm6hAOACwTUYPNlYOLAmqMKoT7c2XQUMH6HyzvhbVjc,2870
9
- jijmodeling/range/value.py,sha256=aRwQGzpH5MZgpgKvd8gxMkMRyloq0S5zv87Kv3PHSd4,532
10
- jijmodeling/__init__.py,sha256=43DV_WzDxS0n6FseNyfJZ6oQucO31T4qqbz3bx9JMtE,44
1
+ jijmodeling-1.12.1.dist-info/METADATA,sha256=lUsoJbiQ_qCPdTAxsDh0hK1dI-GEZ9kMPM7UrrROHzY,2717
2
+ jijmodeling-1.12.1.dist-info/WHEEL,sha256=6_gQVBYN7UgQgJG99CoTxaOuDh9wZg6Pg2-jj941nic,107
3
+ jijmodeling-1.12.1.dist-info/licenses/LICENSE.txt,sha256=T5HdEbP5NWG8fZbvF9pofeteW3HrS30V3_LvtPUHFYM,3400
11
4
  jijmodeling/experimental.py,sha256=Of-tUY3kfpFHpjGbIcclbMenCP2BMW07me895YH7tG8,575
12
5
  jijmodeling/experimental.pyi,sha256=lBo4LxYFm-C4m2oC6XVYkBON6EVbbZjWl2NmMziPhbw,11275
13
- jijmodeling/dataset.pyi,sha256=3kKSch5XR16pEZA0c_Xr_J9Ai_IAv3aTqExR7iCd-pk,4083
14
6
  jijmodeling/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
7
  jijmodeling/dataset.py,sha256=S4piVIiUGJMi8MlG3kFV-8JIkzvnktAS0IdkbJ655hw,185
8
+ jijmodeling/__init__.py,sha256=43DV_WzDxS0n6FseNyfJZ6oQucO31T4qqbz3bx9JMtE,44
9
+ jijmodeling/range/__init__.py,sha256=4HqNNHBnK4H3EDl7nV7crz9EIEr85Uc3APnI6xvz4OQ,529
10
+ jijmodeling/range/value.pyi,sha256=rm6hAOACwTUYPNlYOLAmqMKoT7c2XQUMH6HyzvhbVjc,2870
11
+ jijmodeling/range/size.pyi,sha256=qV7OxCU_sHBVrH7Vyf1tOpClQphMlPD3ZzBDLVacRWI,2830
12
+ jijmodeling/range/__init__.pyi,sha256=VM36FPMICfAW54EAZKIrYFbams01fcCuaSn58MR54Qc,3911
13
+ jijmodeling/range/size.py,sha256=gBwFfLuO4GprRfjVWyCplEvFJri8cxPRtuEd5uXzo7Q,528
14
+ jijmodeling/range/value.py,sha256=aRwQGzpH5MZgpgKvd8gxMkMRyloq0S5zv87Kv3PHSd4,532
16
15
  jijmodeling/__init__.pyi,sha256=IAPx1c3sQiRa2EAgqO34ka75lL1JwRxtolTdPDlVzow,154984
17
- jijmodeling/_jijmodeling.cpython-39-aarch64-linux-gnu.so,sha256=bkrhk3w1V_ygY1cg8ee5OpTjPWSVb93AZpevV_lE6O8,10668568
18
- jijmodeling-1.12.0.dist-info/RECORD,,
16
+ jijmodeling/dataset.pyi,sha256=3kKSch5XR16pEZA0c_Xr_J9Ai_IAv3aTqExR7iCd-pk,4083
17
+ jijmodeling/_jijmodeling.cpython-39-aarch64-linux-gnu.so,sha256=REJVbTxdwu87uIwwWCKcteav9dwIGyNzVyTwtywapuY,7813128
18
+ jijmodeling-1.12.1.dist-info/RECORD,,
@@ -1,235 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: jijmodeling
3
- Version: 1.12.0
4
- Classifier: Development Status :: 5 - Production/Stable
5
- Classifier: Operating System :: POSIX :: Linux
6
- Classifier: Operating System :: MacOS
7
- Classifier: Operating System :: Microsoft :: Windows
8
- Classifier: Programming Language :: Rust
9
- Classifier: Programming Language :: Python
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3 :: Only
12
- Classifier: Programming Language :: Python :: 3.9
13
- Classifier: Programming Language :: Python :: 3.10
14
- Classifier: Programming Language :: Python :: 3.11
15
- Classifier: Programming Language :: Python :: 3.12
16
- Classifier: Programming Language :: Python :: Implementation :: CPython
17
- Classifier: License :: Other/Proprietary License
18
- Classifier: Topic :: Scientific/Engineering :: Mathematics
19
- Requires-Dist: numpy
20
- Requires-Dist: pandas
21
- Requires-Dist: orjson>=3.8.0,<4.0.0
22
- Requires-Dist: ommx>=1.8.1,<2.0.0
23
- Requires-Dist: pyright ; extra == 'test'
24
- Requires-Dist: pytest ; extra == 'test'
25
- Requires-Dist: hypothesis ; extra == 'test'
26
- Requires-Dist: twine ; extra == 'test'
27
- Requires-Dist: pkginfo>=1.10.0 ; extra == 'test'
28
- Provides-Extra: test
29
- License-File: LICENSE.txt
30
- Summary: Mathematical modeling tool for optimization problem
31
- Author: Jij Inc.
32
- Author-email: info@j-ij.com
33
- Requires-Python: >=3.9, <3.13
34
- Description-Content-Type: text/markdown
35
- Project-URL: Homepage, https://www.jijzept.com
36
-
37
- # JijModeling
38
-
39
- [![PyPI version shields.io](https://img.shields.io/pypi/v/jijmodeling.svg)](https://pypi.python.org/pypi/jijmodeling/)
40
- [![PyPI pyversions](https://img.shields.io/pypi/pyversions/jijmodeling.svg)](https://pypi.python.org/pypi/jijmodeling/)
41
- [![PyPI implementation](https://img.shields.io/pypi/implementation/jijmodeling.svg)](https://pypi.python.org/pypi/jijmodeling/)
42
- [![PyPI format](https://img.shields.io/pypi/format/jijmodeling.svg)](https://pypi.python.org/pypi/jijmodeling/)
43
- [![PyPI license](https://img.shields.io/pypi/l/jijmodeling.svg)](https://pypi.python.org/pypi/jijmodeling/)
44
- [![PyPI download month](https://img.shields.io/pypi/dm/jijmodeling.svg)](https://pypi.python.org/pypi/jijmodeling/)
45
-
46
- JijModeling is a Python package designed to intuitively write mathematical optimization models. Its main features are:
47
-
48
- - Allows writing models without specific instance data, leading to quicker verification of the model and easy reuse. Instance size does not affect the performance of writing and manipulating the model.
49
- - Works as a common interface for different kinds of optimization problems, including Linear Programming, Mixed Integer Programming, or Non-Linear Programming, and so on.
50
- - Models can be manipulated programmatically, allowing building up a model piece-by-piece and more complex logic in constraint construction.
51
- - Supports outputting to LaTeX. Mixed with Jupyter notebooks, this allows quick interactive feedback to check that your model fits what you expect.
52
-
53
- JijModeling is a tool for *writing* models using Python code, it does not evaluate or solve the models. The main motivation is to focus on the algebraic structure of the models, so that they can be reasoned about, verified and more nimbly altered regardless of the instance data, while still serving as a step towards generating the input formats the solvers expect.
54
-
55
- To be used with solvers, it needs to be paired with the actual instance data and converted into the specific solver’s input format by another tool, such as our internal [JijZept services](https://www.jijzept.com), or with the freely available [jijmodeling-transpiler](https://www.documentation.jijzept.com/docs/jijmodelingtranspiler).
56
-
57
- ## Installation
58
-
59
- If you use `pip`, you can install JijModeling with:
60
-
61
- ```bash markdown-code-runner
62
- pip install jijmodeling
63
- ```
64
-
65
- Note that JijModeling requires Python 3.9 or higher.
66
-
67
-
68
- ## Quickstart example
69
-
70
- To get a better idea of how to use jijmodeling, we’ll go over a basic example, starting with writing a simple model, converting it, then executing it with a solver. For the first two sections, jijmodeling is all you need, but we recommend using a [Jupyter notebook](https://jupyter.org) to easily check LaTeX output.
71
-
72
- For the third section, we will be using [JijModelingTranspiler](https://www.documentation.jijzept.com/docs/jijmodelingtranspiler) and [OpenJij](https://openjij.github.io/OpenJij/index.html). Note that jijmodeling models are also usable with our paid JijZept services. JijMdelingTranspiler and OpenJij can be installed as usual through `pip`:
73
-
74
- ```bash markdown-code-runner
75
- pip install jijmodeling-transpiler openjij
76
- ```
77
-
78
- ### Overview
79
-
80
- Working with JijModeling should feel natural to anyone familiar with mathematical optimization models.
81
-
82
- We represent various mathematical expressions by combining various classes, like `BinaryVar` and `Placeholder` using basic mathematical operations. `___Var` classes refer to different kinds of decision variables. `Placeholder` represents just about any kind of constant or value to be specified later. That is, they’re something we want to abstract away from the model and mark as part of instance-specific data. You can also use number literals, of course.
83
-
84
- ```python markdown-code-runner
85
- import jijmodeling as jm
86
-
87
- x = jm.BinaryVar("x")
88
- y = jm.IntegerVar("y", lower_bound=1, upper_bound=10)
89
- n = jm.Placeholder("n")
90
- exp = x * (y ** 2) * n
91
- ```
92
-
93
- The placeholder and variables above are zero-dimensional (scalars), but we can also represent arrays/multi-dimensional variables and constants using these classes, as we’ll see later on.
94
-
95
- In JijModeling, we build up a model by adding expressions like this to a `Problem` object, representing our model as a whole. Constraints are defined by the `Constraint` class wrapping around some comparison expression. (Note that only `<=`, `==`, and `>=` are supported in `Constraint`s).
96
-
97
- ```python markdown-code-runner
98
- a = jm.IntegerVar("a", lower_bound=5, upper_bound=20)
99
- b = jm.IntegerVar("b", lower_bound=1, upper_bound=20)
100
- c = jm.IntegerVar("c", lower_bound=20, upper_bound=30)
101
- n = jm.Placeholder("n")
102
-
103
- problem = jm.Problem("my problem")
104
- problem += n * (a + b + c)
105
- problem += jm.Constraint("c1", 2 * (b + c) <= 75)
106
- problem += jm.Constraint("c2", a + b <= 40)
107
- problem
108
- ```
109
-
110
- The above should output a model like this: (in a Jupyter notebook you’ll also see a description of the decision variables, omitted here for brevity)
111
-
112
- $$
113
- \begin{array}{cccc}\text{Problem:} & \text{my problem} & & \\
114
- & & \min \quad \displaystyle n \cdot \left(a + b + c\right) & \\
115
- \text{{s.t.}} & & & \\
116
- & \text{c1} & \displaystyle 2 \cdot \left(b + c\right) \leq 75 & \\
117
- & \text{c2} & \displaystyle a + b \leq 40 \\
118
- \end{array}
119
- $$
120
-
121
- ### Writing a model
122
-
123
- Let’s see how we would model a generic [Knapsack problem](https://www.documentation.jijzept.com/docs/tutorial/knapsack).
124
-
125
- In this problem, we have $N$ valuable items. We want to take as many items as possible, but we can only carry so much with us, determined by a weight limit $W$. We’ll be representing the decision to take some item $i$ with the binary variable $x_{i}$. That item’s weight is $w_i$ and its value $v_i$.
126
-
127
- Let’s first define these values:
128
-
129
- ```python markdown-code-runner
130
- W = jm.Placeholder("W") # The maximum weight we can carry
131
- # The values and weights of each items can represented as
132
- # one-dimensional Placeholders.
133
- values = jm.Placeholder("v", ndim=1)
134
- weights = jm.Placeholder("w", ndim=1)
135
- # We can define N in relation to the size of our placeholders,
136
- # so it's calculated automatically based on the instance data.
137
- # The optional "latex" parameter lets us define how this is
138
- # displayed in the LaTeX output.
139
- N = values.len_at(0, latex="N")
140
-
141
- # we have N decision variables, which we represent with a
142
- # one-dimensional BinaryVar. We must specify that it has N elements.
143
- x = jm.BinaryVar("x", shape=(N,))
144
-
145
- # an index we'll use for summations
146
- i = jm.Element("i", (0,N))
147
- ```
148
-
149
- At the end we create an `Element`. These are used as indices. With `jijmodeling.sum`, this allows us to write summations in a style similar to Sigma notation. Here we define that this index goes from 0 (inclusive) to $N$ (non-inclusive). It can feel strange to write these ahead of time, but doing so allows us to reuse it and is more convenient overall.
150
-
151
- For this problem we want to maximize our total value, while making sure the total weight is within our limit. We can write that like this:
152
-
153
- ```python markdown-code-runner
154
- problem = jm.Problem("knapsack", sense = jm.ProblemSense.MAXIMIZE)
155
- problem += jm.sum(i, values[i] * x[i])
156
- problem += jm.Constraint("weight limit", jm.sum(i, weights[i] * x[i]) <= W)
157
- problem
158
- ```
159
- This gives us the model we’d expect:
160
-
161
- $$
162
- \begin{array}{cccc}\text{Problem:} & \text{knapsack} & & \\
163
- & & \max \quad \displaystyle \sum_{i = 0}^{N - 1} v_{i} \cdot x_{i} & \\
164
- \text{{s.t.}} & & & \\
165
- & \text{weight limit} & \displaystyle \sum_{i = 0}^{N - 1} w_{i} \cdot x_{i} \leq W & \\
166
- \text{{where}} & & & \\
167
- & x & 1\text{-dim binary variable}\\
168
- \end{array}
169
- $$
170
-
171
- As a reminder, JijModeling expressions can be stored in variables like regular python objects. When working with larger problems, complex expressions can be built up from smaller ones, which can be easier to understand and modify later. For a problem this small this is not that useful, but just to illustrate, the previous code snippet could be rewritten like this:
172
-
173
- ```python markdown-code-runner
174
- chosen_v = values[i] * x[i]
175
- chosen_w = weights[i] * x[i]
176
- sum_of_values = jm.sum(i, chosen_v)
177
- sum_of_weights = jm.sum(i, chosen_w)
178
- weight_below_limit = sum_of_weights <= W
179
-
180
- problem = jm.Problem("knapsack", sense = jm.ProblemSense.MAXIMIZE)
181
- problem += sum_of_values
182
- problem += jm.Constraint("weight limit", weight_below_limit)
183
- problem
184
- ```
185
-
186
- These two models are equivalent. How you write the model is a matter of preference and convenience.
187
-
188
- ### Using the model
189
-
190
- Now we have our model, though not much can be done with it by itself other than exporting it to LaTeX. We can pair it with instance data to generate the input for an optimization solver. To demonstrate, let’s see how we’d use it with the freely available [JijModelingTranspiler](https://www.documentation.jijzept.com/docs/jijmodelingtranspiler) to convert it, and [OpenJij](https://openjij.github.io/OpenJij/index.html) to solve the model. Note that our tooling provided with [JijZept](https://www.documentation.jijzept.com/docs/jijzept) also accepts JijModeling models as input.
191
-
192
- This is meant as a quick demonstration, not a full introduction to JijModelingTranspiler and OpenJij features. You can check their documentation for more information.
193
-
194
- With JijModelingTranspiler, we can pass along our instance data to create an intermediary representation that can be converted to different formats quickly, but in our case we'll just convert it to QUBO.
195
-
196
- ```python markdown-code-runner
197
- from jijmodeling_transpiler.core import compile_model
198
- from jijmodeling_transpiler.core.pubo import transpile_to_pubo
199
-
200
- data = {
201
- "W": 100,
202
- "v": [100, 90, 80, 70, 60, 50, 40, 30],
203
- "w": [1, 5, 10, 20, 30, 40, 50, 60, 70],
204
- }
205
-
206
- compiled = compile_model(problem, data)
207
- qubo, _ = transpile_to_pubo(compiled).get_qubo_dict()
208
- qubo
209
- ```
210
-
211
- We now have a QUBO dictionary, which is valid input for certain optimization solvers. Writing out this kind of dictionary by hand would be very prone to error, but thankfully we just had to write out the model in a human-friendly way which is easier to verify. We can now use this dictionary with `openjij` to actually solve the problem:
212
-
213
- ```python markdown-code-runner
214
- import openjij as oj
215
-
216
- sampler = oj.SASampler()
217
- response = sampler.sample_qubo(qubo, num_reads=1)
218
- response.first
219
- ```
220
-
221
- This is using openjij's simulated annealing sampler, with the `num_reads` parameter saying we want to just sample it once. We can increase that to sample the solver multiple times, and then the response object would allow us to explore the different results. But for a problem of this size, all samples will just reach the optimal solution anyway, so here we’ve done a single sample and are looking at just the “best” solution found. It’s an object that looks like:
222
-
223
- ```
224
- Sample(sample={0: 1, 1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 0, 7: 0}, energy=-5.501111111111113, num_occurrences=1)
225
- ```
226
-
227
- The sample dictionary gives us the value the solver figured out for each of the decision variables. There’s a lot more that can be done here with Transpiler and OpenJij to better process and visualize the results, or reuse the same model for different purposes, but for that you should check out their respective documentation pages.
228
-
229
- ## Next Steps
230
-
231
- - [JijModeling Tutorials](https://www.documentation.jijzept.com/docs/jijmodeling/tutorials/1introduction)
232
- - [JijModelingTranspiler](https://www.documentation.jijzept.com/docs/jijmodelingtranspiler/index)
233
- - [JijZept](https://www.documentation.jijzept.com/docs/jijzept/index)
234
- - [Examples with JijModeling and JijZept](https://www.documentation.jijzept.com/docs/tutorial/index)
235
-