feat: lower purely-linear FlatZinc floats to LP-only continuous columns#1298
Open
rasros wants to merge 6 commits into
Open
feat: lower purely-linear FlatZinc floats to LP-only continuous columns#1298rasros wants to merge 6 commits into
rasros wants to merge 6 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the hybrid MIP/CP engine (#1232). Stacked on #1294. Extends the LP-only continuous columns to the FlatZinc frontend (Phase 6's second half for FlatZinc).
What
A whole-problem gate: when every float in a FlatZinc model can be LP-only — no var float array, no nonlinear float constraint (
float_timesvar·var,float_abs,array_float_element,float_min/max), no strict (float_lt/float_lin_lt), none, no reified float constraint, and no float objective — all floats lower to LP-only continuous variables (real columns the simplex resolves) instead of bucket-index integers. Otherwise the model keeps the existing bucketing unchanged. This avoids mixing the two representations in one problem.floatsAreLpOnly()sets the gate;allocFloatthen allocates a real var (parallelrealLo/realHi, passed toProblem).float_lin_le/eq,int2float,float_eq/le) emit realLinearrows over the real columns with raw double coefficients (no bucket scaling); the nonlinear handlers are never reached under the gate.FlatZincWriter,OznApplier) reads an LP-only float's value fromSample.reals.Robustness fix (benefits the whole system)
Surfaced that
exactBasisFeasibledeclines on a degenerate inequality-plus-equality vertex (feasible → UNKNOWN). AddedexactPointFeasible: certify the float primal point directly when it snaps to an exact dyadic rational — verify every row (=/≤) and box bound exactly in 128-bit. Wired as a fallback insolveAndCertify, so a feasible dyadic solution is certified SAT even when the basis reconstruction is finicky.Test
FlatZincFloatConstraintsTest(LP-only engages for a linear model + solves feasibly; a nonlinear constraint keeps bucketing),FlatZincParseTest/FlatZincFloatCompareTestupdated for the LP-only path,LpContinuousColumnTest(degenerate vertex certified via the exact point check). Full:klause:jvmTest,:klause-bench:test,:klause:lintDocsgreen.Remaining
The native schema
Compiler(CompilerAssertions.assertFloatLinear) is a separate pure-linear float surface (its ownfloatMeta*tables) — tracked as a follow-up.