jijmodeling 2.0.0a7__cp38-abi3-win_amd64.whl → 2.0.0a9__cp38-abi3-win_amd64.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 CHANGED
@@ -56,6 +56,7 @@ class Constraint:
56
56
 
57
57
  ```
58
58
  """
59
+ @property
59
60
  def is_inequality(self) -> builtins.bool:
60
61
  r"""
61
62
  Returns true if the constraint is an inequality constraint.
@@ -78,6 +79,7 @@ class Constraint:
78
79
  ```
79
80
  """
80
81
  def __repr__(self) -> builtins.str: ...
82
+ def _repr_latex_(self) -> builtins.str: ...
81
83
 
82
84
  class DecisionVar:
83
85
  r"""
@@ -170,6 +172,7 @@ class DecisionVar:
170
172
  @property
171
173
  def upper_bound(self) -> Expression | builtins.list[Expression]: ...
172
174
  def __repr__(self) -> builtins.str: ...
175
+ def _repr_latex_(self) -> builtins.str: ...
173
176
  def __pow__(self, exponent:typing.Any, modulo:typing.Optional[typing.Any]=None) -> Expression: ...
174
177
  def __rpow__(self, base:typing.Any, modulo:typing.Optional[typing.Any]=None) -> Expression: ...
175
178
  def __add__(self, rhs: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: ...
@@ -224,8 +227,182 @@ class DecoratedProblem(typing.Protocol):
224
227
  r"""
225
228
  A variant of `Problem` that is only available in Decorator API provided by `Problem.compile`.
226
229
  """
230
+ @typing.overload
231
+ def Constraint(self, name:builtins.str, expressions:typing.Generator[Expression], description:typing.Optional[builtins.str]=None) -> Constraint:
232
+ r"""
233
+ Constructs `Constraint` object with comprehension syntax, __WITHOUT__ registering it to the problem.
234
+ Use `+=` operator to register the constraint to the problem.
235
+ """
236
+ @typing.overload
237
+ 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:
238
+ r"""
239
+ Constructs `Constraint` object from index set and function to build comparison expression from each index, __WITHOUT__ registering it to the problem.
240
+ Use `+=` operator to register the constraint to the problem.
241
+ """
242
+ @typing.overload
243
+ 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:
244
+ r"""
245
+ Constructs `Constraint` object from comparison expression, __WITHOUT__ registering it to the problem.
246
+ Use `+=` operator to register the constraint to the problem.
247
+ """
227
248
  def __iadd__(self, other:typing.Any) -> DecoratedProblem: ...
228
- 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=DataType.FLOAT, jagged:builtins.bool=False, latex:typing.Optional[builtins.str]=None, description:typing.Optional[builtins.str]=None) -> Placeholder: ...
249
+ def used_placeholders(self) -> builtins.list[Placeholder]: ...
250
+ def get_problem_schema(self) -> dict:
251
+ r"""
252
+ Returns the schema of the problem.
253
+
254
+ Returns
255
+ --------
256
+ - `schema`: The dictionary containing the schema of the problem.
257
+ """
258
+ def generate_random_dataset(self, _default:typing.Any, _options:typing.Any, _seed:typing.Optional[builtins.int]) -> typing.Any:
259
+ r"""
260
+ Generates a dictionary of random `InstanceDataValue` for a given problem.
261
+ To generate `ommx.v1.Instance` object directly, use `InstanceDataValue.generate_random_instance` instead.
262
+
263
+ Args
264
+ -----
265
+ - `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).
266
+ - `default` (optional): default range parameters for placeholders which is not specified in `options`.
267
+ - `seed` (optional): seed for random number generation.
268
+
269
+ Returns
270
+ --------
271
+ `dict`: The dictionary from the name of placeholders to the generated `InstanceDataValue` objects. To be fed to `Interpreter.eval_problem`.
272
+
273
+ Range Parameters and Range Syntax
274
+ ----------------------------------
275
+ A range parameter is a dictionary consisting of the following fields:
276
+ - `size` (optional): interval of natural numbers for the size of each array dimension (default: `range(1, 6)`)
277
+ - `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]$).
278
+
279
+ Example range parameter config:
280
+
281
+ ```python
282
+ {"size": range(2, 10), "value": jm.range.value.closed(100.0, 200.0)}
283
+ ```
284
+
285
+ Intervals are expressed as a range object.
286
+ Currently, the following syntax is supported for range objects:
287
+
288
+ 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.
289
+ 2. Use the functions from `jijmodeling.range`, `jijmodeling.range.size`, or `jijmodeling.range.value` modules.
290
+ - 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.
291
+ - These three modules provides the following combinators (see the module documents for more details.):
292
+ - `closed(a, b)`: a closed interval $[a, b]$
293
+ - `open(a, b)`: an open interval $(a, b)$
294
+ - `closed_open(a, b)`: an upper half-open interval $[a, b)$
295
+ - `open_closed(a, b)`: a lower half-open interval $(a, b]$
296
+ - `greater_than(a)`: an open interval $(a, \infty)$
297
+ - `at_least(a)`: a closed interval $[a, \infty)$
298
+ - `less_than(a)`: an open interval $(-\infty, a)$
299
+ - `at_most(a)`: a closed interval $(-\infty, a]$
300
+ 3. Use `range` builtin function: this is equivalent to `jijmodeling.range.value.closed_open(a, b)`.
301
+ - Any python range object with `step = 1` can be used as a size range; otherwise it results in runtime error.
302
+ 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`.
303
+ - You can also use bound object as a tuple component; in such case, both tuple components must be one of the following:
304
+
305
+ 1. A string `"Unbounded"` means $-\infty$ (in the first component) or $\infty$ (the second).
306
+ 2. A dictionary `{"Included": a}` means the endpoint is inclusive.
307
+ 3. A dictionary `{"Excluded": a}` means the endpoint is exclusive.
308
+ - Examples:
309
+ - `(1.2, 4)` is equivalent to `closed_open(1.2, 4)`,
310
+ - `(-1, {"Included": 1})` is equivalent to `closed(-1, 1)`,
311
+ - `(-5, {"Excluded": 4})` is equivalent to `closed_open(-5, 4)` and built in function `range(-5, 4)`,
312
+ - `({"Excluded": 1}, {"Excluded": 2.5})` is equivalent to `open(1, 2.5)`,
313
+ - `({"Included": -1}, "Unbounded")` is equivalent to `at_least(-1)`.
314
+ - `(5, "Unbounded")` is **INVALID**; `5` must be bound object.
315
+ 5. The range object: A dictionary of form `{"start": lb, "end": ub}`, where both `lb` and `ub` are the bound object described as above.
316
+
317
+ Examples
318
+ ---------
319
+ ```python
320
+ >>> import jijmodeling as jm
321
+ >>> import builtins
322
+ >>> N = jm.Placeholder("N", dtype=jm.DataType.INTEGER)
323
+ >>> c = jm.Placeholder("c", dtype=jm.DataType.FLOAT, shape=(N,))
324
+ >>> x = jm.BinaryVar("x", shape=(N,))
325
+ >>> i = jm.Element("i", belong_to=N)
326
+
327
+ >>> problem = jm.Problem("problem")
328
+ >>> problem += jm.sum(i, c[i] * x[i])
329
+
330
+ >>> inputs = problem.generate_random_dataset(
331
+ ... options={
332
+ ... 'N': {"value": builtins.range(10, 20)},
333
+ ... 'c': {"value": jm.range.value.closed(-1.0, 1.0)}
334
+ ... # You can also specify "size" for the range of jagged array dimension size.
335
+ ... },
336
+ ... seed=123 # omittable
337
+ ... )
338
+ >>> assert set(inputs.keys()) == {"N", "c"}
339
+ >>> inputs
340
+ {'N': 11.0, 'c': array([ 0.93914459, -0.06511935, -0.7460324 , -0.32443706, 0.99981451,
341
+ -0.24407535, 0.31329469, 0.52206453, -0.1291936 , 0.30443087,
342
+ 0.53125838])}
343
+
344
+ ```
345
+ """
346
+ def generate_random_instance(self, _default:typing.Any, _options:typing.Any, _seed:typing.Optional[builtins.int], _hints:typing.Optional[typing.Any]) -> typing.Any:
347
+ r"""
348
+ Generates random `ommx.v1.Instance` for a given problem.
349
+ See also `InstanceDataValue.generate_random_dataset`.
350
+
351
+ Args
352
+ -----
353
+ - `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`).
354
+ - `default` (optional): default range parameters for placeholders which is not specified in `options`.
355
+ - `seed` (optional): seed for random number generation.
356
+ - `hints` (optional): the hints to be detected during compilation see `Interpreter.eval_problem` for more details.
357
+
358
+ Returns
359
+ --------
360
+ `instance`: The OMMX v1 instance object.
361
+
362
+ Examples
363
+ ---------
364
+ ```python
365
+ >>> import jijmodeling as jm
366
+ >>> import builtins
367
+ >>> import ommx.v1
368
+ >>> N = jm.Placeholder("N", dtype=jm.DataType.INTEGER)
369
+ >>> c = jm.Placeholder("c", dtype=jm.DataType.FLOAT, shape=(N,))
370
+ >>> x = jm.BinaryVar("x", shape=(N,))
371
+ >>> i = jm.Element("i", belong_to=N)
372
+
373
+ >>> problem = jm.Problem("problem")
374
+ >>> problem += jm.sum(i, c[i] * x[i])
375
+
376
+ >>> instance = problem.generate_random_instance(
377
+ ... options={
378
+ ... 'N': {"value": builtins.range(10, 20)},
379
+ ... 'c': {"value": jm.range.value.closed(-1.0, 1.0)}
380
+ ... },
381
+ ... seed=123
382
+ ... )
383
+ >>> assert type(instance) is ommx.v1.Instance
384
+
385
+ ```
386
+ """
387
+ def type_of(self, name:builtins.str) -> Type: ...
388
+ 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: ...
389
+ def decision_vars(self) -> builtins.dict[builtins.str, DecisionVar]:
390
+ r"""
391
+ Returns a dictionary of decision variables in the problem.
392
+
393
+ Returns
394
+ --------
395
+ `dict[str, DecisionVar]`: Dictionary mapping variable names to DecisionVar objects.
396
+ """
397
+ def placeholders(self) -> builtins.dict[builtins.str, Placeholder]:
398
+ r"""
399
+ Returns a dictionary of placeholders in the problem.
400
+
401
+ Returns
402
+ --------
403
+ `dict[str, Placeholder]`: Dictionary mapping placeholder names to Placeholder objects.
404
+ """
405
+ 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: ...
229
406
  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:
