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,139 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import typing as tp
|
|
4
|
-
|
|
5
|
-
import jijmodeling.exceptions.exceptions as _exceptions
|
|
6
|
-
import jijmodeling.expression.condition as _condition
|
|
7
|
-
import jijmodeling.expression.expression as _expression
|
|
8
|
-
import jijmodeling.expression.variables.deci_vars as _deci_vars
|
|
9
|
-
import jijmodeling.expression.variables.variable as _variable
|
|
10
|
-
import jijmodeling.problem.problem as _problem
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def extract_variables(
|
|
14
|
-
expression: _expression.Expression,
|
|
15
|
-
) -> tp.List[_variable.Variable]:
|
|
16
|
-
"""
|
|
17
|
-
Extract variables.
|
|
18
|
-
|
|
19
|
-
Args:
|
|
20
|
-
expression (Expression): target expression
|
|
21
|
-
|
|
22
|
-
Returns:
|
|
23
|
-
Set[Variable]: A set of variables included in the expression.
|
|
24
|
-
|
|
25
|
-
Examples:
|
|
26
|
-
```python
|
|
27
|
-
>>> import jijmodeling as jm
|
|
28
|
-
>>> from jijmodeling.expression.extract import extract_variables
|
|
29
|
-
>>> a = jm.Placeholder("d", dim=2)
|
|
30
|
-
>>> n = a.shape[0]
|
|
31
|
-
>>> x = jm.Binary("x", shape=(n, ))
|
|
32
|
-
>>> i, j = jm.Element("i", n), jm.Element("j", n)
|
|
33
|
-
>>> term = jm.Sum([i, j], x[i] - s[i, j])
|
|
34
|
-
>>> extract_variables(term)
|
|
35
|
-
{j, i, s, x, a, a_shape_0}
|
|
36
|
-
```
|
|
37
|
-
"""
|
|
38
|
-
return list(_extract_var_dict(expression).values())
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def _extract_var_dict(
|
|
42
|
-
expression: _expression.Expression,
|
|
43
|
-
) -> tp.Dict[str, _variable.Variable]:
|
|
44
|
-
var_set = {}
|
|
45
|
-
for child in expression.children():
|
|
46
|
-
var_set.update(_extract_var_dict(child))
|
|
47
|
-
if isinstance(expression, _variable.Variable):
|
|
48
|
-
var_set[expression.uuid] = expression
|
|
49
|
-
return var_set
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
def extract_vars_from_cond(
|
|
53
|
-
condition: _condition.Condition,
|
|
54
|
-
) -> tp.List[_variable.Variable]:
|
|
55
|
-
return list(_extract_vars_from_cond_dict(condition).values())
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
def _extract_vars_from_cond_dict(
|
|
59
|
-
condition: _condition.Condition,
|
|
60
|
-
) -> tp.Dict[str, _variable.Variable]:
|
|
61
|
-
if isinstance(condition, _condition.CompareCondition):
|
|
62
|
-
var_dict = _extract_var_dict(condition.left)
|
|
63
|
-
var_dict.update(_extract_var_dict(condition.right))
|
|
64
|
-
return var_dict
|
|
65
|
-
|
|
66
|
-
elif isinstance(condition, _condition.ConditionOperator):
|
|
67
|
-
var_dict = _extract_vars_from_cond_dict(condition.left)
|
|
68
|
-
var_dict.update(_extract_vars_from_cond_dict(condition.right))
|
|
69
|
-
return var_dict
|
|
70
|
-
else:
|
|
71
|
-
return {}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
def extract_vars_from_problem(problem: _problem.Problem) -> tp.List[_variable.Variable]:
|
|
75
|
-
return list(_extract_vars_from_problem_dict(problem).values())
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
def _extract_vars_from_problem_dict(
|
|
79
|
-
problem: _problem.Problem,
|
|
80
|
-
) -> tp.Dict[str, _variable.Variable]:
|
|
81
|
-
|
|
82
|
-
# Extracts all variables from the objective function
|
|
83
|
-
variables = _extract_var_dict(problem.objective)
|
|
84
|
-
|
|
85
|
-
# Extracts all variables from all the constraints
|
|
86
|
-
for constraint in problem.constraints.values():
|
|
87
|
-
variables.update(_extract_vars_from_cond_dict(constraint.condition))
|
|
88
|
-
for index, condition in constraint.forall:
|
|
89
|
-
variables.update(_extract_var_dict(index))
|
|
90
|
-
variables.update(_extract_vars_from_cond_dict(condition))
|
|
91
|
-
if constraint.left_lower is not None:
|
|
92
|
-
variables.update(_extract_var_dict(constraint.left_lower))
|
|
93
|
-
|
|
94
|
-
# Extracts all variables from all the user-defined penalty
|
|
95
|
-
for penalty in problem.penalties.values():
|
|
96
|
-
variables.update(_extract_var_dict(penalty.penalty_term))
|
|
97
|
-
for index, condition in penalty.forall:
|
|
98
|
-
variables.update(_extract_var_dict(index))
|
|
99
|
-
variables.update(_extract_vars_from_cond_dict(condition))
|
|
100
|
-
|
|
101
|
-
return variables
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
def check_unique_variable_label(expression: _expression.Expression):
|
|
105
|
-
"""
|
|
106
|
-
Check unique variable label.
|
|
107
|
-
|
|
108
|
-
Args:
|
|
109
|
-
expression (Expression): target expression
|
|
110
|
-
|
|
111
|
-
Raises:
|
|
112
|
-
ModelingError: If label is not unique.
|
|
113
|
-
"""
|
|
114
|
-
variables = extract_variables(expression)
|
|
115
|
-
var_labels = []
|
|
116
|
-
for v in variables:
|
|
117
|
-
if v.label not in var_labels:
|
|
118
|
-
var_labels.append(v.label)
|
|
119
|
-
else:
|
|
120
|
-
raise _exceptions.ModelingError(
|
|
121
|
-
f"It seems that the variable {v.label} is defined twice. "
|
|
122
|
-
+ "Please check the label when defining the variable."
|
|
123
|
-
)
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
def has_decivar(expression: _expression.Expression) -> bool:
|
|
127
|
-
variables = extract_variables(expression)
|
|
128
|
-
for v in variables:
|
|
129
|
-
if isinstance(v, _deci_vars.DecisionVariable):
|
|
130
|
-
return True
|
|
131
|
-
return False
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
def condition_has_decivar(condition: _condition.Condition) -> bool:
|
|
135
|
-
variables = extract_vars_from_cond(condition)
|
|
136
|
-
for v in variables:
|
|
137
|
-
if isinstance(v, _deci_vars.DecisionVariable):
|
|
138
|
-
return True
|
|
139
|
-
return False
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from jijmodeling.expression.condition import (
|
|
4
|
-
AndOperator,
|
|
5
|
-
Equal,
|
|
6
|
-
LessThan,
|
|
7
|
-
LessThanEqual,
|
|
8
|
-
NoneCondition,
|
|
9
|
-
OrOperator,
|
|
10
|
-
XorOperator,
|
|
11
|
-
)
|
|
12
|
-
from jijmodeling.expression.constraint import Constraint, Penalty
|
|
13
|
-
from jijmodeling.expression.expression import (
|
|
14
|
-
Add,
|
|
15
|
-
Div,
|
|
16
|
-
Expression,
|
|
17
|
-
Mod,
|
|
18
|
-
Mul,
|
|
19
|
-
Number,
|
|
20
|
-
Power,
|
|
21
|
-
)
|
|
22
|
-
from jijmodeling.expression.mathfunc import AbsoluteValue, Ceil, Floor, Log2, Max, Min
|
|
23
|
-
from jijmodeling.expression.prod import ProdOperator
|
|
24
|
-
from jijmodeling.expression.sum import SumOperator
|
|
25
|
-
from jijmodeling.expression.variables.deci_vars import Binary, Integer
|
|
26
|
-
from jijmodeling.expression.variables.jagged_array import JaggedArray
|
|
27
|
-
from jijmodeling.expression.variables.placeholders import ArrayShape, Placeholder
|
|
28
|
-
from jijmodeling.expression.variables.variable import Element, Range, Subscripts
|
|
29
|
-
from jijmodeling.problem import Problem, ProblemSense
|
|
30
|
-
|
|
31
|
-
_OLD_NAME_TO_CLASS = {
|
|
32
|
-
"jijmodeling.expression.variables.placeholders.Placeholder": Placeholder,
|
|
33
|
-
"jijmodleing.expression.variables.jagged_array.JaggedArray": JaggedArray,
|
|
34
|
-
"jijmodeling.expression.variables.variable.Subscripts": Subscripts,
|
|
35
|
-
"jijmodeling.expression.variables.variable.Element": Element,
|
|
36
|
-
"jijmodeling.expression.variables.variable.Range": Range,
|
|
37
|
-
"jijmodeling.expression.variables.placeholders.ArrayShape": ArrayShape,
|
|
38
|
-
"jijmodeling.expression.expression.Number": Number,
|
|
39
|
-
"jijmodeling.expression.expression.Add": Add,
|
|
40
|
-
"jijmodeling.expression.expression.Mul": Mul,
|
|
41
|
-
"jijmodeling.expression.expression.Div": Div,
|
|
42
|
-
"jijmodeling.expression.expression.Power": Power,
|
|
43
|
-
"jijmodeling.expression.expression.Mod": Mod,
|
|
44
|
-
"jijmodeling.expression.mathfunc.AbsoluteValue": AbsoluteValue,
|
|
45
|
-
"jijmodeling.expression.mathfunc.Max": Max,
|
|
46
|
-
"jijmodeling.expression.mathfunc.Min": Min,
|
|
47
|
-
"jijmodeling.expression.mathfunc.Ceil": Ceil,
|
|
48
|
-
"jijmodeling.expression.mathfunc.Floor": Floor,
|
|
49
|
-
"jijmodeling.expression.mathfunc.Log2": Log2,
|
|
50
|
-
"jijmodeling.expression.prod.ProdOperator": ProdOperator,
|
|
51
|
-
"jijmodeling.expression.sum.SumOperator": SumOperator,
|
|
52
|
-
"jijmodeling.expression.variables.deci_vars.Binary": Binary,
|
|
53
|
-
"jijmodeling.expression.variables.deci_vars.LogEncInteger": Integer,
|
|
54
|
-
"jijmodeling.expression.condition.NoneCondition": NoneCondition,
|
|
55
|
-
"jijmodeling.expression.condition.AndOperator": AndOperator,
|
|
56
|
-
"jijmodeling.expression.condition.OrOperator": OrOperator,
|
|
57
|
-
"jijmodeling.expression.condition.XorOperator": XorOperator,
|
|
58
|
-
"jijmodeling.expression.condition.Equal": Equal,
|
|
59
|
-
"jijmodeling.expression.condition.LessEqual": LessThan,
|
|
60
|
-
"jijmodeling.expression.condition.LessThanEqual": LessThanEqual,
|
|
61
|
-
"jijmodeling.expression.constraint.Constraint": Constraint,
|
|
62
|
-
"jijmodeling.expression.constraint.Penalty": Penalty,
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
def from_0_10_0_serializable(serializable: dict) -> Problem:
|
|
67
|
-
if not serializable["version"] == "0.10.0":
|
|
68
|
-
raise ValueError(
|
|
69
|
-
f"In 'from_0_10_0_serializable', support only 0.10.0, not {serializable['version']}."
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
object_schema = serializable["object"]
|
|
73
|
-
if not object_schema["class"] == "jijmodeling.problem.Problem":
|
|
74
|
-
raise ValueError(
|
|
75
|
-
f"{object_schema['class']} is not supported in 'from_0_10_0_serializable'."
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
attributes = object_schema["attributes"]
|
|
79
|
-
name = attributes["name"]
|
|
80
|
-
_kind_map = {"Minimum": ProblemSense.MINIMUM, "Maximum": ProblemSense.MAXIMUM}
|
|
81
|
-
kind = _kind_map[attributes["kind"]]
|
|
82
|
-
objective = _class_0100_from_serializable(attributes["objective"])
|
|
83
|
-
constraints = [
|
|
84
|
-
_class_0100_from_serializable(c) for c in attributes["constraints"].values()
|
|
85
|
-
]
|
|
86
|
-
penalties = [
|
|
87
|
-
_class_0100_from_serializable(c) for c in attributes["penalties"].values()
|
|
88
|
-
]
|
|
89
|
-
|
|
90
|
-
problem = Problem(name, sense=kind)
|
|
91
|
-
problem += objective
|
|
92
|
-
for c in constraints:
|
|
93
|
-
problem += c
|
|
94
|
-
for p in penalties:
|
|
95
|
-
problem += p
|
|
96
|
-
|
|
97
|
-
return problem
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
def old_0_10_0_to_new_from_serializable(serializable: dict) -> Expression:
|
|
101
|
-
"""Deserialize from old schema to new JijModeling Expression."""
|
|
102
|
-
object_schema = serializable["object"]
|
|
103
|
-
return _class_0100_from_serializable(object_schema)
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
def _0100_from_serializable(object_schema: dict | int | float | None):
|
|
107
|
-
if not isinstance(object_schema, dict):
|
|
108
|
-
return object_schema
|
|
109
|
-
if "class" in object_schema:
|
|
110
|
-
return _class_0100_from_serializable(object_schema)
|
|
111
|
-
elif "iteratable" in object_schema:
|
|
112
|
-
return _iteratable_0100_from_serializable(object_schema)
|
|
113
|
-
else:
|
|
114
|
-
raise ValueError(
|
|
115
|
-
f"'{object_schema.keys()}' is not supported in 0_10_0 deserializer."
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
def _iteratable_0100_from_serializable(object_schema: dict):
|
|
120
|
-
value = [_0100_from_serializable(v) for v in object_schema["value"]]
|
|
121
|
-
if object_schema["iteratable"] == "tuple":
|
|
122
|
-
return tuple(value)
|
|
123
|
-
else:
|
|
124
|
-
return value
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
def _class_0100_from_serializable(object_schema: dict):
|
|
128
|
-
jm_cls = _OLD_NAME_TO_CLASS[object_schema["class"]]
|
|
129
|
-
attributes = object_schema["attributes"]
|
|
130
|
-
|
|
131
|
-
attr_values = {k: _0100_from_serializable(v) for k, v in attributes.items()}
|
|
132
|
-
|
|
133
|
-
return jm_cls(**attr_values)
|
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import abc as _abc
|
|
4
|
-
import builtins as _builtins
|
|
5
|
-
import numbers as _numbers
|
|
6
|
-
import typing as tp
|
|
7
|
-
|
|
8
|
-
from abc import abstractmethod
|
|
9
|
-
|
|
10
|
-
import numpy as np
|
|
11
|
-
import typeguard as _typeguard
|
|
12
|
-
|
|
13
|
-
import jijmodeling.exceptions.exceptions as _exceptions
|
|
14
|
-
import jijmodeling.expression.expression as _expression
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class UnaryOperator(_expression.Expression, metaclass=_abc.ABCMeta):
|
|
18
|
-
"""
|
|
19
|
-
Binary Operator class represents each operation (ex. +,*,&,...) on `_expression.Expression`.
|
|
20
|
-
"""
|
|
21
|
-
|
|
22
|
-
_mark = " "
|
|
23
|
-
|
|
24
|
-
def __init__(
|
|
25
|
-
self,
|
|
26
|
-
operand: tp.Union[_expression.Expression, _expression.NumericValue],
|
|
27
|
-
uuid: tp.Optional[str] = None,
|
|
28
|
-
):
|
|
29
|
-
|
|
30
|
-
super().__init__()
|
|
31
|
-
|
|
32
|
-
_typeguard.check_type(
|
|
33
|
-
"operand",
|
|
34
|
-
operand,
|
|
35
|
-
tp.Union[_expression.Expression, _expression.NumericValue],
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
# convert int float to Number
|
|
39
|
-
self._operand: _expression.Expression = (
|
|
40
|
-
operand
|
|
41
|
-
if isinstance(operand, _expression.Expression)
|
|
42
|
-
else _expression.Number(operand)
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
import jijmodeling.utils.utils as _utils
|
|
46
|
-
|
|
47
|
-
_utils.validate_value("operand.is_operatable()", self._operand.is_operatable())
|
|
48
|
-
|
|
49
|
-
import jijmodeling.expression.extract as _extract
|
|
50
|
-
|
|
51
|
-
if _extract.has_decivar(self._operand):
|
|
52
|
-
raise _exceptions.CannotContainDecisionVarError(
|
|
53
|
-
"An unary operator operand cannot contain a decision variable."
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
if uuid is not None:
|
|
57
|
-
self._uuid = uuid
|
|
58
|
-
|
|
59
|
-
@property
|
|
60
|
-
def operand(self) -> _expression.Expression:
|
|
61
|
-
return self._operand
|
|
62
|
-
|
|
63
|
-
@classmethod
|
|
64
|
-
@abstractmethod
|
|
65
|
-
def operation(
|
|
66
|
-
cls: tp.Type[UnaryOperator], operand: _expression.NumericValue
|
|
67
|
-
) -> _expression.NumericValue:
|
|
68
|
-
"""
|
|
69
|
-
Execute operation.
|
|
70
|
-
|
|
71
|
-
Example:
|
|
72
|
-
>>> Ceil.operation(4.3)
|
|
73
|
-
5
|
|
74
|
-
>>> Floor.operation(3.9)
|
|
75
|
-
3
|
|
76
|
-
>>> Log2.operation(4)
|
|
77
|
-
2.0
|
|
78
|
-
"""
|
|
79
|
-
|
|
80
|
-
@classmethod
|
|
81
|
-
def create(
|
|
82
|
-
cls: tp.Type[UnaryOperator],
|
|
83
|
-
operand: tp.Union[_expression.Expression, _expression.NumericValue],
|
|
84
|
-
) -> _expression.Expression:
|
|
85
|
-
if isinstance(operand, (int, float, _numbers.Real)):
|
|
86
|
-
return _expression.Number(cls.operation(operand))
|
|
87
|
-
elif isinstance(operand, _expression.Number):
|
|
88
|
-
return _expression.Number(cls.operation(operand.value))
|
|
89
|
-
elif isinstance(operand, _expression.Expression):
|
|
90
|
-
return cls(operand)
|
|
91
|
-
else:
|
|
92
|
-
raise _exceptions.ModelingError(
|
|
93
|
-
"The operand of {} is support only number or_expression.Expression, not {}.".format(
|
|
94
|
-
cls.__name__, operand.__class__.__name__
|
|
95
|
-
)
|
|
96
|
-
)
|
|
97
|
-
|
|
98
|
-
def is_operatable(self) -> bool:
|
|
99
|
-
"""
|
|
100
|
-
Unary operator is operatable.
|
|
101
|
-
|
|
102
|
-
Returns:
|
|
103
|
-
bool: True
|
|
104
|
-
"""
|
|
105
|
-
return True
|
|
106
|
-
|
|
107
|
-
def children(self) -> tp.List[_expression.Expression]:
|
|
108
|
-
return [self.operand]
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
class AbsoluteValue(UnaryOperator):
|
|
112
|
-
def __repr__(self) -> str:
|
|
113
|
-
return "|" + str(self.operand) + "|"
|
|
114
|
-
|
|
115
|
-
@classmethod
|
|
116
|
-
def operation(cls, operand: _expression.NumericValue) -> _expression.NumericValue:
|
|
117
|
-
abs_value: _expression.NumericValue = np.abs(operand)
|
|
118
|
-
return abs_value
|
|
119
|
-
|
|
120
|
-
def _default_repr_latex_(self) -> str:
|
|
121
|
-
return r"\left|" + self.operand._make_latex() + r"\right|"
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
class Max(_expression.BinaryOperator):
|
|
125
|
-
def __init__(
|
|
126
|
-
self,
|
|
127
|
-
left: _expression.Expression,
|
|
128
|
-
right: _expression.Expression,
|
|
129
|
-
uuid: tp.Optional[str] = None,
|
|
130
|
-
):
|
|
131
|
-
super().__init__(left, right, uuid)
|
|
132
|
-
|
|
133
|
-
import jijmodeling.expression.extract as _extract
|
|
134
|
-
|
|
135
|
-
if _extract.has_decivar(self.left) or _extract.has_decivar(self.right):
|
|
136
|
-
raise _exceptions.CannotContainDecisionVarError(
|
|
137
|
-
"operands of Max function cannot contain a decision variable."
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
def __repr__(self) -> str:
|
|
141
|
-
return "max(" + ",".join(map(str, [self.left, self.right])) + ")"
|
|
142
|
-
|
|
143
|
-
@classmethod
|
|
144
|
-
def operation(cls, left, right) -> tp.Any:
|
|
145
|
-
return _builtins.max(left, right)
|
|
146
|
-
|
|
147
|
-
def _default_repr_latex_(self) -> str:
|
|
148
|
-
left = self.left._make_latex()
|
|
149
|
-
right = self.right._make_latex()
|
|
150
|
-
return r"\max(" + f"{left}, {right})"
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
class Min(_expression.BinaryOperator):
|
|
154
|
-
def __init__(
|
|
155
|
-
self,
|
|
156
|
-
left: _expression.Expression,
|
|
157
|
-
right: _expression.Expression,
|
|
158
|
-
uuid: tp.Optional[str] = None,
|
|
159
|
-
):
|
|
160
|
-
super().__init__(left, right, uuid)
|
|
161
|
-
|
|
162
|
-
import jijmodeling.expression.extract as _extract
|
|
163
|
-
|
|
164
|
-
if _extract.has_decivar(self.left) or _extract.has_decivar(self.right):
|
|
165
|
-
raise _exceptions.CannotContainDecisionVarError(
|
|
166
|
-
"operands of Max function cannot contain a decision variable."
|
|
167
|
-
)
|
|
168
|
-
|
|
169
|
-
def __repr__(self) -> str:
|
|
170
|
-
return "min(" + ",".join(map(str, [self.left, self.right])) + ")"
|
|
171
|
-
|
|
172
|
-
@classmethod
|
|
173
|
-
def operation(cls, left, right) -> tp.Any:
|
|
174
|
-
return _builtins.min(left, right)
|
|
175
|
-
|
|
176
|
-
def _default_repr_latex_(self) -> str:
|
|
177
|
-
left = self.left._make_latex()
|
|
178
|
-
right = self.right._make_latex()
|
|
179
|
-
return r"\min(" + f"{left}, {right})"
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
class Ceil(UnaryOperator):
|
|
183
|
-
def __repr__(self):
|
|
184
|
-
return "[" + str(self.operand) + "]"
|
|
185
|
-
|
|
186
|
-
@classmethod
|
|
187
|
-
def operation(cls, operand: _expression.NumericValue) -> _expression.NumericValue:
|
|
188
|
-
ceil_value: _expression.NumericValue = np.ceil(operand)
|
|
189
|
-
return ceil_value
|
|
190
|
-
|
|
191
|
-
def _default_repr_latex_(self) -> str:
|
|
192
|
-
term_str = (
|
|
193
|
-
self.operand._make_latex()
|
|
194
|
-
if isinstance(self.operand, _expression.Expression)
|
|
195
|
-
else str(self.operand)
|
|
196
|
-
)
|
|
197
|
-
return r"\left\lceil " + term_str + r"\right\rceil"
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
class Floor(UnaryOperator):
|
|
201
|
-
def __repr__(self) -> str:
|
|
202
|
-
return "|_" + str(self.operand) + "_|"
|
|
203
|
-
|
|
204
|
-
@classmethod
|
|
205
|
-
def operation(cls, operand: _expression.NumericValue) -> _expression.NumericValue:
|
|
206
|
-
floor_value: _expression.NumericValue = np.floor(operand)
|
|
207
|
-
return floor_value
|
|
208
|
-
|
|
209
|
-
def _default_repr_latex_(self) -> str:
|
|
210
|
-
term_str = (
|
|
211
|
-
self.operand._make_latex()
|
|
212
|
-
if isinstance(self.operand, _expression.Expression)
|
|
213
|
-
else str(self._operand)
|
|
214
|
-
)
|
|
215
|
-
return r"\left\lfloor " + term_str + r"\right\floor "
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
class Log2(UnaryOperator):
|
|
219
|
-
def __repr__(self) -> str:
|
|
220
|
-
return f"log2({str(self.operand)})"
|
|
221
|
-
|
|
222
|
-
@classmethod
|
|
223
|
-
def operation(cls, operand: _expression.NumericValue) -> tp.Any:
|
|
224
|
-
return np.log2(operand)
|
|
225
|
-
|
|
226
|
-
def _default_repr_latex_(self) -> str:
|
|
227
|
-
return r"\log_2" + f"({self.operand._make_latex()})"
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
def abs(term) -> _expression.Expression:
|
|
231
|
-
"""Absolute function."""
|
|
232
|
-
return AbsoluteValue.create(term)
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
def ceil(term) -> _expression.Expression:
|
|
236
|
-
"""Ceiling function."""
|
|
237
|
-
return Ceil.create(term)
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
def floor(term) -> _expression.Expression:
|
|
241
|
-
"""Floor function."""
|
|
242
|
-
return Floor.create(term)
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
def log2(antilog) -> _expression.Expression:
|
|
246
|
-
"""
|
|
247
|
-
Log function.
|
|
248
|
-
|
|
249
|
-
Args:
|
|
250
|
-
antilog (int | float |_expression.Expression): antilog
|
|
251
|
-
|
|
252
|
-
```math
|
|
253
|
-
\\log_{2}\\mathrm{antilog}
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
Returns:
|
|
257
|
-
Log: Log2 value
|
|
258
|
-
"""
|
|
259
|
-
return Log2.create(antilog)
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
def max(left, right) -> _expression.Expression:
|
|
263
|
-
"""Max function."""
|
|
264
|
-
return Max.create(left, right)
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
def min(left, right) -> _expression.Expression:
|
|
268
|
-
"""Min function."""
|
|
269
|
-
return Min.create(left, right)
|
jijmodeling/expression/prod.py
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import List, Optional, Tuple, Union
|
|
4
|
-
|
|
5
|
-
from typeguard import typechecked
|
|
6
|
-
|
|
7
|
-
import jijmodeling.expression.condition as _condition
|
|
8
|
-
import jijmodeling.expression.expression as _expression
|
|
9
|
-
import jijmodeling.expression.sum as _sum
|
|
10
|
-
|
|
11
|
-
# type validation
|
|
12
|
-
import jijmodeling.expression.variables.variable as _variable
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class ProdOperator(_sum.ReductionOperator):
|
|
16
|
-
pass
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
INDEXWITHCOND = Union[_variable.Element, Tuple[_variable.Element, _condition.Condition]]
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def Prod(
|
|
23
|
-
indices: Union[INDEXWITHCOND, List[INDEXWITHCOND]],
|
|
24
|
-
term: _expression.Expression,
|
|
25
|
-
) -> ProdOperator:
|
|
26
|
-
"""
|
|
27
|
-
Prod function.
|
|
28
|
-
|
|
29
|
-
Args:
|
|
30
|
-
indices: index list of index.
|
|
31
|
-
term (Expression): operand
|
|
32
|
-
|
|
33
|
-
Returns:
|
|
34
|
-
ProdOperator: ProdOperator object.
|
|
35
|
-
|
|
36
|
-
Example:
|
|
37
|
-
Create $\\prod_{i=0}^n d_i x_i$
|
|
38
|
-
|
|
39
|
-
```python
|
|
40
|
-
import jijmodeling as jm
|
|
41
|
-
d = jm.Placeholder('d', dim=1)
|
|
42
|
-
n = d.shape[0]
|
|
43
|
-
x = jm.Binary('x', shape=n)
|
|
44
|
-
i = jm._variable.Element('i', n)
|
|
45
|
-
jm.Prod(i, d[i]*x[i])
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Π_{i}(d[i]x[i])
|
|
49
|
-
|
|
50
|
-
Create $\\prod_{i}\\sum_j d_{ij}x_i x_j$
|
|
51
|
-
|
|
52
|
-
```python
|
|
53
|
-
import jijmodeling as jm
|
|
54
|
-
d = jm.Placeholder('d', dim = 2)
|
|
55
|
-
n = d.shape[0]
|
|
56
|
-
x = jm.Binary('x', shape=n)
|
|
57
|
-
i = jm._variable.Element('i', n)
|
|
58
|
-
j = jm._variable.Element('j', n)
|
|
59
|
-
jm.Prod([i, j], d[i, j]*x[i]*x[j])
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Conditional production
|
|
63
|
-
|
|
64
|
-
```python
|
|
65
|
-
import jijmodeling as jm
|
|
66
|
-
d = jm.Placeholder('d', dim = 2)
|
|
67
|
-
n = d.shape[0]
|
|
68
|
-
i, j = jm._variable.Element("i", n), jm._variable.Element("j", n)
|
|
69
|
-
x = jm.Binary('x', shape=n)
|
|
70
|
-
jm.Prod([i, (j, i < j)], d[i, j]*x[i]*x[j])
|
|
71
|
-
```
|
|
72
|
-
"""
|
|
73
|
-
|
|
74
|
-
# convert indices and condition to list-type object
|
|
75
|
-
# ex. i -> [i]
|
|
76
|
-
indices_list = indices if isinstance(indices, list) else [indices] # type: ignore
|
|
77
|
-
|
|
78
|
-
# element type from users
|
|
79
|
-
IndexType = Union[
|
|
80
|
-
_variable.Element, Tuple[_variable.Element, Optional[_condition.Condition]]
|
|
81
|
-
]
|
|
82
|
-
|
|
83
|
-
@typechecked
|
|
84
|
-
def convert_to_element(
|
|
85
|
-
index: IndexType,
|
|
86
|
-
) -> Tuple[_variable.Element, Optional[_condition.Condition]]:
|
|
87
|
-
if isinstance(
|
|
88
|
-
index, tuple
|
|
89
|
-
): # Tuple[_variable.ElementType, Optional[Condition]]
|
|
90
|
-
elem, cond = index
|
|
91
|
-
return (elem, cond)
|
|
92
|
-
else: # _variable.ElementType
|
|
93
|
-
return (index, None)
|
|
94
|
-
|
|
95
|
-
elems_and_conds: List[Tuple[_variable.Element, Optional[_condition.Condition]]] = [
|
|
96
|
-
convert_to_element(index) for index in indices_list
|
|
97
|
-
]
|
|
98
|
-
elements = [elem for elem, _ in elems_and_conds]
|
|
99
|
-
condition_list = [cond for _, cond in elems_and_conds]
|
|
100
|
-
|
|
101
|
-
# list length validation
|
|
102
|
-
import jijmodeling.utils.utils as _utils
|
|
103
|
-
|
|
104
|
-
_utils.validate_value("len(indices) > 0", len(elements) > 0)
|
|
105
|
-
_utils.validate_value("len(condition_list) > 0", len(condition_list) > 0)
|
|
106
|
-
_utils.validate_value(
|
|
107
|
-
"len(indices_list) == len(condition_list)",
|
|
108
|
-
len(indices_list) == len(condition_list),
|
|
109
|
-
)
|
|
110
|
-
sum_term = term
|
|
111
|
-
for sum_index, cond in zip(elements[::-1], condition_list[::-1]):
|
|
112
|
-
sum_term = ProdOperator(
|
|
113
|
-
sum_index=sum_index,
|
|
114
|
-
operand=sum_term,
|
|
115
|
-
condition=cond if cond is not None else _condition.NoneCondition(),
|
|
116
|
-
)
|
|
117
|
-
return sum_term # type: ignore
|