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
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import Union
|
|
4
|
-
|
|
5
|
-
import jijmodeling_schema as pb
|
|
6
|
-
|
|
7
|
-
from ulid import ULID
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def add_header_to_message(message: Union[pb.Expression, pb.Problem]) -> pb.Header:
|
|
11
|
-
"""
|
|
12
|
-
Add header meta data to the `Expression` type message.
|
|
13
|
-
|
|
14
|
-
Args:
|
|
15
|
-
message (jijmodeling_schema.Expression): an `Expression` message
|
|
16
|
-
|
|
17
|
-
Returns:
|
|
18
|
-
jijmodeling_schema.Header: a `Header` message
|
|
19
|
-
"""
|
|
20
|
-
# Create an empty `Header` message.
|
|
21
|
-
header = pb.Header()
|
|
22
|
-
|
|
23
|
-
# Make the id of the `Header` message.
|
|
24
|
-
header.id = str(ULID())
|
|
25
|
-
|
|
26
|
-
# Set the version of the JijModeling schema.
|
|
27
|
-
header.version = "0.10.0"
|
|
28
|
-
|
|
29
|
-
# Set the target message to the `header.value`.
|
|
30
|
-
if type(message) is pb.Problem:
|
|
31
|
-
header.value.problem = message
|
|
32
|
-
elif type(message) is pb.Expression:
|
|
33
|
-
header.value.expression = message
|
|
34
|
-
|
|
35
|
-
return header
|
|
@@ -1,43 +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 array_shape_to_message(array_shape: ArrayShape) -> pb.Expression:
|
|
9
|
-
"""
|
|
10
|
-
Convert an `ArrayShape` object to an `Expression` message.
|
|
11
|
-
|
|
12
|
-
Args:
|
|
13
|
-
array_shape (ArrayShape): an `ArrayShape` object
|
|
14
|
-
|
|
15
|
-
Returns:
|
|
16
|
-
pb.Expression: an `Expression` message
|
|
17
|
-
"""
|
|
18
|
-
# Create an empty `ArrayShape` message.
|
|
19
|
-
array_shape_message = pb.ArrayShape()
|
|
20
|
-
|
|
21
|
-
# Set the number of axis
|
|
22
|
-
array_shape_message.axis = array_shape.dimension
|
|
23
|
-
|
|
24
|
-
# Create an empty `Expression` message.
|
|
25
|
-
message = pb.Expression()
|
|
26
|
-
|
|
27
|
-
# Set the id that the `ArrayShape` object has.
|
|
28
|
-
message.id = array_shape.uuid
|
|
29
|
-
|
|
30
|
-
# Set the kind of nodes to an `ArrayShape` message.
|
|
31
|
-
message.kind.array_shape = array_shape_message
|
|
32
|
-
|
|
33
|
-
# NOTE: Import a module within a local scope to fix a circular import.
|
|
34
|
-
# - https://stackoverflow.com/questions/59462679/design-of-python-conditional-imports
|
|
35
|
-
# - https://medium.com/@hamana.hadrien/so-you-got-a-circular-import-in-python-e9142fe10591
|
|
36
|
-
from jijmodeling.protobuf.to_protobuf.expression_to_message import (
|
|
37
|
-
expression_to_message,
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
# Set the array of the ArrayShape.
|
|
41
|
-
message.children.append(expression_to_message(array_shape.array))
|
|
42
|
-
|
|
43
|
-
return message
|
|
@@ -1,101 +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 binary_op_to_message(
|
|
22
|
-
binary_op: Union[BinaryOperator, Range, Condition]
|
|
23
|
-
) -> pb.Expression:
|
|
24
|
-
"""
|
|
25
|
-
Convert a `BinaryOperator | Range | Condition` object to an `Expression`.
|
|
26
|
-
|
|
27
|
-
message.
|
|
28
|
-
|
|
29
|
-
Args:
|
|
30
|
-
unary_op (BinaryOperator): an expression node that has two children
|
|
31
|
-
|
|
32
|
-
Returns:
|
|
33
|
-
pb.Expression: an `Expression` message
|
|
34
|
-
"""
|
|
35
|
-
# Create an empty `BinaryOp` message.
|
|
36
|
-
binary_op_message = pb.BinaryOp()
|
|
37
|
-
|
|
38
|
-
# Set the kind of the binary operator node.
|
|
39
|
-
# BinaryOp
|
|
40
|
-
if type(binary_op) is Add:
|
|
41
|
-
binary_op_message.kind = pb.BinaryOpKind.ADD
|
|
42
|
-
elif type(binary_op) is Mul:
|
|
43
|
-
binary_op_message.kind = pb.BinaryOpKind.MUL
|
|
44
|
-
elif type(binary_op) is Div:
|
|
45
|
-
binary_op_message.kind = pb.BinaryOpKind.DIV
|
|
46
|
-
elif type(binary_op) is Power:
|
|
47
|
-
binary_op_message.kind = pb.BinaryOpKind.POW
|
|
48
|
-
elif type(binary_op) is Mod:
|
|
49
|
-
binary_op_message.kind = pb.BinaryOpKind.MOD
|
|
50
|
-
# Range
|
|
51
|
-
elif type(binary_op) is Range:
|
|
52
|
-
binary_op_message.kind = pb.BinaryOpKind.RANGE
|
|
53
|
-
# ComparisonOp
|
|
54
|
-
elif type(binary_op) is Equal:
|
|
55
|
-
binary_op_message.kind = pb.BinaryOpKind.EQ
|
|
56
|
-
elif type(binary_op) is NotEqual:
|
|
57
|
-
binary_op_message.kind = pb.BinaryOpKind.NOT_EQ
|
|
58
|
-
elif type(binary_op) is LessThan:
|
|
59
|
-
binary_op_message.kind = pb.BinaryOpKind.LESS_THAN
|
|
60
|
-
elif type(binary_op) is LessThanEqual:
|
|
61
|
-
binary_op_message.kind = pb.BinaryOpKind.LESS_THAN_EQ
|
|
62
|
-
# LogicalOp
|
|
63
|
-
elif type(binary_op) is AndOperator:
|
|
64
|
-
binary_op_message.kind = pb.BinaryOpKind.AND
|
|
65
|
-
elif type(binary_op) is OrOperator:
|
|
66
|
-
binary_op_message.kind = pb.BinaryOpKind.OR
|
|
67
|
-
elif type(binary_op) is XorOperator:
|
|
68
|
-
binary_op_message.kind = pb.BinaryOpKind.XOR
|
|
69
|
-
# Otherwise
|
|
70
|
-
else:
|
|
71
|
-
raise TypeError(f"{binary_op.__class__.__name__} is not supported")
|
|
72
|
-
|
|
73
|
-
# Create an empty `Expression` message.
|
|
74
|
-
message = pb.Expression()
|
|
75
|
-
|
|
76
|
-
# Set the id that the `Expression` object has.
|
|
77
|
-
message.id = binary_op.uuid
|
|
78
|
-
|
|
79
|
-
# Set the kind of nodes to the `BinaryOp` message.
|
|
80
|
-
message.kind.binary_op = binary_op_message
|
|
81
|
-
|
|
82
|
-
# NOTE: Import a module within a local scope to fix a circular import.
|
|
83
|
-
# - https://stackoverflow.com/questions/59462679/design-of-python-conditional-imports
|
|
84
|
-
# - https://medium.com/@hamana.hadrien/so-you-got-a-circular-import-in-python-e9142fe10591
|
|
85
|
-
from jijmodeling.protobuf.to_protobuf.expression_to_message import (
|
|
86
|
-
expression_to_message,
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
if type(binary_op) is Range:
|
|
90
|
-
# Set the range of the `Range` object.
|
|
91
|
-
message.children.append(expression_to_message(binary_op.start))
|
|
92
|
-
message.children.append(expression_to_message(binary_op.last))
|
|
93
|
-
elif isinstance(binary_op, (BinaryOperator, Condition)):
|
|
94
|
-
# Set the children of the `BinaryOperator` object.
|
|
95
|
-
message.children.append(expression_to_message(binary_op.left))
|
|
96
|
-
message.children.append(expression_to_message(binary_op.right))
|
|
97
|
-
# Otherwise
|
|
98
|
-
else:
|
|
99
|
-
raise TypeError(f"{binary_op.__class__.__name__} is not supported")
|
|
100
|
-
|
|
101
|
-
return message
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import jijmodeling_schema as pb
|
|
4
|
-
|
|
5
|
-
from jijmodeling.expression.variables.deci_vars import Binary
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def binary_var_to_message(binary_var: Binary) -> pb.Expression:
|
|
9
|
-
"""
|
|
10
|
-
Convert a `Binary` object to an `BinaryVar` message.
|
|
11
|
-
|
|
12
|
-
Args:
|
|
13
|
-
binary_var (Binary): a `Binary` object.
|
|
14
|
-
|
|
15
|
-
Returns:
|
|
16
|
-
pb.Expression: an `Expression` message.
|
|
17
|
-
"""
|
|
18
|
-
# Create an empty `BinaryVar` message.
|
|
19
|
-
binary_var_message = pb.BinaryVar()
|
|
20
|
-
|
|
21
|
-
# Set the symbol.
|
|
22
|
-
binary_var_message.symbol = binary_var.label
|
|
23
|
-
|
|
24
|
-
# Set length of the shape.
|
|
25
|
-
binary_var_message.dim = binary_var.dim
|
|
26
|
-
|
|
27
|
-
# Create an empty `Expression` message.
|
|
28
|
-
message = pb.Expression()
|
|
29
|
-
|
|
30
|
-
# Set the id that the `Binary` object has.
|
|
31
|
-
message.id = binary_var.uuid
|
|
32
|
-
|
|
33
|
-
# Set the kind of nodes to a `BinaryVar` message.
|
|
34
|
-
message.kind.binary_var = binary_var_message
|
|
35
|
-
|
|
36
|
-
# NOTE: Import a module within a local scope to fix a circular import.
|
|
37
|
-
# - https://stackoverflow.com/questions/59462679/design-of-python-conditional-imports
|
|
38
|
-
# - https://medium.com/@hamana.hadrien/so-you-got-a-circular-import-in-python-e9142fe10591
|
|
39
|
-
from jijmodeling.protobuf.to_protobuf.expression_to_message import (
|
|
40
|
-
expression_to_message,
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
# Set the shape.
|
|
44
|
-
message.children = [
|
|
45
|
-
expression_to_message(shape_element) for shape_element in binary_var.shape
|
|
46
|
-
]
|
|
47
|
-
|
|
48
|
-
# Serialize the `Expression` object into a bytes object.
|
|
49
|
-
return message
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import jijmodeling_schema as pb
|
|
4
|
-
|
|
5
|
-
from ulid import ULID
|
|
6
|
-
|
|
7
|
-
from jijmodeling.expression.constraint import Constraint
|
|
8
|
-
from jijmodeling.protobuf.to_protobuf.expression_to_message import expression_to_message
|
|
9
|
-
from jijmodeling.protobuf.to_protobuf.forall_to_message import forall_to_message
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def constraint_to_message(constraint: Constraint) -> pb.Constraint:
|
|
13
|
-
"""
|
|
14
|
-
Convert a `Constraint` object into a `Constraint` message.
|
|
15
|
-
|
|
16
|
-
Args:
|
|
17
|
-
constraint (Constraint): a `Constraint` object
|
|
18
|
-
|
|
19
|
-
Returns:
|
|
20
|
-
pb.Constraint: a `Constraint` message
|
|
21
|
-
"""
|
|
22
|
-
# Create an empty `Constraint` message.
|
|
23
|
-
message = pb.Constraint()
|
|
24
|
-
|
|
25
|
-
# Set the id of the constraint.
|
|
26
|
-
message.id = str(ULID())
|
|
27
|
-
|
|
28
|
-
# Set the name of the constraint.
|
|
29
|
-
message.name = constraint.label
|
|
30
|
-
|
|
31
|
-
# Set the expression of the constraint.
|
|
32
|
-
message.expression = expression_to_message(constraint.condition)
|
|
33
|
-
|
|
34
|
-
# Set the list of forall.
|
|
35
|
-
message.forall.extend(
|
|
36
|
-
[
|
|
37
|
-
forall_to_message(element, condition)
|
|
38
|
-
for element, condition in constraint.forall
|
|
39
|
-
]
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
# Set the left_lower.
|
|
43
|
-
if constraint.left_lower is not None:
|
|
44
|
-
message.left_lower = expression_to_message(constraint.left_lower)
|
|
45
|
-
|
|
46
|
-
message.is_penalty = constraint.with_penalty
|
|
47
|
-
|
|
48
|
-
message.needs_multiplier = constraint.with_multiplier
|
|
49
|
-
|
|
50
|
-
message.needs_square = constraint.auto_qubo
|
|
51
|
-
|
|
52
|
-
return message
|
|
@@ -1,43 +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 element_to_message(element: Element) -> pb.Expression:
|
|
9
|
-
"""
|
|
10
|
-
Convert an `Element` object to an `Element` message.
|
|
11
|
-
|
|
12
|
-
Args:
|
|
13
|
-
element (Element): an `Element` object
|
|
14
|
-
|
|
15
|
-
Returns:
|
|
16
|
-
pb.Expression: an `Element` message
|
|
17
|
-
"""
|
|
18
|
-
# Create an empty `ArrayShape` message.
|
|
19
|
-
element_message = pb.Element()
|
|
20
|
-
|
|
21
|
-
# Set the symbol
|
|
22
|
-
element_message.symbol = element.label
|
|
23
|
-
|
|
24
|
-
# Create an empty `Expression` message.
|
|
25
|
-
message = pb.Expression()
|
|
26
|
-
|
|
27
|
-
# Set the id that the `Element` object has.
|
|
28
|
-
message.id = element.uuid
|
|
29
|
-
|
|
30
|
-
# Set the kind of nodes to an `ArrayShape` message.
|
|
31
|
-
message.kind.element = element_message
|
|
32
|
-
|
|
33
|
-
# NOTE: Import a module within a local scope to fix a circular import.
|
|
34
|
-
# - https://stackoverflow.com/questions/59462679/design-of-python-conditional-imports
|
|
35
|
-
# - https://medium.com/@hamana.hadrien/so-you-got-a-circular-import-in-python-e9142fe10591
|
|
36
|
-
from jijmodeling.protobuf.to_protobuf.expression_to_message import (
|
|
37
|
-
expression_to_message,
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
# Set the parent of the `Element` object.
|
|
41
|
-
message.children.append(expression_to_message(element.parent))
|
|
42
|
-
|
|
43
|
-
return message
|
|
@@ -1,89 +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 BinaryOperator, Expression, Number
|
|
9
|
-
from jijmodeling.expression.mathfunc import UnaryOperator
|
|
10
|
-
from jijmodeling.expression.sum import ReductionOperator
|
|
11
|
-
from jijmodeling.expression.variables.deci_vars import Binary, Integer
|
|
12
|
-
from jijmodeling.expression.variables.jagged_array import JaggedArray
|
|
13
|
-
from jijmodeling.expression.variables.placeholders import ArrayShape, Placeholder
|
|
14
|
-
from jijmodeling.expression.variables.variable import Element, Range, Subscripts
|
|
15
|
-
from jijmodeling.protobuf.to_protobuf.array_shape_to_message import (
|
|
16
|
-
array_shape_to_message,
|
|
17
|
-
)
|
|
18
|
-
from jijmodeling.protobuf.to_protobuf.binary_op_to_message import binary_op_to_message
|
|
19
|
-
from jijmodeling.protobuf.to_protobuf.binary_var_to_message import binary_var_to_message
|
|
20
|
-
from jijmodeling.protobuf.to_protobuf.element_to_message import element_to_message
|
|
21
|
-
from jijmodeling.protobuf.to_protobuf.integer_var_to_message import (
|
|
22
|
-
integer_var_to_message,
|
|
23
|
-
)
|
|
24
|
-
from jijmodeling.protobuf.to_protobuf.jagged_array_to_message import (
|
|
25
|
-
jagged_array_to_message,
|
|
26
|
-
)
|
|
27
|
-
from jijmodeling.protobuf.to_protobuf.number_lit_to_message import number_lit_to_message
|
|
28
|
-
from jijmodeling.protobuf.to_protobuf.placeholder_to_message import (
|
|
29
|
-
placeholder_to_message,
|
|
30
|
-
)
|
|
31
|
-
from jijmodeling.protobuf.to_protobuf.reduction_op_to_message import (
|
|
32
|
-
reduction_op_to_message,
|
|
33
|
-
)
|
|
34
|
-
from jijmodeling.protobuf.to_protobuf.subscript_op_to_message import (
|
|
35
|
-
subscript_op_to_message,
|
|
36
|
-
)
|
|
37
|
-
from jijmodeling.protobuf.to_protobuf.unary_op_to_message import unary_op_to_message
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def expression_to_message(expr: Union[Expression, Range, Condition]) -> pb.Expression:
|
|
41
|
-
"""
|
|
42
|
-
Convert a `Expression` instance object to an `Expression` message.
|
|
43
|
-
|
|
44
|
-
Args:
|
|
45
|
-
expr (Expression): an `Expression` instance object
|
|
46
|
-
|
|
47
|
-
Raises:
|
|
48
|
-
TypeError: the error occurs if the instance ofject cannot be converted to a protobuf object
|
|
49
|
-
|
|
50
|
-
Returns:
|
|
51
|
-
pb.Expression: a `Expression` message
|
|
52
|
-
"""
|
|
53
|
-
if type(expr) is Number:
|
|
54
|
-
message = number_lit_to_message(expr)
|
|
55
|
-
return message
|
|
56
|
-
elif type(expr) is Placeholder:
|
|
57
|
-
message = placeholder_to_message(expr)
|
|
58
|
-
return message
|
|
59
|
-
elif type(expr) is ArrayShape:
|
|
60
|
-
message = array_shape_to_message(expr)
|
|
61
|
-
return message
|
|
62
|
-
elif type(expr) is Element:
|
|
63
|
-
message = element_to_message(expr)
|
|
64
|
-
return message
|
|
65
|
-
elif type(expr) is JaggedArray:
|
|
66
|
-
message = jagged_array_to_message(expr)
|
|
67
|
-
return message
|
|
68
|
-
elif type(expr) is Binary:
|
|
69
|
-
message = binary_var_to_message(expr)
|
|
70
|
-
return message
|
|
71
|
-
elif type(expr) is Integer:
|
|
72
|
-
message = integer_var_to_message(expr)
|
|
73
|
-
return message
|
|
74
|
-
elif isinstance(expr, UnaryOperator):
|
|
75
|
-
message = unary_op_to_message(expr)
|
|
76
|
-
return message
|
|
77
|
-
elif isinstance(expr, (BinaryOperator, Range, Condition)):
|
|
78
|
-
message = binary_op_to_message(expr)
|
|
79
|
-
return message
|
|
80
|
-
elif type(expr) is Subscripts:
|
|
81
|
-
message = subscript_op_to_message(expr)
|
|
82
|
-
return message
|
|
83
|
-
elif isinstance(expr, ReductionOperator):
|
|
84
|
-
message = reduction_op_to_message(expr)
|
|
85
|
-
return message
|
|
86
|
-
else:
|
|
87
|
-
raise TypeError(
|
|
88
|
-
f"{expr.__class__.__name__} is not supported for converting it into a protobuf message."
|
|
89
|
-
)
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import jijmodeling_schema as pb
|
|
4
|
-
|
|
5
|
-
from jijmodeling.expression.condition import Condition, NoneCondition
|
|
6
|
-
from jijmodeling.expression.variables.variable import Element
|
|
7
|
-
from jijmodeling.protobuf.to_protobuf.element_to_message import element_to_message
|
|
8
|
-
from jijmodeling.protobuf.to_protobuf.expression_to_message import expression_to_message
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def forall_to_message(element: Element, condition: Condition) -> pb.Forall:
|
|
12
|
-
"""
|
|
13
|
-
Convert a `forall` object into a `Forall` message.
|
|
14
|
-
|
|
15
|
-
Args:
|
|
16
|
-
element (Element): an `Element` object
|
|
17
|
-
condition (Condition): a `Condition` object
|
|
18
|
-
|
|
19
|
-
Returns:
|
|
20
|
-
pb.Forall: a `Forall` message
|
|
21
|
-
"""
|
|
22
|
-
# Create an empty `Forall` message.
|
|
23
|
-
message = pb.Forall()
|
|
24
|
-
|
|
25
|
-
# Set the element.
|
|
26
|
-
message.element = element_to_message(element)
|
|
27
|
-
|
|
28
|
-
# Set the condition expression for the element.
|
|
29
|
-
if type(condition) is not NoneCondition:
|
|
30
|
-
message.condition = expression_to_message(condition)
|
|
31
|
-
|
|
32
|
-
return message
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import jijmodeling_schema as pb
|
|
4
|
-
|
|
5
|
-
from jijmodeling.expression.variables.deci_vars import Integer
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def integer_var_to_message(integer_var: Integer) -> pb.Expression:
|
|
9
|
-
"""
|
|
10
|
-
Convert an `Integer` object to an `IntegerVar` message.
|
|
11
|
-
|
|
12
|
-
Args:
|
|
13
|
-
integer_var (Integer): an `Integer` object.
|
|
14
|
-
|
|
15
|
-
Returns:
|
|
16
|
-
pb.Expression: an `Expression` message.
|
|
17
|
-
"""
|
|
18
|
-
# Create an empty `IntegerVar` message.
|
|
19
|
-
integer_var_message = pb.IntegerVar()
|
|
20
|
-
|
|
21
|
-
# Set the symbol
|
|
22
|
-
integer_var_message.symbol = integer_var.label
|
|
23
|
-
# Set length of the shape
|
|
24
|
-
integer_var_message.dim = integer_var.dim
|
|
25
|
-
|
|
26
|
-
# Create an empty `Expression` message.
|
|
27
|
-
message = pb.Expression()
|
|
28
|
-
|
|
29
|
-
# Set the id that the `Integer` object has.
|
|
30
|
-
message.id = integer_var.uuid
|
|
31
|
-
|
|
32
|
-
# Set the kind of nodes to a `IntegerVar` message.
|
|
33
|
-
message.kind.integer_var = integer_var_message
|
|
34
|
-
|
|
35
|
-
# NOTE: Import a module within a local scope to fix a circular import.
|
|
36
|
-
# - https://stackoverflow.com/questions/59462679/design-of-python-conditional-imports
|
|
37
|
-
# - https://medium.com/@hamana.hadrien/so-you-got-a-circular-import-in-python-e9142fe10591
|
|
38
|
-
from jijmodeling.protobuf.to_protobuf.expression_to_message import (
|
|
39
|
-
expression_to_message,
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
# Set the bound of the `Integer` object.
|
|
43
|
-
# lower bound
|
|
44
|
-
message.children.append(expression_to_message(integer_var.lower))
|
|
45
|
-
# upper bound
|
|
46
|
-
message.children.append(expression_to_message(integer_var.upper))
|
|
47
|
-
|
|
48
|
-
# Set the shape.
|
|
49
|
-
message.children.extend(
|
|
50
|
-
[expression_to_message(shape_element) for shape_element in integer_var.shape]
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
# Serialize the `Expression` object into a bytes object.
|
|
54
|
-
return message
|
|
@@ -1,37 +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 jagged_array_to_message(jagged_array: JaggedArray) -> pb.Expression:
|
|
9
|
-
"""
|
|
10
|
-
Convert a `JaggedArray` object to a `JaggedArray` message.
|
|
11
|
-
|
|
12
|
-
Args:
|
|
13
|
-
jagged_array (JaggedArray): a `JaggedArray` object
|
|
14
|
-
|
|
15
|
-
Returns:
|
|
16
|
-
pb.Expression: a `JaggedArray` object
|
|
17
|
-
"""
|
|
18
|
-
# Create an empty `JaggedArray` message.
|
|
19
|
-
jagged_array_message = pb.JaggedArray()
|
|
20
|
-
|
|
21
|
-
# Set the symbol.
|
|
22
|
-
jagged_array_message.symbol = jagged_array.label
|
|
23
|
-
|
|
24
|
-
# Set the number of dimensions.
|
|
25
|
-
jagged_array_message.dim = jagged_array.dim
|
|
26
|
-
|
|
27
|
-
# Create an empty `Expression` message.
|
|
28
|
-
message = pb.Expression()
|
|
29
|
-
|
|
30
|
-
# Set the id that the `JaggedArray` object has.
|
|
31
|
-
message.id = jagged_array.uuid
|
|
32
|
-
|
|
33
|
-
# Set the kind of nodes to a `JaggedArray` message.
|
|
34
|
-
message.kind.jagged_array = jagged_array_message
|
|
35
|
-
|
|
36
|
-
# Serialize the `Expression` object into a bytes object.
|
|
37
|
-
return message
|
|
@@ -1,52 +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 number_lit_to_message(lit: Number) -> pb.Expression:
|
|
11
|
-
"""
|
|
12
|
-
Convert a `Number` object to an `Expression` message.
|
|
13
|
-
|
|
14
|
-
Args:
|
|
15
|
-
lit (Number): a `Number` object
|
|
16
|
-
|
|
17
|
-
Returns:
|
|
18
|
-
jijmodeling_schema.Expression: an `Expression` message
|
|
19
|
-
"""
|
|
20
|
-
# Create an empty `NumberLit` message.
|
|
21
|
-
number_lit = pb.NumberLit()
|
|
22
|
-
|
|
23
|
-
# Set the type of the value that the `Number` object has.
|
|
24
|
-
# Case: int
|
|
25
|
-
if lit.dtype == DataType.INT:
|
|
26
|
-
number_lit.type = pb.NumberLitType.INTEGER
|
|
27
|
-
|
|
28
|
-
# Set the value that the `Number` object has.
|
|
29
|
-
# Convert the value to the bytes object.
|
|
30
|
-
number_lit.value = int.from_bytes(struct.pack(">q", lit.value), "big")
|
|
31
|
-
# Case: float
|
|
32
|
-
elif lit.dtype == DataType.FLOAT:
|
|
33
|
-
number_lit.type = pb.NumberLitType.FLOAT
|
|
34
|
-
|
|
35
|
-
# Set the value that the `Number` object has.
|
|
36
|
-
# Convert the value to the bytes object.
|
|
37
|
-
number_lit.value = int.from_bytes(struct.pack(">d", lit.value), "big")
|
|
38
|
-
# Otherwise
|
|
39
|
-
else:
|
|
40
|
-
number_lit.type = pb.NumberLitType.UNKNOWN
|
|
41
|
-
|
|
42
|
-
# Create an empty `Expression` message.
|
|
43
|
-
message = pb.Expression()
|
|
44
|
-
|
|
45
|
-
# Set the id that the `Number` object has.
|
|
46
|
-
message.id = lit.uuid
|
|
47
|
-
|
|
48
|
-
# Set the kind of nodes to `NumberLit`.
|
|
49
|
-
message.kind.number_lit = number_lit
|
|
50
|
-
|
|
51
|
-
# Serialize the `Expression` object into a bytes object.
|
|
52
|
-
return message
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import jijmodeling_schema as pb
|
|
4
|
-
|
|
5
|
-
from ulid import ULID
|
|
6
|
-
|
|
7
|
-
from jijmodeling.expression.constraint import Penalty
|
|
8
|
-
from jijmodeling.protobuf.to_protobuf.expression_to_message import expression_to_message
|
|
9
|
-
from jijmodeling.protobuf.to_protobuf.forall_to_message import forall_to_message
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def penalty_to_message(penalty: Penalty) -> pb.Penalty:
|
|
13
|
-
"""
|
|
14
|
-
Convert a `Penalty` object into a `Penalty` message.
|
|
15
|
-
|
|
16
|
-
Args:
|
|
17
|
-
penalty (Penalty): a `Penalty` object
|
|
18
|
-
|
|
19
|
-
Returns:
|
|
20
|
-
pb.Penalty: a `Penalty` message
|
|
21
|
-
"""
|
|
22
|
-
# Create an empty `Penalty` message
|
|
23
|
-
message = pb.Penalty()
|
|
24
|
-
|
|
25
|
-
# Set the id of the penalty.
|
|
26
|
-
message.id = str(ULID())
|
|
27
|
-
|
|
28
|
-
# Set the name of the penalty.
|
|
29
|
-
message.name = penalty.label
|
|
30
|
-
|
|
31
|
-
# Set the penalty term.
|
|
32
|
-
message.expression = expression_to_message(penalty.penalty_term)
|
|
33
|
-
|
|
34
|
-
# Set the list of forall.
|
|
35
|
-
message.forall.extend(
|
|
36
|
-
[forall_to_message(element, condition) for element, condition in penalty.forall]
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
# Set the needs_multiplier
|
|
40
|
-
message.needs_multiplier = penalty.with_multiplier
|
|
41
|
-
|
|
42
|
-
return message
|