Skip to content

Expose explicit-end MiniZinc scheduling and avoid horizon expansion - #268

Merged
zayenz merged 5 commits into
mainfrom
feature/flatzinc-scheduling-interfaces
Oct 23, 2026
Merged

zayenz merged 5 commits into
mainfrom
feature/flatzinc-scheduling-interfaces

Conversation

@zayenz

@zayenz zayenz commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

MiniZinc scheduling currently creates end variables and selects propagators inside the C++ registry. Its fallback expands cumulative constraints across every time point. This change exposes explicit-end unary, cumulative, and cumulatives bindings and moves standard cumulative dispatch and end expressions into MiniZinc. Existing FlatZinc names remain supported, including the legacy treatment of negative capacity domains. API comments state the end-equality, optional-task, zero-duration, and propagation contracts.

For variable usages and capacity, zero-duration tasks use a separate machine. A spanning task with usage -capacity converts the variable bound into a fixed zero bound. This encoding is used only when the spanning duration and aggregate usage fit Gecode’s integer limits; otherwise a task-start decomposition avoids horizon expansion. Model-level aliases and end variables use Gecode’s integer bounds, preserving unbounded MiniZinc declarations and near-limit sums. Fixed usages use native optional cumulative propagation with presence guarded by positive duration.

Related to #80, #81, and #82. These are compatible 6.5 candidates; this PR does not remove legacy interfaces.

Validation with MiniZinc 2.10.1:

  • Release build, all seven CTest checks, and the installed launcher smoke test pass.
  • All 39 focused native registry/cumulatives tests pass under ASan and UBSan. The installed MiniZinc smoke test also passes with the sanitized solver; LeakSanitizer is unsupported on this macOS platform.
  • Regressions cover aggregate-usage overflow, unbounded domains, near-limit end sums in both scheduling hooks, and shared starts in the mandatory cumulative binding. Independent focused rechecking found no remaining corrections.
  • The initial broader FlatZinc run passed 145/146; on_restart::last_val_float also fails with the original registry and is unrelated to this change.
  • Exhaustive cumulative comparisons cover eight dispatch cases and 10,350 three-task schedules with negative starts. All eight fixed/variable cumulatives argument combinations agree with Python enumeration for both upper and lower bounds.
  • Compiled FlatZinc preserves algorithm/consistency annotations and shares repeated end expressions between native calls.
  • An initial 10-task, horizon-1,000 first-solution experiment used 33 propagators with the alternate-machine encoding versus 51,134 with the legacy fallback. Median initialization fell from about 14 ms to 0.53 ms and search from about 12 ms to 0.09 ms, although nodes increased from 21 to 27. Both alternate-machine and task-start candidates timed out on a harder 30-task case, so these measurements do not establish a universal speedup.

Track each task's active signed profile contribution at both endpoints,
including cancellation of empty profiles. This restores producer bounds
for upper and lower resource limits.

Strengthen the MiniZinc alternate cumulative encoding with each positive-
duration task's resource bound, preserving zero-duration semantics. Add
focused propagation and empty-profile regressions.
@zayenz
zayenz marked this pull request as ready for review October 23, 2026 05:49
@zayenz
zayenz merged commit 1865514 into main Oct 23, 2026
16 checks passed
@zayenz
zayenz deleted the feature/flatzinc-scheduling-interfaces branch October 23, 2026 07:29
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