quicopt.mathopt¶
mathopt ¶
quicopt.mathopt — an OR-Tools MathOpt model → Quicopt Program IR.
A second front-end (beside quicopt.pyomo), for authors already holding an
OR-Tools MathOpt <https://developers.google.com/optimization/math_opt>_ model.
It walks a ModelProto — the objective offset + Σ cᵢxᵢ + Σ_{i≤j} qᵢⱼxᵢxⱼ and
each lbᵣ ≤ Σ A[r,j]xⱼ ≤ ubᵣ row — into the IR expression graph, with variable
bounds + integrality into VarDecl and function-in-set rows into
Zero/Nonneg. ±Inf bounds pass straight through (a free direction); a
one-sided range drops its infinite side.
The supported surface is LP / MILP / (unconstrained binary-quadratic) QUBO — the classes the service routes. A MathOpt construct outside it (quadratic / second-order -cone / SOS / indicator constraints, multiple objectives) raises: it is a coverage gap to resolve in the service, never silently dropped here.
Requires the optional [mathopt] extra (pip install -e '.[mathopt]').
import_model ¶
Convert an OR-Tools MathOpt model into Quicopt's Program IR.
model is a ModelProto or a high-level mathopt.Model (exported to
its proto). Variables are named by their MathOpt name, falling back to x{id}
— matching the service's own naming, so solutions line up. A binary variable
(integer with [0,1] bounds) maps to BINARY, other integers to
INTEGER, the rest to CONTINUOUS.