ommx.adapter#
Attributes#
Exceptions#
Raised when the problem is proven to be infeasible. |
|
Raised when no solution was returned. |
|
Raised when the problem is proven to be unbounded. |
Classes#
An abstract interface for OMMX Sampler Adapters, defining how samplers should be used with OMMX. |
|
An abstract interface for OMMX Solver Adapters, defining how solvers should be used with OMMX. |
Module Contents#
- exception InfeasibleDetected#
Raised when the problem is proven to be infeasible.
This corresponds to
Optimality.OPTIMALITY_INFEASIBLEand indicates that the mathematical model itself has no feasible solution. Should not be used when infeasibility cannot be proven (e.g., heuristic solvers).
- exception NoSolutionReturned#
Raised when no solution was returned.
This indicates that the solver did not return any solution (whether feasible or not) (e.g., due to time limits). This does not prove that the mathematical model itself is infeasible.
- exception UnboundedDetected#
Raised when the problem is proven to be unbounded.
This corresponds to
Optimality.OPTIMALITY_UNBOUNDEDand indicates that the mathematical model itself is unbounded. Should not be used when unboundedness cannot be proven (e.g., heuristic solvers).
- class SamplerAdapter(ommx_instance: Instance)#
An abstract interface for OMMX Sampler Adapters, defining how samplers should be used with OMMX.
See the implementation guide for more details.
- ADDITIONAL_CAPABILITIES: frozenset[AdditionalCapability]#
- property sampler_input: SamplerInput#
- Abstractmethod:
- property solver_input: SolverInput#
- Abstractmethod:
- class SolverAdapter(ommx_instance: Instance)#
An abstract interface for OMMX Solver Adapters, defining how solvers should be used with OMMX.
See the implementation guide for more details.
Subclasses should set
ADDITIONAL_CAPABILITIESto declare which non-standard constraint types they can handle. Standard constraints are always supported.Available capabilities:
AdditionalCapability.Indicator: binvar = 1 → f(x) <= 0AdditionalCapability.OneHot: exactly one of a set of binary variables is 1AdditionalCapability.Sos1: at most one of a set of variables is non-zero
The default is an empty set (standard constraints only). Subclasses must call
super().__init__(ommx_instance)so that any constraint types the adapter does not support are automatically converted into regular constraints (Big-M for indicator / SOS1, linear equality for one-hot). Conversions mutateommx_instancein place and are emitted atINFOlevel from the Rust SDK viapyo3-log.- ADDITIONAL_CAPABILITIES: frozenset[AdditionalCapability]#
- property solver_input: SolverInput#
- Abstractmethod:
- SamplerInput#
- SamplerOutput#
- SolverInput#
- SolverOutput#