jijmodeling 1.7.0__cp39-cp39-manylinux_2_28_x86_64.whl → 1.8.0__cp39-cp39-manylinux_2_28_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
@@ -7,6 +7,7 @@ import typing
7
7
  from . import experimental
8
8
  from enum import Enum, auto
9
9
 
10
+ __version__: str
10
11
  class AbsOp:
11
12
  r"""
12
13
  A class for representing the absolute value
@@ -1628,6 +1629,146 @@ class IntegerVar:
1628
1629
  ...
1629
1630
 
1630
1631
 
1632
+ class Interpreter:
1633
+ r"""
1634
+ Interpreter of the JijModeling AST
1635
+
1636
+ This class is responsible for
1637
+
1638
+ - Creating OMMX instance from the AST.
1639
+ - This means this module also has responsible to register decision variable ID for each decision variables in AST.
1640
+ - Manage instance data to be substituted into the `Placeholder`.
1641
+
1642
+ Examples
1643
+ --------
1644
+
1645
+ ```python
1646
+ >>> import jijmodeling as jm
1647
+ >>> import numpy as np
1648
+
1649
+ Create a new interpreter with scalar instance data
1650
+ >>> interpreter = jm.Interpreter({"a": 1})
1651
+
1652
+ Insert instance data after creating the interpreter
1653
+ >>> interpreter.insert_instance_data("b", 2) # scalar
1654
+
1655
+ Python list and numpy array are supported
1656
+ >>> interpreter.insert_instance_data("c", [3, 4])
1657
+ >>> interpreter.insert_instance_data("d", [[1, 2], [3, 4]])
1658
+ >>> interpreter.insert_instance_data("e", np.array([3, 4]))
1659
+
1660
+ JaggedArray, non-uniform multi-dimensional array is also supported
1661
+ >>> interpreter.insert_instance_data("f", [[[1, 2]], [[3, 4, 5]], [[6]]])
1662
+ >>> interpreter.insert_instance_data("g", jm.JaggedArray([[[1, 2]], [[3, 4, 5]], [[6]]]))
1663
+
1664
+ You can get the instance data by using get_instance_data method
1665
+ >>> interpreter.get_instance_data("a")
1666
+ 1.0
1667
+
1668
+ Array are normalized to numpy array
1669
+ >>> interpreter.get_instance_data("c")
1670
+ array([3., 4.])
1671
+ >>> interpreter.get_instance_data("e")
1672
+ array([3., 4.])
1673
+ >>> interpreter.get_instance_data("f") # doctest: +ELLIPSIS
1674
+ <jijmodeling.JaggedArray object at 0x...>
1675
+
1676
+ ```
1677
+ """
1678
+ num_decision_variables: int
1679
+ def __new__(cls,instance_data:dict): ...
1680
+ def insert_instance_data(self, key:str, value:float | numpy.typing.NDArray[numpy.float64] | JaggedArray | typing.Sequence[float] | typing.Sequence[typing.Sequence[float]] | typing.Sequence[typing.Sequence[typing.Sequence[float]]] | typing.Sequence[typing.Sequence[typing.Sequence[typing.Sequence[float]]]]) -> None:
1681
+ ...
1682
+
1683
+ def get_instance_data(self, key:str) -> float | numpy.typing.NDArray[numpy.float64] | JaggedArray:
1684
+ ...
1685
+
1686
+ def instance_data(self) -> dict[str, float | numpy.typing.NDArray[numpy.float64] | JaggedArray]:
1687
+ ...
1688
+
1689
+ def __str__(self) -> str:
1690
+ ...
1691
+
1692
+ def get_decision_variable_by_id(self, id:int) -> typing.Any:
1693
+ ...
1694
+
1695
+ def get_decision_variable_by_name(self, name,subscript = ...) -> typing.Any:
1696
+ ...
1697
+
1698
+ def eval_scalar(self, expr:typing.Any) -> float:
1699
+ ...
1700
+
1701
+ def eval_expr(self, expr:typing.Any) -> typing.Any:
1702
+ ...
1703
+
1704
+ def eval_constraints(self, constraints:Constraint) -> list[typing.Any]:
1705
+ ...
1706
+
1707
+ def eval_problem(self, problem:Problem) -> typing.Any:
1708
+ ...
1709
+
1710
+
1711
+ class JaggedArray:
1712
+ r"""
1713
+ Jagged array, a multi-dimensional array where each element can be an array of different length.
1714
+
1715
+ Examples
1716
+ --------
1717
+
1718
+ ```python
1719
+ >>> import jijmodeling as jm
1720
+ >>> arr = jm.JaggedArray([[[1, 2], [3, 4, 5]], [[6]]])
1721
+
1722
+ # Three dimensional
1723
+ >>> assert arr.dim == 3
1724
+
1725
+ # __getitem__ works
1726
+ >>> assert arr[0, 0, 0] == 1.0
1727
+ >>> assert arr[0, 0, 1] == 2.0
1728
+ >>> assert arr[0, 1, 0] == 3.0
1729
+ >>> assert arr[0, 1, 1] == 4.0
1730
+ >>> assert arr[0, 1, 2] == 5.0
1731
+ >>> assert arr[1, 0, 0] == 6.0
1732
+
1733
+ # out of range
1734
+ >>> arr[0, 0, 2]
1735
+ Traceback (most recent call last):
1736
+ ...
1737
+ IndexError: Invalid index
1738
+
1739
+ # dimension mismatch
1740
+ >>> arr[0, 0]
1741
+ Traceback (most recent call last):
1742
+ ...
1743
+ IndexError: Invalid index
1744
+
1745
+ >>> assert arr.size_at([]) == 2 # [[1, 2], [3, 4, 5]] and [[6]]
1746
+ >>> assert arr.size_at([0]) == 2 # [1, 2] and [3, 4, 5]
1747
+ >>> assert arr.size_at([1]) == 1 # [[6]]
1748
+ >>> assert arr.size_at([0, 0]) == 2 # [1, 2]
1749
+ >>> assert arr.size_at([0, 1]) == 3 # [3, 4, 5]
1750
+ >>> assert arr.size_at([1, 0]) == 1 # [6]
1751
+
1752
+ ```
1753
+ """
1754
+ dim: int
1755
+ def __new__(cls,obj:typing.Any): ...
1756
+ def __str__(self) -> str:
1757
+ ...
1758
+
1759
+ def __eq__(self, other:typing.Any) -> bool:
1760
+ ...
1761
+
1762
+ def get(self, index:typing.Sequence[int]) -> float:
1763
+ ...
1764
+
1765
+ def __getitem__(self, index:typing.Sequence[int]) -> float:
1766
+ ...
1767
+
1768
+ def size_at(self, index:typing.Sequence[int]) -> int:
1769
+ ...
1770
+
1771
+
1631
1772
  class LessThanEqualOp:
1632
1773
  r"""
