Repository navigation
Rank solutions with Space::compare in best-solution search #242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8a98921
93b21eb
08d71cc
4ed08f0
ed324ad
a25ee31
69818c5
89671e6
07ac3c7
062959c
4d81421
8ac086a
4a9b38e
934fec1
ee572fb
e0dda3a
5e8dc79
42d98b1
b8cff1b
5ffcd2b
f65adb2
9359b1a
eda01fd
1f7c1aa
3f44801
18ab128
7ff78e5
8b4080a
8c635ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,6 +75,31 @@ Date: unreleased | |
| [DESCRIPTION] | ||
| This is the development changelog for the next Gecode release. | ||
|
|
||
| [ENTRY] | ||
| Module: search | ||
| What: change | ||
| Rank: major | ||
| [DESCRIPTION] | ||
| Add Space::compare(), which ranks two solutions without modifying them. | ||
| Best-solution search uses it to choose between solutions, while constrain() | ||
| still prunes the search. Optimization models with a custom constrain() must now | ||
| also override compare(). | ||
| [MORE] | ||
| Parallel BAB, portfolios, external incumbents, and the experimental A* and CABS | ||
| engines all choose their incumbent with compare(). It returns the scoped enum | ||
|
Comment on lines
+88
to
+89
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Document that parallel BAB discards Equivalent solutions. Parallel BAB keeps only candidates that Suggested changelog addition
|
||
| SpaceComparison (Better, Equivalent, Worse, Incomparable), and the scoped enum | ||
| Sense (Minimize, Maximize) gives the optimization direction. compare_int(), | ||
| compare_float(), and compare_lex() compare integer, float, and lexicographic | ||
| objective values for a given Sense. | ||
|
|
||
| Comparing solutions whose objectives differ in direction, float step, or size | ||
| throws SpaceIncompatibleObjectives, and search engines throw | ||
| Search::Incomparable when compare() reports incomparable solutions. | ||
| FloatMinimizeSpace, FloatMaximizeSpace, and FlatZinc reject a negative float | ||
| step, which would admit solutions that are not better. An exception thrown in | ||
| an asset of a parallel portfolio, or by compare() in parallel BAB, is now | ||
| rethrown by next() instead of terminating the program. | ||
|
Comment on lines
+100
to
+101
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. State the engine cleanup requirement after a worker failure. After As per coding guidelines, “Describe user-visible changes in the unreleased section of
|
||
|
|
||
| [RELEASE] | ||
| Version: 6.6.0 | ||
| Date: 2026-11-16 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -369,6 +369,13 @@ class CarSequencing : public Script { | |
| rel(*this, nstall, IRT_LE, best.nstall.val()); | ||
| } | ||
|
|
||
| using Script::compare; | ||
| /// Compare objective values | ||
| virtual SpaceComparison compare(const Space& _other) const { | ||
| const CarSequencing& other = static_cast<const CarSequencing&>(_other); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check the dynamic type before reading If a caller compares a solved
|
||
| return compare_int(nstall.val(), other.nstall.val(), Sense::Minimize); | ||
| } | ||
|
|
||
| /// Print solution | ||
| virtual void | ||
| print(std::ostream& os) const { | ||
|
|
@@ -634,4 +641,3 @@ namespace { | |
| }; | ||
|
|
||
| // STATISTICS: example-any | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
State that
compare()must agree withconstrain().The migration note requires an override of
compare(), but it does not state what that override must do. Best-solution search usescompare()to choose incumbents, andconstrain()restricts later solutions. If the two disagree, search can reject a solution thatconstrain()treats as an improvement. Add the agreement requirement to the same note.Suggested changelog wording
Committable suggestion