230
407
  r"""
231
408
  A shorthand for `Problem.Placeholder(dtype=int)`
@@ -439,151 +616,6 @@ class DecoratedProblem(typing.Protocol):
439
616
  ```
440
617
  """
441
618
  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: ...
442
- 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:
443
- r"""
444
- Constructs `Constraint` object, __WITHOUT__ registering it to the problem.
445
- Use `+=` operator to register the constraint to the problem.
446
- """
447
- def used_placeholders(self) -> builtins.list[Placeholder]: ...
448
- def get_problem_schema(self) -> dict:
449
- r"""
450
- Returns the schema of the problem.
451
-
452
- Returns
453
- --------
454
- - `schema`: The dictionary containing the schema of the problem.
455
- """
456
- def generate_random_dataset(self, _default:typing.Any, _options:typing.Any, _seed:typing.Optional[builtins.int]) -> typing.Any:
457
- r"""
458
- Generates a dictionary of random `InstanceDataValue` for a given problem.
459
- To generate `ommx.v1.Instance` object directly, use `InstanceDataValue.generate_random_instance` instead.
460
-
461
- Args
462
- -----
463
- - `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).
464
- - `default` (optional): default range parameters for placeholders which is not specified in `options`.
465
- - `seed` (optional): seed for random number generation.
466
-
467
- Returns
468
- --------
469
- `dict`: The dictionary from the name of placeholders to the generated `InstanceDataValue` objects. To be fed to `Interpreter.eval_problem`.
470
-
471
- Range Parameters and Range Syntax
472
- ----------------------------------
473
- A range parameter is a dictionary consisting of the following fields:
474
- - `size` (optional): interval of natural numbers for the size of each array dimension (default: `range(1, 6)`)
475
- - `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]$).
476
-
477
- Example range parameter config:
478
-
479
- ```python
480
- {"size": range(2, 10), "value": jm.range.value.closed(100.0, 200.0)}
481
- ```
482
-
483
- Intervals are expressed as a range object.
484
- Currently, the following syntax is supported for range objects:
485
-
486
- 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.
487
- 2. Use the functions from `jijmodeling.range`, `jijmodeling.range.size`, or `jijmodeling.range.value` modules.
488
- - 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.
489
- - These three modules provides the following combinators (see the module documents for more details.):
490
- - `closed(a, b)`: a closed interval $[a, b]$
491
- - `open(a, b)`: an open interval $(a, b)$
492
- - `closed_open(a, b)`: an upper half-open interval $[a, b)$
493
- - `open_closed(a, b)`: a lower half-open interval $(a, b]$
494
- - `greater_than(a)`: an open interval $(a, \infty)$
495
- - `at_least(a)`: a closed interval $[a, \infty)$
496
- - `less_than(a)`: an open interval $(-\infty, a)$
497
- - `at_most(a)`: a closed interval $(-\infty, a]$
498
- 3. Use `range` builtin function: this is equivalent to `jijmodeling.range.value.closed_open(a, b)`.
499
- - Any python range object with `step = 1` can be used as a size range; otherwise it results in runtime error.
500
- 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`.
501
- - You can also use bound object as a tuple component; in such case, both tuple components must be one of the following:
502
-
503
- 1. A string `"Unbounded"` means $-\infty$ (in the first component) or $\infty$ (the second).
504
- 2. A dictionary `{"Included": a}` means the endpoint is inclusive.
505
- 3. A dictionary `{"Excluded": a}` means the endpoint is exclusive.
506
- - Examples:
507
- - `(1.2, 4)` is equivalent to `closed_open(1.2, 4)`,
508
- - `(-1, {"Included": 1})` is equivalent to `closed(-1, 1)`,
509
- - `(-5, {"Excluded": 4})` is equivalent to `closed_open(-5, 4)` and built in function `range(-5, 4)`,
510
- - `({"Excluded": 1}, {"Excluded": 2.5})` is equivalent to `open(1, 2.5)`,
511
- - `({"Included": -1}, "Unbounded")` is equivalent to `at_least(-1)`.
512
- - `(5, "Unbounded")` is **INVALID**; `5` must be bound object.
513
- 5. The range object: A dictionary of form `{"start": lb, "end": ub}`, where both `lb` and `ub` are the bound object described as above.
514
-
515
- Examples
516
- ---------
517
- ```python
518
- >>> import jijmodeling as jm
519
- >>> import builtins
520
- >>> N = jm.Placeholder("N", dtype=jm.DataType.INTEGER)
521
- >>> c = jm.Placeholder("c", dtype=jm.DataType.FLOAT, shape=(N,))
522
- >>> x = jm.BinaryVar("x", shape=(N,))
523
- >>> i = jm.Element("i", belong_to=N)
524
-
525
- >>> problem = jm.Problem("problem")
526
- >>> problem += jm.sum(i, c[i] * x[i])
527
-
528
- >>> inputs = problem.generate_random_dataset(
529
- ... options={
530
- ... 'N': {"value": builtins.range(10, 20)},
531
- ... 'c': {"value": jm.range.value.closed(-1.0, 1.0)}
532
- ... # You can also specify "size" for the range of jagged array dimension size.
533
- ... },
534
- ... seed=123 # omittable
535
- ... )
536
- >>> assert set(inputs.keys()) == {"N", "c"}
537
- >>> inputs
538
- {'N': 11.0, 'c': array([ 0.93914459, -0.06511935, -0.7460324 , -0.32443706, 0.99981451,
539
- -0.24407535, 0.31329469, 0.52206453, -0.1291936 , 0.30443087,
540
- 0.53125838])}
541
-
542
- ```
543
- """
544
- def generate_random_instance(self, _default:typing.Any, _options:typing.Any, _seed:typing.Optional[builtins.int], _hints:typing.Optional[typing.Any]) -> typing.Any:
545
- r"""
546
- Generates random `ommx.v1.Instance` for a given problem.
547
- See also `InstanceDataValue.generate_random_dataset`.
548
-
549
- Args
550
- -----
551
- - `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`).
552
- - `default` (optional): default range parameters for placeholders which is not specified in `options`.
553
- - `seed` (optional): seed for random number generation.
554
- - `hints` (optional): the hints to be detected during compilation see `Interpreter.eval_problem` for more details.
555
-
556
- Returns
557
- --------
558
- `instance`: The OMMX v1 instance object.
559
-
560
- Examples
561
- ---------
562
- ```python
563
- >>> import jijmodeling as jm
564
- >>> import builtins
565
- >>> import ommx.v1
566
- >>> N = jm.Placeholder("N", dtype=jm.DataType.INTEGER)
567
- >>> c = jm.Placeholder("c", dtype=jm.DataType.FLOAT, shape=(N,))
568
- >>> x = jm.BinaryVar("x", shape=(N,))
569
- >>> i = jm.Element("i", belong_to=N)
570
-
571
- >>> problem = jm.Problem("problem")
572
- >>> problem += jm.sum(i, c[i] * x[i])
573
-
574
- >>> instance = problem.generate_random_instance(
575
- ... options={
576
- ... 'N': {"value": builtins.range(10, 20)},
577
- ... 'c': {"value": jm.range.value.closed(-1.0, 1.0)}
578
- ... },
579
- ... seed=123
580
- ... )
581
- >>> assert type(instance) is ommx.v1.Instance
582
-
583
- ```
584
- """
585
- def type_of(self, name:builtins.str) -> Type: ...
586
- 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: ...
587
619
 