1633
1774
  A class for representing the less than equal operator
@@ -4835,6 +4976,8 @@ def sum(index:typing.Any,operand:typing.Any) -> SumOp:
4835
4976
  def to_protobuf(obj:Problem | Constraint | CustomPenaltyTerm | typing.Any | typing.Any) -> bytes:
4836
4977
  ...
4837
4978
 
4979
+ class InterpreterError(RuntimeError): ...
4980
+
4838
4981
  class ModelingError(Exception): ...
4839
4982
 
4840
4983
  class ProtobufDeserializationError(Exception): ...
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: jijmodeling
3
- Version: 1.7.0
3
+ Version: 1.8.0
4
4
  Classifier: Development Status :: 5 - Production/Stable
5
5
  Classifier: Operating System :: POSIX :: Linux
6
6
  Classifier: Operating System :: MacOS
@@ -18,6 +18,7 @@ Classifier: Topic :: Scientific/Engineering :: Mathematics
18
18
  Requires-Dist: numpy
19
19
  Requires-Dist: pandas
20
20
  Requires-Dist: orjson >=3.8.0, <4.0.0
21
+ Requires-Dist: ommx >=1.3.2, <2.0.0
21
22
  Requires-Dist: pyright ; extra == 'test'
22
23
  Requires-Dist: pytest ; extra == 'test'
23
24
  Requires-Dist: twine ; extra == 'test'
@@ -0,0 +1,12 @@
1
+ jijmodeling-1.8.0.dist-info/METADATA,sha256=Bve7uarIabLAq5hIzgJCo29-rOPeEaUgvqNupHCtO9I,12796
2
+ jijmodeling-1.8.0.dist-info/WHEEL,sha256=9i5QB5gaFn7L0pK6HzPVEoYAUfpRFfwJ3XQr3jRScGg,106
3
+ jijmodeling-1.8.0.dist-info/licenses/LICENSE.txt,sha256=T5HdEbP5NWG8fZbvF9pofeteW3HrS30V3_LvtPUHFYM,3400
4
+ jijmodeling/experimental.py,sha256=Of-tUY3kfpFHpjGbIcclbMenCP2BMW07me895YH7tG8,575
5
+ jijmodeling/__init__.py,sha256=43DV_WzDxS0n6FseNyfJZ6oQucO31T4qqbz3bx9JMtE,44
6
+ jijmodeling/experimental.pyi,sha256=PBGw5LutDarKtaP3HTzByjV_FPRrPvv4NAZ_XWUZuGA,9018
7
+ jijmodeling/dataset.py,sha256=S4piVIiUGJMi8MlG3kFV-8JIkzvnktAS0IdkbJ655hw,185
8
+ jijmodeling/dataset.pyi,sha256=LSYVLeyvQRq-Xmql8zfjavbmQwFHjU5Ir_GGyeg0q2Y,4005
9
+ jijmodeling/__init__.pyi,sha256=rF0EcrzJLgHqm-nGBcIGcZ6mk3WM7GE7dznVuLvGci0,133990
10
+ jijmodeling/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ jijmodeling/_jijmodeling.cpython-39-x86_64-linux-gnu.so,sha256=7rfiGAbmmmxTeOEyy8rj1r4jmGQs_xoBv1vwWQuGqw0,9192048
12
+ jijmodeling-1.8.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: maturin (1.7.0)
2
+ Generator: maturin (1.7.4)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp39-cp39-manylinux_2_28_x86_64
@@ -1,12 +0,0 @@
1
- jijmodeling-1.7.0.dist-info/METADATA,sha256=GXVGmRgC0yD064HGoDWB9cdxKI4KsDmQFjtbUKhKid8,12760
2
- jijmodeling-1.7.0.dist-info/WHEEL,sha256=IddfsyIU4--xsfOAffRZMDCAUBM4BTr9kplPmq3uImI,106
3
- jijmodeling-1.7.0.dist-info/license_files/LICENSE.txt,sha256=T5HdEbP5NWG8fZbvF9pofeteW3HrS30V3_LvtPUHFYM,3400
4
- jijmodeling/dataset.py,sha256=S4piVIiUGJMi8MlG3kFV-8JIkzvnktAS0IdkbJ655hw,185
5
- jijmodeling/dataset.pyi,sha256=LSYVLeyvQRq-Xmql8zfjavbmQwFHjU5Ir_GGyeg0q2Y,4005
6
- jijmodeling/__init__.pyi,sha256=fgbL7lNuAR6f3iF0murcGspACejjxthd0y7PeHhx1do,129647
7
- jijmodeling/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- jijmodeling/__init__.py,sha256=43DV_WzDxS0n6FseNyfJZ6oQucO31T4qqbz3bx9JMtE,44
9
- jijmodeling/experimental.pyi,sha256=PBGw5LutDarKtaP3HTzByjV_FPRrPvv4NAZ_XWUZuGA,9018
10
- jijmodeling/experimental.py,sha256=Of-tUY3kfpFHpjGbIcclbMenCP2BMW07me895YH7tG8,575
11
- jijmodeling/_jijmodeling.cpython-39-x86_64-linux-gnu.so,sha256=JBF0jDEBQHlUMiTmX7_3PzrwtCxJ4aubQZXj3RzcG3U,4821632
12
- jijmodeling-1.7.0.dist-info/RECORD,,