jijmodeling 1.0.0rc3__cp37-cp37m-macosx_10_7_x86_64.whl → 1.0.0rc4__cp37-cp37m-macosx_10_7_x86_64.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
@@ -343,8 +343,9 @@ class ArrayLength:
343
343
 
344
344
  The ArrayLength class is to refer to the number of elements of an axis in an array.
345
345
 
346
- This class is not intended to be instantiated directly. Instead, you can use
347
- the `len_at` method in of `Placeholder`, `Element` or `Subscript`.
346
+ This class is not intended to be constructed directly. Instead, we
347
+ recommend using the `len_at` method of `Placeholder`, `Element` or
348
+ `Subscript`.
348
349
 
349
350
  Attributes:
350
351
  array: A variable with `ndim >= 1`.
@@ -361,7 +362,7 @@ class ArrayLength:
361
362
  >>> a = jm.Placeholder("a", ndim=2)
362
363
  >>> N = a.len_at(0, latex="N")
363
364
  """
364
- def __new__(cls):
365
+ def __new__(cls, array, axis, *, latex=None, description=None):
365
366
  pass
366
367
 
367
368
  def __add__(self, value, /):
@@ -1157,10 +1158,13 @@ class Element:
1157
1158
  - an index of product $\displaystyle \prod$ (:obj:`ProdOp`)
1158
1159
  - a bound variable of the universal quantifier $\forall$ (:obj:`Forall`)
1159
1160
 
1160
- It has a set that it belongs to.
1161
- There are two options for this set:
1162
- 1. A half-open range, where the lower bound is included and the upper bound is excluded
1163
- 2. A `Placeholder`, `Element`, or `Subscript` variable with `ndim` >= 1
1161
+ Elements specify a set to which they belong. The set can be:
1162
+ 1. A half-open range, where the lower bound is included and the upper bound is excluded.
1163
+ 2. A `Placeholder`, `Element`, or `Subscript` object with `ndim` >= 1.
1164
+
1165
+ Ranges are generally specified with tuples as `(start, end)`. For
1166
+ convenience, passing a single number or scalar object as the argument is
1167
+ interpreted as the `end` of a range starting from zero.
1164
1168
 
1165
1169
  The index operator (`[]`) of an element with `ndim >= 1` returns a :obj:`Subscript` object.
1166
1170
 
@@ -1178,32 +1182,43 @@ class Element:
1178
1182
  description (str, optional): A description of the element.
1179
1183
 
1180
1184
  Examples:
1185
+ Note that `belong_to` is a positional argument, not a keyword
1186
+ argument, and so does not need to be written out. This is done in some
1187
+ of these examples for clarity.
1188
+
1181
1189
  Create an element that belongs to a half-open range.
1182
1190
 
1183
1191
  >>> import jijmodeling as jm
1184
1192
  >>> i = jm.Element("i", belong_to=(0,10))
1185
1193
 
1186
- If you pass an object with `ndim` as the `belong_to` argument, the set that the element belongs to is a range with a start of 0 and an end of the object.
1194
+ If you pass a scalar as the `belong_to` argument, the set that the element belongs to is a range starting at 0 going up to that value.
1187
1195
 
1188
1196
  >>> import jijmodeling as jm
1189
- >>> i = jm.Element("i", belong_to=10)
1197
+ >>> i = jm.Element("i", 10)
1190
1198
  >>> assert jm.is_same(i, jm.Element("i", belong_to=(0,10)))
1191
1199
 
1200
+ The applies not just to numbers, but certain scalars, like `Placeholder` (with `ndim == 0`).
1201
+
1202
+ >>> import jijmodeling as jm
1203
+ >>> n = jm.Placeholder("N")
1204
+ >>> i = jm.Element("i", n)
1205
+ >>> assert jm.is_same(i, jm.Element("i", belong_to=(0,n)))
1206
+
1192
1207
  Create an element that belongs to a 1-dimensional placeholder.
1193
1208
 
1194
1209
  >>> import jijmodeling as jm
1195
1210
  >>> E = jm.Placeholder("E", ndim=1)
1196
- >>> e = jm.Element("e", belong_to=E)
1211
+ >>> e = jm.Element("e", E)
1197
1212
 
1198
1213
  Create a 1-dimensional element with the index of `123`.
1199
1214
 
1200
1215
  >>> import jijmodeling as jm
1201
1216
  >>> a = jm.Placeholder("a", ndim=2)
1202
- >>> e = jm.Element("e", belong_to=a)
1217
+ >>> e = jm.Element("e", a)
1203
1218
  >>> e[123]
1204
1219
  Element(name='e', belong_to=Placeholder(name='a', ndim=2))[NumberLit(value=123)]
1205
1220
  """