588
620
  class DesugaredProblemBuilder:
589
621
  def __call__(self) -> None: ...
@@ -592,6 +624,7 @@ class Expression:
592
624
  r"""
593
625
  Any expression in Python.
594
626
  """
627
+ def _repr_latex_(self) -> builtins.str: ...
595
628
  def __call__(self, *args) -> Expression: ...
596
629
  def shape(self) -> Expression: ...
597
630
  def len_at(self, axis:builtins.int) -> Expression: ...
@@ -659,7 +692,7 @@ class Namespace:
659
692
  @staticmethod
660
693
  def from_problem(problem:Problem) -> Namespace: ...
661
694
  def add_placeholder(self, placeholder:Placeholder) -> None: ...
662
- 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: ...
695
+ 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: ...
663
696
  def add_decision_var(self, var:DecisionVar) -> None: ...
664
697
  def type_of(self, name:builtins.str) -> Type: ...
665
698
  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: ...
@@ -729,7 +762,22 @@ class Placeholder:
729
762
  Placeholder(name='a', ndim=2, shape=None, dtype=typing.float, jagged=False)
730
763
  ```
731
764
  """
765
+ @property
766
+ def name(self) -> builtins.str: ...
767
+ @property
768
+ def ndim(self) -> builtins.int: ...
769
+ @property
770
+ def shape(self) -> typing.Optional[builtins.list[Expression]]: ...
771
+ @property
772
+ def dtype(self) -> DataType | type | tuple: ...
773
+ @property
774
+ def jagged(self) -> builtins.bool: ...
775
+ @property
776
+ def description(self) -> typing.Optional[builtins.str]: ...
777
+ @property
778
+ def custom_latex(self) -> typing.Optional[builtins.str]: ...
732
779
  def __repr__(self) -> builtins.str: ...
780
+ def _repr_latex_(self) -> builtins.str: ...
733
781
  def len_at(self, index:builtins.int) -> Expression: ...
734
782
  def __pow__(self, exponent:typing.Any, modulo:typing.Optional[typing.Any]=None) -> Expression: ...
735
783
  def __rpow__(self, base:typing.Any, modulo:typing.Optional[typing.Any]=None) -> Expression: ...
@@ -812,8 +860,9 @@ class Problem:
812
860
  """
813
861
  def __iadd__(self, other:typing.Any) -> Problem: ...
814
862
  def __repr__(self) -> builtins.str: ...
863
+ def _repr_latex_(self) -> builtins.str: ...
815
864
  def eval(self, instance_data:dict) -> ommx.v1.Instance: ...
816
- 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: ...
865
+ 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: ...
817
866
  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:
818
867
  r"""
819
868
  A shorthand for `Problem.Placeholder(dtype=int)`
@@ -1059,12 +1108,6 @@ class Problem:
1059
1108
  >>> instance = problem.eval(instance_data)
1060
1109
  ```
