ommx_python_mip_adapter.python_mip_to_ommx
Classes
Build ommx.v1.Instance from Python-MIP Model. |
Functions
|
The function to convert Python-MIP Model to ommx.v1.Instance. |
Module Contents
- class ommx_python_mip_adapter.python_mip_to_ommx.OMMXInstanceBuilder
Build ommx.v1.Instance from Python-MIP Model.
- as_ommx_function(lin_expr: mip.LinExpr) ommx.v1.function_pb2.Function
- build() ommx.v1.Instance
- constraints() list[ommx.v1.constraint_pb2.Constraint]
- decision_variables() list[ommx.v1.DecisionVariable]
Gather decision variables from Python-MIP Model as ommx.v1.DecisionVariable.
- objective() ommx.v1.function_pb2.Function
- sense()
- model: mip.Model
- ommx_python_mip_adapter.python_mip_to_ommx.model_to_instance(model: mip.Model) ommx.v1.Instance
The function to convert Python-MIP Model to ommx.v1.Instance.
Examples
>>> model = mip.Model() >>> x1=model.add_var(name="1", var_type=mip.INTEGER, lb=0, ub=5) >>> x2=model.add_var(name="2", var_type=mip.CONTINUOUS, lb=0, ub=5) >>> model.objective = - x1 - 2 * x2 >>> constr = model.add_constr(x1 + x2 - 6 <= 0) >>> ommx_instance = adapter.model_to_instance(model)