Skip to content

Gecode 7: post nothing for empty arrays - #287

Draft
zayenz wants to merge 7 commits into
feature/breaking-7-03-api-and-checksfrom
feature/breaking-7-04-empty-arrays
Draft

zayenz wants to merge 7 commits into
feature/breaking-7-03-api-and-checksfrom
feature/breaking-7-04-empty-arrays

Conversation

@zayenz

@zayenz zayenz commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Passing an empty array to several constraint-posting and branching functions previously built propagators over empty input or requested zero-sized memory blocks, tripping assertions in debug builds. This PR audits empty-array handling across the modules so those functions either decide the constraint at posting time or post nothing.

The commits cover one area at a time:

  • no_overlap with zero rectangles posts nothing.
  • Global cardinality (count with an array of counts) and bin_packing with no variables or items decide at posting time: every count or load is set to 0, and count with variables but no values fails.
  • LDSB branching for integer, Boolean, and set variables ignores symmetries over empty variable or value sets and accepts an empty Symmetries object; relax with empty variable arrays posts nothing.
  • Set channel_sorted, Boolean-variable channel, union and disjoint-union element over constant sets, element over set variables, rel with union/disjoint-union and a constant set, and weights all decide or post nothing on empty arrays (assigning affected set variables to the empty set where appropriate).
  • Linear constraint posting and MiniModel expressions skip empty term buffers, and open-list distinct with maximum length 0 posts nothing.

The final commit records the audit and fixes in changelog.in.

Stack

Merge in this order. #242 targets main, and each later PR builds on the one before it so its diff shows only its own commits. The first four PRs are standalone search and random-number changes; #284 through #274 are the Gecode 7 changes split out of what used to be a single branch.

  1. Rank solutions with Space::compare in best-solution search #242 Rank solutions with Space::compare
  2. Rename the meta-search hooks to hub and spoke #282 Rename the meta-search hooks to hub and spoke
  3. Give meta search hub and spoke contexts and report why search ended #283 Hub and spoke contexts and end reasons
  4. Add extensible random generators with reproducible stream splitting #241 Splittable random generators
  5. Gecode 7: CMake-only C++23 build baseline #284 Gecode 7: build baseline
  6. Gecode 7: format the sources with LLVM 22 #285 Gecode 7: reformat
  7. Gecode 7: normalized API names, LT constants and Clang checks #286 Gecode 7: API names, LT constants, checks
  8. Gecode 7: post nothing for empty arrays #287 Gecode 7: empty arrays ← this PR
  9. Gecode 7: pass large parameters by const reference #288 Gecode 7: const& parameters
  10. Gecode 7: state and assert the heap size contract #289 Gecode 7: heap contract
  11. Gecode 7: trivially copyable handles and defaulted special members #290 Gecode 7: modern classes
  12. Gecode 7: native float interval instead of Boost #291 Gecode 7: native float interval
  13. Gecode 7: bug fixes and Doxygen warnings #292 Gecode 7: bug fixes and Doxygen
  14. Gecode 7: scoped enums and descriptive constant names #293 Gecode 7: scoped enums
  15. Gecode 7: clang-tidy sweep #274 Gecode 7: clang-tidy sweep

Zdev-Change-Id: Zaf7a888eb914257e90f519223bfacc19df79b6e81c1f7fdcfb32ce9d12bda351
Zdev-Change-Id: Z29f5a5de8dcaeb9c7e36ad57a6f0f8b6da3a7cbdb6796476784b9a4bfd45dd76
Zdev-Change-Id: Za38592943e829d0d5f0639f54bb56ed7b2929c5997714a009f9fb274ee681e37
Zdev-Change-Id: Z59edca85bfdb7c2701928e5f8262679749d118c3a98e03042baf26879102ba98
Zdev-Change-Id: Z0fbe6f16aff95c9a39ff5430e3bc4f73d4399ffde75421d1d68b5d450ff5b34b
Zdev-Change-Id: Z2f16dcb32eaf668fab7f831f2cb1ce8bdafd7f6b7b30fa28158406da084ad476
Zdev-Change-Id: Z1b18cdeb9e1612dbc04fc22e901b19d940719bb2db0fa18fa22cfc611f6454e7

This branch has not been deployed

No deployments
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