jijmodeling 2.0.0a6__cp38-abi3-manylinux_2_28_aarch64.whl → 2.0.0a8__cp38-abi3-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.
- jijmodeling/__init__.pyi +311 -204
- jijmodeling/_jijmodeling.abi3.so +0 -0
- {jijmodeling-2.0.0a6.dist-info → jijmodeling-2.0.0a8.dist-info}/METADATA +1 -1
- jijmodeling-2.0.0a8.dist-info/RECORD +9 -0
- {jijmodeling-2.0.0a6.dist-info → jijmodeling-2.0.0a8.dist-info}/WHEEL +1 -1
- {jijmodeling-2.0.0a6.dist-info → jijmodeling-2.0.0a8.dist-info}/licenses/LICENSE.txt +3 -2
- jijmodeling-2.0.0a6.dist-info/RECORD +0 -9
jijmodeling/__init__.pyi
CHANGED
|
@@ -24,32 +24,39 @@ class Compiler:
|
|
|
24
24
|
def from_problem(problem:Problem, instance_data:typing.Mapping[builtins.str, builtins.int | builtins.float | numpy.typing.NDArray[numpy.float64] | numpy.typing.NDArray[numpy.int64] | list]) -> Compiler: ...
|
|
25
25
|
|
|
26
26
|
class Constraint:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
27
|
+
@property
|
|
28
|
+
def name(self) -> builtins.str: ...
|
|
29
|
+
@property
|
|
30
|
+
def sense(self) -> ConstraintSense: ...
|
|
31
|
+
@property
|
|
32
|
+
def left(self) -> Expression: ...
|
|
33
|
+
@property
|
|
34
|
+
def right(self) -> Expression: ...
|
|
35
|
+
@property
|
|
36
|
+
def expression(self) -> Expression: ...
|
|
37
|
+
@property
|
|
38
|
+
def is_equality(self) -> builtins.bool:
|
|
39
|
+
r"""
|
|
40
|
+
Returns true if the constraint is an equality constraint.
|
|
41
|
+
|
|
42
|
+
Returns
|
|
43
|
+
--------
|
|
44
|
+
`bool`: True if the constraint is an equality constraint. Otherwise, False.
|
|
45
|
+
|
|
46
|
+
Examples
|
|
47
|
+
---------
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
>>> import jijmodeling as jm
|
|
51
|
+
>>> N = jm.Placeholder("N")
|
|
52
|
+
>>> i = jm.Element("i", belong_to=N)
|
|
53
|
+
>>> x = jm.BinaryVar("x", shape=(N,))
|
|
54
|
+
>>> constraint = jm.Constraint("constraint", jm.sum(i, x[i]) == 1)
|
|
55
|
+
>>> assert constraint.is_equality()
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
"""
|
|
59
|
+
@property
|
|
53
60
|
def is_inequality(self) -> builtins.bool:
|
|
54
61
|
r"""
|
|
55
62
|
Returns true if the constraint is an inequality constraint.
|
|
@@ -149,13 +156,20 @@ class DecisionVar:
|
|
|
149
156
|
|
|
150
157
|
```
|
|
151
158
|
"""
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
+
@property
|
|
160
|
+
def name(self) -> builtins.str: ...
|
|
161
|
+
@property
|
|
162
|
+
def kind(self) -> DecisionVarKind: ...
|
|
163
|
+
@property
|
|
164
|
+
def description(self) -> builtins.str: ...
|
|
165
|
+
@property
|
|
166
|
+
def ndim(self) -> builtins.int: ...
|
|
167
|
+
@property
|
|
168
|
+
def shape(self) -> tuple: ...
|
|
169
|
+
@property
|
|
170
|
+
def lower_bound(self) -> Expression | builtins.list[Expression]: ...
|
|
171
|
+
@property
|
|
172
|
+
def upper_bound(self) -> Expression | builtins.list[Expression]: ...
|
|
159
173
|
def __repr__(self) -> builtins.str: ...
|
|
160
174
|
def __pow__(self, exponent:typing.Any, modulo:typing.Optional[typing.Any]=None) -> Expression: ...
|
|
161
175
|
def __rpow__(self, base:typing.Any, modulo:typing.Optional[typing.Any]=None) -> Expression: ...
|
|
@@ -211,8 +225,182 @@ class DecoratedProblem(typing.Protocol):
|
|
|
211
225
|
r"""
|
|
212
226
|
A variant of `Problem` that is only available in Decorator API provided by `Problem.compile`.
|
|
213
227
|
"""
|
|
228
|
+
@typing.overload
|
|
229
|
+
def Constraint(self, name:builtins.str, expressions:typing.Generator[Expression], description:typing.Optional[builtins.str]=None) -> Constraint:
|
|
230
|
+
r"""
|
|
231
|
+
Constructs `Constraint` object with comprehension syntax, __WITHOUT__ registering it to the problem.
|
|
232
|
+
Use `+=` operator to register the constraint to the problem.
|
|
233
|
+
"""
|
|
234
|
+
@typing.overload
|
|
235
|
+
def Constraint(self, name:builtins.str, expression:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any], domain:typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any], description:typing.Optional[builtins.str]=None) -> Constraint:
|
|
236
|
+
r"""
|
|
237
|
+
Constructs `Constraint` object from index set and function to build comparison expression from each index, __WITHOUT__ registering it to the problem.
|
|
238
|
+
Use `+=` operator to register the constraint to the problem.
|
|
239
|
+
"""
|
|
240
|
+
@typing.overload
|
|
241
|
+
def Constraint(self, name:builtins.str, expression:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any], description:typing.Optional[builtins.str]=None) -> Constraint:
|
|
242
|
+
r"""
|
|
243
|
+
Constructs `Constraint` object from comparison expression, __WITHOUT__ registering it to the problem.
|
|
244
|
+
Use `+=` operator to register the constraint to the problem.
|
|
245
|
+
"""
|
|
214
246
|
def __iadd__(self, other:typing.Any) -> DecoratedProblem: ...
|
|
215
|
-
def
|
|
247
|
+
def used_placeholders(self) -> builtins.list[Placeholder]: ...
|
|
248
|
+
def get_problem_schema(self) -> dict:
|
|
249
|
+
r"""
|
|
250
|
+
Returns the schema of the problem.
|
|
251
|
+
|
|
252
|
+
Returns
|
|
253
|
+
--------
|
|
254
|
+
- `schema`: The dictionary containing the schema of the problem.
|
|
255
|
+
"""
|
|
256
|
+
def generate_random_dataset(self, _default:typing.Any, _options:typing.Any, _seed:typing.Optional[builtins.int]) -> typing.Any:
|
|
257
|
+
r"""
|
|
258
|
+
Generates a dictionary of random `InstanceDataValue` for a given problem.
|
|
259
|
+
To generate `ommx.v1.Instance` object directly, use `InstanceDataValue.generate_random_instance` instead.
|
|
260
|
+
|
|
261
|
+
Args
|
|
262
|
+
-----
|
|
263
|
+
- `options` (optional): a dictionary of range parameters for each separate placeholders. The key must be the name of the placeholder and the value must be range parameter (as described in "Range Parameters and Range Syntax" below).
|
|
264
|
+
- `default` (optional): default range parameters for placeholders which is not specified in `options`.
|
|
265
|
+
- `seed` (optional): seed for random number generation.
|
|
266
|
+
|
|
267
|
+
Returns
|
|
268
|
+
--------
|
|
269
|
+
`dict`: The dictionary from the name of placeholders to the generated `InstanceDataValue` objects. To be fed to `Interpreter.eval_problem`.
|
|
270
|
+
|
|
271
|
+
Range Parameters and Range Syntax
|
|
272
|
+
----------------------------------
|
|
273
|
+
A range parameter is a dictionary consisting of the following fields:
|
|
274
|
+
- `size` (optional): interval of natural numbers for the size of each array dimension (default: `range(1, 6)`)
|
|
275
|
+
- `value` (optional): interval of real numbers for the value of each array element (default: `range(-1.0, 1.0)` - a uniform distribution on a closed interval $[-1.0, 1.0]$).
|
|
276
|
+
|
|
277
|
+
Example range parameter config:
|
|
278
|
+
|
|
279
|
+
```python
|
|
280
|
+
{"size": range(2, 10), "value": jm.range.value.closed(100.0, 200.0)}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
Intervals are expressed as a range object.
|
|
284
|
+
Currently, the following syntax is supported for range objects:
|
|
285
|
+
|
|
286
|
+
1. Direct value of type `int` or `float` - it corresponds to a singleton interval $[a, a] = \{a\}$. In random generation context, this just means a constant fixed value.
|
|
287
|
+
2. Use the functions from `jijmodeling.range`, `jijmodeling.range.size`, or `jijmodeling.range.value` modules.
|
|
288
|
+
- Use functions from `jij.modeling.range.size` to specify (non-negative) integer intervals, and `jij.modeling.range.value` for real intervals. `jij.modeling.range` dynamically determines the type of the range based on the input.
|
|
289
|
+
- These three modules provides the following combinators (see the module documents for more details.):
|
|
290
|
+
- `closed(a, b)`: a closed interval $[a, b]$
|
|
291
|
+
- `open(a, b)`: an open interval $(a, b)$
|
|
292
|
+
- `closed_open(a, b)`: an upper half-open interval $[a, b)$
|
|
293
|
+
- `open_closed(a, b)`: a lower half-open interval $(a, b]$
|
|
294
|
+
- `greater_than(a)`: an open interval $(a, \infty)$
|
|
295
|
+
- `at_least(a)`: a closed interval $[a, \infty)$
|
|
296
|
+
- `less_than(a)`: an open interval $(-\infty, a)$
|
|
297
|
+
- `at_most(a)`: a closed interval $(-\infty, a]$
|
|
298
|
+
3. Use `range` builtin function: this is equivalent to `jijmodeling.range.value.closed_open(a, b)`.
|
|
299
|
+
- Any python range object with `step = 1` can be used as a size range; otherwise it results in runtime error.
|
|
300
|
+
4. Use a tuple: raw tuple `(a, b)` is equivalent to `jijmodeling.range.closed_open(a, b)` if `a` and `b` are either `int` or `float`.
|
|
301
|
+
- You can also use bound object as a tuple component; in such case, both tuple components must be one of the following:
|
|
302
|
+
|
|
303
|
+
1. A string `"Unbounded"` means $-\infty$ (in the first component) or $\infty$ (the second).
|
|
304
|
+
2. A dictionary `{"Included": a}` means the endpoint is inclusive.
|
|
305
|
+
3. A dictionary `{"Excluded": a}` means the endpoint is exclusive.
|
|
306
|
+
- Examples:
|
|
307
|
+
- `(1.2, 4)` is equivalent to `closed_open(1.2, 4)`,
|
|
308
|
+
- `(-1, {"Included": 1})` is equivalent to `closed(-1, 1)`,
|
|
309
|
+
- `(-5, {"Excluded": 4})` is equivalent to `closed_open(-5, 4)` and built in function `range(-5, 4)`,
|
|
310
|
+
- `({"Excluded": 1}, {"Excluded": 2.5})` is equivalent to `open(1, 2.5)`,
|
|
311
|
+
- `({"Included": -1}, "Unbounded")` is equivalent to `at_least(-1)`.
|
|
312
|
+
- `(5, "Unbounded")` is **INVALID**; `5` must be bound object.
|
|
313
|
+
5. The range object: A dictionary of form `{"start": lb, "end": ub}`, where both `lb` and `ub` are the bound object described as above.
|
|
314
|
+
|
|
315
|
+
Examples
|
|
316
|
+
---------
|
|
317
|
+
```python
|
|
318
|
+
>>> import jijmodeling as jm
|
|
319
|
+
>>> import builtins
|
|
320
|
+
>>> N = jm.Placeholder("N", dtype=jm.DataType.INTEGER)
|
|
321
|
+
>>> c = jm.Placeholder("c", dtype=jm.DataType.FLOAT, shape=(N,))
|
|
322
|
+
>>> x = jm.BinaryVar("x", shape=(N,))
|
|
323
|
+
>>> i = jm.Element("i", belong_to=N)
|
|
324
|
+
|
|
325
|
+
>>> problem = jm.Problem("problem")
|
|
326
|
+
>>> problem += jm.sum(i, c[i] * x[i])
|
|
327
|
+
|
|
328
|
+
>>> inputs = problem.generate_random_dataset(
|
|
329
|
+
... options={
|
|
330
|
+
... 'N': {"value": builtins.range(10, 20)},
|
|
331
|
+
... 'c': {"value": jm.range.value.closed(-1.0, 1.0)}
|
|
332
|
+
... # You can also specify "size" for the range of jagged array dimension size.
|
|
333
|
+
... },
|
|
334
|
+
... seed=123 # omittable
|
|
335
|
+
... )
|
|
336
|
+
>>> assert set(inputs.keys()) == {"N", "c"}
|
|
337
|
+
>>> inputs
|
|
338
|
+
{'N': 11.0, 'c': array([ 0.93914459, -0.06511935, -0.7460324 , -0.32443706, 0.99981451,
|
|
339
|
+
-0.24407535, 0.31329469, 0.52206453, -0.1291936 , 0.30443087,
|
|
340
|
+
0.53125838])}
|
|
341
|
+
|
|
342
|
+
```
|
|
343
|
+
"""
|
|
344
|
+
def generate_random_instance(self, _default:typing.Any, _options:typing.Any, _seed:typing.Optional[builtins.int], _hints:typing.Optional[typing.Any]) -> typing.Any:
|
|
345
|
+
r"""
|
|
346
|
+
Generates random `ommx.v1.Instance` for a given problem.
|
|
347
|
+
See also `InstanceDataValue.generate_random_dataset`.
|
|
348
|
+
|
|
349
|
+
Args
|
|
350
|
+
-----
|
|
351
|
+
- `options` (optional): a dictionary of range parameters for each separate placeholders. The key must be the name of the placeholder and the value must be range parameter (as described in "Range Parameters and Range Syntax" section in :func:`~jijmodeling.Problem.generate_random_dataset`).
|
|
352
|
+
- `default` (optional): default range parameters for placeholders which is not specified in `options`.
|
|
353
|
+
- `seed` (optional): seed for random number generation.
|
|
354
|
+
- `hints` (optional): the hints to be detected during compilation see `Interpreter.eval_problem` for more details.
|
|
355
|
+
|
|
356
|
+
Returns
|
|
357
|
+
--------
|
|
358
|
+
`instance`: The OMMX v1 instance object.
|
|
359
|
+
|
|
360
|
+
Examples
|
|
361
|
+
---------
|
|
362
|
+
```python
|
|
363
|
+
>>> import jijmodeling as jm
|
|
364
|
+
>>> import builtins
|
|
365
|
+
>>> import ommx.v1
|
|
366
|
+
>>> N = jm.Placeholder("N", dtype=jm.DataType.INTEGER)
|
|
367
|
+
>>> c = jm.Placeholder("c", dtype=jm.DataType.FLOAT, shape=(N,))
|
|
368
|
+
>>> x = jm.BinaryVar("x", shape=(N,))
|
|
369
|
+
>>> i = jm.Element("i", belong_to=N)
|
|
370
|
+
|
|
371
|
+
>>> problem = jm.Problem("problem")
|
|
372
|
+
>>> problem += jm.sum(i, c[i] * x[i])
|
|
373
|
+
|
|
374
|
+
>>> instance = problem.generate_random_instance(
|
|
375
|
+
... options={
|
|
376
|
+
... 'N': {"value": builtins.range(10, 20)},
|
|
377
|
+
... 'c': {"value": jm.range.value.closed(-1.0, 1.0)}
|
|
378
|
+
... },
|
|
379
|
+
... seed=123
|
|
380
|
+
... )
|
|
381
|
+
>>> assert type(instance) is ommx.v1.Instance
|
|
382
|
+
|
|
383
|
+
```
|
|
384
|
+
"""
|
|
385
|
+
def type_of(self, name:builtins.str) -> Type: ...
|
|
386
|
+
def infer(self, expr:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]) -> Type: ...
|
|
387
|
+
def decision_vars(self) -> builtins.dict[builtins.str, DecisionVar]:
|
|
388
|
+
r"""
|
|
389
|
+
Returns a dictionary of decision variables in the problem.
|
|
390
|
+
|
|
391
|
+
Returns
|
|
392
|
+
--------
|
|
393
|
+
`dict[str, DecisionVar]`: Dictionary mapping variable names to DecisionVar objects.
|
|
394
|
+
"""
|
|
395
|
+
def placeholders(self) -> builtins.dict[builtins.str, Placeholder]:
|
|
396
|
+
r"""
|
|
397
|
+
Returns a dictionary of placeholders in the problem.
|
|
398
|
+
|
|
399
|
+
Returns
|
|
400
|
+
--------
|
|
401
|
+
`dict[str, Placeholder]`: Dictionary mapping placeholder names to Placeholder objects.
|
|
402
|
+
"""
|
|
403
|
+
def Placeholder(self, name:typing.Optional[builtins.str]=None, *, ndim:typing.Optional[builtins.int]=None, shape:typing.Optional[typing.Sequence[Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]]]=None, dtype:DataType | type | tuple=DataType.FLOAT, jagged:builtins.bool=False, latex:typing.Optional[builtins.str]=None, description:typing.Optional[builtins.str]=None) -> Placeholder: ...
|
|
216
404
|
def Integer(self, name:typing.Optional[builtins.str]=None, *, ndim:typing.Optional[builtins.int]=None, shape:typing.Optional[typing.Sequence[Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]]]=None, jagged:builtins.bool=False, latex:typing.Optional[builtins.str]=None, description:typing.Optional[builtins.str]=None) -> Placeholder:
|
|
217
405
|
r"""
|
|
218
406
|
A shorthand for `Problem.Placeholder(dtype=int)`
|
|
@@ -426,151 +614,6 @@ class DecoratedProblem(typing.Protocol):
|
|
|
426
614
|
```
|
|
427
615
|
"""
|
|
428
616
|
def SemiContinuousVar(self, name:typing.Optional[builtins.str]=None, *, shape:typing.Optional[typing.Sequence[Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]]]=None, lower_bound:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any] | typing.Sequence[Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]], upper_bound:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any] | typing.Sequence[Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]], latex:typing.Optional[builtins.str]=None, description:typing.Optional[builtins.str]=None) -> DecisionVar: ...
|
|
429
|
-
def Constraint(self, name:builtins.str, expression:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any], *, description:typing.Optional[builtins.str]=None) -> Constraint:
|
|
430
|
-
r"""
|
|
431
|
-
Constructs `Constraint` object, __WITHOUT__ registering it to the problem.
|
|
432
|
-
Use `+=` operator to register the constraint to the problem.
|
|
433
|
-
"""
|
|
434
|
-
def used_placeholders(self) -> builtins.list[Placeholder]: ...
|
|
435
|
-
def get_problem_schema(self) -> dict:
|
|
436
|
-
r"""
|
|
437
|
-
Returns the schema of the problem.
|
|
438
|
-
|
|
439
|
-
Returns
|
|
440
|
-
--------
|
|
441
|
-
- `schema`: The dictionary containing the schema of the problem.
|
|
442
|
-
"""
|
|
443
|
-
def generate_random_dataset(self, _default:typing.Any, _options:typing.Any, _seed:typing.Optional[builtins.int]) -> typing.Any:
|
|
444
|
-
r"""
|
|
445
|
-
Generates a dictionary of random `InstanceDataValue` for a given problem.
|
|
446
|
-
To generate `ommx.v1.Instance` object directly, use `InstanceDataValue.generate_random_instance` instead.
|
|
447
|
-
|
|
448
|
-
Args
|
|
449
|
-
-----
|
|
450
|
-
- `options` (optional): a dictionary of range parameters for each separate placeholders. The key must be the name of the placeholder and the value must be range parameter (as described in "Range Parameters and Range Syntax" below).
|
|
451
|
-
- `default` (optional): default range parameters for placeholders which is not specified in `options`.
|
|
452
|
-
- `seed` (optional): seed for random number generation.
|
|
453
|
-
|
|
454
|
-
Returns
|
|
455
|
-
--------
|
|
456
|
-
`dict`: The dictionary from the name of placeholders to the generated `InstanceDataValue` objects. To be fed to `Interpreter.eval_problem`.
|
|
457
|
-
|
|
458
|
-
Range Parameters and Range Syntax
|
|
459
|
-
----------------------------------
|
|
460
|
-
A range parameter is a dictionary consisting of the following fields:
|
|
461
|
-
- `size` (optional): interval of natural numbers for the size of each array dimension (default: `range(1, 6)`)
|
|
462
|
-
- `value` (optional): interval of real numbers for the value of each array element (default: `range(-1.0, 1.0)` - a uniform distribution on a closed interval $[-1.0, 1.0]$).
|
|
463
|
-
|
|
464
|
-
Example range parameter config:
|
|
465
|
-
|
|
466
|
-
```python
|
|
467
|
-
{"size": range(2, 10), "value": jm.range.value.closed(100.0, 200.0)}
|
|
468
|
-
```
|
|
469
|
-
|
|
470
|
-
Intervals are expressed as a range object.
|
|
471
|
-
Currently, the following syntax is supported for range objects:
|
|
472
|
-
|
|
473
|
-
1. Direct value of type `int` or `float` - it corresponds to a singleton interval $[a, a] = \{a\}$. In random generation context, this just means a constant fixed value.
|
|
474
|
-
2. Use the functions from `jijmodeling.range`, `jijmodeling.range.size`, or `jijmodeling.range.value` modules.
|
|
475
|
-
- Use functions from `jij.modeling.range.size` to specify (non-negative) integer intervals, and `jij.modeling.range.value` for real intervals. `jij.modeling.range` dynamically determines the type of the range based on the input.
|
|
476
|
-
- These three modules provides the following combinators (see the module documents for more details.):
|
|
477
|
-
- `closed(a, b)`: a closed interval $[a, b]$
|
|
478
|
-
- `open(a, b)`: an open interval $(a, b)$
|
|
479
|
-
- `closed_open(a, b)`: an upper half-open interval $[a, b)$
|
|
480
|
-
- `open_closed(a, b)`: a lower half-open interval $(a, b]$
|
|
481
|
-
- `greater_than(a)`: an open interval $(a, \infty)$
|
|
482
|
-
- `at_least(a)`: a closed interval $[a, \infty)$
|
|
483
|
-
- `less_than(a)`: an open interval $(-\infty, a)$
|
|
484
|
-
- `at_most(a)`: a closed interval $(-\infty, a]$
|
|
485
|
-
3. Use `range` builtin function: this is equivalent to `jijmodeling.range.value.closed_open(a, b)`.
|
|
486
|
-
- Any python range object with `step = 1` can be used as a size range; otherwise it results in runtime error.
|
|
487
|
-
4. Use a tuple: raw tuple `(a, b)` is equivalent to `jijmodeling.range.closed_open(a, b)` if `a` and `b` are either `int` or `float`.
|
|
488
|
-
- You can also use bound object as a tuple component; in such case, both tuple components must be one of the following:
|
|
489
|
-
|
|
490
|
-
1. A string `"Unbounded"` means $-\infty$ (in the first component) or $\infty$ (the second).
|
|
491
|
-
2. A dictionary `{"Included": a}` means the endpoint is inclusive.
|
|
492
|
-
3. A dictionary `{"Excluded": a}` means the endpoint is exclusive.
|
|
493
|
-
- Examples:
|
|
494
|
-
- `(1.2, 4)` is equivalent to `closed_open(1.2, 4)`,
|
|
495
|
-
- `(-1, {"Included": 1})` is equivalent to `closed(-1, 1)`,
|
|
496
|
-
- `(-5, {"Excluded": 4})` is equivalent to `closed_open(-5, 4)` and built in function `range(-5, 4)`,
|
|
497
|
-
- `({"Excluded": 1}, {"Excluded": 2.5})` is equivalent to `open(1, 2.5)`,
|
|
498
|
-
- `({"Included": -1}, "Unbounded")` is equivalent to `at_least(-1)`.
|
|
499
|
-
- `(5, "Unbounded")` is **INVALID**; `5` must be bound object.
|
|
500
|
-
5. The range object: A dictionary of form `{"start": lb, "end": ub}`, where both `lb` and `ub` are the bound object described as above.
|
|
501
|
-
|
|
502
|
-
Examples
|
|
503
|
-
---------
|
|
504
|
-
```python
|
|
505
|
-
>>> import jijmodeling as jm
|
|
506
|
-
>>> import builtins
|
|
507
|
-
>>> N = jm.Placeholder("N", dtype=jm.DataType.INTEGER)
|
|
508
|
-
>>> c = jm.Placeholder("c", dtype=jm.DataType.FLOAT, shape=(N,))
|
|
509
|
-
>>> x = jm.BinaryVar("x", shape=(N,))
|
|
510
|
-
>>> i = jm.Element("i", belong_to=N)
|
|
511
|
-
|
|
512
|
-
>>> problem = jm.Problem("problem")
|
|
513
|
-
>>> problem += jm.sum(i, c[i] * x[i])
|
|
514
|
-
|
|
515
|
-
>>> inputs = problem.generate_random_dataset(
|
|
516
|
-
... options={
|
|
517
|
-
... 'N': {"value": builtins.range(10, 20)},
|
|
518
|
-
... 'c': {"value": jm.range.value.closed(-1.0, 1.0)}
|
|
519
|
-
... # You can also specify "size" for the range of jagged array dimension size.
|
|
520
|
-
... },
|
|
521
|
-
... seed=123 # omittable
|
|
522
|
-
... )
|
|
523
|
-
>>> assert set(inputs.keys()) == {"N", "c"}
|
|
524
|
-
>>> inputs
|
|
525
|
-
{'N': 11.0, 'c': array([ 0.93914459, -0.06511935, -0.7460324 , -0.32443706, 0.99981451,
|
|
526
|
-
-0.24407535, 0.31329469, 0.52206453, -0.1291936 , 0.30443087,
|
|
527
|
-
0.53125838])}
|
|
528
|
-
|
|
529
|
-
```
|
|
530
|
-
"""
|
|
531
|
-
def generate_random_instance(self, _default:typing.Any, _options:typing.Any, _seed:typing.Optional[builtins.int], _hints:typing.Optional[typing.Any]) -> typing.Any:
|
|
532
|
-
r"""
|
|
533
|
-
Generates random `ommx.v1.Instance` for a given problem.
|
|
534
|
-
See also `InstanceDataValue.generate_random_dataset`.
|
|
535
|
-
|
|
536
|
-
Args
|
|
537
|
-
-----
|
|
538
|
-
- `options` (optional): a dictionary of range parameters for each separate placeholders. The key must be the name of the placeholder and the value must be range parameter (as described in "Range Parameters and Range Syntax" section in :func:`~jijmodeling.Problem.generate_random_dataset`).
|
|
539
|
-
- `default` (optional): default range parameters for placeholders which is not specified in `options`.
|
|
540
|
-
- `seed` (optional): seed for random number generation.
|
|
541
|
-
- `hints` (optional): the hints to be detected during compilation see `Interpreter.eval_problem` for more details.
|
|
542
|
-
|
|
543
|
-
Returns
|
|
544
|
-
--------
|
|
545
|
-
`instance`: The OMMX v1 instance object.
|
|
546
|
-
|
|
547
|
-
Examples
|
|
548
|
-
---------
|
|
549
|
-
```python
|
|
550
|
-
>>> import jijmodeling as jm
|
|
551
|
-
>>> import builtins
|
|
552
|
-
>>> import ommx.v1
|
|
553
|
-
>>> N = jm.Placeholder("N", dtype=jm.DataType.INTEGER)
|
|
554
|
-
>>> c = jm.Placeholder("c", dtype=jm.DataType.FLOAT, shape=(N,))
|
|
555
|
-
>>> x = jm.BinaryVar("x", shape=(N,))
|
|
556
|
-
>>> i = jm.Element("i", belong_to=N)
|
|
557
|
-
|
|
558
|
-
>>> problem = jm.Problem("problem")
|
|
559
|
-
>>> problem += jm.sum(i, c[i] * x[i])
|
|
560
|
-
|
|
561
|
-
>>> instance = problem.generate_random_instance(
|
|
562
|
-
... options={
|
|
563
|
-
... 'N': {"value": builtins.range(10, 20)},
|
|
564
|
-
... 'c': {"value": jm.range.value.closed(-1.0, 1.0)}
|
|
565
|
-
... },
|
|
566
|
-
... seed=123
|
|
567
|
-
... )
|
|
568
|
-
>>> assert type(instance) is ommx.v1.Instance
|
|
569
|
-
|
|
570
|
-
```
|
|
571
|
-
"""
|
|
572
|
-
def type_of(self, name:builtins.str) -> Type: ...
|
|
573
|
-
def infer(self, expr:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]) -> Type: ...
|
|
574
617
|
|
|
575
618
|
class DesugaredProblemBuilder:
|
|
576
619
|
def __call__(self) -> None: ...
|
|
@@ -646,7 +689,7 @@ class Namespace:
|
|
|
646
689
|
@staticmethod
|
|
647
690
|
def from_problem(problem:Problem) -> Namespace: ...
|
|
648
691
|
def add_placeholder(self, placeholder:Placeholder) -> None: ...
|
|
649
|
-
def Placeholder(self, name:builtins.str, *, ndim:typing.Optional[builtins.int]=None, shape:typing.Optional[typing.Sequence[Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]]]=None, dtype:DataType | type=DataType.FLOAT, jagged:builtins.bool=False, latex:typing.Optional[builtins.str]=None, description:typing.Optional[builtins.str]=None) -> Placeholder: ...
|
|
692
|
+
def Placeholder(self, name:builtins.str, *, ndim:typing.Optional[builtins.int]=None, shape:typing.Optional[typing.Sequence[Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]]]=None, dtype:DataType | type | tuple=DataType.FLOAT, jagged:builtins.bool=False, latex:typing.Optional[builtins.str]=None, description:typing.Optional[builtins.str]=None) -> Placeholder: ...
|
|
650
693
|
def add_decision_var(self, var:DecisionVar) -> None: ...
|
|
651
694
|
def type_of(self, name:builtins.str) -> Type: ...
|
|
652
695
|
def infer(self, expr:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]) -> Type: ...
|
|
@@ -716,6 +759,20 @@ class Placeholder:
|
|
|
716
759
|
Placeholder(name='a', ndim=2, shape=None, dtype=typing.float, jagged=False)
|
|
717
760
|
```
|
|
718
761
|
"""
|
|
762
|
+
@property
|
|
763
|
+
def name(self) -> builtins.str: ...
|
|
764
|
+
@property
|
|
765
|
+
def ndim(self) -> builtins.int: ...
|
|
766
|
+
@property
|
|
767
|
+
def shape(self) -> typing.Optional[builtins.list[Expression]]: ...
|
|
768
|
+
@property
|
|
769
|
+
def dtype(self) -> DataType | type | tuple: ...
|
|
770
|
+
@property
|
|
771
|
+
def jagged(self) -> builtins.bool: ...
|
|
772
|
+
@property
|
|
773
|
+
def description(self) -> typing.Optional[builtins.str]: ...
|
|
774
|
+
@property
|
|
775
|
+
def custom_latex(self) -> typing.Optional[builtins.str]: ...
|
|
719
776
|
def __repr__(self) -> builtins.str: ...
|
|
720
777
|
def len_at(self, index:builtins.int) -> Expression: ...
|
|
721
778
|
def __pow__(self, exponent:typing.Any, modulo:typing.Optional[typing.Any]=None) -> Expression: ...
|
|
@@ -800,7 +857,7 @@ class Problem:
|
|
|
800
857
|
def __iadd__(self, other:typing.Any) -> Problem: ...
|
|
801
858
|
def __repr__(self) -> builtins.str: ...
|
|
802
859
|
def eval(self, instance_data:dict) -> ommx.v1.Instance: ...
|
|
803
|
-
def Placeholder(self, name:builtins.str, *, ndim:typing.Optional[builtins.int]=None, shape:typing.Optional[typing.Sequence[Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]]]=None, dtype:DataType | type=DataType.FLOAT, jagged:builtins.bool=False, latex:typing.Optional[builtins.str]=None, description:typing.Optional[builtins.str]=None) -> Placeholder: ...
|
|
860
|
+
def Placeholder(self, name:builtins.str, *, ndim:typing.Optional[builtins.int]=None, shape:typing.Optional[typing.Sequence[Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]]]=None, dtype:DataType | type | tuple=DataType.FLOAT, jagged:builtins.bool=False, latex:typing.Optional[builtins.str]=None, description:typing.Optional[builtins.str]=None) -> Placeholder: ...
|
|
804
861
|
def Integer(self, name:builtins.str, *, ndim:typing.Optional[builtins.int]=None, shape:typing.Optional[typing.Sequence[Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]]]=None, jagged:builtins.bool=False, latex:typing.Optional[builtins.str]=None, description:typing.Optional[builtins.str]=None) -> Placeholder:
|
|
805
862
|
r"""
|
|
806
863
|
A shorthand for `Problem.Placeholder(dtype=int)`
|
|
@@ -1046,12 +1103,6 @@ class Problem:
|
|
|
1046
1103
|
>>> instance = problem.eval(instance_data)
|
|
1047
1104
|
```
|
|
1048
1105
|
"""
|
|
1049
|
-
def __new__(cls, name:builtins.str, *, sense:ProblemSense=ProblemSense.MINIMIZE) -> Problem: ...
|
|
1050
|
-
def Constraint(self, name:builtins.str, expression:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any], *, description:typing.Optional[builtins.str]=None) -> Constraint:
|
|
1051
|
-
r"""
|
|
1052
|
-
Constructs `Constraint` object, __WITHOUT__ registering it to the problem.
|
|
1053
|
-
Use `+=` operator to register the constraint to the problem.
|
|
1054
|
-
"""
|
|
1055
1106
|
def used_placeholders(self) -> builtins.list[Placeholder]: ...
|
|
1056
1107
|
def get_problem_schema(self) -> dict:
|
|
1057
1108
|
r"""
|
|
@@ -1192,6 +1243,38 @@ class Problem:
|
|
|
1192
1243
|
"""
|
|
1193
1244
|
def type_of(self, name:builtins.str) -> Type: ...
|
|
1194
1245
|
def infer(self, expr:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]) -> Type: ...
|
|
1246
|
+
def decision_vars(self) -> builtins.dict[builtins.str, DecisionVar]:
|
|
1247
|
+
r"""
|
|
1248
|
+
Returns a dictionary of decision variables in the problem.
|
|
1249
|
+
The dictionary may contain decision variables that are not used in the problem.
|
|
1250
|
+
|
|
1251
|
+
Returns
|
|
1252
|
+
--------
|
|
1253
|
+
`dict[str, DecisionVar]`: Dictionary mapping variable names to DecisionVar objects.
|
|
1254
|
+
"""
|
|
1255
|
+
def placeholders(self) -> builtins.dict[builtins.str, Placeholder]:
|
|
1256
|
+
r"""
|
|
1257
|
+
Returns a dictionary of placeholders in the problem.
|
|
1258
|
+
The dictionary may contain placeholders that are not used in the problem;
|
|
1259
|
+
to get only used placeholders, use `used_placeholders` method.
|
|
1260
|
+
|
|
1261
|
+
Returns
|
|
1262
|
+
--------
|
|
1263
|
+
`dict[str, Placeholder]`: Dictionary mapping placeholder names to Placeholder objects.
|
|
1264
|
+
"""
|
|
1265
|
+
@typing.overload
|
|
1266
|
+
def Constraint(self, name:builtins.str, expression:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any], domain:typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any], description:typing.Optional[builtins.str]=None) -> Constraint:
|
|
1267
|
+
r"""
|
|
1268
|
+
Constructs `Constraint` object from index set and function to build comparison expression from each index, __WITHOUT__ registering it to the problem.
|
|
1269
|
+
Use `+=` operator to register the constraint to the problem.
|
|
1270
|
+
"""
|
|
1271
|
+
@typing.overload
|
|
1272
|
+
def Constraint(self, name:builtins.str, expression:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any], description:typing.Optional[builtins.str]=None) -> Constraint:
|
|
1273
|
+
r"""
|
|
1274
|
+
Constructs `Constraint` object from comparison expression, __WITHOUT__ registering it to the problem.
|
|
1275
|
+
Use `+=` operator to register the constraint to the problem.
|
|
1276
|
+
"""
|
|
1277
|
+
def __new__(cls, name:builtins.str, *, sense:ProblemSense=ProblemSense.MINIMIZE) -> Problem: ...
|
|
1195
1278
|
|
|
1196
1279
|
class Type:
|
|
1197
1280
|
...
|
|
@@ -1202,25 +1285,10 @@ class ConstraintSense(Enum):
|
|
|
1202
1285
|
GREATER_THAN_EQUAL = ...
|
|
1203
1286
|
|
|
1204
1287
|
class DataType(Enum):
|
|
1205
|
-
r"""
|
|
1206
|
-
A datatype for JijModeling expressions
|
|
1207
|
-
"""
|
|
1208
1288
|
INTEGER = ...
|
|
1209
|
-
r"""
|
|
1210
|
-
INTEGER
|
|
1211
|
-
"""
|
|
1212
1289
|
FLOAT = ...
|
|
1213
|
-
r"""
|
|
1214
|
-
FLOAT
|
|
1215
|
-
"""
|
|
1216
1290
|
BINARY = ...
|
|
1217
|
-
r"""
|
|
1218
|
-
BINARY
|
|
1219
|
-
"""
|
|
1220
1291
|
NATURAL = ...
|
|
1221
|
-
r"""
|
|
1222
|
-
NATURAL
|
|
1223
|
-
"""
|
|
1224
1292
|
|
|
1225
1293
|
class DecisionVarKind(Enum):
|
|
1226
1294
|
BINARY = ...
|
|
@@ -1286,19 +1354,58 @@ def min(lhs:Expression | builtins.int | builtins.float | DecisionVar | Placehold
|
|
|
1286
1354
|
|
|
1287
1355
|
def neg(expr:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]) -> Expression: ...
|
|
1288
1356
|
|
|
1289
|
-
|
|
1357
|
+
@typing.overload
|
|
1358
|
+
def prod(index:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any], operand:typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]) -> Expression:
|
|
1359
|
+
r"""
|
|
1360
|
+
Takes an index and an operand representing the product operation in positional style. Eg. `jm.prod(N, lambda i: x[i])`
|
|
1361
|
+
"""
|
|
1362
|
+
|
|
1363
|
+
@typing.overload
|
|
1364
|
+
def prod(operand:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any], axis:typing.Optional[Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]]=None) -> Expression:
|
|
1365
|
+
r"""
|
|
1366
|
+
Takes the product of a set or tensor-like expression. You can use `axis` to partially reducing the tensor along specified axes. Eg. `jm.prod(N.map(lambda i: x[i]))`
|
|
1367
|
+
"""
|
|
1368
|
+
|
|
1369
|
+
@typing.overload
|
|
1370
|
+
def prod(x:typing.Generator[Expression]) -> Expression:
|
|
1371
|
+
r"""
|
|
1372
|
+
Comprehension syntax for jm.prod (NOTE: only works with decorated API!)
|
|
1373
|
+
"""
|
|
1374
|
+
|
|
1375
|
+
def product(*sets) -> Expression:
|
|
1376
|
+
r"""
|
|
1377
|
+
Takes the cartesian product of given set-like expressions.
|
|
1378
|
+
"""
|
|
1290
1379
|
|
|
1291
1380
|
def roll(operand:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any], shift:typing.Any, *, axis:typing.Optional[builtins.int]=None) -> Expression: ...
|
|
1292
1381
|
|
|
1293
1382
|
def rows(array:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]) -> Expression: ...
|
|
1294
1383
|
|
|
1384
|
+
def set(operand:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]) -> Expression: ...
|
|
1385
|
+
|
|
1295
1386
|
def sin(expr:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]) -> Expression: ...
|
|
1296
1387
|
|
|
1297
1388
|
def sinh(expr:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]) -> Expression: ...
|
|
1298
1389
|
|
|
1299
1390
|
def sqrt(expr:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]) -> Expression: ...
|
|
1300
1391
|
|
|
1301
|
-
|
|
1392
|
+
@typing.overload
|
|
1393
|
+
def sum(index:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any], operand:typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]) -> Expression:
|
|
1394
|
+
r"""
|
|
1395
|
+
Takes an index and an operand representing the summation operation in positional style. Eg. `jm.sum(N, lambda i: x[i])`
|
|
1396
|
+
"""
|
|
1397
|
+
|
|
1398
|
+
@typing.overload
|
|
1399
|
+
def sum(operand:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any], axis:typing.Optional[Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]]=None) -> Expression:
|
|
1400
|
+
r"""
|
|
1401
|
+
Takes the summation of set or tensor-like expression. You can use `axis` to partially reducing the tensor along specified axes. Eg. `jm.sum(N.map(lambda i: x[i]))`
|
|
1402
|
+
"""
|
|
1403
|
+
|
|
1404
|
+
@typing.overload
|
|
1405
|
+
def sum(x:typing.Generator[Expression]) -> Expression:
|
|
1406
|
+
r"""
|
|
1407
|
+
Comprehension syntax for jm.sum (NOTE: only works with decorated API!)
|
|
1408
|
+
"""
|
|
1302
1409
|
|
|
1303
1410
|
def tan(expr:Expression | builtins.int | builtins.float | DecisionVar | Placeholder | list | tuple | typing.Callable[[Expression], typing.Any] | typing.Callable[[Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression], typing.Any] | typing.Callable[[Expression, Expression, Expression, Expression, Expression], typing.Any]) -> Expression: ...
|
|
1304
1411
|
|
jijmodeling/_jijmodeling.abi3.so
CHANGED
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
jijmodeling-2.0.0a8.dist-info/METADATA,sha256=3WEnd6KxSHmDdNoKBr8-h07nEo8BVG1erSdySmdXyAc,2479
|
|
2
|
+
jijmodeling-2.0.0a8.dist-info/WHEEL,sha256=UrkgLrDWgBx4QmuqgSO9BFTP7-y0Z0RNPOtiCoqPvXw,107
|
|
3
|
+
jijmodeling-2.0.0a8.dist-info/licenses/LICENSE.txt,sha256=UDoDtHuEfRayMGh1HKVD3OR4lXFmXC4ifF2hQvwwj3w,3449
|
|
4
|
+
jijmodeling/__init__.py,sha256=43DV_WzDxS0n6FseNyfJZ6oQucO31T4qqbz3bx9JMtE,44
|
|
5
|
+
jijmodeling/__init__.pyi,sha256=4wOlffYUien9FafFQi2bHqvGT3uLkmS-93QsckYTNRI,148254
|
|
6
|
+
jijmodeling/_jijmodeling.abi3.so,sha256=6BbaP1PXGZ5d9V7Ufid6FoCxeET8sEk7tL2tSTIO2WI,9023080
|
|
7
|
+
jijmodeling/_jijmodeling.pyi,sha256=9towCfPT8yTmJxvncDdME7ZCeFSSntPxAd_TT_spuXQ,162
|
|
8
|
+
jijmodeling/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
jijmodeling-2.0.0a8.dist-info/RECORD,,
|
|
@@ -10,7 +10,7 @@ For these Terms and Conditions:
|
|
|
10
10
|
|
|
11
11
|
(a) "JijZept Service" means a cloud service for optimization calculation infrastructure provided by Jij Inc.
|
|
12
12
|
(b) "JijZept SDK" represents a set of software tools including "JijZept-Client" and "JijModeling" for developing programs that access the JijZept Services. This term includes sample programs provided by us.
|
|
13
|
-
(c) Company (referred to as either "the Company", "We", "Us" or "Our" in this Agreement) refers to Jij Inc.,
|
|
13
|
+
(c) Company (referred to as either "the Company", "We", "Us" or "Our" in this Agreement) refers to Jij Inc., #403, CIC, 3-3-6 Shibaura, Minato-ku, Tokyo, 108-0023.
|
|
14
14
|
(d) "Access Token" means a token necessary for connecting to the JijZept service.
|
|
15
15
|
|
|
16
16
|
2. Acknowledgment
|
|
@@ -43,4 +43,5 @@ You must enter into a separate JijZept service agreement to access the JijZept S
|
|
|
43
43
|
(b) The Company shall not be liable for any failure of the Software to operate when the User uses or uses the Software for the User's customer by incorporating or linking it with the User-provided Software.
|
|
44
44
|
(c) The User shall be responsible for confirming and examining the suitability of the relevant foreign laws and regulations applicable to the use of the Software. The Company shall not be liable for any legal liabilities related to the appropriate foreign laws and regulations.
|
|
45
45
|
|
|
46
|
-
Enacted 1 July 2021.
|
|
46
|
+
Enacted 1 July 2021.
|
|
47
|
+
Updated address on 23 July 2025.
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
jijmodeling-2.0.0a6.dist-info/METADATA,sha256=2VrFrvyjqXa1xzfguzSVpo9Ixyit-TAVd5r0akUoAVM,2479
|
|
2
|
-
jijmodeling-2.0.0a6.dist-info/WHEEL,sha256=mr1qZox3cYDvZG5vJCnwvnEBrBI82LkztNJzwKJciAs,107
|
|
3
|
-
jijmodeling-2.0.0a6.dist-info/licenses/LICENSE.txt,sha256=T5HdEbP5NWG8fZbvF9pofeteW3HrS30V3_LvtPUHFYM,3400
|
|
4
|
-
jijmodeling/__init__.py,sha256=43DV_WzDxS0n6FseNyfJZ6oQucO31T4qqbz3bx9JMtE,44
|
|
5
|
-
jijmodeling/__init__.pyi,sha256=wS4zwiFzlhbXh0LEiLIuBoli3sn4AvRhtZGd8iRH4k4,140970
|
|
6
|
-
jijmodeling/_jijmodeling.abi3.so,sha256=vGBSekTwJOgxzZ_NNCLxXTUYaAyph8hVs985bUEuoEA,8842672
|
|
7
|
-
jijmodeling/_jijmodeling.pyi,sha256=9towCfPT8yTmJxvncDdME7ZCeFSSntPxAd_TT_spuXQ,162
|
|
8
|
-
jijmodeling/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
-
jijmodeling-2.0.0a6.dist-info/RECORD,,
|