jijmodeling 0.10.18__cp310-cp310-win_amd64.whl → 1.11.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 -148
- 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.11.0.dist-info/METADATA +235 -0
- jijmodeling-1.11.0.dist-info/RECORD +18 -0
- {jijmodeling-0.10.18.dist-info → jijmodeling-1.11.0.dist-info}/WHEEL +1 -2
- {jijmodeling-0.10.18.dist-info → jijmodeling-1.11.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/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 -74
- 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 -362
- jijmodeling/expression/constraint.py +0 -340
- jijmodeling/expression/expression.py +0 -706
- jijmodeling/expression/extract.py +0 -139
- jijmodeling/expression/from_old_serializable.py +0 -133
- jijmodeling/expression/mathfunc.py +0 -269
- jijmodeling/expression/prod.py +0 -117
- jijmodeling/expression/serializable.py +0 -132
- jijmodeling/expression/sum.py +0 -197
- jijmodeling/expression/type_annotations.py +0 -50
- jijmodeling/expression/utils.py +0 -201
- jijmodeling/expression/variables/__init__.py +0 -35
- 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 -136
- jijmodeling/expression/variables/jagged_array.py +0 -73
- jijmodeling/expression/variables/placeholders.py +0 -107
- jijmodeling/expression/variables/variable.py +0 -485
- 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 -209
- 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__/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/expr_same.py +0 -32
- jijmodeling/match/is_same_expr.py +0 -304
- jijmodeling/match/penalty_same.py +0 -31
- jijmodeling/match/problem_same.py +0 -44
- jijmodeling/match/replace.py +0 -210
- 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 -166
- 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/from_protobuf/__init__.py +0 -47
- jijmodeling/protobuf/from_protobuf/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/__init__.cpython-310.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/extract_attribute_value_from_header.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/extract_attribute_value_from_header.cpython-310.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/from_protobuf.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/from_protobuf.cpython-310.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_array_shape.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_array_shape.cpython-310.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_binary_op.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_binary_op.cpython-310.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_binary_var.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_binary_var.cpython-310.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_constraint.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_constraint.cpython-310.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_element.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_element.cpython-310.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_expression.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_expression.cpython-310.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_forall.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_forall.cpython-310.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_integer_var.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_integer_var.cpython-310.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_jagged_array.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_jagged_array.cpython-310.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_number_lit.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_number_lit.cpython-310.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_penalty.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_penalty.cpython-310.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_placeholder.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_placeholder.cpython-310.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_problem.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_problem.cpython-310.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_reduction_op.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_reduction_op.cpython-310.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_subscript_op.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_subscript_op.cpython-310.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_unary_op.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/__pycache__/message_to_unary_op.cpython-310.pyc +0 -0
- jijmodeling/protobuf/from_protobuf/extract_attribute_value_from_header.py +0 -26
- jijmodeling/protobuf/from_protobuf/from_protobuf.py +0 -38
- jijmodeling/protobuf/from_protobuf/message_to_array_shape.py +0 -35
- jijmodeling/protobuf/from_protobuf/message_to_binary_op.py +0 -83
- jijmodeling/protobuf/from_protobuf/message_to_binary_var.py +0 -46
- jijmodeling/protobuf/from_protobuf/message_to_constraint.py +0 -48
- jijmodeling/protobuf/from_protobuf/message_to_element.py +0 -30
- jijmodeling/protobuf/from_protobuf/message_to_expression.py +0 -92
- jijmodeling/protobuf/from_protobuf/message_to_forall.py +0 -33
- jijmodeling/protobuf/from_protobuf/message_to_integer_var.py +0 -54
- jijmodeling/protobuf/from_protobuf/message_to_jagged_array.py +0 -25
- jijmodeling/protobuf/from_protobuf/message_to_number_lit.py +0 -41
- jijmodeling/protobuf/from_protobuf/message_to_penalty.py +0 -36
- jijmodeling/protobuf/from_protobuf/message_to_placeholder.py +0 -47
- jijmodeling/protobuf/from_protobuf/message_to_problem.py +0 -51
- jijmodeling/protobuf/from_protobuf/message_to_reduction_op.py +0 -52
- jijmodeling/protobuf/from_protobuf/message_to_subscript_op.py +0 -46
- jijmodeling/protobuf/from_protobuf/message_to_unary_op.py +0 -47
- jijmodeling/protobuf/to_protobuf/__init__.py +0 -43
- jijmodeling/protobuf/to_protobuf/__pycache__/__init__.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/__init__.cpython-310.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/add_header_to_message.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/add_header_to_message.cpython-310.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/array_shape_to_message.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/array_shape_to_message.cpython-310.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/binary_op_to_message.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/binary_op_to_message.cpython-310.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/binary_var_to_message.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/binary_var_to_message.cpython-310.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/constraint_to_message.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/constraint_to_message.cpython-310.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/element_to_message.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/element_to_message.cpython-310.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/expression_to_message.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/expression_to_message.cpython-310.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/forall_to_message.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/forall_to_message.cpython-310.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/integer_var_to_message.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/integer_var_to_message.cpython-310.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/jagged_array_to_message.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/jagged_array_to_message.cpython-310.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/number_lit_to_message.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/number_lit_to_message.cpython-310.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/penalty_to_message.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/penalty_to_message.cpython-310.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/placeholder_to_message.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/placeholder_to_message.cpython-310.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/problem_to_message.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/problem_to_message.cpython-310.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/reduction_op_to_message.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/reduction_op_to_message.cpython-310.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/subscript_op_to_message.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/subscript_op_to_message.cpython-310.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/to_protobuf.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/to_protobuf.cpython-310.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/unary_op_to_message.cpython-310.opt-1.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/__pycache__/unary_op_to_message.cpython-310.pyc +0 -0
- jijmodeling/protobuf/to_protobuf/add_header_to_message.py +0 -35
- jijmodeling/protobuf/to_protobuf/array_shape_to_message.py +0 -43
- jijmodeling/protobuf/to_protobuf/binary_op_to_message.py +0 -101
- jijmodeling/protobuf/to_protobuf/binary_var_to_message.py +0 -49
- jijmodeling/protobuf/to_protobuf/constraint_to_message.py +0 -52
- jijmodeling/protobuf/to_protobuf/element_to_message.py +0 -43
- jijmodeling/protobuf/to_protobuf/expression_to_message.py +0 -89
- jijmodeling/protobuf/to_protobuf/forall_to_message.py +0 -32
- jijmodeling/protobuf/to_protobuf/integer_var_to_message.py +0 -54
- jijmodeling/protobuf/to_protobuf/jagged_array_to_message.py +0 -37
- jijmodeling/protobuf/to_protobuf/number_lit_to_message.py +0 -52
- jijmodeling/protobuf/to_protobuf/penalty_to_message.py +0 -42
- jijmodeling/protobuf/to_protobuf/placeholder_to_message.py +0 -58
- jijmodeling/protobuf/to_protobuf/problem_to_message.py +0 -54
- jijmodeling/protobuf/to_protobuf/reduction_op_to_message.py +0 -64
- jijmodeling/protobuf/to_protobuf/subscript_op_to_message.py +0 -48
- jijmodeling/protobuf/to_protobuf/to_protobuf.py +0 -36
- jijmodeling/protobuf/to_protobuf/unary_op_to_message.py +0 -58
- 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 -288
- jijmodeling/sampleset/measuring_time.py +0 -59
- jijmodeling/sampleset/record.py +0 -158
- jijmodeling/sampleset/sampleset.py +0 -379
- 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__/utils.cpython-310.opt-1.pyc +0 -0
- jijmodeling/utils/__pycache__/utils.cpython-310.pyc +0 -0
- jijmodeling/utils/utils.py +0 -146
- jijmodeling-0.10.18.dist-info/METADATA +0 -60
- jijmodeling-0.10.18.dist-info/RECORD +0 -258
- jijmodeling-0.10.18.dist-info/top_level.txt +0 -1
jijmodeling/problem/problem.py
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import copy as _copy
|
|
4
|
-
import enum as _enum
|
|
5
|
-
import typing as tp
|
|
6
|
-
|
|
7
|
-
import typeguard as _typeguard
|
|
8
|
-
|
|
9
|
-
import jijmodeling.exceptions.exceptions as _exceptions
|
|
10
|
-
import jijmodeling.expression.constraint as _constraint
|
|
11
|
-
import jijmodeling.expression.expression as _expression
|
|
12
|
-
import jijmodeling.expression.serializable as _serializable
|
|
13
|
-
import jijmodeling.expression.utils as _utils
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class ProblemSense(_enum.Enum):
|
|
17
|
-
MINIMUM = "MINIMUM"
|
|
18
|
-
MAXIMUM = "MAXIMUM"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class Problem(metaclass=_serializable.Serializable):
|
|
22
|
-
"""
|
|
23
|
-
Optimization problem.
|
|
24
|
-
|
|
25
|
-
Attributes:
|
|
26
|
-
name (str): name of problem.
|
|
27
|
-
model (Optional[Expression]): total optimization model.
|
|
28
|
-
constraints (Dict[str, Constraint]): constraint objects of problem.
|
|
29
|
-
penalties (Dict[str, Constraint]): penalty objects of problem.
|
|
30
|
-
cost (Expression): cost term of problem. Defaults zero.
|
|
31
|
-
"""
|
|
32
|
-
|
|
33
|
-
def __init__(
|
|
34
|
-
self,
|
|
35
|
-
name: str,
|
|
36
|
-
sense: tp.Union[ProblemSense, str] = ProblemSense.MINIMUM,
|
|
37
|
-
objective: _expression.Expression = _expression.Number(0),
|
|
38
|
-
constraints: tp.Dict[str, _constraint.Constraint] = {},
|
|
39
|
-
penalties: tp.Dict[str, _constraint.Penalty] = {},
|
|
40
|
-
) -> None:
|
|
41
|
-
"""
|
|
42
|
-
Initialize
|
|
43
|
-
|
|
44
|
-
Args:
|
|
45
|
-
problem_name (str): problem name
|
|
46
|
-
kind (ProblemKind): problem kind Minimum or Maximum
|
|
47
|
-
objective (Expression): objective
|
|
48
|
-
constraints (Dict[str, Constraint]): dict of constraints
|
|
49
|
-
penalties (Dict[str, Penalty]): dict of penalties
|
|
50
|
-
"""
|
|
51
|
-
self._name = name
|
|
52
|
-
self._sense = ProblemSense(sense)
|
|
53
|
-
# deepcopy to avoid having the same reference
|
|
54
|
-
self._objective = _copy.deepcopy(objective)
|
|
55
|
-
self._constraints: tp.Dict[str, _constraint.Constraint] = _copy.deepcopy(
|
|
56
|
-
constraints
|
|
57
|
-
)
|
|
58
|
-
self._penalties: tp.Dict[str, _constraint.Penalty] = _copy.deepcopy(penalties)
|
|
59
|
-
|
|
60
|
-
_typeguard.check_type("self._name", self._name, str)
|
|
61
|
-
_typeguard.check_type("self._sense", self._sense, ProblemSense)
|
|
62
|
-
_typeguard.check_type(
|
|
63
|
-
"self._constraints", self._constraints, tp.Dict[str, _constraint.Constraint]
|
|
64
|
-
)
|
|
65
|
-
_typeguard.check_type(
|
|
66
|
-
"self._penalties", self._penalties, tp.Dict[str, _constraint.Penalty]
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
@property
|
|
70
|
-
def name(self) -> str:
|
|
71
|
-
return self._name
|
|
72
|
-
|
|
73
|
-
@property
|
|
74
|
-
def sense(self) -> ProblemSense:
|
|
75
|
-
return self._sense
|
|
76
|
-
|
|
77
|
-
@property
|
|
78
|
-
def objective(self) -> _expression.Expression:
|
|
79
|
-
return self._objective
|
|
80
|
-
|
|
81
|
-
@property
|
|
82
|
-
def constraints(self) -> tp.Dict[str, _constraint.Constraint]:
|
|
83
|
-
return self._constraints
|
|
84
|
-
|
|
85
|
-
@property
|
|
86
|
-
def penalties(self) -> tp.Dict[str, _constraint.Penalty]:
|
|
87
|
-
return self._penalties
|
|
88
|
-
|
|
89
|
-
def add(
|
|
90
|
-
self,
|
|
91
|
-
other: tp.Union[
|
|
92
|
-
_expression.Expression, _constraint.Constraint, _constraint.Penalty
|
|
93
|
-
],
|
|
94
|
-
):
|
|
95
|
-
"""
|
|
96
|
-
Add expression, constraint or penalty to problem.
|
|
97
|
-
|
|
98
|
-
Args:
|
|
99
|
-
other (Expression): expression
|
|
100
|
-
|
|
101
|
-
Examples:
|
|
102
|
-
```python
|
|
103
|
-
>>> import jijmodeling as jm
|
|
104
|
-
>>> d = jm.Placeholder("d", dim=1)
|
|
105
|
-
>>> n = d.shape[0]
|
|
106
|
-
>>> i = jm.Element("i", n)
|
|
107
|
-
>>> x = jm.Binary("x", shape=(n,))
|
|
108
|
-
>>> problem = jm.Problem("sample")
|
|
109
|
-
>>> problem.add(x[:]) # add cost
|
|
110
|
-
>>> problem.add(jm.Constraint("onehot", x[:] == 1)) # add constraint
|
|
111
|
-
>>> problem.add(jm.Penalty("penalty", x[0] + x[2])) # add penalty
|
|
112
|
-
>>> problem += x[:] # syntax sugar `+=`
|
|
113
|
-
>>> problem += jm.Constraint("onehot", jm.Sum(i, d[i]*x[i]) <= 3)
|
|
114
|
-
```
|
|
115
|
-
"""
|
|
116
|
-
if not isinstance(
|
|
117
|
-
other,
|
|
118
|
-
(
|
|
119
|
-
int,
|
|
120
|
-
float,
|
|
121
|
-
_expression.Expression,
|
|
122
|
-
_constraint.Constraint,
|
|
123
|
-
_constraint.Penalty,
|
|
124
|
-
),
|
|
125
|
-
):
|
|
126
|
-
raise TypeError(f"could not add {type(other)} to Problem.")
|
|
127
|
-
# extract constraints
|
|
128
|
-
if isinstance(other, _expression.Expression):
|
|
129
|
-
# check index dependencies
|
|
130
|
-
indices = _utils.expression_indices(other)
|
|
131
|
-
if len(indices) > 0:
|
|
132
|
-
raise _exceptions.ModelingError(
|
|
133
|
-
"{} depends on {}. The dependence on subscripts needs to be eliminated.".format(
|
|
134
|
-
other, indices
|
|
135
|
-
)
|
|
136
|
-
)
|
|
137
|
-
self._objective += other
|
|
138
|
-
elif isinstance(other, _constraint.Constraint):
|
|
139
|
-
# TODO CHECK CONSTRAINT SUBSCRIPTION DEPENDENCES
|
|
140
|
-
self._constraints[other.label] = other
|
|
141
|
-
elif isinstance(other, _constraint.Penalty):
|
|
142
|
-
# check index dependencies
|
|
143
|
-
term = other.penalty_term
|
|
144
|
-
indices = _utils.expression_indices(term)
|
|
145
|
-
if len(indices) > len(other.forall):
|
|
146
|
-
raise _exceptions.ModelingError(
|
|
147
|
-
"{} depends on {}. The dependence on subscripts needs to be eliminated.".format(
|
|
148
|
-
term, indices
|
|
149
|
-
)
|
|
150
|
-
)
|
|
151
|
-
self._penalties[other.label] = other
|
|
152
|
-
|
|
153
|
-
def __add__(
|
|
154
|
-
self,
|
|
155
|
-
other: tp.Union[
|
|
156
|
-
_expression.Expression, _constraint.Constraint, _constraint.Penalty
|
|
157
|
-
],
|
|
158
|
-
) -> Problem:
|
|
159
|
-
self.add(other)
|
|
160
|
-
return self
|
|
161
|
-
|
|
162
|
-
def _repr_latex_(self) -> str:
|
|
163
|
-
from jijmodeling.latex_repr.problem_latex_repr import problem_latex_repr
|
|
164
|
-
|
|
165
|
-
latex_repr = problem_latex_repr(self)
|
|
166
|
-
return r"$$\begin{alignat*}{4}" + latex_repr + r"\end{alignat*}$$"
|
jijmodeling/protobuf/__init__.py
DELETED
|
Binary file
|
|
Binary file
|
|
@@ -1,47 +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.protobuf.from_protobuf.extract_attribute_value_from_header as extract_attribute_value_from_header
|
|
8
|
-
import jijmodeling.protobuf.from_protobuf.from_protobuf as from_protobuf
|
|
9
|
-
import jijmodeling.protobuf.from_protobuf.message_to_array_shape as message_to_array_shape
|
|
10
|
-
import jijmodeling.protobuf.from_protobuf.message_to_binary_op as message_to_binary_op
|
|
11
|
-
import jijmodeling.protobuf.from_protobuf.message_to_binary_var as message_to_binary_var
|
|
12
|
-
import jijmodeling.protobuf.from_protobuf.message_to_constraint as message_to_constraint
|
|
13
|
-
import jijmodeling.protobuf.from_protobuf.message_to_element as message_to_element
|
|
14
|
-
import jijmodeling.protobuf.from_protobuf.message_to_expression as message_to_expression
|
|
15
|
-
import jijmodeling.protobuf.from_protobuf.message_to_forall as message_to_forall
|
|
16
|
-
import jijmodeling.protobuf.from_protobuf.message_to_integer_var as message_to_integer_var
|
|
17
|
-
import jijmodeling.protobuf.from_protobuf.message_to_jagged_array as message_to_jagged_array
|
|
18
|
-
import jijmodeling.protobuf.from_protobuf.message_to_number_lit as message_to_number_lit
|
|
19
|
-
import jijmodeling.protobuf.from_protobuf.message_to_penalty as message_to_penalty
|
|
20
|
-
import jijmodeling.protobuf.from_protobuf.message_to_placeholder as message_to_placeholder
|
|
21
|
-
import jijmodeling.protobuf.from_protobuf.message_to_problem as message_to_problem
|
|
22
|
-
import jijmodeling.protobuf.from_protobuf.message_to_reduction_op as message_to_reduction_op
|
|
23
|
-
import jijmodeling.protobuf.from_protobuf.message_to_subscript_op as message_to_subscript_op
|
|
24
|
-
import jijmodeling.protobuf.from_protobuf.message_to_unary_op as message_to_unary_op
|
|
25
|
-
|
|
26
|
-
# from jijmodeling.protobuf.from_protobuf.from_protobuf import from_protobuf
|
|
27
|
-
|
|
28
|
-
__all__ = [
|
|
29
|
-
"extract_attribute_value_from_header",
|
|
30
|
-
"from_protobuf",
|
|
31
|
-
"message_to_array_shape",
|
|
32
|
-
"message_to_binary_op",
|
|
33
|
-
"message_to_binary_var",
|
|
34
|
-
"message_to_constraint",
|
|
35
|
-
"message_to_element",
|
|
36
|
-
"message_to_expression",
|
|
37
|
-
"message_to_forall",
|
|
38
|
-
"message_to_integer_var",
|
|
39
|
-
"message_to_jagged_array",
|
|
40
|
-
"message_to_number_lit",
|
|
41
|
-
"message_to_penalty",
|
|
42
|
-
"message_to_placeholder",
|
|
43
|
-
"message_to_problem",
|
|
44
|
-
"message_to_reduction_op",
|
|
45
|
-
"message_to_subscript_op",
|
|
46
|
-
"message_to_unary_op",
|
|
47
|
-
]
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
jijmodeling/protobuf/from_protobuf/__pycache__/extract_attribute_value_from_header.cpython-310.pyc
DELETED
|
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
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
jijmodeling/protobuf/from_protobuf/__pycache__/message_to_jagged_array.cpython-310.opt-1.pyc
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
jijmodeling/protobuf/from_protobuf/__pycache__/message_to_reduction_op.cpython-310.opt-1.pyc
DELETED
|
Binary file
|
|
Binary file
|
jijmodeling/protobuf/from_protobuf/__pycache__/message_to_subscript_op.cpython-310.opt-1.pyc
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import Union
|
|
4
|
-
|
|
5
|
-
import jijmodeling_schema as pb
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def extract_attribute_value_from_header(
|
|
9
|
-
bytes: bytes,
|
|
10
|
-
) -> Union[pb.Problem, pb.Expression]:
|
|
11
|
-
"""
|
|
12
|
-
Extract the attribute value from a header messsage.
|
|
13
|
-
|
|
14
|
-
Args:
|
|
15
|
-
bytes (bytes): a bytes object that can be decoded in the `Header` message
|
|
16
|
-
|
|
17
|
-
Returns:
|
|
18
|
-
Union[pb.Problem, pb.Expression]: an instance object of either `Problem` message class or `Expression` message class
|
|
19
|
-
"""
|
|
20
|
-
# Convert the bytes object into the `Header` message object.
|
|
21
|
-
header = pb.Header.FromString(bytes)
|
|
22
|
-
|
|
23
|
-
# Extract the attribute value from the header message.
|
|
24
|
-
attribute_value = pb.betterproto.which_one_of(header.value, "value")[1]
|
|
25
|
-
|
|
26
|
-
return attribute_value
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import Union
|
|
4
|
-
|
|
5
|
-
import jijmodeling_schema as pb
|
|
6
|
-
|
|
7
|
-
from jijmodeling.expression.expression import Expression
|
|
8
|
-
from jijmodeling.problem.problem import Problem
|
|
9
|
-
from jijmodeling.protobuf.from_protobuf.extract_attribute_value_from_header import (
|
|
10
|
-
extract_attribute_value_from_header,
|
|
11
|
-
)
|
|
12
|
-
from jijmodeling.protobuf.from_protobuf.message_to_expression import (
|
|
13
|
-
message_to_expression,
|
|
14
|
-
)
|
|
15
|
-
from jijmodeling.protobuf.from_protobuf.message_to_problem import message_to_problem
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def from_protobuf(bytes: bytes) -> Union[Problem, Expression]:
|
|
19
|
-
"""
|
|
20
|
-
Convert a bytes object in protobuf to a JijModeling's object.
|
|
21
|
-
|
|
22
|
-
Args:
|
|
23
|
-
bytes (bytes): a bytes object in protobuf
|
|
24
|
-
|
|
25
|
-
Returns:
|
|
26
|
-
Expression: an expression
|
|
27
|
-
"""
|
|
28
|
-
# Convert the bytes object into the message object.
|
|
29
|
-
attribute_value = extract_attribute_value_from_header(bytes)
|
|
30
|
-
|
|
31
|
-
if type(attribute_value) is pb.Problem:
|
|
32
|
-
return message_to_problem(attribute_value)
|
|
33
|
-
elif isinstance(attribute_value, pb.Expression):
|
|
34
|
-
return message_to_expression(attribute_value)
|
|
35
|
-
else:
|
|
36
|
-
raise RuntimeError(
|
|
37
|
-
f"cannot convert the bytes object into the instance object according to the class in JijModeling (bytes = {str(bytes)})"
|
|
38
|
-
)
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import jijmodeling_schema as pb
|
|
4
|
-
|
|
5
|
-
from jijmodeling.expression.variables.placeholders import ArrayShape
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def message_to_array_shape(
|
|
9
|
-
id: str, message: pb.ArrayShape, array: pb.Expression
|
|
10
|
-
) -> ArrayShape:
|
|
11
|
-
"""
|
|
12
|
-
Convert a message to a `ArrayShape` object.
|
|
13
|
-
|
|
14
|
-
Args:
|
|
15
|
-
id (str): the id of the `ArrayShape` object
|
|
16
|
-
message (pb.ArrayShape): the `ArrayShape` message
|
|
17
|
-
array (pb.Expression): the target array of the array shape
|
|
18
|
-
|
|
19
|
-
Returns:
|
|
20
|
-
ArrayShape: an `ArrayShape` object
|
|
21
|
-
"""
|
|
22
|
-
# Set the number of axis.
|
|
23
|
-
axis = message.axis
|
|
24
|
-
|
|
25
|
-
# NOTE: Import a module within a local scope to fix a circular import.
|
|
26
|
-
# - https://stackoverflow.com/questions/59462679/design-of-python-conditional-imports
|
|
27
|
-
# - https://medium.com/@hamana.hadrien/so-you-got-a-circular-import-in-python-e9142fe10591
|
|
28
|
-
from jijmodeling.protobuf.from_protobuf.message_to_expression import (
|
|
29
|
-
message_to_expression,
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
# Set the target array of this array shape.
|
|
33
|
-
array = message_to_expression(array)
|
|
34
|
-
|
|
35
|
-
return ArrayShape(uuid=id, array=array, dimension=axis)
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import Union
|
|
4
|
-
|
|
5
|
-
import jijmodeling_schema as pb
|
|
6
|
-
|
|
7
|
-
from jijmodeling.expression.condition import (
|
|
8
|
-
AndOperator,
|
|
9
|
-
Condition,
|
|
10
|
-
Equal,
|
|
11
|
-
LessThan,
|
|
12
|
-
LessThanEqual,
|
|
13
|
-
NotEqual,
|
|
14
|
-
OrOperator,
|
|
15
|
-
XorOperator,
|
|
16
|
-
)
|
|
17
|
-
from jijmodeling.expression.expression import Add, BinaryOperator, Div, Mod, Mul, Power
|
|
18
|
-
from jijmodeling.expression.variables.variable import Range
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def message_to_binary_op(
|
|
22
|
-
id: str, message: pb.BinaryOp, left: pb.Expression, right: pb.Expression
|
|
23
|
-
) -> Union[BinaryOperator, Range, Condition]:
|
|
24
|
-
"""
|
|
25
|
-
Convert a message to a `BinaryOperator` object.
|
|
26
|
-
|
|
27
|
-
Args:
|
|
28
|
-
id (str): the id of the `BinaryOperator` object
|
|
29
|
-
message (pb.BinaryOp): the `BinaryOp` message
|
|
30
|
-
operand (pb.Expression): the operand node that the `BinaryOp` message has
|
|
31
|
-
|
|
32
|
-
Raises:
|
|
33
|
-
TypeError: the error happens if the message cannot be converted to a `BinaryOperator` object
|
|
34
|
-
|
|
35
|
-
Returns:
|
|
36
|
-
BinaryOperator: a `BinaryOperator` object
|
|
37
|
-
"""
|
|
38
|
-
# NOTE: Import a module within a local scope to fix a circular import.
|
|
39
|
-
# - https://stackoverflow.com/questions/59462679/design-of-python-conditional-imports
|
|
40
|
-
# - https://medium.com/@hamana.hadrien/so-you-got-a-circular-import-in-python-e9142fe10591
|
|
41
|
-
from jijmodeling.protobuf.from_protobuf.message_to_expression import (
|
|
42
|
-
message_to_expression,
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
# Convert the children to the `Expression` objects.
|
|
46
|
-
lhs = message_to_expression(left)
|
|
47
|
-
rhs = message_to_expression(right)
|
|
48
|
-
|
|
49
|
-
# BinaryOp
|
|
50
|
-
if message.kind == pb.BinaryOpKind.ADD:
|
|
51
|
-
return Add(uuid=id, left=lhs, right=rhs)
|
|
52
|
-
elif message.kind == pb.BinaryOpKind.MUL:
|
|
53
|
-
return Mul(uuid=id, left=lhs, right=rhs)
|
|
54
|
-
elif message.kind == pb.BinaryOpKind.DIV:
|
|
55
|
-
return Div(uuid=id, left=lhs, right=rhs)
|
|
56
|
-
elif message.kind == pb.BinaryOpKind.POW:
|
|
57
|
-
return Power(uuid=id, left=lhs, right=rhs)
|
|
58
|
-
elif message.kind == pb.BinaryOpKind.MOD:
|
|
59
|
-
return Mod(uuid=id, left=lhs, right=rhs)
|
|
60
|
-
# Range
|
|
61
|
-
elif message.kind == pb.BinaryOpKind.RANGE:
|
|
62
|
-
return Range(start=lhs, last=rhs, uuid=id)
|
|
63
|
-
# ComparisonOp
|
|
64
|
-
elif message.kind == pb.BinaryOpKind.EQ:
|
|
65
|
-
return Equal(uuid=id, left=lhs, right=rhs)
|
|
66
|
-
elif message.kind == pb.BinaryOpKind.NOT_EQ:
|
|
67
|
-
return NotEqual(uuid=id, left=lhs, right=rhs)
|
|
68
|
-
elif message.kind == pb.BinaryOpKind.LESS_THAN:
|
|
69
|
-
return LessThan(uuid=id, left=lhs, right=rhs)
|
|
70
|
-
elif message.kind == pb.BinaryOpKind.LESS_THAN_EQ:
|
|
71
|
-
return LessThanEqual(uuid=id, left=lhs, right=rhs)
|
|
72
|
-
# Logicalop
|
|
73
|
-
elif message.kind == pb.BinaryOpKind.AND:
|
|
74
|
-
return AndOperator(uuid=id, left=lhs, right=rhs)
|
|
75
|
-
elif message.kind == pb.BinaryOpKind.OR:
|
|
76
|
-
return OrOperator(uuid=id, left=lhs, right=rhs)
|
|
77
|
-
elif message.kind == pb.BinaryOpKind.XOR:
|
|
78
|
-
return XorOperator(uuid=id, left=lhs, right=rhs)
|
|
79
|
-
# Otherwise
|
|
80
|
-
else:
|
|
81
|
-
raise TypeError(
|
|
82
|
-
f"cannot convert the binary operator (actual = {message}) to an expression."
|
|
83
|
-
)
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import List
|
|
4
|
-
|
|
5
|
-
import jijmodeling_schema as pb
|
|
6
|
-
|
|
7
|
-
from jijmodeling.expression.variables.deci_vars import Binary
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def message_to_binary_var(
|
|
11
|
-
id: str, message: pb.BinaryVar, shape: List[pb.Expression]
|
|
12
|
-
) -> Binary:
|
|
13
|
-
"""
|
|
14
|
-
Convert a message to a `Binary` object.
|
|
15
|
-
|
|
16
|
-
Args:
|
|
17
|
-
id (str): the id of the `Binary` object
|
|
18
|
-
message (pb.BinaryVar): the `BinaryVar` message
|
|
19
|
-
shape (List[pb.Expression]): the shape of the `Binary` object
|
|
20
|
-
|
|
21
|
-
Raises:
|
|
22
|
-
ValueError: the error occurs if `dim` is not equal to length of the shape
|
|
23
|
-
|
|
24
|
-
Returns:
|
|
25
|
-
Binary: a `Binary` object
|
|
26
|
-
"""
|
|
27
|
-
# Validate length of the shape.
|
|
28
|
-
if message.dim != len(shape):
|
|
29
|
-
raise ValueError("invalid length of the shape")
|
|
30
|
-
|
|
31
|
-
# Set the symbol.
|
|
32
|
-
symbol = message.symbol
|
|
33
|
-
|
|
34
|
-
# NOTE: Import a module within a local scope to fix a circular import.
|
|
35
|
-
# - https://stackoverflow.com/questions/59462679/design-of-python-conditional-imports
|
|
36
|
-
# - https://medium.com/@hamana.hadrien/so-you-got-a-circular-import-in-python-e9142fe10591
|
|
37
|
-
from jijmodeling.protobuf.from_protobuf.message_to_expression import (
|
|
38
|
-
message_to_expression,
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
# Set the shape.
|
|
42
|
-
shape_element_list = [
|
|
43
|
-
message_to_expression(shape_element) for shape_element in shape
|
|
44
|
-
]
|
|
45
|
-
|
|
46
|
-
return Binary(label=symbol, shape=shape_element_list, uuid=id)
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import jijmodeling_schema as pb
|
|
4
|
-
|
|
5
|
-
from jijmodeling.expression.constraint import Constraint
|
|
6
|
-
from jijmodeling.protobuf.from_protobuf.message_to_expression import (
|
|
7
|
-
message_to_expression,
|
|
8
|
-
)
|
|
9
|
-
from jijmodeling.protobuf.from_protobuf.message_to_forall import message_to_forall
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def message_to_constraint(constraint: pb.Constraint) -> Constraint:
|
|
13
|
-
"""
|
|
14
|
-
Convert a `Constraint` message into a `Constraint` object.
|
|
15
|
-
|
|
16
|
-
Args:
|
|
17
|
-
constraint (pb.Constraint): a `Constraint` message
|
|
18
|
-
|
|
19
|
-
Returns:
|
|
20
|
-
Constraint: a `Constraint` object
|
|
21
|
-
"""
|
|
22
|
-
# Set the name of the constraint.
|
|
23
|
-
name = constraint.name
|
|
24
|
-
|
|
25
|
-
# Set the condition expression.
|
|
26
|
-
condition = message_to_expression(constraint.expression)
|
|
27
|
-
|
|
28
|
-
# Set the list of forall.
|
|
29
|
-
forall = [message_to_forall(forall) for forall in constraint.forall]
|
|
30
|
-
|
|
31
|
-
# Set the left_lower.
|
|
32
|
-
has_left_lower = (
|
|
33
|
-
pb.betterproto.which_one_of(constraint.left_lower.kind, "kind")[1] is not None
|
|
34
|
-
)
|
|
35
|
-
if has_left_lower:
|
|
36
|
-
left_lower = message_to_expression(constraint.left_lower)
|
|
37
|
-
else:
|
|
38
|
-
left_lower = None
|
|
39
|
-
|
|
40
|
-
return Constraint(
|
|
41
|
-
label=name,
|
|
42
|
-
condition=condition,
|
|
43
|
-
forall=forall,
|
|
44
|
-
left_lower=left_lower,
|
|
45
|
-
with_penalty=constraint.is_penalty,
|
|
46
|
-
with_multiplier=constraint.needs_multiplier,
|
|
47
|
-
auto_qubo=constraint.needs_square,
|
|
48
|
-
)
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import jijmodeling_schema as pb
|
|
4
|
-
|
|
5
|
-
from jijmodeling.expression.variables.variable import Element
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def message_to_element(id: str, message: pb.Element, parent: pb.Expression) -> Element:
|
|
9
|
-
"""
|
|
10
|
-
Convert a message to a `Element` object.
|
|
11
|
-
|
|
12
|
-
Args:
|
|
13
|
-
id (str): the id of the `Element` object
|
|
14
|
-
message (pb.Element): the `Element` message
|
|
15
|
-
parent (pb.Expression): the parent node that the `Element` message has
|
|
16
|
-
|
|
17
|
-
Returns:
|
|
18
|
-
Element: an `Element` object
|
|
19
|
-
"""
|
|
20
|
-
# Set the symbol
|
|
21
|
-
symbol = message.symbol
|
|
22
|
-
|
|
23
|
-
# NOTE: Import a module within a local scope to fix a circular import.
|
|
24
|
-
# - https://stackoverflow.com/questions/59462679/design-of-python-conditional-imports
|
|
25
|
-
# - https://medium.com/@hamana.hadrien/so-you-got-a-circular-import-in-python-e9142fe10591
|
|
26
|
-
from jijmodeling.protobuf.from_protobuf.message_to_expression import (
|
|
27
|
-
message_to_expression,
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
return Element(label=symbol, parent=message_to_expression(parent), uuid=id)
|