ommx_pyscipopt_adapter.adapter#
Attributes#
Classes#
An abstract interface for OMMX Solver Adapters, defining how solvers should be used with OMMX. |
Module Contents#
- class OMMXPySCIPOptAdapter(ommx_instance: Instance, *, use_sos1: Literal['disabled', 'auto', 'forced'] = 'auto', initial_state: ommx.v1.ToState | None = None)#
An abstract interface for OMMX Solver Adapters, defining how solvers should be used with OMMX.
See the implementation guide for more details.
- decode(data: pyscipopt.Model) Solution#
Convert optimized pyscipopt.Model and ommx.v1.Instance to ommx.v1.Solution.
This method is intended to be used if the model has been acquired with solver_input for further adjustment of the solver parameters, and separately optimizing the model.
Note that alterations to the model may make the decoding process incompatible – decoding will only work if the model still describes effectively the same problem as the OMMX instance used to create the adapter.
Examples#
- decode_to_state(data: pyscipopt.Model) State#
Create an ommx.v1.State from an optimized PySCIPOpt Model.
Examples#
- classmethod solve(ommx_instance: Instance, *, use_sos1: Literal['disabled', 'auto', 'forced'] = 'auto', initial_state: ommx.v1.ToState | None = None) Solution#
Solve the given ommx.v1.Instance using PySCIPopt, returning an ommx.v1.Solution.
- Parameters:
ommx_instance – The ommx.v1.Instance to solve.
use_sos1 – Strategy for handling SOS1 constraints.Options: - “disabled”: Do not use SOS1 constraints. - “auto”: Use SOS1 constraints if hints are provided, otherwise solve without them.(default) - “forced”: Require SOS1 constraints and raise an error if no SOS1 constraint hints are found.
initial_state – Optional initial solution state.
Examples#
KnapSack Problem
Infeasible Problem
Unbounded Problem
- instance#
- model#
- property solver_input: pyscipopt.Model#
The PySCIPOpt model generated from this OMMX instance
- use_sos1: HintMode#
- HintMode#