1061
1110
  """
1062
- def __new__(cls, name:builtins.str, *, sense:ProblemSense=ProblemSense.MINIMIZE) -> Problem: ...
1063
- 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:
1064
- r"""
1065
- Constructs `Constraint` object, __WITHOUT__ registering it to the problem.
1066
- Use `+=` operator to register the constraint to the problem.
1067
- """
1068
1111
  def used_placeholders(self) -> builtins.list[Placeholder]: ...
1069
1112
  def get_problem_schema(self) -> dict:
1070
1113
  r"""
@@ -1205,6 +1248,38 @@ class Problem:
1205
1248
  """
1206
1249
  def type_of(self, name:builtins.str) -> Type: ...
1207
1250
  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: ...
1251
+ def decision_vars(self) -> builtins.dict[builtins.str, DecisionVar]:
1252
+ r"""
1253
+ Returns a dictionary of decision variables in the problem.
1254
+ The dictionary may contain decision variables that are not used in the problem.
1255
+
1256
+ Returns
1257
+ --------
1258
+ `dict[str, DecisionVar]`: Dictionary mapping variable names to DecisionVar objects.
1259
+ """
1260
+ def placeholders(self) -> builtins.dict[builtins.str, Placeholder]:
1261
+ r"""
1262
+ Returns a dictionary of placeholders in the problem.
1263
+ The dictionary may contain placeholders that are not used in the problem;
1264
+ to get only used placeholders, use `used_placeholders` method.
1265
+
1266
+ Returns
1267
+ --------
1268
+ `dict[str, Placeholder]`: Dictionary mapping placeholder names to Placeholder objects.
1269
+ """
1270
+ @typing.overload
1271
+ 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:
1272
+ r"""
1273
+ Constructs `Constraint` object from index set and function to build comparison expression from each index, __WITHOUT__ registering it to the problem.
1274
+ Use `+=` operator to register the constraint to the problem.
1275
+ """
1276
+ @typing.overload
1277
+ 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:
1278
+ r"""
1279
+ Constructs `Constraint` object from comparison expression, __WITHOUT__ registering it to the problem.
1280
+ Use `+=` operator to register the constraint to the problem.
1281
+ """
1282
+ def __new__(cls, name:builtins.str, *, sense:ProblemSense=ProblemSense.MINIMIZE) -> Problem: ...
1208
1283
 
1209
1284
  class Type:
1210
1285
  ...
@@ -1215,25 +1290,10 @@ class ConstraintSense(Enum):
1215
1290
  GREATER_THAN_EQUAL = ...
1216
1291
 
1217
1292
  class DataType(Enum):
1218
- r"""
1219
- A datatype for JijModeling expressions
1220
- """
1221
1293
  INTEGER = ...
1222
- r"""
1223
- INTEGER
1224
- """
1225
1294
  FLOAT = ...
1226
- r"""
1227
- FLOAT
1228
- """
1229
1295
  BINARY = ...
1230
- r"""
1231
- BINARY
1232
- """
1233
1296
  NATURAL = ...
1234
- r"""
1235
- NATURAL
1236
- """
1237
1297
 
1238
1298
  class DecisionVarKind(Enum):
1239
1299
  BINARY = ...
@@ -1300,18 +1360,34 @@ def min(lhs:Expression | builtins.int | builtins.float | DecisionVar | Placehold
1300
1360
  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: ...
1301
1361
 
1302
1362
  @typing.overload
1303
- def prod(x:typing.Generator[Expression]) -> Expression:
1363
+ 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:
1304
1364
  r"""
