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,33 +0,0 @@
|
|
|
1
|
-
from pkgutil import extend_path
|
|
2
|
-
|
|
3
|
-
__path__ = extend_path(__path__, __name__)
|
|
4
|
-
|
|
5
|
-
import jijmodeling.sampleset.evaluation as evaluation
|
|
6
|
-
import jijmodeling.sampleset.measuring_time as measuring_time
|
|
7
|
-
import jijmodeling.sampleset.record as record
|
|
8
|
-
import jijmodeling.sampleset.sampleset as sampleset
|
|
9
|
-
import jijmodeling.sampleset.solving_time as solving_time
|
|
10
|
-
import jijmodeling.sampleset.system_time as system_time
|
|
11
|
-
|
|
12
|
-
from jijmodeling.sampleset.evaluation import Evaluation
|
|
13
|
-
from jijmodeling.sampleset.measuring_time import MeasuringTime
|
|
14
|
-
from jijmodeling.sampleset.record import Record
|
|
15
|
-
from jijmodeling.sampleset.sampleset import SampleSet, concatenate
|
|
16
|
-
from jijmodeling.sampleset.solving_time import SolvingTime
|
|
17
|
-
from jijmodeling.sampleset.system_time import SystemTime
|
|
18
|
-
|
|
19
|
-
__all__ = [
|
|
20
|
-
"evaluation",
|
|
21
|
-
"measuring_time",
|
|
22
|
-
"record",
|
|
23
|
-
"sampleset",
|
|
24
|
-
"solving_time",
|
|
25
|
-
"system_time",
|
|
26
|
-
"SampleSet",
|
|
27
|
-
"Record",
|
|
28
|
-
"Evaluation",
|
|
29
|
-
"MeasuringTime",
|
|
30
|
-
"SolvingTime",
|
|
31
|
-
"SystemTime",
|
|
32
|
-
"concatenate",
|
|
33
|
-
]
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from dataclasses import asdict, dataclass, field
|
|
4
|
-
from typing import Dict, List, Optional, Tuple, Union
|
|
5
|
-
|
|
6
|
-
import numpy as np
|
|
7
|
-
import pandas as pd
|
|
8
|
-
|
|
9
|
-
from jijmodeling.type_annotations import (
|
|
10
|
-
ConstraintExpressionValuesType,
|
|
11
|
-
ForallIndexType,
|
|
12
|
-
ForallValuesType,
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@dataclass
|
|
17
|
-
class Evaluation:
|
|
18
|
-
"""Schema for results of evaluating solutions.
|
|
19
|
-
|
|
20
|
-
Attributes:
|
|
21
|
-
energy (List[float]): a list of values of energy.
|
|
22
|
-
objective (Optional[List[float]], optional): a list of values of objective function. Defaults to None.
|
|
23
|
-
constraint_violations (Optional[Dict[str, List[float]]], optional): a list of constraint violations. A key is the name of a constraint. A value is cost of a constraint. Defaults to None.
|
|
24
|
-
constraint_forall (Optional[ForallIndexType], optional): a list of indices of forall constraints. Defaults to None.
|
|
25
|
-
constraint_values (Optional[List[ForallValuesType]], optional): a list of values of forall constraints. Defaults to None.
|
|
26
|
-
penalty (Optional[Dict[str, List[float]]], optional): a list of costs of penalty terms. A key is the name of a penalty. A value is cost of a penalty term. Defaults to None.
|
|
27
|
-
"""
|
|
28
|
-
|
|
29
|
-
energy: Optional[List[float]] = None
|
|
30
|
-
objective: Optional[List[float]] = None
|
|
31
|
-
constraint_violations: Optional[Dict[str, List[float]]] = None
|
|
32
|
-
constraint_forall: Optional[ForallIndexType] = field(default=None, repr=False)
|
|
33
|
-
constraint_values: Optional[List[ForallValuesType]] = field(
|
|
34
|
-
default=None, repr=False
|
|
35
|
-
)
|
|
36
|
-
penalty: Optional[Dict[str, List[float]]] = None
|
|
37
|
-
|
|
38
|
-
def __post_init__(self):
|
|
39
|
-
self._current_index = 0
|
|
40
|
-
|
|
41
|
-
def __len__(self) -> int:
|
|
42
|
-
"""
|
|
43
|
-
Perform the operation __len__.
|
|
44
|
-
"""
|
|
45
|
-
if self.energy is None:
|
|
46
|
-
return 0
|
|
47
|
-
else:
|
|
48
|
-
return len(self.energy)
|
|
49
|
-
|
|
50
|
-
def __iter__(self):
|
|
51
|
-
return self
|
|
52
|
-
|
|
53
|
-
def __next__(self):
|
|
54
|
-
if self.energy is None:
|
|
55
|
-
raise StopIteration()
|
|
56
|
-
else:
|
|
57
|
-
if self._current_index == len(self.energy):
|
|
58
|
-
self._current_index = 0
|
|
59
|
-
raise StopIteration()
|
|
60
|
-
ret = self[self._current_index]
|
|
61
|
-
self._current_index += 1
|
|
62
|
-
return ret
|
|
63
|
-
|
|
64
|
-
def __getitem__(
|
|
65
|
-
self, item: Union[int, slice, List[int], Tuple[int], np.ndarray]
|
|
66
|
-
) -> Evaluation:
|
|
67
|
-
"""Perform the operation __getitem__.
|
|
68
|
-
|
|
69
|
-
Args:
|
|
70
|
-
item (Union[int, slice, List[int], Tuple[int], np.ndarray]): Index of evaluation metrics.
|
|
71
|
-
|
|
72
|
-
Returns:
|
|
73
|
-
Evaluation: Evaluation object.
|
|
74
|
-
"""
|
|
75
|
-
|
|
76
|
-
def _slice(start: int, stop: int, step: Optional[int] = None) -> Evaluation:
|
|
77
|
-
energy = None if self.energy is None else self.energy[start:stop:step]
|
|
78
|
-
objective = (
|
|
79
|
-
None if self.objective is None else self.objective[start:stop:step]
|
|
80
|
-
)
|
|
81
|
-
constraint_violations = (
|
|
82
|
-
None
|
|
83
|
-
if self.constraint_violations is None
|
|
84
|
-
else {
|
|
85
|
-
label: constraint_violations[start:stop:step]
|
|
86
|
-
for label, constraint_violations in self.constraint_violations.items()
|
|
87
|
-
}
|
|
88
|
-
)
|
|
89
|
-
constraint_values = (
|
|
90
|
-
None
|
|
91
|
-
if self.constraint_values is None
|
|
92
|
-
else self.constraint_values[start:stop:step]
|
|
93
|
-
)
|
|
94
|
-
penalty = (
|
|
95
|
-
None
|
|
96
|
-
if self.penalty is None
|
|
97
|
-
else {
|
|
98
|
-
label: penalty[start:stop:step]
|
|
99
|
-
for label, penalty in self.penalty.items()
|
|
100
|
-
}
|
|
101
|
-
)
|
|
102
|
-
|
|
103
|
-
return Evaluation(
|
|
104
|
-
energy=energy,
|
|
105
|
-
objective=objective,
|
|
106
|
-
constraint_violations=constraint_violations,
|
|
107
|
-
constraint_forall=self.constraint_forall,
|
|
108
|
-
constraint_values=constraint_values,
|
|
109
|
-
penalty=penalty,
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
if isinstance(item, int):
|
|
113
|
-
start, stop, step = item, item + 1, None
|
|
114
|
-
return _slice(start, stop, step)
|
|
115
|
-
elif isinstance(item, slice):
|
|
116
|
-
start, stop, step = item.start, item.stop, item.step
|
|
117
|
-
return _slice(start, stop, step)
|
|
118
|
-
elif isinstance(item, (list, tuple, np.ndarray)):
|
|
119
|
-
item = np.array(item) if len(item) else np.array([], dtype=int)
|
|
120
|
-
if item.dtype == int or item.dtype == bool:
|
|
121
|
-
energy = (
|
|
122
|
-
None
|
|
123
|
-
if self.energy is None
|
|
124
|
-
else np.array(self.energy)[item].tolist()
|
|
125
|
-
)
|
|
126
|
-
objective = (
|
|
127
|
-
None
|
|
128
|
-
if self.objective is None
|
|
129
|
-
else np.array(self.objective)[item].tolist()
|
|
130
|
-
)
|
|
131
|
-
constraint_violations = (
|
|
132
|
-
None
|
|
133
|
-
if self.constraint_violations is None
|
|
134
|
-
else {
|
|
135
|
-
label: np.array(constraint_violations)[item].tolist()
|
|
136
|
-
for label, constraint_violations in self.constraint_violations.items()
|
|
137
|
-
}
|
|
138
|
-
)
|
|
139
|
-
constraint_values = (
|
|
140
|
-
None
|
|
141
|
-
if self.constraint_values is None
|
|
142
|
-
else np.array(self.constraint_values)[item].tolist()
|
|
143
|
-
)
|
|
144
|
-
penalty = (
|
|
145
|
-
None
|
|
146
|
-
if self.penalty is None
|
|
147
|
-
else {
|
|
148
|
-
label: np.array(penalty)[item].tolist()
|
|
149
|
-
for label, penalty in self.penalty.items()
|
|
150
|
-
}
|
|
151
|
-
)
|
|
152
|
-
return Evaluation(
|
|
153
|
-
energy=energy,
|
|
154
|
-
objective=objective,
|
|
155
|
-
constraint_violations=constraint_violations,
|
|
156
|
-
constraint_forall=self.constraint_forall,
|
|
157
|
-
constraint_values=constraint_values,
|
|
158
|
-
penalty=penalty,
|
|
159
|
-
)
|
|
160
|
-
else:
|
|
161
|
-
raise IndexError(f'Element of "{item}" must be int or bool.')
|
|
162
|
-
else:
|
|
163
|
-
raise IndexError(
|
|
164
|
-
f'Type of index "{item}" must be int, slice, list[int], tuple[int, ...] or 1d numpy.ndarray.'
|
|
165
|
-
)
|
|
166
|
-
|
|
167
|
-
@property
|
|
168
|
-
def constraint_expr_values(self) -> List[ConstraintExpressionValuesType] | None:
|
|
169
|
-
"""
|
|
170
|
-
Values for each constraint. The values are stored in `Dict[Tuple[int, ...], float]` for each condition expanded by `forall`.
|
|
171
|
-
"""
|
|
172
|
-
if self.constraint_forall is None:
|
|
173
|
-
return None
|
|
174
|
-
if self.constraint_values is None:
|
|
175
|
-
return None
|
|
176
|
-
|
|
177
|
-
expr_values = []
|
|
178
|
-
for v in self.constraint_values:
|
|
179
|
-
expr_values.append(
|
|
180
|
-
{
|
|
181
|
-
const_name: {
|
|
182
|
-
tuple(i): vi
|
|
183
|
-
for i, vi in zip(
|
|
184
|
-
self.constraint_forall[const_name], v[const_name]
|
|
185
|
-
)
|
|
186
|
-
}
|
|
187
|
-
for const_name in self.constraint_forall
|
|
188
|
-
}
|
|
189
|
-
)
|
|
190
|
-
return expr_values
|
|
191
|
-
|
|
192
|
-
def to_pandas_dataframe(self) -> pd.DataFrame:
|
|
193
|
-
"""Convert Evaluation object to pandas.DataFrame object.
|
|
194
|
-
|
|
195
|
-
Returns:
|
|
196
|
-
pandas.DataFrame: pandas.DataFrame object.
|
|
197
|
-
"""
|
|
198
|
-
|
|
199
|
-
evaluation = asdict(self)
|
|
200
|
-
|
|
201
|
-
if evaluation["constraint_violations"]:
|
|
202
|
-
constraint_violations = {
|
|
203
|
-
f"constraint_violation[{k}]": v
|
|
204
|
-
for k, v in evaluation.pop("constraint_violations").items()
|
|
205
|
-
}
|
|
206
|
-
else:
|
|
207
|
-
constraint_violations = {}
|
|
208
|
-
del evaluation["constraint_violations"]
|
|
209
|
-
evaluation.update(constraint_violations)
|
|
210
|
-
evaluation["constraint_forall"] = [self.constraint_forall] * len(self)
|
|
211
|
-
|
|
212
|
-
if self.penalty:
|
|
213
|
-
penalty = {f"penalty[{k}]": v for k, v in evaluation.pop("penalty").items()}
|
|
214
|
-
else:
|
|
215
|
-
penalty = {}
|
|
216
|
-
del evaluation["penalty"]
|
|
217
|
-
evaluation.update(penalty)
|
|
218
|
-
|
|
219
|
-
return pd.DataFrame(evaluation)
|
|
220
|
-
|
|
221
|
-
@classmethod
|
|
222
|
-
def from_serializable(cls, obj: dict):
|
|
223
|
-
"""To Evaluation object from Dict of SampleSet.
|
|
224
|
-
|
|
225
|
-
Args:
|
|
226
|
-
obj (Dict): Dict of Evaluation.
|
|
227
|
-
|
|
228
|
-
Returns:
|
|
229
|
-
Evaluation: Evaluation obj.
|
|
230
|
-
"""
|
|
231
|
-
|
|
232
|
-
return cls(
|
|
233
|
-
energy=obj.get("energy"),
|
|
234
|
-
objective=obj.get("objective"),
|
|
235
|
-
constraint_violations=obj.get("constraint_violations"),
|
|
236
|
-
constraint_forall=obj.get("constraint_forall"),
|
|
237
|
-
constraint_values=obj.get("constraint_values"),
|
|
238
|
-
penalty=obj.get("penalty"),
|
|
239
|
-
)
|
|
240
|
-
|
|
241
|
-
def to_serializable(self):
|
|
242
|
-
return asdict(self)
|
|
243
|
-
|
|
244
|
-
def _extend(self, other: Evaluation):
|
|
245
|
-
if isinstance(other.energy, list):
|
|
246
|
-
# Concatenate energy
|
|
247
|
-
if self.energy is None:
|
|
248
|
-
self.energy = other.energy
|
|
249
|
-
else:
|
|
250
|
-
self.energy.extend(other.energy)
|
|
251
|
-
|
|
252
|
-
# Concatenate objective
|
|
253
|
-
if isinstance(other.objective, list):
|
|
254
|
-
if self.objective is None:
|
|
255
|
-
self.objective = other.objective
|
|
256
|
-
else:
|
|
257
|
-
self.objective.extend(other.objective)
|
|
258
|
-
|
|
259
|
-
# Concatenate constraint_violations
|
|
260
|
-
if isinstance(other.constraint_violations, dict):
|
|
261
|
-
if self.constraint_violations is None:
|
|
262
|
-
self.constraint_violations = other.constraint_violations
|
|
263
|
-
else:
|
|
264
|
-
for (
|
|
265
|
-
con_label,
|
|
266
|
-
constraint_violation,
|
|
267
|
-
) in other.constraint_violations.items():
|
|
268
|
-
self.constraint_violations[con_label].extend(constraint_violation)
|
|
269
|
-
|
|
270
|
-
# Overwrite constraint_forall
|
|
271
|
-
# Since SampleSet assumes that it does not contain solutions for different problem or instance data,
|
|
272
|
-
# the index of forall constraints (constraint_forall) are the same between the original SampleSet(self)
|
|
273
|
-
# and combined SampleSet(other)."
|
|
274
|
-
if isinstance(other.constraint_forall, dict):
|
|
275
|
-
self.constraint_forall = other.constraint_forall
|
|
276
|
-
|
|
277
|
-
if isinstance(other.constraint_values, list):
|
|
278
|
-
if self.constraint_values is None:
|
|
279
|
-
self.constraint_values = other.constraint_values
|
|
280
|
-
else:
|
|
281
|
-
self.constraint_values.extend(other.constraint_values)
|
|
282
|
-
|
|
283
|
-
# Concatenate penalty
|
|
284
|
-
if isinstance(other.penalty, dict):
|
|
285
|
-
if self.penalty is None:
|
|
286
|
-
self.penalty = other.penalty
|
|
287
|
-
else:
|
|
288
|
-
for pane_label, pena in other.penalty.items():
|
|
289
|
-
self.penalty[pane_label].extend(pena)
|
|
@@ -1,59 +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
|
-
from jijmodeling.sampleset.solving_time import SolvingTime
|
|
8
|
-
from jijmodeling.sampleset.system_time import SystemTime
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
@dataclass
|
|
12
|
-
class MeasuringTime:
|
|
13
|
-
"""Schema for measuring time.
|
|
14
|
-
|
|
15
|
-
Attributes:
|
|
16
|
-
solve (Optional[SolvingTime], optional): Instance of SolvingTime. This means solver running time. Defaults to None.
|
|
17
|
-
system (Optional[SystemTime], optional): Instance of SystemTime. This means time about jijzept system. Defaults to None.
|
|
18
|
-
total (Optional[float], optional): Total time from submitting problem to obtaining solution. Defaults to None.
|
|
19
|
-
"""
|
|
20
|
-
|
|
21
|
-
solve: Optional[SolvingTime] = None
|
|
22
|
-
system: Optional[SystemTime] = None
|
|
23
|
-
total: Optional[float] = None
|
|
24
|
-
|
|
25
|
-
def __post_init__(self):
|
|
26
|
-
if self.solve is None:
|
|
27
|
-
self.solve = SolvingTime()
|
|
28
|
-
if self.system is None:
|
|
29
|
-
self.system = SystemTime()
|
|
30
|
-
|
|
31
|
-
@classmethod
|
|
32
|
-
def from_serializable(cls, obj: Dict):
|
|
33
|
-
"""To MeasuringTime object from Dict of SampleSet.
|
|
34
|
-
|
|
35
|
-
Args:
|
|
36
|
-
obj (Dict): Dict of MeasuringTime.
|
|
37
|
-
|
|
38
|
-
Returns:
|
|
39
|
-
MeasuringTime: MeasuringTime obj.
|
|
40
|
-
"""
|
|
41
|
-
|
|
42
|
-
for key in ["solve", "system", "total"]:
|
|
43
|
-
if key not in obj.keys():
|
|
44
|
-
raise SerializeSampleSetError(f'"obj" does not contain "{key}" key')
|
|
45
|
-
|
|
46
|
-
if obj["solve"] is None:
|
|
47
|
-
solving_time = None
|
|
48
|
-
else:
|
|
49
|
-
solving_time = SolvingTime.from_serializable(obj["solve"])
|
|
50
|
-
|
|
51
|
-
if obj["system"] is None:
|
|
52
|
-
system_time = None
|
|
53
|
-
else:
|
|
54
|
-
system_time = SystemTime.from_serializable(obj["system"])
|
|
55
|
-
return cls(
|
|
56
|
-
solve=solving_time,
|
|
57
|
-
system=system_time,
|
|
58
|
-
total=obj["total"],
|
|
59
|
-
)
|
jijmodeling/sampleset/record.py
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from dataclasses import dataclass
|
|
4
|
-
from typing import Dict, List, Tuple, Union
|
|
5
|
-
|
|
6
|
-
import numpy as np
|
|
7
|
-
import pandas as pd
|
|
8
|
-
|
|
9
|
-
from jijmodeling.exceptions import SerializeSampleSetError
|
|
10
|
-
from jijmodeling.type_annotations import DenseSolution, SparseSolution
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
@dataclass
|
|
14
|
-
class Record:
|
|
15
|
-
"""Represents the Schema for solutions obtained by a solver.
|
|
16
|
-
|
|
17
|
-
Attributes:
|
|
18
|
-
solution (Dict[str, Union[List[SparseSolution], List[DenseSolution]]]): Solution. A key is the label of a decision variable. There are two type in value:
|
|
19
|
-
- SparseSolution is tuple of length 3, where each element means (nonzero index, nonzero value, shape) for solution.
|
|
20
|
-
- DenseSolution is numpy.ndarray which dimension is shape of decision variable.
|
|
21
|
-
num_occurrences (List[int]): Number of occurrences for each sample.
|
|
22
|
-
"""
|
|
23
|
-
|
|
24
|
-
solution: Dict[str, Union[List[SparseSolution], List[DenseSolution]]]
|
|
25
|
-
num_occurrences: List[int]
|
|
26
|
-
|
|
27
|
-
def __post_init__(self):
|
|
28
|
-
self._is_dense = False
|
|
29
|
-
self._current_index = 0
|
|
30
|
-
|
|
31
|
-
def __len__(self) -> int:
|
|
32
|
-
"""
|
|
33
|
-
Perform the operation __len__.
|
|
34
|
-
"""
|
|
35
|
-
return len(self.num_occurrences)
|
|
36
|
-
|
|
37
|
-
def __iter__(self):
|
|
38
|
-
return self
|
|
39
|
-
|
|
40
|
-
def __next__(self):
|
|
41
|
-
if self._current_index == len(self):
|
|
42
|
-
self._current_index = 0
|
|
43
|
-
raise StopIteration()
|
|
44
|
-
ret = self[self._current_index]
|
|
45
|
-
self._current_index += 1
|
|
46
|
-
return ret
|
|
47
|
-
|
|
48
|
-
def __getitem__(
|
|
49
|
-
self, item: Union[int, slice, List[int], Tuple[int], np.ndarray]
|
|
50
|
-
) -> Record:
|
|
51
|
-
"""Perform the operation __getitem__.
|
|
52
|
-
|
|
53
|
-
Args:
|
|
54
|
-
item (Union[int, slice, List[int], Tuple[int], np.ndarray]): Index of solution and num_occurrences.
|
|
55
|
-
|
|
56
|
-
Returns:
|
|
57
|
-
Record: Record object.
|
|
58
|
-
"""
|
|
59
|
-
|
|
60
|
-
if isinstance(item, int):
|
|
61
|
-
start, stop, step = item, item + 1, None
|
|
62
|
-
solution = {
|
|
63
|
-
label: solution[start:stop:step]
|
|
64
|
-
for label, solution in self.solution.items()
|
|
65
|
-
}
|
|
66
|
-
return Record(
|
|
67
|
-
solution=solution,
|
|
68
|
-
num_occurrences=self.num_occurrences[start:stop:step],
|
|
69
|
-
)
|
|
70
|
-
elif isinstance(item, slice):
|
|
71
|
-
start, stop, step = item.start, item.stop, item.step
|
|
72
|
-
solution = {
|
|
73
|
-
label: solution[start:stop:step]
|
|
74
|
-
for label, solution in self.solution.items()
|
|
75
|
-
}
|
|
76
|
-
return Record(
|
|
77
|
-
solution=solution,
|
|
78
|
-
num_occurrences=self.num_occurrences[start:stop:step],
|
|
79
|
-
)
|
|
80
|
-
elif isinstance(item, (list, tuple, np.ndarray)):
|
|
81
|
-
item = np.array(item) if len(item) else np.array([], dtype=int)
|
|
82
|
-
if item.dtype == int or item.dtype == bool:
|
|
83
|
-
index = np.arange(len(item))[item] if item.dtype == bool else item
|
|
84
|
-
solution = {
|
|
85
|
-
label: [solution[i] for i in index]
|
|
86
|
-
for label, solution in self.solution.items()
|
|
87
|
-
}
|
|
88
|
-
num_occurrences = np.array(self.num_occurrences)[item].tolist()
|
|
89
|
-
return Record(solution=solution, num_occurrences=num_occurrences)
|
|
90
|
-
else:
|
|
91
|
-
raise IndexError(f'Element of "{item}" must be int or bool.')
|
|
92
|
-
else:
|
|
93
|
-
raise IndexError(
|
|
94
|
-
f'Type of index "{item}" must be one of int or slice or List[int] or Tuple[int] or 1d numpy.ndarray.'
|
|
95
|
-
)
|
|
96
|
-
|
|
97
|
-
@property
|
|
98
|
-
def is_dense(self) -> bool:
|
|
99
|
-
"""SparseSolution or DenseSolution:
|
|
100
|
-
- If True, DenseSolution,
|
|
101
|
-
- Else, SparseSolution.
|
|
102
|
-
|
|
103
|
-
Returns:
|
|
104
|
-
bool: True or False.
|
|
105
|
-
"""
|
|
106
|
-
return self._is_dense
|
|
107
|
-
|
|
108
|
-
@is_dense.setter
|
|
109
|
-
def is_dense(self, b: bool):
|
|
110
|
-
self._is_dense = b
|
|
111
|
-
|
|
112
|
-
@classmethod
|
|
113
|
-
def from_serializable(cls, obj: Dict):
|
|
114
|
-
"""To Record object from Dict of SampleSet.
|
|
115
|
-
|
|
116
|
-
Args:
|
|
117
|
-
obj (Dict): Dict of Record.
|
|
118
|
-
|
|
119
|
-
Returns:
|
|
120
|
-
Record: Record obj.
|
|
121
|
-
"""
|
|
122
|
-
|
|
123
|
-
for key in ["solution", "num_occurrences"]:
|
|
124
|
-
if key not in obj.keys():
|
|
125
|
-
raise SerializeSampleSetError(f'"obj" does not contain "{key}" key')
|
|
126
|
-
return cls(**obj)
|
|
127
|
-
|
|
128
|
-
def to_pandas_dataframe(self) -> pd.DataFrame:
|
|
129
|
-
"""Convert Record object to pandas.DataFrame object.
|
|
130
|
-
|
|
131
|
-
Returns:
|
|
132
|
-
pandas.DataFrame: pandas.DataFrame object.
|
|
133
|
-
"""
|
|
134
|
-
solution = pd.DataFrame({f"solution[{k}]": v for k, v in self.solution.items()})
|
|
135
|
-
num_occurrences = pd.DataFrame({"num_occurrences": self.num_occurrences})
|
|
136
|
-
return pd.concat([solution, num_occurrences], axis=1)
|
|
137
|
-
|
|
138
|
-
def to_dense(self, inplace: bool = False):
|
|
139
|
-
solution = {}
|
|
140
|
-
for label, si in self.solution.items():
|
|
141
|
-
array_list = []
|
|
142
|
-
for nonzero_index, values, shape in si:
|
|
143
|
-
array = np.zeros(shape)
|
|
144
|
-
if array.ndim:
|
|
145
|
-
array[nonzero_index] = values
|
|
146
|
-
else:
|
|
147
|
-
array = np.array(values or 0)
|
|
148
|
-
array_list.append(array)
|
|
149
|
-
solution[label] = array_list
|
|
150
|
-
if inplace:
|
|
151
|
-
self.solution = solution
|
|
152
|
-
self._solution_type = DenseSolution
|
|
153
|
-
return Record(solution=solution, num_occurrences=self.num_occurrences)
|
|
154
|
-
|
|
155
|
-
def _extend(self, other):
|
|
156
|
-
for var_label, solution in other.solution.items():
|
|
157
|
-
self.solution[var_label].extend(solution)
|
|
158
|
-
self.num_occurrences.extend(other.num_occurrences)
|