jijmodeling 0.10.15__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 -146
- 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.15.dist-info → jijmodeling-1.11.0.dist-info}/WHEEL +1 -2
- {jijmodeling-0.10.15.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 -175
- 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/condition_same.py +0 -44
- jijmodeling/match/constraint_same.py +0 -53
- jijmodeling/match/expr_same.py +0 -23
- jijmodeling/match/is_same_expr.py +0 -288
- jijmodeling/match/penalty_same.py +0 -31
- jijmodeling/match/problem_same.py +0 -44
- 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 -198
- jijmodeling/sampleset/measuring_time.py +0 -59
- jijmodeling/sampleset/record.py +0 -158
- jijmodeling/sampleset/sampleset.py +0 -381
- jijmodeling/sampleset/solving_time.py +0 -38
- jijmodeling/sampleset/system_time.py +0 -48
- jijmodeling/type_annotations/__init__.py +0 -38
- 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 -44
- 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.15.dist-info/METADATA +0 -59
- jijmodeling-0.10.15.dist-info/RECORD +0 -255
- jijmodeling-0.10.15.dist-info/top_level.txt +0 -1
|
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)
|
|
@@ -1,92 +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 Condition
|
|
8
|
-
from jijmodeling.expression.expression import Expression
|
|
9
|
-
from jijmodeling.expression.variables.variable import Range
|
|
10
|
-
from jijmodeling.protobuf.from_protobuf.message_to_array_shape import (
|
|
11
|
-
message_to_array_shape,
|
|
12
|
-
)
|
|
13
|
-
from jijmodeling.protobuf.from_protobuf.message_to_binary_op import message_to_binary_op
|
|
14
|
-
from jijmodeling.protobuf.from_protobuf.message_to_binary_var import (
|
|
15
|
-
message_to_binary_var,
|
|
16
|
-
)
|
|
17
|
-
from jijmodeling.protobuf.from_protobuf.message_to_element import message_to_element
|
|
18
|
-
from jijmodeling.protobuf.from_protobuf.message_to_integer_var import (
|
|
19
|
-
message_to_integer_var,
|
|
20
|
-
)
|
|
21
|
-
from jijmodeling.protobuf.from_protobuf.message_to_jagged_array import (
|
|
22
|
-
message_to_jagged_array,
|
|
23
|
-
)
|
|
24
|
-
from jijmodeling.protobuf.from_protobuf.message_to_number_lit import (
|
|
25
|
-
message_to_number_lit,
|
|
26
|
-
)
|
|
27
|
-
from jijmodeling.protobuf.from_protobuf.message_to_placeholder import (
|
|
28
|
-
message_to_placeholder,
|
|
29
|
-
)
|
|
30
|
-
from jijmodeling.protobuf.from_protobuf.message_to_reduction_op import (
|
|
31
|
-
message_to_reduction_op,
|
|
32
|
-
)
|
|
33
|
-
from jijmodeling.protobuf.from_protobuf.message_to_subscript_op import (
|
|
34
|
-
message_to_subscript_op,
|
|
35
|
-
)
|
|
36
|
-
from jijmodeling.protobuf.from_protobuf.message_to_unary_op import message_to_unary_op
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
def message_to_expression(
|
|
40
|
-
expression: pb.Expression,
|
|
41
|
-
) -> Union[Expression, Range, Condition]:
|
|
42
|
-
"""
|
|
43
|
-
Convert a message object to a `Expression` object.
|
|
44
|
-
|
|
45
|
-
Args:
|
|
46
|
-
expression (pb.Expression): a `Expression` message
|
|
47
|
-
|
|
48
|
-
Raises:
|
|
49
|
-
RuntimeError: the error occurs if the massage cannot be converted to an object that is a subclass of the `Expression` class
|
|
50
|
-
|
|
51
|
-
Returns:
|
|
52
|
-
Expression: an instance object that is a subclass of the `Expression` class
|
|
53
|
-
"""
|
|
54
|
-
# Get the id that the message has.
|
|
55
|
-
id = expression.id
|
|
56
|
-
|
|
57
|
-
# Get the `Expression` object from the field inside the oneof.
|
|
58
|
-
expr_attr = pb.betterproto.which_one_of(expression.kind, "kind")[1]
|
|
59
|
-
|
|
60
|
-
if type(expr_attr) is pb.NumberLit:
|
|
61
|
-
return message_to_number_lit(id, expr_attr)
|
|
62
|
-
elif type(expr_attr) is pb.Placeholder:
|
|
63
|
-
shape = expression.children
|
|
64
|
-
return message_to_placeholder(id, expr_attr, shape)
|
|
65
|
-
elif type(expr_attr) is pb.ArrayShape:
|
|
66
|
-
array = expression.children[0]
|
|
67
|
-
return message_to_array_shape(id, expr_attr, array)
|
|
68
|
-
elif type(expr_attr) is pb.Element:
|
|
69
|
-
parent = expression.children[0]
|
|
70
|
-
return message_to_element(id, expr_attr, parent)
|
|
71
|
-
elif type(expr_attr) is pb.JaggedArray:
|
|
72
|
-
return message_to_jagged_array(id, expr_attr)
|
|
73
|
-
elif type(expr_attr) is pb.BinaryVar:
|
|
74
|
-
shape = expression.children
|
|
75
|
-
return message_to_binary_var(id, expr_attr, shape)
|
|
76
|
-
elif type(expr_attr) is pb.IntegerVar:
|
|
77
|
-
return message_to_integer_var(id, expr_attr, expression.children)
|
|
78
|
-
elif type(expr_attr) is pb.UnaryOp:
|
|
79
|
-
operand = expression.children[0]
|
|
80
|
-
return message_to_unary_op(id, expr_attr, operand)
|
|
81
|
-
elif type(expr_attr) is pb.BinaryOp:
|
|
82
|
-
left = expression.children[0]
|
|
83
|
-
right = expression.children[1]
|
|
84
|
-
return message_to_binary_op(id, expr_attr, left, right)
|
|
85
|
-
elif type(expr_attr) is pb.SubscriptOp:
|
|
86
|
-
return message_to_subscript_op(id, expr_attr, expression.children)
|
|
87
|
-
elif type(expr_attr) is pb.ReductionOp:
|
|
88
|
-
return message_to_reduction_op(id, expr_attr, expression.children)
|
|
89
|
-
else:
|
|
90
|
-
raise RuntimeError(
|
|
91
|
-
f"cannot convert the {expr_attr.__class__.__name__} object into the instance object according to the class in JijModeling"
|
|
92
|
-
)
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import Optional, Tuple
|
|
4
|
-
|
|
5
|
-
import jijmodeling_schema as pb
|
|
6
|
-
|
|
7
|
-
from jijmodeling.expression.condition import Condition
|
|
8
|
-
from jijmodeling.expression.variables.variable import Element
|
|
9
|
-
from jijmodeling.protobuf.from_protobuf.message_to_expression import (
|
|
10
|
-
message_to_expression,
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def message_to_forall(forall: pb.Forall) -> Tuple[Element, Optional[Condition]]:
|
|
15
|
-
"""
|
|
16
|
-
Convert a `Forall` message into a `forall` object.
|
|
17
|
-
|
|
18
|
-
Args:
|
|
19
|
-
forall (pb.Forall): a `Forall` message
|
|
20
|
-
|
|
21
|
-
Returns:
|
|
22
|
-
Tuple[Element, Optional[Condition]]: objects to make the `forall` object
|
|
23
|
-
"""
|
|
24
|
-
# Set the element.
|
|
25
|
-
element = message_to_expression(forall.element)
|
|
26
|
-
|
|
27
|
-
# Set the condition expression.
|
|
28
|
-
is_none_condition = (
|
|
29
|
-
pb.betterproto.which_one_of(forall.condition.kind, "kind")[1] is None
|
|
30
|
-
)
|
|
31
|
-
condition = None if is_none_condition else message_to_expression(forall.condition)
|
|
32
|
-
|
|
33
|
-
return (element, condition)
|
|
@@ -1,54 +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 Integer
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def message_to_integer_var(
|
|
11
|
-
id: str, message: pb.IntegerVar, children: List[pb.Expression]
|
|
12
|
-
) -> Integer:
|
|
13
|
-
"""
|
|
14
|
-
Convert a message to an `Integer` object.
|
|
15
|
-
|
|
16
|
-
Args:
|
|
17
|
-
id (str): the id of the `Integer` object
|
|
18
|
-
message (pb.IntegerVar): the `IntegerVar` message
|
|
19
|
-
children (List[pb.Expression]): 0: lower bound, 1: upper bound, 2..: the shape of the `Integer` object
|
|
20
|
-
|
|
21
|
-
Raises:
|
|
22
|
-
ValueError: the error occurs if `dim` is not equal to length of the shape
|
|
23
|
-
|
|
24
|
-
Returns:
|
|
25
|
-
Integer: an `Integer` object
|
|
26
|
-
"""
|
|
27
|
-
# Validate length of the shape.
|
|
28
|
-
if message.dim + 2 != len(children):
|
|
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 lower.
|
|
42
|
-
lower = message_to_expression(children[0])
|
|
43
|
-
|
|
44
|
-
# Set the upper.
|
|
45
|
-
upper = message_to_expression(children[1])
|
|
46
|
-
|
|
47
|
-
# Set the shape.
|
|
48
|
-
shape_element_list = [
|
|
49
|
-
message_to_expression(shape_element) for shape_element in children[2:]
|
|
50
|
-
]
|
|
51
|
-
|
|
52
|
-
return Integer(
|
|
53
|
-
label=symbol, lower=lower, upper=upper, shape=shape_element_list, uuid=id
|
|
54
|
-
)
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import jijmodeling_schema as pb
|
|
4
|
-
|
|
5
|
-
from jijmodeling.expression.variables.jagged_array import JaggedArray
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def message_to_jagged_array(id: str, message: pb.JaggedArray) -> JaggedArray:
|
|
9
|
-
"""
|
|
10
|
-
Convert a message to a `JaggedArray` object.
|
|
11
|
-
|
|
12
|
-
Args:
|
|
13
|
-
id (str): the id of the `JaggedArray` object
|
|
14
|
-
message (pb.JaggedArray): the `JaggedArray` message
|
|
15
|
-
|
|
16
|
-
Returns:
|
|
17
|
-
JaggedArray: a `JaggedArray` object
|
|
18
|
-
"""
|
|
19
|
-
# Set the symbol.
|
|
20
|
-
symbol = message.symbol
|
|
21
|
-
|
|
22
|
-
# Set the number of dimensions.
|
|
23
|
-
dim = message.dim
|
|
24
|
-
|
|
25
|
-
return JaggedArray(label=symbol, dim=dim, uuid=id)
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import struct
|
|
4
|
-
|
|
5
|
-
import jijmodeling_schema as pb
|
|
6
|
-
|
|
7
|
-
from jijmodeling.expression.expression import DataType, Number
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def message_to_number_lit(id: str, message: pb.NumberLit) -> Number:
|
|
11
|
-
"""
|
|
12
|
-
Convert a message to a `Number` object.
|
|
13
|
-
|
|
14
|
-
Args:
|
|
15
|
-
message (pb.NumberLit): the `NumberLit` message
|
|
16
|
-
id (str): the id of the `Number` object
|
|
17
|
-
|
|
18
|
-
Returns:
|
|
19
|
-
Number: a `Number` object
|
|
20
|
-
"""
|
|
21
|
-
# Check the type that the number literal object has.
|
|
22
|
-
# Case: integer
|
|
23
|
-
if message.type == pb.NumberLitType.INTEGER:
|
|
24
|
-
# Set the value type to `FLOAT`.
|
|
25
|
-
dtype = DataType.INT
|
|
26
|
-
# Set the integer value.
|
|
27
|
-
value = struct.unpack(
|
|
28
|
-
">q",
|
|
29
|
-
message.value.to_bytes(length=struct.calcsize(">q"), byteorder="big"),
|
|
30
|
-
)[0]
|
|
31
|
-
# Case: float
|
|
32
|
-
elif message.type == pb.NumberLitType.FLOAT:
|
|
33
|
-
# Set the value type to `FLOAT`.
|
|
34
|
-
dtype = DataType.FLOAT
|
|
35
|
-
# Convert the bits to a float value.
|
|
36
|
-
value = struct.unpack(
|
|
37
|
-
">d",
|
|
38
|
-
message.value.to_bytes(length=struct.calcsize(">d"), byteorder="big"),
|
|
39
|
-
)[0]
|
|
40
|
-
|
|
41
|
-
return Number(value=value, dtype=dtype, uuid=id)
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import jijmodeling_schema as pb
|
|
4
|
-
|
|
5
|
-
from jijmodeling.expression.constraint import Penalty
|
|
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_penalty(penalty: pb.Penalty) -> Penalty:
|
|
13
|
-
"""
|
|
14
|
-
Convert a `Penalty` message into a `Penalty` object.
|
|
15
|
-
|
|
16
|
-
Args:
|
|
17
|
-
penalty (pb.Penalty): a `Penalty` message
|
|
18
|
-
|
|
19
|
-
Returns:
|
|
20
|
-
Penalty: a `Penalty` object
|
|
21
|
-
"""
|
|
22
|
-
# Set the name of the penalty.
|
|
23
|
-
name = penalty.name
|
|
24
|
-
|
|
25
|
-
# Set the penalty term.
|
|
26
|
-
expr = message_to_expression(penalty.expression)
|
|
27
|
-
|
|
28
|
-
# Set the list of forall.
|
|
29
|
-
forall = [message_to_forall(forall) for forall in penalty.forall]
|
|
30
|
-
|
|
31
|
-
return Penalty(
|
|
32
|
-
label=name,
|
|
33
|
-
penalty_term=expr,
|
|
34
|
-
forall=forall,
|
|
35
|
-
with_multiplier=penalty.needs_multiplier,
|
|
36
|
-
)
|
|
@@ -1,47 +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.placeholders import Placeholder
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def message_to_placeholder(
|
|
11
|
-
id: str, message: pb.Placeholder, shape: List[pb.Expression]
|
|
12
|
-
) -> Placeholder:
|
|
13
|
-
"""
|
|
14
|
-
Convert a message to a `Placeholder` object.
|
|
15
|
-
|
|
16
|
-
Args:
|
|
17
|
-
id (str): the id of the `Placeholder` object
|
|
18
|
-
message (pb.Placeholder): the `Placeholder` message
|
|
19
|
-
shape (List[pb.Expression]): the shape of the `Placeholder` object
|
|
20
|
-
|
|
21
|
-
Returns:
|
|
22
|
-
Placeholder: a `Placeholder` object
|
|
23
|
-
"""
|
|
24
|
-
# Set the symbol.
|
|
25
|
-
symbol = message.symbol
|
|
26
|
-
|
|
27
|
-
# Set the number of dimensions.
|
|
28
|
-
dim = message.dim
|
|
29
|
-
|
|
30
|
-
# Set the shape.
|
|
31
|
-
shape_list = []
|
|
32
|
-
expr_idx = 0
|
|
33
|
-
for shape_elt in message.shape:
|
|
34
|
-
if shape_elt == pb.PlaceholderShapeElement.DYNAMIC:
|
|
35
|
-
shape_list.append(None)
|
|
36
|
-
else:
|
|
37
|
-
# NOTE: Import a module within a local scope to fix a circular import.
|
|
38
|
-
# - https://stackoverflow.com/questions/59462679/design-of-python-conditional-imports
|
|
39
|
-
# - https://medium.com/@hamana.hadrien/so-you-got-a-circular-import-in-python-e9142fe10591
|
|
40
|
-
from jijmodeling.protobuf.from_protobuf.message_to_expression import (
|
|
41
|
-
message_to_expression,
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
shape_list.append(message_to_expression(shape[expr_idx]))
|
|
45
|
-
expr_idx = expr_idx + 1
|
|
46
|
-
|
|
47
|
-
return Placeholder(label=symbol, dim=dim, uuid=id, shape=shape_list)
|