1305
- Comprehension syntax for jm.sum (NOTE: only works with decorated API!)
1365
+ Takes an index and an operand representing the product operation in positional style. Eg. `jm.prod(N, lambda i: x[i])`
1306
1366
  """
1307
1367
 
1308
1368
  @typing.overload
1309
- 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] | builtins.int | 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]] | typing.Sequence[builtins.int]]=None) -> Expression: ...
1369
+ 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:
1370
+ r"""
1371
+ 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]))`
1372
+ """
1373
+
1374
+ @typing.overload
1375
+ def prod(x:typing.Generator[Expression]) -> Expression:
1376
+ r"""
1377
+ Comprehension syntax for jm.prod (NOTE: only works with decorated API!)
1378
+ """
1379
+
1380
+ def product(*sets) -> Expression:
1381
+ r"""
1382
+ Takes the cartesian product of given set-like expressions.
1383
+ """
1310
1384
 
1311
1385
  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: ...
1312
1386
 
1313
1387
  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: ...
1314
1388
 
1389
+ 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: ...
1390
+
1315
1391
  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: ...
1316
1392
 
1317
1393
  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: ...
@@ -1319,17 +1395,21 @@ def sinh(expr:Expression | builtins.int | builtins.float | DecisionVar | Placeho
1319
1395
  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: ...
1320
1396
 
1321
1397
  @typing.overload
1322
- def sum(x:typing.Generator[Expression]) -> Expression:
1398
+ 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:
1323
1399
  r"""
1324
- Comprehension syntax for jm.sum (NOTE: only works with decorated API!)
1400
+ Takes an index and an operand representing the summation operation in positional style. Eg. `jm.sum(N, lambda i: x[i])`
1325
1401
  """
1326
1402
 
1327
1403
  @typing.overload
1328
- 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] | builtins.int | 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]] | typing.Sequence[builtins.int]]=None) -> Expression:
1404
+ 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:
1329
1405
  r"""
1330
- Takes a summation of set or tensor-like expression.
1331
- You can use `axis` to partially reducing the tensor along
1332
- specified axes.
1406
+ 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]))`
1407
+ """
1408
+
1409
+ @typing.overload
1410
+ def sum(x:typing.Generator[Expression]) -> Expression:
1411
+ r"""
1412
+ Comprehension syntax for jm.sum (NOTE: only works with decorated API!)
1333
1413
  """
1334
1414
 
1335
1415
  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: ...
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jijmodeling
3
- Version: 2.0.0a7
3
+ Version: 2.0.0a9
4
4
  Classifier: Development Status :: 5 - Production/Stable
5
5
  Classifier: Operating System :: POSIX :: Linux
6
6
  Classifier: Operating System :: MacOS
@@ -0,0 +1,9 @@
1
+ jijmodeling-2.0.0a9.dist-info/METADATA,sha256=fD-Bexl7ASzPSUVr8wiRG-q_6XbamE1Px3vdqCwRPu0,2495
2
+ jijmodeling-2.0.0a9.dist-info/WHEEL,sha256=lMUAg5cfi6g8a7v52pog4330UzKeSSlNI3fLvrdVzVU,94
3
+ jijmodeling-2.0.0a9.dist-info/licenses/LICENSE.txt,sha256=yFkplSxnOyfXDNYhBo2F7XC3xIQdANn-tk9LZsDekW8,3495
4
+ jijmodeling/__init__.py,sha256=jJ6o5wp3MPAP1uR3dqSvjaXG57t1IwcS8ojqPpZL-gU,45
5
+ jijmodeling/__init__.pyi,sha256=r4NcN9vXa4ZW70nFmf4TZ0nZDu1g1VY_sBGN1aUbxc0,149914
6
+ jijmodeling/_jijmodeling.pyd,sha256=S1w5UE4n0FbJRflMQ5TpvpYpnTSdGMX_fRxEMy_wDDs,14251008
7
+ jijmodeling/_jijmodeling.pyi,sha256=DNNHcMrqQWMefF5936RoeVtH9OEnw2kYlX_c6pZ7idU,175
8
+ jijmodeling/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ jijmodeling-2.0.0a9.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: maturin (1.9.1)
2
+ Generator: maturin (1.9.2)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp38-abi3-win_amd64
@@ -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., 1-4-6 Nezu, Bunkyo-Ku, Tokyo 113-0031.
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.0a7.dist-info/METADATA,sha256=-CelCg1FSRpSDp0pVI05W5wrTWUnCTDwR_16K4sC-NY,2495
2
- jijmodeling-2.0.0a7.dist-info/WHEEL,sha256=jXXXnFq1lMnQGkwJwdMPY4-n4ga_raKn8NABSsZqRTg,94
3
- jijmodeling-2.0.0a7.dist-info/licenses/LICENSE.txt,sha256=llUjgcEN5bUeFlj1RqxJxDMxUnlYvowLsldCF6Lwq8c,3445
4
- jijmodeling/__init__.py,sha256=jJ6o5wp3MPAP1uR3dqSvjaXG57t1IwcS8ojqPpZL-gU,45
5
- jijmodeling/__init__.pyi,sha256=hPB7N5QpqJFgSSIGBKuOwkGlouD3catAEdpRMejQ3og,143305
6
- jijmodeling/_jijmodeling.pyd,sha256=2A196t-yQfdvNw-ZYwvF0u9L70xesFvHBsnHOvBay9I,13246464
7
- jijmodeling/_jijmodeling.pyi,sha256=DNNHcMrqQWMefF5936RoeVtH9OEnw2kYlX_c6pZ7idU,175
8
- jijmodeling/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- jijmodeling-2.0.0a7.dist-info/RECORD,,