1206
- def __new__(cls, name: str, *, belong_to, latex=None, description=None):
1221
+ def __new__(cls, name: str, belong_to, *, latex=None, description=None):
1207
1222
  pass
1208
1223
 
1209
1224
  def __add__(self, value, /):
@@ -1429,7 +1444,7 @@ class Evaluation:
1429
1444
  constraint_values (numpy.ndarray): The constraint value of each sample.
1430
1445
  penalty (dict[str, numpy.ndarray]): The penalty of each sample.
1431
1446
  """
1432
- def __new__(cls, energy=Ellipsis, objective=Ellipsis, constraint_violations=Ellipsis, constraint_forall=Ellipsis, constraint_values=Ellipsis, penalty=Ellipsis):
1447
+ def __new__(cls, energy=None, objective=None, constraint_violations=None, constraint_forall=None, constraint_values=None, penalty=None):
1433
1448
  pass
1434
1449
 
1435
1450
  constraint_expr_values: typing.Any
@@ -2618,7 +2633,7 @@ class MeasuringTime:
2618
2633
  system (SystemTime): Time to measure system time.
2619
2634
  total (float, optional): Total time to solve the problem. Defaults to None.
2620
2635
  """
2621
- def __new__(cls, solve=Ellipsis, system=Ellipsis, total=None):
2636
+ def __new__(cls, solve=None, system=None, total=None):
2622
2637
  pass
2623
2638
 
2624
2639
  @staticmethod
@@ -3924,7 +3939,7 @@ class Record:
3924
3939
 
3925
3940
  As an example, consider the following solutions:
3926
3941
 
