From 2a5db3b5c8e4f69909eb64e8180d45a43a1aa002 Mon Sep 17 00:00:00 2001 From: Mikael Zayenz Lagerkvist Date: Sat, 14 Nov 2026 13:31:37 +0100 Subject: [PATCH 1/3] Set the build version to 6.6.0 and bump the library ABI The exported Search::Seq::RBS engine changes its constructor and layout, and the float rounding control changes for MSVC, so libraries built from this tree are not binary compatible with 6.5.0. --- configure | 20 ++++++++++---------- gecode-version.m4 | 4 ++-- vcpkg.json | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/configure b/configure index 6271f509c6..a6dfd4dbe7 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac Id. # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.72 for GECODE 6.5.0. +# Generated by GNU Autoconf 2.72 for GECODE 6.6.0. # # Report bugs to . # @@ -605,8 +605,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='GECODE' PACKAGE_TARNAME='gecode' -PACKAGE_VERSION='6.5.0' -PACKAGE_STRING='GECODE 6.5.0' +PACKAGE_VERSION='6.6.0' +PACKAGE_STRING='GECODE 6.6.0' PACKAGE_BUGREPORT='users@gecode.dev' PACKAGE_URL='' @@ -1433,7 +1433,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -'configure' configures GECODE 6.5.0 to adapt to many kinds of systems. +'configure' configures GECODE 6.6.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1499,7 +1499,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of GECODE 6.5.0:";; + short | recursive ) echo "Configuration of GECODE 6.6.0:";; esac cat <<\_ACEOF @@ -1654,7 +1654,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -GECODE configure 6.5.0 +GECODE configure 6.6.0 generated by GNU Autoconf 2.72 Copyright (C) 2023 Free Software Foundation, Inc. @@ -2294,7 +2294,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by GECODE $as_me 6.5.0, which was +It was created by GECODE $as_me 6.6.0, which was generated by GNU Autoconf 2.72. Invocation command line was $ $0$ac_configure_args_raw @@ -3289,7 +3289,7 @@ ac_config_headers="$ac_config_headers gecode/support/config.hpp" -ac_gecode_soversion=52 +ac_gecode_soversion=53 GECODE_SOVERSION=${ac_gecode_soversion} @@ -15232,7 +15232,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by GECODE $as_me 6.5.0, which was +This file was extended by GECODE $as_me 6.6.0, which was generated by GNU Autoconf 2.72. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15296,7 +15296,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -GECODE config.status 6.5.0 +GECODE config.status 6.6.0 configured by $0, generated by GNU Autoconf 2.72, with options \\"\$ac_cs_config\\" diff --git a/gecode-version.m4 b/gecode-version.m4 index 5b3f95d7a2..17a9d7210a 100644 --- a/gecode-version.m4 +++ b/gecode-version.m4 @@ -1,5 +1,5 @@ dnl Canonical version metadata consumed by configure.ac and CMakeLists.txt. dnl Kept at repository root so build/ can remain fully ignored as generated dnl output. -m4_define([GECODE_M4_VERSION], [6.5.0]) -m4_define([GECODE_M4_SOVERSION], [52]) +m4_define([GECODE_M4_VERSION], [6.6.0]) +m4_define([GECODE_M4_SOVERSION], [53]) diff --git a/vcpkg.json b/vcpkg.json index 6b778c0d4b..c04b5a56b8 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,7 +1,7 @@ { "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "gecode", - "version-string": "6.5.0", + "version-string": "6.6.0", "builtin-baseline": "37bb045f3c7a747d3e5d1c13b6fe6a0aec4b5d00", "dependencies": [ "mpfr" From 1d299f106b9d122de32b30eb9571c37fed7aa37b Mon Sep 17 00:00:00 2001 From: Mikael Zayenz Lagerkvist Date: Sat, 14 Nov 2026 13:31:53 +0100 Subject: [PATCH 2/3] Write the 6.6.0 release summary The development section opened for 7.0.0 holds only fixes and the opt-in strict option parsing, which go out as 6.6.0 on 16 November. Gecode 7.0.0 remains the next major release. --- changelog.in | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/changelog.in b/changelog.in index 32c886749f..b89bf15572 100755 --- a/changelog.in +++ b/changelog.in @@ -70,10 +70,30 @@ # [RELEASE] -Version: 7.0.0 -Date: unreleased -[DESCRIPTION] -This is the development changelog for the next Gecode release. +Version: 6.6.0 +Date: 2026-11-16 +[DESCRIPTION] +This release fixes errors in restart-based and portfolio search and in float +propagation. Restart-based search with incomplete slave searches, such as large +neighbourhood search, posted no-goods that only hold in the restricted search +space. It could then miss better solutions and report a solution as optimal +when it was not. On AArch64, float multiplication could round its lower bound +upward, so float propagators could remove solutions. + +A portfolio of restart-based engines no longer crashes when it is deleted, and +restart-based and portfolio search now report correctly whether they finished +or were stopped. Restart-based search with no-goods no longer restarts forever +on an unsatisfiable model, and FlatZinc no longer prints UNKNOWN when a proof +follows a restart limit. + +Optimization over float objectives now finishes in cases where proving +optimality used to split variables down to single ulps, both in FlatZinc and +with FloatMinimizeSpace and FloatMaximizeSpace. Float propagation with MSVC is +two to four times faster. + +Options can report unrecognised commandline arguments with parse_strict(), +which the examples now use. Existing calls to parse() keep their behaviour; +strict parsing will become the default in a future major release. [ENTRY] Module: driver From eedcb2792818b914365d4850232b1d20250a01b0 Mon Sep 17 00:00:00 2001 From: Mikael Zayenz Lagerkvist Date: Sat, 14 Nov 2026 14:23:26 +0100 Subject: [PATCH 3/3] Accept the size and instance arguments in strict option parsing BaseOptions::parse(argc,argv) is not virtual, so the strict overload ran only the base parse for SizeOptions and InstanceOptions. Their size or instance argument was then reported as unrecognised, for example "prog 7" with SizeOptions::parse_strict(). Give SizeOptions and InstanceOptions their own strict overloads, which hide the base ones as their parse() already does. The only argument that may remain is the size, which must be a number, or the instance, which must not start with a hyphen so that a misspelled option is not taken as an instance. Making parse() virtual instead would recurse in subclasses whose parse() calls parse_strict(), such as EFPA's options. --- changelog.in | 6 +- gecode/driver.hh | 32 ++++++++++- gecode/driver/options.cpp | 59 ++++++++++++++++++-- gecode/driver/options.hpp | 18 ++++++ test/instance.cpp | 114 ++++++++++++++++++++++++++++++-------- 5 files changed, 197 insertions(+), 32 deletions(-) diff --git a/changelog.in b/changelog.in index b89bf15572..42e9f48129 100755 --- a/changelog.in +++ b/changelog.in @@ -104,8 +104,10 @@ Issue: 144 Options support opt-in strict parsing through parse_strict(), which reports unrecognised arguments, prints help, and exits with failure. The named methods parse_strict() and parse_permissive() select the strictness of parse(). Existing -parsing calls retain their behaviour. Examples that accept only named options -use strict parsing. +parsing calls retain their behaviour. SizeOptions and InstanceOptions accept +their size or instance as the only remaining argument; with SizeOptions it must +be a number, and with InstanceOptions it must not start with a hyphen. Examples +that accept only named options use strict parsing. Strict parsing will become the default in a future major release. [ENTRY] diff --git a/gecode/driver.hh b/gecode/driver.hh index 981fc353a1..0fe7c3c006 100755 --- a/gecode/driver.hh +++ b/gecode/driver.hh @@ -420,8 +420,9 @@ namespace Gecode { * overload. With \a strict set to true, any remaining argument causes * an error message and help text to be printed, followed by exit with * failure. Use strict parsing when no positional arguments or further - * parsing are expected. Help options are handled as in the two-argument - * overload. + * parsing are expected. SizeOptions and InstanceOptions accept their + * size or instance as the only remaining argument. Help options are + * handled as in the two-argument overload. */ void parse(int& argc, char* argv[], bool strict); @@ -780,6 +781,19 @@ namespace Gecode { virtual void help(void); /// Parse options from arguments \a argv (number is \a argc) void parse(int& argc, char* argv[]); + /** + * \brief Parse options, optionally rejecting unrecognised arguments + * + * With \a strict set to true, the only argument that may remain after + * the options is the size, which must be a decimal number. Any other + * argument causes an error message and help text to be printed, + * followed by exit with failure. + */ + void parse(int& argc, char* argv[], bool strict); + /// Parse options with strict checking (equivalent to parse() with \c true) + void parse_strict(int& argc, char* argv[]); + /// Parse options partially (equivalent to parse() with \c false) + void parse_permissive(int& argc, char* argv[]); /// Set default size void size(unsigned int s); @@ -843,6 +857,20 @@ namespace Gecode { virtual void help(void); /// Parse options from arguments \a argv (number is \a argc) void parse(int& argc, char* argv[]); + /** + * \brief Parse options, optionally rejecting unrecognised arguments + * + * With \a strict set to true, the only argument that may remain after + * the options is the instance. An argument that starts with a hyphen + * is an unrecognised option rather than an instance. Any other + * remaining argument causes an error message and help text to be + * printed, followed by exit with failure. + */ + void parse(int& argc, char* argv[], bool strict); + /// Parse options with strict checking (equivalent to parse() with \c true) + void parse_strict(int& argc, char* argv[]); + /// Parse options partially (equivalent to parse() with \c false) + void parse_permissive(int& argc, char* argv[]); /// Set default instance name void instance(const char* s); diff --git a/gecode/driver/options.cpp b/gecode/driver/options.cpp index 967184a207..036c587e83 100755 --- a/gecode/driver/options.cpp +++ b/gecode/driver/options.cpp @@ -631,15 +631,21 @@ namespace Gecode { return; } + namespace { + /// Report unrecognised argument \a a, print help of \a o, and exit + void + unrecognised(BaseOptions& o, const char* a) { + std::cerr << "Unrecognised argument \"" << a << "\"" << std::endl; + o.help(); + exit(EXIT_FAILURE); + } + } + void BaseOptions::parse(int& argc, char* argv[], bool strict) { parse(argc,argv); - if (strict && (argc > 1)) { - std::cerr << "Unrecognised argument \"" << argv[1] << "\"" - << std::endl; - help(); - exit(EXIT_FAILURE); - } + if (strict && (argc > 1)) + unrecognised(*this,argv[1]); } BaseOptions::~BaseOptions(void) { @@ -750,6 +756,28 @@ namespace Gecode { size(static_cast(atoi(argv[1]))); } + void + SizeOptions::parse(int& argc, char* argv[], bool strict) { + if (!strict) { + parse(argc,argv); + return; + } + Options::parse(argc,argv); + if (argc < 2) + return; + // The only remaining argument must be the size + const char* s = argv[1]; + bool number = (*s != 0); + for (const char* c = s; *c != 0; c++) + if (!isdigit(static_cast(*c))) + number = false; + if (!number) + unrecognised(*this,argv[1]); + if (argc > 2) + unrecognised(*this,argv[2]); + size(static_cast(atoi(argv[1]))); + } + InstanceOptions::InstanceOptions(const char* e) @@ -811,6 +839,25 @@ namespace Gecode { instance(argv[1]); } + void + InstanceOptions::parse(int& argc, char* argv[], bool strict) { + if (!strict) { + parse(argc,argv); + return; + } + Options::parse(argc,argv); + // The spec file and parameters may have changed + forget(); + if (argc < 2) + return; + // The only remaining argument must be the instance, not an option + if ((argv[1][0] == '-') && (argv[1][1] != 0)) + unrecognised(*this,argv[1]); + if (argc > 2) + unrecognised(*this,argv[2]); + instance(argv[1]); + } + bool InstanceOptions::builtin(unsigned int& i) const { const char* s = instance(); diff --git a/gecode/driver/options.hpp b/gecode/driver/options.hpp index aeb4b23bf9..60445ac1a6 100755 --- a/gecode/driver/options.hpp +++ b/gecode/driver/options.hpp @@ -631,6 +631,15 @@ namespace Gecode { * Options with additional size argument * */ + inline void + SizeOptions::parse_strict(int& argc, char* argv[]) { + parse(argc,argv,true); + } + inline void + SizeOptions::parse_permissive(int& argc, char* argv[]) { + parse(argc,argv,false); + } + inline void SizeOptions::size(unsigned int s) { _size = s; @@ -644,6 +653,15 @@ namespace Gecode { * Options with additional string argument * */ + inline void + InstanceOptions::parse_strict(int& argc, char* argv[]) { + parse(argc,argv,true); + } + inline void + InstanceOptions::parse_permissive(int& argc, char* argv[]) { + parse(argc,argv,false); + } + inline const char* InstanceOptions::instance(void) const { return _inst; diff --git a/test/instance.cpp b/test/instance.cpp index e409024b57..227f6209eb 100644 --- a/test/instance.cpp +++ b/test/instance.cpp @@ -40,9 +40,11 @@ #include #include #include +#include #include #include #include +#include namespace Test { namespace Instance { @@ -613,17 +615,42 @@ namespace Test { namespace Instance { return true; }); - /// Observe help requests without terminating the test runner - class HelpOptions : public Gecode::Options { + /// Signals that help was shown + struct HelpShown {}; + + /// Observe help requests of options \a Opt without terminating the test runner + template + class HelpOptions : public Opt { public: - struct HelpShown {}; - HelpOptions(void) : Gecode::Options("Strict parsing test") {} + HelpOptions(void) : Opt("Strict parsing test") {} void help(void) override { - Gecode::Options::help(); + Opt::help(); throw HelpShown(); } }; + /// Test whether strict parsing of \a argv rejects argument \a arg + template + bool rejects(HelpOptions& options, int argc, char* argv[], + const char* arg) { + bool help_shown = false; + std::ostringstream output; + std::streambuf* previous = std::cerr.rdbuf(output.rdbuf()); + try { + options.parse_strict(argc, argv); + } catch (const HelpShown&) { + help_shown = true; + } catch (...) { + std::cerr.rdbuf(previous); + throw; + } + std::cerr.rdbuf(previous); + std::string expected = std::string("Unrecognised argument \"") + arg + "\""; + return help_shown && + (output.str().find(expected) != std::string::npos) && + (output.str().find("Options for Strict parsing test:") != std::string::npos); + } + Case strict_options("Driver::Options::Strict", [](void) { Gecode::Options options("Test"); char name[] = "test", iterations[] = "-iterations", value[] = "200"; @@ -642,24 +669,67 @@ namespace Test { namespace Instance { options.parse_permissive(remaining_argc, remaining_argv); CHECK(remaining_argc == 3 && remaining_argv[2] == positional); - HelpOptions strict; + HelpOptions strict; char* invalid_argv[] = {name, iterations, value, unknown, help, nullptr}; - int invalid_argc = 5; - bool help_shown = false; - std::ostringstream output; - std::streambuf* previous = std::cerr.rdbuf(output.rdbuf()); - try { - strict.parse_strict(invalid_argc, invalid_argv); - } catch (const HelpOptions::HelpShown&) { - help_shown = true; - } catch (...) { - std::cerr.rdbuf(previous); - throw; - } - std::cerr.rdbuf(previous); - CHECK(help_shown); - CHECK(output.str().find("Unrecognised argument \"--typo\"") != std::string::npos); - CHECK(output.str().find("Options for Strict parsing test:") != std::string::npos); + CHECK(rejects(strict, 5, invalid_argv, "--typo")); + char* positional_argv[] = {name, positional, nullptr}; + CHECK(rejects(strict, 2, positional_argv, "instance.txt")); + return true; + }); + + Case strict_size_options("Driver::SizeOptions::Strict", [](void) { + char name[] = "test", iterations[] = "-iterations", value[] = "200"; + char size[] = "7", other[] = "8", unknown[] = "--typo", word[] = "seven"; + + // The size is the only argument that may remain + HelpOptions options; + char* valid_argv[] = {name, iterations, value, size, nullptr}; + int valid_argc = 4; + options.parse_strict(valid_argc, valid_argv); + CHECK(options.size() == 7 && options.iterations() == 200); + char* options_argv[] = {name, iterations, value, nullptr}; + int options_argc = 3; + options.parse_strict(options_argc, options_argv); + CHECK(options_argc == 1 && options.size() == 7); + + char* unknown_argv[] = {name, unknown, size, nullptr}; + CHECK(rejects(options, 3, unknown_argv, "--typo")); + char* extra_argv[] = {name, size, other, nullptr}; + CHECK(rejects(options, 3, extra_argv, "8")); + char* word_argv[] = {name, word, nullptr}; + CHECK(rejects(options, 2, word_argv, "seven")); + + // Permissive parsing still reads the size and keeps the rest + char* permissive_argv[] = {name, other, size, nullptr}; + int permissive_argc = 3; + options.parse_permissive(permissive_argc, permissive_argv); + CHECK(permissive_argc == 3 && options.size() == 8); + return true; + }); + + Case strict_instance_options("Driver::InstanceOptions::Strict", [](void) { + char name[] = "test", iterations[] = "-iterations", value[] = "200"; + char inst[] = "instance.txt", other[] = "other.txt", unknown[] = "--typo"; + + // The instance is the only argument that may remain + HelpOptions options; + char* valid_argv[] = {name, iterations, value, inst, nullptr}; + int valid_argc = 4; + options.parse_strict(valid_argc, valid_argv); + CHECK(std::strcmp(options.instance(), "instance.txt") == 0 && + options.iterations() == 200); + + char* unknown_argv[] = {name, unknown, inst, nullptr}; + CHECK(rejects(options, 3, unknown_argv, "--typo")); + char* extra_argv[] = {name, inst, other, nullptr}; + CHECK(rejects(options, 3, extra_argv, "other.txt")); + + // Permissive parsing takes the first remaining argument as instance + char* permissive_argv[] = {name, other, inst, nullptr}; + int permissive_argc = 3; + options.parse_permissive(permissive_argc, permissive_argv); + CHECK(permissive_argc == 3 && + std::strcmp(options.instance(), "other.txt") == 0); return true; });