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
|
@@ -1,288 +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
|
-
|
|
35
|
-
# Case: Number
|
|
36
|
-
if type(target) is Number and type(pattern) is Number:
|
|
37
|
-
return is_same_number(target, pattern)
|
|
38
|
-
# Case: Placeholder
|
|
39
|
-
elif type(target) is Placeholder and type(pattern) is Placeholder:
|
|
40
|
-
return is_same_placeholder(target, pattern, check_id)
|
|
41
|
-
# Case: JaggedArray
|
|
42
|
-
elif type(target) is JaggedArray and type(pattern) is JaggedArray:
|
|
43
|
-
return is_same_jagged_array(target, pattern)
|
|
44
|
-
# Case: ArrayShape
|
|
45
|
-
elif type(target) is ArrayShape and type(pattern) is ArrayShape:
|
|
46
|
-
return is_same_array_shape(target, pattern, check_id)
|
|
47
|
-
# Case: Range
|
|
48
|
-
elif type(target) is Range and type(pattern) is Range:
|
|
49
|
-
return is_same_range(target, pattern, check_id)
|
|
50
|
-
# Case: Element
|
|
51
|
-
elif type(target) is Element and type(pattern) is Element:
|
|
52
|
-
return is_same_element(target, pattern, check_id)
|
|
53
|
-
# Case: Subscripts
|
|
54
|
-
elif type(target) is Subscripts and type(pattern) is Subscripts:
|
|
55
|
-
return is_same_subscripts(target, pattern, check_id)
|
|
56
|
-
# Case: Binary
|
|
57
|
-
elif type(target) is Binary and type(pattern) is Binary:
|
|
58
|
-
return is_same_binary(target, pattern, check_id)
|
|
59
|
-
# Case: Integer
|
|
60
|
-
elif type(target) is Integer and type(pattern) is Integer:
|
|
61
|
-
return is_same_integer(target, pattern, check_id)
|
|
62
|
-
# Case: UnaryOperator
|
|
63
|
-
elif isinstance(target, UnaryOperator) and isinstance(pattern, UnaryOperator):
|
|
64
|
-
return is_same_unary_op(target, pattern, check_id)
|
|
65
|
-
# Case: BinaryOperator
|
|
66
|
-
elif isinstance(target, BinaryOperator) and isinstance(pattern, BinaryOperator):
|
|
67
|
-
return is_same_binary_op(target, pattern, check_id)
|
|
68
|
-
# Case: ReductionOperator
|
|
69
|
-
elif isinstance(target, ReductionOperator) and isinstance(
|
|
70
|
-
pattern, ReductionOperator
|
|
71
|
-
):
|
|
72
|
-
return is_same_reduction_op(target, pattern, check_id)
|
|
73
|
-
# Case: No match
|
|
74
|
-
else:
|
|
75
|
-
raise TypeError(f"{target.__class__.__name__} is not supported.")
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
def is_same_cond(target: Condition, pattern: Condition, check_id) -> bool:
|
|
79
|
-
# Check if the IDs are the same
|
|
80
|
-
if check_id == True and target.uuid != pattern.uuid:
|
|
81
|
-
return False
|
|
82
|
-
|
|
83
|
-
# Check if the type of `target` is a subclass of the type of `pattern`
|
|
84
|
-
if not isinstance(target, type(pattern)):
|
|
85
|
-
return False
|
|
86
|
-
|
|
87
|
-
# Case: NonCondition
|
|
88
|
-
if type(target) is NoneCondition and type(pattern) is NoneCondition:
|
|
89
|
-
return True
|
|
90
|
-
# Case: CompareCondition
|
|
91
|
-
elif isinstance(target, CompareCondition) and isinstance(pattern, CompareCondition):
|
|
92
|
-
return is_same_comparison_op(target, pattern, check_id)
|
|
93
|
-
# Case: ConditionOperator
|
|
94
|
-
elif isinstance(target, ConditionOperator) and isinstance(
|
|
95
|
-
pattern, ConditionOperator
|
|
96
|
-
):
|
|
97
|
-
return is_same_logical_op(target, pattern, check_id)
|
|
98
|
-
# Case: No match
|
|
99
|
-
else:
|
|
100
|
-
raise TypeError(f"{target.__class__.__name__} is not supported.")
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
def is_same_number(target: Number, pattern: Number) -> bool:
|
|
104
|
-
# Compare the following attributes:
|
|
105
|
-
# - value
|
|
106
|
-
# - dtype
|
|
107
|
-
if target.value != pattern.value:
|
|
108
|
-
return False
|
|
109
|
-
elif target.dtype != pattern.dtype:
|
|
110
|
-
return False
|
|
111
|
-
else:
|
|
112
|
-
return True
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
def is_same_shape(target: ShapeType, pattern: ShapeType, check_id: bool) -> bool:
|
|
116
|
-
if len(target) != len(pattern):
|
|
117
|
-
return False
|
|
118
|
-
|
|
119
|
-
for target_shape_elt, pattern_shape_elt in zip(target, pattern):
|
|
120
|
-
# Check if the type of the element of `target` is different from the type of the element of `pattern`
|
|
121
|
-
if type(target_shape_elt) is not type(pattern_shape_elt):
|
|
122
|
-
return False
|
|
123
|
-
# Case: the types of the elements of `target` and `pattern` are not equal to `ArrayShape`
|
|
124
|
-
elif (
|
|
125
|
-
type(target_shape_elt) is not ArrayShape
|
|
126
|
-
and type(pattern_shape_elt) is not ArrayShape
|
|
127
|
-
):
|
|
128
|
-
if not is_same_expr(target_shape_elt, pattern_shape_elt, check_id=check_id):
|
|
129
|
-
return False
|
|
130
|
-
# Case: the types of the elements of `target` and `pattern` are equal to `ArrayShape`
|
|
131
|
-
elif check_id == True and target_shape_elt.uuid != pattern_shape_elt.uuid:
|
|
132
|
-
return False
|
|
133
|
-
return True
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
def is_same_placeholder(
|
|
137
|
-
target: Placeholder, pattern: Placeholder, check_id: bool
|
|
138
|
-
) -> bool:
|
|
139
|
-
# Compare the following attributes:
|
|
140
|
-
# - label
|
|
141
|
-
# - dim
|
|
142
|
-
# - shape
|
|
143
|
-
if target.label != pattern.label:
|
|
144
|
-
return False
|
|
145
|
-
elif target.dim != pattern.dim:
|
|
146
|
-
return False
|
|
147
|
-
else:
|
|
148
|
-
return is_same_shape(target.shape, pattern.shape, check_id)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
def is_same_jagged_array(target: JaggedArray, pattern: JaggedArray) -> bool:
|
|
152
|
-
# Compare the following attributes:
|
|
153
|
-
# - label
|
|
154
|
-
# - dim
|
|
155
|
-
if target.label != pattern.label:
|
|
156
|
-
return False
|
|
157
|
-
elif target.dim != pattern.dim:
|
|
158
|
-
return False
|
|
159
|
-
else:
|
|
160
|
-
return True
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
def is_same_array_shape(
|
|
164
|
-
target: ArrayShape, pattern: ArrayShape, check_id: bool
|
|
165
|
-
) -> bool:
|
|
166
|
-
# Compare the following attributes:
|
|
167
|
-
# - dimension
|
|
168
|
-
# - array
|
|
169
|
-
if target.dimension != pattern.dimension:
|
|
170
|
-
return False
|
|
171
|
-
else:
|
|
172
|
-
return is_same_expr(target.array, pattern.array, check_id=check_id)
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
def is_same_range(target: Range, pattern: Range, check_id: bool) -> bool:
|
|
176
|
-
# Compare the following attributes:
|
|
177
|
-
# - start
|
|
178
|
-
# - last
|
|
179
|
-
return is_same_expr(target.start, pattern.start, check_id) and is_same_expr(
|
|
180
|
-
target.last, pattern.last, check_id
|
|
181
|
-
)
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
def is_same_element(target: Element, pattern: Element, check_id: bool) -> bool:
|
|
185
|
-
# Comare the following attributes:
|
|
186
|
-
# - label
|
|
187
|
-
# - parent
|
|
188
|
-
if target.label != pattern.label:
|
|
189
|
-
return False
|
|
190
|
-
else:
|
|
191
|
-
return is_same_expr(target.parent, pattern.parent, check_id)
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
def is_same_subscripts(target: Subscripts, pattern: Subscripts, check_id: bool) -> bool:
|
|
195
|
-
# Comare the following attributes:
|
|
196
|
-
# - variable
|
|
197
|
-
# - subscripts
|
|
198
|
-
if not is_same_expr(target.variable, pattern.variable, check_id):
|
|
199
|
-
return False
|
|
200
|
-
elif len(target.subscripts) != len(pattern.subscripts):
|
|
201
|
-
return False
|
|
202
|
-
else:
|
|
203
|
-
for target_subs, pattern_subs in zip(target.subscripts, pattern.subscripts):
|
|
204
|
-
if not is_same_expr(target_subs, pattern_subs, check_id):
|
|
205
|
-
return False
|
|
206
|
-
return True
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
def is_same_binary(target: Binary, pattern: Binary, check_id: bool) -> bool:
|
|
210
|
-
# Compare the following attributes:
|
|
211
|
-
# - label
|
|
212
|
-
# - shape
|
|
213
|
-
if target.label != pattern.label:
|
|
214
|
-
return False
|
|
215
|
-
else:
|
|
216
|
-
return is_same_shape(target.shape, pattern.shape, check_id)
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
def is_same_integer(target: Integer, pattern: Integer, check_id: bool) -> bool:
|
|
220
|
-
# Compare the following attributes:
|
|
221
|
-
# - label
|
|
222
|
-
# - lower
|
|
223
|
-
# - upper
|
|
224
|
-
# - shape
|
|
225
|
-
if target.label != pattern.label:
|
|
226
|
-
return False
|
|
227
|
-
elif not is_same_expr(target.lower, pattern.lower, check_id):
|
|
228
|
-
return False
|
|
229
|
-
elif not is_same_expr(target.upper, pattern.upper, check_id):
|
|
230
|
-
return False
|
|
231
|
-
else:
|
|
232
|
-
return is_same_shape(target.shape, pattern.shape, check_id)
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
def is_same_unary_op(
|
|
236
|
-
target: UnaryOperator, pattern: UnaryOperator, check_id: bool
|
|
237
|
-
) -> bool:
|
|
238
|
-
# Compare the following attribute:
|
|
239
|
-
# - operand
|
|
240
|
-
return is_same_expr(target.operand, pattern.operand, check_id)
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
def is_same_binary_op(
|
|
244
|
-
target: BinaryOperator, pattern: BinaryOperator, check_id: bool
|
|
245
|
-
) -> bool:
|
|
246
|
-
# Compare the following attributes:
|
|
247
|
-
# - left
|
|
248
|
-
# - right
|
|
249
|
-
return is_same_expr(target.left, pattern.left, check_id) and is_same_expr(
|
|
250
|
-
target.right, pattern.right, check_id
|
|
251
|
-
)
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
def is_same_reduction_op(
|
|
255
|
-
target: ReductionOperator, pattern: ReductionOperator, check_id: bool
|
|
256
|
-
) -> bool:
|
|
257
|
-
# Compare the following attributes:
|
|
258
|
-
# - sum_index
|
|
259
|
-
# - condition
|
|
260
|
-
# - operand
|
|
261
|
-
if not is_same_element(target.sum_index, pattern.sum_index, check_id):
|
|
262
|
-
return False
|
|
263
|
-
elif not is_same_cond(target.condition, pattern.condition, check_id):
|
|
264
|
-
return False
|
|
265
|
-
else:
|
|
266
|
-
return is_same_expr(target.operand, pattern.operand, check_id)
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
def is_same_comparison_op(
|
|
270
|
-
target: CompareCondition, pattern: CompareCondition, check_id: bool
|
|
271
|
-
) -> bool:
|
|
272
|
-
# Compare the following attributes:
|
|
273
|
-
# - left
|
|
274
|
-
# - right
|
|
275
|
-
return is_same_expr(target.left, pattern.left, check_id) and is_same_expr(
|
|
276
|
-
target.right, pattern.right, check_id
|
|
277
|
-
)
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
def is_same_logical_op(
|
|
281
|
-
target: ConditionOperator, pattern: ConditionOperator, check_id: bool
|
|
282
|
-
) -> bool:
|
|
283
|
-
# Compare the following attributes:
|
|
284
|
-
# - left
|
|
285
|
-
# - right
|
|
286
|
-
return is_same_cond(target.left, pattern.left, check_id) and is_same_cond(
|
|
287
|
-
target.right, pattern.right, check_id
|
|
288
|
-
)
|
|
@@ -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/problem/__init__.py
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
jijmodeling/problem/problem.py
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import copy as _copy
|
|
4
|
-
import enum as _enum
|
|
5
|
-
import typing as tp
|
|
6
|
-
|
|
7
|
-
import typeguard as _typeguard
|
|
8
|
-
|
|
9
|
-
import jijmodeling.exceptions.exceptions as _exceptions
|
|
10
|
-
import jijmodeling.expression.constraint as _constraint
|
|
11
|
-
import jijmodeling.expression.expression as _expression
|
|
12
|
-
import jijmodeling.expression.serializable as _serializable
|
|
13
|
-
import jijmodeling.expression.utils as _utils
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class ProblemSense(_enum.Enum):
|
|
17
|
-
MINIMUM = "MINIMUM"
|
|
18
|
-
MAXIMUM = "MAXIMUM"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class Problem(metaclass=_serializable.Serializable):
|
|
22
|
-
"""
|
|
23
|
-
Optimization problem.
|
|
24
|
-
|
|
25
|
-
Attributes:
|
|
26
|
-
name (str): name of problem.
|
|
27
|
-
model (Optional[Expression]): total optimization model.
|
|
28
|
-
constraints (Dict[str, Constraint]): constraint objects of problem.
|
|
29
|
-
penalties (Dict[str, Constraint]): penalty objects of problem.
|
|
30
|
-
cost (Expression): cost term of problem. Defaults zero.
|
|
31
|
-
"""
|
|
32
|
-
|
|
33
|
-
def __init__(
|
|
34
|
-
self,
|
|
35
|
-
name: str,
|
|
36
|
-
sense: tp.Union[ProblemSense, str] = ProblemSense.MINIMUM,
|
|
37
|
-
objective: _expression.Expression = _expression.Number(0),
|
|
38
|
-
constraints: tp.Dict[str, _constraint.Constraint] = {},
|
|
39
|
-
penalties: tp.Dict[str, _constraint.Penalty] = {},
|
|
40
|
-
) -> None:
|
|
41
|
-
"""
|
|
42
|
-
Initialize
|
|
43
|
-
|
|
44
|
-
Args:
|
|
45
|
-
problem_name (str): problem name
|
|
46
|
-
kind (ProblemKind): problem kind Minimum or Maximum
|
|
47
|
-
objective (Expression): objective
|
|
48
|
-
constraints (Dict[str, Constraint]): dict of constraints
|
|
49
|
-
penalties (Dict[str, Penalty]): dict of penalties
|
|
50
|
-
"""
|
|
51
|
-
self._name = name
|
|
52
|
-
self._sense = ProblemSense(sense)
|
|
53
|
-
# deepcopy to avoid having the same reference
|
|
54
|
-
self._objective = _copy.deepcopy(objective)
|
|
55
|
-
self._constraints: tp.Dict[str, _constraint.Constraint] = _copy.deepcopy(
|
|
56
|
-
constraints
|
|
57
|
-
)
|
|
58
|
-
self._penalties: tp.Dict[str, _constraint.Penalty] = _copy.deepcopy(penalties)
|
|
59
|
-
|
|
60
|
-
_typeguard.check_type("self._name", self._name, str)
|
|
61
|
-
_typeguard.check_type("self._sense", self._sense, ProblemSense)
|
|
62
|
-
_typeguard.check_type(
|
|
63
|
-
"self._constraints", self._constraints, tp.Dict[str, _constraint.Constraint]
|
|
64
|
-
)
|
|
65
|
-
_typeguard.check_type(
|
|
66
|
-
"self._penalties", self._penalties, tp.Dict[str, _constraint.Penalty]
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
@property
|
|
70
|
-
def name(self) -> str:
|
|
71
|
-
return self._name
|
|
72
|
-
|
|
73
|
-
@property
|
|
74
|
-
def sense(self) -> ProblemSense:
|
|
75
|
-
return self._sense
|
|
76
|
-
|
|
77
|
-
@property
|
|
78
|
-
def objective(self) -> _expression.Expression:
|
|
79
|
-
return self._objective
|
|
80
|
-
|
|
81
|
-
@property
|
|
82
|
-
def constraints(self) -> tp.Dict[str, _constraint.Constraint]:
|
|
83
|
-
return self._constraints
|
|
84
|
-
|
|
85
|
-
@property
|
|
86
|
-
def penalties(self) -> tp.Dict[str, _constraint.Penalty]:
|
|
87
|
-
return self._penalties
|
|
88
|
-
|
|
89
|
-
def add(
|
|
90
|
-
self,
|
|
91
|
-
other: tp.Union[
|
|
92
|
-
_expression.Expression, _constraint.Constraint, _constraint.Penalty
|
|
93
|
-
],
|
|
94
|
-
):
|
|
95
|
-
"""
|
|
96
|
-
Add expression, constraint or penalty to problem.
|
|
97
|
-
|
|
98
|
-
Args:
|
|
99
|
-
other (Expression): expression
|
|
100
|
-
|
|
101
|
-
Examples:
|
|
102
|
-
```python
|
|
103
|
-
>>> import jijmodeling as jm
|
|
104
|
-
>>> d = jm.Placeholder("d", dim=1)
|
|
105
|
-
>>> n = d.shape[0]
|
|
106
|
-
>>> i = jm.Element("i", n)
|
|
107
|
-
>>> x = jm.Binary("x", shape=(n,))
|
|
108
|
-
>>> problem = jm.Problem("sample")
|
|
109
|
-
>>> problem.add(x[:]) # add cost
|
|
110
|
-
>>> problem.add(jm.Constraint("onehot", x[:] == 1)) # add constraint
|
|
111
|
-
>>> problem.add(jm.Penalty("penalty", x[0] + x[2])) # add penalty
|
|
112
|
-
>>> problem += x[:] # syntax sugar `+=`
|
|
113
|
-
>>> problem += jm.Constraint("onehot", jm.Sum(i, d[i]*x[i]) <= 3)
|
|
114
|
-
```
|
|
115
|
-
"""
|
|
116
|
-
if not isinstance(
|
|
117
|
-
other,
|
|
118
|
-
(
|
|
119
|
-
int,
|
|
120
|
-
float,
|
|
121
|
-
_expression.Expression,
|
|
122
|
-
_constraint.Constraint,
|
|
123
|
-
_constraint.Penalty,
|
|
124
|
-
),
|
|
125
|
-
):
|
|
126
|
-
raise TypeError(f"could not add {type(other)} to Problem.")
|
|
127
|
-
# extract constraints
|
|
128
|
-
if isinstance(other, _expression.Expression):
|
|
129
|
-
# check index dependencies
|
|
130
|
-
indices = _utils.expression_indices(other)
|
|
131
|
-
if len(indices) > 0:
|
|
132
|
-
raise _exceptions.ModelingError(
|
|
133
|
-
"{} depends on {}. The dependence on subscripts needs to be eliminated.".format(
|
|
134
|
-
other, indices
|
|
135
|
-
)
|
|
136
|
-
)
|
|
137
|
-
self._objective += other
|
|
138
|
-
elif isinstance(other, _constraint.Constraint):
|
|
139
|
-
# TODO CHECK CONSTRAINT SUBSCRIPTION DEPENDENCES
|
|
140
|
-
self._constraints[other.label] = other
|
|
141
|
-
elif isinstance(other, _constraint.Penalty):
|
|
142
|
-
# check index dependencies
|
|
143
|
-
term = other.penalty_term
|
|
144
|
-
indices = _utils.expression_indices(term)
|
|
145
|
-
if len(indices) > len(other.forall):
|
|
146
|
-
raise _exceptions.ModelingError(
|
|
147
|
-
"{} depends on {}. The dependence on subscripts needs to be eliminated.".format(
|
|
148
|
-
term, indices
|
|
149
|
-
)
|
|
150
|
-
)
|
|
151
|
-
self._penalties[other.label] = other
|
|
152
|
-
|
|
153
|
-
def __add__(
|
|
154
|
-
self,
|
|
155
|
-
other: tp.Union[
|
|
156
|
-
_expression.Expression, _constraint.Constraint, _constraint.Penalty
|
|
157
|
-
],
|
|
158
|
-
) -> Problem:
|
|
159
|
-
self.add(other)
|
|
160
|
-
return self
|
|
161
|
-
|
|
162
|
-
def _repr_latex_(self) -> str:
|
|
163
|
-
from jijmodeling.latex_repr.problem_latex_repr import problem_latex_repr
|
|
164
|
-
|
|
165
|
-
latex_repr = problem_latex_repr(self)
|
|
166
|
-
return r"$$\begin{alignat*}{4}" + latex_repr + r"\end{alignat*}$$"
|
jijmodeling/protobuf/__init__.py
DELETED
|
Binary file
|
|
Binary file
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from pkgutil import extend_path
|
|
4
|
-
|
|
5
|
-
__path__ = extend_path(__path__, __name__)
|
|
6
|
-
|
|
7
|
-
import jijmodeling.protobuf.from_protobuf.extract_attribute_value_from_header as extract_attribute_value_from_header
|
|
8
|
-
import jijmodeling.protobuf.from_protobuf.from_protobuf as from_protobuf
|
|
9
|
-
import jijmodeling.protobuf.from_protobuf.message_to_array_shape as message_to_array_shape
|
|
10
|
-
import jijmodeling.protobuf.from_protobuf.message_to_binary_op as message_to_binary_op
|
|
11
|
-
import jijmodeling.protobuf.from_protobuf.message_to_binary_var as message_to_binary_var
|
|
12
|
-
import jijmodeling.protobuf.from_protobuf.message_to_constraint as message_to_constraint
|
|
13
|
-
import jijmodeling.protobuf.from_protobuf.message_to_element as message_to_element
|
|
14
|
-
import jijmodeling.protobuf.from_protobuf.message_to_expression as message_to_expression
|
|
15
|
-
import jijmodeling.protobuf.from_protobuf.message_to_forall as message_to_forall
|
|
16
|
-
import jijmodeling.protobuf.from_protobuf.message_to_integer_var as message_to_integer_var
|
|
17
|
-
import jijmodeling.protobuf.from_protobuf.message_to_jagged_array as message_to_jagged_array
|
|
18
|
-
import jijmodeling.protobuf.from_protobuf.message_to_number_lit as message_to_number_lit
|
|
19
|
-
import jijmodeling.protobuf.from_protobuf.message_to_penalty as message_to_penalty
|
|
20
|
-
import jijmodeling.protobuf.from_protobuf.message_to_placeholder as message_to_placeholder
|
|
21
|
-
import jijmodeling.protobuf.from_protobuf.message_to_problem as message_to_problem
|
|
22
|
-
import jijmodeling.protobuf.from_protobuf.message_to_reduction_op as message_to_reduction_op
|
|
23
|
-
import jijmodeling.protobuf.from_protobuf.message_to_subscript_op as message_to_subscript_op
|
|
24
|
-
import jijmodeling.protobuf.from_protobuf.message_to_unary_op as message_to_unary_op
|
|
25
|
-
|
|
26
|
-
# from jijmodeling.protobuf.from_protobuf.from_protobuf import from_protobuf
|
|
27
|
-
|
|
28
|
-
__all__ = [
|
|
29
|
-
"extract_attribute_value_from_header",
|
|
30
|
-
"from_protobuf",
|
|
31
|
-
"message_to_array_shape",
|
|
32
|
-
"message_to_binary_op",
|
|
33
|
-
"message_to_binary_var",
|
|
34
|
-
"message_to_constraint",
|
|
35
|
-
"message_to_element",
|
|
36
|
-
"message_to_expression",
|
|
37
|
-
"message_to_forall",
|
|
38
|
-
"message_to_integer_var",
|
|
39
|
-
"message_to_jagged_array",
|
|
40
|
-
"message_to_number_lit",
|
|
41
|
-
"message_to_penalty",
|
|
42
|
-
"message_to_placeholder",
|
|
43
|
-
"message_to_problem",
|
|
44
|
-
"message_to_reduction_op",
|
|
45
|
-
"message_to_subscript_op",
|
|
46
|
-
"message_to_unary_op",
|
|
47
|
-
]
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
jijmodeling/protobuf/from_protobuf/__pycache__/extract_attribute_value_from_header.cpython-310.pyc
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
jijmodeling/protobuf/from_protobuf/__pycache__/message_to_jagged_array.cpython-310.opt-1.pyc
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|