3927
- ```python
3942
+ ```
3928
3943
  {
3929
3944
  "x": [np.array([[0.0, 1.0, 0.0], [2.0, 0.0, 3.0]]), np.array([[1.0, 0.0, 0.0], [2.0, 3.0, 4.0]])],
3930
3945
  "y": [np.array([0.0, 0.0, 1.0]), np.array([0.0, 1.0, 0.0])]
@@ -3933,7 +3948,7 @@ class Record:
3933
3948
 
3934
3949
  This is a dense solution. The corresponding sparse solution is as follows:
3935
3950
 
3936
- ```python
3951
+ ```
3937
3952
  {
3938
3953
  "x": [(([0, 1, 1], [1, 0, 2]), [1.0, 2.0, 3.0], (2, 3)), (([0, 1, 1, 1], [0, 0, 1, 2]), [1.0, 2.0, 3.0, 4.0], (2, 3))],
3939
3954
  "y": [(([2],), [1.0], (3,)), (([1],), [1.0], (3,))]
@@ -5074,13 +5089,29 @@ def ceil(operand):
5074
5089
  pass
5075
5090
 
5076
5091
 
5077
- def extract_nodes(obj, type):
5092
+ def concatenate(sample_sets):
5093
+ """
5094
+ Concatenate some SampleSet objects into a single SampleSet object.
5095
+
5096
+ Args:
5097
+ sample_sets (list[SampleSet]): A list of SampleSet objects.
5098
+
5099
+ Returns:
5100
+ SampleSet: A SampleSet object which is concatenated from the given SampleSet objects.
5101
+
5102
+ Note:
5103
+ This function will be deprecated in v1.1.0.
5104
+ """
5105
+ pass
5106
+
5107
+
5108
+ def extract_nodes(obj, class_or_tuple):
5078
5109
  """
5079
5110
  Extract all nodes from the given object.
5080
5111
 
5081
5112
  Args:
5082
5113
  obj: An expression defined by JijModeling's module, or a `Problem`, `Constraint`, `CustomPenaltyTerm`, or a list of forall object.
5083
- type: A type of node to extract.
5114
+ class_or_tuple: A type or tuple of types of nodes to be extracted.
5084
5115
 
5085
5116
  Returns:
5086
5117
  list: A list of nodes whose type is `type`.
@@ -5088,7 +5119,7 @@ def extract_nodes(obj, type):
5088
5119
  Examples:
5089
5120
  Extract all placeholders from the given expression.
5090
5121
 
5091
- ```python
5122
+ ```
5092
5123
  >>> from itertools import zip_longest
5093
5124
  >>> import jijmodeling as jm
5094
5125
  >>> a = jm.Placeholder("a")
@@ -5097,6 +5128,22 @@ def extract_nodes(obj, type):
5097
5128
  >>> for actual, expect in zip_longest(jm.extract_nodes(expr, jm.Placeholder), [a, b]):
5098
5129
  >>> assert jm.is_same(actual, expect)
5099
5130
  ```
5131
+
5132
+ Extract all BinaryVar objects and Placeholder objects from the given expression.
5133
+
5134
+ ```
5135
+ >>> from itertools import zip_longest
5136
+ >>> import jijmodeling as jm
5137
+ >>> a = jm.Placeholder("a")
5138
+ >>> b = jm.Placeholder("b")
5139
+ >>> x = jm.BinaryVar("x")
5140
+ >>> y = jm.ContinuousVar("y", lower_bound=0, upper_bound=1)
5141
+ >>> expr = a * x + b * y + 123
5142
+ >>> actual = jm.extract_nodes(expr, (jm.BinaryVar, jm.Placeholder))
5143
+ >>> expect = [a, x, b, y]
5144
+ >>> for actual, expect in zip_longest(actual, expect):
5145
+ >>> assert jm.is_same(actual, expect)
5146
+ ```
5100
5147
  """
5101
5148
  pass
5102
5149
 
@@ -5119,7 +5166,7 @@ def extract_variables(obj):
5119
5166
  Examples:
5120
5167
  Extract all variables from a problem without duplication.
5121
5168
 
5122
- ```python
5169
+ ```
5123
5170
  >>> n = jm.Placeholder("n")
5124
5171
  >>> i = jm.Element("i", belong_to=n)
5125
5172
  >>> x = jm.BinaryVar("x", shape=[10])
@@ -5182,7 +5229,7 @@ def is_dynamic_degree(expr):
5182
5229
  Examples:
5183
5230
  Check if the degree of the following expression is determined dynamically.
5184
5231
 
5185
- ```python
5232
+ ```
5186
5233
  a = jm.Placeholder("a", ndim=1)
5187
5234
  i = jm.Element("i", belong_to=a)
5188
5235
  x = jm.BinaryVar("x", shape=(a.len_at(0),))
@@ -5356,7 +5403,7 @@ def max(*operands):
5356
5403
  Examples:
5357
5404
  Create the `MaxOp` object whose operands are three placeholders.
5358
5405
 
5359
- ```python
5406
+ ```
5360
5407
  >>> import jijmodeling as jm
5361
5408
  >>> a = jm.Placeholder("a")
5362
5409
  >>> b = jm.Placeholder("b")
@@ -5383,7 +5430,7 @@ def min(*operands):
5383
5430
  Examples:
5384
5431
  Create the `MinOp` object whose operands are three placeholders.
5385
5432
 
5386
- ```python
5433
+ ```
5387
5434
  >>> import jijmodeling as jm
5388
5435
  >>> a = jm.Placeholder("a")
5389
5436
  >>> b = jm.Placeholder("b")
@@ -5449,7 +5496,7 @@ def replace(expr, replacer):
5449
5496
  Examples:
5450
5497
  Replace a placeholder with a binary variable.
5451
5498
 
5452
- ```python
5499
+ ```
5453
5500
  >>> import jijmodeling as jm
5454
5501
  >>> ph = jm.Placeholder("placeholder")
5455
5502
  >>> var = jm.BinaryVar("x")
@@ -5459,7 +5506,7 @@ def replace(expr, replacer):
5459
5506
 
5460
5507
  Replace a subscripted variable with a binary variable if it is a placeholder.
5461
5508
 
5462
- ```python
5509
+ ```
5463
5510
  >>> import jijmodeling as jm
5464
5511
  >>> ph = jm.Placeholder("ph", ndim=2)
5465
5512
  >>> x = jm.BinaryVar("x", shape=(1000, 1000))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jijmodeling
3
- Version: 1.0.0rc3
3
+ Version: 1.0.0rc4
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Operating System :: POSIX :: Linux
6
6
  Classifier: Operating System :: MacOS
@@ -0,0 +1,8 @@
1
+ jijmodeling-1.0.0rc4.dist-info/METADATA,sha256=k_KrVejU5x94BcU1s-9xuFAXCKWlpGM4f7MfqflfgJU,2878
2
+ jijmodeling-1.0.0rc4.dist-info/WHEEL,sha256=qfKm3Ex4-Q73NpzCeX2lZnECVLrw38pdHocMBHEF4Gs,104
3
+ jijmodeling-1.0.0rc4.dist-info/license_files/LICENSE.txt,sha256=T5HdEbP5NWG8fZbvF9pofeteW3HrS30V3_LvtPUHFYM,3400
4
+ jijmodeling/__init__.py,sha256=dTz5lvd2qXlLmjsXX3Pq7v2_dptMkGNTWIf37gSrvwE,127
5
+ jijmodeling/__init__.pyi,sha256=hrTWBclMxi__j6q3vbzF8Jj1rYJEWNtOUlLNoCl4IJA,125584
6
+ jijmodeling/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ jijmodeling/jijmodeling.cpython-37m-darwin.so,sha256=rSj5UBv74yl9diWB1cTd63VMTzMQeoXWM8D8dgK0dWA,2023392
8
+ jijmodeling-1.0.0rc4.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- jijmodeling-1.0.0rc3.dist-info/METADATA,sha256=TR-E7nhEmCa15lWGog7l71SwG6gCKw_jZpSzJQrrVmQ,2878
2
- jijmodeling-1.0.0rc3.dist-info/WHEEL,sha256=qfKm3Ex4-Q73NpzCeX2lZnECVLrw38pdHocMBHEF4Gs,104
3
- jijmodeling-1.0.0rc3.dist-info/license_files/LICENSE.txt,sha256=T5HdEbP5NWG8fZbvF9pofeteW3HrS30V3_LvtPUHFYM,3400
4
- jijmodeling/__init__.py,sha256=dTz5lvd2qXlLmjsXX3Pq7v2_dptMkGNTWIf37gSrvwE,127
5
- jijmodeling/__init__.pyi,sha256=XJ4h_bi-Yl4uZO6_Q3VSdPJp_s7wfKV6FLQMMPnP27s,123911
6
- jijmodeling/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- jijmodeling/jijmodeling.cpython-37m-darwin.so,sha256=mmn2gDIv85GQSEFGs6Vz8JiweFdIJ3mAucolG_iFObc,2006944
8
- jijmodeling-1.0.0rc3.dist-info/RECORD,,