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
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import Tuple, Union
|
|
4
|
-
|
|
5
|
-
from jijmodeling.expression.condition import (
|
|
6
|
-
CompareCondition,
|
|
7
|
-
Condition,
|
|
8
|
-
ConditionOperator,
|
|
9
|
-
NoneCondition,
|
|
10
|
-
)
|
|
11
|
-
from jijmodeling.expression.expression import BinaryOperator, Expression, Number
|
|
12
|
-
from jijmodeling.expression.mathfunc import UnaryOperator
|
|
13
|
-
from jijmodeling.expression.sum import ReductionOperator
|
|
14
|
-
from jijmodeling.expression.type_annotations import ShapeElementType
|
|
15
|
-
from jijmodeling.expression.variables.deci_vars import Binary, Integer
|
|
16
|
-
from jijmodeling.expression.variables.jagged_array import JaggedArray
|
|
17
|
-
from jijmodeling.expression.variables.placeholders import ArrayShape, Placeholder
|
|
18
|
-
from jijmodeling.expression.variables.variable import Element, Range, Subscripts
|
|
19
|
-
|
|
20
|
-
ExpressionType = Union[Expression, Range]
|
|
21
|
-
ShapeType = Tuple[ShapeElementType, ...]
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def is_same_expr(
|
|
25
|
-
target: ExpressionType, pattern: ExpressionType, check_id: bool = True
|
|
26
|
-
) -> bool:
|
|
27
|
-
# Check if the IDs are the same
|
|
28
|
-
if check_id == True and target.uuid != pattern.uuid:
|
|
29
|
-
return False
|
|
30
|
-
|
|
31
|
-
# Check if the type of `target` is a subclass of the type of `pattern`
|
|
32
|
-
if not isinstance(target, type(pattern)):
|
|
33
|
-
return False
|
|
34
|
-
if type(target) != type(pattern):
|
|
35
|
-
return False
|
|
36
|
-
|
|
37
|
-
# Case: Number
|
|
38
|
-
if type(target) is Number and type(pattern) is Number:
|
|
39
|
-
return is_same_number(target, pattern)
|
|
40
|
-
# Case: Placeholder
|
|
41
|
-
elif type(target) is Placeholder and type(pattern) is Placeholder:
|
|
42
|
-
return is_same_placeholder(target, pattern, check_id)
|
|
43
|
-
# Case: JaggedArray
|
|
44
|
-
elif type(target) is JaggedArray and type(pattern) is JaggedArray:
|
|
45
|
-
return is_same_jagged_array(target, pattern)
|
|
46
|
-
# Case: ArrayShape
|
|
47
|
-
elif type(target) is ArrayShape and type(pattern) is ArrayShape:
|
|
48
|
-
return is_same_array_shape(target, pattern, check_id)
|
|
49
|
-
# Case: Range
|
|
50
|
-
elif type(target) is Range and type(pattern) is Range:
|
|
51
|
-
return is_same_range(target, pattern, check_id)
|
|
52
|
-
# Case: Element
|
|
53
|
-
elif type(target) is Element and type(pattern) is Element:
|
|
54
|
-
return is_same_element(target, pattern, check_id)
|
|
55
|
-
# Case: Subscripts
|
|
56
|
-
elif type(target) is Subscripts and type(pattern) is Subscripts:
|
|
57
|
-
return is_same_subscripts(target, pattern, check_id)
|
|
58
|
-
# Case: Binary
|
|
59
|
-
elif type(target) is Binary and type(pattern) is Binary:
|
|
60
|
-
return is_same_binary(target, pattern, check_id)
|
|
61
|
-
# Case: Integer
|
|
62
|
-
elif type(target) is Integer and type(pattern) is Integer:
|
|
63
|
-
return is_same_integer(target, pattern, check_id)
|
|
64
|
-
# Case: UnaryOperator
|
|
65
|
-
elif isinstance(target, UnaryOperator) and isinstance(pattern, UnaryOperator):
|
|
66
|
-
return is_same_unary_op(target, pattern, check_id)
|
|
67
|
-
# Case: BinaryOperator
|
|
68
|
-
elif isinstance(target, BinaryOperator) and isinstance(pattern, BinaryOperator):
|
|
69
|
-
return is_same_binary_op(target, pattern, check_id)
|
|
70
|
-
# Case: ReductionOperator
|
|
71
|
-
elif isinstance(target, ReductionOperator) and isinstance(
|
|
72
|
-
pattern, ReductionOperator
|
|
73
|
-
):
|
|
74
|
-
return is_same_reduction_op(target, pattern, check_id)
|
|
75
|
-
elif type(target) is ArrayShape and type(pattern) is ArrayShape:
|
|
76
|
-
return is_same_arrayshape(target, pattern, check_id)
|
|
77
|
-
# Case: No match
|
|
78
|
-
else:
|
|
79
|
-
raise TypeError(f"{target.__class__.__name__} is not supported in `is_same_expr`.")
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
def is_same_cond(target: Condition, pattern: Condition, check_id) -> bool:
|
|
83
|
-
# Check if the IDs are the same
|
|
84
|
-
if check_id == True and target.uuid != pattern.uuid:
|
|
85
|
-
return False
|
|
86
|
-
|
|
87
|
-
# Check if the type of `target` is a subclass of the type of `pattern`
|
|
88
|
-
if not isinstance(target, type(pattern)):
|
|
89
|
-
return False
|
|
90
|
-
|
|
91
|
-
# Case: NonCondition
|
|
92
|
-
if type(target) is NoneCondition and type(pattern) is NoneCondition:
|
|
93
|
-
return True
|
|
94
|
-
# Case: CompareCondition
|
|
95
|
-
elif isinstance(target, CompareCondition) and isinstance(pattern, CompareCondition):
|
|
96
|
-
return is_same_comparison_op(target, pattern, check_id)
|
|
97
|
-
# Case: ConditionOperator
|
|
98
|
-
elif isinstance(target, ConditionOperator) and isinstance(
|
|
99
|
-
pattern, ConditionOperator
|
|
100
|
-
):
|
|
101
|
-
return is_same_logical_op(target, pattern, check_id)
|
|
102
|
-
# Case: No match
|
|
103
|
-
else:
|
|
104
|
-
raise TypeError(f"{target.__class__.__name__} is not supported.")
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
def is_same_number(target: Number, pattern: Number) -> bool:
|
|
108
|
-
# Compare the following attributes:
|
|
109
|
-
# - value
|
|
110
|
-
# - dtype
|
|
111
|
-
if target.value != pattern.value:
|
|
112
|
-
return False
|
|
113
|
-
elif target.dtype != pattern.dtype:
|
|
114
|
-
return False
|
|
115
|
-
else:
|
|
116
|
-
return True
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
def is_same_arrayshape(target: ArrayShape, pattern: ArrayShape, check_id: bool) -> bool:
|
|
120
|
-
# Compare the following attributes:
|
|
121
|
-
# - array
|
|
122
|
-
# - dim
|
|
123
|
-
if is_same_expr(target.array, pattern.array, check_id):
|
|
124
|
-
return False
|
|
125
|
-
elif target.dimension != pattern.dimension:
|
|
126
|
-
return False
|
|
127
|
-
else:
|
|
128
|
-
return True
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
def is_same_shape(target: ShapeType, pattern: ShapeType, check_id: bool) -> bool:
|
|
132
|
-
if len(target) != len(pattern):
|
|
133
|
-
return False
|
|
134
|
-
|
|
135
|
-
for target_shape_elt, pattern_shape_elt in zip(target, pattern):
|
|
136
|
-
# Check if the type of the element of `target` is different from the type of the element of `pattern`
|
|
137
|
-
if type(target_shape_elt) is not type(pattern_shape_elt):
|
|
138
|
-
return False
|
|
139
|
-
# Case: the types of the elements of `target` and `pattern` are not equal to `ArrayShape`
|
|
140
|
-
elif (
|
|
141
|
-
type(target_shape_elt) is not ArrayShape
|
|
142
|
-
and type(pattern_shape_elt) is not ArrayShape
|
|
143
|
-
):
|
|
144
|
-
if not is_same_expr(target_shape_elt, pattern_shape_elt, check_id=check_id):
|
|
145
|
-
return False
|
|
146
|
-
# Case: the types of the elements of `target` and `pattern` are equal to `ArrayShape`
|
|
147
|
-
elif check_id == True and target_shape_elt.uuid != pattern_shape_elt.uuid:
|
|
148
|
-
return False
|
|
149
|
-
return True
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
def is_same_placeholder(
|
|
153
|
-
target: Placeholder, pattern: Placeholder, check_id: bool
|
|
154
|
-
) -> bool:
|
|
155
|
-
# Compare the following attributes:
|
|
156
|
-
# - label
|
|
157
|
-
# - dim
|
|
158
|
-
# - shape
|
|
159
|
-
if target.label != pattern.label:
|
|
160
|
-
return False
|
|
161
|
-
elif target.dim != pattern.dim:
|
|
162
|
-
return False
|
|
163
|
-
else:
|
|
164
|
-
return is_same_shape(target.shape, pattern.shape, check_id)
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
def is_same_jagged_array(target: JaggedArray, pattern: JaggedArray) -> bool:
|
|
168
|
-
# Compare the following attributes:
|
|
169
|
-
# - label
|
|
170
|
-
# - dim
|
|
171
|
-
if target.label != pattern.label:
|
|
172
|
-
return False
|
|
173
|
-
elif target.dim != pattern.dim:
|
|
174
|
-
return False
|
|
175
|
-
else:
|
|
176
|
-
return True
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
def is_same_array_shape(
|
|
180
|
-
target: ArrayShape, pattern: ArrayShape, check_id: bool
|
|
181
|
-
) -> bool:
|
|
182
|
-
# Compare the following attributes:
|
|
183
|
-
# - dimension
|
|
184
|
-
# - array
|
|
185
|
-
if target.dimension != pattern.dimension:
|
|
186
|
-
return False
|
|
187
|
-
else:
|
|
188
|
-
return is_same_expr(target.array, pattern.array, check_id=check_id)
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
def is_same_range(target: Range, pattern: Range, check_id: bool) -> bool:
|
|
192
|
-
# Compare the following attributes:
|
|
193
|
-
# - start
|
|
194
|
-
# - last
|
|
195
|
-
return is_same_expr(target.start, pattern.start, check_id) and is_same_expr(
|
|
196
|
-
target.last, pattern.last, check_id
|
|
197
|
-
)
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
def is_same_element(target: Element, pattern: Element, check_id: bool) -> bool:
|
|
201
|
-
# Comare the following attributes:
|
|
202
|
-
# - label
|
|
203
|
-
# - parent
|
|
204
|
-
if target.label != pattern.label:
|
|
205
|
-
return False
|
|
206
|
-
else:
|
|
207
|
-
return is_same_expr(target.parent, pattern.parent, check_id)
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
def is_same_subscripts(target: Subscripts, pattern: Subscripts, check_id: bool) -> bool:
|
|
211
|
-
# Comare the following attributes:
|
|
212
|
-
# - variable
|
|
213
|
-
# - subscripts
|
|
214
|
-
if not is_same_expr(target.variable, pattern.variable, check_id):
|
|
215
|
-
return False
|
|
216
|
-
elif len(target.subscripts) != len(pattern.subscripts):
|
|
217
|
-
return False
|
|
218
|
-
else:
|
|
219
|
-
for target_subs, pattern_subs in zip(target.subscripts, pattern.subscripts):
|
|
220
|
-
if not is_same_expr(target_subs, pattern_subs, check_id):
|
|
221
|
-
return False
|
|
222
|
-
return True
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
def is_same_binary(target: Binary, pattern: Binary, check_id: bool) -> bool:
|
|
226
|
-
# Compare the following attributes:
|
|
227
|
-
# - label
|
|
228
|
-
# - shape
|
|
229
|
-
if target.label != pattern.label:
|
|
230
|
-
return False
|
|
231
|
-
else:
|
|
232
|
-
return is_same_shape(target.shape, pattern.shape, check_id)
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
def is_same_integer(target: Integer, pattern: Integer, check_id: bool) -> bool:
|
|
236
|
-
# Compare the following attributes:
|
|
237
|
-
# - label
|
|
238
|
-
# - lower
|
|
239
|
-
# - upper
|
|
240
|
-
# - shape
|
|
241
|
-
if target.label != pattern.label:
|
|
242
|
-
return False
|
|
243
|
-
elif not is_same_expr(target.lower, pattern.lower, check_id):
|
|
244
|
-
return False
|
|
245
|
-
elif not is_same_expr(target.upper, pattern.upper, check_id):
|
|
246
|
-
return False
|
|
247
|
-
else:
|
|
248
|
-
return is_same_shape(target.shape, pattern.shape, check_id)
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
def is_same_unary_op(
|
|
252
|
-
target: UnaryOperator, pattern: UnaryOperator, check_id: bool
|
|
253
|
-
) -> bool:
|
|
254
|
-
# Compare the following attribute:
|
|
255
|
-
# - operand
|
|
256
|
-
return is_same_expr(target.operand, pattern.operand, check_id)
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
def is_same_binary_op(
|
|
260
|
-
target: BinaryOperator, pattern: BinaryOperator, check_id: bool
|
|
261
|
-
) -> bool:
|
|
262
|
-
# Compare the following attributes:
|
|
263
|
-
# - left
|
|
264
|
-
# - right
|
|
265
|
-
return is_same_expr(target.left, pattern.left, check_id) and is_same_expr(
|
|
266
|
-
target.right, pattern.right, check_id
|
|
267
|
-
)
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
def is_same_reduction_op(
|
|
271
|
-
target: ReductionOperator, pattern: ReductionOperator, check_id: bool
|
|
272
|
-
) -> bool:
|
|
273
|
-
# Compare the following attributes:
|
|
274
|
-
# - sum_index
|
|
275
|
-
# - condition
|
|
276
|
-
# - operand
|
|
277
|
-
if not is_same_element(target.sum_index, pattern.sum_index, check_id):
|
|
278
|
-
return False
|
|
279
|
-
elif not is_same_cond(target.condition, pattern.condition, check_id):
|
|
280
|
-
return False
|
|
281
|
-
else:
|
|
282
|
-
return is_same_expr(target.operand, pattern.operand, check_id)
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
def is_same_comparison_op(
|
|
286
|
-
target: CompareCondition, pattern: CompareCondition, check_id: bool
|
|
287
|
-
) -> bool:
|
|
288
|
-
# Compare the following attributes:
|
|
289
|
-
# - left
|
|
290
|
-
# - right
|
|
291
|
-
return is_same_expr(target.left, pattern.left, check_id) and is_same_expr(
|
|
292
|
-
target.right, pattern.right, check_id
|
|
293
|
-
)
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
def is_same_logical_op(
|
|
297
|
-
target: ConditionOperator, pattern: ConditionOperator, check_id: bool
|
|
298
|
-
) -> bool:
|
|
299
|
-
# Compare the following attributes:
|
|
300
|
-
# - left
|
|
301
|
-
# - right
|
|
302
|
-
return is_same_cond(target.left, pattern.left, check_id) and is_same_cond(
|
|
303
|
-
target.right, pattern.right, check_id
|
|
304
|
-
)
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import jijmodeling.expression.constraint as _constraint
|
|
4
|
-
|
|
5
|
-
from jijmodeling.match.condition_same import condition_same
|
|
6
|
-
from jijmodeling.match.expr_same import expr_same
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def penalty_same(
|
|
10
|
-
target: _constraint.Penalty, pattern: _constraint.Penalty, check_id: bool = True
|
|
11
|
-
) -> bool:
|
|
12
|
-
# Is the same label?
|
|
13
|
-
if target.label != pattern.label:
|
|
14
|
-
return False
|
|
15
|
-
# Is the same `with_multiplier`?
|
|
16
|
-
if target.with_multiplier is not pattern.with_multiplier:
|
|
17
|
-
return False
|
|
18
|
-
# Is the same `forall`?
|
|
19
|
-
if len(target.forall) != len(pattern.forall):
|
|
20
|
-
return False
|
|
21
|
-
for target_forall, pattern_forall in zip(target.forall, pattern.forall):
|
|
22
|
-
target_element, target_condition = target_forall
|
|
23
|
-
pattern_element, pattern_condition = pattern_forall
|
|
24
|
-
is_same_forall = expr_same(
|
|
25
|
-
target_element, pattern_element, check_id
|
|
26
|
-
) and condition_same(target_condition, pattern_condition, check_id)
|
|
27
|
-
|
|
28
|
-
if is_same_forall is False:
|
|
29
|
-
return False
|
|
30
|
-
# Is the same `penalty_term`?
|
|
31
|
-
return expr_same(target.penalty_term, pattern.penalty_term, check_id)
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from jijmodeling.match.constraint_same import constraint_same
|
|
4
|
-
from jijmodeling.match.expr_same import expr_same
|
|
5
|
-
from jijmodeling.match.penalty_same import penalty_same
|
|
6
|
-
from jijmodeling.problem.problem import Problem
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def problem_same(target: Problem, pattern: Problem, check_id: bool = True) -> bool:
|
|
10
|
-
# Is the same `name`?
|
|
11
|
-
if target.name != pattern.name:
|
|
12
|
-
return False
|
|
13
|
-
# Is the same `sense`?
|
|
14
|
-
if target.sense != pattern.sense:
|
|
15
|
-
return False
|
|
16
|
-
# Is the same `objective`?
|
|
17
|
-
if expr_same(target.objective, pattern.objective, check_id) is False:
|
|
18
|
-
return False
|
|
19
|
-
# Is the same `constraints`?
|
|
20
|
-
if len(target.constraints.items()) != len(pattern.constraints.items()):
|
|
21
|
-
return False
|
|
22
|
-
for target_key, target_constraint in target.constraints.items():
|
|
23
|
-
if target_key not in pattern.constraints.keys():
|
|
24
|
-
return False
|
|
25
|
-
if (
|
|
26
|
-
constraint_same(
|
|
27
|
-
target_constraint, pattern.constraints[target_key], check_id
|
|
28
|
-
)
|
|
29
|
-
is False
|
|
30
|
-
):
|
|
31
|
-
return False
|
|
32
|
-
# Is the same `penalty`?
|
|
33
|
-
if len(target.penalties.items()) != len(pattern.penalties.items()):
|
|
34
|
-
return False
|
|
35
|
-
for target_key, target_penalty in target.penalties.items():
|
|
36
|
-
if target_key not in pattern.penalties.keys():
|
|
37
|
-
return False
|
|
38
|
-
if (
|
|
39
|
-
penalty_same(target_penalty, pattern.penalties[target_key], check_id)
|
|
40
|
-
is False
|
|
41
|
-
):
|
|
42
|
-
return False
|
|
43
|
-
|
|
44
|
-
return True
|
jijmodeling/match/replace.py
DELETED
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
import typing as tp
|
|
2
|
-
|
|
3
|
-
from functools import singledispatch
|
|
4
|
-
|
|
5
|
-
import jijmodeling as jm
|
|
6
|
-
from jijmodeling.exceptions.exceptions import JijModelingError
|
|
7
|
-
import jijmodeling.expression.condition as jc
|
|
8
|
-
|
|
9
|
-
from jijmodeling.match.expr_same import expr_same
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def replace(
|
|
13
|
-
expr: jm.Expression, target: jm.Expression, source: jm.Expression, check_id: bool
|
|
14
|
-
) -> jm.Expression:
|
|
15
|
-
"""
|
|
16
|
-
replace expression (from `target` element to `source` one)
|
|
17
|
-
This function selects the target element from the expression and replaces it with the source element.
|
|
18
|
-
|
|
19
|
-
Args:
|
|
20
|
-
expr (jm.Expression): expression
|
|
21
|
-
target (jm.Expression): target sub tree
|
|
22
|
-
source (jm.Expression): new sub tree
|
|
23
|
-
check_id (bool): replace only if the uuid is the same, default is True
|
|
24
|
-
|
|
25
|
-
Returns:
|
|
26
|
-
jm.Expression: replaced sub tree
|
|
27
|
-
|
|
28
|
-
Examples:
|
|
29
|
-
>>> import jijmodeling as jm
|
|
30
|
-
>>> n = jm.Placeholder("n")
|
|
31
|
-
>>> i = jm.Element("i", n)
|
|
32
|
-
>>> x = jm.Binary("x", shape=(n, n))
|
|
33
|
-
>>> x_i = x[i] # [i] は xi を生成するたびにuuidが変わるので replaceで使うには一度だけ生成したオブジェクトを使い回す必要がある
|
|
34
|
-
>>> expr = jm.Sum(i, x_i)
|
|
35
|
-
>>> u = jm.Integer("u", shape=(n,), lower=0, upper=10)
|
|
36
|
-
>>> k = jm.Placeholder("k")
|
|
37
|
-
>>> j = jm.Element("j", k)
|
|
38
|
-
>>> y = jm.Placeholder("y", shape=(n, k))
|
|
39
|
-
>>> replaced = replace(expr, x_i, jm.Sum(j, u[i]*y[i,j]), check_id=True)
|
|
40
|
-
>>> print(replaced)
|
|
41
|
-
>>> Sum_{i=0}^{n}(Sum_{j=0}^{k}(u[i]*y[i,j]))
|
|
42
|
-
|
|
43
|
-
>>> import jijmodeling as jm
|
|
44
|
-
>>> n = jm.Placeholder("n")
|
|
45
|
-
>>> i = jm.Element("i", n)
|
|
46
|
-
>>> x = jm.Binary("x", shape=(n, n))
|
|
47
|
-
>>> expr = jm.Sum(i, x[i])
|
|
48
|
-
>>> u = jm.Integer("u", shape=(n,), lower=0, upper=10)
|
|
49
|
-
>>> k = jm.Placeholder("k")
|
|
50
|
-
>>> j = jm.Element("j", k)
|
|
51
|
-
>>> y = jm.Placeholder("y", shape=(n, k))
|
|
52
|
-
>>> replaced = replace(expr, x[i], jm.Sum(j, u[i]*y[i,j]), check_id=False) # check_id=False にすると、uuidが異なっていても置換できる
|
|
53
|
-
>>> print(replaced)
|
|
54
|
-
>>> Sum_{i=0}^{n}(Sum_{j=0}^{k}(u[i]*y[i,j]))
|
|
55
|
-
"""
|
|
56
|
-
if expr_same(expr, target, check_id):
|
|
57
|
-
return source
|
|
58
|
-
|
|
59
|
-
return _replace(expr, target, source, check_id)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
@singledispatch
|
|
63
|
-
def _replace(
|
|
64
|
-
expr: jm.Expression, target: jm.Expression, source: jm.Expression, check_id: bool
|
|
65
|
-
) -> jm.Expression:
|
|
66
|
-
raise TypeError(f"{type(expr)} is not supported in `replace`.")
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
# List all the types that are inherited from `jm.Expression` and register them to `_replace` function.
|
|
70
|
-
@_replace.register
|
|
71
|
-
def _(expr: jm.ArrayShape, target: jm.Expression, source: jm.Expression, check_id: bool) -> jm.Expression:
|
|
72
|
-
if expr_same(expr, target, check_id):
|
|
73
|
-
return source
|
|
74
|
-
if isinstance(source, (jm.Variable, jm.Subscripts)) and expr_same(expr.array, target, check_id):
|
|
75
|
-
return source.shape[expr.dim]
|
|
76
|
-
return expr
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
@_replace.register
|
|
80
|
-
def _(
|
|
81
|
-
expr: jm.expression.Number,
|
|
82
|
-
target: jm.Expression,
|
|
83
|
-
source: jm.Expression,
|
|
84
|
-
check_id: bool,
|
|
85
|
-
) -> jm.Expression:
|
|
86
|
-
if expr_same(expr, target, check_id):
|
|
87
|
-
return source
|
|
88
|
-
return expr
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
@_replace.register
|
|
92
|
-
def _(
|
|
93
|
-
expr: jm.expression.BinaryOperator,
|
|
94
|
-
target: jm.Expression,
|
|
95
|
-
source: jm.Expression,
|
|
96
|
-
check_id: bool,
|
|
97
|
-
) -> jm.Expression:
|
|
98
|
-
if expr_same(expr, target, check_id):
|
|
99
|
-
return source
|
|
100
|
-
|
|
101
|
-
cls = type(expr)
|
|
102
|
-
replaced_left = _replace(expr.left, target, source, check_id)
|
|
103
|
-
replaced_right = _replace(expr.right, target, source, check_id)
|
|
104
|
-
return cls(replaced_left, replaced_right)
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
@_replace.register
|
|
108
|
-
def _(
|
|
109
|
-
expr: jm.expression.UnaryOperator,
|
|
110
|
-
target: jm.Expression,
|
|
111
|
-
source: jm.Expression,
|
|
112
|
-
check_id: bool,
|
|
113
|
-
) -> jm.Expression:
|
|
114
|
-
if expr_same(expr, target, check_id):
|
|
115
|
-
return source
|
|
116
|
-
|
|
117
|
-
cls = type(expr)
|
|
118
|
-
replaced = _replace(expr, target, source, check_id)
|
|
119
|
-
return cls(replaced)
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
@_replace.register
|
|
123
|
-
def _(
|
|
124
|
-
expr: jm.expression.sum.ReductionOperator,
|
|
125
|
-
target: jm.Expression,
|
|
126
|
-
source: jm.Expression,
|
|
127
|
-
check_id: bool,
|
|
128
|
-
) -> jm.Expression:
|
|
129
|
-
if expr_same(expr, target, check_id):
|
|
130
|
-
return source
|
|
131
|
-
|
|
132
|
-
replaced_sum_index = tp.cast(
|
|
133
|
-
jm.Element, _replace(expr.sum_index, target, source, check_id)
|
|
134
|
-
)
|
|
135
|
-
replaced_operand = _replace(expr.operand, target, source, check_id)
|
|
136
|
-
replaced_condition = _replace_condition(expr.condition, target, source, check_id)
|
|
137
|
-
cls = type(expr)
|
|
138
|
-
return cls(replaced_sum_index, replaced_operand, replaced_condition)
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
@_replace.register
|
|
142
|
-
def _(
|
|
143
|
-
expr: jm.Variable, target: jm.Expression, source: jm.Expression, check_id: bool
|
|
144
|
-
) -> jm.Expression:
|
|
145
|
-
if expr_same(expr, target, check_id):
|
|
146
|
-
return source
|
|
147
|
-
return expr
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
@_replace.register
|
|
152
|
-
def _(
|
|
153
|
-
expr: jm.Subscripts, target: jm.Expression, source: jm.Expression, check_id: bool
|
|
154
|
-
) -> jm.Expression:
|
|
155
|
-
if expr_same(expr, target, check_id):
|
|
156
|
-
return source
|
|
157
|
-
replaced_variable = tp.cast(
|
|
158
|
-
jm.Variable, _replace(expr.variable, target, source, check_id)
|
|
159
|
-
)
|
|
160
|
-
replaced_subscripts = [
|
|
161
|
-
_replace(s, target, source, check_id) for s in expr.subscripts
|
|
162
|
-
]
|
|
163
|
-
cls = type(expr)
|
|
164
|
-
return cls(replaced_variable, replaced_subscripts)
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
@singledispatch
|
|
168
|
-
def _replace_condition(
|
|
169
|
-
condition: jc.Condition,
|
|
170
|
-
target: jm.Expression,
|
|
171
|
-
source: jm.Expression,
|
|
172
|
-
check_id: bool,
|
|
173
|
-
) -> jc.Condition:
|
|
174
|
-
raise TypeError(f"{type(condition)} is not supported in `replace`.")
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
@_replace_condition.register
|
|
178
|
-
def _(
|
|
179
|
-
condition: jc.NoneCondition,
|
|
180
|
-
target: jm.Expression,
|
|
181
|
-
source: jm.Expression,
|
|
182
|
-
check_id: bool,
|
|
183
|
-
) -> jc.Condition:
|
|
184
|
-
return condition
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
@_replace_condition.register
|
|
188
|
-
def _(
|
|
189
|
-
condition: jc.CompareCondition,
|
|
190
|
-
target: jm.Expression,
|
|
191
|
-
source: jm.Expression,
|
|
192
|
-
check_id: bool,
|
|
193
|
-
) -> jc.Condition:
|
|
194
|
-
replaced_left = _replace(condition.left, target, source, check_id)
|
|
195
|
-
replaced_right = _replace(condition.right, target, source, check_id)
|
|
196
|
-
cls = type(condition)
|
|
197
|
-
return cls(replaced_left, replaced_right)
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
@_replace_condition.register
|
|
201
|
-
def _(
|
|
202
|
-
condition: jc.ConditionOperator,
|
|
203
|
-
target: jm.Expression,
|
|
204
|
-
source: jm.Expression,
|
|
205
|
-
check_id: bool,
|
|
206
|
-
) -> jc.Condition:
|
|
207
|
-
replaced_left = _replace_condition(condition.left, target, source, check_id)
|
|
208
|
-
replaced_right = _replace_condition(condition.right, target, source, check_id)
|
|
209
|
-
cls = type(condition)
|
|
210
|
-
return cls(replaced_left, replaced_right)
|
jijmodeling/problem/__init__.py
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|