Skip to content

feat: lower purely-linear FlatZinc floats to LP-only continuous columns#1298

Open
rasros wants to merge 6 commits into
mainfrom
feat/lp-fzn-columns
Open

feat: lower purely-linear FlatZinc floats to LP-only continuous columns#1298
rasros wants to merge 6 commits into
mainfrom
feat/lp-fzn-columns

Conversation

@rasros

@rasros rasros commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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_times var·var, float_abs, array_float_element, float_min/max), no strict (float_lt/float_lin_lt), no ne, 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.

  • Prepass floatsAreLpOnly() sets the gate; allocFloat then allocates a real var (parallel realLo/realHi, passed to Problem).
  • The linear float handlers (float_lin_le/eq, int2float, float_eq/le) emit real Linear rows over the real columns with raw double coefficients (no bucket scaling); the nonlinear handlers are never reached under the gate.
  • Solution rendering (FlatZincWriter, OznApplier) reads an LP-only float's value from Sample.reals.

Robustness fix (benefits the whole system)

Surfaced that exactBasisFeasible declines on a degenerate inequality-plus-equality vertex (feasible → UNKNOWN). Added exactPointFeasible: 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 in solveAndCertify, 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/FlatZincFloatCompareTest updated for the LP-only path, LpContinuousColumnTest (degenerate vertex certified via the exact point check). Full :klause:jvmTest, :klause-bench:test, :klause:lintDocs green.

Remaining

The native schema Compiler (CompilerAssertions.assertFloatLinear) is a separate pure-linear float surface (its own floatMeta* tables) — tracked as a follow-up.

Base automatically changed from feat/lp-exact-basis-solve to main July 17, 2026 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant