Gecode 6.4.0
Model ownership, logical constraints and results

Models and edits

Gecode::Optimize::Model stores sparse ranged rows and min/max objectives with an offset. VariableType distinguishes Continuous, Integer, Binary, SemiContinuous and SemiInteger domains. Duplicate terms are coalesced deterministically; invalid/nonfinite coefficients are rejected. The VariableSpec, RowSpec and SparseRowBatch overloads provide atomic bulk additions, including compressed sparse row input.

Variable and constraint handles carry an owner identity and never-reused slot. Removal leaves tombstones; foreign and deleted handles are rejected. Successful edits advance the revision. A Model is movable, not copyable; ModelSnapshot owns a historical copy. Public snapshot fields remain untrusted: structural and original-semantic checks run at API boundaries. Historical SolveResult, observations and analysis artifacts survive edits and destruction of their originating model/session.

Logical and global constraints

Gecode::Optimize::add_indicator retains the original implication and derives finite conservative M values from declared domains for numerical solving. It rejects insufficient bounds or overflow instead of guessing M. Generated rows/gates and their domain guards remain associated with the original metadata. Mutations that invalidate the lowering are rejected; use Gecode::Optimize::remove_indicator for its supported removal lifecycle. Native search uses the original reified implication and preserves exposed gate semantics. The independent checker tests the original implication too.

Gecode::Optimize::add_boolean_and and Gecode::Optimize::add_boolean_or require Binary inputs/results. Empty AND is true; empty OR is false.

Typed helper Original meaning
Gecode::Optimize::add_all_different Pairwise different integer values.
Gecode::Optimize::add_element Variable index/result with explicit index base and retained array aliases.
Gecode::Optimize::add_table Membership in a positive table of integer tuples.
Gecode::Optimize::add_cumulative Mandatory fixed-duration, fixed-height tasks with half-open intervals; zero duration/height consumes no resource.
Gecode::Optimize::add_circuit One cycle through a nonempty successor array with explicit index base.
Gecode::Optimize::add_regular Deterministic finite automaton, sparse state IDs, unique state/symbol transitions, no epsilon transitions. A missing transition rejects; the empty word accepts exactly when the initial state is final.

These six families are the Optimize registry, not the full original Gecode global catalog. Active globals require native compilation, which performs additional domain, indexing, storage and arithmetic admission. HiGHS and model exporters reject unsupported original metadata instead of discarding it.

Result and guarantee contracts

Gecode::Optimize::SolveResult separates termination from availability of a validated incumbent. Test has_solution() before value(handle), and inspect termination before claiming completion. Values use original slots, including a separate active mask for tombstones. Missing bounds/gaps are absent, not zero. The common relative gap is abs(primal-dual)/max(1,abs(primal),abs(dual)); native_backend_gap, when present, retains a vendor's different convention.

Numerical results are tolerance-qualified. Native Exact uses admitted integer arithmetic, original-domain/constraint checking and finite search; it does not export a complete independently checkable proof. Certified is unsupported by these solve routes. Checked LP deductions do not upgrade a complete solve into a certified proof artifact. Infeasibility, local exhaustion and unavailable numerical data are distinct outcomes.

A SolveBudget shares a monotonic deadline, cancellation and node accounting. Copying, conversion and checking are included in the documented whole-call allowance. Calls into propagation, factorization or a backend are cooperative and can overrun a wall limit. Publication rules differ by operation: inspect the result status and availability flags even when historical diagnostics or a previously accepted incumbent remain present.