jijmodeling 0.13.2__cp310-cp310-win_amd64.whl → 1.12.0__cp310-cp310-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__.py +1 -154
- jijmodeling/__init__.pyi +5152 -0
- jijmodeling/_jijmodeling.cp310-win_amd64.pyd +0 -0
- jijmodeling/dataset.py +5 -0
- jijmodeling/dataset.pyi +106 -0
- jijmodeling/experimental.py +13 -0
- jijmodeling/experimental.pyi +302 -0
- jijmodeling/py.typed +0 -0
- jijmodeling/range/__init__.py +14 -0
- jijmodeling/range/__init__.pyi +56 -0
- jijmodeling/range/size.py +14 -0
- jijmodeling/range/size.pyi +54 -0
- jijmodeling/range/value.py +14 -0
- jijmodeling/range/value.pyi +54 -0
- jijmodeling-1.12.0.dist-info/METADATA +235 -0
- jijmodeling-1.12.0.dist-info/RECORD +18 -0
- {jijmodeling-0.13.2.dist-info → jijmodeling-1.12.0.dist-info}/WHEEL +1 -2
- {jijmodeling-0.13.2.dist-info → jijmodeling-1.12.0.dist-info/licenses}/LICENSE.txt +1 -1
- jijmodeling/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
- jijmodeling/__pycache__/__init__.cpython-310.pyc +0 -0
- jijmodeling/__pycache__/_version.cpython-310.opt-1.pyc +0 -0
- jijmodeling/__pycache__/_version.cpython-310.pyc +0 -0
- jijmodeling/_version.py +0 -4
- jijmodeling/deprecation/__init__.py +0 -11
- jijmodeling/deprecation/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
- jijmodeling/deprecation/__pycache__/__init__.cpython-310.pyc +0 -0
- jijmodeling/deprecation/__pycache__/deprecation.cpython-310.opt-1.pyc +0 -0
- jijmodeling/deprecation/__pycache__/deprecation.cpython-310.pyc +0 -0
- jijmodeling/deprecation/deprecation.py +0 -108
- jijmodeling/exceptions/__init__.py +0 -26
- jijmodeling/exceptions/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
- jijmodeling/exceptions/__pycache__/__init__.cpython-310.pyc +0 -0
- jijmodeling/exceptions/__pycache__/exceptions.cpython-310.opt-1.pyc +0 -0
- jijmodeling/exceptions/__pycache__/exceptions.cpython-310.pyc +0 -0
- jijmodeling/exceptions/exceptions.py +0 -37
- jijmodeling/expression/__init__.py +0 -76
- jijmodeling/expression/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
- jijmodeling/expression/__pycache__/__init__.cpython-310.pyc +0 -0
- jijmodeling/expression/__pycache__/condition.cpython-310.opt-1.pyc +0 -0
- jijmodeling/expression/__pycache__/condition.cpython-310.pyc +0 -0
- jijmodeling/expression/__pycache__/constraint.cpython-310.opt-1.pyc +0 -0
- jijmodeling/expression/__pycache__/constraint.cpython-310.pyc +0 -0
- jijmodeling/expression/__pycache__/expression.cpython-310.opt-1.pyc +0 -0
- jijmodeling/expression/__pycache__/expression.cpython-310.pyc +0 -0
- jijmodeling/expression/__pycache__/extract.cpython-310.opt-1.pyc +0 -0
- jijmodeling/expression/__pycache__/extract.cpython-310.pyc +0 -0
- jijmodeling/expression/__pycache__/from_old_serializable.cpython-310.opt-1.pyc +0 -0
- jijmodeling/expression/__pycache__/from_old_serializable.cpython-310.pyc +0 -0
- jijmodeling/expression/__pycache__/mathfunc.cpython-310.opt-1.pyc +0 -0
- jijmodeling/expression/__pycache__/mathfunc.cpython-310.pyc +0 -0
- jijmodeling/expression/__pycache__/prod.cpython-310.opt-1.pyc +0 -0
- jijmodeling/expression/__pycache__/prod.cpython-310.pyc +0 -0
- jijmodeling/expression/__pycache__/serializable.cpython-310.opt-1.pyc +0 -0
- jijmodeling/expression/__pycache__/serializable.cpython-310.pyc +0 -0
- jijmodeling/expression/__pycache__/sum.cpython-310.opt-1.pyc +0 -0
- jijmodeling/expression/__pycache__/sum.cpython-310.pyc +0 -0
- jijmodeling/expression/__pycache__/type_annotations.cpython-310.opt-1.pyc +0 -0
- jijmodeling/expression/__pycache__/type_annotations.cpython-310.pyc +0 -0
- jijmodeling/expression/__pycache__/utils.cpython-310.opt-1.pyc +0 -0
- jijmodeling/expression/__pycache__/utils.cpython-310.pyc +0 -0
- jijmodeling/expression/condition.py +0 -378
- jijmodeling/expression/constraint.py +0 -428
- jijmodeling/expression/expression.py +0 -768
- jijmodeling/expression/extract.py +0 -186
- jijmodeling/expression/from_old_serializable.py +0 -137
- jijmodeling/expression/mathfunc.py +0 -335
- jijmodeling/expression/prod.py +0 -172
- jijmodeling/expression/serializable.py +0 -142
- jijmodeling/expression/sum.py +0 -261
- jijmodeling/expression/type_annotations.py +0 -50
- jijmodeling/expression/utils.py +0 -202
- jijmodeling/expression/variables/__init__.py +0 -39
- jijmodeling/expression/variables/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
- jijmodeling/expression/variables/__pycache__/__init__.cpython-310.pyc +0 -0
- jijmodeling/expression/variables/__pycache__/deci_vars.cpython-310.opt-1.pyc +0 -0
- jijmodeling/expression/variables/__pycache__/deci_vars.cpython-310.pyc +0 -0
- jijmodeling/expression/variables/__pycache__/jagged_array.cpython-310.opt-1.pyc +0 -0
- jijmodeling/expression/variables/__pycache__/jagged_array.cpython-310.pyc +0 -0
- jijmodeling/expression/variables/__pycache__/placeholders.cpython-310.opt-1.pyc +0 -0
- jijmodeling/expression/variables/__pycache__/placeholders.cpython-310.pyc +0 -0
- jijmodeling/expression/variables/__pycache__/variable.cpython-310.opt-1.pyc +0 -0
- jijmodeling/expression/variables/__pycache__/variable.cpython-310.pyc +0 -0
- jijmodeling/expression/variables/deci_vars.py +0 -212
- jijmodeling/expression/variables/jagged_array.py +0 -81
- jijmodeling/expression/variables/placeholders.py +0 -132
- jijmodeling/expression/variables/variable.py +0 -524
- jijmodeling/latex_repr/__init__.py +0 -11
- jijmodeling/latex_repr/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
- jijmodeling/latex_repr/__pycache__/__init__.cpython-310.pyc +0 -0
- jijmodeling/latex_repr/__pycache__/latex_repr.cpython-310.opt-1.pyc +0 -0
- jijmodeling/latex_repr/__pycache__/latex_repr.cpython-310.pyc +0 -0
- jijmodeling/latex_repr/__pycache__/problem_latex_repr.cpython-310.opt-1.pyc +0 -0
- jijmodeling/latex_repr/__pycache__/problem_latex_repr.cpython-310.pyc +0 -0
- jijmodeling/latex_repr/latex_repr.py +0 -243
- jijmodeling/latex_repr/problem_latex_repr.py +0 -210
- jijmodeling/marker/__marker__.cp310-win_amd64.pyd +0 -0
- jijmodeling/match/__init__.py +0 -19
- jijmodeling/match/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
- jijmodeling/match/__pycache__/__init__.cpython-310.pyc +0 -0
- jijmodeling/match/__pycache__/condition_same.cpython-310.opt-1.pyc +0 -0
- jijmodeling/match/__pycache__/condition_same.cpython-310.pyc +0 -0
- jijmodeling/match/__pycache__/constraint_same.cpython-310.opt-1.pyc +0 -0
- jijmodeling/match/__pycache__/constraint_same.cpython-310.pyc +0 -0
- jijmodeling/match/__pycache__/expand.cpython-310.opt-1.pyc +0 -0
- jijmodeling/match/__pycache__/expand.cpython-310.pyc +0 -0
- jijmodeling/match/__pycache__/expr_same.cpython-310.opt-1.pyc +0 -0
- jijmodeling/match/__pycache__/expr_same.cpython-310.pyc +0 -0
- jijmodeling/match/__pycache__/is_same_expr.cpython-310.opt-1.pyc +0 -0
- jijmodeling/match/__pycache__/is_same_expr.cpython-310.pyc +0 -0
- jijmodeling/match/__pycache__/penalty_same.cpython-310.opt-1.pyc +0 -0
- jijmodeling/match/__pycache__/penalty_same.cpython-310.pyc +0 -0
- jijmodeling/match/__pycache__/problem_same.cpython-310.opt-1.pyc +0 -0
- jijmodeling/match/__pycache__/problem_same.cpython-310.pyc +0 -0
- jijmodeling/match/__pycache__/replace.cpython-310.opt-1.pyc +0 -0
- jijmodeling/match/__pycache__/replace.cpython-310.pyc +0 -0
- jijmodeling/match/condition_same.py +0 -44
- jijmodeling/match/constraint_same.py +0 -53
- jijmodeling/match/expand.py +0 -84
- jijmodeling/match/expr_same.py +0 -32
- jijmodeling/match/is_same_expr.py +0 -306
- jijmodeling/match/penalty_same.py +0 -31
- jijmodeling/match/problem_same.py +0 -44
- jijmodeling/match/replace.py +0 -249
- jijmodeling/problem/__init__.py +0 -9
- jijmodeling/problem/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
- jijmodeling/problem/__pycache__/__init__.cpython-310.pyc +0 -0
- jijmodeling/problem/__pycache__/problem.cpython-310.opt-1.pyc +0 -0
- jijmodeling/problem/__pycache__/problem.cpython-310.pyc +0 -0
- jijmodeling/problem/problem.py +0 -186
- jijmodeling/protobuf/__init__.py +0 -8
- jijmodeling/protobuf/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/__pycache__/__init__.cpython-310.pyc +0 -0
- jijmodeling/protobuf/__pycache__/from_protobuf.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/__pycache__/from_protobuf.cpython-310.pyc +0 -0
- jijmodeling/protobuf/__pycache__/to_protobuf.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/__pycache__/to_protobuf.cpython-310.pyc +0 -0
- jijmodeling/protobuf/__pycache__/type_annotations.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/__pycache__/type_annotations.cpython-310.pyc +0 -0
- jijmodeling/protobuf/from_protobuf.py +0 -336
- jijmodeling/protobuf/pb2/__init__.py +0 -42
- jijmodeling/protobuf/pb2/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/__init__.cpython-310.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/array_length_pb2.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/array_length_pb2.cpython-310.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/binary_op_pb2.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/binary_op_pb2.cpython-310.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/commutative_op_pb2.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/commutative_op_pb2.cpython-310.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/constraint_pb2.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/constraint_pb2.cpython-310.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/custom_penalty_term_pb2.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/custom_penalty_term_pb2.cpython-310.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/decision_var_pb2.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/decision_var_pb2.cpython-310.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/element_pb2.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/element_pb2.cpython-310.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/expression_pb2.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/expression_pb2.cpython-310.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/forall_pb2.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/forall_pb2.cpython-310.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/header_pb2.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/header_pb2.cpython-310.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/index_pb2.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/index_pb2.cpython-310.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/number_lit_pb2.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/number_lit_pb2.cpython-310.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/placeholder_pb2.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/placeholder_pb2.cpython-310.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/problem_pb2.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/problem_pb2.cpython-310.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/reduction_op_pb2.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/reduction_op_pb2.cpython-310.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/subscript_pb2.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/subscript_pb2.cpython-310.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/unary_op_pb2.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/pb2/__pycache__/unary_op_pb2.cpython-310.pyc +0 -0
- jijmodeling/protobuf/pb2/array_length_pb2.py +0 -27
- jijmodeling/protobuf/pb2/binary_op_pb2.py +0 -27
- jijmodeling/protobuf/pb2/commutative_op_pb2.py +0 -27
- jijmodeling/protobuf/pb2/constraint_pb2.py +0 -31
- jijmodeling/protobuf/pb2/custom_penalty_term_pb2.py +0 -31
- jijmodeling/protobuf/pb2/decision_var_pb2.py +0 -31
- jijmodeling/protobuf/pb2/element_pb2.py +0 -31
- jijmodeling/protobuf/pb2/expression_pb2.py +0 -39
- jijmodeling/protobuf/pb2/forall_pb2.py +0 -29
- jijmodeling/protobuf/pb2/header_pb2.py +0 -31
- jijmodeling/protobuf/pb2/index_pb2.py +0 -25
- jijmodeling/protobuf/pb2/number_lit_pb2.py +0 -27
- jijmodeling/protobuf/pb2/placeholder_pb2.py +0 -25
- jijmodeling/protobuf/pb2/problem_pb2.py +0 -40
- jijmodeling/protobuf/pb2/reduction_op_pb2.py +0 -30
- jijmodeling/protobuf/pb2/subscript_pb2.py +0 -27
- jijmodeling/protobuf/pb2/unary_op_pb2.py +0 -27
- jijmodeling/protobuf/to_protobuf.py +0 -631
- jijmodeling/protobuf/type_annotations.py +0 -52
- jijmodeling/sampleset/__init__.py +0 -33
- jijmodeling/sampleset/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
- jijmodeling/sampleset/__pycache__/__init__.cpython-310.pyc +0 -0
- jijmodeling/sampleset/__pycache__/evaluation.cpython-310.opt-1.pyc +0 -0
- jijmodeling/sampleset/__pycache__/evaluation.cpython-310.pyc +0 -0
- jijmodeling/sampleset/__pycache__/measuring_time.cpython-310.opt-1.pyc +0 -0
- jijmodeling/sampleset/__pycache__/measuring_time.cpython-310.pyc +0 -0
- jijmodeling/sampleset/__pycache__/record.cpython-310.opt-1.pyc +0 -0
- jijmodeling/sampleset/__pycache__/record.cpython-310.pyc +0 -0
- jijmodeling/sampleset/__pycache__/sampleset.cpython-310.opt-1.pyc +0 -0
- jijmodeling/sampleset/__pycache__/sampleset.cpython-310.pyc +0 -0
- jijmodeling/sampleset/__pycache__/solving_time.cpython-310.opt-1.pyc +0 -0
- jijmodeling/sampleset/__pycache__/solving_time.cpython-310.pyc +0 -0
- jijmodeling/sampleset/__pycache__/system_time.cpython-310.opt-1.pyc +0 -0
- jijmodeling/sampleset/__pycache__/system_time.cpython-310.pyc +0 -0
- jijmodeling/sampleset/evaluation.py +0 -289
- jijmodeling/sampleset/measuring_time.py +0 -59
- jijmodeling/sampleset/record.py +0 -158
- jijmodeling/sampleset/sampleset.py +0 -389
- jijmodeling/sampleset/solving_time.py +0 -38
- jijmodeling/sampleset/system_time.py +0 -48
- jijmodeling/type_annotations/__init__.py +0 -44
- jijmodeling/type_annotations/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
- jijmodeling/type_annotations/__pycache__/__init__.cpython-310.pyc +0 -0
- jijmodeling/type_annotations/__pycache__/type_annotations.cpython-310.opt-1.pyc +0 -0
- jijmodeling/type_annotations/__pycache__/type_annotations.cpython-310.pyc +0 -0
- jijmodeling/type_annotations/type_annotations.py +0 -54
- jijmodeling/utils/__init__.py +0 -28
- jijmodeling/utils/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
- jijmodeling/utils/__pycache__/__init__.cpython-310.pyc +0 -0
- jijmodeling/utils/__pycache__/deprecated.cpython-310.opt-1.pyc +0 -0
- jijmodeling/utils/__pycache__/deprecated.cpython-310.pyc +0 -0
- jijmodeling/utils/__pycache__/utils.cpython-310.opt-1.pyc +0 -0
- jijmodeling/utils/__pycache__/utils.cpython-310.pyc +0 -0
- jijmodeling/utils/deprecated.py +0 -17
- jijmodeling/utils/utils.py +0 -146
- jijmodeling-0.13.2.dist-info/METADATA +0 -60
- jijmodeling-0.13.2.dist-info/RECORD +0 -219
- jijmodeling-0.13.2.dist-info/top_level.txt +0 -1
|
@@ -1,389 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import datetime as dt
|
|
4
|
-
|
|
5
|
-
from copy import deepcopy
|
|
6
|
-
from dataclasses import asdict, dataclass
|
|
7
|
-
from typing import Dict, List, Optional, Tuple, Union
|
|
8
|
-
|
|
9
|
-
import numpy as np
|
|
10
|
-
import orjson
|
|
11
|
-
import pandas as pd
|
|
12
|
-
|
|
13
|
-
from jijmodeling.exceptions import SampleSetNotEvaluatedError, SerializeSampleSetError
|
|
14
|
-
from jijmodeling.sampleset.evaluation import Evaluation
|
|
15
|
-
from jijmodeling.sampleset.measuring_time import MeasuringTime
|
|
16
|
-
from jijmodeling.sampleset.record import Record
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
@dataclass
|
|
20
|
-
class SampleSet:
|
|
21
|
-
"""Schema for sampleset.
|
|
22
|
-
|
|
23
|
-
Attributes:
|
|
24
|
-
record (Record): Record object. This means basic infomation of solutions.
|
|
25
|
-
evaluation (Evaluation): Evaluation object. This means evaluation results of solutions.
|
|
26
|
-
measuring_time (MeasuringTime): MeasuringTime object. This means measuring time of various processing until solutions is obtained.
|
|
27
|
-
"""
|
|
28
|
-
|
|
29
|
-
record: Record
|
|
30
|
-
evaluation: Evaluation
|
|
31
|
-
measuring_time: MeasuringTime
|
|
32
|
-
|
|
33
|
-
def __post_init__(self):
|
|
34
|
-
self._is_dense = False
|
|
35
|
-
self._current_index = 0
|
|
36
|
-
self._metadata = {}
|
|
37
|
-
|
|
38
|
-
def __len__(self) -> int:
|
|
39
|
-
"""
|
|
40
|
-
Perform the operation __len__.
|
|
41
|
-
"""
|
|
42
|
-
return self.record.__len__()
|
|
43
|
-
|
|
44
|
-
def __iter__(self):
|
|
45
|
-
"""
|
|
46
|
-
Perform the operation __iter__.
|
|
47
|
-
"""
|
|
48
|
-
return self
|
|
49
|
-
|
|
50
|
-
def __next__(self):
|
|
51
|
-
"""
|
|
52
|
-
Perform the operation __next__.
|
|
53
|
-
"""
|
|
54
|
-
if self._current_index == len(self):
|
|
55
|
-
self._current_index = 0
|
|
56
|
-
raise StopIteration()
|
|
57
|
-
ret = self[self._current_index]
|
|
58
|
-
self._current_index += 1
|
|
59
|
-
return ret
|
|
60
|
-
|
|
61
|
-
def __getitem__(
|
|
62
|
-
self, item: Union[int, slice, List[int], Tuple[int], np.ndarray]
|
|
63
|
-
) -> SampleSet:
|
|
64
|
-
"""Perform the operation __getitem__.
|
|
65
|
-
|
|
66
|
-
Args:
|
|
67
|
-
item (Union[int, slice, List[int], Tuple[int], np.ndarray]): Index of sampleset.
|
|
68
|
-
|
|
69
|
-
Returns:
|
|
70
|
-
Record: SampleSet object.
|
|
71
|
-
"""
|
|
72
|
-
record = self.record[item]
|
|
73
|
-
evaluation = self.evaluation[item]
|
|
74
|
-
return SampleSet(
|
|
75
|
-
record=record, evaluation=evaluation, measuring_time=self.measuring_time
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
@property
|
|
79
|
-
def is_dense(self) -> bool:
|
|
80
|
-
"""SparseSolution or DenseSolution:
|
|
81
|
-
- If True, DenseSolution,
|
|
82
|
-
- Else, SparseSolution.
|
|
83
|
-
|
|
84
|
-
Returns:
|
|
85
|
-
bool: True or False.
|
|
86
|
-
"""
|
|
87
|
-
return self._is_dense
|
|
88
|
-
|
|
89
|
-
@property
|
|
90
|
-
def metadata(self) -> Dict:
|
|
91
|
-
"""Store information which is not in SampleSet schema.
|
|
92
|
-
|
|
93
|
-
Returns:
|
|
94
|
-
dict: Metadata.
|
|
95
|
-
"""
|
|
96
|
-
return self._metadata
|
|
97
|
-
|
|
98
|
-
@is_dense.setter
|
|
99
|
-
def is_dense(self, b: bool):
|
|
100
|
-
self._is_dense = b
|
|
101
|
-
|
|
102
|
-
def to_pandas_dataframe(self) -> pd.DataFrame:
|
|
103
|
-
"""Convert SampleSet object to pandas.DataFrame object.
|
|
104
|
-
|
|
105
|
-
Returns:
|
|
106
|
-
pandas.DataFrame: pandas.DataFrame object.
|
|
107
|
-
"""
|
|
108
|
-
record = self.record.to_pandas_dataframe()
|
|
109
|
-
evaluation = self.evaluation.to_pandas_dataframe()
|
|
110
|
-
|
|
111
|
-
return pd.concat([record, evaluation], axis=1)
|
|
112
|
-
|
|
113
|
-
def to_dense(self, inplace: bool = False) -> SampleSet | None:
|
|
114
|
-
"""Convert SparseSolution to DenseSolution.
|
|
115
|
-
|
|
116
|
-
Args:
|
|
117
|
-
inplace (bool, optional): Modify the SampleSet object in place (do not create a new object). Defaults to False.
|
|
118
|
-
|
|
119
|
-
Returns:
|
|
120
|
-
SampleSet or None: SampleSet with dense solution or None if inplace=True.
|
|
121
|
-
"""
|
|
122
|
-
if self.is_dense:
|
|
123
|
-
if inplace:
|
|
124
|
-
return None
|
|
125
|
-
else:
|
|
126
|
-
return self
|
|
127
|
-
elif inplace:
|
|
128
|
-
self.record.to_dense(inplace=inplace)
|
|
129
|
-
self._is_dense = True
|
|
130
|
-
return None
|
|
131
|
-
else:
|
|
132
|
-
record = self.record.to_dense(inplace=inplace)
|
|
133
|
-
sampleset = SampleSet(
|
|
134
|
-
record=record,
|
|
135
|
-
evaluation=self.evaluation,
|
|
136
|
-
measuring_time=self.measuring_time,
|
|
137
|
-
)
|
|
138
|
-
sampleset.is_dense = True
|
|
139
|
-
return sampleset
|
|
140
|
-
|
|
141
|
-
@classmethod
|
|
142
|
-
def from_serializable(cls, obj: Dict):
|
|
143
|
-
"""To SampleSet object from Dict of SampleSet.
|
|
144
|
-
|
|
145
|
-
Args:
|
|
146
|
-
obj (Dict): Dict of SampleSet.
|
|
147
|
-
|
|
148
|
-
Returns:
|
|
149
|
-
SampleSet: SampleSet obj.
|
|
150
|
-
"""
|
|
151
|
-
for key in ["record", "evaluation", "measuring_time"]:
|
|
152
|
-
if key not in obj.keys():
|
|
153
|
-
raise SerializeSampleSetError(f'"obj" does not contain "{key}" key')
|
|
154
|
-
|
|
155
|
-
if "metadata" in obj:
|
|
156
|
-
if isinstance(obj["metadata"], dict):
|
|
157
|
-
metadata = obj["metadata"]
|
|
158
|
-
else:
|
|
159
|
-
raise TypeError('Type of "metadata" must be dict')
|
|
160
|
-
else:
|
|
161
|
-
metadata = {}
|
|
162
|
-
|
|
163
|
-
solution = {}
|
|
164
|
-
for k, v in obj["record"]["solution"].items():
|
|
165
|
-
solution[k] = [(tuple(vi[0]), vi[1], tuple(vi[2])) for vi in v]
|
|
166
|
-
obj["record"]["solution"] = solution
|
|
167
|
-
|
|
168
|
-
record = Record.from_serializable(obj["record"])
|
|
169
|
-
evaluation = Evaluation.from_serializable(obj["evaluation"])
|
|
170
|
-
measuring_time = MeasuringTime.from_serializable(obj["measuring_time"])
|
|
171
|
-
|
|
172
|
-
sampleset = cls(
|
|
173
|
-
record=record,
|
|
174
|
-
evaluation=evaluation,
|
|
175
|
-
measuring_time=measuring_time,
|
|
176
|
-
)
|
|
177
|
-
sampleset.metadata.update(metadata)
|
|
178
|
-
|
|
179
|
-
return sampleset
|
|
180
|
-
|
|
181
|
-
def to_serializable(self) -> Dict:
|
|
182
|
-
"""To Dict of SampleSet from SampleSet object.
|
|
183
|
-
|
|
184
|
-
Returns:
|
|
185
|
-
SampleSet: Dict of SampleSet.
|
|
186
|
-
"""
|
|
187
|
-
|
|
188
|
-
def default(obj):
|
|
189
|
-
if isinstance(obj, np.ndarray):
|
|
190
|
-
return obj.tolist()
|
|
191
|
-
else:
|
|
192
|
-
return obj
|
|
193
|
-
|
|
194
|
-
evaluation_to_serializable_obj = self.evaluation.to_serializable()
|
|
195
|
-
to_serializable_obj = asdict(self)
|
|
196
|
-
to_serializable_obj["evaluation"] = evaluation_to_serializable_obj
|
|
197
|
-
json_metadata = orjson.dumps(
|
|
198
|
-
self.metadata,
|
|
199
|
-
default=default,
|
|
200
|
-
option=orjson.OPT_SERIALIZE_NUMPY,
|
|
201
|
-
)
|
|
202
|
-
to_serializable_obj["metadata"] = orjson.loads(json_metadata)
|
|
203
|
-
return to_serializable_obj
|
|
204
|
-
|
|
205
|
-
def feasible(self, rtol: float = 1e-05, atol: float = 1e-08):
|
|
206
|
-
"""Return feasible solutions.
|
|
207
|
-
This function uses `np.isclose` to check feasibility.
|
|
208
|
-
|
|
209
|
-
Args:
|
|
210
|
-
rel_tol (float, optional): Relative tolerance. Defaults to 1e-05.
|
|
211
|
-
abs_tol (float, optional): Absolute tolerance. Defaults to 1e-08.
|
|
212
|
-
|
|
213
|
-
Returns:
|
|
214
|
-
SampleSet: Output only feasible solutions from self.record.solution.
|
|
215
|
-
"""
|
|
216
|
-
|
|
217
|
-
if self.evaluation.constraint_violations is None:
|
|
218
|
-
raise SampleSetNotEvaluatedError("Your SampleSet object is not evaluated.")
|
|
219
|
-
else:
|
|
220
|
-
constraint_violations = np.array(
|
|
221
|
-
list(self.evaluation.constraint_violations.values())
|
|
222
|
-
)
|
|
223
|
-
if len(constraint_violations):
|
|
224
|
-
is_feas = np.isclose(
|
|
225
|
-
constraint_violations.sum(axis=0),
|
|
226
|
-
0,
|
|
227
|
-
rtol=rtol,
|
|
228
|
-
atol=atol,
|
|
229
|
-
)
|
|
230
|
-
return SampleSet(
|
|
231
|
-
record=self.record[is_feas],
|
|
232
|
-
evaluation=self.evaluation[is_feas],
|
|
233
|
-
measuring_time=self.measuring_time,
|
|
234
|
-
)
|
|
235
|
-
else:
|
|
236
|
-
return self
|
|
237
|
-
|
|
238
|
-
def infeasible(self):
|
|
239
|
-
"""Return infeasible solutions.
|
|
240
|
-
|
|
241
|
-
Returns:
|
|
242
|
-
SampleSet: Output only feasible solutions from self.record.solution.
|
|
243
|
-
"""
|
|
244
|
-
if self.evaluation.constraint_violations is None:
|
|
245
|
-
raise SampleSetNotEvaluatedError("Your SampleSet object is not evaluated.")
|
|
246
|
-
else:
|
|
247
|
-
constraint_violations = np.array(
|
|
248
|
-
list(self.evaluation.constraint_violations.values())
|
|
249
|
-
)
|
|
250
|
-
if len(constraint_violations):
|
|
251
|
-
is_infeas = constraint_violations.sum(axis=0) != 0
|
|
252
|
-
return SampleSet(
|
|
253
|
-
record=self.record[is_infeas],
|
|
254
|
-
evaluation=self.evaluation[is_infeas],
|
|
255
|
-
measuring_time=self.measuring_time,
|
|
256
|
-
)
|
|
257
|
-
else:
|
|
258
|
-
return self[[]]
|
|
259
|
-
|
|
260
|
-
def lowest(self):
|
|
261
|
-
"""Return solutions with lowest objective in feasible solutions.
|
|
262
|
-
|
|
263
|
-
Returns:
|
|
264
|
-
SampleSet: Output only lowest objecive solutions in feasibles from self.record.solution.
|
|
265
|
-
"""
|
|
266
|
-
|
|
267
|
-
if self.evaluation.objective is None:
|
|
268
|
-
raise SampleSetNotEvaluatedError("Your SampleSet object is not evaluated.")
|
|
269
|
-
else:
|
|
270
|
-
feas = self.feasible()
|
|
271
|
-
objective = np.array(feas.evaluation.objective)
|
|
272
|
-
is_lowest = objective == objective.min() if len(objective) else []
|
|
273
|
-
return SampleSet(
|
|
274
|
-
record=feas.record[is_lowest],
|
|
275
|
-
evaluation=feas.evaluation[is_lowest],
|
|
276
|
-
measuring_time=feas.measuring_time,
|
|
277
|
-
)
|
|
278
|
-
|
|
279
|
-
def get_backend_calculation_time(self):
|
|
280
|
-
"""You can check calculation time for each process in detail.
|
|
281
|
-
|
|
282
|
-
Returns:
|
|
283
|
-
Dict: Processed metadata for describing JijZept backends.
|
|
284
|
-
"""
|
|
285
|
-
|
|
286
|
-
def _get_root_keys(obj: Dict):
|
|
287
|
-
if not isinstance(obj, dict):
|
|
288
|
-
raise TypeError(f"Type of 'obj' must be Dict, not {obj.__class__}.")
|
|
289
|
-
|
|
290
|
-
root_keys = []
|
|
291
|
-
for k, v in obj.items():
|
|
292
|
-
if isinstance(v, dict):
|
|
293
|
-
parent_id = v.get("parent_id", "")
|
|
294
|
-
if parent_id is None:
|
|
295
|
-
root_keys.append(k)
|
|
296
|
-
return root_keys
|
|
297
|
-
|
|
298
|
-
def _timedelta(start: str, end: str):
|
|
299
|
-
s = dt.datetime.strptime(start, "%Y-%m-%dT%H:%M:%S.%fZ")
|
|
300
|
-
e = dt.datetime.strptime(end, "%Y-%m-%dT%H:%M:%S.%fZ")
|
|
301
|
-
return (e - s).total_seconds()
|
|
302
|
-
|
|
303
|
-
def _get_timedelata_by_span(obj: Dict, res: Optional[Dict] = None):
|
|
304
|
-
if res is None:
|
|
305
|
-
res = {}
|
|
306
|
-
|
|
307
|
-
for k, v in obj.items():
|
|
308
|
-
if isinstance(v, dict):
|
|
309
|
-
if "start_time" in v:
|
|
310
|
-
res[k] = {
|
|
311
|
-
"time": _timedelta(v["start_time"], v["end_time"]),
|
|
312
|
-
"span_id": v["context"]["span_id"],
|
|
313
|
-
"parent_id": v["parent_id"],
|
|
314
|
-
}
|
|
315
|
-
else:
|
|
316
|
-
res[k] = _get_timedelata_by_span(v, {})
|
|
317
|
-
return res
|
|
318
|
-
|
|
319
|
-
def _aggregate(obj: Dict, root_key: str, res: Optional[Dict] = None):
|
|
320
|
-
if res is None:
|
|
321
|
-
v = obj.pop(root_key, None)
|
|
322
|
-
if v is None:
|
|
323
|
-
return {}
|
|
324
|
-
else:
|
|
325
|
-
res = {
|
|
326
|
-
root_key: {
|
|
327
|
-
"id": v["span_id"],
|
|
328
|
-
"time": v["time"],
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
for v_res in res.values():
|
|
332
|
-
time_map = {
|
|
333
|
-
k: {"id": v["span_id"], "time": v["time"]}
|
|
334
|
-
for k, v in obj.items()
|
|
335
|
-
if v.get("parent_id", "") == v_res["id"]
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
if time_map:
|
|
339
|
-
del v_res["id"], v_res["time"]
|
|
340
|
-
v_res.update(_aggregate(obj, root_key, time_map))
|
|
341
|
-
else:
|
|
342
|
-
del v_res["id"]
|
|
343
|
-
return res
|
|
344
|
-
|
|
345
|
-
def _reformat(obj: Dict):
|
|
346
|
-
for k, v in obj.items():
|
|
347
|
-
if isinstance(v, dict):
|
|
348
|
-
if "time" in v:
|
|
349
|
-
obj[k] = v["time"]
|
|
350
|
-
else:
|
|
351
|
-
obj[k] = _reformat(v)
|
|
352
|
-
return obj
|
|
353
|
-
|
|
354
|
-
root_keys = _get_root_keys(self.metadata)
|
|
355
|
-
time = {}
|
|
356
|
-
for root_key in root_keys:
|
|
357
|
-
metadata = _get_timedelata_by_span(self.metadata)
|
|
358
|
-
metadata = _aggregate(metadata, root_key)
|
|
359
|
-
metadata = _reformat(metadata)
|
|
360
|
-
time.update(metadata)
|
|
361
|
-
return time
|
|
362
|
-
|
|
363
|
-
def _extend(self, other):
|
|
364
|
-
self.record._extend(other.record)
|
|
365
|
-
self.evaluation._extend(other.evaluation)
|
|
366
|
-
# TODO: concatenates MeasuringTime objects
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
def concatenate(
|
|
370
|
-
jm_sampleset_list: List[SampleSet],
|
|
371
|
-
) -> SampleSet:
|
|
372
|
-
"""
|
|
373
|
-
Concatenates SampleSet objects into a single SampleSet object.
|
|
374
|
-
|
|
375
|
-
Args:
|
|
376
|
-
jm_sampleset_list (List[SampleSet]): a list of SampleSet objects
|
|
377
|
-
|
|
378
|
-
Returns:
|
|
379
|
-
SampleSet: a SampleSet object that be concatenated
|
|
380
|
-
"""
|
|
381
|
-
if len(jm_sampleset_list) == 0:
|
|
382
|
-
raise ValueError("empty list is invalid")
|
|
383
|
-
elif len(jm_sampleset_list) == 1:
|
|
384
|
-
return jm_sampleset_list[0]
|
|
385
|
-
else:
|
|
386
|
-
concat_sampleset = deepcopy(jm_sampleset_list[0])
|
|
387
|
-
for jm_sampleset in jm_sampleset_list[1:]:
|
|
388
|
-
concat_sampleset._extend(jm_sampleset)
|
|
389
|
-
return concat_sampleset
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from dataclasses import dataclass
|
|
4
|
-
from typing import Dict, Optional
|
|
5
|
-
|
|
6
|
-
from jijmodeling.exceptions import SerializeSampleSetError
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@dataclass
|
|
10
|
-
class SolvingTime:
|
|
11
|
-
"""Schema for solver running time.
|
|
12
|
-
|
|
13
|
-
Attributes:
|
|
14
|
-
preprocess (Optional[float], optional): Time to preprocess. Defaults to None.
|
|
15
|
-
solve (Optional[float], optional): Time to solve. Defaults to None.
|
|
16
|
-
postprocess (Optional[float], optional): Time to postprocess. Defaults to None.
|
|
17
|
-
"""
|
|
18
|
-
|
|
19
|
-
preprocess: Optional[float] = None
|
|
20
|
-
solve: Optional[float] = None
|
|
21
|
-
postprocess: Optional[float] = None
|
|
22
|
-
|
|
23
|
-
@classmethod
|
|
24
|
-
def from_serializable(cls, obj: Dict):
|
|
25
|
-
"""To SolvingTime object from Dict of SampleSet.
|
|
26
|
-
|
|
27
|
-
Args:
|
|
28
|
-
obj (Dict): Dict of SolvingTime.
|
|
29
|
-
|
|
30
|
-
Returns:
|
|
31
|
-
SolvingTime: SolvingTime obj.
|
|
32
|
-
"""
|
|
33
|
-
|
|
34
|
-
for key in ["preprocess", "solve", "postprocess"]:
|
|
35
|
-
if key not in obj.keys():
|
|
36
|
-
raise SerializeSampleSetError(f'"obj" does not contain "{key}" key')
|
|
37
|
-
|
|
38
|
-
return cls(**obj)
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from dataclasses import dataclass
|
|
4
|
-
from typing import Dict, Optional
|
|
5
|
-
|
|
6
|
-
from jijmodeling.exceptions import SerializeSampleSetError
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@dataclass
|
|
10
|
-
class SystemTime:
|
|
11
|
-
"""Schema for system of jijzept running time.
|
|
12
|
-
|
|
13
|
-
Args:
|
|
14
|
-
post_problem_and_instance_data (Optional[float], optional): Time to upload problem and instance_data to blob. Defaults to None.
|
|
15
|
-
request_queue (Optional[float], optional): Time to send request to queue. Defaults to None.
|
|
16
|
-
fetch_problem_and_instance_data (Optional[float], optional): Time to fetch problme and instance_data from blob. Defaults to None.
|
|
17
|
-
fetch_result (Optional[float], optional): Time to fetch result. Defaults to None.
|
|
18
|
-
deserialize_solution (Optional[float], optional): Time to deserialize json object. Defaults to None.
|
|
19
|
-
"""
|
|
20
|
-
|
|
21
|
-
post_problem_and_instance_data: Optional[float] = None
|
|
22
|
-
request_queue: Optional[float] = None
|
|
23
|
-
fetch_problem_and_instance_data: Optional[float] = None
|
|
24
|
-
fetch_result: Optional[float] = None
|
|
25
|
-
deserialize_solution: Optional[float] = None
|
|
26
|
-
|
|
27
|
-
@classmethod
|
|
28
|
-
def from_serializable(cls, obj: Dict):
|
|
29
|
-
"""To SystemTime object from Dict of SampleSet.
|
|
30
|
-
|
|
31
|
-
Args:
|
|
32
|
-
obj (Dict): Dict of SystemTime.
|
|
33
|
-
|
|
34
|
-
Returns:
|
|
35
|
-
SystemTime: SystemTime obj.
|
|
36
|
-
"""
|
|
37
|
-
|
|
38
|
-
for key in [
|
|
39
|
-
"post_problem_and_instance_data",
|
|
40
|
-
"request_queue",
|
|
41
|
-
"fetch_problem_and_instance_data",
|
|
42
|
-
"fetch_result",
|
|
43
|
-
"deserialize_solution",
|
|
44
|
-
]:
|
|
45
|
-
if key not in obj.keys():
|
|
46
|
-
raise SerializeSampleSetError(f'"obj" does not contain "{key}" key')
|
|
47
|
-
|
|
48
|
-
return cls(**obj)
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from pkgutil import extend_path
|
|
4
|
-
|
|
5
|
-
__path__ = extend_path(__path__, __name__)
|
|
6
|
-
|
|
7
|
-
import jijmodeling.type_annotations.type_annotations as type_annotations
|
|
8
|
-
|
|
9
|
-
from jijmodeling.type_annotations.type_annotations import (
|
|
10
|
-
DECI_VALUES_INTEREFACE,
|
|
11
|
-
DECISION_VALUES,
|
|
12
|
-
FIXED_VARIABLES,
|
|
13
|
-
FIXED_VARS_INTERFACE,
|
|
14
|
-
PH_VALUES_INTERFACE,
|
|
15
|
-
PLACEHOLDER_VALUES,
|
|
16
|
-
VARIABLE_KEY,
|
|
17
|
-
ConstraintExpressionValuesType,
|
|
18
|
-
DenseSolution,
|
|
19
|
-
ForallIndexType,
|
|
20
|
-
ForallValuesType,
|
|
21
|
-
ListValue,
|
|
22
|
-
NumberValue,
|
|
23
|
-
SparseSolution,
|
|
24
|
-
TensorValue,
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
__all__ = [
|
|
28
|
-
"type_annotations",
|
|
29
|
-
"ConstraintExpressionValuesType",
|
|
30
|
-
"ForallIndexType",
|
|
31
|
-
"ForallValuesType",
|
|
32
|
-
"NumberValue",
|
|
33
|
-
"TensorValue",
|
|
34
|
-
"ListValue",
|
|
35
|
-
"VARIABLE_KEY",
|
|
36
|
-
"PH_VALUES_INTERFACE",
|
|
37
|
-
"PLACEHOLDER_VALUES",
|
|
38
|
-
"DECI_VALUES_INTEREFACE",
|
|
39
|
-
"DECISION_VALUES",
|
|
40
|
-
"FIXED_VARS_INTERFACE",
|
|
41
|
-
"FIXED_VARIABLES",
|
|
42
|
-
"SparseSolution",
|
|
43
|
-
"DenseSolution",
|
|
44
|
-
]
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
"""TYPE ANNOTATIONS.
|
|
4
|
-
|
|
5
|
-
Describe the types related to the data needed to change from JijModeling to another type, such as to_pyqubo or calc_value.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
import typing as tp
|
|
9
|
-
|
|
10
|
-
import numpy as np
|
|
11
|
-
|
|
12
|
-
from jijmodeling.expression.variables.deci_vars import DecisionVariable
|
|
13
|
-
from jijmodeling.expression.variables.placeholders import Placeholder
|
|
14
|
-
|
|
15
|
-
NumberValue = tp.Union[int, float]
|
|
16
|
-
TensorValue = tp.Union[NumberValue, np.ndarray]
|
|
17
|
-
ListValue = tp.List[NumberValue]
|
|
18
|
-
NonZeroIndices = tp.Tuple[tp.List[int], ...]
|
|
19
|
-
NonZeroValues = tp.Union[tp.List[tp.Union[int, float]], tp.Union[int, float]]
|
|
20
|
-
Shape = tp.Tuple[int, ...]
|
|
21
|
-
SparseSolution = tp.Tuple[
|
|
22
|
-
NonZeroIndices,
|
|
23
|
-
NonZeroValues,
|
|
24
|
-
Shape,
|
|
25
|
-
]
|
|
26
|
-
DenseSolution = np.ndarray
|
|
27
|
-
|
|
28
|
-
ForallIndexType = tp.Dict[str, tp.List[tp.List[int]]]
|
|
29
|
-
ForallValuesType = tp.Dict[str, tp.List[float]]
|
|
30
|
-
ConstraintExpressionValuesType = tp.Dict[str, tp.Dict[tp.Tuple[int, ...], float]]
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
ForallIndexType = tp.Dict[str, tp.List[tp.List[int]]]
|
|
34
|
-
ForallValuesType = tp.Dict[str, tp.List[float]]
|
|
35
|
-
ConstraintExpressionValuesType = tp.Dict[str, tp.Dict[tp.Tuple[int, ...], float]]
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
VARIABLE_KEY = tp.Union[str, Placeholder]
|
|
39
|
-
# User interface for values of placeholder.
|
|
40
|
-
PH_VALUES_INTERFACE = tp.Dict[VARIABLE_KEY, tp.Union[TensorValue, ListValue]]
|
|
41
|
-
# type of value of placholders for inner handling.
|
|
42
|
-
PLACEHOLDER_VALUES = tp.Dict[Placeholder, tp.Union[TensorValue, ListValue]]
|
|
43
|
-
|
|
44
|
-
DECI_VALUES_INTEREFACE = tp.Dict[tp.Union[str, DecisionVariable], TensorValue]
|
|
45
|
-
DECISION_VALUES = tp.Dict[DecisionVariable, TensorValue]
|
|
46
|
-
|
|
47
|
-
# fixed variable
|
|
48
|
-
# ex. fix array element : {"x": {(0, 1, 2): 1}} means x[0, 1, 2] = 1
|
|
49
|
-
# fix scalar variable: {"y": {(): 0}} means y = 0
|
|
50
|
-
FIXED_VARS_INTERFACE = tp.Dict[
|
|
51
|
-
tp.Union[str, DecisionVariable],
|
|
52
|
-
tp.Dict[tp.Tuple[int, ...], NumberValue],
|
|
53
|
-
]
|
|
54
|
-
FIXED_VARIABLES = tp.Dict[DecisionVariable, tp.Dict[tp.Tuple[int, ...], NumberValue]]
|
jijmodeling/utils/__init__.py
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
from pkgutil import extend_path
|
|
2
|
-
|
|
3
|
-
__path__ = extend_path(__path__, __name__)
|
|
4
|
-
|
|
5
|
-
import jijmodeling.utils.utils as utils
|
|
6
|
-
|
|
7
|
-
from jijmodeling.utils.utils import (
|
|
8
|
-
FixedVariables,
|
|
9
|
-
SerializedFixedVariables,
|
|
10
|
-
deserialize_fixed_var,
|
|
11
|
-
serialize_fixed_var,
|
|
12
|
-
simple_dict_validation,
|
|
13
|
-
simple_list_validation,
|
|
14
|
-
validate_value,
|
|
15
|
-
with_measuring_time,
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
__all__ = [
|
|
19
|
-
"utils",
|
|
20
|
-
"validate_value",
|
|
21
|
-
"FixedVariables",
|
|
22
|
-
"SerializedFixedVariables",
|
|
23
|
-
"simple_list_validation",
|
|
24
|
-
"simple_dict_validation",
|
|
25
|
-
"with_measuring_time",
|
|
26
|
-
"serialize_fixed_var",
|
|
27
|
-
"deserialize_fixed_var",
|
|
28
|
-
]
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
jijmodeling/utils/deprecated.py
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import typing as typ
|
|
2
|
-
import warnings
|
|
3
|
-
|
|
4
|
-
ARG_VAL_TYPE = typ.TypeVar("ARG_VAL_TYPE")
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def is_deprecated(
|
|
8
|
-
arg_name,
|
|
9
|
-
arg_value: typ.Optional[ARG_VAL_TYPE],
|
|
10
|
-
default_value=None,
|
|
11
|
-
additional_msg="",
|
|
12
|
-
) -> typ.Optional[ARG_VAL_TYPE]:
|
|
13
|
-
if arg_value is not None:
|
|
14
|
-
warnings.warn(f"{arg_name} is deprecated. " + additional_msg, FutureWarning)
|
|
15
|
-
return arg_value
|
|
16
|
-
else:
|
|
17
|
-
return default_value
|