diff --git a/.clang-tidy b/.clang-tidy index edfd5bc727..32dba7f53b 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,39 +1,88 @@ -# Use clang-tidy 22. Keep checks focused on correctness and useful modernization. +# Use clang-tidy 22. Each group below is enabled as a whole, and a line that +# starts with a minus excludes a check that was tried and does not fit. The +# reasons are in docs/code-style.md. Checks from other groups are named one by +# one, because most of those groups are aliases of checks enabled here. Checks: >- -*, clang-analyzer-core.*, - bugprone-assert-side-effect, - bugprone-dangling-handle, - bugprone-inaccurate-erase, - bugprone-integer-division, - bugprone-macro-repeated-side-effects, - bugprone-misplaced-widening-cast, - bugprone-move-forwarding-reference, - bugprone-sizeof-expression, - bugprone-suspicious-memory-comparison, - bugprone-suspicious-memset-usage, - bugprone-unused-raii, - bugprone-unused-return-value, - bugprone-use-after-move, - bugprone-virtual-near-miss, - modernize-deprecated-headers, - modernize-use-equals-default, - modernize-use-equals-delete, - modernize-use-nullptr, - modernize-use-override, - performance-avoid-endl, - performance-faster-string-find, - performance-for-range-copy, - performance-implicit-conversion-in-loop, - performance-inefficient-algorithm, - performance-inefficient-string-concatenation, - performance-inefficient-vector-operation, - performance-move-const-arg, - performance-move-constructor-init, - performance-no-automatic-move, - performance-unnecessary-copy-initialization, - performance-unnecessary-value-param, - readability-identifier-naming + clang-analyzer-cplusplus.*, + -clang-analyzer-cplusplus.NewDeleteLeaks, + clang-analyzer-deadcode.*, + clang-analyzer-nullability.*, + clang-analyzer-optin.*, + -clang-analyzer-optin.core.EnumCastOutOfRange, + -clang-analyzer-optin.cplusplus.UninitializedObject, + -clang-analyzer-optin.performance.Padding, + clang-analyzer-security.*, + -clang-analyzer-security.ArrayBound, + clang-analyzer-unix.*, + -clang-analyzer-unix.Malloc, + clang-analyzer-valist.*, + cert-err33-c, + google-default-arguments, + cppcoreguidelines-no-malloc, + cppcoreguidelines-rvalue-reference-param-not-moved, + cppcoreguidelines-misleading-capture-default-by-value, + cppcoreguidelines-missing-std-forward, + google-build-explicit-make-pair, + google-global-names-in-headers, + hicpp-exception-baseclass, + bugprone-*, + -bugprone-branch-clone, + -bugprone-derived-method-shadowing-base-method, + -bugprone-easily-swappable-parameters, + -bugprone-implicit-widening-of-multiplication-result, + -bugprone-inc-dec-in-conditions, + -bugprone-macro-parentheses, + -bugprone-multi-level-implicit-pointer-conversion, + -bugprone-narrowing-conversions, + -bugprone-signed-char-misuse, + -bugprone-switch-missing-default-case, + -bugprone-throwing-static-initialization, + -bugprone-unchecked-string-to-number-conversion, + concurrency-*, + -concurrency-mt-unsafe, + misc-*, + -misc-confusable-identifiers, + -misc-const-correctness, + -misc-header-include-cycle, + -misc-include-cleaner, + -misc-multiple-inheritance, + -misc-new-delete-overloads, + -misc-no-recursion, + -misc-non-private-member-variables-in-classes, + -misc-static-assert, + -misc-use-anonymous-namespace, + modernize-*, + -modernize-avoid-c-arrays, + -modernize-pass-by-value, + -modernize-return-braced-init-list, + -modernize-use-auto, + -modernize-use-default-member-init, + -modernize-use-designated-initializers, + -modernize-use-nodiscard, + -modernize-use-std-numbers, + -modernize-use-trailing-return-type, + performance-*, + -performance-enum-size, + -performance-no-int-to-ptr, + portability-*, + -portability-template-virtual-member-function, + readability-*, + -readability-avoid-nested-conditional-operator, + -readability-braces-around-statements, + -readability-convert-member-functions-to-static, + -readability-function-cognitive-complexity, + -readability-function-size, + -readability-identifier-length, + -readability-implicit-bool-conversion, + -readability-isolate-declaration, + -readability-magic-numbers, + -readability-make-member-function-const, + -readability-math-missing-parentheses, + -readability-named-parameter, + -readability-redundant-declaration, + -readability-use-anyofallof WarningsAsErrors: '*' HeaderFilterRegex: '(gecode|test|examples|tools)/' ExcludeHeaderFilterRegex: 'gecode/flatzinc/(parser\.tab\.(cpp|hpp)|lexer\.yy\.cpp)$' @@ -42,6 +91,22 @@ FormatStyle: file CheckOptions: # Explicit discards document intentional ownership handoffs. bugprone-unused-return-value.AllowCastToVoid: true + bugprone-empty-catch.IgnoreCatchWithKeywords: 'Expected;Ignored' + # main reports nothing useful by catching, and the move members this + # reports are implicit ones of value types and lambdas. + bugprone-exception-escape.CheckMain: false + bugprone-exception-escape.CheckMoveMemberFunctions: false + # glibc needs this feature macro defined before any system header. + bugprone-reserved-identifier.AllowedIdentifiers: '_GNU_SOURCE' + cert-err33-c.AllowCastToVoid: true + # Checking functions finds the real cases; classes and test registration + # objects in .cpp files would only need wrapping in anonymous namespaces. + misc-use-internal-linkage.AnalyzeTypes: false + misc-use-internal-linkage.AnalyzeVariables: false + # De Morgan rewrites do not make these conditions easier to read. + readability-simplify-boolean-expr.SimplifyDeMorgan: false + # Sites without a fix-it declare variables in the condition. + readability-else-after-return.WarnOnUnfixable: false readability-identifier-naming.FunctionCase: lower_case readability-identifier-naming.MethodCase: lower_case readability-identifier-naming.VariableCase: lower_case diff --git a/.github/ci/32-bit-linkage-smoke.sh b/.github/ci/32-bit-linkage-smoke.sh index 278a24f494..228f122eb1 100644 --- a/.github/ci/32-bit-linkage-smoke.sh +++ b/.github/ci/32-bit-linkage-smoke.sh @@ -43,7 +43,7 @@ EOF cat > "$consumer_dir/main.cpp" <<'EOF' #include -int main(void) { +int main() { Gecode::Search::Statistics statistics; Gecode::Search::Options options; diff --git a/.github/ci/cmake-consumer-smoke-msys2.sh b/.github/ci/cmake-consumer-smoke-msys2.sh index 3ae83ab693..2232c89e31 100755 --- a/.github/ci/cmake-consumer-smoke-msys2.sh +++ b/.github/ci/cmake-consumer-smoke-msys2.sh @@ -23,7 +23,7 @@ cat > "$work/main.cpp" <<'EOF' #include #include -int main(void) { +int main() { Gecode::IntArgs values(1); values[0] = 0; return values[0]; diff --git a/.github/ci/cmake-consumer-smoke-vcpkg.ps1 b/.github/ci/cmake-consumer-smoke-vcpkg.ps1 index 8f6d9fb2d7..3f7bc506bb 100644 --- a/.github/ci/cmake-consumer-smoke-vcpkg.ps1 +++ b/.github/ci/cmake-consumer-smoke-vcpkg.ps1 @@ -49,7 +49,7 @@ target_link_libraries(consumer_a PRIVATE Gecode::gecode) '@ | Set-Content -Encoding utf8 (Join-Path $work "a\CMakeLists.txt") @' #include -int main(void) { return 0; } +int main() { return 0; } '@ | Set-Content -Encoding utf8 (Join-Path $work "a\main.cpp") @' @@ -61,7 +61,7 @@ target_link_libraries(consumer_b PRIVATE Gecode::gecodedriver) '@ | Set-Content -Encoding utf8 (Join-Path $work "b\CMakeLists.txt") @' #include -int main(void) { +int main() { Gecode::Options options("consumer_b"); return options.model(); } @@ -103,7 +103,7 @@ target_link_libraries(consumer_d PRIVATE Gecode::gecodefloat) #error "Expected installed Gecode package to enable MPFR" #endif #include -int main(void) { +int main() { Gecode::Float::Rounding rounding; return rounding.exp_down(1.0) > 0.0 ? 0 : 1; } diff --git a/.github/ci/cmake-consumer-smoke.ps1 b/.github/ci/cmake-consumer-smoke.ps1 index 2897104644..fc471bf6f3 100644 --- a/.github/ci/cmake-consumer-smoke.ps1 +++ b/.github/ci/cmake-consumer-smoke.ps1 @@ -34,7 +34,7 @@ target_link_libraries(consumer_a PRIVATE Gecode::gecode) '@ | Set-Content -Encoding utf8 (Join-Path $work "a\CMakeLists.txt") @' #include -int main(void) { return 0; } +int main() { return 0; } '@ | Set-Content -Encoding utf8 (Join-Path $work "a\main.cpp") @' @@ -46,7 +46,7 @@ target_link_libraries(consumer_b PRIVATE Gecode::gecodedriver) '@ | Set-Content -Encoding utf8 (Join-Path $work "b\CMakeLists.txt") @' #include -int main(void) { +int main() { Gecode::Options options("consumer_b"); return options.model(); } @@ -131,7 +131,7 @@ target_link_libraries(manual_consumer PRIVATE "${GECODE_SUPPORT_LIBRARY}") '@ | Set-Content -Encoding utf8 (Join-Path $work "manual\CMakeLists.txt") @' #include -int main(void) { +int main() { (void) Gecode::Support::hwrnd(); return 0; } diff --git a/.github/ci/cmake-consumer-smoke.sh b/.github/ci/cmake-consumer-smoke.sh index 673c80a379..23fa593681 100644 --- a/.github/ci/cmake-consumer-smoke.sh +++ b/.github/ci/cmake-consumer-smoke.sh @@ -55,7 +55,7 @@ target_link_libraries(consumer_a PRIVATE Gecode::gecode) EOF cat > "$work/a/main.cpp" <<'EOF' #include -int main(void) { return 0; } +int main() { return 0; } EOF cat > "$work/b/CMakeLists.txt" <<'EOF' @@ -70,7 +70,7 @@ target_link_libraries(consumer_b PRIVATE Gecode::gecodedriver) EOF cat > "$work/b/main.cpp" <<'EOF' #include -int main(void) { +int main() { Gecode::Options options("consumer_b"); return options.model(); } @@ -116,7 +116,7 @@ cat > "$work/d/main.cpp" <<'EOF' #error "Expected installed Gecode package to enable MPFR" #endif #include -int main(void) { +int main() { Gecode::Float::Rounding rounding; return rounding.exp_down(1.0) > 0.0 ? 0 : 1; } @@ -145,7 +145,7 @@ cat > "$work/e/main.cpp" <<'EOF' #error "Expected installed Gecode package to enable MPFR" #endif #include -int main(void) { +int main() { Gecode::Float::Rounding rounding; return rounding.log_down(2.0) >= 0.0 ? 0 : 1; } @@ -172,7 +172,7 @@ target_link_libraries(consumer_f PRIVATE ${Gecode_LIBRARIES}) EOF cat > "$work/f/main.cpp" <<'EOF' #include -int main(void) { return Gecode::Support::Thread::npu() > 0 ? 0 : 1; } +int main() { return Gecode::Support::Thread::npu() > 0 ? 0 : 1; } EOF cat > "$work/g/CMakeLists.txt" <<'EOF' @@ -209,7 +209,7 @@ target_link_libraries(consumer_j PRIVATE ${Gecode_LIBRARIES}) EOF cat > "$work/j/main.cpp" <<'EOF' #include -int main(void) { return 0; } +int main() { return 0; } EOF cat > "$work/k/CMakeLists.txt" <<'EOF' @@ -228,7 +228,7 @@ target_link_libraries(consumer_k PRIVATE ${Gecode_LIBRARIES}) EOF cat > "$work/k/main.cpp" <<'EOF' #include -int main(void) { Gecode::Float::Rounding rounding; return rounding.sqrt_down(4.0) == 2.0 ? 0 : 1; } +int main() { Gecode::Float::Rounding rounding; return rounding.sqrt_down(4.0) == 2.0 ? 0 : 1; } EOF cat > "$work/l/CMakeLists.txt" <<'EOF' diff --git a/.github/ci/qt-gist-consumer-smoke.sh b/.github/ci/qt-gist-consumer-smoke.sh index fc4fc23fde..a3fc0368af 100644 --- a/.github/ci/qt-gist-consumer-smoke.sh +++ b/.github/ci/qt-gist-consumer-smoke.sh @@ -72,7 +72,7 @@ using FloatCompare = std::string (*)(const std::string&, Gecode::FloatVar, Gecod FloatCompare float_compare = &Gecode::Gist::Comparator::compare; #endif -int main(void) { +int main() { #ifdef GECODE_HAS_SET_VARS if (set_compare == nullptr) return 1; diff --git a/.github/ci/qt5-gist-consumer-smoke.sh b/.github/ci/qt5-gist-consumer-smoke.sh index bd3a3dcaa0..6ef2c04b5e 100644 --- a/.github/ci/qt5-gist-consumer-smoke.sh +++ b/.github/ci/qt5-gist-consumer-smoke.sh @@ -62,7 +62,7 @@ using FloatCompare = std::string (*)(const std::string&, Gecode::FloatVar, Gecod FloatCompare float_compare = &Gecode::Gist::Comparator::compare; #endif -int main(void) { +int main() { #ifdef GECODE_HAS_SET_VARS if (set_compare == nullptr) return 1; diff --git a/changelog.in b/changelog.in index 5f17658e21..591a39f5b1 100644 --- a/changelog.in +++ b/changelog.in @@ -76,6 +76,23 @@ Date: unreleased This release contains breaking changes. See the entries below for the changes downstream code needs. +[ENTRY] +Module: flatzinc +What: change +Rank: minor +[DESCRIPTION] +Derive FlatZinc::Error and FlatZinc::AST::TypeError from std::exception, so that +a handler for std::exception also catches them. AST::TypeError::what now returns +const char* instead of std::string. + +[ENTRY] +Module: flatzinc +What: bug +Rank: minor +[DESCRIPTION] +Give FlatZinc::BranchPlugin a virtual destructor, so that a plugin deleted +through its interface is destroyed correctly. + [ENTRY] Module: other What: change diff --git a/docs/code-style.md b/docs/code-style.md index 0e07d14a44..181902b2ba 100644 --- a/docs/code-style.md +++ b/docs/code-style.md @@ -7,8 +7,8 @@ defaults. ## Formatting C++ uses four-space indentation and a 120-column limit. Braces stay on the -opening line, compact nested namespaces remain indented, and pointer and -reference markers bind to the type. Function definitions retain a separate +opening line, namespace bodies remain indented, and pointer and reference +markers bind to the type. Function definitions retain a separate return-type line. Include order and comment wrapping are preserved. Comment indentation follows the surrounding code, including copyright notices and Doxygen text. @@ -119,6 +119,17 @@ All other conversions are explicit: `std::to_underlying` or `static_cast` for an array index, a bit position, a packed field, or an `int`-valued option, and `static_cast` back to the enum. +## Parameter lists and forceinline + +An empty parameter list is `()`, also in function pointer types and +`std::function` signatures. `(void)` is a C spelling and stays only in C +sources, where it means something different. +`modernize-redundant-void-arg` enforces the rule. A cast to `void` that discards +a value, such as `(void)new (p) T()`, is a different construct and stays. + +`forceinline` stays lowercase, although it is a macro, so that it reads like +`inline`. + ## Checking changes Put LLVM 22 tools on `PATH`, or set `CLANG_FORMAT` and `CLANG_TIDY` to their @@ -251,9 +262,114 @@ for the derived-class reason: its two bodies duplicate a range check, but a merged member would reject a privately derived matrix. No clang-tidy check enforces this rule. -Other performance checks need focused review: `performance-enum-size` changes -layouts and ABI, and `performance-no-int-to-ptr` conflicts with deliberate -pointer tagging. Review `noexcept` guarantees, destructor triviality, and math -promotion against allocation-failure handling and interval-rounding semantics -before adopting those checks. Never add `noexcept` to a potentially throwing -operation just to satisfy a diagnostic. +Never add `noexcept` to a potentially throwing operation just to satisfy a +diagnostic. Review `noexcept` guarantees, destructor triviality, and math +promotion against allocation-failure handling and interval-rounding semantics. + +## Clang-tidy check selection + +`.clang-tidy` enables the `bugprone`, `concurrency`, `misc`, `modernize`, +`performance`, `portability`, and `readability` groups as a whole, and the +analyzer groups `core`, `cplusplus`, `deadcode`, `nullability`, `optin`, +`security`, `unix`, and `valist`. Checks from `cert`, `cppcoreguidelines`, +`google`, and `hicpp` are named one by one. When a new diagnostic appears, fix +the code. Use a `NOLINT` naming the check and the reason only for a false +positive or a deliberate exception. Add an exclusion only for a reason like +those below. + +Review fix-its before committing them, and build the tests with them. +`modernize-use-using` drops `const` from aliases such as `const_iterator`. +`modernize-use-integer-sign-comparison` turns `x != static_cast(-1)` +into a comparison that is always true. `readability-simplify-boolean-expr` +rewrites tests that exercise the comparison operators themselves. +`modernize-loop-convert` calls the element of every loop `i`; give it a name +that fits. + +These checks are excluded because the code is deliberately written the way they +reject: + +- `bugprone-derived-method-shadowing-base-method`: static polymorphism. +- `bugprone-multi-level-implicit-pointer-conversion`: allocator templates. +- `bugprone-signed-char-misuse`: `signed char` is a small integer here. +- `bugprone-throwing-static-initialization`: tests register through statics. +- `concurrency-mt-unsafe`: `exit` and `getenv` run before threads start. +- `misc-confusable-identifiers`: `I` as a template parameter next to `l`. +- `misc-multiple-inheritance`, `misc-no-recursion`, + `misc-non-private-member-variables-in-classes`: common and intended. +- `misc-new-delete-overloads`: delete-only overloads are intended. +- `misc-use-anonymous-namespace`: `static` is allowed. +- `modernize-avoid-c-arrays`: fixed tables and space-allocated arrays. +- `modernize-use-std-numbers`: rounded or specification-defined constants, such + as the TSPLIB value of pi. +- `performance-enum-size`: would change layouts and ABI. +- `performance-no-int-to-ptr`: pointer tagging. +- `portability-template-virtual-member-function`: reports every virtual member + that a translation unit leaves uninstantiated, and the MSVC builds compile + them anyway. +- `readability-convert-member-functions-to-static`, + `readability-make-member-function-const`: views implement a shared interface + whose members mutate in some views only. +- `readability-implicit-bool-conversion`: `if (p)` is the local idiom. + +These checks are excluded because following them makes the code worse or their +reports are mostly noise: + +- `bugprone-branch-clone`: parallel cases read better, and none of its reports + was a bug. +- `bugprone-easily-swappable-parameters`: nearly every posting function. +- `bugprone-implicit-widening-of-multiplication-result`: values are int-sized by + design. +- `bugprone-inc-dec-in-conditions`: reports sequenced `&&` conditions. +- `bugprone-macro-parentheses`: macro arguments are names or types. +- `bugprone-narrowing-conversions`: casts would silence the reports, not verify + them. +- `bugprone-switch-missing-default-case`: option values and tests. +- `bugprone-unchecked-string-to-number-conversion`: command-line parsing, where + a change would alter behaviour. +- `misc-const-correctness`: `const` on shallow handles misleads. +- `misc-header-include-cycle`, `misc-include-cleaner`: umbrella headers and + `.hpp` files that are not self-contained by design. +- `misc-static-assert`: only reports `GECODE_NEVER`, which is `assert(false)`. +- `modernize-pass-by-value`: most parameters are handles and views with no + cheaper move, and the rest are strings on setup paths. +- `modernize-return-braced-init-list`, `modernize-use-auto`, + `modernize-use-designated-initializers`, + `modernize-use-trailing-return-type`: the written types and forms are useful + at the declaration. +- `modernize-use-default-member-init`: constructor lists keep all of an actor's + state in one place, and a default initializer adds stores to clone + constructors that leave members unset on purpose. +- `modernize-use-nodiscard`: applies to nearly every accessor. +- `readability-avoid-nested-conditional-operator`: compact view code. +- `readability-braces-around-statements`, `readability-identifier-length`, + `readability-isolate-declaration`, `readability-magic-numbers`, + `readability-math-missing-parentheses`, `readability-named-parameter`: these + contradict the existing style. +- `readability-function-cognitive-complexity`, `readability-function-size`: + propagators are long by nature. +- `readability-redundant-declaration`: documented repeats, and its fix-it breaks + templates. +- `readability-use-anyofallof`: the loops are clearer. + +These analyzer checks are excluded after review of their reports: + +- `clang-analyzer-cplusplus.NewDeleteLeaks`: tests register self-owning objects + with `(void)new`. +- `clang-analyzer-optin.core.EnumCastOutOfRange`: flag combinations. +- `clang-analyzer-optin.cplusplus.UninitializedObject`: `Delta` and similar + types leave fields unset on purpose. +- `clang-analyzer-optin.performance.Padding`: its one report is a small static + table whose field order follows the table's columns. +- `clang-analyzer-security.ArrayBound`: cannot see loop invariants or trailing + arrays. +- `clang-analyzer-unix.Malloc`: cannot see reference counts. + +`cppcoreguidelines-prefer-member-initializer` is not enabled: it moves +statements across side effects, such as `e >> n` before an allocation of size +`n`, and into initializer lists guarded by `#ifdef`. The other checks of +`cppcoreguidelines`, `cert`, `google`, and `hicpp` are not enabled because they +are aliases of enabled checks, restate a rejected check, or forbid techniques +that the kernel depends on, such as raw memory and pointer arithmetic. The +`abseil`, `altera`, `android`, `boost`, `darwin`, `fuchsia`, `linuxkernel`, +`llvm`, `llvmlibc`, `mpi`, `objc`, `openmp`, and `zircon` groups target other +projects and platforms. diff --git a/examples/all-interval.cpp b/examples/all-interval.cpp index 26fc92ef56..77c0a25c15 100644 --- a/examples/all-interval.cpp +++ b/examples/all-interval.cpp @@ -92,7 +92,7 @@ class AllInterval : public Script { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new AllInterval(*this); } /// Print solution diff --git a/examples/alpha.cpp b/examples/alpha.cpp index 827c16c0f3..54b886d27e 100644 --- a/examples/alpha.cpp +++ b/examples/alpha.cpp @@ -107,7 +107,7 @@ class Alpha : public Script { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new Alpha(*this); } /// Print solution @@ -115,7 +115,7 @@ class Alpha : public Script { print(std::ostream& os) const override { os << "\t"; for (int i = 0; i < n; i++) { - os << ((char)(i + 'a')) << '=' << le[i] << ((i < n - 1) ? ", " : "\n"); + os << static_cast(i + 'a') << '=' << le[i] << ((i < n - 1) ? ", " : "\n"); if ((i + 1) % 8 == 0) os << '\n' << "\t"; } diff --git a/examples/archimedean-spiral.cpp b/examples/archimedean-spiral.cpp index aa91fbd0bc..ecbb255ba6 100644 --- a/examples/archimedean-spiral.cpp +++ b/examples/archimedean-spiral.cpp @@ -92,12 +92,12 @@ class ArchimedeanSpiral : public FloatMaximizeScript { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new ArchimedeanSpiral(*this); } /// Cost function FloatVar - cost(void) const override { + cost() const override { return f[0]; } /// Print solution coordinates diff --git a/examples/bacp.cpp b/examples/bacp.cpp index e7a547129a..2107a821aa 100644 --- a/examples/bacp.cpp +++ b/examples/bacp.cpp @@ -214,12 +214,12 @@ class BACP : public IntMinimizeScript { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new BACP(*this); } /// Return solution cost IntVar - cost(void) const override { + cost() const override { return u; } /// Print solution @@ -232,8 +232,8 @@ class BACP : public IntMinimizeScript { os << "Solution with load " << u.val() << ":" << '\n'; for (int i = 0; i < curr.p; i++) { os << "\tPeriod " << i + 1 << ": "; - for (std::list::iterator v = period[i].begin(); v != period[i].end(); ++v) { - os << curr.courses[*v].name << " "; + for (int& v : period[i]) { + os << curr.courses[v].name << " "; } os << '\n'; } diff --git a/examples/bibd.cpp b/examples/bibd.cpp index df844db4a6..c01caf59cb 100644 --- a/examples/bibd.cpp +++ b/examples/bibd.cpp @@ -48,7 +48,7 @@ class BIBDOptions : public Options { int b, r; ///< Derived parameters /// Derive additional parameters void - derive(void) { + derive() { b = (v * (v - 1) * lambda) / (k * (k - 1)); r = (lambda * (v - 1)) / (k - 1); } @@ -69,7 +69,7 @@ class BIBDOptions : public Options { } /// Print help message void - help(void) override { + help() override { Options::help(); std::cerr << "\t(unsigned int) default: " << v << '\n' << "\t\tparameter v" << '\n' @@ -161,7 +161,7 @@ class BIBD : public Script { /// Copy during cloning Space* - copy(void) override { + copy() override { return new BIBD(*this); } }; diff --git a/examples/bin-packing.cpp b/examples/bin-packing.cpp index a0c95f9bd9..d0b2c95845 100644 --- a/examples/bin-packing.cpp +++ b/examples/bin-packing.cpp @@ -61,17 +61,17 @@ namespace { public: /// Whether a valid specification has been found bool - valid(void) const { + valid() const { return data != nullptr; } /// Return maximal capacity of a bin int - capacity(void) const { + capacity() const { return data[0]; } /// Return number of items int - items(void) const { + items() const { return data[1]; } /// Return size of item \a i @@ -91,7 +91,7 @@ namespace { } /// Compute lower bound int - clower(void) const { + clower() const { /* * The lower bound is due to: S. Martello, P. Toth. Lower bounds * and reduction procedures for the bin packing problem. @@ -136,7 +136,7 @@ namespace { } /// Compute upper bound int - cupper(void) const { + cupper() const { // Use a naive greedy algorithm const int c = capacity(), n = items(); @@ -185,7 +185,7 @@ namespace { } /// Return sum of all item sizes int - total(void) const { + total() const { int t = 0; for (int i = 0; i < items(); i++) t += size(i); @@ -193,12 +193,12 @@ namespace { } /// Return lower bound int - lower(void) const { + lower() const { return l; } /// Return upper bound int - upper(void) const { + upper() const { return u; } }; @@ -238,7 +238,7 @@ class CDBF : public Brancher { /** Initialize choice for brancher \a b, alternatives \a a, * item \a i and same bins \a s. */ - Choice(const Brancher& b, unsigned int a, int i, int* s, int n_s) + Choice(const Brancher& b, unsigned int a, int i, const int* s, int n_s) : Gecode::Choice(b, a), item(i), same(heap.alloc(n_s)), n_same(n_s) { for (int k = n_same; k--;) same[k] = s[k]; @@ -252,7 +252,7 @@ class CDBF : public Brancher { e << same[i]; } /// Destructor - ~Choice(void) override { + ~Choice() override { heap.free(same, n_same); } }; @@ -348,8 +348,7 @@ class CDBF : public Brancher { */ if ((slack == 0) || (n_same == n_possible) || (slack == INT_MAX)) return new Choice(*this, 1, item, same, 1); - else - return new Choice(*this, 2, item, same, n_same); + return new Choice(*this, 2, item, same, n_same); } /// Return choice const Gecode::Choice* @@ -400,14 +399,14 @@ class CDBF : public Brancher { }; /// Post branching (assumes that \a s is sorted) -void +static void cdbf(Home home, const IntVarArgs& l, const IntVarArgs& b, const IntArgs& s) { if (b.size() != s.size()) throw Int::ArgumentSizeMismatch("cdbf"); ViewArray load(home, l); ViewArray bin(home, b); IntSharedArray size(s); - return CDBF::post(home, load, bin, size); + CDBF::post(home, load, bin, size); } /** @@ -510,7 +509,7 @@ class BinPacking : public IntMinimizeScript { } /// Return cost IntVar - cost(void) const override { + cost() const override { return bins; } /// Constructor for cloning \a s @@ -521,7 +520,7 @@ class BinPacking : public IntMinimizeScript { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new BinPacking(*this); } /// Print solution diff --git a/examples/black-hole.cpp b/examples/black-hole.cpp index 38c3dd016f..0ae027f5c7 100644 --- a/examples/black-hole.cpp +++ b/examples/black-hole.cpp @@ -245,7 +245,8 @@ class BlackHole : public Script { for (IntVarValues vals(x); vals(); ++vals) if (layer[vals.val()] < w) { v = vals.val(); - if ((w = layer[vals.val()]) == 0) + w = layer[vals.val()]; + if (w == 0) break; } assert(v >= 1 && v < 52); @@ -285,7 +286,7 @@ class BlackHole : public Script { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new BlackHole(*this); } }; diff --git a/examples/car-sequencing.cpp b/examples/car-sequencing.cpp index 6436695ab1..1bf9b29647 100644 --- a/examples/car-sequencing.cpp +++ b/examples/car-sequencing.cpp @@ -70,7 +70,7 @@ namespace { } /// Get max stalls int - max_stalls(void) const { + max_stalls() const { return _max_stalls.value(); } }; @@ -404,7 +404,7 @@ class CarSequencing : public Script { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new CarSequencing(*this); } }; diff --git a/examples/cartesian-heart.cpp b/examples/cartesian-heart.cpp index 3c5db3894e..9bb9f016b7 100644 --- a/examples/cartesian-heart.cpp +++ b/examples/cartesian-heart.cpp @@ -82,7 +82,7 @@ class CartesianHeart : public Script { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new CartesianHeart(*this); } /// Add constraints to current model to get next solution (not too close) diff --git a/examples/colored-matrix.cpp b/examples/colored-matrix.cpp index b4c25de9f6..9d5b1d19c6 100644 --- a/examples/colored-matrix.cpp +++ b/examples/colored-matrix.cpp @@ -73,43 +73,41 @@ class ColoredMatrixOptions : public Options { /// Return height int - height(void) const { + height() const { if (_size.value() == 0U) return static_cast(_height.value()); - else - return static_cast(_size.value()); + return static_cast(_size.value()); } /// Return width int - width(void) const { + width() const { if (_size.value() == 0U) return static_cast(_width.value()); - else - return static_cast(_size.value()); + return static_cast(_size.value()); } /// Return number of colors int - colors(void) const { + colors() const { return static_cast(_colors.value()); } /// Return how to implement not all equals int - not_all_equal(void) const { + not_all_equal() const { return _not_all_equal.value(); } /// Return how to implement same or 0 int - same_or_0(void) const { + same_or_0() const { return _same_or_0.value(); } /// Return how to implement distinct except 0 int - distinct_except_0(void) const { + distinct_except_0() const { return _distinct_except_0.value(); } /// Return how to implement distinct except 0 int - no_monochrome_rectangle(void) const { + no_monochrome_rectangle() const { return _no_monochrome_rectangle.value(); } }; @@ -432,7 +430,7 @@ class ColoredMatrix : public IntMinimizeScript { /// Return cost IntVar - cost(void) const override { + cost() const override { return max_color; } @@ -460,7 +458,7 @@ class ColoredMatrix : public IntMinimizeScript { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new ColoredMatrix(*this); } }; diff --git a/examples/common-pattern.cpp b/examples/common-pattern.cpp index 961361601f..78b0319ac6 100644 --- a/examples/common-pattern.cpp +++ b/examples/common-pattern.cpp @@ -55,7 +55,7 @@ class CommonPatternOptions : public Options { int threshold; public: - CommonPatternOptions(void) + CommonPatternOptions() : Options("CommonPattern"), _sequences("sequences", "comma-separated sequences over A..Z", "ABCBC,BABC,ABDC"), _file("file", "sequence database; one sequence per line", ""), _support("support", "minimum supporting sequences, as a percentage", "100"), @@ -85,7 +85,7 @@ class CommonPatternOptions : public Options { /// Validate external input before constructing a space void - read(void) { + read() { if (_min_length.value() < 1 || _min_length.value() > Int::Limits::max) throw std::invalid_argument("Minimum length must be a positive Gecode integer"); PatternMining::Sequences sequences; @@ -104,7 +104,7 @@ class CommonPatternOptions : public Options { std::ifstream stream(filename); sequences = PatternMining::read_database(stream, format()); } - input.reset(new PatternMining::Database(sequences)); + input = std::make_unique(sequences); threshold = PatternMining::minimum_support(_support.value(), input->ends.size()); const std::string items(_required.value()); if (!items.empty()) { @@ -123,31 +123,31 @@ class CommonPatternOptions : public Options { } const PatternMining::Database& - database(void) const { + database() const { return *input; } const std::vector& - required(void) const { + required() const { return required_items; } int - support(void) const { + support() const { return threshold; } int - min_length(void) const { + min_length() const { return static_cast(_min_length.value()); } PatternMining::Format - format(void) const { + format() const { return static_cast(_format.value()); } bool - letters(void) const { + letters() const { return format() == PatternMining::Format::LETTERS; } PatternMining::Language - language(void) const { + language() const { const auto selected = static_cast(_language.value()); if (selected == PatternMining::Language::DEFAULT) return _motif.value() ? PatternMining::Language::MOTIF : PatternMining::Language::NONE; @@ -222,7 +222,7 @@ class CommonPattern : public IntMaximizeScript { } IntVar - cost(void) const override { + cost() const override { return pattern.length(); } @@ -232,7 +232,7 @@ class CommonPattern : public IntMaximizeScript { } Space* - copy(void) override { + copy() override { return new CommonPattern(*this); } diff --git a/examples/common-pattern.hh b/examples/common-pattern.hh index 3159166e06..cc2ddd2d20 100644 --- a/examples/common-pattern.hh +++ b/examples/common-pattern.hh @@ -22,7 +22,7 @@ namespace PatternMining { using namespace Gecode; - typedef std::vector> Sequences; + using Sequences = std::vector>; enum class Format { LETTERS, INTEGERS, SPMF }; enum class Language { DEFAULT, NONE, MOTIF, RE10, RE14, RE2 }; @@ -143,10 +143,10 @@ namespace PatternMining { } } items.init(static_cast(symbols.size())); - std::sort(symbols.begin(), symbols.end()); - symbols.erase(std::unique(symbols.begin(), symbols.end()), symbols.end()); + std::ranges::sort(symbols); + symbols.erase(std::ranges::unique(symbols).begin(), symbols.end()); alphabet.init(static_cast(symbols.size())); - std::copy(symbols.begin(), symbols.end(), alphabet.begin()); + std::ranges::copy(symbols, alphabet.begin()); ends.init(static_cast(input.size())); last_ends.init(static_cast(input.size())); Region region; @@ -158,8 +158,7 @@ namespace PatternMining { for (const std::vector& sequence : input) { const int start = position; for (int item : sequence) - items[position++] = - static_cast(std::lower_bound(symbols.begin(), symbols.end(), item) - symbols.begin()); + items[position++] = static_cast(std::ranges::lower_bound(symbols, item) - symbols.begin()); ends[record] = position; for (int j = position; j-- > start;) if (seen[items[j]] != record) { @@ -169,16 +168,16 @@ namespace PatternMining { last_ends[record++] = static_cast(last.size()); } last_positions.init(static_cast(last.size())); - std::copy(last.begin(), last.end(), last_positions.begin()); + std::ranges::copy(last, last_positions.begin()); } IntSet - domain(void) const { + domain() const { return IntSet(alphabet.begin(), alphabet.size()); } int - max_length(void) const { + max_length() const { int bound = 0; int start = 0; for (int end : ends) { @@ -242,8 +241,7 @@ namespace PatternMining { /// Extend the prefix by one item and report whether enough records support it bool advance(int item) { - const int rank = static_cast(std::lower_bound(data.alphabet.begin(), data.alphabet.end(), item) - - data.alphabet.begin()); + const int rank = static_cast(std::ranges::lower_bound(data.alphabet, item) - data.alphabet.begin()); if ((rank == data.alphabet.size()) || (data.alphabet[rank] != item)) return false; int n = 0; @@ -261,7 +259,7 @@ namespace PatternMining { } int - support(void) const { + support() const { return size; } @@ -301,7 +299,7 @@ namespace PatternMining { int* sizes = region.alloc(size); for (int i = 0; i < size; i++) sizes[i] = data.ends[suffixes[i].sequence] - suffixes[i].begin; - std::nth_element(sizes, sizes + threshold - 1, sizes + size, std::greater()); + std::nth_element(sizes, sizes + threshold - 1, sizes + size, std::greater<>()); return sizes[threshold - 1]; } }; diff --git a/examples/crew.cpp b/examples/crew.cpp index cde919c25c..4883b7b5fe 100644 --- a/examples/crew.cpp +++ b/examples/crew.cpp @@ -40,7 +40,7 @@ using namespace Gecode; namespace { /// The airline employees - typedef enum { + using Employee = enum { TOM, DAVID, JEREMY, @@ -61,7 +61,7 @@ namespace { JEAN, HEATHER, JULIET - } Employee; + }; const int no_of_employees = JULIET + 1; /// A flight to schedule @@ -169,7 +169,7 @@ class Crew : public Script { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new Crew(*this); } }; diff --git a/examples/crossword.cpp b/examples/crossword.cpp index dd101126d9..8b145295f8 100644 --- a/examples/crossword.cpp +++ b/examples/crossword.cpp @@ -269,7 +269,7 @@ class Crossword : public Script { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new Crossword(*this); } /// Print solution diff --git a/examples/crowded-chess.cpp b/examples/crowded-chess.cpp index 2470cdb1ab..7a991f4e8c 100644 --- a/examples/crowded-chess.cpp +++ b/examples/crowded-chess.cpp @@ -88,7 +88,7 @@ namespace { k.update(*this, s.k); } Space* - copy(void) override { + copy() override { return new Bishops(*this); } }; @@ -206,7 +206,7 @@ class CrowdedChess : public Script { /// Post knight-constraints void - knight_constraints(void) { + knight_constraints() { static const int kmoves[4][2] = {{-1, 2}, {1, 2}, {2, -1}, {2, 1}}; Matrix kb(knights, n, n); for (int x = n; x--;) @@ -332,7 +332,7 @@ class CrowdedChess : public Script { /// Copy during cloning Space* - copy(void) override { + copy() override { return new CrowdedChess(*this); } diff --git a/examples/descartes-folium.cpp b/examples/descartes-folium.cpp index 56288274e3..926ee89d03 100644 --- a/examples/descartes-folium.cpp +++ b/examples/descartes-folium.cpp @@ -95,12 +95,12 @@ class DescartesFolium : public FloatMaximizeScript { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new DescartesFolium(*this); } /// Cost function FloatVar - cost(void) const override { + cost() const override { return f[0]; } /// Print solution coordinates diff --git a/examples/dominating-queens.cpp b/examples/dominating-queens.cpp index 17a62a8a6b..43b5ed0d02 100644 --- a/examples/dominating-queens.cpp +++ b/examples/dominating-queens.cpp @@ -113,7 +113,7 @@ class DominatingQueens : public IntMinimizeScript { /// Return cost IntVar - cost(void) const override { + cost() const override { return q; } @@ -125,7 +125,7 @@ class DominatingQueens : public IntMinimizeScript { /// Perform copying during cloning Space* - copy(void) override { + copy() override { return new DominatingQueens(*this); } diff --git a/examples/domino.cpp b/examples/domino.cpp index 1601dcac25..47754fe5ee 100644 --- a/examples/domino.cpp +++ b/examples/domino.cpp @@ -200,7 +200,7 @@ class Domino : public Script { } /// Copy space during cloning Space* - copy(void) override { + copy() override { return new Domino(*this); } }; diff --git a/examples/donald.cpp b/examples/donald.cpp index 243e5ad111..ce83db27aa 100644 --- a/examples/donald.cpp +++ b/examples/donald.cpp @@ -95,7 +95,7 @@ class Donald : public Script { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new Donald(*this); } /// Print solution diff --git a/examples/efpa.cpp b/examples/efpa.cpp index 610ef58ea5..e76b308f32 100644 --- a/examples/efpa.cpp +++ b/examples/efpa.cpp @@ -76,33 +76,33 @@ class EFPAOptions : public Options { } /// Get v, number of sequences int - v(void) const { + v() const { return _v.value(); } /// Get q, number of symbols int - q(void) const { + q() const { return _q.value(); } /// Get lambda, sets of symbols per sequence int - l(void) const { + l() const { return _l.value(); } /// Get d, Hamming distance between sequences int - d(void) const { + d() const { return _d.value(); } /// Whether to use permutation constraints. Only active if d=4 bool - permutation(void) const { + permutation() const { return d() == 4 && _permutation.value(); } /// Whether to use symmetry breaking. bool - symmetry(void) const { + symmetry() const { return _symmetry.value(); } }; @@ -296,7 +296,7 @@ class EFPA : public Script { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new EFPA(*this); } }; diff --git a/examples/eq20.cpp b/examples/eq20.cpp index e45d0857e0..aa064d81c9 100644 --- a/examples/eq20.cpp +++ b/examples/eq20.cpp @@ -90,7 +90,7 @@ class Eq20 : public Script { } /// Perform copying during cloning Space* - copy(void) override { + copy() override { return new Eq20(*this); } /// Print solution diff --git a/examples/fifteen-puzzle.cpp b/examples/fifteen-puzzle.cpp index 3d0773d5cc..47a94d51ce 100644 --- a/examples/fifteen-puzzle.cpp +++ b/examples/fifteen-puzzle.cpp @@ -55,7 +55,7 @@ class PuzzleOptions : public Options { enum { MODEL_OPEN, MODEL_FIXED }; enum { BRANCH_MIN, BRANCH_MANHATTAN }; enum { SEARCH_BAB, SEARCH_ASTAR, SEARCH_CABS }; - PuzzleOptions(void) + PuzzleOptions() : Options("FifteenPuzzle"), _scramble("scramble", "number of random slides from the goal", 12), _limit("limit", "maximum number of solution moves", 12) { add(_scramble); @@ -76,18 +76,18 @@ class PuzzleOptions : public Options { seed(1); } unsigned int - scramble(void) const { + scramble() const { return _scramble.value(); } int - limit(void) const { + limit() const { Int::Limits::check(16 * (static_cast(_limit.value()) + 1), "FifteenPuzzle::limit"); return static_cast(_limit.value()); } }; static Board -goal(void) { +goal() { return {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0}; } @@ -175,7 +175,7 @@ static void post_start(Home home, const IntVarArgs& tiles, IntVar blank, const Board& initial) { for (int i = 0; i < 16; i++) rel(home, tiles[i] == initial[i]); - const int zero = static_cast(std::find(initial.begin(), initial.end(), 0) - initial.begin()); + const int zero = static_cast(std::ranges::find(initial, 0) - initial.begin()); rel(home, blank == zero); } @@ -276,7 +276,7 @@ class OpenPuzzle : public Script { path.update(*this, s.path); } Space* - copy(void) override { + copy() override { return new OpenPuzzle(*this); } IntVarArgs @@ -287,14 +287,14 @@ class OpenPuzzle : public Script { return result; } int - depth(void) const { + depth() const { int i = 0; while (i + 1 < path.known_length() && path[i + 1].assigned()) i++; return i; } int - bound(void) const { + bound() const { const int g = depth(); const int h = manhattan(values(state(g))); return std::max(g + h, path.length().min() - 1); @@ -358,7 +358,7 @@ class FixedPuzzle : public Script { length.update(*this, s.length); } Space* - copy(void) override { + copy() override { return new FixedPuzzle(*this); } IntVarArgs @@ -369,14 +369,14 @@ class FixedPuzzle : public Script { return result; } int - depth(void) const { + depth() const { int i = 0; while (i + 1 < path.size() && path[i + 1].assigned()) i++; return i; } int - bound(void) const { + bound() const { const int g = depth(); const int h = manhattan(values(state(g))); return std::max(g + h, length.min() - 1); diff --git a/examples/golden-spiral.cpp b/examples/golden-spiral.cpp index 780d6e6a80..9771e78e50 100644 --- a/examples/golden-spiral.cpp +++ b/examples/golden-spiral.cpp @@ -100,12 +100,12 @@ class GoldenSpiral : public FloatMaximizeScript { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new GoldenSpiral(*this); } /// Cost function FloatVar - cost(void) const override { + cost() const override { return f[0]; } /// Print solution coordinates diff --git a/examples/golf.cpp b/examples/golf.cpp index 2deba902ba..f7db5f3027 100644 --- a/examples/golf.cpp +++ b/examples/golf.cpp @@ -48,7 +48,7 @@ class GolfOptions : public Options { Driver::IntOption _s; //< Number of players per group public: /// Constructor - GolfOptions(void) + GolfOptions() : Options("Golf"), _w("w", "number of weeks", 9), _g("g", "number of groups", 8), _s("s", "number of players per group", 4) { add(_w); @@ -57,17 +57,17 @@ class GolfOptions : public Options { } /// Return number of weeks int - w(void) const { + w() const { return _w.value(); } /// Return number of groups int - g(void) const { + g() const { return _g.value(); } /// Return number of players per group int - s(void) const { + s() const { return _s.value(); } }; @@ -219,7 +219,7 @@ class Golf : public Script { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new Golf(*this); } }; diff --git a/examples/golomb-ruler.cpp b/examples/golomb-ruler.cpp index 9188095bf9..a7dd82fff6 100644 --- a/examples/golomb-ruler.cpp +++ b/examples/golomb-ruler.cpp @@ -99,7 +99,7 @@ class GolombRuler : public IntMinimizeScript { /// Return cost IntVar - cost(void) const override { + cost() const override { return m[m.size() - 1]; } @@ -115,7 +115,7 @@ class GolombRuler : public IntMinimizeScript { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new GolombRuler(*this); } }; diff --git a/examples/graph-color.cpp b/examples/graph-color.cpp index e12da862cb..7c6b457117 100644 --- a/examples/graph-color.cpp +++ b/examples/graph-color.cpp @@ -320,7 +320,7 @@ class GraphColor : public IntMinimizeScript { } /// Cost function IntVar - cost(void) const override { + cost() const override { return m; } /// Constructor for cloning \a s @@ -330,7 +330,7 @@ class GraphColor : public IntMinimizeScript { } /// Copying during cloning Space* - copy(void) override { + copy() override { return new GraphColor(*this); } /// Print the solution diff --git a/examples/grocery.cpp b/examples/grocery.cpp index d976bc6c25..d42fb1fce4 100644 --- a/examples/grocery.cpp +++ b/examples/grocery.cpp @@ -85,7 +85,7 @@ class Grocery : public Script { /// Copy during cloning Space* - copy(void) override { + copy() override { return new Grocery(*this); } diff --git a/examples/hamming.cpp b/examples/hamming.cpp index 80dcaed803..cf8e21ecf0 100644 --- a/examples/hamming.cpp +++ b/examples/hamming.cpp @@ -63,17 +63,17 @@ class HammingOptions : public Options { /// Return number of bits unsigned int - bits(void) const { + bits() const { return _bits.value(); } /// Return minimum distance unsigned int - distance(void) const { + distance() const { return _distance.value(); } /// Return number of symbols unsigned int - size(void) const { + size() const { return _size.value(); } }; @@ -127,7 +127,7 @@ class Hamming : public Script { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new Hamming(*this); } }; diff --git a/examples/ind-set.cpp b/examples/ind-set.cpp index 098485fb43..b6de23b800 100644 --- a/examples/ind-set.cpp +++ b/examples/ind-set.cpp @@ -97,7 +97,7 @@ class IndSet : public IntMaximizeScript { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new IndSet(*this); } /// Print solution @@ -107,7 +107,7 @@ class IndSet : public IntMaximizeScript { } /// Return solution cost IntVar - cost(void) const override { + cost() const override { return k; } }; diff --git a/examples/job-shop-instances.hpp b/examples/job-shop-instances.hpp index 053f07830c..0342891816 100644 --- a/examples/job-shop-instances.hpp +++ b/examples/job-shop-instances.hpp @@ -30,6 +30,7 @@ * */ +// NOLINTNEXTLINE(misc-anonymous-namespace-in-header): included by one example namespace { /* diff --git a/examples/job-shop.cpp b/examples/job-shop.cpp index 838d68fb97..27322ea1d9 100644 --- a/examples/job-shop.cpp +++ b/examples/job-shop.cpp @@ -135,17 +135,17 @@ instances { public: /// Whether a valid specification has been found bool - valid(void) const { + valid() const { return data != nullptr; } /// Return number of jobs int - jobs(void) const { + jobs() const { return data[0]; } /// Return number of machines int - machines(void) const { + machines() const { return data[1]; } /// Return machine of step \a j in job \a i @@ -172,7 +172,7 @@ instances { } /// Compute lower bound int - clower(void) const { + clower() const { int l = 0; Region r; int* mach = r.alloc(machines()); @@ -192,7 +192,7 @@ instances { } /// Compute naive upper bound int - cupper(void) const { + cupper() const { int u = 0; for (int i = 0; i < jobs(); i++) for (int j = 0; j < machines(); j++) @@ -234,17 +234,17 @@ instances { } /// Return lower bound int - lower(void) const { + lower() const { return l; } /// Return upper bound int - upper(void) const { + upper() const { return u; } /// Return name const char* - name(void) const { + name() const { return n; } }; @@ -292,42 +292,42 @@ class JobShopOptions : public InstanceOptions { } /// Return whether to print schedule bool - verbose(void) const { + verbose() const { return _verbose.value(); } /// Return number of probes unsigned int - probes(void) const { + probes() const { return _probes.value(); } /// Return number of failures per probe unsigned int - fail_probe(void) const { + fail_probe() const { return _fail_probe.value(); } /// Return time-out for probe unsigned int - time_probe(void) const { + time_probe() const { return _time_probe.value(); } /// Return time-out for adjust unsigned int - time_adjust(void) const { + time_adjust() const { return _time_adjust.value(); } /// Return time-out for solve unsigned int - time_solve(void) const { + time_solve() const { return _time_solve.value(); } /// Return tie-breaking factor double - tbf(void) const { + tbf() const { return _tbf.value(); } /// Print help text for list of instances void - help(void) override { + help() override { InstanceOptions::help(); std::cerr << "\tAvailable instances:" << '\n' << "\t\t"; for (int i = 1; ::name[i] != nullptr; i++) { @@ -383,7 +383,7 @@ class JobShopBase : public IntMinimizeScript { } /// Do not overload machines void - post_no_overload(void) { + post_no_overload() { // Number of jobs and machines/steps int n = spec.jobs(), m = spec.machines(); @@ -408,7 +408,7 @@ class JobShopBase : public IntMinimizeScript { } /// Return cost IntVar - cost(void) const override { + cost() const override { return makespan; } /// Constructor for cloning \a s @@ -487,7 +487,7 @@ class JobShopProbe : public JobShopBase { JobShopProbe(JobShopProbe& s) : JobShopBase(s) {} /// Copy during cloning Space* - copy(void) override { + copy() override { return new JobShopProbe(*this); } }; @@ -648,7 +648,7 @@ class JobShopSolve : public JobShopBase { baction(s.baction), ichb(s.ichb), bchb(s.bchb), rnd(s.rnd) {} /// Copy during cloning Space* - copy(void) override { + copy() override { return new JobShopSolve(*this); } }; @@ -678,14 +678,14 @@ class FailTimeStop : public Search::Stop { return ts->stop(s, o); } /// Destructor - ~FailTimeStop(void) override { + ~FailTimeStop() override { delete fs; delete ts; } }; /// Print statistics -void +static void print(const Search::Statistics& stat, bool restart) { using namespace std; cout << "\t\t\tnodes: " << stat.node << '\n' << "\t\t\tfailures: " << stat.fail << '\n'; @@ -695,7 +695,7 @@ print(const Search::Statistics& stat, bool restart) { } /// Solver -void +static void solve(const JobShopOptions& opt) { Rnd rnd = opt.rnd(); diff --git a/examples/kakuro.cpp b/examples/kakuro.cpp index e7b9b5d36e..36652ded2c 100644 --- a/examples/kakuro.cpp +++ b/examples/kakuro.cpp @@ -262,12 +262,12 @@ namespace { } /// Perform copying during cloning Space* - copy(void) override { + copy() override { return new DistinctLinear(*this); } /// Return a solution IntArgs - solution(void) const { + solution() const { IntArgs s(x.size()); for (int i = 0; i < x.size(); i++) s[i] = x[i].val(); @@ -305,7 +305,7 @@ namespace { Entry* cache; ///< Where all entries start public: /// Initialize cache as empty - Cache(void) : cache(nullptr) {} + Cache() : cache(nullptr) {} /// Return possibly cached Data for \a n distinct variables with sum \a c TupleSet get(int n, int c) { @@ -323,7 +323,7 @@ namespace { return cache->ts; } /// Delete cache entries - ~Cache(void) { + ~Cache() { Entry* e = cache; while (e != nullptr) { Entry* d = e; @@ -459,7 +459,7 @@ class Kakuro : public Script { } /// Perform copying during cloning Space* - copy(void) override { + copy() override { return new Kakuro(*this); } /// Print solution diff --git a/examples/knights.cpp b/examples/knights.cpp index dd4487d57f..e748ce3cba 100644 --- a/examples/knights.cpp +++ b/examples/knights.cpp @@ -128,8 +128,7 @@ class Warnsdorff : public Brancher { const Choice& c = static_cast(_c); if (a == 0) return me_failed(x[c.pos].eq(home, c.val)) ? ES_FAILED : ES_OK; - else - return me_failed(x[c.pos].nq(home, c.val)) ? ES_FAILED : ES_OK; + return me_failed(x[c.pos].nq(home, c.val)) ? ES_FAILED : ES_OK; } /// Print explanation void @@ -193,8 +192,8 @@ class Knights : public Script { static const int moves[8][2] = {{-2, -1}, {-2, 1}, {-1, -2}, {-1, 2}, {1, -2}, {1, 2}, {2, -1}, {2, 1}}; int nbs[8]; int n_nbs = 0; - for (int m = 0; m < 8; m++) { - int nx = x(i) + moves[m][0], ny = y(i) + moves[m][1]; + for (const auto* move : moves) { + int nx = x(i) + move[0], ny = y(i) + move[1]; if ((nx >= 0) && (nx < n) && (ny >= 0) && (ny < n)) nbs[n_nbs++] = f(nx, ny); } @@ -287,7 +286,7 @@ class KnightsReified : public Knights { KnightsReified(KnightsReified& s) : Knights(s) {} /// Copy during cloning Space* - copy(void) override { + copy() override { return new KnightsReified(*this); } }; @@ -318,7 +317,7 @@ class KnightsCircuit : public Knights { KnightsCircuit(KnightsCircuit& s) : Knights(s) {} /// Copy during cloning Space* - copy(void) override { + copy() override { return new KnightsCircuit(*this); } }; @@ -342,7 +341,7 @@ class KnightsInspector : public Gist::Inspector { public: /// Constructor - KnightsInspector(void) : scene(nullptr), mw(nullptr) {} + KnightsInspector() : scene(nullptr), mw(nullptr) {} /// Inspect space \a s void inspect(const Space& s) override { @@ -380,7 +379,7 @@ class KnightsInspector : public Gist::Inspector { /// Set up main window void - initialize(void) { + initialize() { mw = new QMainWindow(); scene = new QGraphicsScene(); QGraphicsView* view = new QGraphicsView(scene); @@ -390,18 +389,18 @@ class KnightsInspector : public Gist::Inspector { mw->setAttribute(Qt::WA_DeleteOnClose, false); QAction* close_window = new QAction("Close window", mw); close_window->setShortcut(QKeySequence("Ctrl+W")); - mw->connect(close_window, SIGNAL(triggered()), mw, SLOT(close())); + QMainWindow::connect(close_window, SIGNAL(triggered()), mw, SLOT(close())); mw->addAction(close_window); } /// Name of the inspector std::string - name(void) override { + name() override { return "Board"; } /// Finalize inspector void - finalize(void) override { + finalize() override { delete mw; mw = nullptr; } diff --git a/examples/langford-number.cpp b/examples/langford-number.cpp index 07f0e074fa..69ace7abdf 100644 --- a/examples/langford-number.cpp +++ b/examples/langford-number.cpp @@ -61,7 +61,7 @@ class LangfordNumberOptions : public Options { } /// Print help message void - help(void) override { + help() override { Options::help(); std::cerr << "\t(unsigned int) default: " << n << '\n' << "\t\tparameter n" << '\n' @@ -168,7 +168,7 @@ class LangfordNumber : public Script { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new LangfordNumber(*this); } }; diff --git a/examples/magic-sequence.cpp b/examples/magic-sequence.cpp index 65627ac33e..b12fb9ec85 100644 --- a/examples/magic-sequence.cpp +++ b/examples/magic-sequence.cpp @@ -90,7 +90,7 @@ class MagicSequence : public Script { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new MagicSequence(*this); } /// Print sequence diff --git a/examples/magic-square-partial.cpp b/examples/magic-square-partial.cpp index f21fced33a..e2be17f2b2 100644 --- a/examples/magic-square-partial.cpp +++ b/examples/magic-square-partial.cpp @@ -138,7 +138,7 @@ class MagicSquare : public Script { /// Copy during cloning Space* - copy(void) override { + copy() override { return new MagicSquare(*this); } /// Print solution diff --git a/examples/magic-square.cpp b/examples/magic-square.cpp index 9d10600cff..1de3beab4d 100644 --- a/examples/magic-square.cpp +++ b/examples/magic-square.cpp @@ -110,7 +110,7 @@ class MagicSquare : public Script { /// Copy during cloning Space* - copy(void) override { + copy() override { return new MagicSquare(*this); } /// Print solution diff --git a/examples/minesweeper.cpp b/examples/minesweeper.cpp index 5b7f2e95d2..80f67b3353 100644 --- a/examples/minesweeper.cpp +++ b/examples/minesweeper.cpp @@ -68,7 +68,7 @@ class MineSweeper : public Script { return b[h * size + w]; } /// Access position (\a h,\a w) in the matrix. - const BoolVar + BoolVar pos(int h, int w) const { return b[h * size + w]; } @@ -136,7 +136,7 @@ class MineSweeper : public Script { } /// Copy space during cloning Space* - copy(void) override { + copy() override { return new MineSweeper(*this); } }; @@ -295,8 +295,7 @@ namespace { int res = (c - 'A') + 10; if (res > n) return 0; - else - return res; + return res; } //@} } // namespace diff --git a/examples/money.cpp b/examples/money.cpp index 823ed987cb..2a37a6bce9 100644 --- a/examples/money.cpp +++ b/examples/money.cpp @@ -109,7 +109,7 @@ class Money : public Script { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new Money(*this); } }; diff --git a/examples/multi-bin-packing.cpp b/examples/multi-bin-packing.cpp index 5e60b43f8a..6d5edb9691 100644 --- a/examples/multi-bin-packing.cpp +++ b/examples/multi-bin-packing.cpp @@ -67,27 +67,27 @@ namespace { Spec(const char* s) : data(find(s)), n(s) {} /// Whether a valid specification has been found bool - valid(void) const { + valid() const { return data != nullptr; } /// Return dimension int - dimension(void) const { + dimension() const { return data[0]; } /// Return instance name const char* - iname(void) const { + iname() const { return n; } /// Return number of items int - items(void) const { + items() const { return data[1]; } /// Return number of bins int - bins(void) const { + bins() const { return data[2]; } /// Return item size for item \a i in dimension \a k @@ -203,7 +203,7 @@ class MultiBinPacking : public Script { } /// Perform copying during cloning Space* - copy(void) override { + copy() override { return new MultiBinPacking(*this); } /// Print solution diff --git a/examples/nonogram.cpp b/examples/nonogram.cpp index 47532b12db..388bf6b1bd 100644 --- a/examples/nonogram.cpp +++ b/examples/nonogram.cpp @@ -143,12 +143,12 @@ class Nonogram : public Script { /// Return width of board int - width(void) const { + width() const { return spec[0]; } /// Return height of board int - height(void) const { + height() const { return spec[1]; } @@ -244,7 +244,7 @@ class Nonogram : public Script { /// Copy space during cloning Space* - copy(void) override { + copy() override { return new Nonogram(*this); } diff --git a/examples/open-route.cpp b/examples/open-route.cpp index 14f5b5bfab..7a5f1a9a63 100644 --- a/examples/open-route.cpp +++ b/examples/open-route.cpp @@ -96,7 +96,7 @@ class OpenRoute : public Script { /// Perform copying during cloning Space* - copy(void) override { + copy() override { return new OpenRoute(*this); } diff --git a/examples/open-shop.cpp b/examples/open-shop.cpp index e14fe1741a..57b510b888 100644 --- a/examples/open-shop.cpp +++ b/examples/open-shop.cpp @@ -79,7 +79,7 @@ class OpenShop : public IntMinimizeScript { int p; //< Processing time /// Default constructor // NOLINTNEXTLINE(modernize-use-equals-default) - Task(void) {} + Task() {} /// Constructor Task(int j0, int m0, int p0) : j(j0), m(m0), p(p0) {} }; @@ -265,13 +265,13 @@ class OpenShop : public IntMinimizeScript { /// Perform copying during cloning Space* - copy(void) override { + copy() override { return new OpenShop(*this); } /// Minimize the makespan IntVar - cost(void) const override { + cost() const override { return makespan; } diff --git a/examples/ortho-latin.cpp b/examples/ortho-latin.cpp index 89baa02bd9..83966f8260 100644 --- a/examples/ortho-latin.cpp +++ b/examples/ortho-latin.cpp @@ -134,7 +134,7 @@ class OrthoLatinSquare : public Script { /// Copy during cloning Space* - copy(void) override { + copy() override { return new OrthoLatinSquare(*this); } /// Print solution diff --git a/examples/partition.cpp b/examples/partition.cpp index f9e32e8186..3c5bd6570a 100644 --- a/examples/partition.cpp +++ b/examples/partition.cpp @@ -99,7 +99,7 @@ class Partition : public Script { } /// Copying during cloning Space* - copy(void) override { + copy() override { return new Partition(*this); } /// Print solution @@ -108,17 +108,17 @@ class Partition : public Script { os << "\t"; int a, b; a = b = 0; - for (int i = 0; i < x.size(); i++) { - a += x[i].val(); - b += x[i].val() * x[i].val(); - os << x[i] << ", "; + for (auto xi : x) { + a += xi.val(); + b += xi.val() * xi.val(); + os << xi << ", "; } os << " = " << a << ", " << b << '\n' << "\t"; a = b = 0; - for (int i = 0; i < y.size(); i++) { - a += y[i].val(); - b += y[i].val() * y[i].val(); - os << y[i] << ", "; + for (auto yi : y) { + a += yi.val(); + b += yi.val() * yi.val(); + os << yi << ", "; } os << " = " << a << ", " << b << '\n'; } diff --git a/examples/pentominoes.cpp b/examples/pentominoes.cpp index 849eb7c58b..f6cae95db0 100644 --- a/examples/pentominoes.cpp +++ b/examples/pentominoes.cpp @@ -91,9 +91,9 @@ namespace { */ int pos(int h, int w, int h1, int w1); /// Type for tile symmetry functions - typedef void (*tsymmfunc)(const char*, int, int, char*, int&, int&); + using tsymmfunc = void (*)(const char*, int, int, char*, int&, int&); /// Type for board symmetry functions - typedef void (*bsymmfunc)(const IntVarArgs, int, int, IntVarArgs&, int&, int&); + using bsymmfunc = void (*)(const IntVarArgs, int, int, IntVarArgs&, int&, int&); /// Identity symmetry template void id(CArray t1, int w1, int h1, Array t2, int& w2, int& h2); @@ -442,7 +442,7 @@ class Pentominoes : public Script { /// Copy space during cloning Space* - copy(void) override { + copy() override { return new Pentominoes(*this); } diff --git a/examples/perfect-square.cpp b/examples/perfect-square.cpp index 0102864c94..c7e74f69ac 100644 --- a/examples/perfect-square.cpp +++ b/examples/perfect-square.cpp @@ -215,7 +215,7 @@ class PerfectSquare : public Script { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new PerfectSquare(*this); } /// Print solution diff --git a/examples/photo.cpp b/examples/photo.cpp index 72bee61b78..80d1f29b4b 100644 --- a/examples/photo.cpp +++ b/examples/photo.cpp @@ -51,12 +51,12 @@ class PhotoSpec { PhotoSpec(int i) : data(pi[i]) {} /// Return number of people int - people(void) const { + people() const { return data[0]; } /// Return number of preferences int - preferences(void) const { + preferences() const { return data[1]; } /// Access preference \a p with position \a i @@ -143,7 +143,7 @@ class Photo : public IntMinimizeScript { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new Photo(*this); } /// Print solution @@ -153,7 +153,7 @@ class Photo : public IntMinimizeScript { } /// Return solution cost IntVar - cost(void) const override { + cost() const override { return violations; } }; diff --git a/examples/qcp.cpp b/examples/qcp.cpp index f5b95fd83f..e4c48ffa6c 100644 --- a/examples/qcp.cpp +++ b/examples/qcp.cpp @@ -45,9 +45,9 @@ using namespace Gecode; namespace { /// Number of random seeds - static const int n_seeds = 32; + const int n_seeds = 32; /// Random seeds (generated by hardware random generator) - static const unsigned int seeds[n_seeds] = { + const unsigned int seeds[n_seeds] = { 4156683608, 97006981, 1375463525, 841714419, 715462902, 2418870981, 1624092856, 123015042, 2456879733, 1964065250, 2622145091, 3852245775, 205913142, 1921802200, 3118573517, 315803625, 1823610061, 3329660933, 3706705607, 2648334003, 424666975, 1774959171, 4178564660, 52701009, @@ -67,7 +67,7 @@ namespace { } /// Return tie-breaking factor double - tbf(void) const { + tbf() const { return _tbf.value(); } /// Set tie-breaking factor @@ -107,14 +107,14 @@ namespace { public: /// Whether a valid specification has been found bool - valid(void) const { + valid() const { return data != nullptr; } /// Initialize Spec(const char* s) : data(find(s)) {} /// Return problem size int - size(void) const { + size() const { return data[0]; } /// Whether field is pre-assigned @@ -240,7 +240,7 @@ class QCP : public Script { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new QCP(*this); } /// Print solution diff --git a/examples/queen-armies.cpp b/examples/queen-armies.cpp index 585641650c..73367fc614 100644 --- a/examples/queen-armies.cpp +++ b/examples/queen-armies.cpp @@ -119,12 +119,12 @@ class QueenArmies : public IntMaximizeScript { } /// Return copy during cloning Space* - copy(void) override { + copy() override { return new QueenArmies(*this); } /// Return solution cost IntVar - cost(void) const override { + cost() const override { return q; } /// Print solution @@ -260,7 +260,7 @@ class QueenArmies : public IntMaximizeScript { }; /** \brief Position of a piece in a square board. */ -int +static int pos(int i, int j, int n) { return i * n + j; } diff --git a/examples/queens.cpp b/examples/queens.cpp index 3e8c00e51a..f5b8d15f09 100644 --- a/examples/queens.cpp +++ b/examples/queens.cpp @@ -98,7 +98,7 @@ class Queens : public Script { /// Perform copying during cloning Space* - copy(void) override { + copy() override { return new Queens(*this); } @@ -128,7 +128,7 @@ class QueensInspector : public Gist::Inspector { public: /// Constructor - QueensInspector(void) : scene(nullptr), mw(nullptr) {} + QueensInspector() : scene(nullptr), mw(nullptr) {} /// Inspect space \a s void inspect(const Space& s) override { @@ -159,7 +159,7 @@ class QueensInspector : public Gist::Inspector { /// Set up main window void - initialize(void) { + initialize() { mw = new QMainWindow(); scene = new QGraphicsScene(); QGraphicsView* view = new QGraphicsView(scene); @@ -169,18 +169,18 @@ class QueensInspector : public Gist::Inspector { mw->setAttribute(Qt::WA_DeleteOnClose, false); QAction* close_window = new QAction("Close window", mw); close_window->setShortcut(QKeySequence("Ctrl+W")); - mw->connect(close_window, SIGNAL(triggered()), mw, SLOT(close())); + QMainWindow::connect(close_window, SIGNAL(triggered()), mw, SLOT(close())); mw->addAction(close_window); } /// Name of the inspector std::string - name(void) override { + name() override { return "Board"; } /// Finalize inspector void - finalize(void) override { + finalize() override { delete mw; mw = nullptr; } diff --git a/examples/radiotherapy.cpp b/examples/radiotherapy.cpp index d0a3f1110c..c8c35968ae 100644 --- a/examples/radiotherapy.cpp +++ b/examples/radiotherapy.cpp @@ -182,13 +182,13 @@ class Radiotherapy : public IntMinimizeScript { /// Perform copying during cloning Space* - copy(void) override { + copy() override { return new Radiotherapy(*this); } /// Cost to be minimized IntVar - cost(void) const override { + cost() const override { return _cost; } @@ -340,7 +340,7 @@ class Radiotherapy : public IntMinimizeScript { index[i].weight *= 0.9; } (void)Brancher::dispose(home); - (void)index.~SharedArray(); + index.~SharedArray(); return sizeof(*this); } }; @@ -373,19 +373,19 @@ namespace { //@{ // Small instance - static const int intensity0[] = {7, 2, 14, 8, 9, 13, 4, 1, 2, 9, 5, 12, 2, 11, 9, 10, 2, 4, 9, 7, 10, 2, 8, 11, 1}; + const int intensity0[] = {7, 2, 14, 8, 9, 13, 4, 1, 2, 9, 5, 12, 2, 11, 9, 10, 2, 4, 9, 7, 10, 2, 8, 11, 1}; RadiotherapyData rd0(5, 5, intensity0); // Larger instance - static const int intensity1[] = { - 6, 10, 6, 8, 10, 0, 4, 10, 0, 6, 2, 8, 0, 2, 0, 1, 8, 3, 1, 0, 8, 0, 3, 6, 10, 9, 8, 9, 6, - 9, 8, 5, 6, 7, 7, 0, 6, 8, 2, 7, 5, 2, 0, 9, 2, 9, 2, 10, 5, 7, 1, 3, 7, 5, 1, 8, 2, 3, - 10, 4, 8, 7, 4, 1, 6, 3, 0, 1, 2, 6, 4, 4, 0, 5, 0, 9, 0, 7, 4, 9, 7, 4, 1, 4, 1, 1, 9, - 2, 9, 9, 3, 6, 10, 0, 6, 6, 10, 10, 7, 0, 10, 2, 10, 2, 4, 8, 9, 5, 2, 6, 1, 9, 0, 4, 2, 4, - 1, 5, 1, 4, 6, 10, 0, 0, 7, 0, 0, 5, 8, 5, 10, 3, 2, 2, 10, 4, 3, 0, 6, 10, 7, 2, 7, 2, 9, - 2, 8, 9, 7, 9, 10, 2, 0, 5, 5, 1, 3, 7, 1, 6, 5, 4, 2, 8, 1, 3, 6, 4, 3, 7, 10, 6, 7, 7, - 6, 5, 9, 10, 8, 3, 9, 9, 5, 2, 4, 2, 3, 3, 1, 2, 9, 2, 5, 6, 3, 7, 5, 2, 6, 4, 8, 1, 0, - 2, 4, 7, 9, 3, 3, 0, 5, 3, 8, 7, 10, 6, 7, 7, 6, 10, 4, 4, 5, 8, 0}; + const int intensity1[] = {6, 10, 6, 8, 10, 0, 4, 10, 0, 6, 2, 8, 0, 2, 0, 1, 8, 3, 1, 0, 8, 0, 3, 6, 10, + 9, 8, 9, 6, 9, 8, 5, 6, 7, 7, 0, 6, 8, 2, 7, 5, 2, 0, 9, 2, 9, 2, 10, 5, 7, + 1, 3, 7, 5, 1, 8, 2, 3, 10, 4, 8, 7, 4, 1, 6, 3, 0, 1, 2, 6, 4, 4, 0, 5, 0, + 9, 0, 7, 4, 9, 7, 4, 1, 4, 1, 1, 9, 2, 9, 9, 3, 6, 10, 0, 6, 6, 10, 10, 7, 0, + 10, 2, 10, 2, 4, 8, 9, 5, 2, 6, 1, 9, 0, 4, 2, 4, 1, 5, 1, 4, 6, 10, 0, 0, 7, + 0, 0, 5, 8, 5, 10, 3, 2, 2, 10, 4, 3, 0, 6, 10, 7, 2, 7, 2, 9, 2, 8, 9, 7, 9, + 10, 2, 0, 5, 5, 1, 3, 7, 1, 6, 5, 4, 2, 8, 1, 3, 6, 4, 3, 7, 10, 6, 7, 7, 6, + 5, 9, 10, 8, 3, 9, 9, 5, 2, 4, 2, 3, 3, 1, 2, 9, 2, 5, 6, 3, 7, 5, 2, 6, 4, + 8, 1, 0, 2, 4, 7, 9, 3, 3, 0, 5, 3, 8, 7, 10, 6, 7, 7, 6, 10, 4, 4, 5, 8, 0}; RadiotherapyData rd1(15, 15, intensity1); /* @@ -407,7 +407,7 @@ namespace { * Planning", Z. Caner Tasin, J. Cole Smith, H. Edwin Romeijn, James * F. Dempsey */ - static const int case1_beam1_matrix[] = { + const int case1_beam1_matrix[] = { 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 5, 0, 3, 0, 2, 3, 1, 0, 0, 0, 0, 0, 0, 18, 0, 0, 4, 6, 0, 2, 0, 0, 3, 11, 8, 15, 1, 11, 0, 0, 0, 10, 0, 0, 0, 0, 9, 11, 14, 6, 2, 7, 0, 0, 0, 7, 0, 0, 8, 2, 7, 10, 11, 7, 2, 0, 7, 0, 0, 0, 1, 0, 0, 4, 1, 6, 7, @@ -417,7 +417,7 @@ namespace { 0, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 1}; RadiotherapyData case1_beam1(15, 14, case1_beam1_matrix); - static const int case1_beam2_matrix[] = { + const int case1_beam2_matrix[] = { 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 4, 3, 4, 0, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 2, 0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 3, 0, 0, 0, 5, 5, 3, 0, 0, 3, 2, 8, 6, 0, 0, 3, 0, 0, 7, 11, 10, 11, 5, 8, 4, 11, 13, 20, 0, 0, 3, 0, 10, 10, 9, 7, 7, 7, 2, 9, 0, 0, 0, 9, 0, 2, 0, 4, 7, 7, 5, 6, 2, 0, 4, @@ -425,7 +425,7 @@ namespace { 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2}; RadiotherapyData case1_beam2(11, 15, case1_beam2_matrix); - static const int case1_beam3_matrix[] = { + const int case1_beam3_matrix[] = { 2, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 1, 1, 2, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 1, 2, 2, 1, 3, 0, 0, 0, 0, 0, 0, 0, 6, 4, 1, 12, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 11, 6, 1, 9, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 2, 11, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 1, 0, 4, 0, 0, 0, 0, @@ -436,7 +436,7 @@ namespace { 0, 0, 0, 0, 0, 9, 1, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 1}; RadiotherapyData case1_beam3(15, 15, case1_beam3_matrix); - static const int case1_beam4_matrix[] = { + const int case1_beam4_matrix[] = { 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 13, 0, 4, 0, 2, 0, 6, 5, 5, 8, 9, 11, 20, 8, 9, 18, 10, 7, 0, 2, 0, 3, 10, 9, 12, 11, 15, 15, 11, 11, 16, 15, @@ -447,7 +447,7 @@ namespace { 1, 10, 12, 6, 3, 0, 2, 1, 3, 0, 0, 0, 0, 0, 0, 2, 12, 15, 3, 0, 1, 2}; RadiotherapyData case1_beam4(15, 15, case1_beam4_matrix); - static const int case1_beam5_matrix[] = { + const int case1_beam5_matrix[] = { 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 6, 4, 3, 1, 0, 0, 7, 0, 0, 0, 0, 3, 2, 0, 13, 6, 1, 1, 1, 5, 0, 2, 0, 0, 0, 0, 1, 2, 0, 2, 12, 5, 4, 2, 2, 0, 1, 20, 11, 11, 5, 0, 2, 0, 9, 12, 7, 3, 2, 7, 3, 5, @@ -456,7 +456,7 @@ namespace { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 9, 0, 3}; RadiotherapyData case1_beam5(11, 15, case1_beam5_matrix); - static const int case2_beam1_matrix[] = { + const int case2_beam1_matrix[] = { 1, 1, 1, 4, 1, 0, 1, 5, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 2, 1, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 2, 7, 2, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 12, 12, 5, 8, 5, 3, 0, 2, 1, 3, 0, 0, 0, 0, 0, 4, 20, @@ -471,7 +471,7 @@ namespace { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 2}; RadiotherapyData case2_beam1(18, 20, case2_beam1_matrix); - static const int case2_beam2_matrix[] = { + const int case2_beam2_matrix[] = { 2, 3, 2, 1, 5, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3, 3, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 3, 2, 3, 3, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 8, 5, 1, 2, 3, 1, 0, 0, 0, 0, 1, 0, 0, 5, 6, 5, 5, @@ -485,7 +485,7 @@ namespace { 0, 0, 2, 2, 2, 0, 0, 0, 18, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2}; RadiotherapyData case2_beam2(17, 19, case2_beam2_matrix); - static const int case2_beam3_matrix[] = { + const int case2_beam3_matrix[] = { 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 4, 3, 2, 6, 2, 2, 1, 0, 0, 0, 0, 0, 0, 4, 2, 10, 11, 12, 7, 7, 4, 0, 4, 1, 2, 0, 0, 0, 0, 0, 0, 4, 6, @@ -500,7 +500,7 @@ namespace { 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}; RadiotherapyData case2_beam3(18, 18, case2_beam3_matrix); - static const int case2_beam4_matrix[] = { + const int case2_beam4_matrix[] = { 3, 0, 5, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 2, 2, 0, 0, 5, 2, 2, 0, 7, 3, 3, 0, 0, 0, 0, 0, 0, 3, 1, 2, 0, 0, 0, 4, 3, 0, 8, 11, 9, 4, 0, 2, 0, 0, 0, 0, 4, 1, 0, 0, 9, 5, 5, 2, 12, 13, 10, 7, 3, 1, 4, 0, 0, 0, 0, 3, 0, 16, 9, 4, 10, 7, 15, 16, 8, @@ -515,7 +515,7 @@ namespace { 0, 0, 0, 0, 0, 0, 4, 2, 2, 3, 3, 5, 0, 3, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 3}; RadiotherapyData case2_beam4(18, 18, case2_beam4_matrix); - static const int case2_beam5_matrix[] = { + const int case2_beam5_matrix[] = { 0, 0, 0, 15, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 2, 10, 16, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 0, 0, 6, 9, 15, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 3, 2, 4, 9, 12, 15, 3, 4, 0, 3, 0, 2, 17, 13, 0, 0, 0, 2, 3, 0, 5, 12, 14, 17, 5, 2, 0, 0, 8, 17, 16, @@ -529,7 +529,7 @@ namespace { 0, 0, 0, 0, 0, 0, 0, 3, 1, 2, 1, 4, 8, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}; RadiotherapyData case2_beam5(17, 18, case2_beam5_matrix); - static const int case3_beam1_matrix[] = { + const int case3_beam1_matrix[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 13, 8, 8, 1, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 11, 9, 5, 5, 4, 5, 0, 2, 0, 1, 0, 0, 0, 0, 0, 8, 13, 9, 6, 4, 4, 4, 8, 0, 2, 0, 0, 2, 17, 10, 13, 14, 10, 8, 7, 6, 4, 4, 5, 8, 0, 2, 0, 0, 12, @@ -545,7 +545,7 @@ namespace { 6, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}; RadiotherapyData case3_beam1(22, 17, case3_beam1_matrix); - static const int case3_beam2_matrix[] = { + const int case3_beam2_matrix[] = { 0, 0, 1, 1, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 1, 4, 5, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 2, 2, 1, 1, 0, 0, 1, 4, 7, 11, 9, 0, 0, 0, 2, 0, 0, 0, 3, 2, 2, 0, 2, 4, 1, 4, 7, 11, 10, 20, 1, 0, 0, 3, 0, 2, 0, 2, 2, 2, 1, 7, 8, 5, @@ -558,7 +558,7 @@ namespace { 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; RadiotherapyData case3_beam2(15, 19, case3_beam2_matrix); - static const int case3_beam3_matrix[] = { + const int case3_beam3_matrix[] = { 0, 0, 0, 0, 0, 0, 0, 0, 15, 8, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 10, 7, 10, 7, 18, 0, 0, 0, 0, 0, 3, 5, 5, 3, 0, 7, 8, 12, 9, 12, 11, 20, 0, 0, 0, 0, 0, 0, 0, 4, 5, 2, 6, 5, 12, 9, 12, 12, 14, 3, 0, 1, 0, 0, 0, 0, 7, 2, 4, 7, 9, 11, 9, 10, 10, 7, @@ -574,7 +574,7 @@ namespace { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0}; RadiotherapyData case3_beam3(20, 17, case3_beam3_matrix); - static const int case3_beam4_matrix[] = { + const int case3_beam4_matrix[] = { 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 12, 0, 3, 0, 2, 0, 0, 0, 0, 0, 2, 0, 10, 9, 20, 0, 0, 15, 0, 3, 0, 0, 0, 0, 14, 0, 0, 0, 3, 7, 11, 16, 16, 6, @@ -589,7 +589,7 @@ namespace { 6, 5, 11, 9, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 10, 13, 13, 0, 0, 0, 0}; RadiotherapyData case3_beam4(19, 17, case3_beam4_matrix); - static const int case3_beam5_matrix[] = { + const int case3_beam5_matrix[] = { 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 15, 0, 0, 0, @@ -602,7 +602,7 @@ namespace { 0, 0, 0, 0, 0, 0, 1, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; RadiotherapyData case3_beam5(15, 19, case3_beam5_matrix); - static const int case4_beam1_matrix[] = { + const int case4_beam1_matrix[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 5, 8, 10, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 2, 9, 2, 0, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 10, 17, 12, 0, 7, 5, 0, 0, 1, 6, 7, 4, 4, 3, 1, 2, 0, @@ -619,7 +619,7 @@ namespace { 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 0, 0, 0}; RadiotherapyData case4_beam1(19, 22, case4_beam1_matrix); - static const int case4_beam2_matrix[] = { + const int case4_beam2_matrix[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 3, 2, 9, 17, 10, 11, 6, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 7, 6, 0, 0, 0, 0, 1, 2, 7, 14, 16, 14, 16, 7, 5, 5, 0, 4, 0, 0, 0, 0, 0, 0, @@ -634,7 +634,7 @@ namespace { 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 3, 0, 0}; RadiotherapyData case4_beam2(13, 24, case4_beam2_matrix); - static const int case4_beam3_matrix[] = { + const int case4_beam3_matrix[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 5, 4, 3, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, @@ -650,7 +650,7 @@ namespace { 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}; RadiotherapyData case4_beam3(18, 23, case4_beam3_matrix); - static const int case4_beam4_matrix[] = { + const int case4_beam4_matrix[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 7, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 6, 0, 5, 0, 3, 1, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 7, 8, 10, 0, 2, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 8, @@ -667,7 +667,7 @@ namespace { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 7, 0, 0, 0, 0, 0, 0, 0}; RadiotherapyData case4_beam4(17, 23, case4_beam4_matrix); - static const int case4_beam5_matrix[] = { + const int case4_beam5_matrix[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 3, 0, 0, 0, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 6, 0, 0, 0, 6, 2, 10, 0, 3, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, @@ -681,7 +681,7 @@ namespace { 0, 0, 0, 0, 0, 0, 0, 2, 0, 6, 4, 0, 0, 0, 0, 4, 0, 0}; RadiotherapyData case4_beam5(12, 24, case4_beam5_matrix); - static const int case5_beam1_matrix[] = { + const int case5_beam1_matrix[] = { 1, 2, 1, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 11, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 1, 9, 8, 1, 8, 4, 5, 0, 1, 2, 0, 0, 5, 0, 4, 4, 1, 7, 4, 5, 5, 5, 4, 0, 0, 1, 0, 8, 2, 2, 1, 1, 0, 0, 0, 0, 2, 5, 1, 1, 0, 0, 2, 2, 4, 4, 4, 2, 0, 0, 0, 0, 0, 6, 3, 1, 0, 1, 3, 2, 3, 5, 4, 1, 2, @@ -691,7 +691,7 @@ namespace { 0, 0, 0, 0, 0, 0, 0, 0, 20, 6, 0, 2, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}; RadiotherapyData case5_beam1(15, 16, case5_beam1_matrix); - static const int case5_beam2_matrix[] = { + const int case5_beam2_matrix[] = { 2, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 1, 2, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 3, 4, 0, 0, 0, 0, 5, 5, 5, 0, 0, 5, 0, 1, 0, 1, 2, 2, 4, 0, 0, 0, 0, 0, 2, 2, 3, 0, 3, 0, 1, 5, 0, 2, 2, 2, 0, 0, 0, 0, 0, 0, 8, 4, 0, 2, 2, 3, 8, 0, 3, 1, 1, 0, 0, 0, 3, 1, 2, 13, 14, @@ -701,7 +701,7 @@ namespace { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2}; RadiotherapyData case5_beam2(13, 17, case5_beam2_matrix); - static const int case5_beam3_matrix[] = { + const int case5_beam3_matrix[] = { 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5, 4, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 10, 11, 5, 10, 3, 4, 1, 1, 2, 1, 2, 0, 0, 0, 3, 0, 0, 11, 5, 4, 0, 2, 0, 2, 1, 0, 9, 0, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 3, 3, 0, @@ -712,7 +712,7 @@ namespace { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 2, 1, 2}; RadiotherapyData case5_beam3(14, 16, case5_beam3_matrix); - static const int case5_beam4_matrix[] = { + const int case5_beam4_matrix[] = { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 11, 5, 3, 3, 12, 10, 20, 1, 0, 4, 6, 2, 6, 0, 1, 0, 9, 7, 7, 10, 11, 8, 8, 18, 12, 8, 6, 4, 8, 0, 0, 0, 9, 10, 9, 10, 12, 7, 9, 7, 6, 9, 5, 5, 6, 0, 0, 0, 0, 6, 11, 7, 8, 7, 4, 10, 6, 9, 1, 0, 5, 1, @@ -722,7 +722,7 @@ namespace { 1, 1, 1, 0, 0, 0, 0, 0, 3, 0, 0, 6, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 10, 1, 1, 0, 1}; RadiotherapyData case5_beam4(14, 16, case5_beam4_matrix); - static const int case5_beam5_matrix[] = { + const int case5_beam5_matrix[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 7, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 9, 12, 3, 0, 1, 0, 0, 10, 0, 0, 0, 0, 0, 0, 1, 3, 0, 10, 11, 11, 1, 9, 3, 5, 0, 6, 3, 14, 12, 0, 0, 3, 2, 0, 5, 7, 12, diff --git a/examples/sat.cpp b/examples/sat.cpp index adcd2a3fa7..5acc11b8db 100644 --- a/examples/sat.cpp +++ b/examples/sat.cpp @@ -128,7 +128,7 @@ class Sat : public Script { /// Perform copying during cloning Space* - copy(void) override { + copy() override { return new Sat(*this); } diff --git a/examples/schurs-lemma.cpp b/examples/schurs-lemma.cpp index 0a6a3cff02..68d486966b 100644 --- a/examples/schurs-lemma.cpp +++ b/examples/schurs-lemma.cpp @@ -56,7 +56,7 @@ class SchurOptions : public Options { } /// Print help message void - help(void) override { + help() override { Options::help(); std::cerr << "\t(unsigned int) default: " << c << '\n' << "\t\tparameter c (number of boxes)" << '\n' @@ -111,7 +111,7 @@ class Schur : public Script { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new Schur(*this); } }; diff --git a/examples/scowl.hpp b/examples/scowl.hpp index 00d631d6e2..e7bbef2806 100644 --- a/examples/scowl.hpp +++ b/examples/scowl.hpp @@ -27,6 +27,7 @@ * */ +#include #include #include #include @@ -42,7 +43,7 @@ class FileSizeOptions : public Gecode::SizeOptions { /// Initialize with name \a s FileSizeOptions(const char* s); /// Return file name (nullptr if none given) - const char* file(void) const; + const char* file() const; }; /// A simple dictionary class @@ -63,7 +64,7 @@ class Dictionary { public: /// Initialize as empty dictionary - Dictionary(void); + Dictionary(); /** * \brief Perform actual initialization * @@ -72,9 +73,9 @@ class Dictionary { */ void init(const char* fn); /// Return maximal length of a word - int len(void) const; + int len() const; /// Return total number of words - int words(void) const; + int words() const; /// Return number of words with length \a l int words(int l) const; /// Return word number \a i with length \a l @@ -83,7 +84,7 @@ class Dictionary { template std::basic_ostream& print(std::basic_ostream& os) const; /// Destructor - ~Dictionary(void); + ~Dictionary(); }; /// Print statistics summary @@ -91,8 +92,9 @@ template std::basic_ostream& operator<<(std::basic_ostream& os, const Dictionary& d); /// The dictionary to be used -Dictionary dict; +inline Dictionary dict; +// NOLINTNEXTLINE(misc-anonymous-namespace-in-header): included by one example each namespace { /* @@ -7744,11 +7746,11 @@ inline FileSizeOptions::FileSizeOptions(const char* s) add(_file); } inline const char* -FileSizeOptions::file(void) const { +FileSizeOptions::file() const { return _file.value(); } -inline Dictionary::Dictionary(void) : max_len(0), n_all_words(0), chunk(nullptr) { +inline Dictionary::Dictionary() : max_len(0), n_all_words(0), chunk(nullptr) { for (int i = 0; i < max_len; i++) { n_words[i] = 0; s_words[i] = nullptr; @@ -7811,8 +7813,7 @@ Dictionary::init(const char* fn) { n_all_words++; n_words[n]++; sz += n + 1; - if (max_len < n) - max_len = n; + max_len = std::max(max_len, n); } skip1:; } @@ -7872,11 +7873,11 @@ Dictionary::init(const char* fn) { } inline int -Dictionary::len(void) const { +Dictionary::len() const { return max_len; } inline int -Dictionary::words(void) const { +Dictionary::words() const { return n_all_words; } inline int @@ -7901,7 +7902,7 @@ operator<<(std::basic_ostream& os, const Dictionary& d) { return d.print(os); } -inline Dictionary::~Dictionary(void) { +inline Dictionary::~Dictionary() { if (chunk != nullptr) Gecode::heap.rfree(chunk); } diff --git a/examples/sports-league.cpp b/examples/sports-league.cpp index 3f125a2f5b..a9a3f52cb9 100644 --- a/examples/sports-league.cpp +++ b/examples/sports-league.cpp @@ -50,7 +50,7 @@ class Play { int a; ///< away team int g; ///< game number /// Default constructor - Play(void) : h(0), a(0), g(0) {} + Play() : h(0), a(0), g(0) {} }; /// Round robin schedule @@ -62,12 +62,12 @@ class RRS { Play* plays; /// Return number of weeks int - weeks(void) const { + weeks() const { return teams - 1; } /// Return number of periods int - periods(void) const { + periods() const { return teams / 2; } /// Game number for game between home team \a h and away team \a a @@ -152,7 +152,7 @@ class RRS { } } /// Delete schedule - ~RRS(void) { + ~RRS() { delete[] plays; } }; @@ -182,12 +182,12 @@ class SportsLeague : public Script { /// Return number of weeks int - weeks(void) const { + weeks() const { return teams - 1; } /// Return number of periods int - periods(void) const { + periods() const { return teams / 2; } /// Home team in period \a p and week \a w @@ -302,7 +302,7 @@ class SportsLeague : public Script { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new SportsLeague(*this); } /// Print solution diff --git a/examples/steel-mill.cpp b/examples/steel-mill.cpp index 2dd291947f..056d6f9846 100644 --- a/examples/steel-mill.cpp +++ b/examples/steel-mill.cpp @@ -44,7 +44,7 @@ using namespace Gecode; * */ //@{ -typedef int (*order_t)[2]; ///< Type of the order-specification +using order_t = int (*)[2]; ///< Type of the order-specification extern const int order_weight; ///< Weight-position in order-array elements extern const int order_color; ///< Color-position in order-array elements //@} @@ -85,48 +85,48 @@ class SteelMillOptions : public Options { _maxcapacity(csplib_maxcapacity), _loss(csplib_loss), _orders(&(csplib_orders[0])), _ncolors(csplib_ncolors), _norders(csplib_norders) {} /// Print help text - void help(void) override; + void help() override; /// Parse options from arguments \a argv (number is \a argc) bool parse(int& argc, char* argv[]); /// Return size unsigned int - size(void) const { + size() const { return _size; } /// Return capacities int* - capacities(void) const { + capacities() const { return _capacities; } /// Return number of capacities int - ncapacities(void) const { + ncapacities() const { return _ncapacities; } /// Return maximum of capacities int - max_capacity(void) const { + max_capacity() const { return _maxcapacity; } /// Return loss values int* - loss(void) const { + loss() const { return _loss; } /// Return orders order_t - orders(void) const { + orders() const { return _orders; } /// Return number of colors int - ncolors(void) const { + ncolors() const { return _ncolors; } /// Return number of orders int - norders(void) const { + norders() const { return _norders; } }; @@ -344,12 +344,12 @@ class SteelMill : public IntMinimizeScript { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new SteelMill(*this); } /// Return solution cost IntVar - cost(void) const override { + cost() const override { return total_cost; } @@ -361,7 +361,7 @@ class SteelMill : public IntMinimizeScript { * * \relates SteelMill */ - class SteelMillBranch : Brancher { + class SteelMillBranch : public Brancher { protected: /// Cache of first unassigned value mutable int start; @@ -446,8 +446,7 @@ class SteelMill : public IntMinimizeScript { const Choice& c = static_cast(_c); if (a) return me_failed(Int::IntView(sm.slab[c.pos]).nq(home, c.val)) ? ES_FAILED : ES_OK; - else - return me_failed(Int::IntView(sm.slab[c.pos]).eq(home, c.val)) ? ES_FAILED : ES_OK; + return me_failed(Int::IntView(sm.slab[c.pos]).eq(home, c.val)) ? ES_FAILED : ES_OK; } /// Print explanation void @@ -491,7 +490,7 @@ main(int argc, char* argv[]) { } void -SteelMillOptions::help(void) { +SteelMillOptions::help() { Options::help(); std::cerr << "\t(string), optional" << '\n' << "\t\tBenchmark to load." << '\n' diff --git a/examples/steiner.cpp b/examples/steiner.cpp index ea41ffc782..1637fa399c 100644 --- a/examples/steiner.cpp +++ b/examples/steiner.cpp @@ -138,7 +138,7 @@ class Steiner : public Script { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new Steiner(*this); } }; diff --git a/examples/sudoku-advanced.cpp b/examples/sudoku-advanced.cpp index 2e6f3e5fa5..6470c053e4 100644 --- a/examples/sudoku-advanced.cpp +++ b/examples/sudoku-advanced.cpp @@ -179,7 +179,7 @@ class SudokuInt : virtual public Sudoku { /// Perform copying during cloning Space* - copy(void) override { + copy() override { return new SudokuInt(*this); } @@ -191,8 +191,9 @@ class SudokuInt : virtual public Sudoku { if (x[i].assigned()) { print_value(os, x[i].val()); os << " "; - } else + } else { os << ". "; + } if ((i + 1) % nn == 0) os << '\n' << " "; } @@ -343,7 +344,7 @@ class SudokuSet : virtual public Sudoku { /// Perform copying during cloning Space* - copy(void) override { + copy() override { return new SudokuSet(*this); } @@ -402,7 +403,7 @@ class SudokuMixed : public SudokuInt, public SudokuSet { /// Perform copying during cloning Space* - copy(void) override { + copy() override { return new SudokuMixed(*this); } diff --git a/examples/sudoku-instances.hh b/examples/sudoku-instances.hh index 950554c381..dc50439218 100644 --- a/examples/sudoku-instances.hh +++ b/examples/sudoku-instances.hh @@ -34,6 +34,7 @@ * */ +// NOLINTNEXTLINE(misc-anonymous-namespace-in-header): included by one example namespace { extern const char* examples[]; extern const unsigned int n_examples; @@ -1785,8 +1786,7 @@ namespace { int res = (c - 'A') + 10; if (res > n) return 0; - else - return res; + return res; } //@} @@ -1852,7 +1852,7 @@ instances { } /// Whether an instance was found bool - valid(void) const { + valid() const { return nn > 0; } }; diff --git a/examples/sudoku.cpp b/examples/sudoku.cpp index 457d003020..a72a872020 100644 --- a/examples/sudoku.cpp +++ b/examples/sudoku.cpp @@ -102,7 +102,7 @@ class Sudoku : public Script { /// Perform copying during cloning Space* - copy(void) override { + copy() override { return new Sudoku(*this); } @@ -114,8 +114,9 @@ class Sudoku : public Script { if (x[i].assigned()) { print_value(os, x[i].val()); os << " "; - } else + } else { os << ". "; + } if ((i + 1) % nn == 0) os << '\n' << " "; } diff --git a/examples/tsp.cpp b/examples/tsp.cpp index 559001cc5b..be7a8b679f 100644 --- a/examples/tsp.cpp +++ b/examples/tsp.cpp @@ -140,32 +140,32 @@ namespace { const int* _d; ///< Distances public: /// Initialize as invalid problem instance - Problem(void); + Problem(); /// Initialize problem instance - Problem(const int n, const int* d); + Problem(int n, const int* d); /// Initialize problem instance with distances \a d read from a file - Problem(const int n, const IntArgs& d); + Problem(int n, const IntArgs& d); /// Whether the problem instance is valid - bool valid(void) const; + bool valid() const; /// Return size of instance - int size(void) const; + int size() const; /// Return distance between node \a i and \a j int d(int i, int j) const; /// Return distances - const int* d(void) const; + const int* d() const; /// Return estimate for maximal cost of a path - int max(void) const; + int max() const; }; - inline Problem::Problem(void) : _n(0), _d(nullptr) {} + inline Problem::Problem() : _n(0), _d(nullptr) {} inline Problem::Problem(const int n, const int* d) : _n(n), _d(d) {} inline Problem::Problem(const int n, const IntArgs& d) : _n(n), _s(d), _d(&_s[0]) {} inline bool - Problem::valid(void) const { + Problem::valid() const { return _n > 0; } inline int - Problem::size(void) const { + Problem::size() const { return _n; } inline int @@ -173,11 +173,11 @@ namespace { return _d[i * _n + j]; } inline const int* - Problem::d(void) const { + Problem::d() const { return _d; } inline int - Problem::max(void) const { + Problem::max() const { int m = 0; for (int i = 0; i < _n * _n; i++) m = std::max(m, _d[i]); @@ -242,7 +242,7 @@ if edge_weight_type == "EXPLICIT" { /// Nearest integer as in the TSPLIB documentation long long int nint(double x) { - return static_cast(x + 0.5); + return std::llround(x); } /// Latitude or longitude in radians of TSPLIB GEO coordinate \a x @@ -382,7 +382,7 @@ class TSP : public IntMinimizeScript { } /// Return solution cost IntVar - cost(void) const override { + cost() const override { return total; } /// Constructor for cloning \a s @@ -392,15 +392,15 @@ class TSP : public IntMinimizeScript { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new TSP(*this); } /// Print solution void print(std::ostream& os) const override { bool assigned = true; - for (int i = 0; i < succ.size(); i++) { - if (!succ[i].assigned()) { + for (auto s : succ) { + if (!s.assigned()) { assigned = false; break; } diff --git a/examples/tsptw.cpp b/examples/tsptw.cpp index 8a0436332e..40e26442e9 100644 --- a/examples/tsptw.cpp +++ b/examples/tsptw.cpp @@ -158,7 +158,7 @@ check nodes[0].ready == 0 "the depot (node 0) must open at time 0" } /// Whether an instance was found bool - valid(void) const { + valid() const { return n > 0; } }; @@ -252,12 +252,12 @@ class TSPTW : public IntMinimizeScript { } /// Return cost IntVar - cost(void) const override { + cost() const override { return total; } /// Return the number of positions assigned from the start int - prefix(void) const { + prefix() const { int k = 0; while ((k < x.size()) && x[k].assigned()) k++; @@ -299,7 +299,7 @@ class TSPTW : public IntMinimizeScript { } /// Return a key for dominance std::size_t - key(void) const { + key() const { int k = prefix(); Region r; unsigned int n = static_cast(p.n); @@ -322,15 +322,15 @@ class TSPTW : public IntMinimizeScript { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new TSPTW(*this); } /// Print solution void print(std::ostream& os) const override { os << "\tTour: 0"; - for (int i = 0; i < x.size(); i++) - os << " -> " << x[i]; + for (auto xi : x) + os << " -> " << xi; os << " -> 0" << '\n' << "\tTravel time: " << total << '\n'; } }; diff --git a/examples/warehouses.cpp b/examples/warehouses.cpp index 009d19fe18..6ad52ce074 100644 --- a/examples/warehouses.cpp +++ b/examples/warehouses.cpp @@ -145,7 +145,7 @@ class SumCostWarehouses : public Warehouses { } /// Return solution cost IntVar - cost(void) const override { + cost() const override { return c_total; } /// Constructor for cloning \a s @@ -154,7 +154,7 @@ class SumCostWarehouses : public Warehouses { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new SumCostWarehouses(*this); } /// Print solution @@ -185,7 +185,7 @@ class LexCostWarehouses : public Warehouses { } /// Return solution cost IntVarArgs - cost(void) const override { + cost() const override { return {c_open, c_stores}; } /// Constructor for cloning \a s @@ -195,7 +195,7 @@ class LexCostWarehouses : public Warehouses { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new LexCostWarehouses(*this); } /// Print solution diff --git a/examples/word-square.cpp b/examples/word-square.cpp index 92053ac6c0..0eaced9b33 100644 --- a/examples/word-square.cpp +++ b/examples/word-square.cpp @@ -116,7 +116,7 @@ class WordSquare : public Script { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new WordSquare(*this); } /// Print solution diff --git a/gecode/driver.hh b/gecode/driver.hh index 7e9774187f..d3cd2e0374 100644 --- a/gecode/driver.hh +++ b/gecode/driver.hh @@ -130,9 +130,9 @@ namespace Gecode { /// Parse option at first position and return number of parsed arguments virtual int parse(int argc, char* argv[]) = 0; /// Print help text - virtual void help(void) = 0; + virtual void help() = 0; /// Destructor - virtual ~BaseOption(void); + virtual ~BaseOption(); /// Create heap-allocated copy of string \a s static char* strdup(const char* s); /// Create heap-allocated copy of string \a s with hyphen added @@ -151,9 +151,9 @@ namespace Gecode { RandomOption(const char* o, const char* e, uint64_t v); void value(uint64_t v); /// Construct an independent generator at the configured initial state. - Rnd rnd(void) const; + Rnd rnd() const; int parse(int argc, char* argv[]) override; - void help(void) override; + void help() override; }; /** @@ -169,13 +169,13 @@ namespace Gecode { /// Set default value to \a v void value(const char* v); /// Return current option value - const char* value(void) const; + const char* value() const; /// Parse option at first position and return number of parsed arguments int parse(int argc, char* argv[]) override; /// Print help text - void help(void) override; + void help() override; /// Destructor - ~StringValueOption(void) override; + ~StringValueOption() override; }; /** @@ -214,15 +214,15 @@ namespace Gecode { /// Set default value to \a v void value(int v); /// Return current option value - int value(void) const; + int value() const; /// Add option value for value \a v, string \a o, and help text \a h void add(int v, const char* o, const char* h = nullptr); /// Parse option at first position and return number of parsed arguments int parse(int argc, char* argv[]) override; /// Print help text - void help(void) override; + void help() override; /// Destructor - ~StringOption(void) override; + ~StringOption() override; }; /** @@ -238,11 +238,11 @@ namespace Gecode { /// Set default value to \a v void value(int v); /// Return current option value - int value(void) const; + int value() const; /// Parse option at first position and return number of parsed arguments int parse(int argc, char* argv[]) override; /// Print help text - void help(void) override; + void help() override; }; /** @@ -258,11 +258,11 @@ namespace Gecode { /// Set default value to \a v void value(unsigned int v); /// Return current option value - unsigned int value(void) const; + unsigned int value() const; /// Parse option at first position and return number of parsed arguments int parse(int argc, char* argv[]) override; /// Print help text - void help(void) override; + void help() override; }; /** @@ -278,11 +278,11 @@ namespace Gecode { /// Set default value to \a v void value(unsigned long long int v); /// Return current option value - unsigned long long int value(void) const; + unsigned long long int value() const; /// Parse option at first position and return number of parsed arguments int parse(int argc, char* argv[]) override; /// Print help text - void help(void) override; + void help() override; }; /** @@ -298,11 +298,11 @@ namespace Gecode { /// Set default value to \a v void value(double v); /// Return current option value - double value(void) const; + double value() const; /// Parse option at first position and return number of parsed arguments int parse(int argc, char* argv[]) override; /// Print help text - void help(void) override; + void help() override; }; /** @@ -318,11 +318,11 @@ namespace Gecode { /// Set default value to \a v void value(bool v); /// Return current option value - bool value(void) const; + bool value() const; /// Parse option at first position and return number of parsed arguments int parse(int argc, char* argv[]) override; /// Print help text - void help(void) override; + void help() override; }; /** @@ -338,11 +338,11 @@ namespace Gecode { /// Set default level to \a l void value(IntPropLevel l); /// Return current option value - IntPropLevel value(void) const; + IntPropLevel value() const; /// Parse option at first position and return number of parsed arguments int parse(int argc, char* argv[]) override; /// Print help text - void help(void) override; + void help() override; }; /** @@ -358,11 +358,11 @@ namespace Gecode { /// Set default trace flags to \a f void value(int f); /// Return current option value - int value(void) const; + int value() const; /// Parse option at first position and return number of parsed arguments int parse(int argc, char* argv[]) override; /// Print help text - void help(void) override; + void help() override; }; /** @@ -374,20 +374,20 @@ namespace Gecode { unsigned int cur_port; ///< Current port int cur_execution_id; ///< Current execution ID public: - /// Initialize for option \a o and explanation \a e and default value \a v - ProfilerOption(const char* o, const char* e, unsigned int p = 0, int v = -1); + /// Initialize for option \a o and explanation \a e and default value \a i + ProfilerOption(const char* o, const char* e, unsigned int p = 0, int i = -1); /// Set default port to \a p void port(unsigned int p); /// Return current port - unsigned int port(void) const; + unsigned int port() const; /// Set default execution ID to \a i void execution_id(int i); /// Return current execution ID - int execution_id(void) const; + int execution_id() const; /// Parse option at first position and return number of parsed arguments int parse(int argc, char* argv[]) override; /// Print help text - void help(void) override; + void help() override; }; } // namespace Driver @@ -404,7 +404,7 @@ namespace Gecode { /// Initialize options for script with name \a s BaseOptions(const char* s); /// Print help text - virtual void help(void); + virtual void help(); /// Add new option \a o void add(Driver::BaseOption& o); @@ -439,12 +439,12 @@ namespace Gecode { void parse_permissive(int& argc, char* argv[]); /// Return name of script - const char* name(void) const; + const char* name() const; /// Set name of script void name(const char*); /// Destructor - virtual ~BaseOptions(void); + virtual ~BaseOptions(); }; /** @@ -519,48 +519,48 @@ namespace Gecode { /// Add model option value for value \a v, string \a o, and help \a h void model(int v, const char* o, const char* h = nullptr); /// Return model value - int model(void) const; + int model() const; /// Set default symmetry value void symmetry(int v); /// Add symmetry option value for value \a v, string \a o, and help \a h void symmetry(int v, const char* o, const char* h = nullptr); /// Return symmetry value - int symmetry(void) const; + int symmetry() const; /// Set default propagation value void propagation(int v); /// Add propagation option value for value \a v, string \a o, and help \a h void propagation(int v, const char* o, const char* h = nullptr); /// Return propagation value - int propagation(void) const; + int propagation() const; /// Set default integer propagation level void ipl(IntPropLevel i); /// Return integer propagation level - IntPropLevel ipl(void) const; + IntPropLevel ipl() const; /// Set default branching value void branching(int v); /// Add branching option value for value \a v, string \a o, and help \a h void branching(int v, const char* o, const char* h = nullptr); /// Return branching value - int branching(void) const; + int branching() const; /// Set default decay factor void decay(double d); /// Return decay factor - double decay(void) const; + double decay() const; /// Set default seed value void seed(uint64_t s); /// Independent generator initialized from the seed or full-state option - Rnd rnd(void) const; + Rnd rnd() const; /// Set default step value void step(double s); /// Return step value - double step(void) const; + double step() const; //@} /// \name Search options @@ -570,145 +570,145 @@ namespace Gecode { /// Add search option value for value \a v, string \a o, and help \a h void search(int v, const char* o, const char* h = nullptr); /// Return search value - int search(void) const; + int search() const; /// Set default number of solutions to search for void solutions(unsigned long long int n); /// Return number of solutions to search for - unsigned long long int solutions(void) const; + unsigned long long int solutions() const; /// Set number of parallel threads void threads(double n); /// Return number of parallel threads - double threads(void) const; + double threads() const; /// Set default copy recomputation distance void c_d(unsigned int d); /// Return copy recomputation distance - unsigned int c_d(void) const; + unsigned int c_d() const; /// Set default adaptive recomputation distance void a_d(unsigned int d); /// Return adaptive recomputation distance - unsigned int a_d(void) const; + unsigned int a_d() const; /// Set default discrepancy limit for LDS void d_l(unsigned int d); /// Return discrepancy limit for LDS - unsigned int d_l(void) const; + unsigned int d_l() const; /// Set default node cutoff void node(unsigned long long int n); /// Return node cutoff - unsigned long long int node(void) const; + unsigned long long int node() const; /// Set default failure cutoff void fail(unsigned long long int n); /// Return failure cutoff - unsigned long long int fail(void) const; + unsigned long long int fail() const; /// Set default time cutoff void time(double t); /// Return time cutoff - double time(void) const; + double time() const; /// Set default number of assets in a portfolio void assets(unsigned int n); /// Return slice size in a portfolio - unsigned int assets(void) const; + unsigned int assets() const; /// Set default slice size in a portfolio void slice(unsigned int n); /// Return slice size in a portfolio - unsigned int slice(void) const; + unsigned int slice() const; /// Set default restart mode void restart(RestartMode r); /// Return restart mode - RestartMode restart(void) const; + RestartMode restart() const; /// Set default restart base - void restart_base(double base); + void restart_base(double n); /// Return restart base - double restart_base(void) const; + double restart_base() const; /// Set default restart scale factor - void restart_scale(unsigned int scale); + void restart_scale(unsigned int n); /// Return restart scale factor - unsigned int restart_scale(void) const; + unsigned int restart_scale() const; /// Set default restart cutoff void restart_limit(unsigned long long int n); /// Return restart cutoff - unsigned long long int restart_limit(void) const; + unsigned long long int restart_limit() const; /// Set default nogoods posting behavior void nogoods(bool b); /// Return whether nogoods are used - bool nogoods(void) const; + bool nogoods() const; /// Set default nogoods depth limit void nogoods_limit(unsigned int l); /// Return depth limit for nogoods - unsigned int nogoods_limit(void) const; + unsigned int nogoods_limit() const; /// Set default relax probability void relax(double d); /// Return default relax probability - double relax(void) const; + double relax() const; /// Set default interrupt behavior void interrupt(bool b); /// Return interrupt behavior - bool interrupt(void) const; + bool interrupt() const; //@} /// \name Execution options //@{ /// Set default mode - void mode(ScriptMode em); + void mode(ScriptMode sm); /// Return mode - ScriptMode mode(void) const; + ScriptMode mode() const; /// Set default number of samples void samples(unsigned int s); /// Return number of samples - unsigned int samples(void) const; + unsigned int samples() const; /// Set default number of iterations void iterations(unsigned int i); /// Return number of iterations - unsigned int iterations(void) const; + unsigned int iterations() const; /// Set whether to print only last solution found void print_last(bool p); /// Return whether to print only last solution found - bool print_last(void) const; + bool print_last() const; /// Set default output file name for solutions void out_file(const char* f); /// Get file name for solutions - const char* out_file(void) const; + const char* out_file() const; /// Set default output file name for Gecode stats void log_file(const char* f); /// Get file name for Gecode stats - const char* log_file(void) const; + const char* log_file() const; /// Set trace flags void trace(int f); /// Return trace flags - int trace(void) const; + int trace() const; #ifdef GECODE_HAS_CPPROFILER /// Set profiler execution identifier void profiler_id(int i); /// Return profiler execution id - int profiler_id(void) const; + int profiler_id() const; /// Set profiler port void profiler_port(unsigned int p); /// Return profiler execution id - unsigned int profiler_port(void) const; + unsigned int profiler_port() const; #endif //@} @@ -718,7 +718,7 @@ namespace Gecode { /// Set guidance for heuristic search (not copied) void guidance(const Search::HeuristicGuidance* g); /// Return guidance for heuristic search - const Search::HeuristicGuidance* guidance(void) const; + const Search::HeuristicGuidance* guidance() const; //@} #endif @@ -745,7 +745,7 @@ namespace Gecode { public: /// Constructor - I_(void); + I_(); /// Add inspector that reacts on node double clicks void click(Gist::Inspector* i); /// Add inspector that reacts on each new solution that is found @@ -782,7 +782,7 @@ namespace Gecode { /// Initialize options for script with name \a s SizeOptions(const char* s); /// Print help text - void help(void) override; + void help() override; /// Parse options from arguments \a argv (number is \a argc) void parse(int& argc, char* argv[]); /** @@ -802,7 +802,7 @@ namespace Gecode { /// Set default size void size(unsigned int s); /// Return size - unsigned int size(void) const; + unsigned int size() const; }; /** @@ -845,7 +845,7 @@ namespace Gecode { Driver::StringListOption _param; ///< Parameters for the spec mutable std::unique_ptr _data; ///< Data read, or null /// Forget the data read - void forget(void) const; + void forget() const; public: /// Initialize options for script with name \a s @@ -859,7 +859,7 @@ namespace Gecode { */ InstanceOptions(const char* s, const char* spec); /// Print help text - void help(void) override; + void help() override; /// Parse options from arguments \a argv (number is \a argc) void parse(int& argc, char* argv[]); /** @@ -880,7 +880,7 @@ namespace Gecode { /// Set default instance name void instance(const char* s); /// Return instance name - const char* instance(void) const; + const char* instance() const; /** * \brief Test whether the instance is the number of a built-in instance * @@ -895,17 +895,17 @@ namespace Gecode { /// Set the reader spec for instance files void spec(const char* s); /// Return the reader spec for instance files (may be null) - const char* spec(void) const; + const char* spec() const; /// Set the file with a reader spec that replaces spec() void spec_file(const char* f); /// Return the file with a reader spec (may be null) - const char* spec_file(void) const; + const char* spec_file() const; /// Set the spec parameters (\c name=value, separated by commas) void param(const char* p); /// Return the spec parameters (may be null) - const char* param(void) const; + const char* param() const; /// Test whether the instance names a readable file - bool is_file(void) const; + bool is_file() const; /** * \brief Read the instance file * @@ -913,16 +913,16 @@ namespace Gecode { * Instance::Error if there is no spec, if the file cannot be read, or * if it does not match the spec. */ - Instance::Data data(void) const; + Instance::Data data() const; /// Destructor - ~InstanceOptions(void) override; + ~InstanceOptions() override; }; } // namespace Gecode #include -namespace Gecode { namespace Driver { +namespace Gecode::Driver { /** * \brief Parametric base-class for scripts @@ -987,7 +987,7 @@ namespace Gecode { namespace Driver { IgnoreStepOption(BaseSpace& e) : BaseSpace(e) {} }; -}} // namespace Gecode::Driver +} // namespace Gecode::Driver #include @@ -1002,29 +1002,29 @@ namespace Gecode { * \brief Base-class for scripts * \ingroup TaskDriverScript */ - typedef Driver::ScriptBase> Script; + using Script = Driver::ScriptBase>; /** * \brief Base-class for scripts for finding solution of lowest integer cost * \ingroup TaskDriverScript */ - typedef Driver::ScriptBase> IntMinimizeScript; + using IntMinimizeScript = Driver::ScriptBase>; /** * \brief Base-class for scripts for finding solution of highest integer cost * \ingroup TaskDriverScript */ - typedef Driver::ScriptBase> IntMaximizeScript; + using IntMaximizeScript = Driver::ScriptBase>; /** * \brief Base-class for scripts for finding solution of lexically lowest integer costs * \ingroup TaskDriverScript */ - typedef Driver::ScriptBase> IntLexMinimizeScript; + using IntLexMinimizeScript = Driver::ScriptBase>; /** * \brief Base-class for scripts for finding solution of lexically highest integer costs * \ingroup TaskDriverScript */ - typedef Driver::ScriptBase> IntLexMaximizeScript; + using IntLexMaximizeScript = Driver::ScriptBase>; #ifdef GECODE_HAS_FLOAT_VARS @@ -1032,12 +1032,12 @@ namespace Gecode { * \brief Base-class for scripts for finding solution of lowest float cost * \ingroup TaskDriverScript */ - typedef Driver::ScriptBase> FloatMinimizeScript; + using FloatMinimizeScript = Driver::ScriptBase>; /** * \brief Base-class for scripts for finding solution of highest float cost * \ingroup TaskDriverScript */ - typedef Driver::ScriptBase> FloatMaximizeScript; + using FloatMaximizeScript = Driver::ScriptBase>; #endif diff --git a/gecode/driver/options.cpp b/gecode/driver/options.cpp index 0e05adf8d3..c9f8c44746 100644 --- a/gecode/driver/options.cpp +++ b/gecode/driver/options.cpp @@ -91,7 +91,7 @@ namespace Gecode { } else { return nullptr; } - if (strcmp(s, eopt)) + if (strcmp(s, eopt) != 0) return nullptr; if (argc == 2) { std::cerr << "Missing argument for option \"" << iopt << "\"" << '\n' << std::flush; @@ -103,7 +103,7 @@ namespace Gecode { BaseOption::BaseOption(const char* o, const char* e) : eopt(strdup(o)), iopt(duplicate_option_flag(o)), exp(strdup(e)) {} - BaseOption::~BaseOption(void) { + BaseOption::~BaseOption() { strdel(eopt); strdel(iopt); strdel(exp); @@ -118,7 +118,7 @@ namespace Gecode { seed_given = state_given = false; } Rnd - RandomOption::rnd(void) const { + RandomOption::rnd() const { return initial; } int @@ -161,7 +161,7 @@ namespace Gecode { return 2; } void - RandomOption::help(void) { + RandomOption::help() { std::cerr << "\t" << iopt << " (64-bit decimal/hex seed, time, hw)\n" << "\t\t" << exp << "\n" << "\t-state (complete " << Support::RandomGenerator::name() << " state; mutually exclusive with " @@ -186,12 +186,12 @@ namespace Gecode { return 0; } void - StringValueOption::help(void) { + StringValueOption::help() { std::cerr << '\t' << iopt << " (string) default: " << ((cur == nullptr) ? "NONE" : cur) << '\n' << "\t\t" << exp << '\n' << std::flush; } - StringValueOption::~StringValueOption(void) { + StringValueOption::~StringValueOption() { strdel(cur); } @@ -239,7 +239,7 @@ namespace Gecode { return 0; } void - StringOption::help(void) { + StringOption::help() { if (fst == nullptr) return; std::cerr << '\t' << iopt << " ("; @@ -258,7 +258,7 @@ namespace Gecode { std::cerr << "\t\t " << v->opt << ": " << v->help << '\n' << std::flush; } - StringOption::~StringOption(void) { + StringOption::~StringOption() { Value* v = fst; while (v != nullptr) { strdel(v->opt); @@ -279,7 +279,7 @@ namespace Gecode { } void - IntOption::help(void) { + IntOption::help() { std::cerr << '\t' << iopt << " (int) default: " << cur << '\n' << "\t\t" << exp << '\n' << std::flush; } @@ -293,7 +293,7 @@ namespace Gecode { } void - UnsignedIntOption::help(void) { + UnsignedIntOption::help() { std::cerr << '\t' << iopt << " (unsigned int) default: " << cur << '\n' << "\t\t" << exp << '\n' << std::flush; @@ -309,7 +309,7 @@ namespace Gecode { } void - UnsignedLongLongIntOption::help(void) { + UnsignedLongLongIntOption::help() { std::cerr << '\t' << iopt << " (unsigned long long int) default: " << cur << '\n' << "\t\t" << exp << '\n' << std::flush; @@ -325,7 +325,7 @@ namespace Gecode { } void - DoubleOption::help(void) { + DoubleOption::help() { using namespace std; cerr << '\t' << iopt << " (double) default: " << cur << '\n' << "\t\t" << exp << '\n' << std::flush; } @@ -342,28 +342,29 @@ namespace Gecode { } else { return 0; } - if (strcmp(s, eopt)) + if (strcmp(s, eopt) != 0) return 0; if (argc == 2) { // Option without argument cur = true; return 1; - } else if (!strcmp(argv[2], "true") || !strcmp(argv[2], "1")) { + } + if (!strcmp(argv[2], "true") || !strcmp(argv[2], "1")) { cur = true; return 2; - } else if (!strcmp(argv[2], "false") || !strcmp(argv[2], "0")) { + } + if (!strcmp(argv[2], "false") || !strcmp(argv[2], "0")) { cur = false; return 2; - } else { - // Option without argument - cur = true; - return 1; - } + } // Option without argument + cur = true; + return 1; + return 0; } void - BoolOption::help(void) { + BoolOption::help() { using namespace std; cerr << '\t' << iopt << " (optional: false, 0, true, 1) default: " << (cur ? "true" : "false") << '\n' << "\t\t" << exp << '\n' @@ -422,7 +423,7 @@ namespace Gecode { } void - IplOption::help(void) { + IplOption::help() { using namespace std; cerr << '\t' << iopt << " (def,val,bnd,dom,basic,advanced,full)" << '\n' << "\t\tdefault: "; switch (vbd(cur)) { @@ -441,9 +442,9 @@ namespace Gecode { default: GECODE_NEVER; } - if ((cur & IPL_FULL) == IPL_FULL) + if ((cur & IPL_FULL) == IPL_FULL) { cerr << ",full"; - else { + } else { if ((cur & IPL_BASIC) != IPL_DEF) cerr << ",basic"; if ((cur & IPL_ADVANCED) != IPL_DEF) @@ -511,7 +512,7 @@ namespace Gecode { } void - TraceOption::help(void) { + TraceOption::help() { using namespace std; cerr << '\t' << iopt << " (init,prune,fix,fail,done,propagate,commit,post,none,all,variable,general)" << " default: "; @@ -590,7 +591,7 @@ namespace Gecode { } void - ProfilerOption::help(void) { + ProfilerOption::help() { std::cerr << '\t' << iopt << " (unsigned int,int) default: " << cur_port << "," << cur_execution_id << '\n' << "\t\t" << exp << '\n' << std::flush; @@ -608,7 +609,7 @@ namespace Gecode { } lst = &o; } - BaseOptions::BaseOptions(const char* n) : fst(nullptr), lst(nullptr), _name(Driver::BaseOption::strdup(n)) {} + BaseOptions::BaseOptions(const char* s) : fst(nullptr), lst(nullptr), _name(Driver::BaseOption::strdup(s)) {} void BaseOptions::name(const char* n) { @@ -617,7 +618,7 @@ namespace Gecode { } void - BaseOptions::help(void) { + BaseOptions::help() { std::cerr << "Gecode configuration information:" << '\n' << " - Version: " << GECODE_VERSION << '\n' << " - Variable types: "; @@ -688,7 +689,6 @@ namespace Gecode { argc = c; for (int i = 1; i < argc; i++) argv[i] = v[i]; - return; } namespace { @@ -708,12 +708,12 @@ namespace Gecode { unrecognised(*this, argv[1]); } - BaseOptions::~BaseOptions(void) { + BaseOptions::~BaseOptions() { Driver::BaseOption::strdel(_name); } - Options::Options(const char* n) - : BaseOptions(n), + Options::Options(const char* s) + : BaseOptions(s), _model("model", "model variants"), _symmetry("symmetry", "symmetry variants"), _propagation("propagation", "propagation variants"), _branching("branching", "branching variants"), @@ -812,10 +812,10 @@ namespace Gecode { #endif } - SizeOptions::SizeOptions(const char* e) : Options(e), _size(0) {} + SizeOptions::SizeOptions(const char* s) : Options(s), _size(0) {} void - SizeOptions::help(void) { + SizeOptions::help() { Options::help(); std::cerr << "\t(unsigned int) default: " << size() << '\n' << "\t\twhich version/size for script" << '\n' @@ -852,19 +852,19 @@ namespace Gecode { size(static_cast(atoi(argv[1]))); } - InstanceOptions::InstanceOptions(const char* e) - : Options(e), _inst(nullptr), _spec(nullptr), + InstanceOptions::InstanceOptions(const char* s) + : Options(s), _inst(nullptr), _spec(nullptr), _spec_file("spec", "file with a reader spec for instance files (default: the script's own spec)"), _param("param", "parameter for the reader spec (name=value; repeat or separate by commas for several)") {} - InstanceOptions::InstanceOptions(const char* e, const char* s) : InstanceOptions(e) { + InstanceOptions::InstanceOptions(const char* s, const char* spec0) : InstanceOptions(s) { add(_spec_file); add(_param); - spec(s); + spec(spec0); } void - InstanceOptions::forget(void) const { + InstanceOptions::forget() const { _data.reset(); } @@ -895,7 +895,7 @@ namespace Gecode { } void - InstanceOptions::help(void) { + InstanceOptions::help() { Options::help(); std::cerr << "\t(string) default: " << ((instance() == nullptr) ? "NONE" : instance()) << '\n' << "\t\twhich instance for script (name or file)" << '\n' @@ -952,7 +952,7 @@ namespace Gecode { } bool - InstanceOptions::is_file(void) const { + InstanceOptions::is_file() const { if (instance() == nullptr) return false; // Directories can be opened on some systems, but not read @@ -963,7 +963,7 @@ namespace Gecode { } Instance::Data - InstanceOptions::data(void) const { + InstanceOptions::data() const { if (_data) return *_data; if (instance() == nullptr) @@ -982,7 +982,7 @@ namespace Gecode { return *_data; } - InstanceOptions::~InstanceOptions(void) { + InstanceOptions::~InstanceOptions() { Driver::BaseOption::strdel(_inst); Driver::BaseOption::strdel(_spec); } diff --git a/gecode/driver/options.hpp b/gecode/driver/options.hpp index 81494b30b9..cf2d01bc45 100644 --- a/gecode/driver/options.hpp +++ b/gecode/driver/options.hpp @@ -42,7 +42,7 @@ namespace Gecode { * */ inline const char* - StringValueOption::value(void) const { + StringValueOption::value() const { return cur; } @@ -57,7 +57,7 @@ namespace Gecode { cur = v; } inline int - StringOption::value(void) const { + StringOption::value() const { return cur; } @@ -71,7 +71,7 @@ namespace Gecode { cur = v; } inline int - IntOption::value(void) const { + IntOption::value() const { return cur; } @@ -86,7 +86,7 @@ namespace Gecode { cur = v; } inline unsigned int - UnsignedIntOption::value(void) const { + UnsignedIntOption::value() const { return cur; } @@ -102,7 +102,7 @@ namespace Gecode { cur = v; } inline unsigned long long int - UnsignedLongLongIntOption::value(void) const { + UnsignedLongLongIntOption::value() const { return cur; } @@ -116,7 +116,7 @@ namespace Gecode { cur = v; } inline double - DoubleOption::value(void) const { + DoubleOption::value() const { return cur; } @@ -130,7 +130,7 @@ namespace Gecode { cur = v; } inline bool - BoolOption::value(void) const { + BoolOption::value() const { return cur; } @@ -143,7 +143,7 @@ namespace Gecode { cur = ipl; } inline IntPropLevel - IplOption::value(void) const { + IplOption::value() const { return cur; } @@ -156,7 +156,7 @@ namespace Gecode { cur = f; } inline int - TraceOption::value(void) const { + TraceOption::value() const { return cur; } @@ -171,7 +171,7 @@ namespace Gecode { cur_port = p; } inline unsigned int - ProfilerOption::port(void) const { + ProfilerOption::port() const { return cur_port; } inline void @@ -179,7 +179,7 @@ namespace Gecode { cur_execution_id = i; } inline int - ProfilerOption::execution_id(void) const { + ProfilerOption::execution_id() const { return cur_execution_id; } @@ -199,7 +199,7 @@ namespace Gecode { } inline const char* - BaseOptions::name(void) const { + BaseOptions::name() const { return _name; } @@ -216,7 +216,7 @@ namespace Gecode { _model.add(v, o, h); } inline int - Options::model(void) const { + Options::model() const { return _model.value(); } @@ -229,7 +229,7 @@ namespace Gecode { _symmetry.add(v, o, h); } inline int - Options::symmetry(void) const { + Options::symmetry() const { return _symmetry.value(); } @@ -242,7 +242,7 @@ namespace Gecode { _propagation.add(v, o, h); } inline int - Options::propagation(void) const { + Options::propagation() const { return _propagation.value(); } @@ -251,7 +251,7 @@ namespace Gecode { _ipl.value(i); } inline IntPropLevel - Options::ipl(void) const { + Options::ipl() const { return _ipl.value(); } @@ -264,7 +264,7 @@ namespace Gecode { _branching.add(v, o, h); } inline int - Options::branching(void) const { + Options::branching() const { return _branching.value(); } @@ -273,7 +273,7 @@ namespace Gecode { _decay.value(d); } inline double - Options::decay(void) const { + Options::decay() const { return _decay.value(); } @@ -282,7 +282,7 @@ namespace Gecode { _seed.value(s); } inline Rnd - Options::rnd(void) const { + Options::rnd() const { return _seed.rnd(); } @@ -291,7 +291,7 @@ namespace Gecode { _step.value(s); } inline double - Options::step(void) const { + Options::step() const { return _step.value(); } @@ -308,7 +308,7 @@ namespace Gecode { _search.add(v, o, h); } inline int - Options::search(void) const { + Options::search() const { return _search.value(); } @@ -317,7 +317,7 @@ namespace Gecode { _solutions.value(n); } inline unsigned long long int - Options::solutions(void) const { + Options::solutions() const { return _solutions.value(); } @@ -326,7 +326,7 @@ namespace Gecode { _threads.value(n); } inline double - Options::threads(void) const { + Options::threads() const { return _threads.value(); } @@ -336,7 +336,7 @@ namespace Gecode { _guidance = g; } inline const Search::HeuristicGuidance* - Options::guidance(void) const { + Options::guidance() const { return _guidance; } #endif @@ -346,7 +346,7 @@ namespace Gecode { _c_d.value(d); } inline unsigned int - Options::c_d(void) const { + Options::c_d() const { return _c_d.value(); } @@ -355,7 +355,7 @@ namespace Gecode { _a_d.value(d); } inline unsigned int - Options::a_d(void) const { + Options::a_d() const { return _a_d.value(); } @@ -364,7 +364,7 @@ namespace Gecode { _d_l.value(d); } inline unsigned int - Options::d_l(void) const { + Options::d_l() const { return _d_l.value(); } @@ -373,7 +373,7 @@ namespace Gecode { _node.value(n); } inline unsigned long long int - Options::node(void) const { + Options::node() const { return _node.value(); } @@ -382,7 +382,7 @@ namespace Gecode { _fail.value(n); } inline unsigned long long int - Options::fail(void) const { + Options::fail() const { return _fail.value(); } @@ -391,7 +391,7 @@ namespace Gecode { _time.value(t); } inline double - Options::time(void) const { + Options::time() const { return _time.value(); } @@ -400,7 +400,7 @@ namespace Gecode { _assets.value(n); } inline unsigned int - Options::assets(void) const { + Options::assets() const { return _assets.value(); } @@ -409,7 +409,7 @@ namespace Gecode { _slice.value(n); } inline unsigned int - Options::slice(void) const { + Options::slice() const { return _slice.value(); } @@ -418,7 +418,7 @@ namespace Gecode { _restart.value(static_cast(rm)); } inline RestartMode - Options::restart(void) const { + Options::restart() const { return static_cast(_restart.value()); } @@ -427,7 +427,7 @@ namespace Gecode { _r_base.value(n); } inline double - Options::restart_base(void) const { + Options::restart_base() const { return _r_base.value(); } @@ -436,7 +436,7 @@ namespace Gecode { _r_scale.value(n); } inline unsigned int - Options::restart_scale(void) const { + Options::restart_scale() const { return _r_scale.value(); } @@ -445,7 +445,7 @@ namespace Gecode { _r_limit.value(n); } inline unsigned long long int - Options::restart_limit(void) const { + Options::restart_limit() const { return _r_limit.value(); } @@ -454,7 +454,7 @@ namespace Gecode { _nogoods.value(b); } inline bool - Options::nogoods(void) const { + Options::nogoods() const { return _nogoods.value(); } @@ -463,7 +463,7 @@ namespace Gecode { _nogoods_limit.value(l); } inline unsigned int - Options::nogoods_limit(void) const { + Options::nogoods_limit() const { return _nogoods_limit.value(); } @@ -472,7 +472,7 @@ namespace Gecode { _relax.value(d); } inline double - Options::relax(void) const { + Options::relax() const { return _relax.value(); } @@ -481,7 +481,7 @@ namespace Gecode { _interrupt.value(b); } inline bool - Options::interrupt(void) const { + Options::interrupt() const { return _interrupt.value(); } @@ -494,7 +494,7 @@ namespace Gecode { _mode.value(static_cast(sm)); } inline ScriptMode - Options::mode(void) const { + Options::mode() const { return static_cast(_mode.value()); } @@ -503,7 +503,7 @@ namespace Gecode { _samples.value(s); } inline unsigned int - Options::samples(void) const { + Options::samples() const { return _samples.value(); } @@ -512,7 +512,7 @@ namespace Gecode { _iterations.value(i); } inline unsigned int - Options::iterations(void) const { + Options::iterations() const { return _iterations.value(); } @@ -521,7 +521,7 @@ namespace Gecode { _print_last.value(p); } inline bool - Options::print_last(void) const { + Options::print_last() const { return _print_last.value(); } @@ -531,7 +531,7 @@ namespace Gecode { } inline const char* - Options::out_file(void) const { + Options::out_file() const { return _out_file.value(); } @@ -541,7 +541,7 @@ namespace Gecode { } inline const char* - Options::log_file(void) const { + Options::log_file() const { return _log_file.value(); } @@ -551,7 +551,7 @@ namespace Gecode { } inline int - Options::trace(void) const { + Options::trace() const { return _trace.value(); } @@ -566,7 +566,7 @@ namespace Gecode { _profiler.execution_id(i); } inline int - Options::profiler_id(void) const { + Options::profiler_id() const { return _profiler.execution_id(); } inline void @@ -574,14 +574,14 @@ namespace Gecode { _profiler.port(p); } inline unsigned int - Options::profiler_port(void) const { + Options::profiler_port() const { return _profiler.port(); } #endif #ifdef GECODE_HAS_GIST forceinline - Options::I_::I_(void) + Options::I_::I_() : _click(heap, 1), n_click(0), _solution(heap, 1), n_solution(0), _move(heap, 1), n_move(0), _compare(heap, 1), n_compare(0) {} @@ -637,7 +637,7 @@ namespace Gecode { _size = s; } inline unsigned int - SizeOptions::size(void) const { + SizeOptions::size() const { return _size; } @@ -655,22 +655,22 @@ namespace Gecode { } inline const char* - InstanceOptions::instance(void) const { + InstanceOptions::instance() const { return _inst; } inline const char* - InstanceOptions::spec(void) const { + InstanceOptions::spec() const { return _spec; } inline const char* - InstanceOptions::spec_file(void) const { + InstanceOptions::spec_file() const { return _spec_file.value(); } inline const char* - InstanceOptions::param(void) const { + InstanceOptions::param() const { return _param.value(); } } // namespace Gecode diff --git a/gecode/driver/script.cpp b/gecode/driver/script.cpp index da15dc30d3..4c44d984bd 100644 --- a/gecode/driver/script.cpp +++ b/gecode/driver/script.cpp @@ -35,7 +35,7 @@ #include -namespace Gecode { namespace Driver { +namespace Gecode::Driver { void stop(Support::Timer& timer, std::ostream& os) { @@ -68,7 +68,7 @@ namespace Gecode { namespace Driver { } double - am(double t[], unsigned int n) { + am(const double t[], unsigned int n) { if (n < 1) return 0.0; double s = 0; @@ -92,6 +92,6 @@ namespace Gecode { namespace Driver { bool CombinedStop::sigint; -}} // namespace Gecode::Driver +} // namespace Gecode::Driver // STATISTICS: driver-any diff --git a/gecode/driver/script.hpp b/gecode/driver/script.hpp index 252fd62041..35f5b0b187 100644 --- a/gecode/driver/script.hpp +++ b/gecode/driver/script.hpp @@ -40,7 +40,7 @@ #include #endif -namespace Gecode { namespace Driver { +namespace Gecode::Driver { /** * \brief Stop object based on nodes, failures, and time @@ -93,8 +93,7 @@ namespace Gecode { namespace Driver { bool intr) { if (!intr && (node == 0ULL) && (fail == 0ULL) && (time == 0.0) && (restart == 0ULL)) return nullptr; - else - return new CombinedStop(node, fail, time, restart); + return new CombinedStop(node, fail, time, restart); } #ifdef GECODE_THREADS_WINDOWS /// Handler for catching Ctrl-C @@ -122,12 +121,12 @@ namespace Gecode { namespace Driver { #ifdef GECODE_THREADS_WINDOWS SetConsoleCtrlHandler((PHANDLER_ROUTINE)interrupt, install); #else - std::signal(SIGINT, install ? interrupt : SIG_DFL); + (void)std::signal(SIGINT, install ? interrupt : SIG_DFL); #endif } } /// Destructor - ~CombinedStop(void) override { + ~CombinedStop() override { delete ns; delete fs; delete ts; @@ -144,7 +143,7 @@ namespace Gecode { namespace Driver { /** * \brief Compute arithmetic mean of \a n elements in \a t */ - GECODE_DRIVER_EXPORT double am(double t[], unsigned int n); + GECODE_DRIVER_EXPORT double am(const double t[], unsigned int n); /** * \brief Compute deviation of \a n elements in \a t @@ -225,7 +224,7 @@ namespace Gecode { namespace Driver { class ScriptGetInfo : public CPProfilerSearchTracer::GetInfo { public: /// Initialize - ScriptGetInfo(void) = default; + ScriptGetInfo() = default; /// Return info for a space (which must be a script) std::string get_info(const Space& home) const override; }; @@ -255,14 +254,15 @@ namespace Gecode { namespace Driver { ScriptBase::select_ostream(const char* sn, std::ofstream& ofs) { if (strcmp(sn, "stdout") == 0) { return std::cout; - } else if (strcmp(sn, "stdlog") == 0) { + } + if (strcmp(sn, "stdlog") == 0) { return std::clog; - } else if (strcmp(sn, "stderr") == 0) { + } + if (strcmp(sn, "stderr") == 0) { return std::cerr; - } else { - ofs.open(sn); - return ofs; } + ofs.open(sn); + return ofs; } #ifdef GECODE_HAS_CPPROFILER @@ -396,11 +396,11 @@ namespace Gecode { namespace Driver { delete px; } break; - } else { - s_n++; - delete px; - px = ex; } + s_n++; + delete px; + px = ex; + } while (s_n < s_l); } else { do { @@ -422,9 +422,9 @@ namespace Gecode { namespace Driver { } else if (e.end_reason() == Search::EndReason::Limit) { l_out << "Search engine stopped..." << '\n' << "\treason: "; int r = static_cast(so.stop)->reason(stat, so); - if (r & CombinedStop::SR_INT) + if (r & CombinedStop::SR_INT) { l_out << "user interrupt " << '\n'; - else { + } else { if (r & CombinedStop::SR_NODE) l_out << "node "; if (r & CombinedStop::SR_FAIL) @@ -586,6 +586,6 @@ namespace Gecode { namespace Driver { log_file.close(); } -}} // namespace Gecode::Driver +} // namespace Gecode::Driver // STATISTICS: driver-any diff --git a/gecode/flatzinc.hh b/gecode/flatzinc.hh index 2eca4c6977..4f8c743d06 100644 --- a/gecode/flatzinc.hh +++ b/gecode/flatzinc.hh @@ -37,6 +37,7 @@ #ifndef GECODE_FLATZINC_HH #define GECODE_FLATZINC_HH +#include #include #include @@ -90,7 +91,7 @@ * */ -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { /** * \brief Output support class for %FlatZinc interpreter @@ -134,7 +135,7 @@ namespace Gecode { namespace FlatZinc { #endif ) const; public: - Printer(void) : _output(nullptr) {} + Printer() : _output(nullptr) {} void init(AST::Array* output); void print(std::ostream& out, const Gecode::IntVarArray& iv, const Gecode::BoolVarArray& bv @@ -160,7 +161,7 @@ namespace Gecode { namespace FlatZinc { #endif ) const; - ~Printer(void); + ~Printer(); void add_int_var_name(const std::string& n); const std::string& @@ -202,7 +203,6 @@ namespace Gecode { namespace FlatZinc { #endif ); - public: Printer(const Printer&) = delete; Printer& operator=(const Printer&) = delete; }; @@ -328,7 +328,7 @@ namespace Gecode { namespace FlatZinc { } void - help(void) override { + help() override { std::cerr << "Gecode FlatZinc interpreter" << '\n' << " - FlatZinc text interface" << '\n' << '\n' @@ -337,65 +337,65 @@ namespace Gecode { namespace FlatZinc { } int - solutions(void) const { + solutions() const { return _solutions.value(); } bool - all_solutions(void) const { + all_solutions() const { return _all_solutions.value(); } double - threads(void) const { + threads() const { return _threads.value(); } bool - free(void) const { + free() const { return _free.value(); } unsigned int - c_d(void) const { + c_d() const { return _c_d.value(); } unsigned int - a_d(void) const { + a_d() const { return _a_d.value(); } unsigned long long int - node(void) const { + node() const { return _node.value(); } unsigned long long int - fail(void) const { + fail() const { return _fail.value(); } double - time(void) const { + time() const { return _time.value(); } Rnd - rnd(void) const { + rnd() const { return _seed.rnd(); } double - step(void) const { + step() const { return _step.value(); } const char* - output(void) const { + output() const { return _output.value(); } Gecode::ScriptMode - mode(void) const { + mode() const { return static_cast(_mode.value()); } double - decay(void) const { + decay() const { return _decay.value(); } RestartMode - restart(void) const { + restart() const { return static_cast(_restart.value()); } void @@ -403,7 +403,7 @@ namespace Gecode { namespace FlatZinc { _restart.value(static_cast(rm)); } double - restart_base(void) const { + restart_base() const { return _r_base.value(); } void @@ -411,7 +411,7 @@ namespace Gecode { namespace FlatZinc { _r_base.value(d); } unsigned int - restart_scale(void) const { + restart_scale() const { return _r_scale.value(); } void @@ -419,34 +419,34 @@ namespace Gecode { namespace FlatZinc { _r_scale.value(i); } unsigned long long int - restart_limit(void) const { + restart_limit() const { return _r_limit.value(); } bool - nogoods(void) const { + nogoods() const { return _nogoods.value(); } unsigned int - nogoods_limit(void) const { + nogoods_limit() const { return _nogoods_limit.value(); } bool - interrupt(void) const { + interrupt() const { return _interrupt.value(); } #ifdef GECODE_HAS_CPPROFILER int - profiler_id(void) const { + profiler_id() const { return _profiler.execution_id(); } unsigned int - profiler_port(void) const { + profiler_port() const { return _profiler.port(); } bool - profiler_info(void) const { + profiler_info() const { return true; } @@ -461,11 +461,11 @@ namespace Gecode { namespace FlatZinc { class BranchInformation : public SharedHandle { public: /// Constructor - BranchInformation(void); + BranchInformation(); /// Copy constructor BranchInformation(const BranchInformation& bi) = default; /// Initialise for use - void init(void); + void init(); /// Add new brancher information void add(BrancherGroup bg, const std::string& rel0, const std::string& rel1, const std::vector& n); /// Output branch information @@ -587,12 +587,9 @@ namespace Gecode { namespace FlatZinc { }; public: - OnRestartHandle() : SharedHandle() {} + OnRestartHandle() = default; OnRestartHandle(const OnRestartHandle& handle) = default; - OnRestartHandle& - operator=(const OnRestartHandle& handle) { - return static_cast(SharedHandle::operator=(handle)); - } + OnRestartHandle& operator=(const OnRestartHandle& handle) = default; virtual ~OnRestartHandle() = default; void @@ -659,7 +656,7 @@ namespace Gecode { namespace FlatZinc { FlatZincSpace(Rnd& random = defrnd); /// Destructor - ~FlatZincSpace(void) override; + ~FlatZincSpace() override; /// Initialize space with given number of variables void init(int int_vars, int bool_vars, int set_vars, int float_vars); @@ -724,12 +721,12 @@ namespace Gecode { namespace FlatZinc { void shrink_arrays(Printer& p); /// Return whether to solve a satisfaction or optimization problem - Meth method(void) const; + Meth method() const; /// Return index of variable used for optimization - int opt_var(void) const; + int opt_var() const; /// Return whether variable used for optimization is integer (or float) - bool opt_var_is_int(void) const; + bool opt_var_is_int() const; /** * \brief Create branchers corresponding to the solve item annotations @@ -744,7 +741,7 @@ namespace Gecode { namespace FlatZinc { std::ostream& err = std::cerr); /// Return the solve item annotations - AST::Array* solve_annotations(void) const; + AST::Array* solve_annotations() const; /// Information for printing branches BranchInformation branch_info; @@ -752,7 +749,7 @@ namespace Gecode { namespace FlatZinc { /// Implement optimization void constrain(const Space& s) override; /// Copy function - Gecode::Space* copy(void) override; + Gecode::Space* copy() override; /// Spoke hook for restarts: on_restart and LNS spokes have partial coverage void spoke(SpokeContext& sc) override; @@ -805,7 +802,7 @@ namespace Gecode { namespace FlatZinc { }; /// %Exception class for %FlatZinc errors - class GECODE_VTABLE_EXPORT Error { + class GECODE_VTABLE_EXPORT Error : public std::exception { private: const std::string msg; @@ -814,9 +811,14 @@ namespace Gecode { namespace FlatZinc { Error(const std::string& where, const std::string& what, AST::Array* const ann) : msg(make_message(where, what, ann)) {} const std::string& - to_string(void) const { + to_string() const { return msg; } + /// Return the message + const char* + what() const noexcept override { + return msg.c_str(); + } private: static std::string @@ -883,7 +885,7 @@ namespace Gecode { namespace FlatZinc { FlatZincSpace* parse(std::istream& is, Printer& p, std::ostream& err = std::cerr, FlatZincSpace* fzs = nullptr, Rnd& rnd = defrnd); -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc #endif diff --git a/gecode/flatzinc/ast.hh b/gecode/flatzinc/ast.hh index 7cd63ee311..e417b4bc4b 100644 --- a/gecode/flatzinc/ast.hh +++ b/gecode/flatzinc/ast.hh @@ -37,6 +37,7 @@ #include #include #include +#include #include /** @@ -44,7 +45,7 @@ * \brief Abstract syntax trees for the %FlatZinc interpreter */ -namespace Gecode { namespace FlatZinc { namespace AST { +namespace Gecode::FlatZinc::AST { class Call; class Array; @@ -52,16 +53,16 @@ namespace Gecode { namespace FlatZinc { namespace AST { class SetLit; /// %Exception signaling type error - class GECODE_VTABLE_EXPORT TypeError { + class GECODE_VTABLE_EXPORT TypeError : public std::exception { private: std::string _what; public: - TypeError() : _what("") {} + TypeError() = default; TypeError(std::string what) : _what(std::move(what)) {} - std::string - what(void) const { - return _what; + const char* + what() const noexcept override { + return _what.c_str(); } }; @@ -71,7 +72,7 @@ namespace Gecode { namespace FlatZinc { namespace AST { class GECODE_VTABLE_EXPORT Node { public: /// Destructor - virtual ~Node(void); + virtual ~Node(); /// Append \a n to an array node void append(Node* n); @@ -81,64 +82,64 @@ namespace Gecode { namespace FlatZinc { namespace AST { /// Test if node is int, if yes set \a i to the value bool is_int(int& i); /// Test if node is float, if yes set \a d to the value - bool is_float(double& i); + bool is_float(double& d); /// Test if node is function call with \a id bool is_call(const std::string& id); /// Return function call - Call* get_call(void); + Call* get_call(); /// Test if node is function call or array containing function call \a id bool has_call(const std::string& id); /// Return function call \a id Call* get_call(const std::string& id); /// Cast this node to an array node - Array* get_array(void); + Array* get_array(); /// Cast this node to an Atom node - Atom* get_atom(void); + Atom* get_atom(); /// Return name of variable represented by this node - std::string get_var_name(void); + std::string get_var_name(); /// Cast this node to an integer variable node - int get_int_var(void); + int get_int_var(); /// Cast this node to a Boolean variable node - int get_bool_var(void); + int get_bool_var(); /// Cast this node to a Float variable node - int get_float_var(void); + int get_float_var(); /// Cast this node to a set variable node - int get_set_var(void); + int get_set_var(); /// Cast this node to an integer node - int get_int(void); + int get_int(); /// Cast this node to a Boolean node - bool get_bool(void); + bool get_bool(); /// Cast this node to a Float node - double get_float(void); + double get_float(); /// Cast this node to a set literal node - SetLit* get_set(void); + SetLit* get_set(); /// Cast this node to a string node - std::string get_string(void); + std::string get_string(); /// Test if node is an integer variable node - bool is_int_var(void); + bool is_int_var(); /// Test if node is a Boolean variable node - bool is_bool_var(void); + bool is_bool_var(); /// Test if node is a set variable node - bool is_set_var(void); + bool is_set_var(); /// Test if node is a float variable node - bool is_float_var(void); + bool is_float_var(); /// Test if node is an integer node - bool is_int(void); + bool is_int(); /// Test if node is a float node - bool is_float(void); + bool is_float(); /// Test if node is a Boolean node - bool is_bool(void); + bool is_bool(); /// Test if node is a string node - bool is_string(void); + bool is_string(); /// Test if node is an array node - bool is_array(void); + bool is_array(); /// Test if node is a set literal node - bool is_set(void); + bool is_set(); /// Test if node is an atom node - bool is_atom(void); + bool is_atom(); /// Output string representation virtual void print(std::ostream&) = 0; @@ -182,13 +183,13 @@ namespace Gecode { namespace FlatZinc { namespace AST { int max; std::vector s; // NOLINTNEXTLINE(modernize-use-equals-default) - SetLit(void) {} + SetLit() {} SetLit(int min0, int max0) : interval(true), min(min0), max(max0) {} SetLit(const std::vector& s0) : interval(false), s(s0) {} explicit SetLit(SetLit* s0) : interval(s0->interval), min(s0->min), max(s0->max), s(s0->s) {} bool - empty(void) const { - return ((interval && min > max) || (!interval && s.size() == 0)); + empty() const { + return ((interval && min > max) || (!interval && s.empty())); } void print(std::ostream& os) override { @@ -261,7 +262,7 @@ namespace Gecode { namespace FlatZinc { namespace AST { } os << "]"; } - ~Array(void) override { + ~Array() override { for (int i = a.size(); i--;) delete a[i]; } @@ -273,7 +274,7 @@ namespace Gecode { namespace FlatZinc { namespace AST { std::string id; Node* args; Call(const std::string& id0, Node* args0) : id(id0), args(args0) {} - ~Call(void) override { + ~Call() override { delete args; } void @@ -297,7 +298,7 @@ namespace Gecode { namespace FlatZinc { namespace AST { Node* a; Node* idx; ArrayAccess(Node* a0, Node* idx0) : a(a0), idx(idx0) {} - ~ArrayAccess(void) override { + ~ArrayAccess() override { delete a; delete idx; } @@ -332,7 +333,7 @@ namespace Gecode { namespace FlatZinc { namespace AST { } }; - inline Node::~Node(void) = default; + inline Node::~Node() = default; inline void Node::append(Node* new_node) { @@ -365,7 +366,7 @@ namespace Gecode { namespace FlatZinc { namespace AST { } inline Call* - Node::get_call(void) { + Node::get_call() { if (Call* a = dynamic_cast(this)) return a; throw TypeError("call expected"); @@ -418,121 +419,121 @@ namespace Gecode { namespace FlatZinc { namespace AST { } inline Array* - Node::get_array(void) { + Node::get_array() { if (Array* a = dynamic_cast(this)) return a; throw TypeError("array expected"); } inline Atom* - Node::get_atom(void) { + Node::get_atom() { if (Atom* a = dynamic_cast(this)) return a; throw TypeError("atom expected"); } inline std::string - Node::get_var_name(void) { + Node::get_var_name() { if (Var* a = dynamic_cast(this)) return a->n; throw TypeError("variable expected"); } inline int - Node::get_int_var(void) { + Node::get_int_var() { if (IntVar* a = dynamic_cast(this)) return a->i; throw TypeError("integer variable expected"); } inline int - Node::get_bool_var(void) { + Node::get_bool_var() { if (BoolVar* a = dynamic_cast(this)) return a->i; throw TypeError("bool variable expected"); } inline int - Node::get_float_var(void) { + Node::get_float_var() { if (FloatVar* a = dynamic_cast(this)) return a->i; throw TypeError("integer variable expected"); } inline int - Node::get_set_var(void) { + Node::get_set_var() { if (SetVar* a = dynamic_cast(this)) return a->i; throw TypeError("set variable expected"); } inline int - Node::get_int(void) { + Node::get_int() { if (IntLit* a = dynamic_cast(this)) return a->i; throw TypeError("integer literal expected"); } inline bool - Node::get_bool(void) { + Node::get_bool() { if (BoolLit* a = dynamic_cast(this)) return a->b; throw TypeError("bool literal expected"); } inline double - Node::get_float(void) { + Node::get_float() { if (FloatLit* a = dynamic_cast(this)) return a->d; throw TypeError("float literal expected"); } inline SetLit* - Node::get_set(void) { + Node::get_set() { if (SetLit* a = dynamic_cast(this)) return a; throw TypeError("set literal expected"); } inline std::string - Node::get_string(void) { + Node::get_string() { if (String* a = dynamic_cast(this)) return a->s; throw TypeError("string literal expected"); } inline bool - Node::is_int_var(void) { + Node::is_int_var() { return (dynamic_cast(this) != nullptr); } inline bool - Node::is_bool_var(void) { + Node::is_bool_var() { return (dynamic_cast(this) != nullptr); } inline bool - Node::is_set_var(void) { + Node::is_set_var() { return (dynamic_cast(this) != nullptr); } inline bool - Node::is_float_var(void) { + Node::is_float_var() { return (dynamic_cast(this) != nullptr); } inline bool - Node::is_int(void) { + Node::is_int() { return (dynamic_cast(this) != nullptr); } inline bool - Node::is_bool(void) { + Node::is_bool() { return (dynamic_cast(this) != nullptr); } inline bool - Node::is_float(void) { + Node::is_float() { return (dynamic_cast(this) != nullptr); } inline bool - Node::is_set(void) { + Node::is_set() { return (dynamic_cast(this) != nullptr); } inline bool - Node::is_string(void) { + Node::is_string() { return (dynamic_cast(this) != nullptr); } inline bool - Node::is_array(void) { + Node::is_array() { return (dynamic_cast(this) != nullptr); } inline bool - Node::is_atom(void) { + Node::is_atom() { return (dynamic_cast(this) != nullptr); } @@ -549,7 +550,7 @@ namespace Gecode { namespace FlatZinc { namespace AST { return n; } -}}} // namespace Gecode::FlatZinc::AST +} // namespace Gecode::FlatZinc::AST #endif diff --git a/gecode/flatzinc/blackbox-backend.cpp b/gecode/flatzinc/blackbox-backend.cpp index b953b1f1a7..8700d77d99 100644 --- a/gecode/flatzinc/blackbox-backend.cpp +++ b/gecode/flatzinc/blackbox-backend.cpp @@ -33,7 +33,7 @@ * */ -#if defined(_WIN32) +#ifdef _WIN32 #if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0600) #undef _WIN32_WINNT #define _WIN32_WINNT 0x0600 @@ -42,7 +42,7 @@ #undef WINVER #define WINVER 0x0600 #endif -#elif !defined(_GNU_SOURCE) +#elifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif @@ -81,7 +81,7 @@ #include #endif -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { namespace { @@ -180,7 +180,7 @@ namespace Gecode { namespace FlatZinc { #else (void)stdcall_bytes; T symbol = nullptr; - *(void**)(&symbol) = dlsym(library, name); + *reinterpret_cast(&symbol) = dlsym(library, name); return symbol; #endif } @@ -315,6 +315,7 @@ namespace Gecode { namespace FlatZinc { try { library_fzn_free(root_instance); } catch (...) { + // Ignored: cleanup has no way to report a failure } } close_library(loaded); @@ -329,12 +330,14 @@ namespace Gecode { namespace FlatZinc { try { library_fzn_free(instance->value); } catch (...) { + // Ignored: cleanup has no way to report a failure } } #endif try { library_fzn_free(root_instance); } catch (...) { + // Ignored: cleanup has no way to report a failure } } #ifdef GECODE_HAS_THREADS @@ -347,7 +350,7 @@ namespace Gecode { namespace FlatZinc { #ifdef GECODE_HAS_THREADS BlackBoxLibrary::Instance* - BlackBoxLibrary::instance(void) { + BlackBoxLibrary::instance() { const std::thread::id owner = std::this_thread::get_id(); Support::Lock lock(mutex); // Each live thread has exclusive access to its selected instance. @@ -368,6 +371,7 @@ namespace Gecode { namespace FlatZinc { try { library_fzn_free(value); } catch (...) { + // Ignored: cleanup has no way to report a failure } } throw; @@ -404,7 +408,7 @@ namespace Gecode { namespace FlatZinc { BlackBoxExec::BlackBoxExec(const std::string& program0, const std::vector& args0) : program(program0), args(args0) {} - BlackBoxExec::~BlackBoxExec(void) { + BlackBoxExec::~BlackBoxExec() { Support::Lock lock(mutex); for (BlackBoxProcessSession* s : sessions) { delete s; @@ -413,7 +417,7 @@ namespace Gecode { namespace FlatZinc { } BlackBoxProcessSession& - BlackBoxExec::session(void) { + BlackBoxExec::session() { Support::Lock lock(mutex); for (BlackBoxProcessSession* s : sessions) { if (s->owned_by_current_thread()) { @@ -451,7 +455,7 @@ namespace Gecode { namespace FlatZinc { void decode_blackbox_response(const std::string& response, BlackBoxCall& call) { - if (response.find('\0') != std::string::npos) { + if (response.contains('\0')) { throw Error("BlackBoxExec", "Blackbox process response contains NUL data."); } // Parse the response in a single left-to-right pass: comma-separated @@ -560,6 +564,6 @@ namespace Gecode { namespace FlatZinc { decode_blackbox_response(response, call); } -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc // STATISTICS: flatzinc-other diff --git a/gecode/flatzinc/blackbox-backend.hh b/gecode/flatzinc/blackbox-backend.hh index c2391995c3..8814cd503d 100644 --- a/gecode/flatzinc/blackbox-backend.hh +++ b/gecode/flatzinc/blackbox-backend.hh @@ -53,7 +53,7 @@ #define GECODE_BLACKBOX_CALL #endif -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { class BlackBoxProcessSession; @@ -68,7 +68,7 @@ namespace Gecode { namespace FlatZinc { /// Backend for a deterministic FlatZinc blackbox function. class BlackBoxBackend : public SharedHandle::Object { public: - ~BlackBoxBackend(void) override = default; + ~BlackBoxBackend() override = default; virtual void run(BlackBoxCall& call) = 0; void run(const std::vector& int_input, const std::vector& float_input, @@ -99,7 +99,7 @@ namespace Gecode { namespace FlatZinc { class Instance; Support::Mutex mutex; std::vector instances; - Instance* instance(void); + Instance* instance(); #endif }; @@ -116,7 +116,7 @@ namespace Gecode { namespace FlatZinc { std::vector args; Support::Mutex mutex; std::vector sessions; - BlackBoxProcessSession& session(void); + BlackBoxProcessSession& session(); }; /// Encode one request for the executable backend's line protocol. @@ -126,7 +126,7 @@ namespace Gecode { namespace FlatZinc { GECODE_FLATZINC_EXPORT void decode_blackbox_response(const std::string& response, BlackBoxCall& call); -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc #endif // GECODE_FLATZINC_BLACKBOX_BACKEND_HH diff --git a/gecode/flatzinc/blackbox-process-none.cpp b/gecode/flatzinc/blackbox-process-none.cpp index 85bf92dc12..c15b6a14c9 100644 --- a/gecode/flatzinc/blackbox-process-none.cpp +++ b/gecode/flatzinc/blackbox-process-none.cpp @@ -9,7 +9,7 @@ #include #if !defined(_WIN32) && !defined(GECODE_HAS_POSIX_BLACKBOX_EXEC) -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { BlackBoxProcessSession* create_blackbox_process(const std::string&, const std::vector&) { @@ -17,7 +17,7 @@ namespace Gecode { namespace FlatZinc { "platform"); } -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc #endif // STATISTICS: flatzinc-other diff --git a/gecode/flatzinc/blackbox-process-posix.cpp b/gecode/flatzinc/blackbox-process-posix.cpp index acb519974e..21e53e8938 100644 --- a/gecode/flatzinc/blackbox-process-posix.cpp +++ b/gecode/flatzinc/blackbox-process-posix.cpp @@ -28,7 +28,7 @@ extern char** environ; -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { namespace { const size_t max_exec_response_size = 1024 * 1024; @@ -86,16 +86,16 @@ namespace Gecode { namespace FlatZinc { public: explicit FileDescriptor(int fd0 = -1) : fd(fd0) {} - ~FileDescriptor(void) { + ~FileDescriptor() { reset(); } int - get(void) const { + get() const { return fd; } int - release(void) { + release() { int fd0 = fd; fd = -1; return fd0; @@ -127,21 +127,21 @@ namespace Gecode { namespace FlatZinc { bool initialized; public: - SpawnFileActions(void) : initialized(false) {} - ~SpawnFileActions(void) { + SpawnFileActions() : initialized(false) {} + ~SpawnFileActions() { if (initialized) { posix_spawn_file_actions_destroy(&actions); } } int - init(void) { + init() { int err = posix_spawn_file_actions_init(&actions); initialized = err == 0; return err; } posix_spawn_file_actions_t* - get(void) { + get() { return &actions; } }; @@ -152,21 +152,21 @@ namespace Gecode { namespace FlatZinc { bool initialized; public: - SpawnAttributes(void) : initialized(false) {} - ~SpawnAttributes(void) { + SpawnAttributes() : initialized(false) {} + ~SpawnAttributes() { if (initialized) { posix_spawnattr_destroy(&attr); } } int - init(void) { + init() { int err = posix_spawnattr_init(&attr); initialized = err == 0; return err; } posix_spawnattr_t* - get(void) { + get() { return &attr; } }; @@ -239,7 +239,7 @@ namespace Gecode { namespace FlatZinc { } static void - sleep_grace_period(void) { + sleep_grace_period() { struct timespec remaining = {0, 10000000}; while ((nanosleep(&remaining, &remaining) == -1) && (errno == EINTR)) { } @@ -295,7 +295,7 @@ namespace Gecode { namespace FlatZinc { } static void - check_sigchld(void) { + check_sigchld() { struct sigaction action; if (sigaction(SIGCHLD, nullptr, &action) != 0) { throw Error("BlackBoxExec", last_error("SIGCHLD query failed")); @@ -311,7 +311,7 @@ namespace Gecode { namespace FlatZinc { } void open_posix(const std::string& program, const std::vector& args); - void close_posix(void); + void close_posix(); public: PosixProcessSession(const std::string& program, const std::vector& args) @@ -319,7 +319,7 @@ namespace Gecode { namespace FlatZinc { open_posix(program, args); } - ~PosixProcessSession(void) override { + ~PosixProcessSession() override { close(); } @@ -372,7 +372,7 @@ namespace Gecode { namespace FlatZinc { } void - close(void) { + close() { close_posix(); } }; @@ -445,7 +445,7 @@ namespace Gecode { namespace FlatZinc { if (err == 0) { err = posix_spawn_file_actions_addinherit_np(actions.get(), STDERR_FILENO); } -#elif defined(GECODE_HAS_POSIX_SPAWN_ADDCLOSEFROM_NP) +#elifdef GECODE_HAS_POSIX_SPAWN_ADDCLOSEFROM_NP if (err == 0) { err = posix_spawn_file_actions_addclosefrom_np(actions.get(), STDERR_FILENO + 1); } @@ -486,13 +486,13 @@ namespace Gecode { namespace FlatZinc { } void - PosixProcessSession::close_posix(void) { + PosixProcessSession::close_posix() { if (pipe_send != -1) { ::close(pipe_send); pipe_send = -1; } if (file_receive != nullptr) { - fclose(file_receive); + (void)fclose(file_receive); file_receive = nullptr; } if (child > 0) { @@ -508,7 +508,7 @@ namespace Gecode { namespace FlatZinc { return new PosixProcessSession(program, args); } -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc #endif // STATISTICS: flatzinc-other diff --git a/gecode/flatzinc/blackbox-process-windows.cpp b/gecode/flatzinc/blackbox-process-windows.cpp index aa3617781e..a4d948c831 100644 --- a/gecode/flatzinc/blackbox-process-windows.cpp +++ b/gecode/flatzinc/blackbox-process-windows.cpp @@ -8,7 +8,7 @@ * Copyright: * Jip J. Dekker, 2026 */ -#if defined(_WIN32) +#ifdef _WIN32 #if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0600) #undef _WIN32_WINNT #define _WIN32_WINNT 0x0600 @@ -24,7 +24,7 @@ #include #include -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { namespace { const size_t max_exec_response_size = 1024 * 1024; @@ -58,7 +58,7 @@ namespace Gecode { namespace FlatZinc { public: explicit WindowsHandle(HANDLE handle0 = nullptr) : handle(handle0) {} - ~WindowsHandle(void) { + ~WindowsHandle() { reset(); } @@ -66,22 +66,22 @@ namespace Gecode { namespace FlatZinc { WindowsHandle& operator=(const WindowsHandle&) = delete; HANDLE - get(void) const { + get() const { return handle; } HANDLE* - put(void) { + put() { reset(); return &handle; } HANDLE - release(void) { + release() { HANDLE handle0 = handle; handle = nullptr; return handle0; } bool - valid(void) const { + valid() const { return (handle != nullptr) && (handle != INVALID_HANDLE_VALUE); } void @@ -100,15 +100,15 @@ namespace Gecode { namespace FlatZinc { bool initialized; public: - WindowsAttributeList(void) : list(nullptr), initialized(false) {} - ~WindowsAttributeList(void) { + WindowsAttributeList() : list(nullptr), initialized(false) {} + ~WindowsAttributeList() { if (initialized) { DeleteProcThreadAttributeList(list); } } void - init(void) { + init() { SIZE_T size = 0; InitializeProcThreadAttributeList(nullptr, 1, 0, &size); if (size == 0) { @@ -134,7 +134,7 @@ namespace Gecode { namespace FlatZinc { } LPPROC_THREAD_ATTRIBUTE_LIST - get(void) const { + get() const { return list; } }; @@ -187,7 +187,7 @@ namespace Gecode { namespace FlatZinc { } void open_windows(const std::string& program, const std::vector& args); - void close_windows(void); + void close_windows(); public: WindowsProcessSession(const std::string& program, const std::vector& args) @@ -195,7 +195,7 @@ namespace Gecode { namespace FlatZinc { open_windows(program, args); } - ~WindowsProcessSession(void) override { + ~WindowsProcessSession() override { close(); } @@ -236,7 +236,7 @@ namespace Gecode { namespace FlatZinc { } void - close(void) { + close() { close_windows(); } }; @@ -391,7 +391,7 @@ namespace Gecode { namespace FlatZinc { } void - WindowsProcessSession::close_windows(void) { + WindowsProcessSession::close_windows() { close_handle(pipe_send); close_handle(pipe_receive); if (process != nullptr) { @@ -415,7 +415,7 @@ namespace Gecode { namespace FlatZinc { return new WindowsProcessSession(program, args); } -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc #endif // STATISTICS: flatzinc-other diff --git a/gecode/flatzinc/blackbox-process.hh b/gecode/flatzinc/blackbox-process.hh index eed6c3329f..e790bbcab6 100644 --- a/gecode/flatzinc/blackbox-process.hh +++ b/gecode/flatzinc/blackbox-process.hh @@ -18,7 +18,7 @@ #include #endif -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { /// Platform process session used by the executable blackbox backend. class BlackBoxProcessSession { @@ -27,7 +27,7 @@ namespace Gecode { namespace FlatZinc { std::thread::id owner; #endif // NOLINTNEXTLINE(modernize-use-equals-default) - BlackBoxProcessSession(void) + BlackBoxProcessSession() #ifdef GECODE_HAS_THREADS : owner(std::this_thread::get_id()) #endif @@ -35,9 +35,9 @@ namespace Gecode { namespace FlatZinc { } public: - virtual ~BlackBoxProcessSession(void) = default; + virtual ~BlackBoxProcessSession() = default; bool - owned_by_current_thread(void) const { + owned_by_current_thread() const { #ifdef GECODE_HAS_THREADS return owner == std::this_thread::get_id(); #else @@ -50,7 +50,7 @@ namespace Gecode { namespace FlatZinc { /// Create the process implementation selected for the target platform. BlackBoxProcessSession* create_blackbox_process(const std::string& program, const std::vector& args); -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc #endif diff --git a/gecode/flatzinc/blackbox-propagator.cpp b/gecode/flatzinc/blackbox-propagator.cpp index 7092ec7084..72bf42b833 100644 --- a/gecode/flatzinc/blackbox-propagator.cpp +++ b/gecode/flatzinc/blackbox-propagator.cpp @@ -43,23 +43,20 @@ #include #include -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { namespace { class BlackBoxHandle : public SharedHandle { public: - explicit BlackBoxHandle(BlackBoxBackend* backend) : SharedHandle() { + explicit BlackBoxHandle(BlackBoxBackend* backend) { object(backend); } explicit BlackBoxHandle(const SharedHandle& handle) : SharedHandle(handle) {} BlackBoxHandle(const BlackBoxHandle& handle) = default; - BlackBoxHandle& - operator=(const BlackBoxHandle& handle) { - return static_cast(SharedHandle::operator=(handle)); - } + BlackBoxHandle& operator=(const BlackBoxHandle& handle) = default; BlackBoxBackend* - operator()(void) const { + operator()() const { return static_cast(object()); } }; @@ -82,16 +79,16 @@ namespace Gecode { namespace FlatZinc { std::atomic error_recorded; public: - BlackBoxContext(void) : error_recorded(false) {} + BlackBoxContext() : error_recorded(false) {} BlackBoxHandle backend_for_constraint(const std::string& mode, const std::string& target, const std::vector& args); void fail(std::exception_ptr e); - bool failed(void) const; - void rethrow(void) const; + bool failed() const; + void rethrow() const; }; void - BlackBoxContextHandle::init(void) { + BlackBoxContextHandle::init() { if (!*this) { object(new BlackBoxContext); } @@ -109,12 +106,12 @@ namespace Gecode { namespace FlatZinc { } bool - BlackBoxContextHandle::failed(void) const { + BlackBoxContextHandle::failed() const { return static_cast(*this) && static_cast(object())->failed(); } void - BlackBoxContextHandle::rethrow(void) const { + BlackBoxContextHandle::rethrow() const { if (*this) { static_cast(object())->rethrow(); } @@ -131,7 +128,7 @@ namespace Gecode { namespace FlatZinc { } } BlackBoxHandle handle(new BlackBoxExec(target, args)); - exec.push_back(ExecEntry(target, args, handle)); + exec.emplace_back(target, args, handle); return handle; } if (mode == "dll") { @@ -150,12 +147,12 @@ namespace Gecode { namespace FlatZinc { } bool - BlackBoxContext::failed(void) const { + BlackBoxContext::failed() const { return error_recorded.load(std::memory_order_acquire); } void - BlackBoxContext::rethrow(void) const { + BlackBoxContext::rethrow() const { if (!error_recorded.load(std::memory_order_acquire)) { return; } @@ -696,6 +693,6 @@ namespace Gecode { namespace FlatZinc { GECODE_ES_FAIL(es); } -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc // STATISTICS: flatzinc-prop diff --git a/gecode/flatzinc/blackbox.hh b/gecode/flatzinc/blackbox.hh index 734ff8fe7f..9744911086 100644 --- a/gecode/flatzinc/blackbox.hh +++ b/gecode/flatzinc/blackbox.hh @@ -46,31 +46,28 @@ #include #endif -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { class BlackBoxContext; /// Model-local context shared by blackbox propagators and search support. class BlackBoxContextHandle : public SharedHandle { public: - BlackBoxContextHandle(void) : SharedHandle() {} + BlackBoxContextHandle() = default; BlackBoxContextHandle(const BlackBoxContextHandle& handle) = default; - BlackBoxContextHandle& - operator=(const BlackBoxContextHandle& handle) { - return static_cast(SharedHandle::operator=(handle)); - } + BlackBoxContextHandle& operator=(const BlackBoxContextHandle& handle) = default; /// Initialize this context if it is empty. - void init(void); + void init(); /// Return the backend selected for one constraint as an opaque handle. SharedHandle backend_for_constraint(const std::string& mode, const std::string& target, const std::vector& args) const; /// Record the first exception raised during blackbox propagation. void fail(std::exception_ptr e) const; /// Whether blackbox propagation raised an exception. - bool failed(void) const; + bool failed() const; /// Rethrow the first recorded propagation exception. - void rethrow(void) const; + void rethrow() const; }; /// Access to the model-local blackbox context while posting and searching. @@ -92,7 +89,7 @@ namespace Gecode { namespace FlatZinc { const std::string& mode, const std::string& target, const std::vector& args, const std::vector& reason); -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc #endif // GECODE_FLATZINC_BLACKBOX_HH diff --git a/gecode/flatzinc/branch.cpp b/gecode/flatzinc/branch.cpp index c910beadf3..168d2b7ae6 100644 --- a/gecode/flatzinc/branch.cpp +++ b/gecode/flatzinc/branch.cpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { void PosIntChoice::archive(Archive& e) const { @@ -67,10 +67,9 @@ namespace Gecode { namespace FlatZinc { int n = c.val(); if (p < x.size()) { return me_failed(xvsc->commit(home, b, x[p], p, n)) ? ES_FAILED : ES_OK; - } else { - p -= x.size(); - return me_failed(yvsc->commit(home, b, y[p], p, n)) ? ES_FAILED : ES_OK; } + p -= x.size(); + return me_failed(yvsc->commit(home, b, y[p], p, n)) ? ES_FAILED : ES_OK; } void @@ -86,10 +85,9 @@ namespace Gecode { namespace FlatZinc { int n = c.val(); if (p < x.size()) { return xvsc->ngl(home, b, x[p], n); - } else { - p -= x.size(); - return yvsc->ngl(home, b, y[p], n); } + p -= x.size(); + return yvsc->ngl(home, b, y[p], n); } void @@ -154,6 +152,6 @@ namespace Gecode { namespace FlatZinc { } } -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc // STATISTICS: flatzinc-branch diff --git a/gecode/flatzinc/branch.hh b/gecode/flatzinc/branch.hh index 3b5a4d07c3..cc4a21fe7c 100644 --- a/gecode/flatzinc/branch.hh +++ b/gecode/flatzinc/branch.hh @@ -37,7 +37,7 @@ #include #include -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { /// Which integer or Boolean variable to select for branching class IntBoolVarBranch : public VarBranch { @@ -79,19 +79,19 @@ namespace Gecode { namespace FlatZinc { /// Initialize with selection strategy \a s and CHB \a i and \a b IntBoolVarBranch(Select s, const IntCHB& i, const BoolCHB& b); /// Return selection strategy - Select select(void) const; + Select select() const; /// Return integer AFC - IntAFC int_afc(void) const; + IntAFC int_afc() const; /// Return Boolean AFC - BoolAFC bool_afc(void) const; + BoolAFC bool_afc() const; /// Return integer action - IntAction int_action(void) const; + IntAction int_action() const; /// Return Boolean action - BoolAction bool_action(void) const; + BoolAction bool_action() const; /// Return integer CHB - IntCHB int_chb(void) const; + IntCHB int_chb() const; /// Return Boolean AFC - BoolCHB bool_chb(void) const; + BoolCHB bool_chb() const; /// Expand AFC, action, and CHB void expand(Home home, const IntVarArgs& x, const BoolVarArgs& y); }; @@ -142,7 +142,7 @@ namespace Gecode { namespace FlatZinc { /// Return merit double operator()(Int::BoolView x, int i) const; /// Dispose - void dispose(void); + void dispose(); }; /// Select by maximal AFC over size @@ -163,7 +163,7 @@ namespace Gecode { namespace FlatZinc { /// Return merit double operator()(Int::BoolView x, int i) const; /// Dispose - void dispose(void); + void dispose(); }; /// Select by maximal Action @@ -184,7 +184,7 @@ namespace Gecode { namespace FlatZinc { /// Return merit double operator()(Int::BoolView x, int i) const; /// Dispose - void dispose(void); + void dispose(); }; /// Select by maximal Action over size @@ -205,7 +205,7 @@ namespace Gecode { namespace FlatZinc { /// Return merit double operator()(Int::BoolView x, int i) const; /// Dispose - void dispose(void); + void dispose(); }; /// Select by maximal CHB @@ -226,7 +226,7 @@ namespace Gecode { namespace FlatZinc { /// Return merit double operator()(Int::BoolView x, int i) const; /// Dispose - void dispose(void); + void dispose(); }; /// Select by maximal CHB over size @@ -247,7 +247,7 @@ namespace Gecode { namespace FlatZinc { /// Return merit double operator()(Int::BoolView x, int i) const; /// Dispose - void dispose(void); + void dispose(); }; /// %Choice storing position and value @@ -262,9 +262,9 @@ namespace Gecode { namespace FlatZinc { /// Initialize choice for brancher \a b, number of alternatives \a a, position \a p, and value \a n PosIntChoice(const Brancher& b, unsigned int a, int p, int n); /// Return position of view to assign - int pos(void) const; + int pos() const; /// Return value to assign to - int val(void) const; + int val() const; /// Archive into \a e void archive(Archive& e) const override; }; @@ -338,7 +338,7 @@ namespace Gecode { namespace FlatZinc { GECODE_FLATZINC_EXPORT void branch(Home home, const IntVarArgs& x, const BoolVarArgs& y, IntBoolVarBranch vars, const IntValBranch& vals); -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc #include diff --git a/gecode/flatzinc/branch.hpp b/gecode/flatzinc/branch.hpp index 828f361c2a..654e59aa85 100644 --- a/gecode/flatzinc/branch.hpp +++ b/gecode/flatzinc/branch.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { forceinline IntBoolVarBranch::IntBoolVarBranch(Select s0, double d) @@ -49,34 +49,34 @@ namespace Gecode { namespace FlatZinc { : s(s0), int_chb_data(i), bool_chb_data(b) {} forceinline IntBoolVarBranch::Select - IntBoolVarBranch::select(void) const { + IntBoolVarBranch::select() const { return s; } forceinline IntAFC - IntBoolVarBranch::int_afc(void) const { + IntBoolVarBranch::int_afc() const { return int_afc_data; } forceinline BoolAFC - IntBoolVarBranch::bool_afc(void) const { + IntBoolVarBranch::bool_afc() const { return bool_afc_data; } forceinline IntAction - IntBoolVarBranch::int_action(void) const { + IntBoolVarBranch::int_action() const { return int_action_data; } forceinline BoolAction - IntBoolVarBranch::bool_action(void) const { + IntBoolVarBranch::bool_action() const { return bool_action_data; } forceinline IntCHB - IntBoolVarBranch::int_chb(void) const { + IntBoolVarBranch::int_chb() const { return int_chb_data; } forceinline BoolCHB - IntBoolVarBranch::bool_chb(void) const { + IntBoolVarBranch::bool_chb() const { return bool_chb_data; } forceinline void @@ -171,7 +171,7 @@ namespace Gecode { namespace FlatZinc { return x.afc(); } forceinline void - MeritMaxAFC::dispose(void) { + MeritMaxAFC::dispose() { int_afc_data.~IntAFC(); bool_afc_data.~BoolAFC(); } @@ -191,7 +191,7 @@ namespace Gecode { namespace FlatZinc { return x.afc() / 2.0; } forceinline void - MeritMaxAFCSize::dispose(void) { + MeritMaxAFCSize::dispose() { int_afc_data.~IntAFC(); bool_afc_data.~BoolAFC(); } @@ -211,7 +211,7 @@ namespace Gecode { namespace FlatZinc { return bool_action_data[i]; } forceinline void - MeritMaxAction::dispose(void) { + MeritMaxAction::dispose() { int_action_data.~IntAction(); bool_action_data.~BoolAction(); } @@ -231,7 +231,7 @@ namespace Gecode { namespace FlatZinc { return bool_action_data[i] / 2.0; } forceinline void - MeritMaxActionSize::dispose(void) { + MeritMaxActionSize::dispose() { int_action_data.~IntAction(); bool_action_data.~BoolAction(); } @@ -251,7 +251,7 @@ namespace Gecode { namespace FlatZinc { return bool_chb_data[i]; } forceinline void - MeritMaxCHB::dispose(void) { + MeritMaxCHB::dispose() { int_chb_data.~IntCHB(); bool_chb_data.~BoolCHB(); } @@ -271,7 +271,7 @@ namespace Gecode { namespace FlatZinc { return bool_chb_data[i] / 2.0; } forceinline void - MeritMaxCHBSize::dispose(void) { + MeritMaxCHBSize::dispose() { int_chb_data.~IntCHB(); bool_chb_data.~BoolCHB(); } @@ -280,11 +280,11 @@ namespace Gecode { namespace FlatZinc { PosIntChoice::PosIntChoice(const Brancher& b, unsigned int a, int p, int n) : Choice(b, a), _pos(p), _val(n) {} forceinline int - PosIntChoice::pos(void) const { + PosIntChoice::pos() const { return _pos; } forceinline int - PosIntChoice::val(void) const { + PosIntChoice::val() const { return _val; } @@ -418,6 +418,6 @@ namespace Gecode { namespace FlatZinc { return BOOL_VAL_MIN(); } -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc // STATISTICS: flatzinc-branch diff --git a/gecode/flatzinc/complete.hh b/gecode/flatzinc/complete.hh index d544f4ff5b..0efa322fc0 100644 --- a/gecode/flatzinc/complete.hh +++ b/gecode/flatzinc/complete.hh @@ -38,7 +38,7 @@ using namespace Gecode::Int; -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { class Complete : public UnaryPropagator { protected: @@ -81,7 +81,7 @@ namespace Gecode { namespace FlatZinc { } }; -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc #endif // FLATZINC_COMPLETE_HH diff --git a/gecode/flatzinc/conexpr.hh b/gecode/flatzinc/conexpr.hh index ef3f72b501..bf74b1eecc 100644 --- a/gecode/flatzinc/conexpr.hh +++ b/gecode/flatzinc/conexpr.hh @@ -36,7 +36,7 @@ #include #include -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { /// Abstract representation of a constraint class ConExpr { @@ -52,9 +52,9 @@ namespace Gecode { namespace FlatZinc { /// Return argument \a i AST::Node* operator[](int i) const; /// Return number of arguments - int size(void) const; + int size() const; /// Destructor - ~ConExpr(void); + ~ConExpr(); }; forceinline @@ -67,16 +67,16 @@ namespace Gecode { namespace FlatZinc { } forceinline int - ConExpr::size(void) const { + ConExpr::size() const { return args->a.size(); } - forceinline ConExpr::~ConExpr(void) { + forceinline ConExpr::~ConExpr() { delete args; delete ann; } -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc #endif diff --git a/gecode/flatzinc/exampleplugin/myplugin.hh b/gecode/flatzinc/exampleplugin/myplugin.hh index c7ddf0a86d..2870f30220 100644 --- a/gecode/flatzinc/exampleplugin/myplugin.hh +++ b/gecode/flatzinc/exampleplugin/myplugin.hh @@ -38,5 +38,6 @@ public: Q_OBJECT Q_PLUGIN_METADATA(IID "org.gecode.FlatZinc.BranchPlugin/1.0") Q_INTERFACES(Gecode::FlatZinc::BranchPlugin) +public: void branch(Gecode::FlatZinc::FlatZincSpace& space, Gecode::FlatZinc::AST::Call* call) override; }; diff --git a/gecode/flatzinc/flatzinc.cpp b/gecode/flatzinc/flatzinc.cpp index 88496d52fb..ed8202ecb1 100644 --- a/gecode/flatzinc/flatzinc.cpp +++ b/gecode/flatzinc/flatzinc.cpp @@ -36,6 +36,7 @@ * */ +#include #include #include #include @@ -44,12 +45,13 @@ #include +#include +#include #include #include #include #include #include -#include #include namespace std { @@ -89,7 +91,7 @@ namespace std { } // namespace std -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { // Default random number generator Rnd defrnd(0); @@ -159,7 +161,7 @@ namespace Gecode { namespace FlatZinc { Choice(const Brancher& b, bool fail0) : Gecode::Choice(b, 1), fail(fail0) {} /// Report size occupied virtual size_t - size(void) const { + size() const { return sizeof(Choice); } /// Archive into \a e @@ -190,20 +192,20 @@ namespace Gecode { namespace FlatZinc { if (done) return false; const FlatZincSpace& home = static_cast(_home); - for (int i = 0; i < home.iv_aux.size(); i++) - if (!home.iv_aux[i].assigned()) + for (auto var : home.iv_aux) + if (!var.assigned()) return true; - for (int i = 0; i < home.bv_aux.size(); i++) - if (!home.bv_aux[i].assigned()) + for (auto var : home.bv_aux) + if (!var.assigned()) return true; #ifdef GECODE_HAS_SET_VARS - for (int i = 0; i < home.sv_aux.size(); i++) - if (!home.sv_aux[i].assigned()) + for (auto var : home.sv_aux) + if (!var.assigned()) return true; #endif #ifdef GECODE_HAS_FLOAT_VARS - for (int i = 0; i < home.fv_aux.size(); i++) - if (!home.fv_aux[i].assigned()) + for (auto var : home.fv_aux) + if (!var.assigned()) return true; #endif // No non-assigned variables left @@ -229,9 +231,8 @@ namespace Gecode { namespace FlatZinc { if (sol) { delete sol; return new Choice(*this, false); - } else { - return new Choice(*this, true); } + return new Choice(*this, true); } /// Return choice Choice* @@ -307,7 +308,7 @@ namespace Gecode { namespace FlatZinc { std::string r0; std::string r1; std::vector n; - BI(void) : r0(""), r1(""), n(0) {} + BI() : n(0) {} BI(const std::string& r00, const std::string& r10, const std::vector& n0) : r0(r00), r1(r10), n(n0) {} }; @@ -315,10 +316,10 @@ namespace Gecode { namespace FlatZinc { BranchInformationO(std::vector v0) : v(std::move(v0)) {} public: - BranchInformationO(void) = default; - ~BranchInformationO(void) override = default; + BranchInformationO() = default; + ~BranchInformationO() override = default; virtual SharedHandle::Object* - copy(void) const { + copy() const { return new BranchInformationO(v); } /// Add new brancher information @@ -342,10 +343,10 @@ namespace Gecode { namespace FlatZinc { #endif }; - BranchInformation::BranchInformation(void) : SharedHandle(nullptr) {} + BranchInformation::BranchInformation() : SharedHandle(nullptr) {} void - BranchInformation::init(void) { + BranchInformation::init() { assert(object() == nullptr); object(new BranchInformationO()); } @@ -367,20 +368,20 @@ namespace Gecode { namespace FlatZinc { } #endif template - void + static void var_val_print(const Space& home, const Brancher& b, unsigned int a, Var, int i, const int& n, std::ostream& o) { static_cast(home).branch_info.print(b, a, i, n, o); } #ifdef GECODE_HAS_FLOAT_VARS - void + static void var_val_print_f(const Space& home, const Brancher& b, unsigned int a, FloatVar, int i, const FloatNumBranch& nl, std::ostream& o) { static_cast(home).branch_info.print(b, a, i, nl, o); } #endif - IntSet + static IntSet vs2is(IntVarSpec* vs) { if (vs->assigned) { return IntSet(vs->i, vs->i); @@ -389,14 +390,13 @@ namespace Gecode { namespace FlatZinc { AST::SetLit* sl = vs->domain.some(); if (sl->interval) { return IntSet(sl->min, sl->max); - } else { - return IntSet(sl->s.data(), static_cast(sl->s.size())); } + return IntSet(sl->s.data(), static_cast(sl->s.size())); } return IntSet(Int::Limits::min, Int::Limits::max); } - int + static int vs2bsl(BoolVarSpec* bs) { if (bs->assigned) { return bs->i; @@ -409,7 +409,7 @@ namespace Gecode { namespace FlatZinc { return 0; } - int + static int vs2bsh(BoolVarSpec* bs) { if (bs->assigned) { return bs->i; @@ -422,7 +422,7 @@ namespace Gecode { namespace FlatZinc { return 1; } - TieBreak + static TieBreak annotation_to_int_var_branch(AST::Node* ann, const Rnd& rnd, double decay) { if (AST::Atom* s = dynamic_cast(ann)) { if (s->id == "input_order") @@ -471,7 +471,7 @@ namespace Gecode { namespace FlatZinc { return TieBreak(INT_VAR_NONE()); } - IntValBranch + static IntValBranch annotation_to_int_val_branch(AST::Node* ann, std::string& r0, std::string& r1, const Rnd& rnd) { if (AST::Atom* s = dynamic_cast(ann)) { if (s->id == "indomain_min") { @@ -532,7 +532,7 @@ namespace Gecode { namespace FlatZinc { return INT_VAL_MIN(); } - IntAssign + static IntAssign annotation_to_int_assign(AST::Node* ann, const Rnd& rnd) { if (AST::Atom* s = dynamic_cast(ann)) { if (s->id == "indomain_min") @@ -551,7 +551,7 @@ namespace Gecode { namespace FlatZinc { return INT_ASSIGN_MIN(); } - TieBreak + static TieBreak annotation_to_bool_var_branch(AST::Node* ann, const Rnd& rnd, double decay) { if (AST::Atom* s = dynamic_cast(ann)) { if ((s->id == "input_order") || (s->id == "first_fail") || (s->id == "anti_first_fail") || @@ -576,7 +576,7 @@ namespace Gecode { namespace FlatZinc { return TieBreak(BOOL_VAR_NONE()); } - BoolValBranch + static BoolValBranch annotation_to_bool_val_branch(AST::Node* ann, std::string& r0, std::string& r1, const Rnd& rnd) { if (AST::Atom* s = dynamic_cast(ann)) { if (s->id == "indomain_min") { @@ -637,7 +637,7 @@ namespace Gecode { namespace FlatZinc { return BOOL_VAL_MIN(); } - BoolAssign + static BoolAssign annotation_to_bool_assign(AST::Node* ann, const Rnd& rnd) { if (AST::Atom* s = dynamic_cast(ann)) { if ((s->id == "indomain_min") || (s->id == "indomain_median")) @@ -655,7 +655,7 @@ namespace Gecode { namespace FlatZinc { } #ifdef GECODE_HAS_SET_VARS - SetVarBranch + static SetVarBranch annotation_to_set_var_branch(AST::Node* ann, const Rnd& rnd, double decay) { if (AST::Atom* s = dynamic_cast(ann)) { if (s->id == "input_order") @@ -694,7 +694,7 @@ namespace Gecode { namespace FlatZinc { return SET_VAR_NONE(); } - SetValBranch + static SetValBranch annotation_to_set_val_branch(AST::Node* ann, std::string& r0, std::string& r1, const Rnd& rnd) { (void)rnd; if (AST::Atom* s = dynamic_cast(ann)) { @@ -729,7 +729,7 @@ namespace Gecode { namespace FlatZinc { #endif #ifdef GECODE_HAS_FLOAT_VARS - TieBreak + static TieBreak annotation_to_float_var_branch(AST::Node* ann, const Rnd& rnd, double decay) { if (AST::Atom* s = dynamic_cast(ann)) { if (s->id == "input_order") @@ -772,7 +772,7 @@ namespace Gecode { namespace FlatZinc { return TieBreak(FLOAT_VAR_NONE()); } - FloatValBranch + static FloatValBranch annotation_to_float_val_branch(AST::Node* ann, std::string& r0, std::string& r1) { if (AST::Atom* s = dynamic_cast(ann)) { if (s->id == "indomain_split") { @@ -799,17 +799,17 @@ namespace Gecode { namespace FlatZinc { class FlatZincSpaceInitData { public: /// Hash table of tuple sets - typedef std::unordered_set TupleSetSet; + using TupleSetSet = std::unordered_set; /// Hash table of tuple sets TupleSetSet tuple_set_set; /// Hash table of shared integer arrays - typedef std::unordered_set> IntSharedArraySet; + using IntSharedArraySet = std::unordered_set>; /// Hash table of shared integer arrays IntSharedArraySet int_shared_array_set; /// Hash table of DFAs - typedef std::unordered_set DFASet; + using DFASet = std::unordered_set; /// Hash table of DFAs DFASet dfa_set; @@ -817,7 +817,7 @@ namespace Gecode { namespace FlatZinc { BlackBoxContextHandle black_box_context; /// Initialize - FlatZincSpaceInitData(void) = default; + FlatZincSpaceInitData() = default; }; FlatZincSpace::FlatZincSpace(FlatZincSpace& f) @@ -847,10 +847,10 @@ namespace Gecode { namespace FlatZinc { #endif if (need_aux_vars) { IntVarArgs iva; - for (int i = 0; i < f.iv_aux.size(); i++) { - if (!f.iv_aux[i].assigned()) { + for (auto& var : f.iv_aux) { + if (!var.assigned()) { iva << IntVar(); - iva[iva.size() - 1].update(*this, f.iv_aux[i]); + iva[iva.size() - 1].update(*this, var); } } iv_aux = IntVarArray(*this, iva); @@ -860,10 +860,10 @@ namespace Gecode { namespace FlatZinc { bool_var_count = f.bool_var_count; if (need_aux_vars) { BoolVarArgs bva; - for (int i = 0; i < f.bv_aux.size(); i++) { - if (!f.bv_aux[i].assigned()) { + for (auto& var : f.bv_aux) { + if (!var.assigned()) { bva << BoolVar(); - bva[bva.size() - 1].update(*this, f.bv_aux[i]); + bva[bva.size() - 1].update(*this, var); } } bv_aux = BoolVarArray(*this, bva); @@ -874,10 +874,10 @@ namespace Gecode { namespace FlatZinc { set_var_count = f.set_var_count; if (need_aux_vars) { SetVarArgs sva; - for (int i = 0; i < f.sv_aux.size(); i++) { - if (!f.sv_aux[i].assigned()) { + for (auto& var : f.sv_aux) { + if (!var.assigned()) { sva << SetVar(); - sva[sva.size() - 1].update(*this, f.sv_aux[i]); + sva[sva.size() - 1].update(*this, var); } } sv_aux = SetVarArray(*this, sva); @@ -888,10 +888,10 @@ namespace Gecode { namespace FlatZinc { float_var_count = f.float_var_count; if (need_aux_vars) { FloatVarArgs fva; - for (int i = 0; i < f.fv_aux.size(); i++) { - if (!f.fv_aux[i].assigned()) { + for (auto& var : f.fv_aux) { + if (!var.assigned()) { fva << FloatVar(); - fva[fva.size() - 1].update(*this, f.fv_aux[i]); + fva[fva.size() - 1].update(*this, var); } } fv_aux = FloatVarArray(*this, fva); @@ -949,9 +949,8 @@ namespace Gecode { namespace FlatZinc { if (dom.size() == 0) { fail(); return; - } else { - iv[int_var_count++] = IntVar(*this, dom); } + iv[int_var_count++] = IntVar(*this, dom); } iv_introduced[2 * (int_var_count - 1)] = vs->introduced; iv_introduced[2 * (int_var_count - 1) + 1] = vs->func_dep; @@ -1057,10 +1056,12 @@ namespace Gecode { namespace FlatZinc { void FlatZincSpace::post_constraints(std::vector& ces) { ConExprOrder ceo; - std::sort(ces.begin(), ces.end(), ceo); + // The order compares argument counts, not the pointers. + // NOLINTNEXTLINE(bugprone-nondeterministic-pointer-iteration-order) + std::ranges::sort(ces, ceo); - for (unsigned int i = 0; i < ces.size(); i++) { - const ConExpr& ce = *ces[i]; + for (auto& con : ces) { + const ConExpr& ce = *con; try { registry().post(*this, ce); } catch (Gecode::Exception& e) { @@ -1068,22 +1069,22 @@ namespace Gecode { namespace FlatZinc { } catch (AST::TypeError& e) { throw FlatZinc::Error("Type error", e.what(), ce.ann); } - delete ces[i]; - ces[i] = nullptr; + delete con; + con = nullptr; } } - void + static void flatten_annotations(AST::Array* ann, std::vector& out) { - for (unsigned int i = 0; i < ann->a.size(); i++) { - if (ann->a[i]->is_call("seq_search")) { - AST::Call* c = ann->a[i]->get_call(); + for (auto& arg : ann->a) { + if (arg->is_call("seq_search")) { + AST::Call* c = arg->get_call(); if (c->args->is_array()) flatten_annotations(c->args->get_array(), out); else out.push_back(c->args); } else { - out.push_back(ann->a[i]); + out.push_back(arg); } } } @@ -1141,31 +1142,31 @@ namespace Gecode { namespace FlatZinc { flat_ann.push_back(ann); } - for (unsigned int i = 0; i < flat_ann.size(); i++) { - if (flat_ann[i]->is_call("restart_geometric")) { - AST::Call* call = flat_ann[i]->get_call("restart_geometric"); + for (auto& flat : flat_ann) { + if (flat->is_call("restart_geometric")) { + AST::Call* call = flat->get_call("restart_geometric"); opt.restart(RESTART_GEOMETRIC); AST::Array* args = call->get_args(2); opt.restart_base(args->a[0]->get_float()); opt.restart_scale(args->a[1]->get_int()); - } else if (flat_ann[i]->is_call("restart_luby")) { - AST::Call* call = flat_ann[i]->get_call("restart_luby"); + } else if (flat->is_call("restart_luby")) { + AST::Call* call = flat->get_call("restart_luby"); opt.restart(RESTART_LUBY); opt.restart_scale(call->args->get_int()); - } else if (flat_ann[i]->is_call("restart_linear")) { - AST::Call* call = flat_ann[i]->get_call("restart_linear"); + } else if (flat->is_call("restart_linear")) { + AST::Call* call = flat->get_call("restart_linear"); opt.restart(RESTART_LINEAR); opt.restart_scale(call->args->get_int()); - } else if (flat_ann[i]->is_call("restart_constant")) { - AST::Call* call = flat_ann[i]->get_call("restart_constant"); + } else if (flat->is_call("restart_constant")) { + AST::Call* call = flat->get_call("restart_constant"); opt.restart(RESTART_CONSTANT); opt.restart_scale(call->args->get_int()); - } else if (flat_ann[i]->is_call("restart_none")) { + } else if (flat->is_call("restart_none")) { opt.restart(RESTART_NONE); - } else if (flat_ann[i]->is_call("relax_and_reconstruct")) { + } else if (flat->is_call("relax_and_reconstruct")) { if (_lns != 0) throw FlatZinc::Error("FlatZinc", "Only one relax_and_reconstruct annotation allowed"); - AST::Call* call = flat_ann[i]->get_call("relax_and_reconstruct"); + AST::Call* call = flat->get_call("relax_and_reconstruct"); AST::Array* args; if (call->args->get_array()->a.size() == 2) { args = call->get_args(2); @@ -1175,42 +1176,42 @@ namespace Gecode { namespace FlatZinc { _lns = args->a[1]->get_int(); AST::Array* vars = args->a[0]->get_array(); int k = vars->a.size(); - for (int i = vars->a.size(); i--;) - if (vars->a[i]->is_int()) + for (int flat = vars->a.size(); flat--;) + if (vars->a[flat]->is_int()) k--; iv_lns = IntVarArray(*this, k); k = 0; - for (unsigned int i = 0; i < vars->a.size(); i++) { - if (vars->a[i]->is_int()) + for (auto& var : vars->a) { + if (var->is_int()) continue; - iv_lns[k++] = iv[vars->a[i]->get_int_var()]; + iv_lns[k++] = iv[var->get_int_var()]; } if (args->a.size() == 3) { AST::Array* initial = args->a[2]->get_array(); _lns_initial_solution = IntSharedArray(initial->a.size()); - for (unsigned int i = initial->a.size(); i--;) - _lns_initial_solution[i] = initial->a[i]->get_int(); + for (unsigned int flat = initial->a.size(); flat--;) + _lns_initial_solution[flat] = initial->a[flat]->get_int(); } - } else if (flat_ann[i]->is_call("gecode_search")) { - AST::Call* c = flat_ann[i]->get_call(); + } else if (flat->is_call("gecode_search")) { + AST::Call* c = flat->get_call(); branch_with_plugin(c->args); - } else if (flat_ann[i]->is_call("int_search")) { - AST::Call* call = flat_ann[i]->get_call("int_search"); + } else if (flat->is_call("int_search")) { + AST::Call* call = flat->get_call("int_search"); AST::Array* args = call->get_args(4); AST::Array* vars = args->a[0]->get_array(); int k = vars->a.size(); - for (int i = vars->a.size(); i--;) - if (vars->a[i]->is_int()) + for (int flat = vars->a.size(); flat--;) + if (vars->a[flat]->is_int()) k--; IntVarArgs va(k); std::vector names; k = 0; - for (unsigned int i = 0; i < vars->a.size(); i++) { - if (vars->a[i]->is_int()) + for (auto& var : vars->a) { + if (var->is_int()) continue; - va[k++] = iv[vars->a[i]->get_int_var()]; - iv_searched[vars->a[i]->get_int_var()] = true; - names.push_back(vars->a[i]->get_var_name()); + va[k++] = iv[var->get_int_var()]; + iv_searched[var->get_int_var()] = true; + names.push_back(var->get_var_name()); } std::string r0, r1; { @@ -1219,40 +1220,40 @@ namespace Gecode { namespace FlatZinc { annotation_to_int_val_branch(args->a[2], r0, r1, rnd), nullptr, &var_val_print); branch_info.add(bg, r0, r1, names); } - } else if (flat_ann[i]->is_call("int_assign")) { - AST::Call* call = flat_ann[i]->get_call("int_assign"); + } else if (flat->is_call("int_assign")) { + AST::Call* call = flat->get_call("int_assign"); AST::Array* args = call->get_args(2); AST::Array* vars = args->a[0]->get_array(); int k = vars->a.size(); - for (int i = vars->a.size(); i--;) - if (vars->a[i]->is_int()) + for (int flat = vars->a.size(); flat--;) + if (vars->a[flat]->is_int()) k--; IntVarArgs va(k); k = 0; - for (unsigned int i = 0; i < vars->a.size(); i++) { - if (vars->a[i]->is_int()) + for (auto& var : vars->a) { + if (var->is_int()) continue; - va[k++] = iv[vars->a[i]->get_int_var()]; - iv_searched[vars->a[i]->get_int_var()] = true; + va[k++] = iv[var->get_int_var()]; + iv_searched[var->get_int_var()] = true; } assign(*this, va, annotation_to_int_assign(args->a[1], rnd), nullptr, &var_val_print); - } else if (flat_ann[i]->is_call("bool_search")) { - AST::Call* call = flat_ann[i]->get_call("bool_search"); + } else if (flat->is_call("bool_search")) { + AST::Call* call = flat->get_call("bool_search"); AST::Array* args = call->get_args(4); AST::Array* vars = args->a[0]->get_array(); int k = vars->a.size(); - for (int i = vars->a.size(); i--;) - if (vars->a[i]->is_bool()) + for (int flat = vars->a.size(); flat--;) + if (vars->a[flat]->is_bool()) k--; BoolVarArgs va(k); k = 0; std::vector names; - for (unsigned int i = 0; i < vars->a.size(); i++) { - if (vars->a[i]->is_bool()) + for (auto& var : vars->a) { + if (var->is_bool()) continue; - va[k++] = bv[vars->a[i]->get_bool_var()]; - bv_searched[vars->a[i]->get_bool_var()] = true; - names.push_back(vars->a[i]->get_var_name()); + va[k++] = bv[var->get_bool_var()]; + bv_searched[var->get_bool_var()] = true; + names.push_back(var->get_var_name()); } std::string r0, r1; @@ -1263,20 +1264,20 @@ namespace Gecode { namespace FlatZinc { &var_val_print); branch_info.add(bg, r0, r1, names); } - } else if (flat_ann[i]->is_call("int_default_search")) { - AST::Call* call = flat_ann[i]->get_call("int_default_search"); + } else if (flat->is_call("int_default_search")) { + AST::Call* call = flat->get_call("int_default_search"); AST::Array* args = call->get_args(2); def_int_varsel = annotation_to_int_var_branch(args->a[0], rnd, decay); def_int_valsel = annotation_to_int_val_branch(args->a[1], def_int_rel_left, def_int_rel_right, rnd); - } else if (flat_ann[i]->is_call("bool_default_search")) { - AST::Call* call = flat_ann[i]->get_call("bool_default_search"); + } else if (flat->is_call("bool_default_search")) { + AST::Call* call = flat->get_call("bool_default_search"); AST::Array* args = call->get_args(2); def_bool_varsel = annotation_to_bool_var_branch(args->a[0], rnd, decay); def_bool_valsel = annotation_to_bool_val_branch(args->a[1], def_bool_rel_left, def_bool_rel_right, rnd); - } else if (flat_ann[i]->is_call("set_search")) { + } else if (flat->is_call("set_search")) { #ifdef GECODE_HAS_SET_VARS - AST::Call* call = flat_ann[i]->get_call("set_search"); + AST::Call* call = flat->get_call("set_search"); AST::Array* args = call->get_args(4); AST::Array* vars = args->a[0]->get_array(); int k = vars->a.size(); @@ -1286,12 +1287,12 @@ namespace Gecode { namespace FlatZinc { SetVarArgs va(k); k = 0; std::vector names; - for (unsigned int i = 0; i < vars->a.size(); i++) { - if (vars->a[i]->is_set()) + for (auto& var : vars->a) { + if (var->is_set()) continue; - va[k++] = sv[vars->a[i]->get_set_var()]; - sv_searched[vars->a[i]->get_set_var()] = true; - names.push_back(vars->a[i]->get_var_name()); + va[k++] = sv[var->get_set_var()]; + sv_searched[var->get_set_var()] = true; + names.push_back(var->get_var_name()); } std::string r0, r1; { @@ -1307,9 +1308,9 @@ namespace Gecode { namespace FlatZinc { err << '\n' << std::flush; } #endif - } else if (flat_ann[i]->is_call("set_default_search")) { + } else if (flat->is_call("set_default_search")) { #ifdef GECODE_HAS_SET_VARS - AST::Call* call = flat_ann[i]->get_call("set_default_search"); + AST::Call* call = flat->get_call("set_default_search"); AST::Array* args = call->get_args(2); def_set_varsel = annotation_to_set_var_branch(args->a[0], rnd, decay); def_set_valsel = annotation_to_set_val_branch(args->a[1], def_set_rel_left, def_set_rel_right, rnd); @@ -1320,9 +1321,9 @@ namespace Gecode { namespace FlatZinc { err << '\n' << std::flush; } #endif - } else if (flat_ann[i]->is_call("float_default_search")) { + } else if (flat->is_call("float_default_search")) { #ifdef GECODE_HAS_FLOAT_VARS - AST::Call* call = flat_ann[i]->get_call("float_default_search"); + AST::Call* call = flat->get_call("float_default_search"); AST::Array* args = call->get_args(2); def_float_varsel = annotation_to_float_var_branch(args->a[0], rnd, decay); def_float_valsel = @@ -1334,9 +1335,9 @@ namespace Gecode { namespace FlatZinc { err << '\n' << std::flush; } #endif - } else if (flat_ann[i]->is_call("float_search")) { + } else if (flat->is_call("float_search")) { #ifdef GECODE_HAS_FLOAT_VARS - AST::Call* call = flat_ann[i]->get_call("float_search"); + AST::Call* call = flat->get_call("float_search"); AST::Array* args = call->get_args(5); AST::Array* vars = args->a[0]->get_array(); int k = vars->a.size(); @@ -1346,12 +1347,12 @@ namespace Gecode { namespace FlatZinc { FloatVarArgs va(k); k = 0; std::vector names; - for (unsigned int i = 0; i < vars->a.size(); i++) { - if (vars->a[i]->is_float()) + for (auto& var : vars->a) { + if (var->is_float()) continue; - va[k++] = fv[vars->a[i]->get_float_var()]; - fv_searched[vars->a[i]->get_float_var()] = true; - names.push_back(vars->a[i]->get_var_name()); + va[k++] = fv[var->get_float_var()]; + fv_searched[var->get_float_var()] = true; + names.push_back(var->get_var_name()); } std::string r0, r1; { @@ -1370,7 +1371,7 @@ namespace Gecode { namespace FlatZinc { } else { if (!ignore_unknown) { err << "Warning, ignored search annotation: "; - flat_ann[i]->print(err); + flat->print(err); err << '\n' << std::flush; } } @@ -1617,7 +1618,7 @@ namespace Gecode { namespace FlatZinc { } AST::Array* - FlatZincSpace::solve_annotations(void) const { + FlatZincSpace::solve_annotations() const { return _solve_annotations; } @@ -1643,7 +1644,7 @@ namespace Gecode { namespace FlatZinc { _solve_annotations = ann; } - FlatZincSpace::~FlatZincSpace(void) { + FlatZincSpace::~FlatZincSpace() { delete _init_data; delete _solve_annotations; } @@ -1698,7 +1699,7 @@ namespace Gecode { namespace FlatZinc { /// Use the print method of the template class S to print a space void inspect(const Space& node) override; /// Finalize when Gist exits - void finalize(void) override; + void finalize() override; }; template @@ -1714,7 +1715,7 @@ namespace Gecode { namespace FlatZinc { template void - FZPrintingInspector::finalize(void) { + FZPrintingInspector::finalize() { Gecode::Gist::TextOutput::finalize(); } @@ -1759,7 +1760,7 @@ namespace Gecode { namespace FlatZinc { : stop_object(stop_object0), black_box_context(black_box_context0) {} bool stop(const Search::Statistics& s, const Search::Options& o) override { - return black_box_context.failed() || ((stop_object.get() != nullptr) && stop_object->stop(s, o)); + return black_box_context.failed() || ((stop_object != nullptr) && stop_object->stop(s, o)); } }; @@ -1772,7 +1773,7 @@ namespace Gecode { namespace FlatZinc { if (installed) Driver::CombinedStop::install_ctrl_handler(true); } - ~InterruptHandlerGuard(void) { + ~InterruptHandlerGuard() { if (installed) Driver::CombinedStop::install_ctrl_handler(false); } @@ -1805,10 +1806,10 @@ namespace Gecode { namespace FlatZinc { } return ss.str(); } - ~FlatZincGetInfo(void) override = default; + ~FlatZincGetInfo() override = default; }; - void + static void print_int_var(std::ostream& os, const std::string& name, const Int::IntView& x) { os << "var "; if (x.assigned()) { @@ -1829,7 +1830,7 @@ namespace Gecode { namespace FlatZinc { } os << "\n"; } - void + static void print_bool_var(std::ostream& os, const std::string& name, const BoolVar& b) { os << "var bool: " << name; if (b.assigned()) @@ -1837,7 +1838,7 @@ namespace Gecode { namespace FlatZinc { os << ";\n"; } #ifdef GECODE_HAS_FLOAT_VARS - void + static void print_float_var(std::ostream& os, const std::string& name, const Float::FloatView& f) { os << "var "; if (f.assigned()) @@ -1902,7 +1903,7 @@ namespace Gecode { namespace FlatZinc { std::unique_ptr stop( Driver::CombinedStop::create(opt.node(), opt.fail(), opt.time(), opt.restart_limit(), true)); if (black_box_context) { - stop.reset(new FlatZincStop(stop.release(), black_box_context)); + stop = std::make_unique(stop.release(), black_box_context); } o.stop = stop.get(); std::unique_ptr tracer; @@ -1914,7 +1915,8 @@ namespace Gecode { namespace FlatZinc { FlatZincGetInfo* get_info = nullptr; if (opt.profiler_info()) get_info = new FlatZincGetInfo(p); - tracer.reset(new CPProfilerSearchTracer(opt.profiler_id(), opt.name(), opt.profiler_port(), get_info)); + tracer = + std::make_unique(opt.profiler_id(), opt.name(), opt.profiler_port(), get_info); o.tracer = tracer.get(); } @@ -2316,22 +2318,22 @@ namespace Gecode { namespace FlatZinc { } Space* - FlatZincSpace::copy(void) { + FlatZincSpace::copy() { return new FlatZincSpace(*this); } FlatZincSpace::Meth - FlatZincSpace::method(void) const { + FlatZincSpace::method() const { return _method; } int - FlatZincSpace::opt_var(void) const { + FlatZincSpace::opt_var() const { return _opt_var; } bool - FlatZincSpace::opt_var_is_int(void) const { + FlatZincSpace::opt_var_is_int() const { return _opt_var_is_int; } @@ -2359,14 +2361,14 @@ namespace Gecode { namespace FlatZinc { std::stringstream ss; ss << "iv[" << i << "]"; std::string result(Gecode::Gist::Comparator::compare(ss.str(), iv[i], fs.iv[i])); - if (result.length() > 0) + if (!result.empty()) out << result << '\n'; } for (int i = 0; i < bv.size(); ++i) { std::stringstream ss; ss << "bv[" << i << "]"; std::string result(Gecode::Gist::Comparator::compare(ss.str(), bv[i], fs.bv[i])); - if (result.length() > 0) + if (!result.empty()) out << result << '\n'; } #ifdef GECODE_HAS_SET_VARS @@ -2374,7 +2376,7 @@ namespace Gecode { namespace FlatZinc { std::stringstream ss; ss << "sv[" << i << "]"; std::string result(Gecode::Gist::Comparator::compare(ss.str(), sv[i], fs.sv[i])); - if (result.length() > 0) + if (!result.empty()) out << result << '\n'; } #endif @@ -2383,7 +2385,7 @@ namespace Gecode { namespace FlatZinc { std::stringstream ss; ss << "fv[" << i << "]"; std::string result(Gecode::Gist::Comparator::compare(ss.str(), fv[i], fs.fv[i])); - if (result.length() > 0) + if (!result.empty()) out << result << '\n'; } #endif @@ -2510,7 +2512,7 @@ namespace Gecode { namespace FlatZinc { IntSetArgs FlatZincSpace::arg_to_int_set_args(AST::Node* arg, int offset) { AST::Array* a = arg->get_array(); - if (a->a.size() == 0) { + if (a->a.empty()) { IntSetArgs empty_ia(0); return empty_ia; } @@ -2525,7 +2527,7 @@ namespace Gecode { namespace FlatZinc { IntVarArgs FlatZincSpace::arg_to_int_var_args(AST::Node* arg, int offset) { AST::Array* a = arg->get_array(); - if (a->a.size() == 0) { + if (a->a.empty()) { IntVarArgs empty_ia(0); return empty_ia; } @@ -2546,14 +2548,14 @@ namespace Gecode { namespace FlatZinc { BoolVarArgs FlatZincSpace::arg_to_bool_var_args(AST::Node* arg, int offset, int siv) { AST::Array* a = arg->get_array(); - if (a->a.size() == 0) { + if (a->a.empty()) { BoolVarArgs empty_ia(0); return empty_ia; } BoolVarArgs ia(a->a.size() + offset - (siv == -1 ? 0 : 1)); for (int i = offset; i--;) ia[i] = BoolVar(*this, 0, 0); - for (int i = 0; i < static_cast(a->a.size()); i++) { + for (int i = 0; std::cmp_less(i, a->a.size()); i++) { if (i == siv) continue; if (a->a[i]->is_bool()) { @@ -2592,7 +2594,7 @@ namespace Gecode { namespace FlatZinc { FlatZincSpace::is_bool_array(AST::Node* b, int& single_int) { AST::Array* a = b->get_array(); single_int = -1; - if (a->a.size() == 0) + if (a->a.empty()) return true; for (int i = a->a.size(); i--;) { if (a->a[i]->is_bool_var() || a->a[i]->is_bool()) { @@ -2649,7 +2651,7 @@ namespace Gecode { namespace FlatZinc { FloatVarArgs FlatZincSpace::arg_to_float_var_args(AST::Node* arg, int offset) { AST::Array* a = arg->get_array(); - if (a->a.size() == 0) { + if (a->a.empty()) { FloatVarArgs empty_fa(0); return empty_fa; } @@ -2689,9 +2691,9 @@ namespace Gecode { namespace FlatZinc { else if (ann->has_atom("bounds") || ann->has_atom("bounds_propagation") || ann->has_atom("boundsR") || ann->has_atom("boundsD") || ann->has_atom("boundsZ")) ipl = IPL_BND; - if (ann->has_atom("gecode_full_propagation")) + if (ann->has_atom("gecode_full_propagation")) { ipl |= IPL_FULL; - else { + } else { if (ann->has_atom("gecode_basic_propagation")) ipl |= IPL_BASIC; if (ann->has_atom("gecode_advanced_propagation")) @@ -2783,7 +2785,7 @@ namespace Gecode { namespace FlatZinc { // oss << std::scientific; oss << std::setprecision(std::numeric_limits::digits10); oss << v; - if (oss.str().find('.') == std::string::npos) + if (!oss.str().contains('.')) oss << ".0"; out << oss.str(); } else { @@ -2847,7 +2849,7 @@ namespace Gecode { namespace FlatZinc { out << k; } else if (ai->is_int_var()) { std::string res(Comparator::compare("", iv1[ai->get_int_var()], iv2[ai->get_int_var()])); - if (res.length() > 0) { + if (!res.empty()) { res.erase(0, 1); // Remove '=' out << res; } else { @@ -2855,7 +2857,7 @@ namespace Gecode { namespace FlatZinc { } } else if (ai->is_bool_var()) { std::string res(Comparator::compare("", bv1[ai->get_bool_var()], bv2[ai->get_bool_var()])); - if (res.length() > 0) { + if (!res.empty()) { res.erase(0, 1); // Remove '=' out << res; } else { @@ -2864,7 +2866,7 @@ namespace Gecode { namespace FlatZinc { #ifdef GECODE_HAS_SET_VARS } else if (ai->is_set_var()) { std::string res(Comparator::compare("", sv1[ai->get_set_var()], sv2[ai->get_set_var()])); - if (res.length() > 0) { + if (!res.empty()) { res.erase(0, 1); // Remove '=' out << res; } else { @@ -2874,7 +2876,7 @@ namespace Gecode { namespace FlatZinc { #ifdef GECODE_HAS_FLOAT_VARS } else if (ai->is_float_var()) { std::string res(Comparator::compare("", fv1[ai->get_float_var()], fv2[ai->get_float_var()])); - if (res.length() > 0) { + if (!res.empty()) { res.erase(0, 1); // Remove '=' out << res; } else { @@ -2948,8 +2950,7 @@ namespace Gecode { namespace FlatZinc { ) const { if (_output == nullptr) return; - for (unsigned int i = 0; i < _output->a.size(); i++) { - AST::Node* ai = _output->a[i]; + for (auto* ai : _output->a) { if (ai->is_array()) { AST::Array* aia = ai->get_array(); int size = aia->a.size(); @@ -2998,8 +2999,7 @@ namespace Gecode { namespace FlatZinc { ) const { if (_output == nullptr) return; - for (unsigned int i = 0; i < _output->a.size(); i++) { - AST::Node* ai = _output->a[i]; + for (auto* ai : _output->a) { if (ai->is_array()) { AST::Array* aia = ai->get_array(); int size = aia->a.size(); @@ -3060,28 +3060,28 @@ namespace Gecode { namespace FlatZinc { std::map& fv) { if (node->is_int_var()) { AST::IntVar* x = static_cast(node); - if (iv.find(x->i) == iv.end()) { + if (!iv.contains(x->i)) { int newi = iv.size(); iv[x->i] = newi; } x->i = iv[x->i]; } else if (node->is_bool_var()) { AST::BoolVar* x = static_cast(node); - if (bv.find(x->i) == bv.end()) { + if (!bv.contains(x->i)) { int newi = bv.size(); bv[x->i] = newi; } x->i = bv[x->i]; } else if (node->is_set_var()) { AST::SetVar* x = static_cast(node); - if (sv.find(x->i) == sv.end()) { + if (!sv.contains(x->i)) { int newi = sv.size(); sv[x->i] = newi; } x->i = sv[x->i]; } else if (node->is_float_var()) { AST::FloatVar* x = static_cast(node); - if (fv.find(x->i) == fv.end()) { + if (!fv.contains(x->i)) { int newi = fv.size(); fv[x->i] = newi; } @@ -3139,12 +3139,11 @@ namespace Gecode { namespace FlatZinc { opt_var = 0; } - for (unsigned int i = 0; i < _output->a.size(); i++) { - AST::Node* ai = _output->a[i]; + for (auto* ai : _output->a) { if (ai->is_array()) { AST::Array* aia = ai->get_array(); - for (unsigned int j = 0; j < aia->a.size(); j++) { - shrink_element(aia->a[j], iv_new, bv_new, sv_new, fv_new); + for (auto& j : aia->a) { + shrink_element(j, iv_new, bv_new, sv_new, fv_new); } } else { shrink_element(ai, iv_new, bv_new, sv_new, fv_new); @@ -3153,18 +3152,18 @@ namespace Gecode { namespace FlatZinc { IntVarArgs iva(iv_new.size()); std::vector iv_names_new(iv_new.size()); - for (std::map::iterator i = iv_new.begin(); i != iv_new.end(); ++i) { - iva[(*i).second] = iv[(*i).first]; - iv_names_new[(*i).second] = iv_names[(*i).first]; + for (auto& entry : iv_new) { + iva[entry.second] = iv[entry.first]; + iv_names_new[entry.second] = iv_names[entry.first]; } iv = IntVarArray(home, iva); iv_names = iv_names_new; BoolVarArgs bva(bv_new.size()); std::vector bv_names_new(bv_new.size()); - for (std::map::iterator i = bv_new.begin(); i != bv_new.end(); ++i) { - bva[(*i).second] = bv[(*i).first]; - bv_names_new[(*i).second] = bv_names[(*i).first]; + for (auto& entry : bv_new) { + bva[entry.second] = bv[entry.first]; + bv_names_new[entry.second] = bv_names[entry.first]; } bv = BoolVarArray(home, bva); bv_names = bv_names_new; @@ -3172,9 +3171,9 @@ namespace Gecode { namespace FlatZinc { #ifdef GECODE_HAS_SET_VARS SetVarArgs sva(sv_new.size()); std::vector sv_names_new(sv_new.size()); - for (std::map::iterator i = sv_new.begin(); i != sv_new.end(); ++i) { - sva[(*i).second] = sv[(*i).first]; - sv_names_new[(*i).second] = sv_names[(*i).first]; + for (auto& entry : sv_new) { + sva[entry.second] = sv[entry.first]; + sv_names_new[entry.second] = sv_names[entry.first]; } sv = SetVarArray(home, sva); sv_names = sv_names_new; @@ -3183,19 +3182,19 @@ namespace Gecode { namespace FlatZinc { #ifdef GECODE_HAS_FLOAT_VARS FloatVarArgs fva(fv_new.size()); std::vector fv_names_new(fv_new.size()); - for (std::map::iterator i = fv_new.begin(); i != fv_new.end(); ++i) { - fva[(*i).second] = fv[(*i).first]; - fv_names_new[(*i).second] = fv_names[(*i).first]; + for (auto& entry : fv_new) { + fva[entry.second] = fv[entry.first]; + fv_names_new[entry.second] = fv_names[entry.first]; } fv = FloatVarArray(home, fva); fv_names = fv_names_new; #endif } - Printer::~Printer(void) { + Printer::~Printer() { delete _output; } -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc // STATISTICS: flatzinc-any diff --git a/gecode/flatzinc/lastval.hh b/gecode/flatzinc/lastval.hh index 516d3d8766..8443c5356e 100644 --- a/gecode/flatzinc/lastval.hh +++ b/gecode/flatzinc/lastval.hh @@ -48,19 +48,19 @@ using namespace Gecode::Int; #ifdef GECODE_HAS_FLOAT_VARS -namespace Gecode { namespace Int { +namespace Gecode::Int { /// VarArg type for %Set views template <> class ViewToVarArg { public: - typedef Gecode::FloatVarArgs argtype; + using argtype = Gecode::FloatVarArgs; }; -}} // namespace Gecode::Int +} // namespace Gecode::Int #endif -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { template class LastVal : public Propagator { @@ -142,7 +142,7 @@ namespace Gecode { namespace FlatZinc { home.restart_data().last_val_int[idx] = var.val(); } }; - typedef LastVal LastValInt; + using LastValInt = LastVal; class SetBoolLastVal { public: @@ -155,7 +155,7 @@ namespace Gecode { namespace FlatZinc { home.restart_data().last_val_bool[idx] = var.val(); } }; - typedef LastVal LastValBool; + using LastValBool = LastVal; #ifdef GECODE_HAS_FLOAT_VARS class SetFloatLastVal { @@ -169,7 +169,7 @@ namespace Gecode { namespace FlatZinc { home.restart_data().last_val_float[idx] = var.val(); } }; - typedef LastVal LastValFloat; + using LastValFloat = LastVal; #endif #ifdef GECODE_HAS_SET_VARS @@ -186,10 +186,10 @@ namespace Gecode { namespace FlatZinc { home.restart_data().last_val_set[idx] = IntSet(lb); } }; - typedef LastVal LastValSet; + using LastValSet = LastVal; #endif -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc #endif //__FLATZINC_LASTVAL_HH__ diff --git a/gecode/flatzinc/lexer.lxx b/gecode/flatzinc/lexer.lxx index dee23f66f6..227bca4479 100755 --- a/gecode/flatzinc/lexer.lxx +++ b/gecode/flatzinc/lexer.lxx @@ -36,23 +36,23 @@ %option yylineno %{ -#if defined __GNUC__ +#ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wsign-compare" -#elif defined _MSC_VER +#endif +#ifdef _MSC_VER #pragma warning(push, 1) #endif -void yyerror(void*, const char*); -#define yyerror(s) yyerror(yyextra, s) - #include #include #include -bool parse_int(const char* text, int& value) { +#define yyerror(s) yyerror(yyextra, s) + +static bool parse_int(const char* text, int& value) { long int result = strtol(text,nullptr,0); if ( (result == LONG_MAX || result == LONG_MIN) && errno == ERANGE ) return false; @@ -62,7 +62,7 @@ bool parse_int(const char* text, int& value) { return true; } -int yy_input_proc(char* buf, int size, yyscan_t yyscanner); +static int yy_input_proc(char* buf, int size, yyscan_t yyscanner); #define YY_INPUT(buf, result, max_size) \ result = yy_input_proc(buf, max_size, yyscanner); %} @@ -75,28 +75,28 @@ int yy_input_proc(char* buf, int size, yyscan_t yyscanner); "true" { yylval->int_value = 1; return FZ_BOOL_LIT; } "false" { yylval->int_value = 0; return FZ_BOOL_LIT; } --?[0-9]+ { if (parse_int(yytext,yylval->int_value)) +-?[0-9]+ { + if (parse_int(yytext,yylval->int_value)) return FZ_INT_LIT; - else - yyerror(("The literal '" + std::string(yytext) + yyerror(("The literal '" + std::string(yytext) + "' of the type int is out of range (" + std::to_string(Gecode::Int::Limits::min) + ".." + std::to_string(Gecode::Int::Limits::max) + ")").c_str()); } --?0x[0-9A-Fa-f]+ { if (parse_int(yytext,yylval->int_value)) +-?0x[0-9A-Fa-f]+ { + if (parse_int(yytext,yylval->int_value)) return FZ_INT_LIT; - else - yyerror(("The literal '" + std::string(yytext) + yyerror(("The literal '" + std::string(yytext) + "' of the type int is out of range (" + std::to_string(Gecode::Int::Limits::min) + ".." + std::to_string(Gecode::Int::Limits::max) + ")").c_str()); } --?0o[0-7]+ { if (parse_int(yytext,yylval->int_value)) +-?0o[0-7]+ { + if (parse_int(yytext,yylval->int_value)) return FZ_INT_LIT; - else - yyerror(("The literal '" + std::string(yytext) + yyerror(("The literal '" + std::string(yytext) + "' of the type int is out of range (" + std::to_string(Gecode::Int::Limits::min) + ".." + std::to_string(Gecode::Int::Limits::max) @@ -156,7 +156,7 @@ _[_]*[A-Za-z][A-Za-z0-9_]* { yylval->string_value = strdup(yytext); return FZ_U_ return FZ_STRING_LIT; } . { yyerror("Unknown character"); } %% -int yy_input_proc(char* buf, int size, yyscan_t yyscanner) { +static int yy_input_proc(char* buf, int size, yyscan_t yyscanner) { Gecode::FlatZinc::ParserState* parm = static_cast(yyget_extra(yyscanner)); return parm->fill_buffer(buf, size); diff --git a/gecode/flatzinc/lexer.yy.cpp b/gecode/flatzinc/lexer.yy.cpp index afe613bbc0..bc3b5ebfd3 100644 --- a/gecode/flatzinc/lexer.yy.cpp +++ b/gecode/flatzinc/lexer.yy.cpp @@ -630,23 +630,23 @@ static const flex_int32_t yy_rule_can_match_eol[57] = * */ #line 39 "./gecode/flatzinc/lexer.lxx" -#if defined __GNUC__ +#ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wsign-compare" -#elif defined _MSC_VER +#endif +#ifdef _MSC_VER #pragma warning(push, 1) #endif -void yyerror(void*, const char*); -#define yyerror(s) yyerror(yyextra, s) - #include #include #include -bool parse_int(const char* text, int& value) { +#define yyerror(s) yyerror(yyextra, s) + +static bool parse_int(const char* text, int& value) { long int result = strtol(text,nullptr,0); if ( (result == LONG_MAX || result == LONG_MIN) && errno == ERANGE ) return false; @@ -656,7 +656,7 @@ bool parse_int(const char* text, int& value) { return true; } -int yy_input_proc(char* buf, int size, yyscan_t yyscanner); +static int yy_input_proc(char* buf, int size, yyscan_t yyscanner); #define YY_INPUT(buf, result, max_size) \ result = yy_input_proc(buf, max_size, yyscanner); #line 662 "gecode/flatzinc/lexer.yy.cpp" @@ -1035,10 +1035,10 @@ YY_RULE_SETUP case 6: YY_RULE_SETUP #line 78 "./gecode/flatzinc/lexer.lxx" -{ if (parse_int(yytext,yylval->int_value)) +{ + if (parse_int(yytext,yylval->int_value)) return FZ_INT_LIT; - else - yyerror(("The literal '" + std::string(yytext) + yyerror(("The literal '" + std::string(yytext) + "' of the type int is out of range (" + std::to_string(Gecode::Int::Limits::min) + ".." + std::to_string(Gecode::Int::Limits::max) @@ -1048,10 +1048,10 @@ YY_RULE_SETUP case 7: YY_RULE_SETUP #line 87 "./gecode/flatzinc/lexer.lxx" -{ if (parse_int(yytext,yylval->int_value)) +{ + if (parse_int(yytext,yylval->int_value)) return FZ_INT_LIT; - else - yyerror(("The literal '" + std::string(yytext) + yyerror(("The literal '" + std::string(yytext) + "' of the type int is out of range (" + std::to_string(Gecode::Int::Limits::min) + ".." + std::to_string(Gecode::Int::Limits::max) @@ -1061,10 +1061,10 @@ YY_RULE_SETUP case 8: YY_RULE_SETUP #line 96 "./gecode/flatzinc/lexer.lxx" -{ if (parse_int(yytext,yylval->int_value)) +{ + if (parse_int(yytext,yylval->int_value)) return FZ_INT_LIT; - else - yyerror(("The literal '" + std::string(yytext) + yyerror(("The literal '" + std::string(yytext) + "' of the type int is out of range (" + std::to_string(Gecode::Int::Limits::min) + ".." + std::to_string(Gecode::Int::Limits::max) @@ -2511,7 +2511,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) #line 158 "./gecode/flatzinc/lexer.lxx" -int yy_input_proc(char* buf, int size, yyscan_t yyscanner) { +static int yy_input_proc(char* buf, int size, yyscan_t yyscanner) { Gecode::FlatZinc::ParserState* parm = static_cast(yyget_extra(yyscanner)); return parm->fill_buffer(buf, size); diff --git a/gecode/flatzinc/option.hh b/gecode/flatzinc/option.hh index bd3e3b3d25..70030be61b 100644 --- a/gecode/flatzinc/option.hh +++ b/gecode/flatzinc/option.hh @@ -33,7 +33,7 @@ #ifndef FLATZINC_OPTION_HH #define FLATZINC_OPTION_HH -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { /// Optional value template @@ -44,19 +44,19 @@ namespace Gecode { namespace FlatZinc { public: bool - operator()(void) const { + operator()() const { return _some; } const Val& - some(void) const { + some() const { return _v; } Val& - some(void) { + some() { return _v; } static Option - none(void) { + none() { Option o; o._some = false; new (&o._v) Val(); @@ -71,7 +71,7 @@ namespace Gecode { namespace FlatZinc { } }; -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc #endif diff --git a/gecode/flatzinc/parser.hh b/gecode/flatzinc/parser.hh index 13d9a66123..c7fbec4ec1 100644 --- a/gecode/flatzinc/parser.hh +++ b/gecode/flatzinc/parser.hh @@ -37,7 +37,7 @@ // This is a workaround for a bug in flex that only shows up // with the Microsoft C++ compiler -#if defined(_MSC_VER) +#ifdef _MSC_VER #define YY_NO_UNISTD_H #ifdef __cplusplus extern "C" int isatty(int); @@ -46,7 +46,7 @@ extern "C" int isatty(int); // The Microsoft C++ compiler marks certain functions as deprecated, // so let's take the alternative definitions -#if defined(_MSC_VER) +#ifdef _MSC_VER #define strdup _strdup #define fileno _fileno #endif @@ -64,10 +64,10 @@ extern "C" int isatty(int); #include #include -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { class VarSpec; - typedef std::pair NamedVarSpec; + using NamedVarSpec = std::pair; /// Strict weak ordering for output items class OutputOrder { @@ -107,7 +107,7 @@ namespace Gecode { namespace FlatZinc { int i; //< Value of entry or array start index /// Default constructor // NOLINTNEXTLINE(modernize-use-equals-default) - SymbolEntry(void) {} + SymbolEntry() {} /// Constructor SymbolEntry(SymbolType t0, int i0) : t(t0), i(i0) {} }; @@ -202,10 +202,10 @@ namespace Gecode { namespace FlatZinc { ParserState(const std::string& b, std::ostream& err0, Gecode::FlatZinc::FlatZincSpace* fg0) : yyscanner(nullptr), buf(b.c_str()), pos(0), length(b.size()), fg(fg0), had_error(false), err(err0) {} - ParserState(char* buf0, int length0, std::ostream& err0, Gecode::FlatZinc::FlatZincSpace* fg0) + ParserState(const char* buf0, int length0, std::ostream& err0, Gecode::FlatZinc::FlatZincSpace* fg0) : yyscanner(nullptr), buf(buf0), pos(0), length(length0), fg(fg0), had_error(false), err(err0) {} - ~ParserState(void); + ~ParserState(); void* yyscanner; const char* buf; @@ -262,30 +262,33 @@ namespace Gecode { namespace FlatZinc { } AST::Array* - get_output(void) { + get_output() { OutputOrder oo; - std::sort(output_items.begin(), output_items.end(), oo); + std::ranges::sort(output_items, oo); AST::Array* a = new AST::Array(); - for (unsigned int i = 0; i < output_items.size(); i++) { - a->a.push_back(new AST::String(output_items[i].first + " = ")); - if (output_items[i].second->is_array()) { - AST::Array* oa = output_items[i].second->get_array(); - for (unsigned int j = 0; j < oa->a.size(); j++) { - a->a.push_back(oa->a[j]); - oa->a[j] = nullptr; + for (std::pair& item : output_items) { + a->a.push_back(new AST::String(item.first + " = ")); + if (item.second->is_array()) { + AST::Array* oa = item.second->get_array(); + for (AST::Node*& element : oa->a) { + a->a.push_back(element); + element = nullptr; } - delete output_items[i].second; + delete item.second; } else { - a->a.push_back(output_items[i].second); + a->a.push_back(item.second); } - output_items[i].second = nullptr; + item.second = nullptr; a->a.push_back(new AST::String(";\n")); } return a; } }; -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc + +/// Report error \a str for the parser state \a parm, called by the lexer too +void yyerror(void* parm, const char* str); #endif diff --git a/gecode/flatzinc/parser.tab.cpp b/gecode/flatzinc/parser.tab.cpp index 7bc2b155ce..a199207619 100644 --- a/gecode/flatzinc/parser.tab.cpp +++ b/gecode/flatzinc/parser.tab.cpp @@ -79,7 +79,7 @@ #include #include -#if defined __GNUC__ +#ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wunused-but-set-variable" #endif @@ -115,7 +115,7 @@ void yyerror(void* parm, const char *str) { pp->had_error = true; } -void yyassert(ParserState* pp, bool cond, const char* str) +static void yyassert(ParserState* pp, bool cond, const char* str) { if (!cond) { pp->err << "Error: " << str @@ -125,12 +125,17 @@ void yyassert(ParserState* pp, bool cond, const char* str) } } +/// Free a string token, which the lexer allocates with strdup +static void free_token(char* s) { + free(s); // NOLINT(cppcoreguidelines-no-malloc): strdup memory needs free +} + /* * The symbol tables * */ -AST::Node* get_array_element(ParserState* pp, const string& id, int offset, +static AST::Node* get_array_element(ParserState* pp, const string& id, int offset, bool annotation) { if (offset > 0) { SymbolEntry e; @@ -208,7 +213,7 @@ AST::Node* get_array_element(ParserState* pp, const string& id, int offset, pp->had_error = true; return new AST::IntVar(0); // keep things consistent } -AST::Node* get_var_ref_arg(ParserState* pp, const string& id, bool annotation = false) { +static AST::Node* get_var_ref_arg(ParserState* pp, const string& id, bool annotation = false) { SymbolEntry e; string n; if (annotation) @@ -232,7 +237,7 @@ AST::Node* get_var_ref_arg(ParserState* pp, const string& id, bool annotation = return new AST::IntVar(0); // keep things consistent } -void add_domain_constraint(ParserState* pp, const std::string& id, AST::Node* var, +static void add_domain_constraint(ParserState* pp, const std::string& id, AST::Node* var, Option& dom) { if (!dom()) return; @@ -242,7 +247,7 @@ void add_domain_constraint(ParserState* pp, const std::string& id, AST::Node* va pp->domain_constraints.push_back(new ConExpr(id, args, nullptr)); } -void add_domain_constraint(ParserState* pp, AST::Node* var, +static void add_domain_constraint(ParserState* pp, AST::Node* var, Option* > dom) { if (!dom()) return; @@ -262,7 +267,7 @@ void add_domain_constraint(ParserState* pp, AST::Node* var, delete dom.some(); } -int get_base_int_var(ParserState* pp, int i) { +static int get_base_int_var(ParserState* pp, int i) { int base = i; IntVarSpec* ivs = static_cast(pp->int_vars[base].second); while (ivs->alias) { @@ -271,7 +276,7 @@ int get_base_int_var(ParserState* pp, int i) { } return base; } -int get_base_bool_var(ParserState* pp, int i) { +static int get_base_bool_var(ParserState* pp, int i) { int base = i; BoolVarSpec* ivs = static_cast(pp->bool_vars[base].second); while (ivs->alias) { @@ -280,7 +285,7 @@ int get_base_bool_var(ParserState* pp, int i) { } return base; } -int get_base_float_var(ParserState* pp, int i) { +static int get_base_float_var(ParserState* pp, int i) { int base = i; FloatVarSpec* ivs = static_cast(pp->float_vars[base].second); while (ivs->alias) { @@ -289,7 +294,7 @@ int get_base_float_var(ParserState* pp, int i) { } return base; } -int get_base_set_var(ParserState* pp, int i) { +static int get_base_set_var(ParserState* pp, int i) { int base = i; SetVarSpec* ivs = static_cast(pp->set_vars[base].second); while (ivs->alias) { @@ -304,7 +309,7 @@ int get_base_set_var(ParserState* pp, int i) { * */ -void initialize_space(ParserState* pp) { +static void initialize_space(ParserState* pp) { if (!pp->had_error) pp->fg->init(pp->int_vars.size(), pp->bool_vars.size(), @@ -501,7 +506,7 @@ void initialize_space(ParserState* pp) { } } -void fill_printer(ParserState& pp, Gecode::FlatZinc::Printer& p) { +static void fill_printer(ParserState& pp, Gecode::FlatZinc::Printer& p) { p.init(pp.get_output()); for (unsigned int i=0; iargs->is_array()) { @@ -541,13 +546,13 @@ AST::Node* array_output(AST::Call* ann) { std::ostringstream oss; oss << "array" << a->a.size() << "d("; - for (unsigned int i=0; ia.size(); i++) { - AST::SetLit* s = a->a[i]->get_set(); - if (s->empty()) + for (AST::Node* element : a->a) { + AST::SetLit* s = element->get_set(); + if (s->empty()) { oss << "{}, "; - else if (s->interval) + } else if (s->interval) { oss << s->min << ".." << s->max << ", "; - else { + } else { oss << "{"; for (unsigned int j=0; js.size(); j++) { oss << s->s[j]; @@ -570,9 +575,9 @@ AST::Node* array_output(AST::Call* ann) { * */ -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { - ParserState::~ParserState(void) { + ParserState::~ParserState() { if (yyscanner) yylex_destroy(yyscanner); for (auto& var : int_vars) @@ -618,7 +623,7 @@ namespace Gecode { namespace FlatZinc { std::unique_ptr mapping(data,unmap); if (fzs == nullptr) { - owned.reset(new FlatZincSpace(rnd)); + owned = std::make_unique(rnd); fzs = owned.get(); } ParserState pp(mapping.get(), sbuf.st_size, err, fzs); @@ -632,7 +637,7 @@ namespace Gecode { namespace FlatZinc { std::string s = string(istreambuf_iterator(file), istreambuf_iterator()); if (fzs == nullptr) { - owned.reset(new FlatZincSpace(rnd)); + owned = std::make_unique(rnd); fzs = owned.get(); } ParserState pp(s, err, fzs); @@ -656,7 +661,7 @@ namespace Gecode { namespace FlatZinc { std::unique_ptr owned; if (fzs == nullptr) { - owned.reset(new FlatZincSpace(rnd)); + owned = std::make_unique(rnd); fzs = owned.get(); } ParserState pp(s, err, fzs); @@ -672,10 +677,10 @@ namespace Gecode { namespace FlatZinc { return pp.fg; } -}} +} // namespace Gecode::FlatZinc -#line 679 "gecode/flatzinc/parser.tab.cpp" +#line 684 "gecode/flatzinc/parser.tab.cpp" # ifndef YY_CAST # ifdef __cplusplus @@ -1219,23 +1224,23 @@ static const yytype_int8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_int16 yyrline[] = { - 0, 746, 746, 748, 750, 753, 754, 756, 758, 761, - 762, 764, 766, 769, 770, 777, 780, 782, 785, 786, - 789, 793, 794, 795, 796, 799, 801, 803, 804, 807, - 808, 811, 812, 818, 818, 821, 853, 885, 924, 957, - 966, 976, 985, 997, 1068, 1135, 1207, 1276, 1297, 1317, - 1337, 1360, 1364, 1379, 1403, 1404, 1408, 1410, 1413, 1413, - 1415, 1419, 1421, 1436, 1459, 1460, 1464, 1466, 1470, 1474, - 1476, 1491, 1514, 1515, 1519, 1521, 1524, 1527, 1529, 1544, - 1567, 1568, 1572, 1574, 1577, 1582, 1583, 1588, 1589, 1594, - 1595, 1600, 1601, 1605, 1780, 1794, 1819, 1821, 1823, 1829, - 1831, 1844, 1846, 1855, 1857, 1864, 1865, 1869, 1871, 1876, - 1877, 1881, 1883, 1888, 1889, 1893, 1895, 1900, 1901, 1905, - 1907, 1915, 1917, 1921, 1923, 1928, 1929, 1933, 1935, 1937, - 1939, 1941, 2037, 2052, 2053, 2057, 2059, 2067, 2101, 2108, - 2115, 2141, 2142, 2150, 2151, 2155, 2157, 2161, 2165, 2169, - 2171, 2175, 2177, 2179, 2182, 2182, 2185, 2187, 2189, 2191, - 2193, 2299, 2311 + 0, 751, 751, 753, 755, 758, 759, 761, 763, 766, + 767, 769, 771, 774, 775, 782, 785, 787, 790, 791, + 794, 798, 799, 800, 801, 804, 806, 808, 809, 812, + 813, 816, 817, 823, 823, 826, 858, 890, 929, 962, + 971, 981, 990, 1002, 1073, 1140, 1212, 1281, 1302, 1322, + 1342, 1365, 1369, 1384, 1408, 1409, 1413, 1415, 1418, 1418, + 1420, 1424, 1426, 1441, 1464, 1465, 1469, 1471, 1475, 1479, + 1481, 1496, 1519, 1520, 1524, 1526, 1529, 1532, 1534, 1549, + 1572, 1573, 1577, 1579, 1582, 1587, 1588, 1593, 1594, 1599, + 1600, 1605, 1606, 1610, 1785, 1799, 1824, 1826, 1828, 1834, + 1836, 1849, 1851, 1860, 1862, 1869, 1870, 1874, 1876, 1881, + 1882, 1886, 1888, 1893, 1894, 1898, 1900, 1905, 1906, 1910, + 1912, 1920, 1922, 1926, 1928, 1933, 1934, 1938, 1940, 1942, + 1944, 1946, 2042, 2057, 2058, 2062, 2064, 2072, 2106, 2113, + 2120, 2146, 2147, 2155, 2156, 2160, 2162, 2166, 2170, 2174, + 2176, 2180, 2182, 2184, 2187, 2187, 2190, 2192, 2194, 2196, + 2198, 2304, 2316 }; #endif @@ -2317,31 +2322,31 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); switch (yyn) { case 15: /* preddecl_item: FZ_PREDICATE FZ_ID '(' pred_arg_list ')' */ -#line 778 "./gecode/flatzinc/parser.yxx" - { free((yyvsp[-3].string_value)); } -#line 2323 "gecode/flatzinc/parser.tab.cpp" +#line 783 "./gecode/flatzinc/parser.yxx" + { free_token((yyvsp[-3].string_value)); } +#line 2328 "gecode/flatzinc/parser.tab.cpp" break; case 20: /* pred_arg: pred_arg_type ':' FZ_ID */ -#line 790 "./gecode/flatzinc/parser.yxx" - { free((yyvsp[0].string_value)); } -#line 2329 "gecode/flatzinc/parser.tab.cpp" +#line 795 "./gecode/flatzinc/parser.yxx" + { free_token((yyvsp[0].string_value)); } +#line 2334 "gecode/flatzinc/parser.tab.cpp" break; case 25: /* pred_arg_simple_type: int_ti_expr_tail */ -#line 800 "./gecode/flatzinc/parser.yxx" +#line 805 "./gecode/flatzinc/parser.yxx" { if ((yyvsp[0].optional_set)()) delete (yyvsp[0].optional_set).some(); } -#line 2335 "gecode/flatzinc/parser.tab.cpp" +#line 2340 "gecode/flatzinc/parser.tab.cpp" break; case 26: /* pred_arg_simple_type: FZ_SET FZ_OF int_ti_expr_tail */ -#line 802 "./gecode/flatzinc/parser.yxx" +#line 807 "./gecode/flatzinc/parser.yxx" { if ((yyvsp[0].optional_set)()) delete (yyvsp[0].optional_set).some(); } -#line 2341 "gecode/flatzinc/parser.tab.cpp" +#line 2346 "gecode/flatzinc/parser.tab.cpp" break; case 35: /* vardecl_item: FZ_VAR int_ti_expr_tail ':' var_par_id annotations non_array_expr_opt */ -#line 822 "./gecode/flatzinc/parser.yxx" +#line 827 "./gecode/flatzinc/parser.yxx" { ParserState* pp = static_cast(parm); bool print = (yyvsp[-1].arg_nodes) != nullptr && (yyvsp[-1].arg_nodes)->has_atom("output_var"); @@ -2371,13 +2376,13 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); pp->int_vars.push_back(NamedVarSpec((yyvsp[-2].string_value), new IntVarSpec((yyvsp[-4].optional_set),!print,func_dep))); } - delete (yyvsp[-1].arg_nodes); free((yyvsp[-2].string_value)); + delete (yyvsp[-1].arg_nodes); free_token((yyvsp[-2].string_value)); } -#line 2377 "gecode/flatzinc/parser.tab.cpp" +#line 2382 "gecode/flatzinc/parser.tab.cpp" break; case 36: /* vardecl_item: FZ_VAR bool_ti_expr_tail ':' var_par_id annotations non_array_expr_opt */ -#line 854 "./gecode/flatzinc/parser.yxx" +#line 859 "./gecode/flatzinc/parser.yxx" { ParserState* pp = static_cast(parm); bool print = (yyvsp[-1].arg_nodes) != nullptr && (yyvsp[-1].arg_nodes)->has_atom("output_var"); @@ -2407,13 +2412,13 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); pp->bool_vars.push_back(NamedVarSpec((yyvsp[-2].string_value), new BoolVarSpec((yyvsp[-4].optional_set),!print,func_dep))); } - delete (yyvsp[-1].arg_nodes); free((yyvsp[-2].string_value)); + delete (yyvsp[-1].arg_nodes); free_token((yyvsp[-2].string_value)); } -#line 2413 "gecode/flatzinc/parser.tab.cpp" +#line 2418 "gecode/flatzinc/parser.tab.cpp" break; case 37: /* vardecl_item: FZ_VAR float_ti_expr_tail ':' var_par_id annotations non_array_expr_opt */ -#line 886 "./gecode/flatzinc/parser.yxx" +#line 891 "./gecode/flatzinc/parser.yxx" { ParserState* pp = static_cast(parm); bool print = (yyvsp[-1].arg_nodes) != nullptr && (yyvsp[-1].arg_nodes)->has_atom("output_var"); @@ -2450,13 +2455,13 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); pp->float_vars.push_back(NamedVarSpec((yyvsp[-2].string_value), new FloatVarSpec(dom,!print,func_dep))); } - delete (yyvsp[-1].arg_nodes); free((yyvsp[-2].string_value)); + delete (yyvsp[-1].arg_nodes); free_token((yyvsp[-2].string_value)); } -#line 2456 "gecode/flatzinc/parser.tab.cpp" +#line 2461 "gecode/flatzinc/parser.tab.cpp" break; case 38: /* vardecl_item: FZ_VAR FZ_SET FZ_OF int_ti_expr_tail ':' var_par_id annotations non_array_expr_opt */ -#line 925 "./gecode/flatzinc/parser.yxx" +#line 930 "./gecode/flatzinc/parser.yxx" { ParserState* pp = static_cast(parm); bool print = (yyvsp[-1].arg_nodes) != nullptr && (yyvsp[-1].arg_nodes)->has_atom("output_var"); @@ -2487,26 +2492,26 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); pp->set_vars.push_back(NamedVarSpec((yyvsp[-2].string_value), new SetVarSpec((yyvsp[-4].optional_set),!print,func_dep))); } - delete (yyvsp[-1].arg_nodes); free((yyvsp[-2].string_value)); + delete (yyvsp[-1].arg_nodes); free_token((yyvsp[-2].string_value)); } -#line 2493 "gecode/flatzinc/parser.tab.cpp" +#line 2498 "gecode/flatzinc/parser.tab.cpp" break; case 39: /* vardecl_item: FZ_INT ':' var_par_id annotations '=' non_array_expr */ -#line 958 "./gecode/flatzinc/parser.yxx" +#line 963 "./gecode/flatzinc/parser.yxx" { ParserState* pp = static_cast(parm); yyassert(pp, (yyvsp[0].arg)->is_int(), "Invalid int initializer"); yyassert(pp, pp->symbols.put((yyvsp[-3].string_value), se_i((yyvsp[0].arg)->get_int())), "Duplicate symbol"); - delete (yyvsp[0].arg); delete (yyvsp[-2].arg_nodes); free((yyvsp[-3].string_value)); + delete (yyvsp[0].arg); delete (yyvsp[-2].arg_nodes); free_token((yyvsp[-3].string_value)); } -#line 2506 "gecode/flatzinc/parser.tab.cpp" +#line 2511 "gecode/flatzinc/parser.tab.cpp" break; case 40: /* vardecl_item: FZ_FLOAT ':' var_par_id annotations '=' non_array_expr */ -#line 967 "./gecode/flatzinc/parser.yxx" +#line 972 "./gecode/flatzinc/parser.yxx" { ParserState* pp = static_cast(parm); yyassert(pp, (yyvsp[0].arg)->is_float(), "Invalid float initializer"); @@ -2514,26 +2519,26 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyassert(pp, pp->symbols.put((yyvsp[-3].string_value), se_f(pp->float_values.size()-1)), "Duplicate symbol"); - delete (yyvsp[0].arg); delete (yyvsp[-2].arg_nodes); free((yyvsp[-3].string_value)); + delete (yyvsp[0].arg); delete (yyvsp[-2].arg_nodes); free_token((yyvsp[-3].string_value)); } -#line 2520 "gecode/flatzinc/parser.tab.cpp" +#line 2525 "gecode/flatzinc/parser.tab.cpp" break; case 41: /* vardecl_item: FZ_BOOL ':' var_par_id annotations '=' non_array_expr */ -#line 977 "./gecode/flatzinc/parser.yxx" +#line 982 "./gecode/flatzinc/parser.yxx" { ParserState* pp = static_cast(parm); yyassert(pp, (yyvsp[0].arg)->is_bool(), "Invalid bool initializer"); yyassert(pp, pp->symbols.put((yyvsp[-3].string_value), se_b((yyvsp[0].arg)->get_bool())), "Duplicate symbol"); - delete (yyvsp[0].arg); delete (yyvsp[-2].arg_nodes); free((yyvsp[-3].string_value)); + delete (yyvsp[0].arg); delete (yyvsp[-2].arg_nodes); free_token((yyvsp[-3].string_value)); } -#line 2533 "gecode/flatzinc/parser.tab.cpp" +#line 2538 "gecode/flatzinc/parser.tab.cpp" break; case 42: /* vardecl_item: FZ_SET FZ_OF FZ_INT ':' var_par_id annotations '=' non_array_expr */ -#line 986 "./gecode/flatzinc/parser.yxx" +#line 991 "./gecode/flatzinc/parser.yxx" { ParserState* pp = static_cast(parm); yyassert(pp, (yyvsp[0].arg)->is_set(), "Invalid set initializer"); @@ -2543,13 +2548,13 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); pp->symbols.put((yyvsp[-3].string_value), se_s(pp->set_values.size()-1)), "Duplicate symbol"); delete set; - delete (yyvsp[-2].arg_nodes); free((yyvsp[-3].string_value)); + delete (yyvsp[-2].arg_nodes); free_token((yyvsp[-3].string_value)); } -#line 2549 "gecode/flatzinc/parser.tab.cpp" +#line 2554 "gecode/flatzinc/parser.tab.cpp" break; case 43: /* vardecl_item: FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_VAR int_ti_expr_tail ':' var_par_id annotations vardecl_int_var_array_init */ -#line 999 "./gecode/flatzinc/parser.yxx" +#line 1004 "./gecode/flatzinc/parser.yxx" { ParserState* pp = static_cast(parm); yyassert(pp, (yyvsp[-10].int_value)==1, "Arrays must start at 1"); @@ -2573,7 +2578,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); if (print) ivsv->introduced = false; vars[i] = pp->int_vars.size(); - pp->int_vars.push_back(NamedVarSpec((yyvsp[-2].string_value), ivsv)); + pp->int_vars.emplace_back((yyvsp[-2].string_value), ivsv); } if (!pp->had_error && (yyvsp[-4].optional_set)()) { Option opt = @@ -2593,7 +2598,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); : Option::none(); IntVarSpec* ispec = new IntVarSpec(dom,!print,false); vars[i] = pp->int_vars.size(); - pp->int_vars.push_back(NamedVarSpec((yyvsp[-2].string_value), ispec)); + pp->int_vars.emplace_back((yyvsp[-2].string_value), ispec); } } } @@ -2610,20 +2615,20 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); } int iva = pp->arrays.size(); pp->arrays.push_back(vars.size()); - for (unsigned int i=0; iarrays.push_back(vars[i]); + for (int v : vars) + pp->arrays.push_back(v); yyassert(pp, pp->symbols.put((yyvsp[-2].string_value), se_iva(iva)), "Duplicate symbol"); } if ((yyvsp[-4].optional_set)()) delete (yyvsp[-4].optional_set).some(); - delete (yyvsp[-1].arg_nodes); free((yyvsp[-2].string_value)); + delete (yyvsp[-1].arg_nodes); free_token((yyvsp[-2].string_value)); } -#line 2623 "gecode/flatzinc/parser.tab.cpp" +#line 2628 "gecode/flatzinc/parser.tab.cpp" break; case 44: /* vardecl_item: FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_VAR bool_ti_expr_tail ':' var_par_id annotations vardecl_bool_var_array_init */ -#line 1070 "./gecode/flatzinc/parser.yxx" +#line 1075 "./gecode/flatzinc/parser.yxx" { ParserState* pp = static_cast(parm); bool print = (yyvsp[-1].arg_nodes) != nullptr && (yyvsp[-1].arg_nodes)->has_call("output_array"); @@ -2646,7 +2651,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); if (print) bvsv->introduced = false; vars[i] = pp->bool_vars.size(); - pp->bool_vars.push_back(NamedVarSpec((yyvsp[-2].string_value), (*vsv)[i])); + pp->bool_vars.emplace_back((yyvsp[-2].string_value), (*vsv)[i]); } if (!pp->had_error && (yyvsp[-4].optional_set)()) { Option opt = @@ -2680,20 +2685,20 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); } int bva = pp->arrays.size(); pp->arrays.push_back(vars.size()); - for (unsigned int i=0; iarrays.push_back(vars[i]); + for (int v : vars) + pp->arrays.push_back(v); yyassert(pp, pp->symbols.put((yyvsp[-2].string_value), se_bva(bva)), "Duplicate symbol"); } if ((yyvsp[-4].optional_set)()) delete (yyvsp[-4].optional_set).some(); - delete (yyvsp[-1].arg_nodes); free((yyvsp[-2].string_value)); + delete (yyvsp[-1].arg_nodes); free_token((yyvsp[-2].string_value)); } -#line 2693 "gecode/flatzinc/parser.tab.cpp" +#line 2698 "gecode/flatzinc/parser.tab.cpp" break; case 45: /* vardecl_item: FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_VAR float_ti_expr_tail ':' var_par_id annotations vardecl_float_var_array_init */ -#line 1138 "./gecode/flatzinc/parser.yxx" +#line 1143 "./gecode/flatzinc/parser.yxx" { ParserState* pp = static_cast(parm); yyassert(pp, (yyvsp[-10].int_value)==1, "Arrays must start at 1"); @@ -2717,7 +2722,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); if (print) ivsv->introduced = false; vars[i] = pp->float_vars.size(); - pp->float_vars.push_back(NamedVarSpec((yyvsp[-2].string_value), ivsv)); + pp->float_vars.emplace_back((yyvsp[-2].string_value), ivsv); } if (!pp->had_error && (yyvsp[-4].optional_float_bounds)()) { Option*> opt = @@ -2737,7 +2742,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); for (int i=0; i<(yyvsp[-8].int_value); i++) { FloatVarSpec* ispec = new FloatVarSpec(dom,!print,false); vars[i] = pp->float_vars.size(); - pp->float_vars.push_back(NamedVarSpec((yyvsp[-2].string_value), ispec)); + pp->float_vars.emplace_back((yyvsp[-2].string_value), ispec); } } } @@ -2754,20 +2759,20 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); } int fva = pp->arrays.size(); pp->arrays.push_back(vars.size()); - for (unsigned int i=0; iarrays.push_back(vars[i]); + for (int v : vars) + pp->arrays.push_back(v); yyassert(pp, pp->symbols.put((yyvsp[-2].string_value), se_fva(fva)), "Duplicate symbol"); } if ((yyvsp[-4].optional_float_bounds)()) delete (yyvsp[-4].optional_float_bounds).some(); - delete (yyvsp[-1].arg_nodes); free((yyvsp[-2].string_value)); + delete (yyvsp[-1].arg_nodes); free_token((yyvsp[-2].string_value)); } -#line 2767 "gecode/flatzinc/parser.tab.cpp" +#line 2772 "gecode/flatzinc/parser.tab.cpp" break; case 46: /* vardecl_item: FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_VAR FZ_SET FZ_OF int_ti_expr_tail ':' var_par_id annotations vardecl_set_var_array_init */ -#line 1209 "./gecode/flatzinc/parser.yxx" +#line 1214 "./gecode/flatzinc/parser.yxx" { ParserState* pp = static_cast(parm); bool print = (yyvsp[-1].arg_nodes) != nullptr && (yyvsp[-1].arg_nodes)->has_call("output_array"); @@ -2790,7 +2795,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); if (print) svsv->introduced = false; vars[i] = pp->set_vars.size(); - pp->set_vars.push_back(NamedVarSpec((yyvsp[-2].string_value), (*vsv)[i])); + pp->set_vars.emplace_back((yyvsp[-2].string_value), (*vsv)[i]); } if (!pp->had_error && (yyvsp[-4].optional_set)()) { Option opt = @@ -2810,7 +2815,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); : Option::none(); SetVarSpec* ispec = new SetVarSpec(dom,!print,false); vars[i] = pp->set_vars.size(); - pp->set_vars.push_back(NamedVarSpec((yyvsp[-2].string_value), ispec)); + pp->set_vars.emplace_back((yyvsp[-2].string_value), ispec); } } } @@ -2826,20 +2831,20 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); } int sva = pp->arrays.size(); pp->arrays.push_back(vars.size()); - for (unsigned int i=0; iarrays.push_back(vars[i]); + for (int v : vars) + pp->arrays.push_back(v); yyassert(pp, pp->symbols.put((yyvsp[-2].string_value), se_sva(sva)), "Duplicate symbol"); } if ((yyvsp[-4].optional_set)()) delete (yyvsp[-4].optional_set).some(); - delete (yyvsp[-1].arg_nodes); free((yyvsp[-2].string_value)); + delete (yyvsp[-1].arg_nodes); free_token((yyvsp[-2].string_value)); } -#line 2839 "gecode/flatzinc/parser.tab.cpp" +#line 2844 "gecode/flatzinc/parser.tab.cpp" break; case 47: /* vardecl_item: FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_INT ':' var_par_id annotations '=' '[' int_list ']' */ -#line 1278 "./gecode/flatzinc/parser.yxx" +#line 1283 "./gecode/flatzinc/parser.yxx" { ParserState* pp = static_cast(parm); yyassert(pp, (yyvsp[-12].int_value)==1, "Arrays must start at 1"); @@ -2849,21 +2854,21 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); if (!pp->had_error) { int ia = pp->arrays.size(); pp->arrays.push_back((yyvsp[-1].set_values)->size()); - for (unsigned int i=0; i<(yyvsp[-1].set_values)->size(); i++) - pp->arrays.push_back((*(yyvsp[-1].set_values))[i]); + for (int v : *(yyvsp[-1].set_values)) + pp->arrays.push_back(v); yyassert(pp, pp->symbols.put((yyvsp[-5].string_value), se_ia(ia)), "Duplicate symbol"); } delete (yyvsp[-1].set_values); - free((yyvsp[-5].string_value)); + free_token((yyvsp[-5].string_value)); delete (yyvsp[-4].arg_nodes); } -#line 2863 "gecode/flatzinc/parser.tab.cpp" +#line 2868 "gecode/flatzinc/parser.tab.cpp" break; case 48: /* vardecl_item: FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_BOOL ':' var_par_id annotations '=' '[' bool_list ']' */ -#line 1299 "./gecode/flatzinc/parser.yxx" +#line 1304 "./gecode/flatzinc/parser.yxx" { ParserState* pp = static_cast(parm); yyassert(pp, (yyvsp[-12].int_value)==1, "Arrays must start at 1"); @@ -2872,21 +2877,21 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); if (!pp->had_error) { int ia = pp->arrays.size(); pp->arrays.push_back((yyvsp[-1].set_values)->size()); - for (unsigned int i=0; i<(yyvsp[-1].set_values)->size(); i++) - pp->arrays.push_back((*(yyvsp[-1].set_values))[i]); + for (int v : *(yyvsp[-1].set_values)) + pp->arrays.push_back(v); yyassert(pp, pp->symbols.put((yyvsp[-5].string_value), se_ba(ia)), "Duplicate symbol"); } delete (yyvsp[-1].set_values); - free((yyvsp[-5].string_value)); + free_token((yyvsp[-5].string_value)); delete (yyvsp[-4].arg_nodes); } -#line 2886 "gecode/flatzinc/parser.tab.cpp" +#line 2891 "gecode/flatzinc/parser.tab.cpp" break; case 49: /* vardecl_item: FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_FLOAT ':' var_par_id annotations '=' '[' float_list ']' */ -#line 1319 "./gecode/flatzinc/parser.yxx" +#line 1324 "./gecode/flatzinc/parser.yxx" { ParserState* pp = static_cast(parm); yyassert(pp, (yyvsp[-12].int_value)==1, "Arrays must start at 1"); @@ -2896,20 +2901,20 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); int fa = pp->arrays.size(); pp->arrays.push_back((yyvsp[-1].float_values)->size()); pp->arrays.push_back(pp->float_values.size()); - for (unsigned int i=0; i<(yyvsp[-1].float_values)->size(); i++) - pp->float_values.push_back((*(yyvsp[-1].float_values))[i]); + for (double v : *(yyvsp[-1].float_values)) + pp->float_values.push_back(v); yyassert(pp, pp->symbols.put((yyvsp[-5].string_value), se_fa(fa)), "Duplicate symbol"); } delete (yyvsp[-1].float_values); - delete (yyvsp[-4].arg_nodes); free((yyvsp[-5].string_value)); + delete (yyvsp[-4].arg_nodes); free_token((yyvsp[-5].string_value)); } -#line 2909 "gecode/flatzinc/parser.tab.cpp" +#line 2914 "gecode/flatzinc/parser.tab.cpp" break; case 50: /* vardecl_item: FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_SET FZ_OF FZ_INT ':' var_par_id annotations '=' '[' set_literal_list ']' */ -#line 1339 "./gecode/flatzinc/parser.yxx" +#line 1344 "./gecode/flatzinc/parser.yxx" { ParserState* pp = static_cast(parm); yyassert(pp, (yyvsp[-14].int_value)==1, "Arrays must start at 1"); @@ -2919,48 +2924,48 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); int sa = pp->arrays.size(); pp->arrays.push_back((yyvsp[-1].set_value_list)->size()); pp->arrays.push_back(pp->set_values.size()); - for (unsigned int i=0; i<(yyvsp[-1].set_value_list)->size(); i++) - pp->set_values.push_back((*(yyvsp[-1].set_value_list))[i]); + for (const AST::SetLit& v : *(yyvsp[-1].set_value_list)) + pp->set_values.push_back(v); yyassert(pp, pp->symbols.put((yyvsp[-5].string_value), se_sa(sa)), "Duplicate symbol"); } delete (yyvsp[-1].set_value_list); - delete (yyvsp[-4].arg_nodes); free((yyvsp[-5].string_value)); + delete (yyvsp[-4].arg_nodes); free_token((yyvsp[-5].string_value)); } -#line 2933 "gecode/flatzinc/parser.tab.cpp" +#line 2938 "gecode/flatzinc/parser.tab.cpp" break; case 51: /* int_init: FZ_INT_LIT */ -#line 1361 "./gecode/flatzinc/parser.yxx" +#line 1366 "./gecode/flatzinc/parser.yxx" { (yyval.var_spec) = new IntVarSpec((yyvsp[0].int_value),false,false); } -#line 2941 "gecode/flatzinc/parser.tab.cpp" +#line 2946 "gecode/flatzinc/parser.tab.cpp" break; case 52: /* int_init: var_par_id */ -#line 1365 "./gecode/flatzinc/parser.yxx" +#line 1370 "./gecode/flatzinc/parser.yxx" { SymbolEntry e; ParserState* pp = static_cast(parm); - if (pp->symbols.get((yyvsp[0].string_value), e) && (e.t == ST_INTVAR || e.t == ST_INT)) + if (pp->symbols.get((yyvsp[0].string_value), e) && (e.t == ST_INTVAR || e.t == ST_INT)) { (yyval.var_spec) = new IntVarSpec(Alias(e.i),false,false); - else { + } else { pp->err << "Error: undefined identifier for type int " << (yyvsp[0].string_value) << " in line no. " << yyget_lineno(pp->yyscanner) << '\n' << std::flush; pp->had_error = true; (yyval.var_spec) = new IntVarSpec(0,false,false); // keep things consistent } - free((yyvsp[0].string_value)); + free_token((yyvsp[0].string_value)); } -#line 2960 "gecode/flatzinc/parser.tab.cpp" +#line 2965 "gecode/flatzinc/parser.tab.cpp" break; case 53: /* int_init: var_par_id '[' FZ_INT_LIT ']' */ -#line 1380 "./gecode/flatzinc/parser.yxx" +#line 1385 "./gecode/flatzinc/parser.yxx" { vector v; SymbolEntry e; @@ -2979,68 +2984,68 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); pp->had_error = true; (yyval.var_spec) = new IntVarSpec(0,false,false); // keep things consistent } - free((yyvsp[-3].string_value)); + free_token((yyvsp[-3].string_value)); } -#line 2985 "gecode/flatzinc/parser.tab.cpp" +#line 2990 "gecode/flatzinc/parser.tab.cpp" break; case 54: /* int_init_list: %empty */ -#line 1403 "./gecode/flatzinc/parser.yxx" +#line 1408 "./gecode/flatzinc/parser.yxx" { (yyval.var_specs) = new vector(0); } -#line 2991 "gecode/flatzinc/parser.tab.cpp" +#line 2996 "gecode/flatzinc/parser.tab.cpp" break; case 55: /* int_init_list: int_init_list_head list_tail */ -#line 1405 "./gecode/flatzinc/parser.yxx" +#line 1410 "./gecode/flatzinc/parser.yxx" { (yyval.var_specs) = (yyvsp[-1].var_specs); } -#line 2997 "gecode/flatzinc/parser.tab.cpp" +#line 3002 "gecode/flatzinc/parser.tab.cpp" break; case 56: /* int_init_list_head: int_init */ -#line 1409 "./gecode/flatzinc/parser.yxx" +#line 1414 "./gecode/flatzinc/parser.yxx" { (yyval.var_specs) = new vector(1); (*(yyval.var_specs))[0] = (yyvsp[0].var_spec); } -#line 3003 "gecode/flatzinc/parser.tab.cpp" +#line 3008 "gecode/flatzinc/parser.tab.cpp" break; case 57: /* int_init_list_head: int_init_list_head ',' int_init */ -#line 1411 "./gecode/flatzinc/parser.yxx" +#line 1416 "./gecode/flatzinc/parser.yxx" { (yyval.var_specs) = (yyvsp[-2].var_specs); (yyval.var_specs)->push_back((yyvsp[0].var_spec)); } -#line 3009 "gecode/flatzinc/parser.tab.cpp" +#line 3014 "gecode/flatzinc/parser.tab.cpp" break; case 60: /* int_var_array_literal: '[' int_init_list ']' */ -#line 1416 "./gecode/flatzinc/parser.yxx" +#line 1421 "./gecode/flatzinc/parser.yxx" { (yyval.var_specs) = (yyvsp[-1].var_specs); } -#line 3015 "gecode/flatzinc/parser.tab.cpp" +#line 3020 "gecode/flatzinc/parser.tab.cpp" break; case 61: /* float_init: FZ_FLOAT_LIT */ -#line 1420 "./gecode/flatzinc/parser.yxx" +#line 1425 "./gecode/flatzinc/parser.yxx" { (yyval.var_spec) = new FloatVarSpec((yyvsp[0].float_value),false,false); } -#line 3021 "gecode/flatzinc/parser.tab.cpp" +#line 3026 "gecode/flatzinc/parser.tab.cpp" break; case 62: /* float_init: var_par_id */ -#line 1422 "./gecode/flatzinc/parser.yxx" +#line 1427 "./gecode/flatzinc/parser.yxx" { SymbolEntry e; ParserState* pp = static_cast(parm); - if (pp->symbols.get((yyvsp[0].string_value), e) && (e.t == ST_FLOATVAR || e.t == ST_FLOAT)) + if (pp->symbols.get((yyvsp[0].string_value), e) && (e.t == ST_FLOATVAR || e.t == ST_FLOAT)) { (yyval.var_spec) = new FloatVarSpec(Alias(e.i),false,false); - else { + } else { pp->err << "Error: undefined identifier for type float " << (yyvsp[0].string_value) << " in line no. " << yyget_lineno(pp->yyscanner) << '\n' << std::flush; pp->had_error = true; (yyval.var_spec) = new FloatVarSpec(0.0,false,false); } - free((yyvsp[0].string_value)); + free_token((yyvsp[0].string_value)); } -#line 3040 "gecode/flatzinc/parser.tab.cpp" +#line 3045 "gecode/flatzinc/parser.tab.cpp" break; case 63: /* float_init: var_par_id '[' FZ_INT_LIT ']' */ -#line 1437 "./gecode/flatzinc/parser.yxx" +#line 1442 "./gecode/flatzinc/parser.yxx" { SymbolEntry e; ParserState* pp = static_cast(parm); @@ -3058,68 +3063,68 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); pp->had_error = true; (yyval.var_spec) = new FloatVarSpec(0.0,false,false); } - free((yyvsp[-3].string_value)); + free_token((yyvsp[-3].string_value)); } -#line 3064 "gecode/flatzinc/parser.tab.cpp" +#line 3069 "gecode/flatzinc/parser.tab.cpp" break; case 64: /* float_init_list: %empty */ -#line 1459 "./gecode/flatzinc/parser.yxx" +#line 1464 "./gecode/flatzinc/parser.yxx" { (yyval.var_specs) = new vector(0); } -#line 3070 "gecode/flatzinc/parser.tab.cpp" +#line 3075 "gecode/flatzinc/parser.tab.cpp" break; case 65: /* float_init_list: float_init_list_head list_tail */ -#line 1461 "./gecode/flatzinc/parser.yxx" +#line 1466 "./gecode/flatzinc/parser.yxx" { (yyval.var_specs) = (yyvsp[-1].var_specs); } -#line 3076 "gecode/flatzinc/parser.tab.cpp" +#line 3081 "gecode/flatzinc/parser.tab.cpp" break; case 66: /* float_init_list_head: float_init */ -#line 1465 "./gecode/flatzinc/parser.yxx" +#line 1470 "./gecode/flatzinc/parser.yxx" { (yyval.var_specs) = new vector(1); (*(yyval.var_specs))[0] = (yyvsp[0].var_spec); } -#line 3082 "gecode/flatzinc/parser.tab.cpp" +#line 3087 "gecode/flatzinc/parser.tab.cpp" break; case 67: /* float_init_list_head: float_init_list_head ',' float_init */ -#line 1467 "./gecode/flatzinc/parser.yxx" +#line 1472 "./gecode/flatzinc/parser.yxx" { (yyval.var_specs) = (yyvsp[-2].var_specs); (yyval.var_specs)->push_back((yyvsp[0].var_spec)); } -#line 3088 "gecode/flatzinc/parser.tab.cpp" +#line 3093 "gecode/flatzinc/parser.tab.cpp" break; case 68: /* float_var_array_literal: '[' float_init_list ']' */ -#line 1471 "./gecode/flatzinc/parser.yxx" +#line 1476 "./gecode/flatzinc/parser.yxx" { (yyval.var_specs) = (yyvsp[-1].var_specs); } -#line 3094 "gecode/flatzinc/parser.tab.cpp" +#line 3099 "gecode/flatzinc/parser.tab.cpp" break; case 69: /* bool_init: FZ_BOOL_LIT */ -#line 1475 "./gecode/flatzinc/parser.yxx" +#line 1480 "./gecode/flatzinc/parser.yxx" { (yyval.var_spec) = new BoolVarSpec((yyvsp[0].int_value),false,false); } -#line 3100 "gecode/flatzinc/parser.tab.cpp" +#line 3105 "gecode/flatzinc/parser.tab.cpp" break; case 70: /* bool_init: var_par_id */ -#line 1477 "./gecode/flatzinc/parser.yxx" +#line 1482 "./gecode/flatzinc/parser.yxx" { SymbolEntry e; ParserState* pp = static_cast(parm); - if (pp->symbols.get((yyvsp[0].string_value), e) && (e.t == ST_BOOLVAR || e.t == ST_BOOL)) + if (pp->symbols.get((yyvsp[0].string_value), e) && (e.t == ST_BOOLVAR || e.t == ST_BOOL)) { (yyval.var_spec) = new BoolVarSpec(Alias(e.i),false,false); - else { + } else { pp->err << "Error: undefined identifier for type bool " << (yyvsp[0].string_value) << " in line no. " << yyget_lineno(pp->yyscanner) << '\n' << std::flush; pp->had_error = true; (yyval.var_spec) = new BoolVarSpec(false,false,false); } - free((yyvsp[0].string_value)); + free_token((yyvsp[0].string_value)); } -#line 3119 "gecode/flatzinc/parser.tab.cpp" +#line 3124 "gecode/flatzinc/parser.tab.cpp" break; case 71: /* bool_init: var_par_id '[' FZ_INT_LIT ']' */ -#line 1492 "./gecode/flatzinc/parser.yxx" +#line 1497 "./gecode/flatzinc/parser.yxx" { SymbolEntry e; ParserState* pp = static_cast(parm); @@ -3137,68 +3142,68 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); pp->had_error = true; (yyval.var_spec) = new BoolVarSpec(false,false,false); } - free((yyvsp[-3].string_value)); + free_token((yyvsp[-3].string_value)); } -#line 3143 "gecode/flatzinc/parser.tab.cpp" +#line 3148 "gecode/flatzinc/parser.tab.cpp" break; case 72: /* bool_init_list: %empty */ -#line 1514 "./gecode/flatzinc/parser.yxx" +#line 1519 "./gecode/flatzinc/parser.yxx" { (yyval.var_specs) = new vector(0); } -#line 3149 "gecode/flatzinc/parser.tab.cpp" +#line 3154 "gecode/flatzinc/parser.tab.cpp" break; case 73: /* bool_init_list: bool_init_list_head list_tail */ -#line 1516 "./gecode/flatzinc/parser.yxx" +#line 1521 "./gecode/flatzinc/parser.yxx" { (yyval.var_specs) = (yyvsp[-1].var_specs); } -#line 3155 "gecode/flatzinc/parser.tab.cpp" +#line 3160 "gecode/flatzinc/parser.tab.cpp" break; case 74: /* bool_init_list_head: bool_init */ -#line 1520 "./gecode/flatzinc/parser.yxx" +#line 1525 "./gecode/flatzinc/parser.yxx" { (yyval.var_specs) = new vector(1); (*(yyval.var_specs))[0] = (yyvsp[0].var_spec); } -#line 3161 "gecode/flatzinc/parser.tab.cpp" +#line 3166 "gecode/flatzinc/parser.tab.cpp" break; case 75: /* bool_init_list_head: bool_init_list_head ',' bool_init */ -#line 1522 "./gecode/flatzinc/parser.yxx" +#line 1527 "./gecode/flatzinc/parser.yxx" { (yyval.var_specs) = (yyvsp[-2].var_specs); (yyval.var_specs)->push_back((yyvsp[0].var_spec)); } -#line 3167 "gecode/flatzinc/parser.tab.cpp" +#line 3172 "gecode/flatzinc/parser.tab.cpp" break; case 76: /* bool_var_array_literal: '[' bool_init_list ']' */ -#line 1524 "./gecode/flatzinc/parser.yxx" +#line 1529 "./gecode/flatzinc/parser.yxx" { (yyval.var_specs) = (yyvsp[-1].var_specs); } -#line 3173 "gecode/flatzinc/parser.tab.cpp" +#line 3178 "gecode/flatzinc/parser.tab.cpp" break; case 77: /* set_init: set_literal */ -#line 1528 "./gecode/flatzinc/parser.yxx" +#line 1533 "./gecode/flatzinc/parser.yxx" { (yyval.var_spec) = new SetVarSpec((yyvsp[0].set_literal),false,false); } -#line 3179 "gecode/flatzinc/parser.tab.cpp" +#line 3184 "gecode/flatzinc/parser.tab.cpp" break; case 78: /* set_init: var_par_id */ -#line 1530 "./gecode/flatzinc/parser.yxx" +#line 1535 "./gecode/flatzinc/parser.yxx" { ParserState* pp = static_cast(parm); SymbolEntry e; - if (pp->symbols.get((yyvsp[0].string_value), e) && (e.t == ST_SETVAR || e.t == ST_SET)) + if (pp->symbols.get((yyvsp[0].string_value), e) && (e.t == ST_SETVAR || e.t == ST_SET)) { (yyval.var_spec) = new SetVarSpec(Alias(e.i),false,false); - else { + } else { pp->err << "Error: undefined identifier for type set " << (yyvsp[0].string_value) << " in line no. " << yyget_lineno(pp->yyscanner) << '\n' << std::flush; pp->had_error = true; (yyval.var_spec) = new SetVarSpec(Alias(0),false,false); } - free((yyvsp[0].string_value)); + free_token((yyvsp[0].string_value)); } -#line 3198 "gecode/flatzinc/parser.tab.cpp" +#line 3203 "gecode/flatzinc/parser.tab.cpp" break; case 79: /* set_init: var_par_id '[' FZ_INT_LIT ']' */ -#line 1545 "./gecode/flatzinc/parser.yxx" +#line 1550 "./gecode/flatzinc/parser.yxx" { SymbolEntry e; ParserState* pp = static_cast(parm); @@ -3216,95 +3221,95 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); pp->had_error = true; (yyval.var_spec) = new SetVarSpec(Alias(0),false,false); } - free((yyvsp[-3].string_value)); + free_token((yyvsp[-3].string_value)); } -#line 3222 "gecode/flatzinc/parser.tab.cpp" +#line 3227 "gecode/flatzinc/parser.tab.cpp" break; case 80: /* set_init_list: %empty */ -#line 1567 "./gecode/flatzinc/parser.yxx" +#line 1572 "./gecode/flatzinc/parser.yxx" { (yyval.var_specs) = new vector(0); } -#line 3228 "gecode/flatzinc/parser.tab.cpp" +#line 3233 "gecode/flatzinc/parser.tab.cpp" break; case 81: /* set_init_list: set_init_list_head list_tail */ -#line 1569 "./gecode/flatzinc/parser.yxx" +#line 1574 "./gecode/flatzinc/parser.yxx" { (yyval.var_specs) = (yyvsp[-1].var_specs); } -#line 3234 "gecode/flatzinc/parser.tab.cpp" +#line 3239 "gecode/flatzinc/parser.tab.cpp" break; case 82: /* set_init_list_head: set_init */ -#line 1573 "./gecode/flatzinc/parser.yxx" +#line 1578 "./gecode/flatzinc/parser.yxx" { (yyval.var_specs) = new vector(1); (*(yyval.var_specs))[0] = (yyvsp[0].var_spec); } -#line 3240 "gecode/flatzinc/parser.tab.cpp" +#line 3245 "gecode/flatzinc/parser.tab.cpp" break; case 83: /* set_init_list_head: set_init_list_head ',' set_init */ -#line 1575 "./gecode/flatzinc/parser.yxx" +#line 1580 "./gecode/flatzinc/parser.yxx" { (yyval.var_specs) = (yyvsp[-2].var_specs); (yyval.var_specs)->push_back((yyvsp[0].var_spec)); } -#line 3246 "gecode/flatzinc/parser.tab.cpp" +#line 3251 "gecode/flatzinc/parser.tab.cpp" break; case 84: /* set_var_array_literal: '[' set_init_list ']' */ -#line 1578 "./gecode/flatzinc/parser.yxx" +#line 1583 "./gecode/flatzinc/parser.yxx" { (yyval.var_specs) = (yyvsp[-1].var_specs); } -#line 3252 "gecode/flatzinc/parser.tab.cpp" +#line 3257 "gecode/flatzinc/parser.tab.cpp" break; case 85: /* vardecl_int_var_array_init: %empty */ -#line 1582 "./gecode/flatzinc/parser.yxx" +#line 1587 "./gecode/flatzinc/parser.yxx" { (yyval.optional_var_specs) = Option* >::none(); } -#line 3258 "gecode/flatzinc/parser.tab.cpp" +#line 3263 "gecode/flatzinc/parser.tab.cpp" break; case 86: /* vardecl_int_var_array_init: '=' int_var_array_literal */ -#line 1584 "./gecode/flatzinc/parser.yxx" +#line 1589 "./gecode/flatzinc/parser.yxx" { (yyval.optional_var_specs) = Option* >::some((yyvsp[0].var_specs)); } -#line 3264 "gecode/flatzinc/parser.tab.cpp" +#line 3269 "gecode/flatzinc/parser.tab.cpp" break; case 87: /* vardecl_bool_var_array_init: %empty */ -#line 1588 "./gecode/flatzinc/parser.yxx" +#line 1593 "./gecode/flatzinc/parser.yxx" { (yyval.optional_var_specs) = Option* >::none(); } -#line 3270 "gecode/flatzinc/parser.tab.cpp" +#line 3275 "gecode/flatzinc/parser.tab.cpp" break; case 88: /* vardecl_bool_var_array_init: '=' bool_var_array_literal */ -#line 1590 "./gecode/flatzinc/parser.yxx" +#line 1595 "./gecode/flatzinc/parser.yxx" { (yyval.optional_var_specs) = Option* >::some((yyvsp[0].var_specs)); } -#line 3276 "gecode/flatzinc/parser.tab.cpp" +#line 3281 "gecode/flatzinc/parser.tab.cpp" break; case 89: /* vardecl_float_var_array_init: %empty */ -#line 1594 "./gecode/flatzinc/parser.yxx" +#line 1599 "./gecode/flatzinc/parser.yxx" { (yyval.optional_var_specs) = Option* >::none(); } -#line 3282 "gecode/flatzinc/parser.tab.cpp" +#line 3287 "gecode/flatzinc/parser.tab.cpp" break; case 90: /* vardecl_float_var_array_init: '=' float_var_array_literal */ -#line 1596 "./gecode/flatzinc/parser.yxx" +#line 1601 "./gecode/flatzinc/parser.yxx" { (yyval.optional_var_specs) = Option* >::some((yyvsp[0].var_specs)); } -#line 3288 "gecode/flatzinc/parser.tab.cpp" +#line 3293 "gecode/flatzinc/parser.tab.cpp" break; case 91: /* vardecl_set_var_array_init: %empty */ -#line 1600 "./gecode/flatzinc/parser.yxx" +#line 1605 "./gecode/flatzinc/parser.yxx" { (yyval.optional_var_specs) = Option* >::none(); } -#line 3294 "gecode/flatzinc/parser.tab.cpp" +#line 3299 "gecode/flatzinc/parser.tab.cpp" break; case 92: /* vardecl_set_var_array_init: '=' set_var_array_literal */ -#line 1602 "./gecode/flatzinc/parser.yxx" +#line 1607 "./gecode/flatzinc/parser.yxx" { (yyval.optional_var_specs) = Option* >::some((yyvsp[0].var_specs)); } -#line 3300 "gecode/flatzinc/parser.tab.cpp" +#line 3305 "gecode/flatzinc/parser.tab.cpp" break; case 93: /* constraint_item: FZ_CONSTRAINT FZ_ID '(' flat_expr_list ')' annotations */ -#line 1606 "./gecode/flatzinc/parser.yxx" +#line 1611 "./gecode/flatzinc/parser.yxx" { ParserState *pp = static_cast(parm); std::unique_ptr ce(new ConExpr((yyvsp[-4].string_value), (yyvsp[-2].arg_nodes), (yyvsp[0].arg_nodes))); - free((yyvsp[-4].string_value)); + free_token((yyvsp[-4].string_value)); if (!pp->had_error) { const std::string& cid = ce->id; if (cid=="gecode_on_restart_status" && (yyvsp[-2].arg_nodes)->a[0]->is_int_var()) { @@ -3474,11 +3479,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); } } } -#line 3478 "gecode/flatzinc/parser.tab.cpp" +#line 3483 "gecode/flatzinc/parser.tab.cpp" break; case 94: /* solve_item: FZ_SOLVE annotations FZ_SATISFY */ -#line 1781 "./gecode/flatzinc/parser.yxx" +#line 1786 "./gecode/flatzinc/parser.yxx" { ParserState *pp = static_cast(parm); std::unique_ptr ann((yyvsp[-1].arg_nodes)); @@ -3492,11 +3497,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); } } } -#line 3496 "gecode/flatzinc/parser.tab.cpp" +#line 3501 "gecode/flatzinc/parser.tab.cpp" break; case 95: /* solve_item: FZ_SOLVE annotations minmax solve_expr */ -#line 1795 "./gecode/flatzinc/parser.yxx" +#line 1800 "./gecode/flatzinc/parser.yxx" { ParserState *pp = static_cast(parm); std::unique_ptr ann((yyvsp[-2].arg_nodes)); @@ -3515,37 +3520,37 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); } } } -#line 3519 "gecode/flatzinc/parser.tab.cpp" +#line 3524 "gecode/flatzinc/parser.tab.cpp" break; case 96: /* int_ti_expr_tail: FZ_INT */ -#line 1820 "./gecode/flatzinc/parser.yxx" +#line 1825 "./gecode/flatzinc/parser.yxx" { (yyval.optional_set) = Option::none(); } -#line 3525 "gecode/flatzinc/parser.tab.cpp" +#line 3530 "gecode/flatzinc/parser.tab.cpp" break; case 97: /* int_ti_expr_tail: '{' int_list '}' */ -#line 1822 "./gecode/flatzinc/parser.yxx" +#line 1827 "./gecode/flatzinc/parser.yxx" { (yyval.optional_set) = Option::some(new AST::SetLit(*(yyvsp[-1].set_values))); delete (yyvsp[-1].set_values); } -#line 3531 "gecode/flatzinc/parser.tab.cpp" +#line 3536 "gecode/flatzinc/parser.tab.cpp" break; case 98: /* int_ti_expr_tail: FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT */ -#line 1824 "./gecode/flatzinc/parser.yxx" +#line 1829 "./gecode/flatzinc/parser.yxx" { (yyval.optional_set) = Option::some(new AST::SetLit((yyvsp[-2].int_value), (yyvsp[0].int_value))); } -#line 3539 "gecode/flatzinc/parser.tab.cpp" +#line 3544 "gecode/flatzinc/parser.tab.cpp" break; case 99: /* bool_ti_expr_tail: FZ_BOOL */ -#line 1830 "./gecode/flatzinc/parser.yxx" +#line 1835 "./gecode/flatzinc/parser.yxx" { (yyval.optional_set) = Option::none(); } -#line 3545 "gecode/flatzinc/parser.tab.cpp" +#line 3550 "gecode/flatzinc/parser.tab.cpp" break; case 100: /* bool_ti_expr_tail: '{' bool_list_head list_tail '}' */ -#line 1832 "./gecode/flatzinc/parser.yxx" +#line 1837 "./gecode/flatzinc/parser.yxx" { bool have_true = false; bool have_false = false; for (int i=(yyvsp[-2].set_values)->size(); i--;) { @@ -3556,192 +3561,192 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.optional_set) = Option::some( new AST::SetLit(!have_false,have_true)); } -#line 3560 "gecode/flatzinc/parser.tab.cpp" +#line 3565 "gecode/flatzinc/parser.tab.cpp" break; case 101: /* float_ti_expr_tail: FZ_FLOAT */ -#line 1845 "./gecode/flatzinc/parser.yxx" +#line 1850 "./gecode/flatzinc/parser.yxx" { (yyval.optional_float_bounds) = Option* >::none(); } -#line 3566 "gecode/flatzinc/parser.tab.cpp" +#line 3571 "gecode/flatzinc/parser.tab.cpp" break; case 102: /* float_ti_expr_tail: FZ_FLOAT_LIT FZ_DOTDOT FZ_FLOAT_LIT */ -#line 1847 "./gecode/flatzinc/parser.yxx" +#line 1852 "./gecode/flatzinc/parser.yxx" { std::pair* dom = new std::pair((yyvsp[-2].float_value),(yyvsp[0].float_value)); (yyval.optional_float_bounds) = Option* >::some(dom); } -#line 3573 "gecode/flatzinc/parser.tab.cpp" +#line 3578 "gecode/flatzinc/parser.tab.cpp" break; case 103: /* set_literal: '{' int_list '}' */ -#line 1856 "./gecode/flatzinc/parser.yxx" +#line 1861 "./gecode/flatzinc/parser.yxx" { (yyval.set_literal) = new AST::SetLit(*(yyvsp[-1].set_values)); delete (yyvsp[-1].set_values); } -#line 3579 "gecode/flatzinc/parser.tab.cpp" +#line 3584 "gecode/flatzinc/parser.tab.cpp" break; case 104: /* set_literal: FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT */ -#line 1858 "./gecode/flatzinc/parser.yxx" +#line 1863 "./gecode/flatzinc/parser.yxx" { (yyval.set_literal) = new AST::SetLit((yyvsp[-2].int_value), (yyvsp[0].int_value)); } -#line 3585 "gecode/flatzinc/parser.tab.cpp" +#line 3590 "gecode/flatzinc/parser.tab.cpp" break; case 105: /* int_list: %empty */ -#line 1864 "./gecode/flatzinc/parser.yxx" +#line 1869 "./gecode/flatzinc/parser.yxx" { (yyval.set_values) = new vector(0); } -#line 3591 "gecode/flatzinc/parser.tab.cpp" +#line 3596 "gecode/flatzinc/parser.tab.cpp" break; case 106: /* int_list: int_list_head list_tail */ -#line 1866 "./gecode/flatzinc/parser.yxx" +#line 1871 "./gecode/flatzinc/parser.yxx" { (yyval.set_values) = (yyvsp[-1].set_values); } -#line 3597 "gecode/flatzinc/parser.tab.cpp" +#line 3602 "gecode/flatzinc/parser.tab.cpp" break; case 107: /* int_list_head: FZ_INT_LIT */ -#line 1870 "./gecode/flatzinc/parser.yxx" +#line 1875 "./gecode/flatzinc/parser.yxx" { (yyval.set_values) = new vector(1); (*(yyval.set_values))[0] = (yyvsp[0].int_value); } -#line 3603 "gecode/flatzinc/parser.tab.cpp" +#line 3608 "gecode/flatzinc/parser.tab.cpp" break; case 108: /* int_list_head: int_list_head ',' FZ_INT_LIT */ -#line 1872 "./gecode/flatzinc/parser.yxx" +#line 1877 "./gecode/flatzinc/parser.yxx" { (yyval.set_values) = (yyvsp[-2].set_values); (yyval.set_values)->push_back((yyvsp[0].int_value)); } -#line 3609 "gecode/flatzinc/parser.tab.cpp" +#line 3614 "gecode/flatzinc/parser.tab.cpp" break; case 109: /* bool_list: %empty */ -#line 1876 "./gecode/flatzinc/parser.yxx" +#line 1881 "./gecode/flatzinc/parser.yxx" { (yyval.set_values) = new vector(0); } -#line 3615 "gecode/flatzinc/parser.tab.cpp" +#line 3620 "gecode/flatzinc/parser.tab.cpp" break; case 110: /* bool_list: bool_list_head list_tail */ -#line 1878 "./gecode/flatzinc/parser.yxx" +#line 1883 "./gecode/flatzinc/parser.yxx" { (yyval.set_values) = (yyvsp[-1].set_values); } -#line 3621 "gecode/flatzinc/parser.tab.cpp" +#line 3626 "gecode/flatzinc/parser.tab.cpp" break; case 111: /* bool_list_head: FZ_BOOL_LIT */ -#line 1882 "./gecode/flatzinc/parser.yxx" +#line 1887 "./gecode/flatzinc/parser.yxx" { (yyval.set_values) = new vector(1); (*(yyval.set_values))[0] = (yyvsp[0].int_value); } -#line 3627 "gecode/flatzinc/parser.tab.cpp" +#line 3632 "gecode/flatzinc/parser.tab.cpp" break; case 112: /* bool_list_head: bool_list_head ',' FZ_BOOL_LIT */ -#line 1884 "./gecode/flatzinc/parser.yxx" +#line 1889 "./gecode/flatzinc/parser.yxx" { (yyval.set_values) = (yyvsp[-2].set_values); (yyval.set_values)->push_back((yyvsp[0].int_value)); } -#line 3633 "gecode/flatzinc/parser.tab.cpp" +#line 3638 "gecode/flatzinc/parser.tab.cpp" break; case 113: /* float_list: %empty */ -#line 1888 "./gecode/flatzinc/parser.yxx" +#line 1893 "./gecode/flatzinc/parser.yxx" { (yyval.float_values) = new vector(0); } -#line 3639 "gecode/flatzinc/parser.tab.cpp" +#line 3644 "gecode/flatzinc/parser.tab.cpp" break; case 114: /* float_list: float_list_head list_tail */ -#line 1890 "./gecode/flatzinc/parser.yxx" +#line 1895 "./gecode/flatzinc/parser.yxx" { (yyval.float_values) = (yyvsp[-1].float_values); } -#line 3645 "gecode/flatzinc/parser.tab.cpp" +#line 3650 "gecode/flatzinc/parser.tab.cpp" break; case 115: /* float_list_head: FZ_FLOAT_LIT */ -#line 1894 "./gecode/flatzinc/parser.yxx" +#line 1899 "./gecode/flatzinc/parser.yxx" { (yyval.float_values) = new vector(1); (*(yyval.float_values))[0] = (yyvsp[0].float_value); } -#line 3651 "gecode/flatzinc/parser.tab.cpp" +#line 3656 "gecode/flatzinc/parser.tab.cpp" break; case 116: /* float_list_head: float_list_head ',' FZ_FLOAT_LIT */ -#line 1896 "./gecode/flatzinc/parser.yxx" +#line 1901 "./gecode/flatzinc/parser.yxx" { (yyval.float_values) = (yyvsp[-2].float_values); (yyval.float_values)->push_back((yyvsp[0].float_value)); } -#line 3657 "gecode/flatzinc/parser.tab.cpp" +#line 3662 "gecode/flatzinc/parser.tab.cpp" break; case 117: /* set_literal_list: %empty */ -#line 1900 "./gecode/flatzinc/parser.yxx" +#line 1905 "./gecode/flatzinc/parser.yxx" { (yyval.set_value_list) = new vector(0); } -#line 3663 "gecode/flatzinc/parser.tab.cpp" +#line 3668 "gecode/flatzinc/parser.tab.cpp" break; case 118: /* set_literal_list: set_literal_list_head list_tail */ -#line 1902 "./gecode/flatzinc/parser.yxx" +#line 1907 "./gecode/flatzinc/parser.yxx" { (yyval.set_value_list) = (yyvsp[-1].set_value_list); } -#line 3669 "gecode/flatzinc/parser.tab.cpp" +#line 3674 "gecode/flatzinc/parser.tab.cpp" break; case 119: /* set_literal_list_head: set_literal */ -#line 1906 "./gecode/flatzinc/parser.yxx" +#line 1911 "./gecode/flatzinc/parser.yxx" { (yyval.set_value_list) = new vector(1); (*(yyval.set_value_list))[0] = *(yyvsp[0].set_literal); delete (yyvsp[0].set_literal); } -#line 3675 "gecode/flatzinc/parser.tab.cpp" +#line 3680 "gecode/flatzinc/parser.tab.cpp" break; case 120: /* set_literal_list_head: set_literal_list_head ',' set_literal */ -#line 1908 "./gecode/flatzinc/parser.yxx" +#line 1913 "./gecode/flatzinc/parser.yxx" { (yyval.set_value_list) = (yyvsp[-2].set_value_list); (yyval.set_value_list)->push_back(*(yyvsp[0].set_literal)); delete (yyvsp[0].set_literal); } -#line 3681 "gecode/flatzinc/parser.tab.cpp" +#line 3686 "gecode/flatzinc/parser.tab.cpp" break; case 121: /* flat_expr_list: flat_expr */ -#line 1916 "./gecode/flatzinc/parser.yxx" +#line 1921 "./gecode/flatzinc/parser.yxx" { (yyval.arg_nodes) = new AST::Array((yyvsp[0].arg)); } -#line 3687 "gecode/flatzinc/parser.tab.cpp" +#line 3692 "gecode/flatzinc/parser.tab.cpp" break; case 122: /* flat_expr_list: flat_expr_list ',' flat_expr */ -#line 1918 "./gecode/flatzinc/parser.yxx" +#line 1923 "./gecode/flatzinc/parser.yxx" { (yyval.arg_nodes) = (yyvsp[-2].arg_nodes); (yyval.arg_nodes)->append((yyvsp[0].arg)); } -#line 3693 "gecode/flatzinc/parser.tab.cpp" +#line 3698 "gecode/flatzinc/parser.tab.cpp" break; case 123: /* flat_expr: non_array_expr */ -#line 1922 "./gecode/flatzinc/parser.yxx" +#line 1927 "./gecode/flatzinc/parser.yxx" { (yyval.arg) = (yyvsp[0].arg); } -#line 3699 "gecode/flatzinc/parser.tab.cpp" +#line 3704 "gecode/flatzinc/parser.tab.cpp" break; case 124: /* flat_expr: '[' non_array_expr_list ']' */ -#line 1924 "./gecode/flatzinc/parser.yxx" +#line 1929 "./gecode/flatzinc/parser.yxx" { (yyval.arg) = (yyvsp[-1].arg_nodes); } -#line 3705 "gecode/flatzinc/parser.tab.cpp" +#line 3710 "gecode/flatzinc/parser.tab.cpp" break; case 125: /* non_array_expr_opt: %empty */ -#line 1928 "./gecode/flatzinc/parser.yxx" +#line 1933 "./gecode/flatzinc/parser.yxx" { (yyval.optional_arg) = Option::none(); } -#line 3711 "gecode/flatzinc/parser.tab.cpp" +#line 3716 "gecode/flatzinc/parser.tab.cpp" break; case 126: /* non_array_expr_opt: '=' non_array_expr */ -#line 1930 "./gecode/flatzinc/parser.yxx" +#line 1935 "./gecode/flatzinc/parser.yxx" { (yyval.optional_arg) = Option::some((yyvsp[0].arg)); } -#line 3717 "gecode/flatzinc/parser.tab.cpp" +#line 3722 "gecode/flatzinc/parser.tab.cpp" break; case 127: /* non_array_expr: FZ_BOOL_LIT */ -#line 1934 "./gecode/flatzinc/parser.yxx" +#line 1939 "./gecode/flatzinc/parser.yxx" { (yyval.arg) = new AST::BoolLit((yyvsp[0].int_value)); } -#line 3723 "gecode/flatzinc/parser.tab.cpp" +#line 3728 "gecode/flatzinc/parser.tab.cpp" break; case 128: /* non_array_expr: FZ_INT_LIT */ -#line 1936 "./gecode/flatzinc/parser.yxx" +#line 1941 "./gecode/flatzinc/parser.yxx" { (yyval.arg) = new AST::IntLit((yyvsp[0].int_value)); } -#line 3729 "gecode/flatzinc/parser.tab.cpp" +#line 3734 "gecode/flatzinc/parser.tab.cpp" break; case 129: /* non_array_expr: FZ_FLOAT_LIT */ -#line 1938 "./gecode/flatzinc/parser.yxx" +#line 1943 "./gecode/flatzinc/parser.yxx" { (yyval.arg) = new AST::FloatLit((yyvsp[0].float_value)); } -#line 3735 "gecode/flatzinc/parser.tab.cpp" +#line 3740 "gecode/flatzinc/parser.tab.cpp" break; case 130: /* non_array_expr: set_literal */ -#line 1940 "./gecode/flatzinc/parser.yxx" +#line 1945 "./gecode/flatzinc/parser.yxx" { (yyval.arg) = (yyvsp[0].set_literal); } -#line 3741 "gecode/flatzinc/parser.tab.cpp" +#line 3746 "gecode/flatzinc/parser.tab.cpp" break; case 131: /* non_array_expr: var_par_id */ -#line 1942 "./gecode/flatzinc/parser.yxx" +#line 1947 "./gecode/flatzinc/parser.yxx" { ParserState* pp = static_cast(parm); SymbolEntry e; @@ -3835,13 +3840,13 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); pp->had_error = true; (yyval.arg) = nullptr; } - free((yyvsp[0].string_value)); + free_token((yyvsp[0].string_value)); } -#line 3841 "gecode/flatzinc/parser.tab.cpp" +#line 3846 "gecode/flatzinc/parser.tab.cpp" break; case 132: /* non_array_expr: var_par_id '[' non_array_expr ']' */ -#line 2038 "./gecode/flatzinc/parser.yxx" +#line 2043 "./gecode/flatzinc/parser.yxx" { ParserState* pp = static_cast(parm); int i = -1; @@ -3851,37 +3856,37 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); else (yyval.arg) = new AST::IntLit(0); // keep things consistent delete (yyvsp[-1].arg); - free((yyvsp[-3].string_value)); + free_token((yyvsp[-3].string_value)); } -#line 3857 "gecode/flatzinc/parser.tab.cpp" +#line 3862 "gecode/flatzinc/parser.tab.cpp" break; case 133: /* non_array_expr_list: %empty */ -#line 2052 "./gecode/flatzinc/parser.yxx" +#line 2057 "./gecode/flatzinc/parser.yxx" { (yyval.arg_nodes) = new AST::Array(0); } -#line 3863 "gecode/flatzinc/parser.tab.cpp" +#line 3868 "gecode/flatzinc/parser.tab.cpp" break; case 134: /* non_array_expr_list: non_array_expr_list_head list_tail */ -#line 2054 "./gecode/flatzinc/parser.yxx" +#line 2059 "./gecode/flatzinc/parser.yxx" { (yyval.arg_nodes) = (yyvsp[-1].arg_nodes); } -#line 3869 "gecode/flatzinc/parser.tab.cpp" +#line 3874 "gecode/flatzinc/parser.tab.cpp" break; case 135: /* non_array_expr_list_head: non_array_expr */ -#line 2058 "./gecode/flatzinc/parser.yxx" +#line 2063 "./gecode/flatzinc/parser.yxx" { (yyval.arg_nodes) = new AST::Array((yyvsp[0].arg)); } -#line 3875 "gecode/flatzinc/parser.tab.cpp" +#line 3880 "gecode/flatzinc/parser.tab.cpp" break; case 136: /* non_array_expr_list_head: non_array_expr_list_head ',' non_array_expr */ -#line 2060 "./gecode/flatzinc/parser.yxx" +#line 2065 "./gecode/flatzinc/parser.yxx" { (yyval.arg_nodes) = (yyvsp[-2].arg_nodes); (yyval.arg_nodes)->append((yyvsp[0].arg)); } -#line 3881 "gecode/flatzinc/parser.tab.cpp" +#line 3886 "gecode/flatzinc/parser.tab.cpp" break; case 137: /* solve_expr: var_par_id */ -#line 2068 "./gecode/flatzinc/parser.yxx" +#line 2073 "./gecode/flatzinc/parser.yxx" { ParserState *pp = static_cast(parm); SymbolEntry e; @@ -3913,35 +3918,35 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); << yyget_lineno(pp->yyscanner) << '\n' << std::flush; pp->had_error = true; } - free((yyvsp[0].string_value)); + free_token((yyvsp[0].string_value)); } -#line 3919 "gecode/flatzinc/parser.tab.cpp" +#line 3924 "gecode/flatzinc/parser.tab.cpp" break; case 138: /* solve_expr: FZ_INT_LIT */ -#line 2102 "./gecode/flatzinc/parser.yxx" +#line 2107 "./gecode/flatzinc/parser.yxx" { ParserState *pp = static_cast(parm); pp->int_vars.push_back(NamedVarSpec("OBJ_CONST_INTRODUCED", new IntVarSpec(0,true,false))); (yyval.int_value) = pp->int_vars.size()-1; } -#line 3930 "gecode/flatzinc/parser.tab.cpp" +#line 3935 "gecode/flatzinc/parser.tab.cpp" break; case 139: /* solve_expr: FZ_FLOAT_LIT */ -#line 2109 "./gecode/flatzinc/parser.yxx" +#line 2114 "./gecode/flatzinc/parser.yxx" { ParserState *pp = static_cast(parm); pp->int_vars.push_back(NamedVarSpec("OBJ_CONST_INTRODUCED", new IntVarSpec(0,true,false))); (yyval.int_value) = pp->int_vars.size()-1; } -#line 3941 "gecode/flatzinc/parser.tab.cpp" +#line 3946 "gecode/flatzinc/parser.tab.cpp" break; case 140: /* solve_expr: var_par_id '[' FZ_INT_LIT ']' */ -#line 2116 "./gecode/flatzinc/parser.yxx" +#line 2121 "./gecode/flatzinc/parser.yxx" { SymbolEntry e; ParserState *pp = static_cast(parm); @@ -3963,105 +3968,105 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); else (yyval.int_value) = -pp->arrays[e.i+(yyvsp[-1].int_value)]-1; } - free((yyvsp[-3].string_value)); + free_token((yyvsp[-3].string_value)); } -#line 3969 "gecode/flatzinc/parser.tab.cpp" +#line 3974 "gecode/flatzinc/parser.tab.cpp" break; case 143: /* annotations: %empty */ -#line 2150 "./gecode/flatzinc/parser.yxx" +#line 2155 "./gecode/flatzinc/parser.yxx" { (yyval.arg_nodes) = nullptr; } -#line 3975 "gecode/flatzinc/parser.tab.cpp" +#line 3980 "gecode/flatzinc/parser.tab.cpp" break; case 144: /* annotations: annotations_head */ -#line 2152 "./gecode/flatzinc/parser.yxx" +#line 2157 "./gecode/flatzinc/parser.yxx" { (yyval.arg_nodes) = (yyvsp[0].arg_nodes); } -#line 3981 "gecode/flatzinc/parser.tab.cpp" +#line 3986 "gecode/flatzinc/parser.tab.cpp" break; case 145: /* annotations_head: FZ_COLONCOLON annotation */ -#line 2156 "./gecode/flatzinc/parser.yxx" +#line 2161 "./gecode/flatzinc/parser.yxx" { (yyval.arg_nodes) = new AST::Array((yyvsp[0].arg)); } -#line 3987 "gecode/flatzinc/parser.tab.cpp" +#line 3992 "gecode/flatzinc/parser.tab.cpp" break; case 146: /* annotations_head: annotations_head FZ_COLONCOLON annotation */ -#line 2158 "./gecode/flatzinc/parser.yxx" +#line 2163 "./gecode/flatzinc/parser.yxx" { (yyval.arg_nodes) = (yyvsp[-2].arg_nodes); (yyval.arg_nodes)->append((yyvsp[0].arg)); } -#line 3993 "gecode/flatzinc/parser.tab.cpp" +#line 3998 "gecode/flatzinc/parser.tab.cpp" break; case 147: /* annotation: FZ_ID '(' annotation_list ')' */ -#line 2162 "./gecode/flatzinc/parser.yxx" +#line 2167 "./gecode/flatzinc/parser.yxx" { - (yyval.arg) = new AST::Call((yyvsp[-3].string_value), AST::extract_singleton((yyvsp[-1].arg))); free((yyvsp[-3].string_value)); + (yyval.arg) = new AST::Call((yyvsp[-3].string_value), AST::extract_singleton((yyvsp[-1].arg))); free_token((yyvsp[-3].string_value)); } -#line 4001 "gecode/flatzinc/parser.tab.cpp" +#line 4006 "gecode/flatzinc/parser.tab.cpp" break; case 148: /* annotation: annotation_expr */ -#line 2166 "./gecode/flatzinc/parser.yxx" +#line 2171 "./gecode/flatzinc/parser.yxx" { (yyval.arg) = (yyvsp[0].arg); } -#line 4007 "gecode/flatzinc/parser.tab.cpp" +#line 4012 "gecode/flatzinc/parser.tab.cpp" break; case 149: /* annotation_list: annotation */ -#line 2170 "./gecode/flatzinc/parser.yxx" +#line 2175 "./gecode/flatzinc/parser.yxx" { (yyval.arg) = new AST::Array((yyvsp[0].arg)); } -#line 4013 "gecode/flatzinc/parser.tab.cpp" +#line 4018 "gecode/flatzinc/parser.tab.cpp" break; case 150: /* annotation_list: annotation_list ',' annotation */ -#line 2172 "./gecode/flatzinc/parser.yxx" +#line 2177 "./gecode/flatzinc/parser.yxx" { (yyval.arg) = (yyvsp[-2].arg); (yyval.arg)->append((yyvsp[0].arg)); } -#line 4019 "gecode/flatzinc/parser.tab.cpp" +#line 4024 "gecode/flatzinc/parser.tab.cpp" break; case 151: /* annotation_expr: ann_non_array_expr */ -#line 2176 "./gecode/flatzinc/parser.yxx" +#line 2181 "./gecode/flatzinc/parser.yxx" { (yyval.arg) = (yyvsp[0].arg); } -#line 4025 "gecode/flatzinc/parser.tab.cpp" +#line 4030 "gecode/flatzinc/parser.tab.cpp" break; case 152: /* annotation_expr: '[' ']' */ -#line 2178 "./gecode/flatzinc/parser.yxx" +#line 2183 "./gecode/flatzinc/parser.yxx" { (yyval.arg) = new AST::Array(); } -#line 4031 "gecode/flatzinc/parser.tab.cpp" +#line 4036 "gecode/flatzinc/parser.tab.cpp" break; case 153: /* annotation_expr: '[' annotation_list annotation_list_tail ']' */ -#line 2180 "./gecode/flatzinc/parser.yxx" +#line 2185 "./gecode/flatzinc/parser.yxx" { (yyval.arg) = (yyvsp[-2].arg); } -#line 4037 "gecode/flatzinc/parser.tab.cpp" +#line 4042 "gecode/flatzinc/parser.tab.cpp" break; case 156: /* ann_non_array_expr: FZ_BOOL_LIT */ -#line 2186 "./gecode/flatzinc/parser.yxx" +#line 2191 "./gecode/flatzinc/parser.yxx" { (yyval.arg) = new AST::BoolLit((yyvsp[0].int_value)); } -#line 4043 "gecode/flatzinc/parser.tab.cpp" +#line 4048 "gecode/flatzinc/parser.tab.cpp" break; case 157: /* ann_non_array_expr: FZ_INT_LIT */ -#line 2188 "./gecode/flatzinc/parser.yxx" +#line 2193 "./gecode/flatzinc/parser.yxx" { (yyval.arg) = new AST::IntLit((yyvsp[0].int_value)); } -#line 4049 "gecode/flatzinc/parser.tab.cpp" +#line 4054 "gecode/flatzinc/parser.tab.cpp" break; case 158: /* ann_non_array_expr: FZ_FLOAT_LIT */ -#line 2190 "./gecode/flatzinc/parser.yxx" +#line 2195 "./gecode/flatzinc/parser.yxx" { (yyval.arg) = new AST::FloatLit((yyvsp[0].float_value)); } -#line 4055 "gecode/flatzinc/parser.tab.cpp" +#line 4060 "gecode/flatzinc/parser.tab.cpp" break; case 159: /* ann_non_array_expr: set_literal */ -#line 2192 "./gecode/flatzinc/parser.yxx" +#line 2197 "./gecode/flatzinc/parser.yxx" { (yyval.arg) = (yyvsp[0].set_literal); } -#line 4061 "gecode/flatzinc/parser.tab.cpp" +#line 4066 "gecode/flatzinc/parser.tab.cpp" break; case 160: /* ann_non_array_expr: var_par_id */ -#line 2194 "./gecode/flatzinc/parser.yxx" +#line 2199 "./gecode/flatzinc/parser.yxx" { ParserState* pp = static_cast(parm); SymbolEntry e; @@ -4165,13 +4170,13 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); } if (!got_symbol) (yyval.arg) = get_var_ref_arg(pp,(yyvsp[0].string_value),true); - free((yyvsp[0].string_value)); + free_token((yyvsp[0].string_value)); } -#line 4171 "gecode/flatzinc/parser.tab.cpp" +#line 4176 "gecode/flatzinc/parser.tab.cpp" break; case 161: /* ann_non_array_expr: var_par_id '[' ann_non_array_expr ']' */ -#line 2300 "./gecode/flatzinc/parser.yxx" +#line 2305 "./gecode/flatzinc/parser.yxx" { ParserState* pp = static_cast(parm); int i = -1; @@ -4181,22 +4186,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); else (yyval.arg) = new AST::IntLit(0); // keep things consistent delete (yyvsp[-1].arg); - free((yyvsp[-3].string_value)); + free_token((yyvsp[-3].string_value)); } -#line 4187 "gecode/flatzinc/parser.tab.cpp" +#line 4192 "gecode/flatzinc/parser.tab.cpp" break; case 162: /* ann_non_array_expr: FZ_STRING_LIT */ -#line 2312 "./gecode/flatzinc/parser.yxx" +#line 2317 "./gecode/flatzinc/parser.yxx" { (yyval.arg) = new AST::String((yyvsp[0].string_value)); - free((yyvsp[0].string_value)); + free_token((yyvsp[0].string_value)); } -#line 4196 "gecode/flatzinc/parser.tab.cpp" +#line 4201 "gecode/flatzinc/parser.tab.cpp" break; -#line 4200 "gecode/flatzinc/parser.tab.cpp" +#line 4205 "gecode/flatzinc/parser.tab.cpp" default: break; } diff --git a/gecode/flatzinc/parser.tab.hpp b/gecode/flatzinc/parser.tab.hpp index 32453fcef9..ad4a17f719 100644 --- a/gecode/flatzinc/parser.tab.hpp +++ b/gecode/flatzinc/parser.tab.hpp @@ -107,7 +107,7 @@ extern int yydebug; #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { -#line 644 "./gecode/flatzinc/parser.yxx" +#line 649 "./gecode/flatzinc/parser.yxx" int int_value; char* string_value; bool bool_value; double float_value; std::vector* set_values; Gecode::FlatZinc::AST::SetLit* set_literal; diff --git a/gecode/flatzinc/parser.yxx b/gecode/flatzinc/parser.yxx index eaef50d631..f85833ddc8 100755 --- a/gecode/flatzinc/parser.yxx +++ b/gecode/flatzinc/parser.yxx @@ -44,7 +44,7 @@ #include #include -#if defined __GNUC__ +#ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wunused-but-set-variable" #endif @@ -80,7 +80,7 @@ void yyerror(void* parm, const char *str) { pp->had_error = true; } -void yyassert(ParserState* pp, bool cond, const char* str) +static void yyassert(ParserState* pp, bool cond, const char* str) { if (!cond) { pp->err << "Error: " << str @@ -90,12 +90,17 @@ void yyassert(ParserState* pp, bool cond, const char* str) } } +/// Free a string token, which the lexer allocates with strdup +static void free_token(char* s) { + free(s); // NOLINT(cppcoreguidelines-no-malloc): strdup memory needs free +} + /* * The symbol tables * */ -AST::Node* get_array_element(ParserState* pp, const string& id, int offset, +static AST::Node* get_array_element(ParserState* pp, const string& id, int offset, bool annotation) { if (offset > 0) { SymbolEntry e; @@ -173,7 +178,7 @@ error: pp->had_error = true; return new AST::IntVar(0); // keep things consistent } -AST::Node* get_var_ref_arg(ParserState* pp, const string& id, bool annotation = false) { +static AST::Node* get_var_ref_arg(ParserState* pp, const string& id, bool annotation = false) { SymbolEntry e; string n; if (annotation) @@ -197,7 +202,7 @@ AST::Node* get_var_ref_arg(ParserState* pp, const string& id, bool annotation = return new AST::IntVar(0); // keep things consistent } -void add_domain_constraint(ParserState* pp, const std::string& id, AST::Node* var, +static void add_domain_constraint(ParserState* pp, const std::string& id, AST::Node* var, Option& dom) { if (!dom()) return; @@ -207,7 +212,7 @@ void add_domain_constraint(ParserState* pp, const std::string& id, AST::Node* va pp->domain_constraints.push_back(new ConExpr(id, args, nullptr)); } -void add_domain_constraint(ParserState* pp, AST::Node* var, +static void add_domain_constraint(ParserState* pp, AST::Node* var, Option* > dom) { if (!dom()) return; @@ -227,7 +232,7 @@ void add_domain_constraint(ParserState* pp, AST::Node* var, delete dom.some(); } -int get_base_int_var(ParserState* pp, int i) { +static int get_base_int_var(ParserState* pp, int i) { int base = i; IntVarSpec* ivs = static_cast(pp->int_vars[base].second); while (ivs->alias) { @@ -236,7 +241,7 @@ int get_base_int_var(ParserState* pp, int i) { } return base; } -int get_base_bool_var(ParserState* pp, int i) { +static int get_base_bool_var(ParserState* pp, int i) { int base = i; BoolVarSpec* ivs = static_cast(pp->bool_vars[base].second); while (ivs->alias) { @@ -245,7 +250,7 @@ int get_base_bool_var(ParserState* pp, int i) { } return base; } -int get_base_float_var(ParserState* pp, int i) { +static int get_base_float_var(ParserState* pp, int i) { int base = i; FloatVarSpec* ivs = static_cast(pp->float_vars[base].second); while (ivs->alias) { @@ -254,7 +259,7 @@ int get_base_float_var(ParserState* pp, int i) { } return base; } -int get_base_set_var(ParserState* pp, int i) { +static int get_base_set_var(ParserState* pp, int i) { int base = i; SetVarSpec* ivs = static_cast(pp->set_vars[base].second); while (ivs->alias) { @@ -269,7 +274,7 @@ int get_base_set_var(ParserState* pp, int i) { * */ -void initialize_space(ParserState* pp) { +static void initialize_space(ParserState* pp) { if (!pp->had_error) pp->fg->init(pp->int_vars.size(), pp->bool_vars.size(), @@ -466,7 +471,7 @@ void initialize_space(ParserState* pp) { } } -void fill_printer(ParserState& pp, Gecode::FlatZinc::Printer& p) { +static void fill_printer(ParserState& pp, Gecode::FlatZinc::Printer& p) { p.init(pp.get_output()); for (unsigned int i=0; iargs->is_array()) { @@ -506,13 +511,13 @@ AST::Node* array_output(AST::Call* ann) { std::ostringstream oss; oss << "array" << a->a.size() << "d("; - for (unsigned int i=0; ia.size(); i++) { - AST::SetLit* s = a->a[i]->get_set(); - if (s->empty()) + for (AST::Node* element : a->a) { + AST::SetLit* s = element->get_set(); + if (s->empty()) { oss << "{}, "; - else if (s->interval) + } else if (s->interval) { oss << s->min << ".." << s->max << ", "; - else { + } else { oss << "{"; for (unsigned int j=0; js.size(); j++) { oss << s->s[j]; @@ -535,9 +540,9 @@ AST::Node* array_output(AST::Call* ann) { * */ -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { - ParserState::~ParserState(void) { + ParserState::~ParserState() { if (yyscanner) yylex_destroy(yyscanner); for (auto& var : int_vars) @@ -583,7 +588,7 @@ namespace Gecode { namespace FlatZinc { std::unique_ptr mapping(data,unmap); if (fzs == nullptr) { - owned.reset(new FlatZincSpace(rnd)); + owned = std::make_unique(rnd); fzs = owned.get(); } ParserState pp(mapping.get(), sbuf.st_size, err, fzs); @@ -597,7 +602,7 @@ namespace Gecode { namespace FlatZinc { std::string s = string(istreambuf_iterator(file), istreambuf_iterator()); if (fzs == nullptr) { - owned.reset(new FlatZincSpace(rnd)); + owned = std::make_unique(rnd); fzs = owned.get(); } ParserState pp(s, err, fzs); @@ -621,7 +626,7 @@ namespace Gecode { namespace FlatZinc { std::unique_ptr owned; if (fzs == nullptr) { - owned.reset(new FlatZincSpace(rnd)); + owned = std::make_unique(rnd); fzs = owned.get(); } ParserState pp(s, err, fzs); @@ -637,7 +642,7 @@ namespace Gecode { namespace FlatZinc { return pp.fg; } -}} +} // namespace Gecode::FlatZinc %} @@ -775,7 +780,7 @@ constraint_items_head: preddecl_item: FZ_PREDICATE FZ_ID '(' pred_arg_list ')' - { free($2); } + { free_token($2); } pred_arg_list: /* empty */ @@ -787,7 +792,7 @@ pred_arg_list_head: pred_arg: pred_arg_type ':' FZ_ID - { free($3); } + { free_token($3); } pred_arg_type: FZ_ARRAY '[' pred_array_init ']' FZ_OF pred_arg_simple_type @@ -848,7 +853,7 @@ vardecl_item: pp->int_vars.push_back(NamedVarSpec($4, new IntVarSpec($2,!print,func_dep))); } - delete $5; free($4); + delete $5; free_token($4); } | FZ_VAR bool_ti_expr_tail ':' var_par_id annotations non_array_expr_opt { @@ -880,7 +885,7 @@ vardecl_item: pp->bool_vars.push_back(NamedVarSpec($4, new BoolVarSpec($2,!print,func_dep))); } - delete $5; free($4); + delete $5; free_token($4); } | FZ_VAR float_ti_expr_tail ':' var_par_id annotations non_array_expr_opt { @@ -919,7 +924,7 @@ vardecl_item: pp->float_vars.push_back(NamedVarSpec($4, new FloatVarSpec(dom,!print,func_dep))); } - delete $5; free($4); + delete $5; free_token($4); } | FZ_VAR FZ_SET FZ_OF int_ti_expr_tail ':' var_par_id annotations non_array_expr_opt { @@ -952,7 +957,7 @@ vardecl_item: pp->set_vars.push_back(NamedVarSpec($6, new SetVarSpec($4,!print,func_dep))); } - delete $7; free($6); + delete $7; free_token($6); } | FZ_INT ':' var_par_id annotations '=' non_array_expr { @@ -961,7 +966,7 @@ vardecl_item: yyassert(pp, pp->symbols.put($3, se_i($6->get_int())), "Duplicate symbol"); - delete $6; delete $4; free($3); + delete $6; delete $4; free_token($3); } | FZ_FLOAT ':' var_par_id annotations '=' non_array_expr { @@ -971,7 +976,7 @@ vardecl_item: yyassert(pp, pp->symbols.put($3, se_f(pp->float_values.size()-1)), "Duplicate symbol"); - delete $6; delete $4; free($3); + delete $6; delete $4; free_token($3); } | FZ_BOOL ':' var_par_id annotations '=' non_array_expr { @@ -980,7 +985,7 @@ vardecl_item: yyassert(pp, pp->symbols.put($3, se_b($6->get_bool())), "Duplicate symbol"); - delete $6; delete $4; free($3); + delete $6; delete $4; free_token($3); } | FZ_SET FZ_OF FZ_INT ':' var_par_id annotations '=' non_array_expr { @@ -992,7 +997,7 @@ vardecl_item: pp->symbols.put($5, se_s(pp->set_values.size()-1)), "Duplicate symbol"); delete set; - delete $6; free($5); + delete $6; free_token($5); } | FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_VAR int_ti_expr_tail ':' var_par_id annotations vardecl_int_var_array_init @@ -1019,7 +1024,7 @@ vardecl_item: if (print) ivsv->introduced = false; vars[i] = pp->int_vars.size(); - pp->int_vars.push_back(NamedVarSpec($11, ivsv)); + pp->int_vars.emplace_back($11, ivsv); } if (!pp->had_error && $9()) { Option opt = @@ -1039,7 +1044,7 @@ vardecl_item: : Option::none(); IntVarSpec* ispec = new IntVarSpec(dom,!print,false); vars[i] = pp->int_vars.size(); - pp->int_vars.push_back(NamedVarSpec($11, ispec)); + pp->int_vars.emplace_back($11, ispec); } } } @@ -1056,14 +1061,14 @@ vardecl_item: } int iva = pp->arrays.size(); pp->arrays.push_back(vars.size()); - for (unsigned int i=0; iarrays.push_back(vars[i]); + for (int v : vars) + pp->arrays.push_back(v); yyassert(pp, pp->symbols.put($11, se_iva(iva)), "Duplicate symbol"); } if ($9()) delete $9.some(); - delete $12; free($11); + delete $12; free_token($11); } | FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_VAR bool_ti_expr_tail ':' var_par_id annotations vardecl_bool_var_array_init @@ -1089,7 +1094,7 @@ vardecl_item: if (print) bvsv->introduced = false; vars[i] = pp->bool_vars.size(); - pp->bool_vars.push_back(NamedVarSpec($11, (*vsv)[i])); + pp->bool_vars.emplace_back($11, (*vsv)[i]); } if (!pp->had_error && $9()) { Option opt = @@ -1123,14 +1128,14 @@ vardecl_item: } int bva = pp->arrays.size(); pp->arrays.push_back(vars.size()); - for (unsigned int i=0; iarrays.push_back(vars[i]); + for (int v : vars) + pp->arrays.push_back(v); yyassert(pp, pp->symbols.put($11, se_bva(bva)), "Duplicate symbol"); } if ($9()) delete $9.some(); - delete $12; free($11); + delete $12; free_token($11); } | FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_VAR float_ti_expr_tail ':' var_par_id annotations @@ -1158,7 +1163,7 @@ vardecl_item: if (print) ivsv->introduced = false; vars[i] = pp->float_vars.size(); - pp->float_vars.push_back(NamedVarSpec($11, ivsv)); + pp->float_vars.emplace_back($11, ivsv); } if (!pp->had_error && $9()) { Option*> opt = @@ -1178,7 +1183,7 @@ vardecl_item: for (int i=0; i<$5; i++) { FloatVarSpec* ispec = new FloatVarSpec(dom,!print,false); vars[i] = pp->float_vars.size(); - pp->float_vars.push_back(NamedVarSpec($11, ispec)); + pp->float_vars.emplace_back($11, ispec); } } } @@ -1195,14 +1200,14 @@ vardecl_item: } int fva = pp->arrays.size(); pp->arrays.push_back(vars.size()); - for (unsigned int i=0; iarrays.push_back(vars[i]); + for (int v : vars) + pp->arrays.push_back(v); yyassert(pp, pp->symbols.put($11, se_fva(fva)), "Duplicate symbol"); } if ($9()) delete $9.some(); - delete $12; free($11); + delete $12; free_token($11); } | FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_VAR FZ_SET FZ_OF int_ti_expr_tail ':' var_par_id annotations vardecl_set_var_array_init @@ -1228,7 +1233,7 @@ vardecl_item: if (print) svsv->introduced = false; vars[i] = pp->set_vars.size(); - pp->set_vars.push_back(NamedVarSpec($13, (*vsv)[i])); + pp->set_vars.emplace_back($13, (*vsv)[i]); } if (!pp->had_error && $11()) { Option opt = @@ -1248,7 +1253,7 @@ vardecl_item: : Option::none(); SetVarSpec* ispec = new SetVarSpec(dom,!print,false); vars[i] = pp->set_vars.size(); - pp->set_vars.push_back(NamedVarSpec($13, ispec)); + pp->set_vars.emplace_back($13, ispec); } } } @@ -1264,14 +1269,14 @@ vardecl_item: } int sva = pp->arrays.size(); pp->arrays.push_back(vars.size()); - for (unsigned int i=0; iarrays.push_back(vars[i]); + for (int v : vars) + pp->arrays.push_back(v); yyassert(pp, pp->symbols.put($13, se_sva(sva)), "Duplicate symbol"); } if ($11()) delete $11.some(); - delete $14; free($13); + delete $14; free_token($13); } | FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_INT ':' var_par_id annotations '=' '[' int_list ']' @@ -1284,14 +1289,14 @@ vardecl_item: if (!pp->had_error) { int ia = pp->arrays.size(); pp->arrays.push_back($14->size()); - for (unsigned int i=0; i<$14->size(); i++) - pp->arrays.push_back((*$14)[i]); + for (int v : *$14) + pp->arrays.push_back(v); yyassert(pp, pp->symbols.put($10, se_ia(ia)), "Duplicate symbol"); } delete $14; - free($10); + free_token($10); delete $11; } | FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_BOOL ':' @@ -1304,14 +1309,14 @@ vardecl_item: if (!pp->had_error) { int ia = pp->arrays.size(); pp->arrays.push_back($14->size()); - for (unsigned int i=0; i<$14->size(); i++) - pp->arrays.push_back((*$14)[i]); + for (int v : *$14) + pp->arrays.push_back(v); yyassert(pp, pp->symbols.put($10, se_ba(ia)), "Duplicate symbol"); } delete $14; - free($10); + free_token($10); delete $11; } | FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_FLOAT ':' @@ -1325,14 +1330,14 @@ vardecl_item: int fa = pp->arrays.size(); pp->arrays.push_back($14->size()); pp->arrays.push_back(pp->float_values.size()); - for (unsigned int i=0; i<$14->size(); i++) - pp->float_values.push_back((*$14)[i]); + for (double v : *$14) + pp->float_values.push_back(v); yyassert(pp, pp->symbols.put($10, se_fa(fa)), "Duplicate symbol"); } delete $14; - delete $11; free($10); + delete $11; free_token($10); } | FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_SET FZ_OF FZ_INT ':' var_par_id annotations '=' '[' set_literal_list ']' @@ -1345,15 +1350,15 @@ vardecl_item: int sa = pp->arrays.size(); pp->arrays.push_back($16->size()); pp->arrays.push_back(pp->set_values.size()); - for (unsigned int i=0; i<$16->size(); i++) - pp->set_values.push_back((*$16)[i]); + for (const AST::SetLit& v : *$16) + pp->set_values.push_back(v); yyassert(pp, pp->symbols.put($12, se_sa(sa)), "Duplicate symbol"); } delete $16; - delete $13; free($12); + delete $13; free_token($12); } int_init : @@ -1365,16 +1370,16 @@ int_init : { SymbolEntry e; ParserState* pp = static_cast(parm); - if (pp->symbols.get($1, e) && (e.t == ST_INTVAR || e.t == ST_INT)) + if (pp->symbols.get($1, e) && (e.t == ST_INTVAR || e.t == ST_INT)) { $$ = new IntVarSpec(Alias(e.i),false,false); - else { + } else { pp->err << "Error: undefined identifier for type int " << $1 << " in line no. " << yyget_lineno(pp->yyscanner) << '\n' << std::flush; pp->had_error = true; $$ = new IntVarSpec(0,false,false); // keep things consistent } - free($1); + free_token($1); } | var_par_id '[' FZ_INT_LIT ']' { @@ -1395,7 +1400,7 @@ int_init : pp->had_error = true; $$ = new IntVarSpec(0,false,false); // keep things consistent } - free($1); + free_token($1); } int_init_list : @@ -1422,16 +1427,16 @@ float_init : { SymbolEntry e; ParserState* pp = static_cast(parm); - if (pp->symbols.get($1, e) && (e.t == ST_FLOATVAR || e.t == ST_FLOAT)) + if (pp->symbols.get($1, e) && (e.t == ST_FLOATVAR || e.t == ST_FLOAT)) { $$ = new FloatVarSpec(Alias(e.i),false,false); - else { + } else { pp->err << "Error: undefined identifier for type float " << $1 << " in line no. " << yyget_lineno(pp->yyscanner) << '\n' << std::flush; pp->had_error = true; $$ = new FloatVarSpec(0.0,false,false); } - free($1); + free_token($1); } | var_par_id '[' FZ_INT_LIT ']' { @@ -1451,7 +1456,7 @@ float_init : pp->had_error = true; $$ = new FloatVarSpec(0.0,false,false); } - free($1); + free_token($1); } float_init_list : @@ -1477,16 +1482,16 @@ bool_init : { SymbolEntry e; ParserState* pp = static_cast(parm); - if (pp->symbols.get($1, e) && (e.t == ST_BOOLVAR || e.t == ST_BOOL)) + if (pp->symbols.get($1, e) && (e.t == ST_BOOLVAR || e.t == ST_BOOL)) { $$ = new BoolVarSpec(Alias(e.i),false,false); - else { + } else { pp->err << "Error: undefined identifier for type bool " << $1 << " in line no. " << yyget_lineno(pp->yyscanner) << '\n' << std::flush; pp->had_error = true; $$ = new BoolVarSpec(false,false,false); } - free($1); + free_token($1); } | var_par_id '[' FZ_INT_LIT ']' { @@ -1506,7 +1511,7 @@ bool_init : pp->had_error = true; $$ = new BoolVarSpec(false,false,false); } - free($1); + free_token($1); } bool_init_list : @@ -1530,16 +1535,16 @@ set_init : { ParserState* pp = static_cast(parm); SymbolEntry e; - if (pp->symbols.get($1, e) && (e.t == ST_SETVAR || e.t == ST_SET)) + if (pp->symbols.get($1, e) && (e.t == ST_SETVAR || e.t == ST_SET)) { $$ = new SetVarSpec(Alias(e.i),false,false); - else { + } else { pp->err << "Error: undefined identifier for type set " << $1 << " in line no. " << yyget_lineno(pp->yyscanner) << '\n' << std::flush; pp->had_error = true; $$ = new SetVarSpec(Alias(0),false,false); } - free($1); + free_token($1); } | var_par_id '[' FZ_INT_LIT ']' { @@ -1559,7 +1564,7 @@ set_init : pp->had_error = true; $$ = new SetVarSpec(Alias(0),false,false); } - free($1); + free_token($1); } set_init_list : @@ -1606,7 +1611,7 @@ constraint_item : { ParserState *pp = static_cast(parm); std::unique_ptr ce(new ConExpr($2, $4, $6)); - free($2); + free_token($2); if (!pp->had_error) { const std::string& cid = ce->id; if (cid=="gecode_on_restart_status" && $4->a[0]->is_int_var()) { @@ -2032,7 +2037,7 @@ non_array_expr : pp->had_error = true; $$ = nullptr; } - free($1); + free_token($1); } | var_par_id '[' non_array_expr ']' /* array access */ { @@ -2044,7 +2049,7 @@ non_array_expr : else $$ = new AST::IntLit(0); // keep things consistent delete $3; - free($1); + free_token($1); } non_array_expr_list : @@ -2096,7 +2101,7 @@ solve_expr: << yyget_lineno(pp->yyscanner) << '\n' << std::flush; pp->had_error = true; } - free($1); + free_token($1); } | FZ_INT_LIT { @@ -2134,7 +2139,7 @@ solve_expr: else $$ = -pp->arrays[e.i+$3]-1; } - free($1); + free_token($1); } minmax: @@ -2160,7 +2165,7 @@ annotations_head : annotation : FZ_ID '(' annotation_list ')' { - $$ = new AST::Call($1, AST::extract_singleton($3)); free($1); + $$ = new AST::Call($1, AST::extract_singleton($3)); free_token($1); } | annotation_expr { $$ = $1; } @@ -2294,7 +2299,7 @@ ann_non_array_expr : } if (!got_symbol) $$ = get_var_ref_arg(pp,$1,true); - free($1); + free_token($1); } | var_par_id '[' ann_non_array_expr ']' /* array access */ { @@ -2306,10 +2311,10 @@ ann_non_array_expr : else $$ = new AST::IntLit(0); // keep things consistent delete $3; - free($1); + free_token($1); } | FZ_STRING_LIT { $$ = new AST::String($1); - free($1); + free_token($1); } diff --git a/gecode/flatzinc/plugin.hh b/gecode/flatzinc/plugin.hh index f62143e140..73977aa9e4 100644 --- a/gecode/flatzinc/plugin.hh +++ b/gecode/flatzinc/plugin.hh @@ -38,7 +38,7 @@ #include #include -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { /** * \brief Interface for branch plugins * @@ -64,10 +64,12 @@ namespace Gecode { namespace FlatZinc { */ class GECODE_VTABLE_EXPORT BranchPlugin { public: + /// Destructor + virtual ~BranchPlugin() = default; /// The custom branch method that this plugin provides virtual void branch(Gecode::FlatZinc::FlatZincSpace& s, Gecode::FlatZinc::AST::Call* c) = 0; }; -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc Q_DECLARE_INTERFACE(Gecode::FlatZinc::BranchPlugin, "org.gecode.FlatZinc.BranchPlugin/1.0"); #endif diff --git a/gecode/flatzinc/registry-float.cpp b/gecode/flatzinc/registry-float.cpp index 00b5ae0dbb..a1aa8aa4c0 100644 --- a/gecode/flatzinc/registry-float.cpp +++ b/gecode/flatzinc/registry-float.cpp @@ -40,7 +40,7 @@ #include #endif -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { #ifdef GECODE_HAS_FLOAT_VARS namespace { @@ -343,6 +343,6 @@ namespace Gecode { namespace FlatZinc { } // namespace RegistryDetail #endif -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc // STATISTICS: flatzinc-any diff --git a/gecode/flatzinc/registry-internal.hh b/gecode/flatzinc/registry-internal.hh index 1279b31f6c..381322f490 100644 --- a/gecode/flatzinc/registry-internal.hh +++ b/gecode/flatzinc/registry-internal.hh @@ -39,7 +39,7 @@ #include -namespace Gecode { namespace FlatZinc { namespace RegistryDetail { +namespace Gecode::FlatZinc::RegistryDetail { void post_cumulatives(FlatZincSpace& s, const ConExpr& ce, AST::Node* ann); @@ -53,7 +53,7 @@ namespace Gecode { namespace FlatZinc { namespace RegistryDetail { void register_float(Registry& r); #endif -}}} // namespace Gecode::FlatZinc::RegistryDetail +} // namespace Gecode::FlatZinc::RegistryDetail #endif diff --git a/gecode/flatzinc/registry-scheduling.cpp b/gecode/flatzinc/registry-scheduling.cpp index 11c06a444c..2f82e8c479 100644 --- a/gecode/flatzinc/registry-scheduling.cpp +++ b/gecode/flatzinc/registry-scheduling.cpp @@ -37,7 +37,7 @@ #include #include -namespace Gecode { namespace FlatZinc { namespace RegistryDetail { +namespace Gecode::FlatZinc::RegistryDetail { void post_cumulatives(FlatZincSpace& s, const ConExpr& ce, AST::Node* ann) { @@ -218,6 +218,6 @@ namespace Gecode { namespace FlatZinc { namespace RegistryDetail { } } -}}} // namespace Gecode::FlatZinc::RegistryDetail +} // namespace Gecode::FlatZinc::RegistryDetail // STATISTICS: flatzinc-any diff --git a/gecode/flatzinc/registry-set.cpp b/gecode/flatzinc/registry-set.cpp index f7e893810e..c74308afa4 100644 --- a/gecode/flatzinc/registry-set.cpp +++ b/gecode/flatzinc/registry-set.cpp @@ -40,7 +40,7 @@ #include #endif -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { #ifdef GECODE_HAS_SET_VARS namespace { @@ -406,8 +406,8 @@ namespace Gecode { namespace FlatZinc { if ((x.size() < 2) || (cardinality <= 1)) { // The intersection bound is trivial here. atmost_one skips cardinality // for fewer than two sets, and its filter divides by cardinality - 1. - for (int i = 0; i < x.size(); i++) - Gecode::cardinality(s, x[i], cardinality, cardinality); + for (auto xi : x) + Gecode::cardinality(s, xi, cardinality, cardinality); } else { atmost_one(s, x, static_cast(cardinality)); } @@ -520,6 +520,6 @@ namespace Gecode { namespace FlatZinc { } // namespace RegistryDetail #endif -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc // STATISTICS: flatzinc-any diff --git a/gecode/flatzinc/registry.cpp b/gecode/flatzinc/registry.cpp index c565ca20f2..aecb7a54db 100644 --- a/gecode/flatzinc/registry.cpp +++ b/gecode/flatzinc/registry.cpp @@ -45,10 +45,10 @@ #include #include -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { Registry& - registry(void) { + registry() { static Registry r; return r; } @@ -1319,9 +1319,9 @@ namespace Gecode { namespace FlatZinc { if ((targets.size() != 0) && ((targets.min() < 1) || (targets.max() > q))) throw FlatZinc::Error("Registry", "invalid NFA transition"); for (IntSetValues target(targets); target(); ++target) - transitions.push_back(DFA::Transition(state + 1, first_symbol + symbol, target.val())); + transitions.emplace_back(state + 1, first_symbol + symbol, target.val()); } - transitions.push_back(DFA::Transition(-1, 0, 0)); + transitions.emplace_back(-1, 0, 0); std::vector accepting; for (IntSetValues final(finals); final(); ++final) accepting.push_back(final.val()); @@ -1635,7 +1635,8 @@ namespace Gecode { namespace FlatZinc { bool has_exec = (ann != nullptr) && ann->has_call("blackbox_exec"); if (has_dll && has_exec) { throw FlatZinc::Error("Registry", "Blackbox constraint has multiple execution method annotations."); - } else if (has_dll) { + } + if (has_dll) { c = ann->get_call("blackbox_dll"); mode = "dll"; } else if (has_exec) { @@ -1661,8 +1662,8 @@ namespace Gecode { namespace FlatZinc { "of strings."); } AST::Array* al = arr->a[1]->get_array(); - for (unsigned int i = 0; i < al->a.size(); i++) { - args.push_back(string_arg(al->a[i], "argument")); + for (auto& arg : al->a) { + args.push_back(string_arg(arg, "argument")); } } else { target = string_arg(c->args, "target"); @@ -1805,10 +1806,10 @@ namespace Gecode { namespace FlatZinc { return; } int lo = Int::Limits::max, hi = Int::Limits::min, n = 0; - for (int i = 0; i < x.size(); i++) - if (!(x[i].assigned() && (x[i].val() == c))) { - lo = std::min(lo, x[i].min()); - hi = std::max(hi, x[i].max()); + for (auto& xi : x) + if (!(xi.assigned() && (xi.val() == c))) { + lo = std::min(lo, xi.min()); + hi = std::max(hi, xi.max()); n++; } if (n < 2) @@ -1838,8 +1839,8 @@ namespace Gecode { namespace FlatZinc { if ((x.size() != y.size()) || (x.size() != z.size())) throw FlatZinc::Error("Registry", "sort arrays must have equal lengths"); int offset = ce[3]->get_int(); - for (int i = 0; i < z.size(); i++) - z[i] = expr(s, z[i] - offset); + for (auto& zi : z) + zi = expr(s, zi - offset); IntVarArgs xyz; xyz << x << y << z; unshare(s, xyz); @@ -2059,7 +2060,7 @@ namespace Gecode { namespace FlatZinc { class BuiltinPosters { public: - BuiltinPosters(void) { + BuiltinPosters() { registry().add("all_different_int", &p_distinct); registry().add("all_different_offset", &p_distinct_offset); registry().add("gecode_all_different_offset_fzn", &p_distinct_offset); @@ -2303,6 +2304,6 @@ namespace Gecode { namespace FlatZinc { BuiltinPosters builtin_posters; } // namespace -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc // STATISTICS: flatzinc-any diff --git a/gecode/flatzinc/registry.hh b/gecode/flatzinc/registry.hh index 5120f8b102..a5754a92f2 100644 --- a/gecode/flatzinc/registry.hh +++ b/gecode/flatzinc/registry.hh @@ -37,13 +37,13 @@ #include #include -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { /// Map from constraint identifier to constraint posting functions class GECODE_FLATZINC_EXPORT Registry { public: /// Type of constraint posting function - typedef void (*poster)(FlatZincSpace&, const ConExpr&, AST::Node*); + using poster = void (*)(FlatZincSpace&, const ConExpr&, AST::Node*); /// Add posting function \a p with identifier \a id void add(const std::string& id, poster p); /// Post constraint specified by \a ce @@ -55,9 +55,9 @@ namespace Gecode { namespace FlatZinc { }; /// Return global registry object - GECODE_FLATZINC_EXPORT Registry& registry(void); + GECODE_FLATZINC_EXPORT Registry& registry(); -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc #endif diff --git a/gecode/flatzinc/symboltable.hh b/gecode/flatzinc/symboltable.hh index d41c3e21c7..162cb8c5c5 100644 --- a/gecode/flatzinc/symboltable.hh +++ b/gecode/flatzinc/symboltable.hh @@ -36,7 +36,7 @@ #include #include -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { /// Symbol table mapping identifiers (strings) to values template @@ -70,7 +70,7 @@ namespace Gecode { namespace FlatZinc { return true; } -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc #endif // STATISTICS: flatzinc-any diff --git a/gecode/flatzinc/varspec.hh b/gecode/flatzinc/varspec.hh index f2e43be4dc..2a64afe545 100644 --- a/gecode/flatzinc/varspec.hh +++ b/gecode/flatzinc/varspec.hh @@ -38,7 +38,7 @@ #include #include -namespace Gecode { namespace FlatZinc { +namespace Gecode::FlatZinc { /// %Alias for a variable specification class Alias { @@ -51,7 +51,7 @@ namespace Gecode { namespace FlatZinc { class VarSpec { public: /// Destructor - virtual ~VarSpec(void) = default; + virtual ~VarSpec() = default; /// Variable index int i; /// Whether the variable aliases another variable @@ -85,7 +85,7 @@ namespace Gecode { namespace FlatZinc { alias = true; i = eq.v; } - ~IntVarSpec(void) override { + ~IntVarSpec() override { if (!alias && !assigned && domain()) delete domain.some(); } @@ -110,7 +110,7 @@ namespace Gecode { namespace FlatZinc { alias = true; i = eq.v; } - ~BoolVarSpec(void) override { + ~BoolVarSpec() override { if (!alias && !assigned && domain()) delete domain.some(); } @@ -159,13 +159,13 @@ namespace Gecode { namespace FlatZinc { alias = true; i = eq.v; } - ~SetVarSpec(void) override { + ~SetVarSpec() override { if (!alias && upper_bound()) delete upper_bound.some(); } }; -}} // namespace Gecode::FlatZinc +} // namespace Gecode::FlatZinc #endif diff --git a/gecode/float.hh b/gecode/float.hh index a8e029013f..ca9d7fd94b 100644 --- a/gecode/float.hh +++ b/gecode/float.hh @@ -111,7 +111,7 @@ namespace Gecode { * point values. * \ingroup TaskModelFloatVars */ - typedef double FloatNum; + using FloatNum = double; /// Compare objective value \a x with \a y for direction \a s forceinline SpaceComparison @@ -122,17 +122,17 @@ namespace Gecode { } /// Return lower bound of \f$\pi/2\f$ - FloatNum pi_half_lower(void); + FloatNum pi_half_lower(); /// Return upper bound of \f$\pi/2\f$ - FloatNum pi_half_upper(void); + FloatNum pi_half_upper(); /// Return lower bound of \f$\pi\f$ - FloatNum pi_lower(void); + FloatNum pi_lower(); /// Return upper bound of \f$\pi\f$ - FloatNum pi_upper(void); + FloatNum pi_upper(); /// Return lower bound of \f$2\pi\f$ - FloatNum pi_twice_lower(void); + FloatNum pi_twice_lower(); /// Return upper bound of \f$2\pi\f$ - FloatNum pi_twice_upper(void); + FloatNum pi_twice_upper(); // Forward declaration class FloatVal; @@ -141,7 +141,7 @@ namespace Gecode { #include -namespace Gecode { namespace Float { +namespace Gecode::Float { /** * \brief Floating point rounding operations without state saving @@ -191,23 +191,23 @@ namespace Gecode { namespace Float { //@{ #ifdef GECODE_FLOAT_MODE_CONTROL87 /// Floating-point control word, as returned by `_control87` - typedef unsigned int Mode; + using Mode = unsigned int; #else /// Rounding mode, one of the `FE_*` values of `` - typedef int Mode; + using Mode = int; #endif /// Return the current rounding mode - static Mode current_mode(void); + static Mode current_mode(); /// Restore mode \a m, as returned by current_mode() static void restore_mode(Mode m); /// Round toward \f$+\infty\f$ - static void upward(void); + static void upward(); /// Round toward \f$-\infty\f$ - static void downward(void); + static void downward(); /// Round to nearest - static void to_nearest(void); + static void to_nearest(); /// Set the mode that the arithmetic operations expect between calls - static void init(void); + static void init(); //@} private: @@ -243,8 +243,8 @@ namespace Gecode { namespace Float { /// \name Miscellaneous operations //@{ - /// Return an overflow-safe median of \a x and \a y, where \a x <= \a y - FloatNum median(FloatNum x, FloatNum y); + /// Return an overflow-safe median of \a l and \a u, where \a l <= \a u + FloatNum median(FloatNum l, FloatNum u); /// Return next downward-rounded integer of \a x (domain: \f$ [-\infty;+\infty]\f$) FloatNum int_down(FloatNum x); /// Return next upward-rounded integer of \a x (domain: \f$ [-\infty;+\infty] \f$) @@ -347,21 +347,21 @@ namespace Gecode { namespace Float { public: /// Save the caller's mode and initialize the rounding operations - Rounding(void); + Rounding(); /// Restore the caller's mode - ~Rounding(void); + ~Rounding(); /// A scope cannot be copied Rounding(const Rounding&) = delete; /// A scope cannot be assigned Rounding& operator=(const Rounding&) = delete; }; -}} // namespace Gecode::Float +} // namespace Gecode::Float #include #include -namespace Gecode { namespace Float { +namespace Gecode::Float { /** * \brief Test whether \a x is a subset of \a y @@ -405,7 +405,7 @@ namespace Gecode { namespace Float { */ FloatVal hull(const FloatNum& x, const FloatNum& y); -}} // namespace Gecode::Float +} // namespace Gecode::Float namespace Gecode { @@ -496,7 +496,7 @@ namespace Gecode { protected: /// Implementation type for float value - typedef Float::Interval FloatValImpType; + using FloatValImpType = Float::Interval; /// Implementation of float value FloatValImpType x; /// Initialize from implementation \a i @@ -506,7 +506,7 @@ namespace Gecode { /// \name Constructors and initialization //@{ /// Default constructor - FloatVal(void) = default; + FloatVal() = default; /// Initialize with float number \a n FloatVal(const FloatNum& n); /// Initialize with lower bound \a l and upper bound \a u @@ -526,25 +526,25 @@ namespace Gecode { /// \name Value access //@{ /// Return lower bound - FloatNum min(void) const; + FloatNum min() const; /// Return upper bound - FloatNum max(void) const; + FloatNum max() const; /// Return size of float value (distance between maximum and minimum) - FloatNum size(void) const; + FloatNum size() const; /// Return median of float value - FloatNum med(void) const; + FloatNum med() const; //@} /// \name Value tests //@{ /// Test whether float is tight - bool tight(void) const; + bool tight() const; /// Test whether float is a singleton - bool singleton(void) const; + bool singleton() const; /// Test whether \a n is included bool in(FloatNum n) const; /// Test whether zero is included - bool zero_in(void) const; + bool zero_in() const; //@} /// \name Float value construction @@ -552,11 +552,11 @@ namespace Gecode { /// Return hull of \a x and \a y static FloatVal hull(FloatNum x, FloatNum y); /// Return \f$\pi/2\f$ - static FloatVal pi_half(void); + static FloatVal pi_half(); /// Return lower bound of \f$\pi\f$ - static FloatVal pi(void); + static FloatVal pi(); /// Return \f$2\pi\f$ - static FloatVal pi_twice(void); + static FloatVal pi_twice(); //@} /// \name Update operators @@ -650,7 +650,7 @@ namespace Gecode { * \brief Arithmetic operator * \relates Gecode::FloatVal */ - FloatVal operator/(const FloatNum& r, const FloatVal& x); + FloatVal operator/(const FloatNum& x, const FloatVal& y); /** * \brief Comparison operator @@ -908,25 +908,21 @@ namespace Gecode { #include -namespace Gecode { namespace Float { - - /** - * \brief Numerical limits for floating point variables - * - * \ingroup TaskModelFloatVars - */ - namespace Limits { - /// Largest allowed float value - const FloatNum max = std::numeric_limits::max(); - /// Smallest allowed float value - const FloatNum min = -max; - /// Return whether float \a n is a valid number - bool valid(const FloatVal& n); - /// Check whether float \a n is a valid number, otherwise throw out of limits exception with information \a l - void check(const FloatVal& n, const char* l); - } // namespace Limits - -}} // namespace Gecode::Float +/** + * \brief Numerical limits for floating point variables + * + * \ingroup TaskModelFloatVars + */ +namespace Gecode::Float::Limits { + /// Largest allowed float value + const FloatNum max = std::numeric_limits::max(); + /// Smallest allowed float value + const FloatNum min = -max; + /// Return whether float \a n is a valid number + bool valid(const FloatVal& n); + /// Check whether float \a n is a valid number, otherwise throw out of limits exception with information \a l + void check(const FloatVal& n, const char* l); +} // namespace Gecode::Float::Limits #include @@ -961,7 +957,7 @@ namespace Gecode { /// \name Constructors and initialization //@{ /// Default constructor - FloatVar(void) = default; + FloatVar() = default; /// Initialize from float variable \a y FloatVar(const FloatVar& y) = default; /// Initialize from float view \a y @@ -983,15 +979,15 @@ namespace Gecode { /// \name Value access //@{ /// Return domain - FloatVal domain(void) const; + FloatVal domain() const; /// Return minimum of domain - FloatNum min(void) const; + FloatNum min() const; /// Return maximum of domain - FloatNum max(void) const; + FloatNum max() const; /// Return median of domain - FloatNum med(void) const; + FloatNum med() const; /// Return size of domain (distance between maximum and minimum) - FloatNum size(void) const; + FloatNum size() const; /** * \brief Return assigned value * @@ -999,7 +995,7 @@ namespace Gecode { * is not yet assigned. * */ - FloatVal val(void) const; + FloatVal val() const; //@} @@ -1032,7 +1028,7 @@ namespace Gecode { /// \name Constructors and initialization //@{ /// Allocate empty array - FloatValArgs(void); + FloatValArgs(); /// Allocate array with \a n elements explicit FloatValArgs(int n); /// Allocate array and copy elements from \a x @@ -1061,7 +1057,7 @@ namespace Gecode { /// \name Constructors and initialization //@{ /// Allocate empty array - FloatVarArgs(void) = default; + FloatVarArgs() = default; /// Allocate array with \a n elements explicit FloatVarArgs(int n); /// Initialize from variable argument array \a a (copy elements) @@ -1114,7 +1110,7 @@ namespace Gecode { /// \name Creation and initialization //@{ /// Default constructor (array of size 0) - FloatVarArray(void) = default; + FloatVarArray() = default; /// Allocate array for \a n float variables (variables are uninitialized) FloatVarArray(Space& home, int n); /// Initialize from float variable array \a a (share elements) @@ -1467,7 +1463,7 @@ namespace Gecode { * * \ingroup TaskModelFloatBranch */ - typedef std::function FloatBranchFilter; + using FloatBranchFilter = std::function; /** * \brief Branch merit function type for float variables @@ -1479,7 +1475,7 @@ namespace Gecode { * * \ingroup TaskModelFloatBranch */ - typedef std::function FloatBranchMerit; + using FloatBranchMerit = std::function; /** * \brief Value description class for branching @@ -1504,7 +1500,7 @@ namespace Gecode { * * \ingroup TaskModelFloatBranch */ - typedef std::function FloatBranchVal; + using FloatBranchVal = std::function; /** * \brief Branch commit function type for float variables @@ -1517,7 +1513,7 @@ namespace Gecode { * * \ingroup TaskModelFloatBranch */ - typedef std::function FloatBranchCommit; + using FloatBranchCommit = std::function; } // namespace Gecode @@ -1539,7 +1535,7 @@ namespace Gecode { * yet initialized AFC storage is init or the assignment operator. * */ - FloatAFC(void) = default; + FloatAFC() = default; /** * \brief Initialize for float variables \a x and decay factor \a d * @@ -1581,7 +1577,7 @@ namespace Gecode { * yet initialized action storage is init or the assignment operator. * */ - FloatAction(void) = default; + FloatAction() = default; /// Copy constructor FloatAction(const FloatAction& a) = default; /// Assignment operator @@ -1636,7 +1632,7 @@ namespace Gecode { * yet initialized CHB storage is init or the assignment operator. * */ - FloatCHB(void) = default; + FloatCHB() = default; /// Copy constructor FloatCHB(const FloatCHB& chb) = default; /// Assignment operator @@ -1672,9 +1668,8 @@ namespace Gecode { namespace Gecode { /// Function type for explaining branching alternatives for float variables - typedef std::function - FloatVarValPrint; + using FloatVarValPrint = std::function; } // namespace Gecode @@ -1724,7 +1719,7 @@ namespace Gecode { public: /// Initialize with strategy SEL_NONE - FloatVarBranch(void); + FloatVarBranch(); /// Initialize with random number generator \a r FloatVarBranch(const Rnd& r); /// Initialize with selection strategy \a s and tie-break limit function \a t @@ -1740,7 +1735,7 @@ namespace Gecode { /// Initialize with selection strategy \a s, branch merit function \a mf, and tie-break limit function \a t FloatVarBranch(Select s, FloatBranchMerit mf, BranchTbl t); /// Return selection strategy - Select select(void) const; + Select select() const; /// Expand AFC, action, and CHB void expand(Home home, const FloatVarArgs& x); }; @@ -1751,7 +1746,7 @@ namespace Gecode { */ //@{ /// Select first unassigned variable - FloatVarBranch FLOAT_VAR_NONE(void); + FloatVarBranch FLOAT_VAR_NONE(); /// Select random variable (uniform distribution, for tie breaking) FloatVarBranch FLOAT_VAR_RND(const Rnd& r); /// Select variable with least merit according to branch merit function \a bm @@ -1781,11 +1776,11 @@ namespace Gecode { /// Select variable with lowest CHB Q-score FloatVarBranch FLOAT_VAR_CHB_MIN(BranchTbl tbl = nullptr); /// Select variable with lowest CHB Q-score - FloatVarBranch FLOAT_VAR_CHB_MIN(const FloatCHB& a, BranchTbl tbl = nullptr); + FloatVarBranch FLOAT_VAR_CHB_MIN(const FloatCHB& c, BranchTbl tbl = nullptr); /// Select variable with highest CHB Q-score FloatVarBranch FLOAT_VAR_CHB_MAX(BranchTbl tbl = nullptr); /// Select variable with highest CHB Q-score - FloatVarBranch FLOAT_VAR_CHB_MAX(const FloatCHB& a, BranchTbl tbl = nullptr); + FloatVarBranch FLOAT_VAR_CHB_MAX(const FloatCHB& c, BranchTbl tbl = nullptr); /// Select variable with smallest min FloatVarBranch FLOAT_VAR_MIN_MIN(BranchTbl tbl = nullptr); /// Select variable with largest min @@ -1825,7 +1820,7 @@ namespace Gecode { /// Select variable with largest CHB Q-score divided by domain size FloatVarBranch FLOAT_VAR_CHB_SIZE_MAX(BranchTbl tbl = nullptr); /// Select variable with largest CHB Q-score divided by domain size - FloatVarBranch FLOAT_VAR_CHB_SIZE_MAX(const FloatCHB& a, BranchTbl tbl = nullptr); + FloatVarBranch FLOAT_VAR_CHB_SIZE_MAX(const FloatCHB& c, BranchTbl tbl = nullptr); //@} } // namespace Gecode @@ -1862,7 +1857,7 @@ namespace Gecode { /// Initialize with value function \a f and commit function \a c FloatValBranch(FloatBranchVal v, FloatBranchCommit c); /// Return selection strategy - Select select(void) const; + Select select() const; }; /** @@ -1871,9 +1866,9 @@ namespace Gecode { */ //@{ /// Select values not greater than mean of smallest and largest value - FloatValBranch FLOAT_VAL_SPLIT_MIN(void); + FloatValBranch FLOAT_VAL_SPLIT_MIN(); /// Select values greater than mean of smallest and largest value - FloatValBranch FLOAT_VAL_SPLIT_MAX(void); + FloatValBranch FLOAT_VAL_SPLIT_MAX(); /// Select values randomly which are not greater or not smaller than mean of largest and smallest value FloatValBranch FLOAT_VAL_SPLIT_RND(const Rnd& r); /** @@ -1919,7 +1914,7 @@ namespace Gecode { /// Initialize with value function \a f and commit function \a c FloatAssign(FloatBranchVal v, FloatBranchCommit c); /// Return selection strategy - Select select(void) const; + Select select() const; }; /** @@ -1928,9 +1923,9 @@ namespace Gecode { */ //@{ /// Select median value of the lower part - FloatAssign FLOAT_ASSIGN_MIN(void); + FloatAssign FLOAT_ASSIGN_MIN(); /// Select median value of the upper part - FloatAssign FLOAT_ASSIGN_MAX(void); + FloatAssign FLOAT_ASSIGN_MAX(); /// Select median value of a randomly chosen part FloatAssign FLOAT_ASSIGN_RND(const Rnd& r); /** @@ -2070,9 +2065,9 @@ namespace Gecode { /// \name Access //@{ /// Return minimum - FloatNum min(void) const; + FloatNum min() const; /// Return maximum - FloatNum max(void) const; + FloatNum max() const; //@} }; @@ -2088,12 +2083,12 @@ namespace Gecode { * \brief Tracer for float variables * \ingroup TaskFloatTrace */ - typedef ViewTracer FloatTracer; + using FloatTracer = ViewTracer; /** * \brief Trace recorder for float variables * \ingroup TaskFloatTrace */ - typedef ViewTraceRecorder FloatTraceRecorder; + using FloatTraceRecorder = ViewTraceRecorder; /** * \brief Standard float variable tracer diff --git a/gecode/float/arithmetic.hh b/gecode/float/arithmetic.hh index 5f476a7c39..83bd806c37 100644 --- a/gecode/float/arithmetic.hh +++ b/gecode/float/arithmetic.hh @@ -46,7 +46,7 @@ * \brief %Arithmetic propagators */ -namespace Gecode { namespace Float { namespace Arithmetic { +namespace Gecode::Float::Arithmetic { /** * \brief Bounds consistent positive square propagator @@ -407,7 +407,7 @@ namespace Gecode { namespace Float { namespace Arithmetic { static ExecStatus post(Home home, ViewArray& x, View y); }; -}}} // namespace Gecode::Float::Arithmetic +} // namespace Gecode::Float::Arithmetic #include #include diff --git a/gecode/float/arithmetic/abs.hpp b/gecode/float/arithmetic/abs.hpp index 9787dbee35..eb9a37f737 100644 --- a/gecode/float/arithmetic/abs.hpp +++ b/gecode/float/arithmetic/abs.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Float { namespace Arithmetic { +namespace Gecode::Float::Arithmetic { template forceinline @@ -79,6 +79,6 @@ namespace Gecode { namespace Float { namespace Arithmetic { return (x0.assigned() && x1.assigned()) ? home.ES_SUBSUMED(*this) : ES_FIX; } -}}} // namespace Gecode::Float::Arithmetic +} // namespace Gecode::Float::Arithmetic // STATISTICS: float-prop diff --git a/gecode/float/arithmetic/div.hpp b/gecode/float/arithmetic/div.hpp index dfddc9c694..08f9aac4b3 100644 --- a/gecode/float/arithmetic/div.hpp +++ b/gecode/float/arithmetic/div.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Float { namespace Arithmetic { +namespace Gecode::Float::Arithmetic { /* * Bounds consistent division operator @@ -75,6 +75,6 @@ namespace Gecode { namespace Float { namespace Arithmetic { return (x0.assigned() && x1.assigned()) ? home.ES_SUBSUMED(*this) : ES_NOFIX; } -}}} // namespace Gecode::Float::Arithmetic +} // namespace Gecode::Float::Arithmetic // STATISTICS: float-prop diff --git a/gecode/float/arithmetic/min-max.hpp b/gecode/float/arithmetic/min-max.hpp index afb6fa79a5..a8295f2f6e 100644 --- a/gecode/float/arithmetic/min-max.hpp +++ b/gecode/float/arithmetic/min-max.hpp @@ -34,7 +34,7 @@ #include -namespace Gecode { namespace Float { namespace Arithmetic { +namespace Gecode::Float::Arithmetic { /* * Bounds consistent min propagator @@ -225,8 +225,9 @@ namespace Gecode { namespace Float { namespace Arithmetic { if (x[i].max() < maxmin) { x.move_lst(i, home, p, pc); status |= MPS_REMOVED; - } else if (!x[i].assigned()) + } else if (!x[i].assigned()) { status &= ~MPS_ASSIGNED; + } } if (x.size() == 0) return ES_FAILED; @@ -243,6 +244,6 @@ namespace Gecode { namespace Float { namespace Arithmetic { return prop_nary_max(home, *this, x, y, PC_FLOAT_BND); } -}}} // namespace Gecode::Float::Arithmetic +} // namespace Gecode::Float::Arithmetic // STATISTICS: float-prop diff --git a/gecode/float/arithmetic/mult.hpp b/gecode/float/arithmetic/mult.hpp index 148f049173..d434224f73 100644 --- a/gecode/float/arithmetic/mult.hpp +++ b/gecode/float/arithmetic/mult.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Float { namespace Arithmetic { +namespace Gecode::Float::Arithmetic { /// Test whether \a x is positive template @@ -259,6 +259,6 @@ namespace Gecode { namespace Float { namespace Arithmetic { return ES_OK; } -}}} // namespace Gecode::Float::Arithmetic +} // namespace Gecode::Float::Arithmetic // STATISTICS: float-prop diff --git a/gecode/float/arithmetic/pow-nroot.hpp b/gecode/float/arithmetic/pow-nroot.hpp index ab24b92d9e..16de8b39cc 100644 --- a/gecode/float/arithmetic/pow-nroot.hpp +++ b/gecode/float/arithmetic/pow-nroot.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Float { namespace Arithmetic { +namespace Gecode::Float::Arithmetic { /// Propagator maintaining that a float view does not contain zero template @@ -265,6 +265,6 @@ namespace Gecode { namespace Float { namespace Arithmetic { return x0.assigned() ? home.ES_SUBSUMED(*this) : ES_NOFIX; } -}}} // namespace Gecode::Float::Arithmetic +} // namespace Gecode::Float::Arithmetic // STATISTICS: float-prop diff --git a/gecode/float/arithmetic/sqr-sqrt.hpp b/gecode/float/arithmetic/sqr-sqrt.hpp index 2713d5a750..1301a750ed 100644 --- a/gecode/float/arithmetic/sqr-sqrt.hpp +++ b/gecode/float/arithmetic/sqr-sqrt.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Float { namespace Arithmetic { +namespace Gecode::Float::Arithmetic { /* * Positive bounds consistent squaring @@ -110,14 +110,14 @@ namespace Gecode { namespace Float { namespace Arithmetic { return ((x0.val() == 0) || (x0.val() == 1)) ? ES_OK : ES_FAILED; GECODE_ME_CHECK(x1.lq(home, 1)); return SqrPlus::post(home, x0, x1); - } else { - if (x0.min() >= 0) - return SqrPlus::post(home, x0, x1); - if (x0.max() <= 0) - return SqrPlus::post(home, MinusView(x0), x1); - GECODE_ME_CHECK(x1.eq(home, sqr(x0.val()))); - (void)new (home) Sqr(home, x0, x1); } + if (x0.min() >= 0) + return SqrPlus::post(home, x0, x1); + if (x0.max() <= 0) + return SqrPlus::post(home, MinusView(x0), x1); + GECODE_ME_CHECK(x1.eq(home, sqr(x0.val()))); + (void)new (home) Sqr(home, x0, x1); + return ES_OK; } @@ -211,6 +211,6 @@ namespace Gecode { namespace Float { namespace Arithmetic { return ES_FIX; } -}}} // namespace Gecode::Float::Arithmetic +} // namespace Gecode::Float::Arithmetic // STATISTICS: float-prop diff --git a/gecode/float/array-traits.hpp b/gecode/float/array-traits.hpp index 79bdab32f7..29f6933844 100644 --- a/gecode/float/array-traits.hpp +++ b/gecode/float/array-traits.hpp @@ -42,54 +42,54 @@ namespace Gecode { template <> class ArrayTraits> { public: - typedef FloatVarArgs StorageType; - typedef FloatVar ValueType; - typedef FloatVarArgs ArgsType; + using StorageType = FloatVarArgs; + using ValueType = FloatVar; + using ArgsType = FloatVarArgs; }; /// Traits of %FloatVarArray template <> class ArrayTraits> { public: - typedef FloatVarArray StorageType; - typedef FloatVar ValueType; - typedef FloatVarArgs ArgsType; + using StorageType = FloatVarArray; + using ValueType = FloatVar; + using ArgsType = FloatVarArgs; }; /// Traits of %FloatValArgs template <> class ArrayTraits> { public: - typedef FloatValArgs StorageType; - typedef FloatVal ValueType; - typedef FloatValArgs ArgsType; + using StorageType = FloatValArgs; + using ValueType = FloatVal; + using ArgsType = FloatValArgs; }; /// Traits of %FloatVarArray template <> class ArrayTraits { public: - typedef FloatVarArray StorageType; - typedef FloatVar ValueType; - typedef FloatVarArgs ArgsType; + using StorageType = FloatVarArray; + using ValueType = FloatVar; + using ArgsType = FloatVarArgs; }; /// Traits of %FloatVarArgs template <> class ArrayTraits { public: - typedef FloatVarArgs StorageType; - typedef FloatVar ValueType; - typedef FloatVarArgs ArgsType; + using StorageType = FloatVarArgs; + using ValueType = FloatVar; + using ArgsType = FloatVarArgs; }; /// Traits of %FloatValArgs template <> class ArrayTraits { public: - typedef FloatValArgs StorageType; - typedef FloatVal ValueType; - typedef FloatValArgs ArgsType; + using StorageType = FloatValArgs; + using ValueType = FloatVal; + using ArgsType = FloatValArgs; }; } // namespace Gecode diff --git a/gecode/float/array.hpp b/gecode/float/array.hpp index 0618133a8c..935965217b 100644 --- a/gecode/float/array.hpp +++ b/gecode/float/array.hpp @@ -40,7 +40,7 @@ namespace Gecode { */ forceinline - FloatValArgs::FloatValArgs(void) + FloatValArgs::FloatValArgs() : ArgArray(0) {} forceinline diff --git a/gecode/float/bool.hh b/gecode/float/bool.hh index 361e7084e0..07075eae22 100644 --- a/gecode/float/bool.hh +++ b/gecode/float/bool.hh @@ -40,7 +40,7 @@ * \brief Boolean propagators */ -namespace Gecode { namespace Float { namespace Bool { +namespace Gecode::Float::Bool { /** * \brief If-then-else propagator @@ -58,7 +58,7 @@ namespace Gecode { namespace Float { namespace Bool { /// Constructor for cloning \a p Ite(Space& home, Ite& p); /// Constructor for creation - Ite(Home home, Int::BoolView b, View x0, View x1, View x2); + Ite(Home home, Int::BoolView b, View y0, View y1, View y2); public: /// Cost function (defined as low ternary) @@ -75,7 +75,7 @@ namespace Gecode { namespace Float { namespace Bool { size_t dispose(Space& home) override; }; -}}} // namespace Gecode::Float::Bool +} // namespace Gecode::Float::Bool #include diff --git a/gecode/float/bool/ite.hpp b/gecode/float/bool/ite.hpp index 3ed0018efb..b34187c971 100644 --- a/gecode/float/bool/ite.hpp +++ b/gecode/float/bool/ite.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Float { namespace Bool { +namespace Gecode::Float::Bool { template forceinline @@ -120,16 +120,14 @@ namespace Gecode { namespace Float { namespace Bool { GECODE_ME_CHECK(b.zero_none(home)); if (eq21 == RT_TRUE) return home.ES_SUBSUMED(*this); - else - GECODE_REWRITE(*this, (Rel::Eq::post(home(*this), x2, x1))); + GECODE_REWRITE(*this, (Rel::Eq::post(home(*this), x2, x1))); } if (eq21 == RT_FALSE) { GECODE_ME_CHECK(b.one_none(home)); if (eq20 == RT_TRUE) return home.ES_SUBSUMED(*this); - else - GECODE_REWRITE(*this, (Rel::Eq::post(home(*this), x2, x0))); + GECODE_REWRITE(*this, (Rel::Eq::post(home(*this), x2, x0))); } if ((eq20 == RT_TRUE) && (eq21 == RT_TRUE)) @@ -138,6 +136,6 @@ namespace Gecode { namespace Float { namespace Bool { return ES_FIX; } -}}} // namespace Gecode::Float::Bool +} // namespace Gecode::Float::Bool // STATISTICS: float-prop diff --git a/gecode/float/branch.hh b/gecode/float/branch.hh index 79d17157af..28e7edff81 100644 --- a/gecode/float/branch.hh +++ b/gecode/float/branch.hh @@ -42,7 +42,7 @@ * \brief Float branchers */ -namespace Gecode { namespace Float { namespace Branch { +namespace Gecode::Float::Branch { /** * \defgroup FuncFloatViewSel Merit-based float view selection for branchers @@ -139,7 +139,7 @@ namespace Gecode { namespace Float { namespace Branch { /// Return AFC over size as merit for view \a x at position \a i double operator()(const Space& home, FloatView x, int i); /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const; + bool notice() const; /// Dispose view selection void dispose(Space& home); }; @@ -163,7 +163,7 @@ namespace Gecode { namespace Float { namespace Branch { /// Return action over size as merit for view \a x at position \a i double operator()(const Space& home, FloatView x, int i); /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const; + bool notice() const; /// Dispose view selection void dispose(Space& home); }; @@ -187,24 +187,24 @@ namespace Gecode { namespace Float { namespace Branch { /// Return CHB Q-score over size as merit for view \a x at position \a i double operator()(const Space& home, FloatView x, int i); /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const; + bool notice() const; /// Dispose view selection void dispose(Space& home); }; -}}} // namespace Gecode::Float::Branch +} // namespace Gecode::Float::Branch #include -namespace Gecode { namespace Float { namespace Branch { +namespace Gecode::Float::Branch { /// Return view selectors for float views GECODE_FLOAT_EXPORT ViewSel* view_selection(Space& home, const FloatVarBranch& fvb); -}}} // namespace Gecode::Float::Branch +} // namespace Gecode::Float::Branch -namespace Gecode { namespace Float { namespace Branch { +namespace Gecode::Float::Branch { /** * \defgroup FuncFloatValSel Float value selection for brancher @@ -267,7 +267,7 @@ namespace Gecode { namespace Float { namespace Branch { r = r.split(a); } bool - random(void) const { + random() const { return true; } /// Constructor for initialization @@ -277,16 +277,16 @@ namespace Gecode { namespace Float { namespace Branch { /// Return value of view \a x at position \a i FloatNumBranch val(const Space& home, FloatView x, int i); /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const; + bool notice() const; /// Delete value selection void dispose(Space& home); }; -}}} // namespace Gecode::Float::Branch +} // namespace Gecode::Float::Branch #include -namespace Gecode { namespace Float { namespace Branch { +namespace Gecode::Float::Branch { /** * \defgroup FuncFloatValCommit Float value commit classes @@ -320,11 +320,11 @@ namespace Gecode { namespace Float { namespace Branch { void print(const Space& home, unsigned int a, FloatView x, int i, FloatNumBranch n, std::ostream& o) const; }; -}}} // namespace Gecode::Float::Branch +} // namespace Gecode::Float::Branch #include -namespace Gecode { namespace Float { namespace Branch { +namespace Gecode::Float::Branch { /// Return value and commit for float views GECODE_FLOAT_EXPORT @@ -334,7 +334,7 @@ namespace Gecode { namespace Float { namespace Branch { GECODE_FLOAT_EXPORT ValSelCommitBase* value_selection_commit(Space& home, const FloatAssign& ia); -}}} // namespace Gecode::Float::Branch +} // namespace Gecode::Float::Branch #endif diff --git a/gecode/float/branch/action.hpp b/gecode/float/branch/action.hpp index ea4c46342e..aef8123a3d 100644 --- a/gecode/float/branch/action.hpp +++ b/gecode/float/branch/action.hpp @@ -32,10 +32,7 @@ namespace Gecode { - forceinline FloatAction& - FloatAction::operator=(const FloatAction& a) { - return static_cast(Action::operator=(a)); - } + forceinline FloatAction& FloatAction::operator=(const FloatAction& a) = default; } // namespace Gecode diff --git a/gecode/float/branch/assign.hpp b/gecode/float/branch/assign.hpp index e38cfa3bc8..479ed650ca 100644 --- a/gecode/float/branch/assign.hpp +++ b/gecode/float/branch/assign.hpp @@ -45,17 +45,17 @@ namespace Gecode { : ValBranch(std::move(v), std::move(c)), s(SEL_VAL_COMMIT) {} forceinline FloatAssign::Select - FloatAssign::select(void) const { + FloatAssign::select() const { return s; } inline FloatAssign - FLOAT_ASSIGN_MIN(void) { + FLOAT_ASSIGN_MIN() { return FloatAssign(FloatAssign::SEL_MIN); } inline FloatAssign - FLOAT_ASSIGN_MAX(void) { + FLOAT_ASSIGN_MAX() { return FloatAssign(FloatAssign::SEL_MAX); } diff --git a/gecode/float/branch/chb.hpp b/gecode/float/branch/chb.hpp index 6144310e2c..21518bb1c8 100644 --- a/gecode/float/branch/chb.hpp +++ b/gecode/float/branch/chb.hpp @@ -32,10 +32,7 @@ namespace Gecode { - forceinline FloatCHB& - FloatCHB::operator=(const FloatCHB& chb) { - return static_cast(CHB::operator=(chb)); - } + forceinline FloatCHB& FloatCHB::operator=(const FloatCHB& chb) = default; } // namespace Gecode diff --git a/gecode/float/branch/merit.hpp b/gecode/float/branch/merit.hpp index 9ac88c3fbf..b5ff4af192 100644 --- a/gecode/float/branch/merit.hpp +++ b/gecode/float/branch/merit.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Float { namespace Branch { +namespace Gecode::Float::Branch { // Minimum merit forceinline @@ -96,7 +96,7 @@ namespace Gecode { namespace Float { namespace Branch { return x.afc() / static_cast(x.size()); } forceinline bool - MeritAFCSize::notice(void) const { + MeritAFCSize::notice() const { return false; } forceinline void @@ -117,7 +117,7 @@ namespace Gecode { namespace Float { namespace Branch { return action[i] / static_cast(x.size()); } forceinline bool - MeritActionSize::notice(void) const { + MeritActionSize::notice() const { return true; } forceinline void @@ -137,7 +137,7 @@ namespace Gecode { namespace Float { namespace Branch { return chb[i] / static_cast(x.size()); } forceinline bool - MeritCHBSize::notice(void) const { + MeritCHBSize::notice() const { return true; } forceinline void @@ -145,6 +145,6 @@ namespace Gecode { namespace Float { namespace Branch { chb.~CHB(); } -}}} // namespace Gecode::Float::Branch +} // namespace Gecode::Float::Branch // STATISTICS: float-branch diff --git a/gecode/float/branch/traits.hpp b/gecode/float/branch/traits.hpp index 072a541a8c..e65da00b9d 100644 --- a/gecode/float/branch/traits.hpp +++ b/gecode/float/branch/traits.hpp @@ -37,15 +37,15 @@ namespace Gecode { class BranchTraits { public: /// Type for the branching filter function - typedef FloatBranchFilter Filter; + using Filter = FloatBranchFilter; /// Type for the branching merit function - typedef FloatBranchMerit Merit; + using Merit = FloatBranchMerit; /// Type for the branching value function - typedef FloatBranchVal Val; + using Val = FloatBranchVal; /// Return type of the branching value function - typedef FloatNumBranch ValType; + using ValType = FloatNumBranch; /// Type for the branching commit function - typedef FloatBranchCommit Commit; + using Commit = FloatBranchCommit; }; } // namespace Gecode diff --git a/gecode/float/branch/val-commit.hpp b/gecode/float/branch/val-commit.hpp index 08e01410df..7cdcc6385b 100644 --- a/gecode/float/branch/val-commit.hpp +++ b/gecode/float/branch/val-commit.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Float { namespace Branch { +namespace Gecode::Float::Branch { forceinline ValCommitLqGq::ValCommitLqGq(Space& home, const ValBranch& vb) @@ -48,14 +48,11 @@ namespace Gecode { namespace Float { namespace Branch { if ((a == 0) == nl.l) { if ((x.min() == nl.n) || (x.max() == nl.n)) return x.eq(home, x.min()); - else - return x.lq(home, nl.n); - } else { - if ((x.min() == nl.n) || (x.max() == nl.n)) - return x.eq(home, x.max()); - else - return x.gq(home, nl.n); + return x.lq(home, nl.n); } + if ((x.min() == nl.n) || (x.max() == nl.n)) + return x.eq(home, x.max()); + return x.gq(home, nl.n); } forceinline NGL* ValCommitLqGq::ngl(Space&, unsigned int, FloatView, FloatNumBranch) const { @@ -66,6 +63,6 @@ namespace Gecode { namespace Float { namespace Branch { o << "var[" << i << "] " << (((a == 0) == nl.l) ? "<=" : ">=") << "(" << nl.n << ")"; } -}}} // namespace Gecode::Float::Branch +} // namespace Gecode::Float::Branch // STATISTICS: float-branch diff --git a/gecode/float/branch/val-sel-commit.cpp b/gecode/float/branch/val-sel-commit.cpp index baf3f6b4a8..d5acf5b67f 100644 --- a/gecode/float/branch/val-sel-commit.cpp +++ b/gecode/float/branch/val-sel-commit.cpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Float { namespace Branch { +namespace Gecode::Float::Branch { ValSelCommitBase* value_selection_commit(Space& home, const FloatValBranch& fvb) { @@ -74,6 +74,6 @@ namespace Gecode { namespace Float { namespace Branch { } } -}}} // namespace Gecode::Float::Branch +} // namespace Gecode::Float::Branch // STATISTICS: float-branch diff --git a/gecode/float/branch/val-sel.hpp b/gecode/float/branch/val-sel.hpp index 22d8498ef7..a2718af9a3 100644 --- a/gecode/float/branch/val-sel.hpp +++ b/gecode/float/branch/val-sel.hpp @@ -46,7 +46,7 @@ namespace Gecode { } // namespace Gecode -namespace Gecode { namespace Float { namespace Branch { +namespace Gecode::Float::Branch { forceinline ValSelLq::ValSelLq(Space& home, const ValBranch& vb) @@ -91,7 +91,7 @@ namespace Gecode { namespace Float { namespace Branch { return nl; } forceinline bool - ValSelRnd::notice(void) const { + ValSelRnd::notice() const { return false; } forceinline void @@ -99,6 +99,6 @@ namespace Gecode { namespace Float { namespace Branch { r.~Rnd(); } -}}} // namespace Gecode::Float::Branch +} // namespace Gecode::Float::Branch // STATISTICS: float-branch diff --git a/gecode/float/branch/val.hpp b/gecode/float/branch/val.hpp index 61d98505a5..f81c47ee9a 100644 --- a/gecode/float/branch/val.hpp +++ b/gecode/float/branch/val.hpp @@ -45,17 +45,17 @@ namespace Gecode { : ValBranch(std::move(v), std::move(c)), s(SEL_VAL_COMMIT) {} forceinline FloatValBranch::Select - FloatValBranch::select(void) const { + FloatValBranch::select() const { return s; } inline FloatValBranch - FLOAT_VAL_SPLIT_MIN(void) { + FLOAT_VAL_SPLIT_MIN() { return FloatValBranch(FloatValBranch::SEL_SPLIT_MIN); } inline FloatValBranch - FLOAT_VAL_SPLIT_MAX(void) { + FLOAT_VAL_SPLIT_MAX() { return FloatValBranch(FloatValBranch::SEL_SPLIT_MAX); } diff --git a/gecode/float/branch/var.hpp b/gecode/float/branch/var.hpp index bce2be4d63..39bc7c3708 100644 --- a/gecode/float/branch/var.hpp +++ b/gecode/float/branch/var.hpp @@ -35,7 +35,7 @@ namespace Gecode { forceinline - FloatVarBranch::FloatVarBranch(void) + FloatVarBranch::FloatVarBranch() : s(SEL_NONE) {} forceinline @@ -67,7 +67,7 @@ namespace Gecode { : VarBranch(std::move(mf), std::move(t)), s(s0) {} forceinline FloatVarBranch::Select - FloatVarBranch::select(void) const { + FloatVarBranch::select() const { return s; } @@ -100,7 +100,7 @@ namespace Gecode { } inline FloatVarBranch - FLOAT_VAR_NONE(void) { + FLOAT_VAR_NONE() { return FloatVarBranch(FloatVarBranch::SEL_NONE, nullptr); } diff --git a/gecode/float/branch/view-sel.cpp b/gecode/float/branch/view-sel.cpp index ddca33de37..a7299c19c6 100644 --- a/gecode/float/branch/view-sel.cpp +++ b/gecode/float/branch/view-sel.cpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Float { namespace Branch { +namespace Gecode::Float::Branch { ViewSel* view_selection(Space& home, const FloatVarBranch& fvb) { @@ -155,6 +155,6 @@ namespace Gecode { namespace Float { namespace Branch { return nullptr; } -}}} // namespace Gecode::Float::Branch +} // namespace Gecode::Float::Branch // STATISTICS: float-branch diff --git a/gecode/float/channel.hh b/gecode/float/channel.hh index f83fd05526..9ff4b46e42 100644 --- a/gecode/float/channel.hh +++ b/gecode/float/channel.hh @@ -45,7 +45,7 @@ * \brief %Channel propagators */ -namespace Gecode { namespace Float { namespace Channel { +namespace Gecode::Float::Channel { /** * \brief %Propagator for bounds consistent integer part operator @@ -73,7 +73,7 @@ namespace Gecode { namespace Float { namespace Channel { static ExecStatus post(Home home, A x0, B x1); }; -}}} // namespace Gecode::Float::Channel +} // namespace Gecode::Float::Channel #include diff --git a/gecode/float/channel/channel.hpp b/gecode/float/channel/channel.hpp index 0b1aca2d25..2d717f1ae6 100644 --- a/gecode/float/channel/channel.hpp +++ b/gecode/float/channel/channel.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Float { namespace Channel { +namespace Gecode::Float::Channel { template forceinline @@ -70,6 +70,6 @@ namespace Gecode { namespace Float { namespace Channel { return x0.assigned() ? home.ES_SUBSUMED(*this) : ES_FIX; } -}}} // namespace Gecode::Float::Channel +} // namespace Gecode::Float::Channel // STATISTICS: float-prop diff --git a/gecode/float/exception.cpp b/gecode/float/exception.cpp index 73322323f9..2bb88d9eb0 100644 --- a/gecode/float/exception.cpp +++ b/gecode/float/exception.cpp @@ -34,7 +34,7 @@ #include -namespace Gecode { namespace Float { +namespace Gecode::Float { OutOfLimits::OutOfLimits(const char* l) : Exception(l, "Number out of limits") {} @@ -60,6 +60,6 @@ namespace Gecode { namespace Float { ValOfUnassignedVar::ValOfUnassignedVar(const char* l) : Exception(l, "Attempt to access value of unassigned variable") {} -}} // namespace Gecode::Float +} // namespace Gecode::Float // STATISTICS: float-other diff --git a/gecode/float/exception.hpp b/gecode/float/exception.hpp index c78b551d61..c3723c382a 100644 --- a/gecode/float/exception.hpp +++ b/gecode/float/exception.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Float { +namespace Gecode::Float { /** * \defgroup FuncThrowFloat Float exceptions @@ -120,6 +120,6 @@ namespace Gecode { namespace Float { //@} -}} // namespace Gecode::Float +} // namespace Gecode::Float // STATISTICS: float-other diff --git a/gecode/float/interval.hpp b/gecode/float/interval.hpp index 1f8f2ddef7..c9181ba857 100644 --- a/gecode/float/interval.hpp +++ b/gecode/float/interval.hpp @@ -35,7 +35,7 @@ #include #include -namespace Gecode { namespace Float { +namespace Gecode::Float { /** * \brief Closed interval of floating-point numbers with directed rounding @@ -97,7 +97,7 @@ namespace Gecode { namespace Float { /// \name Construction and access //@{ /// Initialize as \f$[0,0]\f$ - Interval(void) = default; + Interval() = default; /// Initialize as \f$[v,v]\f$, accepting NaN explicit Interval(FloatNum v); /// Initialize as \f$[l,u]\f$, throwing unless \f$l\leq u\f$ @@ -107,19 +107,19 @@ namespace Gecode { namespace Float { /// Set to \f$[l,u]\f$, or throw and stay unchanged unless \f$l\leq u\f$ void assign(FloatNum l, FloatNum u); /// Return lower bound - FloatNum lower(void) const; + FloatNum lower() const; /// Return upper bound - FloatNum upper(void) const; + FloatNum upper() const; //@} /// \name Constants //@{ /// Return enclosure of \f$\pi/2\f$ - static Interval pi_half(void); + static Interval pi_half(); /// Return enclosure of \f$\pi\f$ - static Interval pi(void); + static Interval pi(); /// Return enclosure of \f$2\pi\f$ - static Interval pi_twice(void); + static Interval pi_twice(); //@} /// \name Update operators @@ -148,13 +148,13 @@ namespace Gecode { namespace Float { /// Throw the exception for an empty result [[noreturn]] inline void - throw_empty(void) { + throw_empty() { throw std::runtime_error("Gecode::Float::Interval: empty interval"); } /// Return \f$[-\infty,+\infty]\f$ forceinline Interval - whole(void) { + whole() { const FloatNum inf = std::numeric_limits::infinity(); return Interval::unchecked(-inf, inf); } @@ -194,24 +194,24 @@ namespace Gecode { namespace Float { } forceinline FloatNum - Interval::lower(void) const { + Interval::lower() const { return lb; } forceinline FloatNum - Interval::upper(void) const { + Interval::upper() const { return ub; } forceinline Interval - Interval::pi_half(void) { + Interval::pi_half() { return unchecked(pi_half_lower(), pi_half_upper()); } forceinline Interval - Interval::pi(void) { + Interval::pi() { return unchecked(pi_lower(), pi_upper()); } forceinline Interval - Interval::pi_twice(void) { + Interval::pi_twice() { return unchecked(pi_twice_lower(), pi_twice_upper()); } @@ -1364,6 +1364,6 @@ namespace Gecode { namespace Float { #endif -}} // namespace Gecode::Float +} // namespace Gecode::Float // STATISTICS: float-var diff --git a/gecode/float/limits.hpp b/gecode/float/limits.hpp index 4f287a550a..212fee401b 100644 --- a/gecode/float/limits.hpp +++ b/gecode/float/limits.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Float { +namespace Gecode::Float { inline bool Limits::valid(const FloatVal&) { @@ -45,6 +45,6 @@ namespace Gecode { namespace Float { throw OutOfLimits(l); } -}} // namespace Gecode::Float +} // namespace Gecode::Float // STATISTICS: float-var diff --git a/gecode/float/linear.hh b/gecode/float/linear.hh index 996d92d01f..a5b7d0e9b0 100644 --- a/gecode/float/linear.hh +++ b/gecode/float/linear.hh @@ -45,7 +45,7 @@ * \brief %Linear propagators */ -namespace Gecode { namespace Float { namespace Linear { +namespace Gecode::Float::Linear { /** * \brief Base-class for n-ary linear propagators @@ -150,11 +150,11 @@ namespace Gecode { namespace Float { namespace Linear { static ExecStatus post(Home home, ViewArray

& x, ViewArray& y, const FloatVal& c); }; -}}} // namespace Gecode::Float::Linear +} // namespace Gecode::Float::Linear #include -namespace Gecode { namespace Float { namespace Linear { +namespace Gecode::Float::Linear { /** * \brief Class for describing linear term \f$a\cdot x\f$ @@ -221,7 +221,7 @@ namespace Gecode { namespace Float { namespace Linear { */ GECODE_FLOAT_EXPORT void post(Home home, Term* t, int n, FloatRelType frt, const FloatVal& c, Reify r); -}}} // namespace Gecode::Float::Linear +} // namespace Gecode::Float::Linear #endif diff --git a/gecode/float/linear/nary.hpp b/gecode/float/linear/nary.hpp index 0fc41b8837..74a9e03f7c 100644 --- a/gecode/float/linear/nary.hpp +++ b/gecode/float/linear/nary.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Float { namespace Linear { +namespace Gecode::Float::Linear { /* * Linear propagators @@ -346,6 +346,6 @@ namespace Gecode { namespace Float { namespace Linear { return assigned ? home.ES_SUBSUMED(*this) : es; } -}}} // namespace Gecode::Float::Linear +} // namespace Gecode::Float::Linear // STATISTICS: float-prop diff --git a/gecode/float/linear/post.cpp b/gecode/float/linear/post.cpp index e78e6582cc..3ca686c047 100644 --- a/gecode/float/linear/post.cpp +++ b/gecode/float/linear/post.cpp @@ -38,7 +38,7 @@ #include #include -namespace Gecode { namespace Float { namespace Linear { +namespace Gecode::Float::Linear { void estimate(Term* t, int n, const FloatVal& c, FloatNum& l, FloatNum& u) { @@ -47,19 +47,15 @@ namespace Gecode { namespace Float { namespace Linear { est += t[i].a * t[i].x.domain(); FloatNum min = est.min(); FloatNum max = est.max(); - if (min < Limits::min) - min = Limits::min; - if (min > Limits::max) - min = Limits::max; + min = std::max(min, Limits::min); + min = std::min(min, Limits::max); l = min; - if (max < Limits::min) - max = Limits::min; - if (max > Limits::max) - max = Limits::max; + max = std::max(max, Limits::min); + max = std::min(max, Limits::max); u = max; } - forceinline bool + static forceinline bool overflow(Term* t, int n, const FloatVal& c) { FloatVal est = c; for (int i = n; i--;) @@ -79,7 +75,7 @@ namespace Gecode { namespace Float { namespace Linear { }; /// Extend terms by adding view for result - FloatView + static FloatView extend(Home home, Region& r, Term*& t, int& n) { FloatNum min, max; estimate(t, n, 0.0, min, max); @@ -99,7 +95,7 @@ namespace Gecode { namespace Float { namespace Linear { * */ template - forceinline void + static forceinline void post_nary(Home home, ViewArray& x, ViewArray& y, FloatRelType frt, const FloatVal& c) { switch (frt) { case FRT_EQ: @@ -113,7 +109,7 @@ namespace Gecode { namespace Float { namespace Linear { } } - void + static void post_linear(Home home, Term* t, int n, FloatRelType frt, FloatVal c) { Limits::check(c, "Float::linear"); @@ -278,6 +274,6 @@ namespace Gecode { namespace Float { namespace Linear { post_linear(home, t, n, FRT_EQ, 0.0); } -}}} // namespace Gecode::Float::Linear +} // namespace Gecode::Float::Linear // STATISTICS: float-post diff --git a/gecode/float/num.hpp b/gecode/float/num.hpp index d3ac156cb1..437665d2dd 100644 --- a/gecode/float/num.hpp +++ b/gecode/float/num.hpp @@ -38,27 +38,27 @@ namespace Gecode { */ forceinline FloatNum - pi_half_lower(void) { + pi_half_lower() { return 0x1.921fb54442d18p+0; } forceinline FloatNum - pi_half_upper(void) { + pi_half_upper() { return 0x1.921fb54442d19p+0; } forceinline FloatNum - pi_lower(void) { + pi_lower() { return 0x1.921fb54442d18p+1; } forceinline FloatNum - pi_upper(void) { + pi_upper() { return 0x1.921fb54442d19p+1; } forceinline FloatNum - pi_twice_lower(void) { + pi_twice_lower() { return 0x1.921fb54442d18p+2; } forceinline FloatNum - pi_twice_upper(void) { + pi_twice_upper() { return 0x1.921fb54442d19p+2; } } // namespace Gecode diff --git a/gecode/float/rel.hh b/gecode/float/rel.hh index 8a675aa36d..73cc72b3c8 100644 --- a/gecode/float/rel.hh +++ b/gecode/float/rel.hh @@ -48,7 +48,7 @@ * \namespace Gecode::Float::Rel * \brief Simple relation propagators */ -namespace Gecode { namespace Float { namespace Rel { +namespace Gecode::Float::Rel { /* * Equality propagators @@ -375,7 +375,7 @@ namespace Gecode { namespace Float { namespace Rel { static ExecStatus post(Home home, View x0, View x1, CtrlView b); }; -}}} // namespace Gecode::Float::Rel +} // namespace Gecode::Float::Rel #include #include diff --git a/gecode/float/rel/eq.hpp b/gecode/float/rel/eq.hpp index 517b4e7089..bb9d955879 100644 --- a/gecode/float/rel/eq.hpp +++ b/gecode/float/rel/eq.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Float { namespace Rel { +namespace Gecode::Float::Rel { /* * Binary bounds consistent equality @@ -116,7 +116,8 @@ namespace Gecode { namespace Float { namespace Rel { x.unique(home); if (x.size() == 2) { return Eq::post(home, x[0], x[1]); - } else if (x.size() > 2) { + } + if (x.size() > 2) { FloatNum l = x[0].min(); FloatNum u = x[0].max(); for (int i = x.size(); i-- > 1;) { @@ -148,8 +149,7 @@ namespace Gecode { namespace Float { namespace Rel { NaryEq::cost(const Space&, const ModEventDelta& med) const { if (View::me(med) == ME_FLOAT_VAL) return PropCost::unary(PropCost::LO); - else - return PropCost::linear(PropCost::LO, x.size()); + return PropCost::linear(PropCost::LO, x.size()); } template @@ -328,6 +328,6 @@ namespace Gecode { namespace Float { namespace Rel { return home.ES_SUBSUMED(*this); } -}}} // namespace Gecode::Float::Rel +} // namespace Gecode::Float::Rel // STATISTICS: float-prop diff --git a/gecode/float/rel/lq-le.hpp b/gecode/float/rel/lq-le.hpp index 5bc0142bfb..8690c0023c 100644 --- a/gecode/float/rel/lq-le.hpp +++ b/gecode/float/rel/lq-le.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Float { namespace Rel { +namespace Gecode::Float::Rel { /* * Less or equal propagator @@ -92,8 +92,9 @@ namespace Gecode { namespace Float { namespace Rel { if (x0.assigned() && x1.assigned()) { if (x0.max() >= x1.min()) return ES_FAILED; - } else if (x0 == x1) + } else if (x0 == x1) { return ES_FAILED; + } if (x0.max() >= x1.min()) (void)new (home) Le(home, x0, x1); return ES_OK; @@ -155,9 +156,9 @@ namespace Gecode { namespace Float { namespace Rel { GECODE_ME_CHECK(b.zero_none(home)); break; case RT_MAYBE: - if (!x0.assigned() || !x1.assigned()) + if (!x0.assigned() || !x1.assigned()) { (void)new (home) ReLq(home, x0, x1, b); - else { + } else { if (rm != RM_IMP) GECODE_ME_CHECK(b.one_none(home)); } @@ -202,9 +203,9 @@ namespace Gecode { namespace Float { namespace Rel { GECODE_ME_CHECK(b.zero_none(home)); break; case RT_MAYBE: - if (!x0.assigned() || !x1.assigned()) + if (!x0.assigned() || !x1.assigned()) { return ES_FIX; - else { + } else { if (rm != RM_IMP) GECODE_ME_CHECK(b.one_none(home)); break; @@ -389,6 +390,6 @@ namespace Gecode { namespace Float { namespace Rel { return home.ES_SUBSUMED(*this); } -}}} // namespace Gecode::Float::Rel +} // namespace Gecode::Float::Rel // STATISTICS: float-prop diff --git a/gecode/float/rel/nq.hpp b/gecode/float/rel/nq.hpp index 712ff31fb4..850e646cfc 100644 --- a/gecode/float/rel/nq.hpp +++ b/gecode/float/rel/nq.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Float { namespace Rel { +namespace Gecode::Float::Rel { /* * Disequality @@ -118,6 +118,6 @@ namespace Gecode { namespace Float { namespace Rel { return ES_FIX; } -}}} // namespace Gecode::Float::Rel +} // namespace Gecode::Float::Rel // STATISTICS: float-prop diff --git a/gecode/float/relax.cpp b/gecode/float/relax.cpp index 8a63caedab..bdeb1d4a10 100644 --- a/gecode/float/relax.cpp +++ b/gecode/float/relax.cpp @@ -33,7 +33,7 @@ #include #include -namespace Gecode { namespace Float { +namespace Gecode::Float { /// Class for posting equalities for non-relaxed variables class Relax { @@ -48,7 +48,7 @@ namespace Gecode { namespace Float { return me_failed(xv.eq(home, sx.val())) ? ES_FAILED : ES_OK; } -}} // namespace Gecode::Float +} // namespace Gecode::Float namespace Gecode { diff --git a/gecode/float/rounding.cpp b/gecode/float/rounding.cpp index 76e69a55f7..1c4d04abaf 100644 --- a/gecode/float/rounding.cpp +++ b/gecode/float/rounding.cpp @@ -41,13 +41,13 @@ #include #include -namespace Gecode { namespace Float { +namespace Gecode::Float { /// Type signature of mpfr function - typedef int mpfr_func(mpfr_t, const __mpfr_struct*, mp_rnd_t); + using mpfr_func = int(mpfr_t, const __mpfr_struct*, mp_rnd_t); /// Routine to call mpfr function with proper rounding - forceinline double + static forceinline double invoke_mpfr(FloatNum x, mpfr_func f, mp_rnd_t r) { mpfr_t xx; mpfr_init_set_d(xx, x, GMP_RNDN); @@ -82,7 +82,7 @@ namespace Gecode { namespace Float { #undef GECODE_GENR_FUNC -}} // namespace Gecode::Float +} // namespace Gecode::Float #endif diff --git a/gecode/float/rounding.hpp b/gecode/float/rounding.hpp index 0a102b1d27..f5fe656737 100644 --- a/gecode/float/rounding.hpp +++ b/gecode/float/rounding.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Float { +namespace Gecode::Float { /* * Rounding mode control @@ -62,7 +62,7 @@ namespace Gecode { namespace Float { } // namespace Control87 forceinline RoundingBase::Mode - RoundingBase::current_mode(void) { + RoundingBase::current_mode() { return _control87(0, 0); } forceinline void @@ -70,22 +70,22 @@ namespace Gecode { namespace Float { _control87(m, Control87::fields); } forceinline void - RoundingBase::upward(void) { + RoundingBase::upward() { _control87(Control87::base_settings | _RC_UP, Control87::fields); } forceinline void - RoundingBase::downward(void) { + RoundingBase::downward() { _control87(Control87::base_settings | _RC_DOWN, Control87::fields); } forceinline void - RoundingBase::to_nearest(void) { + RoundingBase::to_nearest() { _control87(Control87::base_settings | _RC_NEAR, Control87::fields); } #else forceinline RoundingBase::Mode - RoundingBase::current_mode(void) { + RoundingBase::current_mode() { return std::fegetround(); } forceinline void @@ -93,33 +93,33 @@ namespace Gecode { namespace Float { std::fesetround(m); } forceinline void - RoundingBase::upward(void) { + RoundingBase::upward() { std::fesetround(FE_UPWARD); } forceinline void - RoundingBase::downward(void) { + RoundingBase::downward() { std::fesetround(FE_DOWNWARD); } forceinline void - RoundingBase::to_nearest(void) { + RoundingBase::to_nearest() { std::fesetround(FE_TONEAREST); } #endif forceinline void - RoundingBase::init(void) { + RoundingBase::init() { #ifndef GECODE_FLOAT_DIRECTED_PER_OPERATION upward(); #endif } forceinline - Rounding::Rounding(void) + Rounding::Rounding() : saved(current_mode()) { init(); } - forceinline Rounding::~Rounding(void) { + forceinline Rounding::~Rounding() { restore_mode(saved); } @@ -278,6 +278,6 @@ namespace Gecode { namespace Float { return std::ceil(x); } -}} // namespace Gecode::Float +} // namespace Gecode::Float // STATISTICS: float-var diff --git a/gecode/float/trace/delta.hpp b/gecode/float/trace/delta.hpp index 8820d9efee..09c9e2fde7 100644 --- a/gecode/float/trace/delta.hpp +++ b/gecode/float/trace/delta.hpp @@ -39,12 +39,12 @@ namespace Gecode { } forceinline FloatNum - FloatTraceDelta::min(void) const { + FloatTraceDelta::min() const { return n.min(d); } forceinline FloatNum - FloatTraceDelta::max(void) const { + FloatTraceDelta::max() const { return n.max(d); } diff --git a/gecode/float/trace/trace-view.hpp b/gecode/float/trace/trace-view.hpp index 432b5f1c86..b8ad1a81a1 100644 --- a/gecode/float/trace/trace-view.hpp +++ b/gecode/float/trace/trace-view.hpp @@ -30,13 +30,13 @@ * */ -namespace Gecode { namespace Float { +namespace Gecode::Float { /// Float trace view class FloatTraceView { public: /// Default constructor (initializes with no view) - FloatTraceView(void) = default; + FloatTraceView() = default; /// Duplicate view \a y FloatTraceView(Space& home, FloatView y); /// Update duplicated view from view \a y and delta \a d @@ -58,6 +58,6 @@ namespace Gecode { namespace Float { return x.size(); } -}} // namespace Gecode::Float +} // namespace Gecode::Float // STATISTICS: float-trace diff --git a/gecode/float/trace/traits.hpp b/gecode/float/trace/traits.hpp index 141a4faa56..8a0fc252f8 100644 --- a/gecode/float/trace/traits.hpp +++ b/gecode/float/trace/traits.hpp @@ -36,9 +36,9 @@ namespace Gecode { template <> class TraceTraits { public: - typedef Float::FloatTraceView TraceView; - typedef FloatTraceDelta TraceDelta; - typedef FloatNum SlackValue; + using TraceView = Float::FloatTraceView; + using TraceDelta = FloatTraceDelta; + using SlackValue = FloatNum; }; } // namespace Gecode diff --git a/gecode/float/transcendental.hh b/gecode/float/transcendental.hh index 0082444664..b47d31d5e6 100644 --- a/gecode/float/transcendental.hh +++ b/gecode/float/transcendental.hh @@ -40,7 +40,7 @@ * \brief %Transcendental propagators */ -namespace Gecode { namespace Float { namespace Transcendental { +namespace Gecode::Float::Transcendental { /** * \brief %Propagator for bounds consistent exp operator @@ -99,7 +99,7 @@ namespace Gecode { namespace Float { namespace Transcendental { static ExecStatus post(Home home, FloatNum base, A x0, B x1); }; -}}} // namespace Gecode::Float::Transcendental +} // namespace Gecode::Float::Transcendental #include diff --git a/gecode/float/transcendental/exp-log.hpp b/gecode/float/transcendental/exp-log.hpp index e19279b02f..e3445e79d9 100644 --- a/gecode/float/transcendental/exp-log.hpp +++ b/gecode/float/transcendental/exp-log.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Float { namespace Transcendental { +namespace Gecode::Float::Transcendental { // Round endpoints explicitly; compiler optimizations can ignore changes to // the hardware rounding mode. @@ -69,10 +69,10 @@ namespace Gecode { namespace Float { namespace Transcendental { mpfr_init2(q, std::numeric_limits::digits); // log(base) does not contain zero. Divide all four endpoint pairs with // outward rounding, including when 0 < base < 1. - for (int i = 0; i < 2; i++) { - mpfr_set_d(x, n[i], GMP_RNDN); - for (int j = 0; j < 2; j++) { - mpfr_set_d(y, d[j], GMP_RNDN); + for (double ni : n) { + mpfr_set_d(x, ni, GMP_RNDN); + for (double j : d) { + mpfr_set_d(y, j, GMP_RNDN); mpfr_div(q, x, y, GMP_RNDD); lower = std::min(lower, mpfr_get_d(q, GMP_RNDD)); mpfr_div(q, x, y, GMP_RNDU); @@ -100,9 +100,9 @@ namespace Gecode { namespace Float { namespace Transcendental { Exp::post(Home home, A x0, B x1) { if (x0 == x1) { return ES_FAILED; - } else { - GECODE_ME_CHECK(x1.gq(home, 0.0)); } + GECODE_ME_CHECK(x1.gq(home, 0.0)); + GECODE_ME_CHECK(x1.eq(home, exp(x0.domain()))); if (x1.max() == 0.0) return ES_FAILED; @@ -181,6 +181,6 @@ namespace Gecode { namespace Float { namespace Transcendental { return x0.assigned() ? home.ES_SUBSUMED(*this) : ES_NOFIX; } -}}} // namespace Gecode::Float::Transcendental +} // namespace Gecode::Float::Transcendental // STATISTICS: float-prop diff --git a/gecode/float/trigonometric.hh b/gecode/float/trigonometric.hh index 0516f00b08..4d2c994035 100644 --- a/gecode/float/trigonometric.hh +++ b/gecode/float/trigonometric.hh @@ -39,7 +39,7 @@ * \namespace Gecode::Float::Trigonometric * \brief %Trigonometric propagators */ -namespace Gecode { namespace Float { namespace Trigonometric { +namespace Gecode::Float::Trigonometric { /** * \brief %Propagator for bounds consistent sinus operator @@ -211,7 +211,7 @@ namespace Gecode { namespace Float { namespace Trigonometric { /// Post propagator for \f$atan(x_0) = x_1\f$ static ExecStatus post(Home home, A x0, B x1); }; -}}} // namespace Gecode::Float::Trigonometric +} // namespace Gecode::Float::Trigonometric #include #include diff --git a/gecode/float/trigonometric/asinacos.hpp b/gecode/float/trigonometric/asinacos.hpp index 0d32fdd36a..65262f6c98 100644 --- a/gecode/float/trigonometric/asinacos.hpp +++ b/gecode/float/trigonometric/asinacos.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Float { namespace Trigonometric { +namespace Gecode::Float::Trigonometric { /* * Bounds consistent arc sinus operator @@ -130,6 +130,6 @@ namespace Gecode { namespace Float { namespace Trigonometric { return (x0.assigned() || x1.assigned()) ? home.ES_SUBSUMED(*this) : ES_FIX; } -}}} // namespace Gecode::Float::Trigonometric +} // namespace Gecode::Float::Trigonometric // STATISTICS: float-prop diff --git a/gecode/float/trigonometric/sincos.hpp b/gecode/float/trigonometric/sincos.hpp index 9b299cb2b1..0361b7efde 100644 --- a/gecode/float/trigonometric/sincos.hpp +++ b/gecode/float/trigonometric/sincos.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Float { namespace Trigonometric { +namespace Gecode::Float::Trigonometric { /* * ASin projection function @@ -281,6 +281,6 @@ namespace Gecode { namespace Float { namespace Trigonometric { return (x0.assigned()) ? home.ES_SUBSUMED(*this) : ES_FIX; } -}}} // namespace Gecode::Float::Trigonometric +} // namespace Gecode::Float::Trigonometric // STATISTICS: float-prop diff --git a/gecode/float/trigonometric/tanatan.hpp b/gecode/float/trigonometric/tanatan.hpp index 0bac1707f3..e3c6d08a6f 100644 --- a/gecode/float/trigonometric/tanatan.hpp +++ b/gecode/float/trigonometric/tanatan.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Float { namespace Trigonometric { +namespace Gecode::Float::Trigonometric { /* * ATan projection function * @@ -244,6 +244,6 @@ namespace Gecode { namespace Float { namespace Trigonometric { return (x0.assigned() && x1.assigned()) ? home.ES_SUBSUMED(*this) : ES_FIX; } -}}} // namespace Gecode::Float::Trigonometric +} // namespace Gecode::Float::Trigonometric // STATISTICS: float-prop diff --git a/gecode/float/val.hpp b/gecode/float/val.hpp index a92108f0e2..c734a38d47 100644 --- a/gecode/float/val.hpp +++ b/gecode/float/val.hpp @@ -62,29 +62,29 @@ namespace Gecode { } forceinline FloatNum - FloatVal::min(void) const { + FloatVal::min() const { return x.lower(); } forceinline FloatNum - FloatVal::max(void) const { + FloatVal::max() const { return x.upper(); } forceinline FloatNum - FloatVal::size(void) const { + FloatVal::size() const { return Float::width(x); } forceinline FloatNum - FloatVal::med(void) const { + FloatVal::med() const { Float::Rounding r; return r.median(x.lower(), x.upper()); } forceinline bool - FloatVal::tight(void) const { + FloatVal::tight() const { return (Float::singleton(x) || (nextafter(x.lower(), x.upper()) == x.upper())); } forceinline bool - FloatVal::singleton(void) const { + FloatVal::singleton() const { return Float::singleton(x); } forceinline bool @@ -92,7 +92,7 @@ namespace Gecode { return Float::in(n, x); } forceinline bool - FloatVal::zero_in(void) const { + FloatVal::zero_in() const { return Float::zero_in(x); } @@ -102,17 +102,17 @@ namespace Gecode { return h; } forceinline FloatVal - FloatVal::pi_half(void) { + FloatVal::pi_half() { FloatVal p(FloatValImpType::pi_half()); return p; } forceinline FloatVal - FloatVal::pi(void) { + FloatVal::pi() { FloatVal p(FloatValImpType::pi()); return p; } forceinline FloatVal - FloatVal::pi_twice(void) { + FloatVal::pi_twice() { FloatVal p(FloatValImpType::pi_twice()); return p; } @@ -446,7 +446,7 @@ namespace Gecode { #endif } // namespace Gecode -namespace Gecode { namespace Float { +namespace Gecode::Float { forceinline bool subset(const FloatVal& x, const FloatVal& y) { @@ -482,6 +482,6 @@ namespace Gecode { namespace Float { return FloatVal(x, y); } -}} // namespace Gecode::Float +} // namespace Gecode::Float // STATISTICS: float-var diff --git a/gecode/float/var-imp.hpp b/gecode/float/var-imp.hpp index 30d522a39a..85f32b95bf 100644 --- a/gecode/float/var-imp.hpp +++ b/gecode/float/var-imp.hpp @@ -39,7 +39,7 @@ #include -namespace Gecode { namespace Float { +namespace Gecode::Float { class FloatVarImp; @@ -52,22 +52,22 @@ namespace Gecode { namespace Float { FloatNum _max; ///< Largest value just pruned public: /// Create float delta as providing no information - FloatDelta(void); + FloatDelta(); /// Create float delta with \a min and \a max FloatDelta(FloatNum min, FloatNum max); private: /// Return minimum - FloatNum min(void) const; + FloatNum min() const; /// Return maximum - FloatNum max(void) const; + FloatNum max() const; }; -}} // namespace Gecode::Float +} // namespace Gecode::Float #include -namespace Gecode { namespace Float { +namespace Gecode::Float { /** * \brief Float variable implementation @@ -88,27 +88,27 @@ namespace Gecode { namespace Float { /// \name Value access //@{ /// Return domain - FloatVal domain(void) const; + FloatVal domain() const; /// Return minimum of domain - FloatNum min(void) const; + FloatNum min() const; /// Return maximum of domain - FloatNum max(void) const; + FloatNum max() const; /// Return value of domain (only if assigned) - FloatVal val(void) const; + FloatVal val() const; /// Return median of domain (closest representation) - FloatNum med(void) const; + FloatNum med() const; /// Return width of domain (distance between maximum and minimum) - FloatNum size(void) const; + FloatNum size() const; //@} /// \name Domain tests //@{ /// Test whether variable is assigned - bool assigned(void) const; + bool assigned() const; /// Test whether 0 is contained in domain - bool zero_in(void) const; + bool zero_in() const; /// Test whether \a n is contained in domain bool in(FloatNum n) const; /// Test whether \a n is contained in domain @@ -181,7 +181,7 @@ namespace Gecode { namespace Float { //@} }; -}} // namespace Gecode::Float +} // namespace Gecode::Float #include diff --git a/gecode/float/var-imp/delta.hpp b/gecode/float/var-imp/delta.hpp index e61fa1334f..045e1a4f50 100644 --- a/gecode/float/var-imp/delta.hpp +++ b/gecode/float/var-imp/delta.hpp @@ -37,23 +37,23 @@ * */ -namespace Gecode { namespace Float { +namespace Gecode::Float { forceinline - FloatDelta::FloatDelta(void) + FloatDelta::FloatDelta() : _min(1), _max(0) {} forceinline FloatDelta::FloatDelta(FloatNum min, FloatNum max) : _min(min), _max(max) {} forceinline FloatNum - FloatDelta::min(void) const { + FloatDelta::min() const { return _min; } forceinline FloatNum - FloatDelta::max(void) const { + FloatDelta::max() const { return _max; } -}} // namespace Gecode::Float +} // namespace Gecode::Float // STATISTICS: float-var diff --git a/gecode/float/var-imp/float.cpp b/gecode/float/var-imp/float.cpp index a0e81a8c2f..554d7493d2 100644 --- a/gecode/float/var-imp/float.cpp +++ b/gecode/float/var-imp/float.cpp @@ -39,7 +39,7 @@ #include -namespace Gecode { namespace Float { +namespace Gecode::Float { /* * Dependencies @@ -60,6 +60,6 @@ namespace Gecode { namespace Float { FloatVarImpBase::subscribe(home, a, assigned(), fail); } -}} // namespace Gecode::Float +} // namespace Gecode::Float // STATISTICS: float-var diff --git a/gecode/float/var-imp/float.hpp b/gecode/float/var-imp/float.hpp index 654c3f5b30..88899ed8f1 100644 --- a/gecode/float/var-imp/float.hpp +++ b/gecode/float/var-imp/float.hpp @@ -37,7 +37,7 @@ * */ -namespace Gecode { namespace Float { +namespace Gecode::Float { /* * Creation of new variable implementations @@ -58,33 +58,33 @@ namespace Gecode { namespace Float { */ forceinline FloatVal - FloatVarImp::domain(void) const { + FloatVarImp::domain() const { return dom; } forceinline FloatNum - FloatVarImp::min(void) const { + FloatVarImp::min() const { return dom.min(); } forceinline FloatNum - FloatVarImp::max(void) const { + FloatVarImp::max() const { return dom.max(); } forceinline FloatVal - FloatVarImp::val(void) const { + FloatVarImp::val() const { return dom; } forceinline FloatNum - FloatVarImp::med(void) const { + FloatVarImp::med() const { return dom.med(); } forceinline bool - FloatVarImp::assigned(void) const { + FloatVarImp::assigned() const { return dom.tight(); } forceinline FloatNum - FloatVarImp::size(void) const { + FloatVarImp::size() const { return dom.size(); } @@ -94,7 +94,7 @@ namespace Gecode { namespace Float { */ forceinline bool - FloatVarImp::zero_in(void) const { + FloatVarImp::zero_in() const { return dom.zero_in(); } forceinline bool @@ -228,6 +228,6 @@ namespace Gecode { namespace Float { return FloatVarImpBase::med(me); } -}} // namespace Gecode::Float +} // namespace Gecode::Float // STATISTICS: float-var diff --git a/gecode/float/var/float.hpp b/gecode/float/var/float.hpp index 4fce8fb960..3232dd9d6e 100644 --- a/gecode/float/var/float.hpp +++ b/gecode/float/var/float.hpp @@ -44,31 +44,31 @@ namespace Gecode { : VarImpVar(y.varimp()) {} forceinline FloatVal - FloatVar::val(void) const { + FloatVar::val() const { if (!x->assigned()) throw Float::ValOfUnassignedVar("FloatVar::val"); return x->val(); } forceinline FloatNum - FloatVar::min(void) const { + FloatVar::min() const { return x->min(); } forceinline FloatNum - FloatVar::med(void) const { + FloatVar::med() const { return x->med(); } forceinline FloatNum - FloatVar::max(void) const { + FloatVar::max() const { return x->max(); } forceinline FloatVal - FloatVar::domain(void) const { + FloatVar::domain() const { return x->domain(); } forceinline FloatNum - FloatVar::size(void) const { + FloatVar::size() const { return x->size(); } diff --git a/gecode/float/view.hpp b/gecode/float/view.hpp index 72f01edea3..7a2d6313e4 100644 --- a/gecode/float/view.hpp +++ b/gecode/float/view.hpp @@ -34,7 +34,7 @@ #include -namespace Gecode { namespace Float { +namespace Gecode::Float { /** * \defgroup TaskActorFloatView Float views @@ -56,7 +56,7 @@ namespace Gecode { namespace Float { /// \name Constructors and initialization //@{ /// Default constructor - FloatView(void) = default; + FloatView() = default; /// Initialize from float variable \a y FloatView(const FloatVar& y); /// Initialize from float variable \a y @@ -66,13 +66,13 @@ namespace Gecode { namespace Float { /// \name Value access //@{ /// Return domain - FloatVal domain(void) const; + FloatVal domain() const; /// Return minimum of domain - FloatNum min(void) const; + FloatNum min() const; /// Return maximum of domain - FloatNum max(void) const; + FloatNum max() const; /// Return median of domain (closest representation) - FloatNum med(void) const; + FloatNum med() const; /** * \brief Return assigned value * @@ -80,16 +80,16 @@ namespace Gecode { namespace Float { * is not yet assigned. * */ - FloatVal val(void) const; + FloatVal val() const; /// Return size of domain (distance between maximum and minimum) - FloatNum size(void) const; + FloatNum size() const; //@} /// \name Domain tests //@{ /// Test whether 0 is contained in domain - bool zero_in(void) const; + bool zero_in() const; /// Test whether \a n is contained in domain bool in(FloatNum n) const; /// Test whether \a n is contained in domain @@ -158,7 +158,7 @@ namespace Gecode { namespace Float { /// \name Constructors and initialization //@{ /// Default constructor - MinusView(void) = default; + MinusView() = default; /// Initialize with float view \a y explicit MinusView(const FloatView& y); //@} @@ -166,13 +166,13 @@ namespace Gecode { namespace Float { /// \name Value access //@{ /// Return domain - FloatVal domain(void) const; + FloatVal domain() const; /// Return minimum of domain - FloatNum min(void) const; + FloatNum min() const; /// Return maximum of domain - FloatNum max(void) const; + FloatNum max() const; /// Return median of domain (closest representation) - FloatNum med(void) const; + FloatNum med() const; /** * \brief Return assigned value * @@ -180,16 +180,16 @@ namespace Gecode { namespace Float { * is not yet assigned. * */ - FloatVal val(void) const; + FloatVal val() const; /// Return size of domain (distance between maximum and minimum) - FloatNum size(void) const; + FloatNum size() const; //@} /// \name Domain tests //@{ /// Test whether 0 is contained in domain - bool zero_in(void) const; + bool zero_in() const; /// Test whether \a n is contained in domain bool in(FloatNum n) const; /// Test whether \a n is contained in domain @@ -268,25 +268,25 @@ namespace Gecode { namespace Float { /// \name Constructors and initialization //@{ /// Default constructor - OffsetView(void) = default; + OffsetView() = default; /// Initialize with float view \a y and an offset c - explicit OffsetView(const FloatView& y, FloatNum c); + explicit OffsetView(const FloatView& y, FloatNum d); //@} /// \name Value access //@{ /// Return offset - FloatNum offset(void) const; + FloatNum offset() const; /// Change offset to be \a n void offset(FloatNum n); /// Return domain - FloatVal domain(void) const; + FloatVal domain() const; /// Return minimum of domain - FloatNum min(void) const; + FloatNum min() const; /// Return maximum of domain - FloatNum max(void) const; + FloatNum max() const; /// Return median of domain (closest representation) - FloatNum med(void) const; + FloatNum med() const; /** * \brief Return assigned value * @@ -294,16 +294,16 @@ namespace Gecode { namespace Float { * is not yet assigned. * */ - FloatVal val(void) const; + FloatVal val() const; /// Return size of domain (distance between maximum and minimum) - FloatNum size(void) const; + FloatNum size() const; //@} /// \name Domain tests //@{ /// Test whether 0 is contained in domain - bool zero_in(void) const; + bool zero_in() const; /// Test whether \a n is contained in domain bool in(FloatNum n) const; /// Test whether \a n is contained in domain @@ -394,23 +394,23 @@ namespace Gecode { namespace Float { /// \name Constructors and initialization //@{ /// Default constructor - ScaleView(void) = default; + ScaleView() = default; /// Initialize as \f$b\cdot y\f$ - ScaleView(const FloatVal& b, const FloatView& y); + ScaleView(const FloatVal& d, const FloatView& y); //@} /// \name Value access //@{ /// Return domain - FloatVal domain(void) const; + FloatVal domain() const; /// Return scale factor of scale view - FloatVal scale(void) const; + FloatVal scale() const; /// Return minimum of domain - FloatNum min(void) const; + FloatNum min() const; /// Return maximum of domain - FloatNum max(void) const; + FloatNum max() const; /// Return median of domain (closest representation) - FloatNum med(void) const; + FloatNum med() const; /** * \brief Return assigned value @@ -419,16 +419,16 @@ namespace Gecode { namespace Float { * is not yet assigned. * */ - FloatVal val(void) const; + FloatVal val() const; /// Return size of domain (distance between maximum and minimum) - FloatNum size(void) const; + FloatNum size() const; //@} /// \name Domain tests //@{ /// Test whether 0 is contained in domain - bool zero_in(void) const; + bool zero_in() const; /// Test whether \a n is contained in domain bool in(FloatNum n) const; /// Test whether \a n is contained in domain @@ -500,7 +500,7 @@ namespace Gecode { namespace Float { bool operator==(const ScaleView& x, const ScaleView& y); //@} -}} // namespace Gecode::Float +} // namespace Gecode::Float #include #include @@ -510,7 +510,7 @@ namespace Gecode { namespace Float { #include #include -namespace Gecode { namespace Float { +namespace Gecode::Float { /** * \defgroup TaskActorFloatTest Testing relations between float views * \ingroup TaskActorFloat @@ -548,7 +548,7 @@ namespace Gecode { namespace Float { //@} -}} // namespace Gecode::Float +} // namespace Gecode::Float #include diff --git a/gecode/float/view/float.hpp b/gecode/float/view/float.hpp index cc27997b7c..39d2d633d2 100644 --- a/gecode/float/view/float.hpp +++ b/gecode/float/view/float.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Float { +namespace Gecode::Float { /* * Constructors and initialization @@ -50,28 +50,28 @@ namespace Gecode { namespace Float { * */ forceinline FloatVal - FloatView::domain(void) const { + FloatView::domain() const { return x->domain(); } forceinline FloatNum - FloatView::min(void) const { + FloatView::min() const { return x->min(); } forceinline FloatNum - FloatView::max(void) const { + FloatView::max() const { return x->max(); } forceinline FloatNum - FloatView::med(void) const { + FloatView::med() const { return x->med(); } forceinline FloatVal - FloatView::val(void) const { + FloatView::val() const { return x->val(); } forceinline FloatNum - FloatView::size(void) const { + FloatView::size() const { return x->size(); } @@ -80,7 +80,7 @@ namespace Gecode { namespace Float { * */ forceinline bool - FloatView::zero_in(void) const { + FloatView::zero_in() const { return x->zero_in(); } forceinline bool @@ -153,6 +153,6 @@ namespace Gecode { namespace Float { return VarImpView::med(me); } -}} // namespace Gecode::Float +} // namespace Gecode::Float // STATISTICS: float-var diff --git a/gecode/float/view/minus.hpp b/gecode/float/view/minus.hpp index 77b56477f5..2dff83e02a 100644 --- a/gecode/float/view/minus.hpp +++ b/gecode/float/view/minus.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Float { +namespace Gecode::Float { /* * Constructors and initialization @@ -47,28 +47,28 @@ namespace Gecode { namespace Float { * */ forceinline FloatVal - MinusView::domain(void) const { + MinusView::domain() const { return -x.domain(); } forceinline FloatNum - MinusView::min(void) const { + MinusView::min() const { return -x.max(); } forceinline FloatNum - MinusView::max(void) const { + MinusView::max() const { return -x.min(); } forceinline FloatNum - MinusView::med(void) const { + MinusView::med() const { return -x.med(); } forceinline FloatVal - MinusView::val(void) const { + MinusView::val() const { return -x.val(); } forceinline FloatNum - MinusView::size(void) const { + MinusView::size() const { return x.size(); } @@ -77,7 +77,7 @@ namespace Gecode { namespace Float { * */ forceinline bool - MinusView::zero_in(void) const { + MinusView::zero_in() const { return x.zero_in(); } forceinline bool @@ -159,6 +159,6 @@ namespace Gecode { namespace Float { return x.base() == y.base(); } -}} // namespace Gecode::Float +} // namespace Gecode::Float // STATISTICS: float-var diff --git a/gecode/float/view/offset.hpp b/gecode/float/view/offset.hpp index 4a8ee15dfc..fdae4fad41 100644 --- a/gecode/float/view/offset.hpp +++ b/gecode/float/view/offset.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Float { +namespace Gecode::Float { /* * Constructors and initialization @@ -47,7 +47,7 @@ namespace Gecode { namespace Float { * */ forceinline FloatNum - OffsetView::offset(void) const { + OffsetView::offset() const { return c; } forceinline void @@ -55,28 +55,28 @@ namespace Gecode { namespace Float { c = n; } forceinline FloatVal - OffsetView::domain(void) const { + OffsetView::domain() const { return x.domain() + c; } forceinline FloatNum - OffsetView::min(void) const { + OffsetView::min() const { return x.min() + c; } forceinline FloatNum - OffsetView::max(void) const { + OffsetView::max() const { return x.max() + c; } forceinline FloatNum - OffsetView::med(void) const { + OffsetView::med() const { return x.med() + c; } forceinline FloatVal - OffsetView::val(void) const { + OffsetView::val() const { return x.val() + c; } forceinline FloatNum - OffsetView::size(void) const { + OffsetView::size() const { return x.size(); } @@ -85,7 +85,7 @@ namespace Gecode { namespace Float { * */ forceinline bool - OffsetView::zero_in(void) const { + OffsetView::zero_in() const { return x.in(-c); } forceinline bool @@ -186,6 +186,6 @@ namespace Gecode { namespace Float { return (x.base() == y.base()) && (x.offset() == y.offset()); } -}} // namespace Gecode::Float +} // namespace Gecode::Float // STATISTICS: float-var diff --git a/gecode/float/view/print.hpp b/gecode/float/view/print.hpp index 9f7a049b57..4b1adfdb22 100644 --- a/gecode/float/view/print.hpp +++ b/gecode/float/view/print.hpp @@ -34,7 +34,7 @@ #include -namespace Gecode { namespace Float { +namespace Gecode::Float { namespace Linear { class NoView; } @@ -83,6 +83,6 @@ namespace Gecode { namespace Float { return os << "NoView"; } -}} // namespace Gecode::Float +} // namespace Gecode::Float // STATISTICS: float-var diff --git a/gecode/float/view/rel-test.hpp b/gecode/float/view/rel-test.hpp index 71f7932c35..4f46f51ba5 100644 --- a/gecode/float/view/rel-test.hpp +++ b/gecode/float/view/rel-test.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Float { +namespace Gecode::Float { template forceinline RelTest @@ -90,6 +90,6 @@ namespace Gecode { namespace Float { return RT_MAYBE; } -}} // namespace Gecode::Float +} // namespace Gecode::Float // STATISTICS: float-var diff --git a/gecode/float/view/scale.hpp b/gecode/float/view/scale.hpp index 5f2ff1ea9a..94f332bac7 100644 --- a/gecode/float/view/scale.hpp +++ b/gecode/float/view/scale.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Float { +namespace Gecode::Float { /* * Constructors and initialization @@ -47,40 +47,40 @@ namespace Gecode { namespace Float { * */ forceinline FloatVal - ScaleView::scale(void) const { + ScaleView::scale() const { return a; } forceinline FloatVal - ScaleView::domain(void) const { + ScaleView::domain() const { return x.domain() * a; } forceinline FloatNum - ScaleView::min(void) const { + ScaleView::min() const { FloatVal c = x.min(); c *= a; return c.min(); } forceinline FloatNum - ScaleView::max(void) const { + ScaleView::max() const { FloatVal c = x.max(); c *= a; return c.max(); } forceinline FloatNum - ScaleView::med(void) const { + ScaleView::med() const { FloatVal c = x.med(); c *= a; return (c.min() + c.max()) / 2; } forceinline FloatVal - ScaleView::val(void) const { + ScaleView::val() const { FloatVal c = x.val(); c *= a; return c; } forceinline FloatNum - ScaleView::size(void) const { + ScaleView::size() const { FloatVal c = x.size(); c *= a; return c.max(); @@ -91,7 +91,7 @@ namespace Gecode { namespace Float { * */ forceinline bool - ScaleView::zero_in(void) const { + ScaleView::zero_in() const { return x.zero_in(); } forceinline bool @@ -214,6 +214,6 @@ namespace Gecode { namespace Float { return (x.base() == y.base()) && (x.scale() == y.scale()); } -}} // namespace Gecode::Float +} // namespace Gecode::Float // STATISTICS: float-var diff --git a/gecode/gist.hh b/gecode/gist.hh index 4789c9ed88..553945d371 100644 --- a/gecode/gist.hh +++ b/gecode/gist.hh @@ -70,221 +70,217 @@ #include #include -namespace Gecode { +/** + * \namespace Gecode::Gist + * \brief The %Gecode Interactive %Search Tool + * + * The Gecode::Gist namespace contains the %Gecode Interactive %Search Tool, + * a Qt-based graphical search engine. + * + */ +namespace Gecode::Gist { - /** - * \namespace Gecode::Gist - * \brief The %Gecode Interactive %Search Tool + /** \brief Abstract base class for inspectors * - * The Gecode::Gist namespace contains the %Gecode Interactive %Search Tool, - * a Qt-based graphical search engine. + * An inspector provides a virtual method that is called + * when a node in the search tree is inspected (e.g. by + * double-clicking) * + * \ingroup TaskGist */ - namespace Gist { - - /** \brief Abstract base class for inspectors - * - * An inspector provides a virtual method that is called - * when a node in the search tree is inspected (e.g. by - * double-clicking) - * - * \ingroup TaskGist - */ - class GECODE_GIST_EXPORT Inspector { - public: - /// Call-back function - virtual void inspect(const Space& s) = 0; - /// Name of the inspector - virtual std::string name(void); - /// Clean up when Gist exits - virtual void finalize(void); - /// Destructor - virtual ~Inspector(void); - }; - - /** \brief Abstract base class for comparators - * - * A comparator provides a virtual method that is called - * when a node in the search tree is compared to another - * node. - * - * \ingroup TaskGist - */ - class GECODE_GIST_EXPORT Comparator { - public: - //@{ - ///\name Comparator interface - - /// Call-back function - virtual void compare(const Space& s0, const Space& s1) = 0; - /// Name of the comparator - virtual std::string name(void); - /// Clean up when Gist exits - virtual void finalize(void); - /// Destructor - virtual ~Comparator(void); - - //@} - - //@{ - ///\name Helper methods - - /// Return string representation of difference between arrays \a x and \a y, which are called \a x_n - template - static std::string compare(const std::string& x_n, const VarArgArray& x, const VarArgArray& y); - /// Return string representation of difference between \a x and \a y, which are called \a x_n - static std::string compare(const std::string& x_n, IntVar x, IntVar y); - /// Return string representation of difference between \a x and \a y, which are called \a x_n - static std::string compare(const std::string& x_n, BoolVar x, BoolVar y); + class GECODE_GIST_EXPORT Inspector { + public: + /// Call-back function + virtual void inspect(const Space& s) = 0; + /// Name of the inspector + virtual std::string name(); + /// Clean up when Gist exits + virtual void finalize(); + /// Destructor + virtual ~Inspector(); + }; + + /** \brief Abstract base class for comparators + * + * A comparator provides a virtual method that is called + * when a node in the search tree is compared to another + * node. + * + * \ingroup TaskGist + */ + class GECODE_GIST_EXPORT Comparator { + public: + //@{ + ///\name Comparator interface + + /// Call-back function + virtual void compare(const Space& s0, const Space& s1) = 0; + /// Name of the comparator + virtual std::string name(); + /// Clean up when Gist exits + virtual void finalize(); + /// Destructor + virtual ~Comparator(); + + //@} + + //@{ + ///\name Helper methods + + /// Return string representation of difference between arrays \a x and \a y, which are called \a x_n + template + static std::string compare(const std::string& x_n, const VarArgArray& x, const VarArgArray& y); + /// Return string representation of difference between \a x and \a y, which are called \a x_n + static std::string compare(const std::string& x_n, IntVar x, IntVar y); + /// Return string representation of difference between \a x and \a y, which are called \a x_n + static std::string compare(const std::string& x_n, BoolVar x, BoolVar y); #ifdef GECODE_HAS_SET_VARS - /// Return string representation of difference between \a x and \a y, which are called \a x_n - static std::string compare(const std::string& x_n, SetVar x, SetVar y); + /// Return string representation of difference between \a x and \a y, which are called \a x_n + static std::string compare(const std::string& x_n, SetVar x, SetVar y); #endif #ifdef GECODE_HAS_FLOAT_VARS - /// Return string representation of difference between \a x and \a y, which are called \a x_n - static std::string compare(const std::string& x_n, FloatVar x, FloatVar y); + /// Return string representation of difference between \a x and \a y, which are called \a x_n + static std::string compare(const std::string& x_n, FloatVar x, FloatVar y); #endif - //@} - }; + //@} + }; + + class TextOutputI; + + /// An window for simple text output + class GECODE_GIST_EXPORT TextOutput { + private: + /// The implementation object + TextOutputI* t; + /// The name of the window + std::string n; + + protected: + /// Initialize the implementation object + void init(); + /// Get the stream that is used to output text + std::ostream& get_stream(); + /// Flush stream + void flush(); + /// Add html text \a s to the output + void add_html(const char* s); + + public: + /// Constructor + TextOutput(const std::string& name); + /// Clean up when Gist exits + void finalize(); + /// Destructor + virtual ~TextOutput(); + /// Name of the inspector + virtual std::string name(); + }; + + /// An inspector for printing simple text output + template + class Print : public TextOutput, public Inspector { + public: + /// Constructor + Print(const std::string& name); + /// Use the print method of the template class S to print a space + void inspect(const Space& node) override; + /// Return name + std::string name() override; + /// Clean up when Gist exits + void finalize() override; + }; - class TextOutputI; + /** + * \brief A simple comparator + * + * This class serves two purposes. First, it provides static methods + * that compare two variables or two arrays of variables and return + * a string representation of the differences. + * Second, it implements a Comparator that uses the compare method of + * the script to output the differences between two spaces. + * + */ + template + class VarComparator : public TextOutput, public Comparator { + public: + /// Constructor + VarComparator(const std::string& name); + /// Compare \a s0 to \a s1 + void compare(const Space& s0, const Space& s1) override; + /// Return name + std::string name() override; + /// Finalize when Gist exits + void finalize() override; + }; + + /// A branching that stops exploration + GECODE_GIST_EXPORT + void stop_branch(Space& home); - /// An window for simple text output - class GECODE_GIST_EXPORT TextOutput { + /** + * \brief %Options for %Gist + * + * Note that the \a d and \a stop fields of the Search::Options class + * are not used by Gist. + * + */ + class Options : public Search::Options { + public: + /// Helper class storing inspectors + class I_ { private: - /// The implementation object - TextOutputI* t; - /// The name of the window - std::string n; - - protected: - /// Initialize the implementation object - void init(void); - /// Get the stream that is used to output text - std::ostream& get_stream(void); - /// Flush stream - void flush(void); - /// Add html text \a s to the output - void add_html(const char* s); + Support::DynamicArray _click; + unsigned int n_click; + Support::DynamicArray _solution; + unsigned int n_solution; + Support::DynamicArray _move; + unsigned int n_move; + Support::DynamicArray _compare; + unsigned int n_compare; public: /// Constructor - TextOutput(const std::string& name); - /// Clean up when Gist exits - void finalize(void); - /// Destructor - virtual ~TextOutput(void); - /// Name of the inspector - virtual std::string name(void); - }; - - /// An inspector for printing simple text output - template - class Print : public TextOutput, public Inspector { - public: - /// Constructor - Print(const std::string& name); - /// Use the print method of the template class S to print a space - void inspect(const Space& node) override; - /// Return name - std::string name(void) override; - /// Clean up when Gist exits - void finalize(void) override; - }; - - /** - * \brief A simple comparator - * - * This class serves two purposes. First, it provides static methods - * that compare two variables or two arrays of variables and return - * a string representation of the differences. - * Second, it implements a Comparator that uses the compare method of - * the script to output the differences between two spaces. - * - */ - template - class VarComparator : public TextOutput, public Comparator { - public: - /// Constructor - VarComparator(const std::string& name); - /// Compare \a s0 to \a s1 - void compare(const Space& s0, const Space& s1) override; - /// Return name - std::string name(void) override; - /// Finalize when Gist exits - void finalize(void) override; - }; - - /// A branching that stops exploration - GECODE_GIST_EXPORT - void stop_branch(Space& home); - - /** - * \brief %Options for %Gist - * - * Note that the \a d and \a stop fields of the Search::Options class - * are not used by Gist. - * - */ - class Options : public Search::Options { - public: - /// Helper class storing inspectors - class I_ { - private: - Support::DynamicArray _click; - unsigned int n_click; - Support::DynamicArray _solution; - unsigned int n_solution; - Support::DynamicArray _move; - unsigned int n_move; - Support::DynamicArray _compare; - unsigned int n_compare; - - public: - /// Constructor - I_(void); - /// Add inspector that reacts on node double clicks - void click(Inspector* i); - /// Add inspector that reacts on each new solution that is found - void solution(Inspector* i); - /// Add inspector that reacts on each move of the cursor - void move(Inspector* i); - /// Add comparator - void compare(Comparator* c); - - /// Return click inspector number \a i, or nullptr if it does not exist - Inspector* click(unsigned int i) const; - /// Return solution inspector number \a i, or nullptr if it does not exist - Inspector* solution(unsigned int i) const; - /// Return move inspector number \a i, or nullptr if it does not exist - Inspector* move(unsigned int i) const; - /// Return comparator number \a i, or nullptr if it does not exist - Comparator* compare(unsigned int i) const; - } inspect; - /// Default options - GECODE_GIST_EXPORT static const Options def; - /// Initialize with default values - Options(void) = default; - }; - - /// Create a new stand-alone Gist for \a root using \a bab - GECODE_GIST_EXPORT int explore(Space* root, bool bab, const Options& opt); - - /** - * \brief Create a new stand-alone Gist for \a root - * \ingroup TaskGist - */ - int dfs(Space* root, const Gist::Options& opt = Gist::Options::def); - - /** - * \brief Create a new stand-alone Gist for branch-and-bound search of \a root - * \ingroup TaskGist - */ - int bab(Space* root, const Gist::Options& opt = Gist::Options::def); - - } // namespace Gist - -} // namespace Gecode + I_(); + /// Add inspector that reacts on node double clicks + void click(Inspector* i); + /// Add inspector that reacts on each new solution that is found + void solution(Inspector* i); + /// Add inspector that reacts on each move of the cursor + void move(Inspector* i); + /// Add comparator + void compare(Comparator* c); + + /// Return click inspector number \a i, or nullptr if it does not exist + Inspector* click(unsigned int i) const; + /// Return solution inspector number \a i, or nullptr if it does not exist + Inspector* solution(unsigned int i) const; + /// Return move inspector number \a i, or nullptr if it does not exist + Inspector* move(unsigned int i) const; + /// Return comparator number \a i, or nullptr if it does not exist + Comparator* compare(unsigned int i) const; + } inspect; + /// Default options + GECODE_GIST_EXPORT static const Options def; + /// Initialize with default values + Options() = default; + }; + + /// Create a new stand-alone Gist for \a root using \a bab + GECODE_GIST_EXPORT int explore(Space* root, bool bab, const Options& opt); + + /** + * \brief Create a new stand-alone Gist for \a root + * \ingroup TaskGist + */ + int dfs(Space* root, const Gist::Options& opt = Gist::Options::def); + + /** + * \brief Create a new stand-alone Gist for branch-and-bound search of \a root + * \ingroup TaskGist + */ + int bab(Space* root, const Gist::Options& opt = Gist::Options::def); + +} // namespace Gecode::Gist #include diff --git a/gecode/gist/drawingcursor.cpp b/gecode/gist/drawingcursor.cpp index 3d6fa298e1..efb67d20c8 100644 --- a/gecode/gist/drawingcursor.cpp +++ b/gecode/gist/drawingcursor.cpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Gist { +namespace Gecode::Gist { /// Red color for failed nodes const QColor DrawingCursor::red(218, 37, 29); @@ -70,7 +70,7 @@ namespace Gecode { namespace Gist { } void - DrawingCursor::process_current_node(void) { + DrawingCursor::process_current_node() { Gist::VisualNode* n = node(); double parent_x = x - static_cast(n->get_offset()); double parent_y = y - static_cast(Layout::dist_y) + node_width; @@ -257,6 +257,6 @@ namespace Gecode { namespace Gist { } } -}} // namespace Gecode::Gist +} // namespace Gecode::Gist // STATISTICS: gist-any diff --git a/gecode/gist/drawingcursor.hh b/gecode/gist/drawingcursor.hh index 4bdc4ee755..f9495757cd 100644 --- a/gecode/gist/drawingcursor.hh +++ b/gecode/gist/drawingcursor.hh @@ -37,7 +37,7 @@ #include #include -namespace Gecode { namespace Gist { +namespace Gecode::Gist { /// \brief A cursor that draws a tree on a QWidget class DrawingCursor : public NodeCursor { @@ -54,7 +54,7 @@ namespace Gecode { namespace Gist { bool copies; /// Test if current node is clipped - bool is_clipped(void); + bool is_clipped(); public: /// The color for failed nodes @@ -82,19 +82,19 @@ namespace Gecode { namespace Gist { ///\name Cursor interface //@{ /// Move cursor to parent - void move_upwards(void); + void move_upwards(); /// Test if cursor may move to child - bool may_move_downwards(void); + bool may_move_downwards(); /// Move cursor to child - void move_downwards(void); + void move_downwards(); /// Move cursor to sibling - void move_sidewards(void); + void move_sidewards(); /// Draw the node - void process_current_node(void); + void process_current_node(); //@} }; -}} // namespace Gecode::Gist +} // namespace Gecode::Gist #include diff --git a/gecode/gist/drawingcursor.hpp b/gecode/gist/drawingcursor.hpp index e720fe8dc9..087fccc887 100644 --- a/gecode/gist/drawingcursor.hpp +++ b/gecode/gist/drawingcursor.hpp @@ -30,17 +30,17 @@ * */ -namespace Gecode { namespace Gist { +namespace Gecode::Gist { inline void - DrawingCursor::move_upwards(void) { + DrawingCursor::move_upwards() { x -= node()->get_offset(); y -= Layout::dist_y; NodeCursor::move_upwards(); } forceinline bool - DrawingCursor::is_clipped(void) { + DrawingCursor::is_clipped() { if (clipping_rect.width() == 0 && clipping_rect.x() == 0 && clipping_rect.height() == 0 && clipping_rect.y() == 0) return false; @@ -51,24 +51,24 @@ namespace Gecode { namespace Gist { } inline bool - DrawingCursor::may_move_downwards(void) { + DrawingCursor::may_move_downwards() { return NodeCursor::may_move_downwards() && !node()->is_hidden() && node()->children_layout_is_done() && !is_clipped(); } inline void - DrawingCursor::move_downwards(void) { + DrawingCursor::move_downwards() { NodeCursor::move_downwards(); x += node()->get_offset(); y += Layout::dist_y; } inline void - DrawingCursor::move_sidewards(void) { + DrawingCursor::move_sidewards() { x -= node()->get_offset(); NodeCursor::move_sidewards(); x += node()->get_offset(); } -}} // namespace Gecode::Gist +} // namespace Gecode::Gist // STATISTICS: gist-any diff --git a/gecode/gist/gecodelogo.cpp b/gecode/gist/gecodelogo.cpp index 8581a1a49f..b86dacd711 100644 --- a/gecode/gist/gecodelogo.cpp +++ b/gecode/gist/gecodelogo.cpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Gist { +namespace Gecode::Gist { namespace { const unsigned char _logo[] = { @@ -391,9 +391,8 @@ namespace Gecode { namespace Gist { } // namespace - Logos::Logos(void) - : logo(_logo), logo_size(sizeof(_logo)), gist_logo(_gist_logo), gist_logo_size(sizeof(_gist_logo)) {} + Logos::Logos() : logo(_logo), logo_size(sizeof(_logo)), gist_logo(_gist_logo), gist_logo_size(sizeof(_gist_logo)) {} -}} // namespace Gecode::Gist +} // namespace Gecode::Gist // STATISTICS: gist-any diff --git a/gecode/gist/gecodelogo.hh b/gecode/gist/gecodelogo.hh index 1122d9f1d3..cf76fdc4b2 100644 --- a/gecode/gist/gecodelogo.hh +++ b/gecode/gist/gecodelogo.hh @@ -33,7 +33,7 @@ #ifndef GECODE_GIST_GECODELOGO_HH #define GECODE_GIST_GECODELOGO_HH -namespace Gecode { namespace Gist { +namespace Gecode::Gist { /// Class holding %Gecode and %Gist logo icons class Logos { @@ -49,10 +49,10 @@ namespace Gecode { namespace Gist { const unsigned int gist_logo_size; /// Constructor - Logos(void); + Logos(); }; -}} // namespace Gecode::Gist +} // namespace Gecode::Gist #endif diff --git a/gecode/gist/gist.cpp b/gecode/gist/gist.cpp index 2eac8fe6cc..c5ba88dc0c 100644 --- a/gecode/gist/gist.cpp +++ b/gecode/gist/gist.cpp @@ -38,47 +38,47 @@ #include #include -namespace Gecode { namespace Gist { +namespace Gecode::Gist { std::string - Inspector::name(void) { + Inspector::name() { return "Inspector"; } void - Inspector::finalize(void) {} + Inspector::finalize() {} - Inspector::~Inspector(void) = default; + Inspector::~Inspector() = default; std::string - Comparator::name(void) { + Comparator::name() { return "Comparator"; } void - Comparator::finalize(void) {} + Comparator::finalize() {} - Comparator::~Comparator(void) = default; + Comparator::~Comparator() = default; TextOutput::TextOutput(const std::string& name) : t(nullptr), n(name) {} void - TextOutput::finalize(void) { + TextOutput::finalize() { delete t; t = nullptr; } - TextOutput::~TextOutput(void) { + TextOutput::~TextOutput() { delete t; } std::string - TextOutput::name(void) { + TextOutput::name() { return n; } void - TextOutput::init(void) { + TextOutput::init() { if (t == nullptr) { t = new TextOutputI(n); } @@ -86,12 +86,12 @@ namespace Gecode { namespace Gist { } std::ostream& - TextOutput::get_stream(void) { + TextOutput::get_stream() { return t->get_stream(); } void - TextOutput::flush(void) { + TextOutput::flush() { t->flush(); } @@ -124,7 +124,7 @@ namespace Gecode { namespace Gist { QApplication app(argc, &argv1); GistMainWindow mw(root, bab, opt); - return app.exec(); + return QApplication::exec(); } void @@ -132,6 +132,6 @@ namespace Gecode { namespace Gist { StopBrancher::post(home); } -}} // namespace Gecode::Gist +} // namespace Gecode::Gist // STATISTICS: gist-any diff --git a/gecode/gist/gist.hpp b/gecode/gist/gist.hpp index 9135e1861e..b2961e098f 100644 --- a/gecode/gist/gist.hpp +++ b/gecode/gist/gist.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Gist { +namespace Gecode::Gist { template VarComparator::VarComparator(const std::string& name) : TextOutput(name) {} @@ -40,7 +40,7 @@ namespace Gecode { namespace Gist { VarComparator::compare(const Space& s0, const Space& s1) { std::ostringstream result; dynamic_cast(s0).compare(s1, result); - if (result.str() != "") { + if (!result.str().empty()) { init(); add_html("

\n");
             get_stream() << result.str() << '\n';
@@ -50,13 +50,13 @@ namespace Gecode { namespace Gist {
 
     template 
     std::string
-    VarComparator::name(void) {
+    VarComparator::name() {
         return TextOutput::name();
     }
 
     template 
     void
-    VarComparator::finalize(void) {
+    VarComparator::finalize() {
         TextOutput::finalize();
     }
 
@@ -115,7 +115,7 @@ namespace Gecode { namespace Gist {
             std::ostringstream xni;
             xni << x_n << "[" << i << "]";
             std::string cmp = compare(xni.str(), x[i], y[i]);
-            if (cmp != "") {
+            if (!cmp.empty()) {
                 if (!first) {
                     ret << ", ";
                 } else {
@@ -142,18 +142,18 @@ namespace Gecode { namespace Gist {
 
     template 
     std::string
-    Print::name(void) {
+    Print::name() {
         return TextOutput::name();
     }
 
     template 
     void
-    Print::finalize(void) {
+    Print::finalize() {
         TextOutput::finalize();
     }
 
     forceinline
-    Options::I_::I_(void)
+    Options::I_::I_()
         : _click(heap, 1), n_click(0), _solution(heap, 1), n_solution(0), _move(heap, 1), n_move(0), _compare(heap, 1),
           n_compare(0) {}
 
@@ -200,6 +200,6 @@ namespace Gecode { namespace Gist {
         return Gist::explore(root, true, opt);
     }
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 // STATISTICS: gist-any
diff --git a/gecode/gist/layoutcursor.hh b/gecode/gist/layoutcursor.hh
index 1aa1904dc9..94a471c27d 100644
--- a/gecode/gist/layoutcursor.hh
+++ b/gecode/gist/layoutcursor.hh
@@ -36,7 +36,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     /// \brief A cursor that computes a tree layout for VisualNodes
     class LayoutCursor : public NodeCursor {
@@ -47,13 +47,13 @@ namespace Gecode { namespace Gist {
         /// \name Cursor interface
         //@{
         /// Test if the cursor may move to the first child node
-        bool may_move_downwards(void);
+        bool may_move_downwards();
         /// Compute layout for current node
-        void process_current_node(void);
+        void process_current_node();
         //@}
     };
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 #include 
 
diff --git a/gecode/gist/layoutcursor.hpp b/gecode/gist/layoutcursor.hpp
index cb544e333c..04daabd975 100644
--- a/gecode/gist/layoutcursor.hpp
+++ b/gecode/gist/layoutcursor.hpp
@@ -30,10 +30,10 @@
  *
  */
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     forceinline bool
-    LayoutCursor::may_move_downwards(void) {
+    LayoutCursor::may_move_downwards() {
         return NodeCursor::may_move_downwards() && node()->is_dirty();
     }
 
@@ -41,13 +41,11 @@ namespace Gecode { namespace Gist {
         : NodeCursor(the_node, na) {}
 
     forceinline void
-    LayoutCursor::process_current_node(void) {
+    LayoutCursor::process_current_node() {
         VisualNode* current_node = node();
         if (current_node->is_dirty()) {
             if (current_node->is_hidden()) {
                 // do nothing
-            } else if (false && current_node->get_number_of_children() < 1) {
-                current_node->set_shape(Shape::leaf);
             } else {
                 current_node->compute_shape(na);
             }
@@ -57,6 +55,6 @@ namespace Gecode { namespace Gist {
             current_node->set_children_layout_done(true);
     }
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 // STATISTICS: gist-any
diff --git a/gecode/gist/mainwindow.cpp b/gecode/gist/mainwindow.cpp
index 285992673a..555e7f7d03 100644
--- a/gecode/gist/mainwindow.cpp
+++ b/gecode/gist/mainwindow.cpp
@@ -37,7 +37,7 @@
 
 #include 
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     AboutGist::AboutGist(QWidget* parent) : QDialog(parent) {
 
@@ -201,7 +201,7 @@ namespace Gecode { namespace Gist {
         connect(c, SIGNAL(status_changed(const Statistics&, bool)), this,
                 SLOT(status_changed(const Statistics&, bool)));
 
-        connect(c, SIGNAL(search_finished(void)), this, SLOT(close(void)));
+        connect(c, SIGNAL(search_finished()), this, SLOT(close()));
 
         preferences(true);
         show();
@@ -224,32 +224,12 @@ namespace Gecode { namespace Gist {
             pref_action->setEnabled(true);
         } else if (is_searching && finished) {
             is_searching = false;
-            double ms = search_timer.stop();
-            double s = std::floor(ms / 1000.0);
-            ms -= s * 1000.0;
-            double m = std::floor(s / 60.0);
-            s -= m * 60.0;
-            double h = std::floor(m / 60.0);
-            m -= h * 60.0;
-
-            // QString t;
-            // if (static_cast(h) != 0)
-            //   t += QString().setNum(static_cast(h))+"h ";
-            // if (static_cast(m) != 0)
-            //   t += QString().setNum(static_cast(m))+"m ";
-            // if (static_cast(s) != 0)
-            //   t += QString().setNum(static_cast(s));
-            // else
-            //   t += "0";
-            // t += "."+QString().setNum(static_cast(ms))+"s";
-            // statusBar()->showMessage(QString("Ready (search time ")+t+")");
             statusBar()->showMessage("Ready");
             pref_action->setEnabled(true);
         } else if (!is_searching && !finished) {
             pref_action->setEnabled(false);
             statusBar()->showMessage("Searching");
             is_searching = true;
-            search_timer.start();
         }
         depth_label->setNum(stats.max_depth);
         solved_label->setNum(stats.solutions);
@@ -259,7 +239,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    GistMainWindow::about(void) {
+    GistMainWindow::about() {
         about_gist.show();
     }
 
@@ -283,7 +263,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    GistMainWindow::populate_inspector_selection(void) {
+    GistMainWindow::populate_inspector_selection() {
         double_click_inspectors_menu->clear();
         double_click_inspectors_menu->addActions(c->double_click_inspector_group->actions());
         solution_inspectors_menu->clear();
@@ -295,7 +275,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    GistMainWindow::populate_bookmarks(void) {
+    GistMainWindow::populate_bookmarks() {
         bookmarks_menu->clear();
         bookmarks_menu->addAction(c->bookmark_node);
         bookmarks_menu->addSeparator();
@@ -303,7 +283,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    GistMainWindow::populate_inspectors(void) {
+    GistMainWindow::populate_inspectors() {
         inspect_node_menu->clear();
         inspect_node_menu->addAction(c->inspect);
         inspect_node_menu->addSeparator();
@@ -314,6 +294,6 @@ namespace Gecode { namespace Gist {
         inspect_node_before_fp_menu->addActions(c->inspect_before_fp_group->actions());
     }
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 // STATISTICS: gist-any
diff --git a/gecode/gist/mainwindow.hh b/gecode/gist/mainwindow.hh
index fac74d3d8e..a6ac9ad977 100644
--- a/gecode/gist/mainwindow.hh
+++ b/gecode/gist/mainwindow.hh
@@ -36,7 +36,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     /// Display information about %Gist
     class AboutGist : public QDialog {
@@ -57,8 +57,6 @@ namespace Gecode { namespace Gist {
         Options opt;
         /// Whether search is currently running
         bool is_searching;
-        /// Measure search time
-        Support::Timer search_timer;
         /// Status bar label for maximum depth indicator
         QLabel* depth_label;
         /// Status bar label for number of solutions
@@ -94,19 +92,18 @@ namespace Gecode { namespace Gist {
         /// About dialog
         AboutGist about_gist;
 
-    protected Q_SLOTS:
         /// The status has changed (e.g., new solutions have been found)
         void status_changed(const Statistics& stats, bool finished);
         /// Open the about dialog
-        void about(void);
+        void about();
         /// Open the preferences dialog
         void preferences(bool setup = false);
         /// Populate the inspector menus from the actions found in Gist
-        void populate_inspector_selection(void);
+        void populate_inspector_selection();
         /// Populate the inspector menus from the actions found in Gist
-        void populate_inspectors(void);
+        void populate_inspectors();
         /// Populate the bookmarks menus from the actions found in Gist
-        void populate_bookmarks(void);
+        void populate_bookmarks();
 
     public:
         /// Constructor
@@ -117,7 +114,7 @@ namespace Gecode { namespace Gist {
         void closeEvent(QCloseEvent* event) override;
     };
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 #endif
 
diff --git a/gecode/gist/node.cpp b/gecode/gist/node.cpp
index 0a3434a3a9..3c8fcd8c0d 100644
--- a/gecode/gist/node.cpp
+++ b/gecode/gist/node.cpp
@@ -35,7 +35,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     void
     Node::set_number_of_children(unsigned int n, NodeAllocator& na) {
@@ -68,6 +68,6 @@ namespace Gecode { namespace Gist {
         }
     }
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 // STATISTICS: gist-any
diff --git a/gecode/gist/node.hh b/gecode/gist/node.hh
index e3a87d5261..07f51bf02d 100644
--- a/gecode/gist/node.hh
+++ b/gecode/gist/node.hh
@@ -38,7 +38,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     class VisualNode;
 
@@ -65,7 +65,7 @@ namespace Gecode { namespace Gist {
         /// Current node number in current block
         int cur_t;
         /// Allocate new block, potentially reallocate block array
-        void allocate(void);
+        void allocate();
         /// Flag whether search uses branch-and-bound
         bool _bab;
         /// Hash table mapping nodes to label text
@@ -75,7 +75,7 @@ namespace Gecode { namespace Gist {
         /// Constructor
         NodeAllocatorBase(bool bab);
         /// Destructor
-        ~NodeAllocatorBase(void);
+        ~NodeAllocatorBase();
         /// Allocate new node with parent \a p
         int allocate(int p);
         /// Allocate new root node for space \a root
@@ -87,9 +87,9 @@ namespace Gecode { namespace Gist {
         /// Set index of best node before \a i to \a b
         void set_best(int i, int b);
         /// Return branch-and-bound flag
-        bool bab(void) const;
+        bool bab() const;
         /// Return branching label flag
-        bool show_labels(void) const;
+        bool show_labels() const;
         /// Set branching label flag
         void show_labels(bool b);
         /// Return whether node \a n has a label
@@ -125,29 +125,29 @@ namespace Gecode { namespace Gist {
         int parent;
 
         /// Read the tag of childrenOrFirstChild
-        unsigned int get_tag(void) const;
+        unsigned int get_tag() const;
         /// Set the tag of childrenOrFirstChild
         void set_tag(unsigned int tag);
         /// Return childrenOrFirstChild without tag
-        void* get_ptr(void) const;
+        void* get_ptr() const;
         /// Return childrenOrFirstChild as integer
-        int get_first_child(void) const;
+        int get_first_child() const;
 
     protected:
         /// Return whether this node is undetermined
-        bool is_undetermined(void) const;
+        bool is_undetermined() const;
 
         /// Return index of child no \a n
         int get_child(int n) const;
 
     public:
-        typedef NodeAllocatorBase NodeAllocator;
+        using NodeAllocator = NodeAllocatorBase;
 
         /// Construct node with parent \a p
         Node(int p, bool failed = false);
 
         /// Return the parent
-        int get_parent(void) const;
+        int get_parent() const;
         /// Return the parent
         VisualNode* get_parent(const NodeAllocator& na) const;
         /// Return child no \a n
@@ -157,16 +157,16 @@ namespace Gecode { namespace Gist {
         int get_index(const NodeAllocator& na) const;
 
         /// Check if this node is the root of a tree
-        bool is_root(void) const;
+        bool is_root() const;
 
         /// Set the number of children to \a n and initialize children
         void set_number_of_children(unsigned int n, NodeAllocator& na);
 
         /// Return the number of children
-        unsigned int get_number_of_children(void) const;
+        unsigned int get_number_of_children() const;
     };
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 #endif
 
diff --git a/gecode/gist/node.hpp b/gecode/gist/node.hpp
index cb6c5d045a..fc78904c87 100644
--- a/gecode/gist/node.hpp
+++ b/gecode/gist/node.hpp
@@ -30,11 +30,11 @@
  *
  */
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     template 
     void
-    NodeAllocatorBase::allocate(void) {
+    NodeAllocatorBase::allocate() {
         cur_b++;
         cur_t = 0;
         if (cur_b == n) {
@@ -54,7 +54,7 @@ namespace Gecode { namespace Gist {
     }
 
     template 
-    NodeAllocatorBase::~NodeAllocatorBase(void) {
+    NodeAllocatorBase::~NodeAllocatorBase() {
         for (int i = cur_b + 1; i--;)
             heap.rfree(b[i]);
         heap.free(b, n);
@@ -109,13 +109,13 @@ namespace Gecode { namespace Gist {
 
     template 
     forceinline bool
-    NodeAllocatorBase::bab(void) const {
+    NodeAllocatorBase::bab() const {
         return _bab;
     }
 
     template 
     forceinline bool
-    NodeAllocatorBase::show_labels(void) const {
+    NodeAllocatorBase::show_labels() const {
         return !labels.isEmpty();
     }
 
@@ -144,7 +144,7 @@ namespace Gecode { namespace Gist {
     }
 
     forceinline unsigned int
-    Node::get_tag(void) const {
+    Node::get_tag() const {
         return static_cast(reinterpret_cast(children_or_first_child) & 0b11);
     }
 
@@ -157,12 +157,12 @@ namespace Gecode { namespace Gist {
     }
 
     forceinline void*
-    Node::get_ptr(void) const {
+    Node::get_ptr() const {
         return Support::clear_pointer_tag_bits<2>(children_or_first_child);
     }
 
     forceinline int
-    Node::get_first_child(void) const {
+    Node::get_first_child() const {
         return static_cast(
             (reinterpret_cast(children_or_first_child) & ~static_cast(0b11)) >>
             2);
@@ -177,7 +177,7 @@ namespace Gecode { namespace Gist {
     }
 
     forceinline int
-    Node::get_parent(void) const {
+    Node::get_parent() const {
         return parent;
     }
 
@@ -187,7 +187,7 @@ namespace Gecode { namespace Gist {
     }
 
     forceinline bool
-    Node::is_undetermined(void) const {
+    Node::is_undetermined() const {
         return get_tag() == UNDET;
     }
 
@@ -208,12 +208,12 @@ namespace Gecode { namespace Gist {
     }
 
     forceinline bool
-    Node::is_root(void) const {
+    Node::is_root() const {
         return parent == -1;
     }
 
     forceinline unsigned int
-    Node::get_number_of_children(void) const {
+    Node::get_number_of_children() const {
         switch (get_tag()) {
         case UNDET:
         case LEAF:
@@ -237,6 +237,6 @@ namespace Gecode { namespace Gist {
         return -1;
     }
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 // STATISTICS: gist-any
diff --git a/gecode/gist/nodecursor.hh b/gecode/gist/nodecursor.hh
index dd954e4454..0df730cd17 100644
--- a/gecode/gist/nodecursor.hh
+++ b/gecode/gist/nodecursor.hh
@@ -35,7 +35,7 @@
 
 #include 
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     /// \brief A cursor that can be run over a tree
     template 
@@ -50,36 +50,36 @@ namespace Gecode { namespace Gist {
 
     protected:
         /// The node allocator
-        const typename Node::NodeAllocator& na;
+        const Node::NodeAllocator& na;
         /// Set current node to \a n
         void node(Node* n);
         /// Return start node
-        Node* start_node(void);
+        Node* start_node();
 
     public:
         /// Construct cursor, initially set to \a current_node
-        NodeCursor(Node* current_node, const typename Node::NodeAllocator& na);
+        NodeCursor(Node* current_node, const Node::NodeAllocator& na);
         /// Return current node
-        Node* node(void);
+        Node* node();
         /// Return current alternative
-        unsigned int alternative(void);
+        unsigned int alternative();
         /// Set current alternative
         void alternative(unsigned int a);
 
         /// \name Cursor interface
         //@{
         /// Test if the cursor may move to the parent node
-        bool may_move_upwards(void);
+        bool may_move_upwards();
         /// Move cursor to the parent node
-        void move_upwards(void);
+        void move_upwards();
         /// Test if cursor may move to the first child node
-        bool may_move_downwards(void);
+        bool may_move_downwards();
         /// Move cursor to the first child node
-        void move_downwards(void);
+        void move_downwards();
         /// Test if cursor may move to the first sibling
-        bool may_move_sidewards(void);
+        bool may_move_sidewards();
         /// Move cursor to the first sibling
-        void move_sidewards(void);
+        void move_sidewards();
         //@}
     };
 
@@ -90,13 +90,13 @@ namespace Gecode { namespace Gist {
 
     public:
         /// Constructor
-        HideFailedCursor(VisualNode* the_node, const VisualNode::NodeAllocator& na, bool only_dirty_nodes);
+        HideFailedCursor(VisualNode* root, const VisualNode::NodeAllocator& na, bool only_dirty_nodes);
         /// \name Cursor interface
         //@{
         /// Test if the cursor may move to the first child node
-        bool may_move_downwards(void);
+        bool may_move_downwards();
         /// Process node
-        void process_current_node(void);
+        void process_current_node();
         //@}
     };
 
@@ -104,11 +104,11 @@ namespace Gecode { namespace Gist {
     class UnhideAllCursor : public NodeCursor {
     public:
         /// Constructor
-        UnhideAllCursor(VisualNode* the_node, const VisualNode::NodeAllocator& na);
+        UnhideAllCursor(VisualNode* root, const VisualNode::NodeAllocator& na);
         /// \name Cursor interface
         //@{
         /// Process node
-        void process_current_node(void);
+        void process_current_node();
         //@}
     };
 
@@ -116,11 +116,11 @@ namespace Gecode { namespace Gist {
     class UnstopAllCursor : public NodeCursor {
     public:
         /// Constructor
-        UnstopAllCursor(VisualNode* the_node, const VisualNode::NodeAllocator& na);
+        UnstopAllCursor(VisualNode* root, const VisualNode::NodeAllocator& na);
         /// \name Cursor interface
         //@{
         /// Process node
-        void process_current_node(void);
+        void process_current_node();
         //@}
     };
 
@@ -130,7 +130,7 @@ namespace Gecode { namespace Gist {
         /// Whether to search backwards
         bool back;
         /// Whether the current node is not a solution
-        bool not_on_sol(void);
+        bool not_on_sol();
 
     public:
         /// Constructor
@@ -138,17 +138,17 @@ namespace Gecode { namespace Gist {
         /// \name Cursor interface
         //@{
         /// Do nothing
-        void process_current_node(void);
+        void process_current_node();
         /// Test if the cursor may move to the parent node
-        bool may_move_upwards(void);
+        bool may_move_upwards();
         /// Test if cursor may move to the first child node
-        bool may_move_downwards(void);
+        bool may_move_downwards();
         /// Move cursor to the first child node
-        void move_downwards(void);
+        void move_downwards();
         /// Test if cursor may move to the first sibling
-        bool may_move_sidewards(void);
+        bool may_move_sidewards();
         /// Move cursor to the first sibling
-        void move_sidewards(void);
+        void move_sidewards();
         //@}
     };
 
@@ -171,16 +171,16 @@ namespace Gecode { namespace Gist {
         int open;
 
         /// Constructor
-        StatCursor(VisualNode* the_node, const VisualNode::NodeAllocator& na);
+        StatCursor(VisualNode* root, const VisualNode::NodeAllocator& na);
 
         /// \name Cursor interface
         //@{
         /// Collect statistics
-        void process_current_node(void);
+        void process_current_node();
         /// Move cursor to the first child node
-        void move_downwards(void);
+        void move_downwards();
         /// Move cursor to the parent node
-        void move_upwards(void);
+        void move_upwards();
         //@}
     };
 
@@ -200,11 +200,11 @@ namespace Gecode { namespace Gist {
 
     public:
         /// Constructor
-        BranchLabelCursor(VisualNode* the_node, BestNode* cur_best, int c_d, int a_d, bool clear,
+        BranchLabelCursor(VisualNode* root, BestNode* cur_best, int c_d, int a_d, bool clear,
                           VisualNode::NodeAllocator& na);
         /// \name Cursor interface
         //@{
-        void process_current_node(void);
+        void process_current_node();
         //@}
     };
 
@@ -212,16 +212,16 @@ namespace Gecode { namespace Gist {
     class DisposeCursor : public NodeCursor {
     public:
         /// Constructor
-        DisposeCursor(VisualNode* the_node, const VisualNode::NodeAllocator& na);
+        DisposeCursor(VisualNode* root, const VisualNode::NodeAllocator& na);
 
         /// \name Cursor interface
         //@{
         /// Dispose node
-        void process_current_node(void);
+        void process_current_node();
         //@}
     };
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 #include 
 
diff --git a/gecode/gist/nodecursor.hpp b/gecode/gist/nodecursor.hpp
index 309d327a2f..80316c626c 100644
--- a/gecode/gist/nodecursor.hpp
+++ b/gecode/gist/nodecursor.hpp
@@ -30,22 +30,22 @@
  *
  */
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     template 
     forceinline
-    NodeCursor::NodeCursor(Node* current_node, const typename Node::NodeAllocator& na0)
+    NodeCursor::NodeCursor(Node* current_node, const Node::NodeAllocator& na0)
         : _start_node(current_node), _node(current_node), _alternative(current_node->get_alternative(na0)), na(na0) {}
 
     template 
     forceinline Node*
-    NodeCursor::node(void) {
+    NodeCursor::node() {
         return _node;
     }
 
     template 
     forceinline unsigned int
-    NodeCursor::alternative(void) {
+    NodeCursor::alternative() {
         return _alternative;
     }
 
@@ -57,7 +57,7 @@ namespace Gecode { namespace Gist {
 
     template 
     forceinline Node*
-    NodeCursor::start_node(void) {
+    NodeCursor::start_node() {
         return _start_node;
     }
 
@@ -69,13 +69,13 @@ namespace Gecode { namespace Gist {
 
     template 
     forceinline bool
-    NodeCursor::may_move_upwards(void) {
+    NodeCursor::may_move_upwards() {
         return _node != _start_node && !_node->is_root();
     }
 
     template 
     forceinline void
-    NodeCursor::move_upwards(void) {
+    NodeCursor::move_upwards() {
         _node = static_cast(_node->get_parent(na));
         if (_node->is_root()) {
             _alternative = 0;
@@ -92,32 +92,32 @@ namespace Gecode { namespace Gist {
 
     template 
     forceinline bool
-    NodeCursor::may_move_downwards(void) {
+    NodeCursor::may_move_downwards() {
         return _node->get_number_of_children() > 0;
     }
 
     template 
     forceinline void
-    NodeCursor::move_downwards(void) {
+    NodeCursor::move_downwards() {
         _alternative = 0;
         _node = _node->get_child(na, 0);
     }
 
     template 
     forceinline bool
-    NodeCursor::may_move_sidewards(void) {
+    NodeCursor::may_move_sidewards() {
         return (!_node->is_root()) && (_node != _start_node) &&
                (_alternative < _node->get_parent(na)->get_number_of_children() - 1);
     }
 
     template 
     forceinline void
-    NodeCursor::move_sidewards(void) {
+    NodeCursor::move_sidewards() {
         _node = static_cast(_node->get_parent(na)->get_child(na, ++_alternative));
     }
 
     forceinline bool
-    HideFailedCursor::may_move_downwards(void) {
+    HideFailedCursor::may_move_downwards() {
         VisualNode* n = node();
         return (!only_dirty || n->is_dirty()) && NodeCursor::may_move_downwards() &&
                (n->has_solved_children() || n->get_no_of_open_children(na) > 0) && (!n->is_hidden());
@@ -128,7 +128,7 @@ namespace Gecode { namespace Gist {
         : NodeCursor(root, na), only_dirty(only_dirty_nodes) {}
 
     forceinline void
-    HideFailedCursor::process_current_node(void) {
+    HideFailedCursor::process_current_node() {
         VisualNode* n = node();
         if (n->get_status() == BRANCH && !n->has_solved_children() && n->get_no_of_open_children(na) == 0) {
             n->set_hidden(true);
@@ -142,7 +142,7 @@ namespace Gecode { namespace Gist {
         : NodeCursor(root, na) {}
 
     forceinline void
-    UnhideAllCursor::process_current_node(void) {
+    UnhideAllCursor::process_current_node() {
         VisualNode* n = node();
         if (n->is_hidden()) {
             n->set_hidden(false);
@@ -155,7 +155,7 @@ namespace Gecode { namespace Gist {
         : NodeCursor(root, na) {}
 
     forceinline void
-    UnstopAllCursor::process_current_node(void) {
+    UnstopAllCursor::process_current_node() {
         VisualNode* n = node();
         if (n->get_status() == STOP) {
             n->set_stop(false);
@@ -168,26 +168,26 @@ namespace Gecode { namespace Gist {
         : NodeCursor(the_node, na), back(backwards) {}
 
     forceinline void
-    NextSolCursor::process_current_node(void) {}
+    NextSolCursor::process_current_node() {}
 
     forceinline bool
-    NextSolCursor::not_on_sol(void) {
+    NextSolCursor::not_on_sol() {
         return node() == start_node() || node()->get_status() != SOLVED;
     }
 
     forceinline bool
-    NextSolCursor::may_move_upwards(void) {
+    NextSolCursor::may_move_upwards() {
         return not_on_sol() && !node()->is_root();
     }
 
     forceinline bool
-    NextSolCursor::may_move_downwards(void) {
+    NextSolCursor::may_move_downwards() {
         return not_on_sol() && !(back && node() == start_node()) && node()->has_solved_children() &&
                NodeCursor::may_move_downwards();
     }
 
     forceinline void
-    NextSolCursor::move_downwards(void) {
+    NextSolCursor::move_downwards() {
         NodeCursor::move_downwards();
         if (back) {
             while (NodeCursor::may_move_sidewards())
@@ -196,17 +196,16 @@ namespace Gecode { namespace Gist {
     }
 
     forceinline bool
-    NextSolCursor::may_move_sidewards(void) {
+    NextSolCursor::may_move_sidewards() {
         if (back) {
             return not_on_sol() && !node()->is_root() && alternative() > 0;
-        } else {
-            return not_on_sol() && !node()->is_root() &&
-                   (alternative() < node()->get_parent(na)->get_number_of_children() - 1);
         }
+        return not_on_sol() && !node()->is_root() &&
+               (alternative() < node()->get_parent(na)->get_number_of_children() - 1);
     }
 
     forceinline void
-    NextSolCursor::move_sidewards(void) {
+    NextSolCursor::move_sidewards() {
         if (back) {
             alternative(alternative() - 1);
             node(node()->get_parent(na)->get_child(na, alternative()));
@@ -220,7 +219,7 @@ namespace Gecode { namespace Gist {
         : NodeCursor(root, na), cur_depth(0), depth(0), failed(0), solved(0), choice(0), open(0) {}
 
     forceinline void
-    StatCursor::process_current_node(void) {
+    StatCursor::process_current_node() {
         VisualNode* n = node();
         switch (n->get_status()) {
         case SOLVED:
@@ -241,14 +240,14 @@ namespace Gecode { namespace Gist {
     }
 
     forceinline void
-    StatCursor::move_downwards(void) {
+    StatCursor::move_downwards() {
         cur_depth++;
         depth = std::max(depth, cur_depth);
         NodeCursor::move_downwards();
     }
 
     forceinline void
-    StatCursor::move_upwards(void) {
+    StatCursor::move_upwards() {
         cur_depth--;
         NodeCursor::move_upwards();
     }
@@ -259,7 +258,7 @@ namespace Gecode { namespace Gist {
         : NodeCursor(root, na), _na(na), _cur_best(cur_best), _c_d(c_d), _a_d(a_d), _clear(clear) {}
 
     forceinline void
-    BranchLabelCursor::process_current_node(void) {
+    BranchLabelCursor::process_current_node() {
         VisualNode* n = node();
         if (!_clear) {
             if (!na.has_label(n)) {
@@ -284,10 +283,10 @@ namespace Gecode { namespace Gist {
         : NodeCursor(root, na) {}
 
     forceinline void
-    DisposeCursor::process_current_node(void) {
+    DisposeCursor::process_current_node() {
         node()->dispose();
     }
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 // STATISTICS: gist-any
diff --git a/gecode/gist/nodestats.cpp b/gecode/gist/nodestats.cpp
index dfe56455b7..82051d4e80 100644
--- a/gecode/gist/nodestats.cpp
+++ b/gecode/gist/nodestats.cpp
@@ -36,7 +36,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     NodeStatInspector::NodeStatInspector(QWidget* parent) : QWidget(parent) {
         setWindowFlags(Qt::Tool);
@@ -120,11 +120,11 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    NodeStatInspector::show_stats(void) {
+    NodeStatInspector::show_stats() {
         show();
         activateWindow();
     }
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 // STATISTICS: gist-any
diff --git a/gecode/gist/nodestats.hh b/gecode/gist/nodestats.hh
index 48f33ab1ee..3cd833c89e 100644
--- a/gecode/gist/nodestats.hh
+++ b/gecode/gist/nodestats.hh
@@ -40,7 +40,7 @@
 #include 
 #endif
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     /**
      * \brief Display information about nodes
@@ -67,12 +67,12 @@ namespace Gecode { namespace Gist {
         NodeStatInspector(QWidget* parent);
         /// Update display to reflect information about \a n
         void node(const VisualNode::NodeAllocator&, VisualNode* n, const Statistics& stat, bool finished);
-    public Q_SLOTS:
+
         /// Show this window and bring it to the front
-        void show_stats(void);
+        void show_stats();
     };
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 #endif
 
diff --git a/gecode/gist/nodevisitor.hh b/gecode/gist/nodevisitor.hh
index 7752988c82..0662f6126a 100644
--- a/gecode/gist/nodevisitor.hh
+++ b/gecode/gist/nodevisitor.hh
@@ -33,7 +33,7 @@
 #ifndef GECODE_GIST_NODEVISITOR_HH
 #define GECODE_GIST_NODEVISITOR_HH
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     /// \brief Base class for a visitor that runs a cursor over a tree
     template 
@@ -48,7 +48,7 @@ namespace Gecode { namespace Gist {
         /// Reset the cursor object to \a c0
         void set_cursor(const Cursor& c0);
         /// Return the cursor
-        Cursor& get_cursor(void);
+        Cursor& get_cursor();
     };
 
     /// \brief Run a cursor over a tree, processing nodes in post-order
@@ -57,15 +57,15 @@ namespace Gecode { namespace Gist {
     protected:
         using NodeVisitor::c;
         /// Move the cursor to the left-most leaf
-        void move_to_leaf(void);
+        void move_to_leaf();
 
     public:
         /// Constructor
         PostorderNodeVisitor(const Cursor& c);
         /// Move cursor to next node, return true if succeeded
-        bool next(void);
+        bool next();
         /// Execute visitor
-        void run(void);
+        void run();
     };
 
     /// \brief Run a cursor over a tree, processing nodes in pre-order
@@ -74,18 +74,18 @@ namespace Gecode { namespace Gist {
     protected:
         using NodeVisitor::c;
         /// Move cursor to next node from a leaf
-        bool backtrack(void);
+        bool backtrack();
 
     public:
         /// Constructor
         PreorderNodeVisitor(const Cursor& c);
         /// Move cursor to the next node, return true if succeeded
-        bool next(void);
+        bool next();
         /// Execute visitor
-        void run(void);
+        void run();
     };
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 #include 
 
diff --git a/gecode/gist/nodevisitor.hpp b/gecode/gist/nodevisitor.hpp
index 2bf5b274f6..95b56a8b9b 100644
--- a/gecode/gist/nodevisitor.hpp
+++ b/gecode/gist/nodevisitor.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     template 
     forceinline
@@ -45,13 +45,13 @@ namespace Gecode { namespace Gist {
 
     template 
     forceinline Cursor&
-    NodeVisitor::get_cursor(void) {
+    NodeVisitor::get_cursor() {
         return c;
     }
 
     template 
     forceinline void
-    PostorderNodeVisitor::move_to_leaf(void) {
+    PostorderNodeVisitor::move_to_leaf() {
         while (c.may_move_downwards()) {
             c.move_downwards();
         }
@@ -64,7 +64,7 @@ namespace Gecode { namespace Gist {
 
     template 
     forceinline bool
-    PostorderNodeVisitor::next(void) {
+    PostorderNodeVisitor::next() {
         c.process_current_node();
         if (c.may_move_sidewards()) {
             c.move_sidewards();
@@ -79,22 +79,22 @@ namespace Gecode { namespace Gist {
 
     template 
     forceinline void
-    PostorderNodeVisitor::run(void) {
+    PostorderNodeVisitor::run() {
         while (next()) {
         }
     }
 
     template 
     forceinline bool
-    PreorderNodeVisitor::backtrack(void) {
+    PreorderNodeVisitor::backtrack() {
         while (!c.may_move_sidewards() && c.may_move_upwards()) {
             c.move_upwards();
         }
         if (!c.may_move_upwards()) {
             return false;
-        } else {
-            c.move_sidewards();
         }
+        c.move_sidewards();
+
         return true;
     }
 
@@ -103,7 +103,7 @@ namespace Gecode { namespace Gist {
 
     template 
     forceinline bool
-    PreorderNodeVisitor::next(void) {
+    PreorderNodeVisitor::next() {
         c.process_current_node();
         if (c.may_move_downwards()) {
             c.move_downwards();
@@ -117,10 +117,10 @@ namespace Gecode { namespace Gist {
 
     template 
     forceinline void
-    PreorderNodeVisitor::run(void) {
+    PreorderNodeVisitor::run() {
         while (next()) {
         }
     }
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 // STATISTICS: gist-any
diff --git a/gecode/gist/nodewidget.cpp b/gecode/gist/nodewidget.cpp
index 75147285b5..6309c9d2f0 100644
--- a/gecode/gist/nodewidget.cpp
+++ b/gecode/gist/nodewidget.cpp
@@ -33,7 +33,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     NodeWidget::NodeWidget(NodeStatus s) : status(s) {
         setMinimumSize(22, 22);
@@ -71,6 +71,6 @@ namespace Gecode { namespace Gist {
         }
     }
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 // STATISTICS: gist-any
diff --git a/gecode/gist/nodewidget.hh b/gecode/gist/nodewidget.hh
index fa54a4926a..7a19977486 100644
--- a/gecode/gist/nodewidget.hh
+++ b/gecode/gist/nodewidget.hh
@@ -36,7 +36,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     /// \brief Small node drawings for the status bar
     class NodeWidget : public QWidget {
@@ -48,7 +48,7 @@ namespace Gecode { namespace Gist {
         void paintEvent(QPaintEvent*) override;
     };
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 #endif
 
diff --git a/gecode/gist/preferences.cpp b/gecode/gist/preferences.cpp
index c895cb5395..2ce7c592de 100644
--- a/gecode/gist/preferences.cpp
+++ b/gecode/gist/preferences.cpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     PreferencesDialog::PreferencesDialog(const Options& opt, QWidget* parent) : QDialog(parent) {
         QSettings settings("gecode.dev", "Gist");
@@ -134,7 +134,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    PreferencesDialog::write_back(void) {
+    PreferencesDialog::write_back() {
         hide_failed = hide_check->isChecked();
         zoom = zoom_check->isChecked();
         refresh = refresh_box->value();
@@ -156,7 +156,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    PreferencesDialog::defaults(void) {
+    PreferencesDialog::defaults() {
         hide_failed = true;
         zoom = false;
         refresh = 500;
@@ -180,6 +180,6 @@ namespace Gecode { namespace Gist {
         refresh_box->setEnabled(state != Qt::Checked);
     }
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 // STATISTICS: gist-any
diff --git a/gecode/gist/preferences.hh b/gecode/gist/preferences.hh
index 12e6628d22..5fd563f0ac 100644
--- a/gecode/gist/preferences.hh
+++ b/gecode/gist/preferences.hh
@@ -39,7 +39,7 @@
 #endif
 #include 
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     /**
      * \brief Preferences dialog for %Gist
@@ -57,11 +57,11 @@ namespace Gecode { namespace Gist {
         QCheckBox* move_during_search_box;
         QSpinBox* cd_box;
         QSpinBox* ad_box;
-    protected Q_SLOTS:
+
         /// Write settings
-        void write_back(void);
+        void write_back();
         /// Reset to defaults
-        void defaults(void);
+        void defaults();
         /// Toggle slow down setting
         void toggle_slow(int state);
 
@@ -90,7 +90,7 @@ namespace Gecode { namespace Gist {
         int a_d;
     };
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 #endif
 
diff --git a/gecode/gist/qtgist.cpp b/gecode/gist/qtgist.cpp
index 22267fa8e5..7a7e9c3e27 100644
--- a/gecode/gist/qtgist.cpp
+++ b/gecode/gist/qtgist.cpp
@@ -36,7 +36,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     Gist::Gist(Space* root, bool bab, QWidget* parent, const Options& opt) : QWidget(parent) {
         QGridLayout* layout = new QGridLayout(this);
@@ -53,8 +53,8 @@ namespace Gecode { namespace Gist {
         canvas->setPalette(my_palette);
         canvas->setObjectName("canvas");
 
-        connect(scroll_area->horizontalScrollBar(), SIGNAL(valueChanged(int)), canvas, SLOT(scroll(void)));
-        connect(scroll_area->verticalScrollBar(), SIGNAL(valueChanged(int)), canvas, SLOT(scroll(void)));
+        connect(scroll_area->horizontalScrollBar(), SIGNAL(valueChanged(int)), canvas, SLOT(scroll()));
+        connect(scroll_area->verticalScrollBar(), SIGNAL(valueChanged(int)), canvas, SLOT(scroll()));
 
         QVBoxLayout* sa_layout = new QVBoxLayout();
         sa_layout->setContentsMargins(0, 0, 0, 0);
@@ -63,7 +63,7 @@ namespace Gecode { namespace Gist {
 
         connect(canvas, SIGNAL(solution(const Space*)), this, SIGNAL(solution(const Space*)));
 
-        connect(canvas, SIGNAL(search_finished(void)), this, SIGNAL(search_finished(void)));
+        connect(canvas, SIGNAL(search_finished()), this, SIGNAL(search_finished()));
 
         QPixmap my_pic;
         my_pic.loadFromData(zoom_to_fit_icon, sizeof(zoom_to_fit_icon));
@@ -80,7 +80,7 @@ namespace Gecode { namespace Gist {
 
         inspect_before_fp = new QAction("Inspect before fixpoint", this);
         inspect_before_fp->setShortcut(QKeySequence("Ctrl+Return"));
-        connect(inspect_before_fp, SIGNAL(triggered()), canvas, SLOT(inspect_before_fp(void)));
+        connect(inspect_before_fp, SIGNAL(triggered()), canvas, SLOT(inspect_before_fp()));
 
         stop = new QAction("Stop search", this);
         stop->setShortcut(QKeySequence("Esc"));
@@ -499,7 +499,7 @@ namespace Gecode { namespace Gist {
         select_comparator(ncs);
     }
 
-    Gist::~Gist(void) {
+    Gist::~Gist() {
         delete canvas;
     }
 
@@ -648,7 +648,7 @@ namespace Gecode { namespace Gist {
     }
 
     bool
-    Gist::finish(void) {
+    Gist::finish() {
         return canvas->finish();
     }
 
@@ -690,13 +690,13 @@ namespace Gecode { namespace Gist {
     Gist::remove_bookmark(int idx) {
         QAction* a = bookmarks_group->actions()[idx];
         bookmarks_group->removeAction(a);
-        if (bookmarks_group->actions().size() == 0) {
+        if (bookmarks_group->actions().empty()) {
             bookmarks_group->addAction(null_bookmark);
         }
     }
 
     void
-    Gist::populate_bookmarks_menu(void) {
+    Gist::populate_bookmarks_menu() {
         bookmarks_menu->clear();
         bookmarks_menu->addAction(bookmark_node);
         bookmarks_menu->addSeparator();
@@ -704,7 +704,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    Gist::populate_inspectors(void) {
+    Gist::populate_inspectors() {
         inspect_node_menu->clear();
         inspect_node_menu->addAction(inspect);
         inspect_node_menu->addSeparator();
@@ -724,11 +724,11 @@ namespace Gecode { namespace Gist {
         canvas->set_auto_zoom(b);
     }
     bool
-    Gist::get_auto_hide_failed(void) {
+    Gist::get_auto_hide_failed() {
         return canvas->get_auto_hide_failed();
     }
     bool
-    Gist::get_auto_zoom(void) {
+    Gist::get_auto_zoom() {
         return canvas->get_auto_zoom();
     }
     void
@@ -740,7 +740,7 @@ namespace Gecode { namespace Gist {
         canvas->set_refresh_pause(i);
     }
     bool
-    Gist::get_smooth_scroll_and_zoom(void) {
+    Gist::get_smooth_scroll_and_zoom() {
         return canvas->get_smooth_scroll_and_zoom();
     }
     void
@@ -748,7 +748,7 @@ namespace Gecode { namespace Gist {
         canvas->set_smooth_scroll_and_zoom(b);
     }
     bool
-    Gist::get_move_during_search(void) {
+    Gist::get_move_during_search() {
         return canvas->get_move_during_search();
     }
     void
@@ -761,11 +761,11 @@ namespace Gecode { namespace Gist {
     }
 
     int
-    Gist::get_cd(void) {
+    Gist::get_cd() {
         return canvas->c_d;
     }
     int
-    Gist::get_ad(void) {
+    Gist::get_ad() {
         return canvas->a_d;
     }
 
@@ -774,16 +774,16 @@ namespace Gecode { namespace Gist {
         canvas->set_show_copies(b);
     }
     bool
-    Gist::get_show_copies(void) {
+    Gist::get_show_copies() {
         return canvas->get_show_copies();
     }
 
     void
-    Gist::show_stats(void) {
+    Gist::show_stats() {
         node_stat_inspector->show_stats();
         canvas->emit_status_changed();
     }
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 // STATISTICS: gist-any
diff --git a/gecode/gist/qtgist.hh b/gecode/gist/qtgist.hh
index d0fca746eb..2ddd63198f 100644
--- a/gecode/gist/qtgist.hh
+++ b/gecode/gist/qtgist.hh
@@ -60,7 +60,7 @@
 
 #endif
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     /**
      * \brief %Gecode Interactive %Search Tool
@@ -187,18 +187,17 @@ namespace Gecode { namespace Gist {
         /// Group of all actions for direct inspector selection
         QActionGroup* inspect_before_fp_group;
 
-    public:
         /// Constructor
         Gist(Space* root, bool bab, QWidget* parent, const Options& opt);
         /// Destructor
-        ~Gist(void) override;
+        ~Gist() override;
 
-        /// Add double click inspector \a i0
-        void add_double_click_inspector(Inspector* i0);
-        /// Add solution inspector \a i0
-        void add_solution_inspector(Inspector* i0);
-        /// Add move inspector \a i0
-        void add_move_inspector(Inspector* i0);
+        /// Add double click inspector \a ins
+        void add_double_click_inspector(Inspector* ins);
+        /// Add solution inspector \a ins
+        void add_solution_inspector(Inspector* ins);
+        /// Add move inspector \a ins
+        void add_move_inspector(Inspector* ins);
         /// Add comparator \a c0
         void add_comparator(Comparator* c0);
 
@@ -207,37 +206,38 @@ namespace Gecode { namespace Gist {
         /// Set preference whether to automatically zoom to fit
         void set_auto_zoom(bool b);
         /// Return preference whether to automatically hide failed subtrees
-        bool get_auto_hide_failed(void);
+        bool get_auto_hide_failed();
         /// Return preference whether to automatically zoom to fit
-        bool get_auto_zoom(void);
+        bool get_auto_zoom();
         /// Set preference whether to show copies in the tree
         void set_show_copies(bool b);
         /// Return preference whether to show copies in the tree
-        bool get_show_copies(void);
+        bool get_show_copies();
 
         /// Set refresh rate
         void set_refresh(int i);
         /// Set refresh pause in msec
         void set_refresh_pause(int i);
         /// Return preference whether to use smooth scrolling and zooming
-        bool get_smooth_scroll_and_zoom(void);
+        bool get_smooth_scroll_and_zoom();
         /// Set preference whether to use smooth scrolling and zooming
         void set_smooth_scroll_and_zoom(bool b);
         /// Return preference whether to move cursor during search
-        bool get_move_during_search(void);
+        bool get_move_during_search();
         /// Set preference whether to move cursor during search
         void set_move_during_search(bool b);
 
         /// Set recomputation parameters \a c_d and \a a_d
         void set_recomp_distances(int c_d, int a_d);
         /// Return recomputation distance
-        int get_cd(void);
+        int get_cd();
         /// Return adaptive recomputation distance
-        int get_ad(void);
+        int get_ad();
 
         /// Stop search and wait until finished
-        bool finish(void);
+        bool finish();
 
+    protected:
         /// Handle resize event
         void resizeEvent(QResizeEvent*) override;
 
@@ -249,7 +249,7 @@ namespace Gecode { namespace Gist {
         void solution(const Space*);
 
         /// Signals that %Gist is ready to be closed
-        void search_finished(void);
+        void search_finished();
 
     private Q_SLOTS:
         /// Displays the context menu for a node
@@ -271,11 +271,11 @@ namespace Gecode { namespace Gist {
         /// Reacts on removing a bookmark
         void remove_bookmark(int idx);
         /// Populate the inspector menus from the actions found in Gist
-        void populate_inspectors(void);
+        void populate_inspectors();
         /// Populate the bookmarks menu
-        void populate_bookmarks_menu(void);
+        void populate_bookmarks_menu();
         /// Shows node status information
-        void show_stats(void);
+        void show_stats();
         /// Inspect current node with inspector described by \a a
         void inspect_with_action(QAction* a);
         /// Inspect current node with inspector described by \a a
@@ -286,7 +286,7 @@ namespace Gecode { namespace Gist {
         void add_inspector(Inspector* i, QAction*& nas, QAction*& nad, QAction*& nam);
     };
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 #endif
 
diff --git a/gecode/gist/spacenode.cpp b/gecode/gist/spacenode.cpp
index 244a9a5b2e..a8d29002e0 100644
--- a/gecode/gist/spacenode.cpp
+++ b/gecode/gist/spacenode.cpp
@@ -39,7 +39,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     /// \brief Representation of a branch in the search tree
     class Branch {
@@ -104,9 +104,8 @@ namespace Gecode { namespace Gist {
                     if (cur_space->status() == SS_FAILED) {
                         copy = static_cast(Support::mark(cur_space));
                         return rdist;
-                    } else {
-                        middle_node->copy = cur_space->clone();
                     }
+                    middle_node->copy = cur_space->clone();
                 }
                 Branch b = stck.top();
                 stck.pop();
@@ -267,7 +266,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    SpaceNode::dispose(void) {
+    SpaceNode::dispose() {
         delete choice;
         delete static_cast(Support::clear_pointer_tag_bits(copy));
     }
@@ -345,6 +344,6 @@ namespace Gecode { namespace Gist {
         return no_of_open_children;
     }
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 // STATISTICS: gist-any
diff --git a/gecode/gist/spacenode.hh b/gecode/gist/spacenode.hh
index fffc3f6733..bc3b21f172 100644
--- a/gecode/gist/spacenode.hh
+++ b/gecode/gist/spacenode.hh
@@ -36,7 +36,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     /** \brief Status of nodes in the search tree
      */
@@ -70,7 +70,7 @@ namespace Gecode { namespace Gist {
         int max_depth;
 
         /// Constructor
-        Statistics(void) : solutions(0), failures(0), choices(0), undetermined(1), max_depth(0) {}
+        Statistics() : solutions(0), failures(0), choices(0), undetermined(1), max_depth(0) {}
     };
 
     class SpaceNode;
@@ -94,7 +94,6 @@ namespace Gecode { namespace Gist {
          */
         Space* copy;
 
-    protected:
         const Choice* choice;
 
         /** \brief Status of the node
@@ -109,7 +108,7 @@ namespace Gecode { namespace Gist {
         void set_distance(unsigned int d);
 
         /// Return distance from copy
-        unsigned int get_distance(void) const;
+        unsigned int get_distance() const;
 
         /// Set status flag
         void set_flag(int flag, bool value);
@@ -152,13 +151,13 @@ namespace Gecode { namespace Gist {
         Space* get_space(NodeAllocator& na, BestNode* cur_best, int c_d, int a_d);
 
         /// Return working space (if present).
-        const Space* get_working_space(void) const;
+        const Space* get_working_space() const;
 
         /// Clear working space and copy (if present and this is not the root).
         void purge(const NodeAllocator& na);
 
         /// Free allocated memory
-        void dispose(void);
+        void dispose();
 
         /// Return whether this node is the currently best solution
         bool is_current_best(BestNode* cur_best);
@@ -176,32 +175,32 @@ namespace Gecode { namespace Gist {
         int get_number_of_child_nodes(NodeAllocator& na, BestNode* cur_best, Statistics& stats, int c_d, int a_d);
 
         /// Return current status of the node
-        NodeStatus get_status(void) const;
+        NodeStatus get_status() const;
 
         /// Return whether this node still has open children
-        bool is_open(void);
+        bool is_open();
         /// Return whether the subtree of this node has any failed children
-        bool has_failed_children(void);
+        bool has_failed_children();
         /// Return whether the subtree of this node has any solved children
-        bool has_solved_children(void);
+        bool has_solved_children();
         /// Return whether the subtree of this node has any open children
-        bool has_open_children(void);
+        bool has_open_children();
         /// Return number of open children
         int get_no_of_open_children(const NodeAllocator& na);
         /// Set number of open children to \a n
         void set_no_of_open_children(int n);
         /// Return whether the node has a copy
-        bool has_copy(void);
+        bool has_copy();
         /// Return whether the node has a working space
-        bool has_working_space(void);
+        bool has_working_space();
 
         /// Return alternative number of this node
         int get_alternative(const NodeAllocator& na) const;
         /// Return choice of this node
-        const Choice* get_choice(void);
+        const Choice* get_choice();
     };
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 #endif
 
diff --git a/gecode/gist/spacenode.hpp b/gecode/gist/spacenode.hpp
index 6e8be34ee4..13aa75535a 100644
--- a/gecode/gist/spacenode.hpp
+++ b/gecode/gist/spacenode.hpp
@@ -1,3 +1,5 @@
+#include 
+
 /*
  *  Main authors:
  *     Guido Tack 
@@ -30,7 +32,7 @@
  *
  */
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     forceinline void
     SpaceNode::set_flag(int flag, bool value) {
@@ -62,25 +64,24 @@ namespace Gecode { namespace Gist {
 
     forceinline void
     SpaceNode::set_status(NodeStatus s) {
-        status_bits &= ~(status_mask);
+        status_bits &= ~status_mask;
         status_bits |= std::to_underlying(s) << 20;
     }
 
     forceinline NodeStatus
-    SpaceNode::get_status(void) const {
+    SpaceNode::get_status() const {
         return static_cast((status_bits & status_mask) >> 20);
     }
 
     forceinline void
     SpaceNode::set_distance(unsigned int d) {
-        if (d > max_distance)
-            d = max_distance;
-        status_bits &= ~(distance_mask);
+        d = std::min(d, max_distance);
+        status_bits &= ~distance_mask;
         status_bits |= d;
     }
 
     forceinline unsigned int
-    SpaceNode::get_distance(void) const {
+    SpaceNode::get_distance() const {
         return status_bits & distance_mask;
     }
 
@@ -107,7 +108,7 @@ namespace Gecode { namespace Gist {
     }
 
     forceinline const Space*
-    SpaceNode::get_working_space(void) const {
+    SpaceNode::get_working_space() const {
         assert(copy != nullptr);
         if (Support::marked(copy))
             return static_cast(Support::unmark(copy));
@@ -132,32 +133,32 @@ namespace Gecode { namespace Gist {
     }
 
     forceinline bool
-    SpaceNode::is_open(void) {
+    SpaceNode::is_open() {
         return ((get_status() == UNDETERMINED) || get_flag(HAS_OPEN_CHILDREN));
     }
 
     forceinline bool
-    SpaceNode::has_failed_children(void) {
+    SpaceNode::has_failed_children() {
         return get_flag(HAS_FAILED_CHILDREN);
     }
 
     forceinline bool
-    SpaceNode::has_solved_children(void) {
+    SpaceNode::has_solved_children() {
         return get_flag(HAS_SOLVED_CHILDREN);
     }
 
     forceinline bool
-    SpaceNode::has_open_children(void) {
+    SpaceNode::has_open_children() {
         return get_flag(HAS_OPEN_CHILDREN);
     }
 
     forceinline bool
-    SpaceNode::has_copy(void) {
+    SpaceNode::has_copy() {
         return copy != nullptr;
     }
 
     forceinline bool
-    SpaceNode::has_working_space(void) {
+    SpaceNode::has_working_space() {
         return copy != nullptr && Support::marked(copy);
     }
 
@@ -174,10 +175,10 @@ namespace Gecode { namespace Gist {
     }
 
     forceinline const Choice*
-    SpaceNode::get_choice(void) {
+    SpaceNode::get_choice() {
         return choice;
     }
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 // STATISTICS: gist-any
diff --git a/gecode/gist/standalone-example/mygist.cpp b/gecode/gist/standalone-example/mygist.cpp
index 6c6c8a26e5..814e29cb1c 100644
--- a/gecode/gist/standalone-example/mygist.cpp
+++ b/gecode/gist/standalone-example/mygist.cpp
@@ -43,7 +43,7 @@ using namespace Gecode;
 class TestSpace : public Space {
 public:
     IntVarArray variables;
-    TestSpace(void) : variables(*this, 2, 0, 2) {
+    TestSpace() : variables(*this, 2, 0, 2) {
         branch(*this, variables, INT_VAR_NONE(), INT_VAL_MIN());
     }
     TestSpace(TestSpace& other) : Space(other) {
@@ -75,5 +75,5 @@ main(int argc, char** argv) {
     widget_window.resize(500, 300);
     widget_window.show();
 
-    return app.exec();
+    return QApplication::exec();
 }
diff --git a/gecode/gist/stopbrancher.cpp b/gecode/gist/stopbrancher.cpp
index b71e2906a1..d5ede56a82 100644
--- a/gecode/gist/stopbrancher.cpp
+++ b/gecode/gist/stopbrancher.cpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     StopChoice::StopChoice(const Brancher& b) : Choice(b, 1) {}
     void
@@ -79,6 +79,6 @@ namespace Gecode { namespace Gist {
         return sizeof(*this);
     }
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 // STATISTICS: gist-any
diff --git a/gecode/gist/stopbrancher.hh b/gecode/gist/stopbrancher.hh
index ca7e913cda..cb11c45b09 100644
--- a/gecode/gist/stopbrancher.hh
+++ b/gecode/gist/stopbrancher.hh
@@ -33,7 +33,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     /// %Choice for %StopBrancher
     class GECODE_GIST_EXPORT StopChoice : public Choice {
@@ -73,6 +73,6 @@ namespace Gecode { namespace Gist {
         size_t dispose(Space&) override;
     };
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 // STATISTICS: gist-any
diff --git a/gecode/gist/textoutput.cpp b/gecode/gist/textoutput.cpp
index 5114fc03c3..f9ecf63a9f 100644
--- a/gecode/gist/textoutput.cpp
+++ b/gecode/gist/textoutput.cpp
@@ -39,7 +39,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     /// \brief An outputstream that prints on a QTextEdit
     class GistOutputStream : public std::basic_ostream> {
@@ -50,23 +50,25 @@ namespace Gecode { namespace Gist {
 
         public:
             void
-            flush(void) {
+            flush() {
                 QTextBlockFormat bf = editor->textCursor().blockFormat();
                 bf.setBottomMargin(0);
                 editor->textCursor().setBlockFormat(bf);
                 editor->append(buffer);
                 buffer.clear();
             }
+            Buf(QTextEdit* e) : editor(e) {}
+
+        protected:
             int
-            overflow(int v = std::char_traits::eof()) override {
+            overflow(int v) override {
                 if (v == '\n') {
                     flush();
                 } else {
-                    buffer += (char)v;
+                    buffer += static_cast(v);
                 }
                 return v;
             }
-            Buf(QTextEdit* e) : editor(e) {}
         };
 
         Buf _buf;
@@ -76,7 +78,7 @@ namespace Gecode { namespace Gist {
             clear();
         }
         void
-        flush(void) {
+        flush() {
             _buf.flush();
         }
     };
@@ -130,17 +132,17 @@ namespace Gecode { namespace Gist {
         resize(600, 300);
     }
 
-    TextOutputI::~TextOutputI(void) {
+    TextOutputI::~TextOutputI() {
         delete os;
     }
 
     std::ostream&
-    TextOutputI::get_stream(void) {
+    TextOutputI::get_stream() {
         return *os;
     }
 
     void
-    TextOutputI::flush(void) {
+    TextOutputI::flush() {
         static_cast(os)->flush();
     }
 
@@ -154,7 +156,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TextOutputI::change_stay_on_top(void) {
+    TextOutputI::change_stay_on_top() {
         QPoint p = pos();
         if (stay_on_top->isChecked()) {
             setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
@@ -165,6 +167,6 @@ namespace Gecode { namespace Gist {
         show();
     }
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 // STATISTICS: gist-any
diff --git a/gecode/gist/textoutput.hh b/gecode/gist/textoutput.hh
index 12b3ae7a9a..4aa3c2b1b5 100644
--- a/gecode/gist/textoutput.hh
+++ b/gecode/gist/textoutput.hh
@@ -36,7 +36,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
     /// \brief Window with associated ostream, used for inspecting %Gist nodes
     class TextOutputI : public QMainWindow {
         Q_OBJECT
@@ -52,18 +52,18 @@ namespace Gecode { namespace Gist {
         /// Constructor
         TextOutputI(const std::string& name, QWidget* parent = nullptr);
         /// Destructor
-        ~TextOutputI(void) override;
+        ~TextOutputI() override;
         /// Return stream that prints to the text display
-        std::ostream& get_stream(void);
+        std::ostream& get_stream();
         /// Add html string \a s to the output
         void insert_html(const QString& s);
         /// Flush output
-        void flush(void);
+        void flush();
     protected Q_SLOTS:
-        void change_stay_on_top(void);
+        void change_stay_on_top();
     };
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 #endif
 
diff --git a/gecode/gist/treecanvas.cpp b/gecode/gist/treecanvas.cpp
index 6cc91c62f0..e7784eb573 100644
--- a/gecode/gist/treecanvas.cpp
+++ b/gecode/gist/treecanvas.cpp
@@ -34,6 +34,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -46,7 +47,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     TreeCanvas::TreeCanvas(Space* root_space, bool bab, QWidget* parent, const Options& opt)
         : QWidget(parent)
@@ -91,7 +92,7 @@ namespace Gecode { namespace Gist {
         connect(&searcher, SIGNAL(move_to_node(VisualNode*, bool)), this, SLOT(set_current_node(VisualNode*, bool)),
                 Qt::BlockingQueuedConnection);
 
-        connect(&searcher, SIGNAL(search_finished(void)), this, SIGNAL(search_finished(void)));
+        connect(&searcher, SIGNAL(search_finished()), this, SIGNAL(search_finished()));
 
         connect(&scroll_time_line, SIGNAL(frameChanged(int)), this, SLOT(scroll(int)));
 #if QT_VERSION >= 0x060000
@@ -120,7 +121,7 @@ namespace Gecode { namespace Gist {
         update();
     }
 
-    TreeCanvas::~TreeCanvas(void) {
+    TreeCanvas::~TreeCanvas() {
         if (root) {
             DisposeCursor dc(root, *na);
             PreorderNodeVisitor(dc).run();
@@ -212,7 +213,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::update(void) {
+    TreeCanvas::update() {
         QMutexLocker locker(&mutex);
         layout_mutex.lock();
         if (root != nullptr) {
@@ -239,7 +240,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::scroll(void) {
+    TreeCanvas::scroll() {
         QWidget::update();
     }
 
@@ -281,7 +282,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    SearcherThread::update_canvas(void) {
+    SearcherThread::update_canvas() {
         t->layout_mutex.lock();
         if (t->root == nullptr)
             return;
@@ -314,10 +315,8 @@ namespace Gecode { namespace Gist {
                                      (t->root->get_shape()->depth() * Layout::dist_y + 2 * Layout::extent);
 
                 scale0 = static_cast(std::min(new_x_scale, new_y_scale) * 100);
-                if (scale0 < LayoutConfig::min_scale)
-                    scale0 = LayoutConfig::min_scale;
-                if (scale0 > LayoutConfig::max_auto_zoom_scale)
-                    scale0 = LayoutConfig::max_auto_zoom_scale;
+                scale0 = std::max(scale0, LayoutConfig::min_scale);
+                scale0 = std::min(scale0, LayoutConfig::max_auto_zoom_scale);
                 double scale = (static_cast(scale0)) / 100.0;
 
                 w = static_cast((bb.right - bb.left + Layout::extent) * scale);
@@ -343,7 +342,7 @@ namespace Gecode { namespace Gist {
     };
 
     void
-    SearcherThread::run(void) {
+    SearcherThread::run() {
         {
             if (!node->is_open())
                 return;
@@ -359,7 +358,7 @@ namespace Gecode { namespace Gist {
             }
 
             std::stack stck;
-            stck.push(SearchItem(node, kids));
+            stck.emplace(node, kids);
             t->stats.max_depth = std::max(static_cast(t->stats.max_depth),
                                           static_cast(depth + stck.size()));
 
@@ -398,7 +397,7 @@ namespace Gecode { namespace Gist {
                             }
                         } else {
                             if (n->get_status() != STOP)
-                                stck.push(SearchItem(n, kids));
+                                stck.emplace(n, kids);
                             else if (!a)
                                 break;
                             t->stats.max_depth = std::max(static_cast(t->stats.max_depth),
@@ -423,19 +422,19 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::search_all(void) {
+    TreeCanvas::search_all() {
         QMutexLocker locker(&mutex);
         searcher.search(current_node, true, this);
     }
 
     void
-    TreeCanvas::search_one(void) {
+    TreeCanvas::search_one() {
         QMutexLocker locker(&mutex);
         searcher.search(current_node, false, this);
     }
 
     void
-    TreeCanvas::toggle_hidden(void) {
+    TreeCanvas::toggle_hidden() {
         QMutexLocker locker(&mutex);
         current_node->toggle_hidden(*na);
         update();
@@ -444,7 +443,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::hide_failed(void) {
+    TreeCanvas::hide_failed() {
         QMutexLocker locker(&mutex);
         current_node->hide_failed(*na);
         update();
@@ -453,7 +452,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::unhide_all(void) {
+    TreeCanvas::unhide_all() {
         QMutexLocker locker(&mutex);
         QMutexLocker layout_locker(&layout_mutex);
         current_node->unhide_all(*na);
@@ -463,7 +462,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::toggle_stop(void) {
+    TreeCanvas::toggle_stop() {
         QMutexLocker locker(&mutex);
         current_node->toggle_stop(*na);
         update();
@@ -472,7 +471,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::unstop_all(void) {
+    TreeCanvas::unstop_all() {
         QMutexLocker locker(&mutex);
         QMutexLocker layout_locker(&layout_mutex);
         current_node->unstop_all(*na);
@@ -502,7 +501,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::zoom_to_fit(void) {
+    TreeCanvas::zoom_to_fit() {
         QMutexLocker locker(&layout_mutex);
         if (root != nullptr) {
             BoundingBox bb;
@@ -513,10 +512,8 @@ namespace Gecode { namespace Gist {
                 double new_y_scale = static_cast(p->height()) /
                                      (root->get_shape()->depth() * Layout::dist_y + 2 * Layout::extent);
                 int scale0 = static_cast(std::min(new_x_scale, new_y_scale) * 100);
-                if (scale0 < LayoutConfig::min_scale)
-                    scale0 = LayoutConfig::min_scale;
-                if (scale0 > LayoutConfig::max_auto_zoom_scale)
-                    scale0 = LayoutConfig::max_auto_zoom_scale;
+                scale0 = std::max(scale0, LayoutConfig::min_scale);
+                scale0 = std::min(scale0, LayoutConfig::max_auto_zoom_scale);
 
                 if (!smooth_scroll_and_zoom) {
                     scale_tree(scale0);
@@ -534,7 +531,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::center_current_node(void) {
+    TreeCanvas::center_current_node() {
         QMutexLocker locker(&mutex);
         int x = 0;
         int y = 0;
@@ -567,7 +564,7 @@ namespace Gecode { namespace Gist {
             scroll_time_line.stop();
             scroll_time_line.setFrameRange(0, 100);
             scroll_time_line.setDuration(
-                std::max(200, std::min(1000, std::min(std::abs(source_x - target_x), std::abs(source_y - target_y)))));
+                std::max(200, std::min({1000, std::abs(source_x - target_x), std::abs(source_y - target_y)})));
             scroll_time_line.start();
         }
     }
@@ -707,12 +704,12 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::inspect_before_fp(void) {
+    TreeCanvas::inspect_before_fp() {
         inspect_current_node(false);
     }
 
     void
-    TreeCanvas::label_branches(void) {
+    TreeCanvas::label_branches() {
         QMutexLocker locker(&mutex);
         current_node->label_branches(*na, cur_best, c_d, a_d);
         update();
@@ -720,7 +717,7 @@ namespace Gecode { namespace Gist {
         emit status_changed(current_node, stats, true);
     }
     void
-    TreeCanvas::label_path(void) {
+    TreeCanvas::label_path() {
         QMutexLocker locker(&mutex);
         current_node->label_path(*na, cur_best, c_d, a_d);
         update();
@@ -761,13 +758,13 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::stop_search(void) {
+    TreeCanvas::stop_search() {
         stop_search_flag = true;
         layout_done_timer_id = startTimer(15);
     }
 
     void
-    TreeCanvas::reset(void) {
+    TreeCanvas::reset() {
         QMutexLocker locker(&mutex);
         Space* root_space = root->get_status() == FAILED ? nullptr : root->get_space(*na, cur_best, c_d, a_d);
         if (cur_best != nullptr) {
@@ -799,7 +796,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::bookmark_node(void) {
+    TreeCanvas::bookmark_node() {
         QMutexLocker locker(&mutex);
         if (!current_node->is_bookmarked()) {
             bool ok;
@@ -822,7 +819,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::set_path(void) {
+    TreeCanvas::set_path() {
         QMutexLocker locker(&mutex);
         if (current_node == path_head)
             return;
@@ -836,7 +833,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::inspect_path(void) {
+    TreeCanvas::inspect_path() {
         QMutexLocker locker(&mutex);
         set_current_node(root);
         if (current_node->is_on_path()) {
@@ -852,7 +849,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::start_compare_nodes(void) {
+    TreeCanvas::start_compare_nodes() {
         QMutexLocker locker(&mutex);
         compare_nodes = true;
         compare_nodes_before_fp = false;
@@ -860,7 +857,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::start_compare_nodes_before_fp(void) {
+    TreeCanvas::start_compare_nodes_before_fp() {
         QMutexLocker locker(&mutex);
         compare_nodes = true;
         compare_nodes_before_fp = true;
@@ -868,12 +865,12 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::emit_status_changed(void) {
+    TreeCanvas::emit_status_changed() {
         emit status_changed(current_node, stats, true);
     }
 
     void
-    TreeCanvas::nav_up(void) {
+    TreeCanvas::nav_up() {
         QMutexLocker locker(&mutex);
 
         VisualNode* p = current_node->get_parent(*na);
@@ -886,7 +883,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::nav_down(void) {
+    TreeCanvas::nav_down() {
         QMutexLocker locker(&mutex);
         if (!current_node->is_hidden()) {
             switch (current_node->get_status()) {
@@ -908,7 +905,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::nav_left(void) {
+    TreeCanvas::nav_left() {
         QMutexLocker locker(&mutex);
         VisualNode* p = current_node->get_parent(*na);
         if (p != nullptr) {
@@ -922,7 +919,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::nav_right(void) {
+    TreeCanvas::nav_right() {
         QMutexLocker locker(&mutex);
         VisualNode* p = current_node->get_parent(*na);
         if (p != nullptr) {
@@ -936,7 +933,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::nav_root(void) {
+    TreeCanvas::nav_root() {
         QMutexLocker locker(&mutex);
         set_current_node(root);
         center_current_node();
@@ -956,7 +953,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::nav_prev_sol(void) {
+    TreeCanvas::nav_prev_sol() {
         nav_next_sol(true);
     }
 
@@ -1010,21 +1007,21 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::export_whole_tree_pdf(void) {
+    TreeCanvas::export_whole_tree_pdf() {
 #if QT_VERSION >= 0x040400
         export_node_pdf(root);
 #endif
     }
 
     void
-    TreeCanvas::export_pdf(void) {
+    TreeCanvas::export_pdf() {
 #if QT_VERSION >= 0x040400
         export_node_pdf(current_node);
 #endif
     }
 
     void
-    TreeCanvas::print(void) {
+    TreeCanvas::print() {
         QPrinter printer;
         if (QPrintDialog(&printer, this).exec() == QDialog::Accepted) {
             QMutexLocker locker(&mutex);
@@ -1039,10 +1036,8 @@ namespace Gecode { namespace Gist {
             double new_y_scale = static_cast(page_rect.height()) /
                                  (root->get_shape()->depth() * Layout::dist_y + 2 * Layout::extent);
             double print_scale = std::min(new_x_scale, new_y_scale) * 100;
-            if (print_scale < 1.0)
-                print_scale = 1.0;
-            if (print_scale > 400.0)
-                print_scale = 400.0;
+            print_scale = std::max(print_scale, 1.0);
+            print_scale = std::min(print_scale, 400.0);
             print_scale = print_scale / 100.0;
 
             QPainter painter(&printer);
@@ -1122,7 +1117,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    TreeCanvas::resize_to_outer(void) {
+    TreeCanvas::resize_to_outer() {
         if (auto_zoom)
             zoom_to_fit();
     }
@@ -1226,19 +1221,19 @@ namespace Gecode { namespace Gist {
     }
 
     bool
-    TreeCanvas::finish(void) {
+    TreeCanvas::finish() {
         if (finished_flag)
             return true;
         stop_search_flag = true;
         finished_flag = true;
-        for (int i = 0; i < double_click_inspectors.size(); i++)
-            double_click_inspectors[i].first->finalize();
-        for (int i = 0; i < solution_inspectors.size(); i++)
-            solution_inspectors[i].first->finalize();
-        for (int i = 0; i < move_inspectors.size(); i++)
-            move_inspectors[i].first->finalize();
-        for (int i = 0; i < comparators.size(); i++)
-            comparators[i].first->finalize();
+        for (auto& double_click_inspector : double_click_inspectors)
+            double_click_inspector.first->finalize();
+        for (auto& solution_inspector : solution_inspectors)
+            solution_inspector.first->finalize();
+        for (auto& move_inspector : move_inspectors)
+            move_inspector.first->finalize();
+        for (auto& comparator : comparators)
+            comparator.first->finalize();
         return !searcher.isRunning();
     }
 
@@ -1357,17 +1352,17 @@ namespace Gecode { namespace Gist {
         show_copies = b;
     }
     bool
-    TreeCanvas::get_show_copies(void) {
+    TreeCanvas::get_show_copies() {
         return show_copies;
     }
 
     bool
-    TreeCanvas::get_auto_hide_failed(void) {
+    TreeCanvas::get_auto_hide_failed() {
         return auto_hide_failed;
     }
 
     bool
-    TreeCanvas::get_auto_zoom(void) {
+    TreeCanvas::get_auto_zoom() {
         return auto_zoom;
     }
 
@@ -1384,7 +1379,7 @@ namespace Gecode { namespace Gist {
     }
 
     bool
-    TreeCanvas::get_smooth_scroll_and_zoom(void) {
+    TreeCanvas::get_smooth_scroll_and_zoom() {
         return smooth_scroll_and_zoom;
     }
 
@@ -1394,7 +1389,7 @@ namespace Gecode { namespace Gist {
     }
 
     bool
-    TreeCanvas::get_move_during_search(void) {
+    TreeCanvas::get_move_during_search() {
         return move_during_search;
     }
 
@@ -1403,6 +1398,6 @@ namespace Gecode { namespace Gist {
         move_during_search = b;
     }
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 // STATISTICS: gist-any
diff --git a/gecode/gist/treecanvas.hh b/gecode/gist/treecanvas.hh
index 0bf679cb76..25692c96d9 100644
--- a/gecode/gist/treecanvas.hh
+++ b/gecode/gist/treecanvas.hh
@@ -44,12 +44,12 @@
 #include 
 
 #if QT_VERSION >= 0x060000
-typedef QRecursiveMutex GecodeQMutex;
+using GecodeQMutex = QRecursiveMutex;
 #else
-typedef QMutex GecodeQMutex;
+using GecodeQMutex = QMutex;
 #endif
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     /// \brief Parameters for the tree layout
     namespace LayoutConfig {
@@ -73,7 +73,7 @@ namespace Gecode { namespace Gist {
         int depth;
         bool a;
         TreeCanvas* t;
-        void update_canvas(void);
+        void update_canvas();
 
     public:
         void search(VisualNode* n, bool all, TreeCanvas* ti);
@@ -83,11 +83,11 @@ namespace Gecode { namespace Gist {
         void status_changed(bool);
         void scale_changed(int);
         void solution(const Space*);
-        void search_finished(void);
+        void search_finished();
         void move_to_node(VisualNode* n, bool);
 
     protected:
-        void run(void) override;
+        void run() override;
     };
 
     /// \brief A canvas that displays the search tree
@@ -101,7 +101,7 @@ namespace Gecode { namespace Gist {
         /// Constructor
         TreeCanvas(Space* root_space, bool bab, QWidget* parent, const Options& opt);
         /// Destructor
-        ~TreeCanvas(void) override;
+        ~TreeCanvas() override;
 
         /// Add inspector \a i
         void add_double_click_inspector(Inspector* i);
@@ -120,34 +120,33 @@ namespace Gecode { namespace Gist {
         /// Set active comparator
         void activate_comparator(int i, bool active);
 
-    public Q_SLOTS:
         /// Set scale factor to \a scale0
         void scale_tree(int scale0, int zoomx = -1, int zoomy = -1);
 
         /// Explore complete subtree of selected node
-        void search_all(void);
+        void search_all();
         /// Find next solution below selected node
-        void search_one(void);
+        void search_one();
         /// Toggle hidden state of selected node
-        void toggle_hidden(void);
+        void toggle_hidden();
         /// Hide failed subtrees of selected node
-        void hide_failed(void);
+        void hide_failed();
         /// Unhide all nodes below selected node
-        void unhide_all(void);
+        void unhide_all();
         /// Do not stop at selected stop node
-        void toggle_stop(void);
+        void toggle_stop();
         /// Do not stop at any stop node
-        void unstop_all(void);
+        void unstop_all();
         /// Export pdf of the current subtree
-        void export_pdf(void);
+        void export_pdf();
         /// Export pdf of the whole tree
-        void export_whole_tree_pdf(void);
+        void export_whole_tree_pdf();
         /// Print the tree
-        void print(void);
+        void print();
         /// Zoom the canvas so that the whole tree fits
-        void zoom_to_fit(void);
+        void zoom_to_fit();
         /// Center the view on the currently selected node
-        void center_current_node(void);
+        void center_current_node();
         /**
          * \brief Call the double click inspector for the currently selected node
          *
@@ -157,46 +156,46 @@ namespace Gecode { namespace Gist {
          */
         void inspect_current_node(bool fix = true, int inspector_no = -1);
         /// Calls inspect_current_node(false)
-        void inspect_before_fp(void);
+        void inspect_before_fp();
         /// Label all branches in subtree under current node
-        void label_branches(void);
+        void label_branches();
         /// Label all branches on path to root node
-        void label_path(void);
+        void label_path();
 
         /// Stop current search
-        void stop_search(void);
+        void stop_search();
 
         /// Reset
-        void reset(void);
+        void reset();
 
         /// Move selection to the parent of the selected node
-        void nav_up(void);
+        void nav_up();
         /// Move selection to the first child of the selected node
-        void nav_down(void);
+        void nav_down();
         /// Move selection to the left sibling of the selected node
-        void nav_left(void);
+        void nav_left();
         /// Move selection to the right sibling of the selected node
-        void nav_right(void);
+        void nav_right();
         /// Move selection to the root node
-        void nav_root(void);
+        void nav_root();
         /// Move selection to next solution (in DFS order)
         void nav_next_sol(bool back = false);
         /// Move selection to previous solution (in DFS order)
-        void nav_prev_sol(void);
+        void nav_prev_sol();
 
         /// Bookmark current node
-        void bookmark_node(void);
+        void bookmark_node();
         /// Set the current node to be the head of the path
-        void set_path(void);
+        void set_path();
         /// Call the double click inspector for all nodes on the path from root to head of the path
-        void inspect_path(void);
+        void inspect_path();
         /// Wait for click on node to compare with current node
-        void start_compare_nodes(void);
+        void start_compare_nodes();
         /// Wait for click on node to compare with current node before fixpoint
-        void start_compare_nodes_before_fp(void);
+        void start_compare_nodes_before_fp();
 
         /// Re-emit status change information for current node
-        void emit_status_changed(void);
+        void emit_status_changed();
 
         /// Set recomputation distances
         void set_recomp_distances(int c_d, int a_d);
@@ -205,30 +204,30 @@ namespace Gecode { namespace Gist {
         /// Set preference whether to automatically zoom to fit
         void set_auto_zoom(bool b);
         /// Return preference whether to automatically hide failed subtrees
-        bool get_auto_hide_failed(void);
+        bool get_auto_hide_failed();
         /// Return preference whether to automatically zoom to fit
-        bool get_auto_zoom(void);
+        bool get_auto_zoom();
         /// Set preference whether to show copies in the tree
         void set_show_copies(bool b);
         /// Return preference whether to show copies in the tree
-        bool get_show_copies(void);
+        bool get_show_copies();
         /// Set refresh rate
         void set_refresh(int i);
         /// Set refresh pause in msec
         void set_refresh_pause(int i);
         /// Return preference whether to use smooth scrolling and zooming
-        bool get_smooth_scroll_and_zoom(void);
+        bool get_smooth_scroll_and_zoom();
         /// Set preference whether to use smooth scrolling and zooming
         void set_smooth_scroll_and_zoom(bool b);
         /// Return preference whether to move cursor during search
-        bool get_move_during_search(void);
+        bool get_move_during_search();
         /// Set preference whether to move cursor during search
         void set_move_during_search(bool b);
         /// Resize to the outer widget size if auto zoom is enabled
-        void resize_to_outer(void);
+        void resize_to_outer();
 
         /// Stop search and wait for it to finish
-        bool finish(void);
+        bool finish();
 
     Q_SIGNALS:
         /// The scale factor has changed
@@ -242,7 +241,7 @@ namespace Gecode { namespace Gist {
         /// Signals that a solution has been found
         void solution(const Space*);
         /// Signals that %Gist is finished
-        void search_finished(void);
+        void search_finished();
         /// Signals that a bookmark has been added
         void added_bookmark(const QString& id);
         /// Signals that a bookmark has been removed
@@ -361,9 +360,9 @@ namespace Gecode { namespace Gist {
 
     public Q_SLOTS:
         /// Update display
-        void update(void);
+        void update();
         /// React to scroll events
-        void scroll(void);
+        void scroll();
         /// Layout done
         void layout_done(int w, int h, int scale0);
         /// Set the selected node to \a n
@@ -379,7 +378,7 @@ namespace Gecode { namespace Gist {
         void scroll(int i);
     };
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 #endif
 
diff --git a/gecode/gist/visualnode.cpp b/gecode/gist/visualnode.cpp
index 3457d96eb2..2b778b8b66 100644
--- a/gecode/gist/visualnode.cpp
+++ b/gecode/gist/visualnode.cpp
@@ -37,7 +37,7 @@
 
 #include 
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     Shape* Shape::leaf;
     Shape* Shape::hidden;
@@ -46,7 +46,7 @@ namespace Gecode { namespace Gist {
     class ShapeAllocator {
     public:
         /// Constructor
-        ShapeAllocator(void) {
+        ShapeAllocator() {
             Shape::leaf = Shape::allocate(1);
             (*Shape::leaf)[0] = Extent(Layout::extent);
             Shape::leaf->compute_bounding_box();
@@ -56,7 +56,7 @@ namespace Gecode { namespace Gist {
             (*Shape::hidden)[1] = Extent(Layout::extent);
             Shape::hidden->compute_bounding_box();
         }
-        ~ShapeAllocator(void) {
+        ~ShapeAllocator() {
             Shape::deallocate(Shape::leaf);
             Shape::deallocate(Shape::hidden);
         }
@@ -86,7 +86,7 @@ namespace Gecode { namespace Gist {
     }
 
     void
-    VisualNode::dispose(void) {
+    VisualNode::dispose() {
         Shape::deallocate(shape);
         SpaceNode::dispose();
     }
@@ -179,7 +179,7 @@ namespace Gecode { namespace Gist {
             std::vector> path;
             VisualNode* p = this;
             while (p) {
-                path.push_back(std::pair(p, p->get_alternative(na)));
+                path.emplace_back(p, p->get_alternative(na));
                 p = p->get_parent(na);
             }
             while (!path.empty()) {
@@ -232,9 +232,8 @@ namespace Gecode { namespace Gist {
         Extent the_extent;
         if (get_shape()->get_extent_at_depth(depth, the_extent)) {
             return (the_extent.l <= x && x <= the_extent.r);
-        } else {
-            return false;
         }
+        return false;
     }
 
     VisualNode*
@@ -404,9 +403,8 @@ namespace Gecode { namespace Gist {
             if (number_of_shapes == 0) {
                 set_shape(Shape::leaf);
                 return;
-            } else {
-                extent = Extent(Layout::extent);
             }
+            extent = Extent(Layout::extent);
         }
 
         int max_depth = 0;
@@ -509,6 +507,6 @@ namespace Gecode { namespace Gist {
         }
     }
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 // STATISTICS: gist-any
diff --git a/gecode/gist/visualnode.hh b/gecode/gist/visualnode.hh
index fe944356e6..538a67ef61 100644
--- a/gecode/gist/visualnode.hh
+++ b/gecode/gist/visualnode.hh
@@ -37,7 +37,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     /// \brief %Layout parameters
     class Layout {
@@ -55,7 +55,7 @@ namespace Gecode { namespace Gist {
         /// Right coordinate
         int right;
         /// Default constructor
-        BoundingBox(void) = default;
+        BoundingBox() = default;
     };
 
     /// \brief %Extent representing shape of a tree at one depth level
@@ -66,7 +66,7 @@ namespace Gecode { namespace Gist {
         /// Right extent
         int r;
         /// Default constructor
-        Extent(void);
+        Extent();
         /// Construct with \a l0 and \a r0
         Extent(int l0, int r0);
         /// Construct with width \a width
@@ -94,7 +94,7 @@ namespace Gecode { namespace Gist {
         /// Assignment operator
         Shape& operator=(const Shape&) = delete;
         /// Constructor
-        Shape(void) = delete;
+        Shape() = delete;
         /// Construct shape of depth \a d
         static Shape* allocate(int d);
         // Destruct
@@ -106,11 +106,11 @@ namespace Gecode { namespace Gist {
         static Shape* hidden;
 
         /// Return depth of the shape
-        int depth(void) const;
+        int depth() const;
         /// Set depth of the shape to \a d (must be smaller than original depth)
         void set_depth(int d);
         /// Compute bounding box
-        void compute_bounding_box(void);
+        void compute_bounding_box();
         /// Return extent at depth \a i
         const Extent& operator[](int i) const;
         /// Return extent at depth \a i
@@ -118,7 +118,7 @@ namespace Gecode { namespace Gist {
         /// Return if extent exists at \a depth, if yes return it in \a extent
         bool get_extent_at_depth(int depth, Extent& extent);
         /// Return bounding box
-        const BoundingBox& get_bounding_box(void) const;
+        const BoundingBox& get_bounding_box() const;
     };
 
     /// \brief %Node class that supports visual layout
@@ -149,7 +149,7 @@ namespace Gecode { namespace Gist {
         VisualNode(Space* root);
 
         /// Return if node is hidden
-        bool is_hidden(void);
+        bool is_hidden();
         /// Set hidden state to \a h
         void set_hidden(bool h);
         /// Set stop state to \a h
@@ -159,23 +159,23 @@ namespace Gecode { namespace Gist {
         /// Compute layout for the subtree of this node
         void layout(const NodeAllocator& na);
         /// Return offset off this node from its parent
-        int get_offset(void);
+        int get_offset();
         /// Set offset of this node, relative to its parent
         void set_offset(int n);
         /// Return whether node is marked as dirty
-        bool is_dirty(void);
+        bool is_dirty();
         /// Mark node as dirty
         void set_dirty(bool d);
         /// Return whether the layout of the node's children has been completed
-        bool children_layout_is_done(void);
+        bool children_layout_is_done();
         /// Mark node whether the layout of the node's children has been completed
         void set_children_layout_done(bool d);
         /// Return whether node is marked
-        bool is_marked(void);
+        bool is_marked();
         /// Set mark of this node
         void set_marked(bool m);
         /// Return whether node is bookmarked
-        bool is_bookmarked(void);
+        bool is_bookmarked();
         /// Set bookmark of this node
         void set_bookmarked(bool m);
         /// Set all nodes from the node to the root to be on the path
@@ -183,11 +183,11 @@ namespace Gecode { namespace Gist {
         /// Set all nodes from the node to the root not to be on the path
         void un_path_up(const NodeAllocator& na);
         /// Return whether node is on the path
-        bool is_on_path(void);
+        bool is_on_path();
         /// Return the alternative of the child that is on the path (-1 if none)
         int get_path_alternative(const NodeAllocator& na);
         /// Set whether node is on the path
-        void set_on_path(bool on_path0);
+        void set_on_path(bool b);
 
         /// Toggle whether this node is hidden
         void toggle_hidden(const NodeAllocator& na);
@@ -201,13 +201,13 @@ namespace Gecode { namespace Gist {
         void unstop_all(const NodeAllocator& na);
 
         /// Return the shape of this node
-        Shape* get_shape(void);
+        Shape* get_shape();
         /// Set the shape of this node
         void set_shape(Shape* s);
         /// Compute the shape according to the shapes of the children
         void compute_shape(const NodeAllocator& na);
         /// Return the bounding box
-        BoundingBox get_bounding_box(void);
+        BoundingBox get_bounding_box();
         /// Signal that the status has changed
         void changed_status(const NodeAllocator& na);
         /// Find a node in this subtree at coordinates \a x, \a y
@@ -225,10 +225,10 @@ namespace Gecode { namespace Gist {
         std::string tool_tip(NodeAllocator& na, BestNode* cur_best, int c_d, int a_d);
 
         /// Free allocated memory
-        void dispose(void);
+        void dispose();
     };
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 #include 
 #include 
diff --git a/gecode/gist/visualnode.hpp b/gecode/gist/visualnode.hpp
index 995f481863..8fd187bc62 100644
--- a/gecode/gist/visualnode.hpp
+++ b/gecode/gist/visualnode.hpp
@@ -30,10 +30,10 @@
  *
  */
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     forceinline
-    Extent::Extent(void)
+    Extent::Extent()
         : l(-1), r(-1) {}
 
     forceinline
@@ -59,7 +59,7 @@ namespace Gecode { namespace Gist {
     }
 
     forceinline int
-    Shape::depth(void) const {
+    Shape::depth() const {
         return _depth;
     }
 
@@ -110,7 +110,7 @@ namespace Gecode { namespace Gist {
     }
 
     forceinline void
-    Shape::compute_bounding_box(void) {
+    Shape::compute_bounding_box() {
         int last_left = 0;
         int last_right = 0;
         bb.left = 0;
@@ -124,12 +124,12 @@ namespace Gecode { namespace Gist {
     }
 
     forceinline const BoundingBox&
-    Shape::get_bounding_box(void) const {
+    Shape::get_bounding_box() const {
         return bb;
     }
 
     forceinline bool
-    VisualNode::is_hidden(void) {
+    VisualNode::is_hidden() {
         return get_flag(HIDDEN);
     }
 
@@ -147,7 +147,7 @@ namespace Gecode { namespace Gist {
     }
 
     forceinline int
-    VisualNode::get_offset(void) {
+    VisualNode::get_offset() {
         return offset;
     }
 
@@ -157,7 +157,7 @@ namespace Gecode { namespace Gist {
     }
 
     forceinline bool
-    VisualNode::is_dirty(void) {
+    VisualNode::is_dirty() {
         return get_flag(DIRTY);
     }
 
@@ -167,7 +167,7 @@ namespace Gecode { namespace Gist {
     }
 
     forceinline bool
-    VisualNode::children_layout_is_done(void) {
+    VisualNode::children_layout_is_done() {
         return get_flag(CHILDREN_LAYOUT_DONE);
     }
 
@@ -177,7 +177,7 @@ namespace Gecode { namespace Gist {
     }
 
     forceinline bool
-    VisualNode::is_marked(void) {
+    VisualNode::is_marked() {
         return get_flag(MARKED);
     }
 
@@ -187,7 +187,7 @@ namespace Gecode { namespace Gist {
     }
 
     forceinline bool
-    VisualNode::is_bookmarked(void) {
+    VisualNode::is_bookmarked() {
         return get_flag(BOOKMARKED);
     }
 
@@ -197,7 +197,7 @@ namespace Gecode { namespace Gist {
     }
 
     forceinline bool
-    VisualNode::is_on_path(void) {
+    VisualNode::is_on_path() {
         return get_flag(ONPATH);
     }
 
@@ -207,15 +207,15 @@ namespace Gecode { namespace Gist {
     }
 
     forceinline Shape*
-    VisualNode::get_shape(void) {
+    VisualNode::get_shape() {
         return is_hidden() ? Shape::hidden : shape;
     }
 
     forceinline BoundingBox
-    VisualNode::get_bounding_box(void) {
+    VisualNode::get_bounding_box() {
         return get_shape()->get_bounding_box();
     }
 
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 // STATISTICS: gist-any
diff --git a/gecode/gist/zoomToFitIcon.hpp b/gecode/gist/zoomToFitIcon.hpp
index cbaa29c209..de2cde354e 100644
--- a/gecode/gist/zoomToFitIcon.hpp
+++ b/gecode/gist/zoomToFitIcon.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Gist {
+namespace Gecode::Gist {
 
     const unsigned char zoom_to_fit_icon[] = {
         0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00,
@@ -95,6 +95,6 @@ namespace Gecode { namespace Gist {
         0x7C, 0xA0, 0xF7, 0x83, 0x99, 0x98, 0xAE, 0x03, 0x5F, 0x06, 0x00, 0x2F, 0xA1, 0x37, 0xFD, 0x49, 0x68, 0x17,
         0xB8, 0x07, 0x38, 0xBB, 0xE3, 0xD2, 0xD5, 0x70, 0x55, 0xC5, 0x9C, 0x97, 0xBF, 0x3E, 0xCA, 0x4D, 0x0B, 0x4A,
         0x32, 0x37, 0x13, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82};
-}} // namespace Gecode::Gist
+} // namespace Gecode::Gist
 
 // STATISTICS: gist-any
diff --git a/gecode/instance.hh b/gecode/instance.hh
index 446c2b7e0e..a57569ebd7 100644
--- a/gecode/instance.hh
+++ b/gecode/instance.hh
@@ -79,7 +79,7 @@
  * \ingroup TaskInstance
  */
 
-namespace Gecode { namespace Instance {
+namespace Gecode::Instance {
 
     /**
      * \defgroup TaskInstance Reading instance files
@@ -335,7 +335,7 @@ namespace Gecode { namespace Instance {
         /// Initialize with message \a m
         explicit Error(const std::string& m);
         /// Return the full message
-        const char* what(void) const noexcept override;
+        const char* what() const noexcept override;
     };
 
     /// Type of the values in a data entry
@@ -361,7 +361,7 @@ namespace Gecode { namespace Instance {
 
     public:
         /// No parameters
-        Params(void);
+        Params();
         /// Set parameter \a name to \a value
         void set(const std::string& name, const std::string& value);
         /**
@@ -375,7 +375,7 @@ namespace Gecode { namespace Instance {
         /// Return whether \a name is set, and if so store its value in \a value
         bool get(const std::string& name, std::string& value) const;
         /// Return number of parameters
-        int size(void) const;
+        int size() const;
         /// Return the name of parameter \a i
         std::string name(int i) const;
     };
@@ -406,12 +406,12 @@ namespace Gecode { namespace Instance {
 
     public:
         /// Empty data
-        Data(void);
+        Data();
 
         /// \name Entries
         //@{
         /// Return number of entries
-        int entries(void) const;
+        int entries() const;
         /// Return name of entry \a i, in the order they were defined
         std::string name(int i) const;
         /// Test whether there is an entry \a n
@@ -470,7 +470,7 @@ namespace Gecode { namespace Instance {
 
     public:
         /// The empty spec (reads only empty input)
-        Spec(void);
+        Spec();
 
         /// \name Creating specs
         //@{
@@ -483,7 +483,7 @@ namespace Gecode { namespace Instance {
         /// \name Information
         //@{
         /// Return the format name declared by the spec (may be empty)
-        std::string name(void) const;
+        std::string name() const;
         //@}
 
         /// \name Reading
@@ -515,7 +515,7 @@ namespace Gecode { namespace Instance {
         //@}
     };
 
-}} // namespace Gecode::Instance
+} // namespace Gecode::Instance
 
 #endif
 
diff --git a/gecode/instance/data.cpp b/gecode/instance/data.cpp
index 8b649ea99f..14422d3b83 100644
--- a/gecode/instance/data.cpp
+++ b/gecode/instance/data.cpp
@@ -41,7 +41,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Instance {
+namespace Gecode::Instance {
 
     /*
      * Errors and parameters
@@ -51,11 +51,11 @@ namespace Gecode { namespace Instance {
     Error::Error(const std::string& m) : Exception("Instance", m.c_str()), msg(m) {}
 
     const char*
-    Error::what(void) const noexcept {
+    Error::what() const noexcept {
         return msg.c_str();
     }
 
-    Params::Params(void) : impl(std::make_shared()) {}
+    Params::Params() : impl(std::make_shared()) {}
 
     void
     Params::set(const std::string& name, const std::string& value) {
@@ -99,7 +99,7 @@ namespace Gecode { namespace Instance {
     }
 
     int
-    Params::size(void) const {
+    Params::size() const {
         return impl->names.size();
     }
 
@@ -120,7 +120,7 @@ namespace Gecode { namespace Instance {
     }
 
     void
-    Column::skip(void) {
+    Column::skip() {
         rows++;
         missing = true;
         if (!started)
@@ -180,7 +180,7 @@ namespace Gecode { namespace Instance {
     }
 
     Value
-    Column::finish(void) {
+    Column::finish() {
         if (!started) {
             // No rows added: every row is missing, so empty if it is a list
             if ((d == 0) && (rows > 0))
@@ -198,7 +198,7 @@ namespace Gecode { namespace Instance {
     }
 
     void
-    Value::index(void) {
+    Value::index() {
         // The memory of earlier starts is reused (see clear_list)
         while (starts.size() > depth)
             starts.pop();
@@ -354,10 +354,10 @@ namespace Gecode { namespace Instance {
 
     } // namespace
 
-    Data::Data(void) : impl(std::make_shared()) {}
+    Data::Data() : impl(std::make_shared()) {}
 
     int
-    Data::entries(void) const {
+    Data::entries() const {
         return impl->entries.size();
     }
 
@@ -500,7 +500,7 @@ namespace Gecode { namespace Instance {
                 "superset", "symdiff",    "test",   "then",    "true",  "tuple",     "type",       "union",
                 "var",      "where",      "xor"};
             // MiniZinc identifiers start with a letter
-            bool plain = !n.empty() && is_letter(n[0]) && (keywords.count(n) == 0);
+            bool plain = !n.empty() && is_letter(n[0]) && (!keywords.contains(n));
             if (plain)
                 os << n;
             else
@@ -577,12 +577,12 @@ namespace Gecode { namespace Instance {
                 // Arrays with an empty dimension need explicit index sets
                 bool empty = false;
                 for (int k = 0; k < v.depth; k++)
-                    empty = empty || (v.lengths[k].size() == 0) || (v.lengths[k][0] == 0);
+                    empty = empty || (v.lengths[k].empty()) || (v.lengths[k][0] == 0);
                 bool nd = (v.depth > 2) || ((v.depth == 2) && empty);
                 if (nd) {
                     os << "array" << v.depth << "d(";
                     for (int k = 0; k < v.depth; k++)
-                        os << "1.." << (v.lengths[k].size() > 0 ? v.lengths[k][0] : 0) << ", ";
+                        os << "1.." << (!v.lengths[k].empty() ? v.lengths[k][0] : 0) << ", ";
                 }
                 os << "[";
                 for (int i = 0; i < nl; i++) {
@@ -611,6 +611,6 @@ namespace Gecode { namespace Instance {
         }
     }
 
-}} // namespace Gecode::Instance
+} // namespace Gecode::Instance
 
 // STATISTICS: instance-any
diff --git a/gecode/instance/eval.cpp b/gecode/instance/eval.cpp
index c9bdffa6cd..afb9d064d1 100644
--- a/gecode/instance/eval.cpp
+++ b/gecode/instance/eval.cpp
@@ -36,7 +36,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Instance {
+namespace Gecode::Instance {
 
     std::string
     quote(const std::string& s) {
@@ -872,6 +872,6 @@ namespace Gecode { namespace Instance {
         return located(m, place(q));
     }
 
-}} // namespace Gecode::Instance
+} // namespace Gecode::Instance
 
 // STATISTICS: instance-any
diff --git a/gecode/instance/eval.hpp b/gecode/instance/eval.hpp
index 9696e5efd3..9adcc8f594 100644
--- a/gecode/instance/eval.hpp
+++ b/gecode/instance/eval.hpp
@@ -35,7 +35,7 @@
 
 #include 
 
-namespace Gecode { namespace Instance {
+namespace Gecode::Instance {
 
     /// Return \a s in single quotes, with newlines and tabs escaped
     std::string quote(const std::string& s);
@@ -50,14 +50,14 @@ namespace Gecode { namespace Instance {
      * The indices \a path select them in the record starts of the repeat
      * (see record_starts), and in each name defined in the repeat.
      */
-    class RecordRef {
+    class RecordRef { // NOLINT(bugprone-exception-escape): the check sees the copy of a Seq argument
     public:
         /// The repeat
         const Stmt* repeat;
         /// The indices
         Seq path;
         /// Initialize without a repeat
-        RecordRef(void) : repeat(nullptr) {}
+        RecordRef() : repeat(nullptr) {}
     };
 
     /// A part of the explanation of a failed check, such as "record 3 of
@@ -91,7 +91,7 @@ namespace Gecode { namespace Instance {
             innermost = this;
         }
         /// Remove the binding
-        ~Binding(void) {
+        ~Binding() {
             innermost = outer;
         }
     };
@@ -187,7 +187,7 @@ namespace Gecode { namespace Instance {
         }
         /// Test whether only blanks precede the position on its line
         bool
-        line_start(void) const {
+        line_start() const {
             for (size_t k = start; k < pos; k++)
                 if (!is_blank(text[k]))
                     return false;
@@ -203,7 +203,7 @@ namespace Gecode { namespace Instance {
         }
         /// Move to the end of the current line
         void
-        to_eol(void) {
+        to_eol() {
             size_t p = text.find('\n', pos);
             advance(p == std::string::npos ? text.size() : p);
         }
@@ -224,7 +224,7 @@ namespace Gecode { namespace Instance {
         }
         /// Skip white space, comment lines, and everything after a stop line
         void
-        skip(void) {
+        skip() {
             for (;;) {
                 const char* s = text.data();
                 size_t n = text.size();
@@ -254,20 +254,20 @@ namespace Gecode { namespace Instance {
         }
         /// Skip to the next data (see skip), and return whether there is any
         bool
-        skip_to_data(void) {
+        skip_to_data() {
             skip();
             return pos < text.size();
         }
         /// Skip blanks and separators, and return whether data follows on the line
         bool
-        skip_to_line_data(void) {
+        skip_to_line_data() {
             while (in_line(pos) && is_separator(text[pos]))
                 pos++;
             return in_line(pos);
         }
         /// Return where the token at the position ends
         size_t
-        token_end(void) const {
+        token_end() const {
             size_t q = pos;
             if ((q < text.size()) && is_split(text[q]))
                 return q + 1;
@@ -277,7 +277,7 @@ namespace Gecode { namespace Instance {
         }
         /// Read the token at the position
         std::string
-        token(void) {
+        token() {
             size_t q = token_end();
             std::string t = text.substr(pos, q - pos);
             advance(q);
@@ -323,7 +323,7 @@ namespace Gecode { namespace Instance {
         }
         /// Return the next token without consuming it
         std::string
-        peek(void) {
+        peek() {
             size_t p0 = pos, s0 = start;
             int l0 = line;
             std::string t = skip_to_data() ? token() : std::string();
@@ -334,7 +334,7 @@ namespace Gecode { namespace Instance {
         }
         /// Return the rest of the current line without trailing blanks
         std::string
-        rest(void) const {
+        rest() const {
             size_t q = text.find('\n', pos);
             if (q == std::string::npos)
                 q = text.size();
@@ -354,7 +354,7 @@ namespace Gecode { namespace Instance {
         }
         /// Return the current place
         Place
-        here(void) const {
+        here() const {
             Place p;
             p.pos = pos;
             p.line = line;
@@ -379,7 +379,7 @@ namespace Gecode { namespace Instance {
         }
         /// Return where the next data starts (see skip), without moving there
         size_t
-        next_data(void) {
+        next_data() {
             size_t p0 = pos, s0 = start;
             int l0 = line;
             skip();
@@ -570,7 +570,7 @@ namespace Gecode { namespace Instance {
         std::string failure(const Stmt& s, int deepest, const Seq& at);
     };
 
-}} // namespace Gecode::Instance
+} // namespace Gecode::Instance
 
 #endif
 
diff --git a/gecode/instance/impl.hpp b/gecode/instance/impl.hpp
index 3c7e763e88..130c81a701 100644
--- a/gecode/instance/impl.hpp
+++ b/gecode/instance/impl.hpp
@@ -41,10 +41,11 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
-namespace Gecode { namespace Instance {
+namespace Gecode::Instance {
 
     /*
      * Character classes and number syntax, ASCII only and independent of the
@@ -135,7 +136,7 @@ namespace Gecode { namespace Instance {
         grow(int m) {
             // Doubling, computed without overflow
             long long int d = std::min(2LL * cap, static_cast(INT_MAX));
-            int c = std::max(std::max(m, static_cast(d)), 2);
+            int c = std::max({m, static_cast(d), 2});
             T* y = static_cast(heap.ralloc(sizeof(T) * static_cast(c)));
             for (int i = 0; i < n; i++) {
                 new (&y[i]) T(std::move(x[i]));
@@ -149,7 +150,7 @@ namespace Gecode { namespace Instance {
 
     public:
         /// Empty array
-        Seq(void) : x(nullptr), n(0), cap(0) {}
+        Seq() : x(nullptr), n(0), cap(0) {}
         /// Copy elements of \a s
         Seq(const Seq& s) : Seq() {
             // Delegating, so that the destructor runs if a copy throws
@@ -172,19 +173,19 @@ namespace Gecode { namespace Instance {
             return *this;
         }
         /// Release memory
-        ~Seq(void) {
+        ~Seq() {
             clear();
             if (x != nullptr)
                 heap.rfree(x);
         }
         /// Return number of elements
         int
-        size(void) const {
+        size() const {
             return n;
         }
         /// Test whether empty
         bool
-        empty(void) const {
+        empty() const {
             return n == 0;
         }
         /// Make room for \a m elements
@@ -219,13 +220,13 @@ namespace Gecode { namespace Instance {
         }
         /// Remove last element
         void
-        pop(void) {
+        pop() {
             assert(n > 0);
             x[--n].~T();
         }
         /// Remove all elements
         void
-        clear(void) {
+        clear() {
             while (n > 0)
                 x[--n].~T();
         }
@@ -243,45 +244,50 @@ namespace Gecode { namespace Instance {
         }
         /// Return last element
         T&
-        back(void) {
+        back() {
             assert(n > 0);
             return x[n - 1];
         }
         /// Return last element
         const T&
-        back(void) const {
+        back() const {
             assert(n > 0);
             return x[n - 1];
         }
         /// Iteration support
         T*
-        begin(void) {
+        begin() {
             return x;
         }
         /// Iteration support
         T*
-        end(void) {
+        end() {
             return x + n;
         }
         /// Iteration support
         const T*
-        begin(void) const {
+        begin() const {
             return x;
         }
         /// Iteration support
         const T*
-        end(void) const {
+        end() const {
             return x + n;
         }
     };
 
     /// Error about the shape or type of a value, located by the caller
-    class ShapeError {
+    class ShapeError : public std::exception {
     public:
         /// Message
         std::string msg;
         /// Initialize with message \a m
         explicit ShapeError(const std::string& m) : msg(m) {}
+        /// Return the message
+        const char*
+        what() const noexcept override {
+            return msg.c_str();
+        }
     };
 
     /**
@@ -293,7 +299,7 @@ namespace Gecode { namespace Instance {
      * list), level \a k has one entry per list at depth \a k. The lengths at
      * the last level sum to the number of leaves.
      */
-    class Value {
+    class Value { // NOLINT(bugprone-exception-escape): the check sees the copy of a Seq argument
     public:
         /// Type of the leaves
         ValueType type;
@@ -311,7 +317,7 @@ namespace Gecode { namespace Instance {
         Seq strs;
 
         /// The empty integer list
-        Value(void) : type(ValueType::INT), depth(1) {
+        Value() : type(ValueType::INT), depth(1) {
             lengths.push(Seq());
             lengths[0].push(0);
         }
@@ -341,17 +347,17 @@ namespace Gecode { namespace Instance {
 
         /// Test whether scalar
         bool
-        is_scalar(void) const {
+        is_scalar() const {
             return depth == 0;
         }
         /// Test whether numeric scalar
         bool
-        is_number(void) const {
+        is_number() const {
             return (depth == 0) && (type != ValueType::STRING);
         }
         /// Return number of leaves
         int
-        leaves(void) const {
+        leaves() const {
             switch (type) {
             case ValueType::INT:
                 return ints.size();
@@ -363,7 +369,7 @@ namespace Gecode { namespace Instance {
         }
         /// Return length of outermost list
         int
-        size(void) const {
+        size() const {
             return depth == 0 ? 0 : lengths[0][0];
         }
         /// Return value of numeric scalar or leaf \a i as a double
@@ -373,7 +379,7 @@ namespace Gecode { namespace Instance {
         }
         /// Convert integer leaves to floats
         void
-        to_float(void) {
+        to_float() {
             if (type != ValueType::INT)
                 return;
             for (long long int v : ints)
@@ -408,7 +414,7 @@ namespace Gecode { namespace Instance {
         }
         /// Test whether this is an empty list
         bool
-        is_empty_list(void) const {
+        is_empty_list() const {
             return (depth > 0) && (lengths[0][0] == 0);
         }
         /// Make this the empty list of type \a t, keeping the memory for reuse
@@ -428,7 +434,7 @@ namespace Gecode { namespace Instance {
         }
 
         /// Compute \a starts, needed by range
-        void index(void);
+        void index();
         /// Find leaf range of list \a pos at level \a level
         void range(int level, int pos, int& from, int& to) const;
     };
@@ -466,9 +472,9 @@ namespace Gecode { namespace Instance {
         /// Add a row \a v; throws ShapeError with a phrase completing the name
         void add(Value& v);
         /// Add a missing row
-        void skip(void);
+        void skip();
         /// Return the array
-        Value finish(void);
+        Value finish();
     };
 
     /// A named value
@@ -479,7 +485,7 @@ namespace Gecode { namespace Instance {
         /// Value
         Value value;
         /// Initialize as the empty integer list without a name
-        Entry(void) = default;
+        Entry() = default;
         /// Initialize as \a v named \a n
         Entry(const std::string& n, Value&& v) : name(n), value(std::move(v)) {}
     };
@@ -636,7 +642,7 @@ namespace Gecode { namespace Instance {
         explicit Type(ReadType r = ReadType::INT) : read(r), exclusive(false), named(nullptr), base(1) {}
         /// Test whether the type has a range, possibly through its name
         bool
-        ranged(void) const {
+        ranged() const {
             return (lo != nullptr) || (hi != nullptr) || (named != nullptr);
         }
         /// Return a use of the type defined by type statement \a d
@@ -676,7 +682,7 @@ namespace Gecode { namespace Instance {
     };
 
     /// Sequence of statements
-    typedef Seq> Block;
+    using Block = Seq>;
 
     /// Arm of a sections statement
     class Arm {
@@ -690,7 +696,7 @@ namespace Gecode { namespace Instance {
         /// Whether the sections statement ends after this arm
         bool last;
         /// Initialize
-        Arm(void) : optional(false), last(false) {}
+        Arm() : optional(false), last(false) {}
     };
 
     /// Statement
@@ -821,7 +827,7 @@ namespace Gecode { namespace Instance {
     /// Read file \a path into a string
     std::string read_file(const std::string& path);
 
-}} // namespace Gecode::Instance
+} // namespace Gecode::Instance
 
 #endif
 
diff --git a/gecode/instance/reader.cpp b/gecode/instance/reader.cpp
index 6a582b6a51..a27af43edb 100644
--- a/gecode/instance/reader.cpp
+++ b/gecode/instance/reader.cpp
@@ -35,7 +35,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Instance {
+namespace Gecode::Instance {
 
     namespace {
 
@@ -87,7 +87,7 @@ namespace Gecode { namespace Instance {
             /// Upper bound, included
             long long int hi;
             /// Initialize without bounds
-            Range(void) : low(false), high(false), lo(0), hi(0) {}
+            Range() : low(false), high(false), lo(0), hi(0) {}
             /// Test whether \a v is in the range
             bool
             contains(long long int v) const {
@@ -95,7 +95,7 @@ namespace Gecode { namespace Instance {
             }
             /// Test whether there are bounds
             bool
-            bounded(void) const {
+            bounded() const {
                 return low || high;
             }
         };
@@ -111,7 +111,7 @@ namespace Gecode { namespace Instance {
             Domain(const Type& t, const Range& r) : type(t), range(r) {}
             /// Return a description of the values, for messages
             std::string
-            describe(void) const {
+            describe() const {
                 std::string d = Instance::describe(type.read);
                 if (range.bounded())
                     d = "an int in " + (range.low ? std::to_string(range.lo) : "") + ".." +
@@ -603,7 +603,7 @@ namespace Gecode { namespace Instance {
             /// Match item \a k of \a p at position \a c of line \a l
             bool
             match_item(const Pattern& p, int k, const std::string& l, size_t& c, Seq& caps) {
-                typedef Pattern::Item Item;
+                using Item = Pattern::Item;
                 const Item& it = p.items[k];
                 switch (it.kind) {
                 case Item::Kind::SPACE: {
@@ -1004,7 +1004,7 @@ namespace Gecode { namespace Instance {
              * the name, and may not be while the name is not defined yet.
              */
             bool
-            may_be_skipped(void) const {
+            may_be_skipped() const {
                 if (current == 0)
                     return false;
                 if (catalog)
@@ -1328,12 +1328,12 @@ namespace Gecode { namespace Instance {
                                 fail("expected a symbol for row " + std::to_string(i + 1) + ", column " +
                                      std::to_string(j + 1) + ", found end of input");
                             ch = in.text[in.pos];
-                            if (t.strip.find(ch) == std::string::npos)
+                            if (!t.strip.contains(ch))
                                 break;
                             in.advance(in.pos + 1);
                         }
                         size_t k = t.alphabet.find(ch);
-                        if (t.blank.find(ch) != std::string::npos) {
+                        if (t.blank.contains(ch)) {
                             g.ints.push(0);
                         } else if (k != std::string::npos) {
                             long long int v;
@@ -1370,6 +1370,6 @@ namespace Gecode { namespace Instance {
         return r;
     }
 
-}} // namespace Gecode::Instance
+} // namespace Gecode::Instance
 
 // STATISTICS: instance-any
diff --git a/gecode/instance/resolve.cpp b/gecode/instance/resolve.cpp
index 846821002d..e2ee23c766 100644
--- a/gecode/instance/resolve.cpp
+++ b/gecode/instance/resolve.cpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Instance {
+namespace Gecode::Instance {
 
     namespace {
 
@@ -222,7 +222,7 @@ namespace Gecode { namespace Instance {
             /// Check that the names of the records of repeats are not used
             /// otherwise
             void
-            check_lists(void) const {
+            check_lists() const {
                 for (int i = 0; i < lists.size(); i++) {
                     const Stmt* r = lists[i].repeat;
                     check_name(r->list, i);
@@ -408,7 +408,7 @@ namespace Gecode { namespace Instance {
             /// Test whether the statement visited is a check, so that record
             /// names in it range over their records
             bool
-            lifting(void) const {
+            lifting() const {
                 return stmt->kind == Stmt::Kind::CHECK;
             }
             /// Check that the record names of check \a s range over one repeat
@@ -667,6 +667,6 @@ namespace Gecode { namespace Instance {
         Resolver(origin).run(b);
     }
 
-}} // namespace Gecode::Instance
+} // namespace Gecode::Instance
 
 // STATISTICS: instance-any
diff --git a/gecode/instance/spec.cpp b/gecode/instance/spec.cpp
index 2869fab197..6479f3570e 100644
--- a/gecode/instance/spec.cpp
+++ b/gecode/instance/spec.cpp
@@ -40,9 +40,10 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
-namespace Gecode { namespace Instance {
+namespace Gecode::Instance {
 
     std::string
     read_file(const std::string& path) {
@@ -102,7 +103,7 @@ namespace Gecode { namespace Instance {
             /// Whether no white space precedes the token
             bool glued;
             /// Initialize
-            Token(void) : kind(Kind::END), i(0), f(0.0), line(0), glued(false) {}
+            Token() : kind(Kind::END), i(0), f(0.0), line(0), glued(false) {}
         };
 
         /**
@@ -124,8 +125,7 @@ namespace Gecode { namespace Instance {
             case '\n':
                 fail_at(origin, line, "unterminated string");
             default:
-                fail_at(origin, line,
-                        std::string("unknown escape '\\") + e + "' in string (use \\n, \\t, \\\\, or \\\")");
+                fail_at(origin, line, std::string("unknown escape '\\") + e + R"(' in string (use \n, \t, \\, or \"))");
             }
         }
 
@@ -151,7 +151,7 @@ namespace Gecode { namespace Instance {
         /// Test whether \a n is the name of a Gecode constant
         bool
         is_gecode_name(const std::string& n) {
-            return n.compare(0, gecode_prefix.size(), gecode_prefix) == 0;
+            return n.starts_with(gecode_prefix);
         }
 
         /// Split spec \a src, which starts on line \a line, into tokens
@@ -288,7 +288,7 @@ namespace Gecode { namespace Instance {
         /// Test whether pattern item \a it ends with a word character
         bool
         ends_word(const Pattern::Item& it) {
-            typedef Pattern::Item::Kind Kind;
+            using Kind = Pattern::Item::Kind;
             return (it.kind == Kind::CAP) || (it.kind == Kind::VAR) ||
                    ((it.kind == Kind::LIT) && is_alnum(it.text[it.text.size() - 1]));
         }
@@ -296,7 +296,7 @@ namespace Gecode { namespace Instance {
         /// Test whether pattern item \a it starts with a word character
         bool
         starts_word(const Pattern::Item& it) {
-            typedef Pattern::Item::Kind Kind;
+            using Kind = Pattern::Item::Kind;
             return (it.kind == Kind::CAP) || (it.kind == Kind::VAR) || ((it.kind == Kind::LIT) && is_alnum(it.text[0]));
         }
 
@@ -304,7 +304,7 @@ namespace Gecode { namespace Instance {
         /// capture to \a types
         Pattern
         compile(const std::string& src, Seq& types) {
-            typedef Pattern::Item Item;
+            using Item = Pattern::Item;
             Pattern pat;
             pat.source = src;
             size_t p = 0;
@@ -449,11 +449,11 @@ namespace Gecode { namespace Instance {
             static const int max_nesting = 256;
 
             const Token&
-            peek(void) const {
+            peek() const {
                 return toks[p];
             }
             const Token&
-            next(void) {
+            next() {
                 const Token& t = toks[p];
                 if (p + 1 < toks.size())
                     p++;
@@ -482,7 +482,7 @@ namespace Gecode { namespace Instance {
             /// Test whether a '-' or '.' joining the words of a format name such as
             /// dimacs-cnf comes next
             bool
-            at_name_joiner(void) const {
+            at_name_joiner() const {
                 if (!(punct("-") || punct(".")) || !peek().glued || (p + 1 >= toks.size()))
                     return false;
                 const Token& t = toks[p + 1];
@@ -522,7 +522,7 @@ namespace Gecode { namespace Instance {
                 return next().text;
             }
             Pattern
-            pattern(void) {
+            pattern() {
                 int line = peek().line;
                 std::string s = string("a line pattern");
                 Pattern pat;
@@ -566,7 +566,7 @@ namespace Gecode { namespace Instance {
                     fail(std::string(what) + " are nested too deeply");
             }
             Block
-            block(void) {
+            block() {
                 expect_punct("{");
                 enter(depth, "blocks");
                 // The types defined in the block are only visible inside it
@@ -585,7 +585,7 @@ namespace Gecode { namespace Instance {
             }
             std::unique_ptr
             integer(long long int v) {
-                std::unique_ptr e(new Expr(Expr::Kind::INT));
+                std::unique_ptr e = std::make_unique(Expr::Kind::INT);
                 e->i = v;
                 return e;
             }
@@ -605,7 +605,7 @@ namespace Gecode { namespace Instance {
              */
 
             /// A function completing statement \a s, which starts with \a kw
-            typedef void (Parser::*Parse)(Stmt& s, const std::string& kw);
+            using Parse = void (Parser::*)(Stmt& s, const std::string& kw);
 
             /// A statement that starts with a keyword
             class Keyword {
@@ -675,14 +675,14 @@ namespace Gecode { namespace Instance {
             }
 
             std::unique_ptr
-            statement(void) {
+            statement() {
                 const Token& t = peek();
                 each_ok = repeat_start;
                 repeat_start = false;
                 if (t.kind != Token::Kind::IDENT)
                     fail("expected a statement, found " + describe(t));
                 if (at_declaration(p)) {
-                    std::unique_ptr s(new Stmt(Stmt::Kind::READ, t.line));
+                    std::unique_ptr s = std::make_unique(Stmt::Kind::READ, t.line);
                     declaration(*s);
                     return s;
                 }
@@ -691,7 +691,7 @@ namespace Gecode { namespace Instance {
                     fail("unknown statement '" + t.text + "'");
                 if (e->setting && (depth > 0))
                     fail("the setting '" + t.text + "' must be at the top level of the spec");
-                std::unique_ptr s(new Stmt(e->kind, t.line));
+                std::unique_ptr s = std::make_unique(e->kind, t.line);
                 std::string kw = next().text;
                 (this->*e->parse)(*s, kw);
                 return s;
@@ -748,7 +748,7 @@ namespace Gecode { namespace Instance {
             }
             /// Test whether the upper bound of a range comes next
             bool
-            at_upper_bound(void) const {
+            at_upper_bound() const {
                 const Token& t = peek();
                 switch (t.kind) {
                 case Token::Kind::IDENT:
@@ -783,7 +783,7 @@ namespace Gecode { namespace Instance {
              * bound of lo..
-            expr(void) {
+            expr() {
                 return binary(0);
             }
             /// Store the binary operator \a t in \a op, and return its precedence
@@ -1073,7 +1073,7 @@ namespace Gecode { namespace Instance {
                         break;
                     enter(nesting, "expressions");
                     levels++;
-                    std::unique_ptr e(new Expr(Expr::Kind::BINARY));
+                    std::unique_ptr e = std::make_unique(Expr::Kind::BINARY);
                     e->op = op;
                     e->s = next().text;
                     e->args.push(std::move(lhs));
@@ -1084,11 +1084,11 @@ namespace Gecode { namespace Instance {
                 return lhs;
             }
             std::unique_ptr
-            unary(void) {
+            unary() {
                 enter(nesting, "expressions");
                 std::unique_ptr e;
                 if (punct("-") || punct("!")) {
-                    e.reset(new Expr(Expr::Kind::UNARY));
+                    e = std::make_unique(Expr::Kind::UNARY);
                     e->op = punct("-") ? Expr::Op::NEG : Expr::Op::NOT;
                     e->s = next().text;
                     e->args.push(unary());
@@ -1101,11 +1101,11 @@ namespace Gecode { namespace Instance {
             /// a ^ b, which binds tighter than unary operators and groups to the
             /// right; b is a unary expression, so 2^-1 is 2^(-1)
             std::unique_ptr
-            power(void) {
+            power() {
                 std::unique_ptr e = postfix();
                 if (!punct("^"))
                     return e;
-                std::unique_ptr x(new Expr(Expr::Kind::BINARY));
+                std::unique_ptr x = std::make_unique(Expr::Kind::BINARY);
                 x->op = Expr::Op::POW;
                 x->s = next().text;
                 x->args.push(std::move(e));
@@ -1114,7 +1114,7 @@ namespace Gecode { namespace Instance {
             }
             /// Indices and fields a[i][j].f...
             std::unique_ptr
-            postfix(void) {
+            postfix() {
                 std::unique_ptr e = primary();
                 // Each index or field adds a level above e
                 int levels = 0;
@@ -1123,7 +1123,7 @@ namespace Gecode { namespace Instance {
                     next();
                     enter(nesting, "expressions");
                     levels++;
-                    std::unique_ptr x(new Expr(field ? Expr::Kind::FIELD : Expr::Kind::INDEX));
+                    std::unique_ptr x = std::make_unique(field ? Expr::Kind::FIELD : Expr::Kind::INDEX);
                     x->args.push(std::move(e));
                     if (field) {
                         x->s = ident("a field name");
@@ -1186,7 +1186,7 @@ namespace Gecode { namespace Instance {
             /// f(x in a: e), after "f("
             std::unique_ptr
             comprehension(const std::string& f) {
-                std::unique_ptr e(new Expr(Expr::Kind::COMPREHENSION));
+                std::unique_ptr e = std::make_unique(Expr::Kind::COMPREHENSION);
                 e->s = f;
                 BoundName b;
                 b.line = peek().line;
@@ -1209,17 +1209,17 @@ namespace Gecode { namespace Instance {
                 return e;
             }
             std::unique_ptr
-            primary(void) {
+            primary() {
                 const Token& t = peek();
                 if (t.kind == Token::Kind::INT)
                     return integer(next().i);
                 if (t.kind == Token::Kind::FLOAT) {
-                    std::unique_ptr e(new Expr(Expr::Kind::FLOAT));
+                    std::unique_ptr e = std::make_unique(Expr::Kind::FLOAT);
                     e->f = next().f;
                     return e;
                 }
                 if (t.kind == Token::Kind::STRING) {
-                    std::unique_ptr e(new Expr(Expr::Kind::STR));
+                    std::unique_ptr e = std::make_unique(Expr::Kind::STR);
                     e->s = next().text;
                     return e;
                 }
@@ -1240,7 +1240,7 @@ namespace Gecode { namespace Instance {
                         next();
                         if (at_comprehension(n))
                             return comprehension(n);
-                        std::unique_ptr e(new Expr(Expr::Kind::CALL));
+                        std::unique_ptr e = std::make_unique(Expr::Kind::CALL);
                         e->s = n;
                         if (!punct(")")) {
                             e->args.push(expr());
@@ -1253,7 +1253,7 @@ namespace Gecode { namespace Instance {
                         check_call(*e, line);
                         return e;
                     }
-                    std::unique_ptr e(new Expr(Expr::Kind::NAME));
+                    std::unique_ptr e = std::make_unique(Expr::Kind::NAME);
                     e->s = n;
                     return e;
                 }
@@ -1359,7 +1359,7 @@ namespace Gecode { namespace Instance {
      *
      */
 
-    Spec::Spec(void) : impl(std::make_shared("", "")) {}
+    Spec::Spec() : impl(std::make_shared("", "")) {}
 
     Spec
     Spec::parse(const std::string& text, const std::string& origin) {
@@ -1374,7 +1374,7 @@ namespace Gecode { namespace Instance {
     }
 
     std::string
-    Spec::name(void) const {
+    Spec::name() const {
         return impl->name;
     }
 
@@ -1398,6 +1398,6 @@ namespace Gecode { namespace Instance {
         return impl->read(text, origin, p, true);
     }
 
-}} // namespace Gecode::Instance
+} // namespace Gecode::Instance
 
 // STATISTICS: instance-any
diff --git a/gecode/int.hh b/gecode/int.hh
index 7bfc318254..f982ce330a 100644
--- a/gecode/int.hh
+++ b/gecode/int.hh
@@ -99,59 +99,55 @@
 
 #include 
 
-namespace Gecode { namespace Int {
-
-    /**
-     * \brief Numerical limits for integer variables
-     *
-     * The integer limits are chosen such changing the sign is always possible
-     * without overflow.
-     * \ingroup TaskModelIntVars
-     */
-    namespace Limits {
-        /// Largest allowed integer value
-        const int max = INT_MAX - 1;
-        /// Smallest allowed integer value
-        const int min = -max;
-        /// Infinity for integers
-        const int infinity = max + 1;
-        /// Largest allowed long long integer value
-        const long long int llmax = LLONG_MAX - 1;
-        /// Smallest allowed long long integer value
-        const long long int llmin = -llmax;
-        /// Infinity for long long integers
-        const long long int llinfinity = llmax + 1;
-        /// Return whether \a n is in range
-        bool valid(int n);
-        /// Return whether \a n is in range
-        bool valid(long long int n);
-        /// Check whether \a n is in range, otherwise throw out of limits with information \a l
-        void check(int n, const char* l);
-        /// Check whether \a n is in range, otherwise throw out of limits with information \a l
-        void check(long long int n, const char* l);
-        /// Check whether \a n is in range and strictly positive, otherwise throw out of limits with information \a l
-        void positive(int n, const char* l);
-        /// Check whether \a n is in range and strictly positive, otherwise throw out of limits with information \a l
-        void positive(long long int n, const char* l);
-        /// Check whether \a n is in range and nonnegative, otherwise throw out of limits with information \a l
-        void nonnegative(int n, const char* l);
-        /// Check whether \a n is in integer range and nonnegative, otherwise throw out of limits exception with information \a l
-        void nonnegative(long long int n, const char* l);
-        /// Check whether adding \a n and \a m would overflow
-        bool overflow_add(int n, int m);
-        /// Check whether adding \a n and \a m would overflow
-        bool overflow_add(long long int n, long long int m);
-        /// Check whether subtracting \a m from \a n would overflow
-        bool overflow_sub(int n, int m);
-        /// Check whether subtracting \a m from \a n would overflow
-        bool overflow_sub(long long int n, long long int m);
-        /// Check whether multiplying \a n and \a m would overflow
-        bool overflow_mul(int n, int m);
-        /// Check whether multiplying \a n and \a m would overflow
-        bool overflow_mul(long long int n, long long int m);
-    } // namespace Limits
-
-}} // namespace Gecode::Int
+/**
+ * \brief Numerical limits for integer variables
+ *
+ * The integer limits are chosen such changing the sign is always possible
+ * without overflow.
+ * \ingroup TaskModelIntVars
+ */
+namespace Gecode::Int::Limits {
+    /// Largest allowed integer value
+    const int max = INT_MAX - 1;
+    /// Smallest allowed integer value
+    const int min = -max;
+    /// Infinity for integers
+    const int infinity = max + 1;
+    /// Largest allowed long long integer value
+    const long long int llmax = LLONG_MAX - 1;
+    /// Smallest allowed long long integer value
+    const long long int llmin = -llmax;
+    /// Infinity for long long integers
+    const long long int llinfinity = llmax + 1;
+    /// Return whether \a n is in range
+    bool valid(int n);
+    /// Return whether \a n is in range
+    bool valid(long long int n);
+    /// Check whether \a n is in range, otherwise throw out of limits with information \a l
+    void check(int n, const char* l);
+    /// Check whether \a n is in range, otherwise throw out of limits with information \a l
+    void check(long long int n, const char* l);
+    /// Check whether \a n is in range and strictly positive, otherwise throw out of limits with information \a l
+    void positive(int n, const char* l);
+    /// Check whether \a n is in range and strictly positive, otherwise throw out of limits with information \a l
+    void positive(long long int n, const char* l);
+    /// Check whether \a n is in range and nonnegative, otherwise throw out of limits with information \a l
+    void nonnegative(int n, const char* l);
+    /// Check whether \a n is in integer range and nonnegative, otherwise throw out of limits exception with information \a l
+    void nonnegative(long long int n, const char* l);
+    /// Check whether adding \a n and \a m would overflow
+    bool overflow_add(int n, int m);
+    /// Check whether adding \a n and \a m would overflow
+    bool overflow_add(long long int n, long long int m);
+    /// Check whether subtracting \a m from \a n would overflow
+    bool overflow_sub(int n, int m);
+    /// Check whether subtracting \a m from \a n would overflow
+    bool overflow_sub(long long int n, long long int m);
+    /// Check whether multiplying \a n and \a m would overflow
+    bool overflow_mul(int n, int m);
+    /// Check whether multiplying \a n and \a m would overflow
+    bool overflow_mul(long long int n, long long int m);
+} // namespace Gecode::Int::Limits
 
 #include 
 
@@ -203,7 +199,7 @@ namespace Gecode {
             /// Perform equality test on ranges
             GECODE_INT_EXPORT bool equal(const IntSetObject& so) const;
             /// Delete object
-            GECODE_INT_EXPORT ~IntSetObject(void) override;
+            GECODE_INT_EXPORT ~IntSetObject() override;
         };
         /// Sort ranges according to increasing minimum
         class MinInc;
@@ -219,14 +215,14 @@ namespace Gecode {
     public:
 #ifdef GECODE_HAS_FAULT_INJECTION
         /// Reset live object accounting for fault-injection tests
-        GECODE_INT_EXPORT static void fault_reset_allocations(void);
+        GECODE_INT_EXPORT static void fault_reset_allocations();
         /// Return live object accounting for fault-injection tests
-        GECODE_INT_EXPORT static int fault_live_allocations(void);
+        GECODE_INT_EXPORT static int fault_live_allocations();
 #endif
         /// \name Constructors and initialization
         //@{
         /// Initialize as empty set
-        IntSet(void) = default;
+        IntSet() = default;
         /** \brief Initialize as range with minimum \a n and maximum \a m
          *
          * Note that the set is empty if \a n is larger than \a m
@@ -261,7 +257,7 @@ namespace Gecode {
         /// \name Range access
         //@{
         /// Return number of ranges of the specification
-        int ranges(void) const;
+        int ranges() const;
         /// Return minimum of range at position \a i
         int min(int i) const;
         /// Return maximum of range at position \a i
@@ -275,13 +271,13 @@ namespace Gecode {
         /// Return whether \a n is included in the set
         bool in(int n) const;
         /// Return size (cardinality) of set
-        unsigned int size(void) const;
+        unsigned int size() const;
         /// Return width of set (distance between maximum and minimum)
-        unsigned int width(void) const;
+        unsigned int width() const;
         /// Return minimum of entire set
-        int min(void) const;
+        int min() const;
         /// Return maximum of entire set
-        int max(void) const;
+        int max() const;
         //@}
 
         /// \name Equality tests
@@ -313,7 +309,7 @@ namespace Gecode {
         /// \name Constructors and initialization
         //@{
         /// Default constructor
-        IntSetRanges(void) = default;
+        IntSetRanges() = default;
         /// Initialize with ranges for set \a s
         IntSetRanges(const IntSet& s);
         /// Initialize with ranges for set \a s
@@ -323,19 +319,19 @@ namespace Gecode {
         /// \name Iteration control
         //@{
         /// Test whether iterator is still at a range or done
-        bool operator()(void) const;
+        bool operator()() const;
         /// Move iterator to next range (if possible)
-        void operator++(void);
+        void operator++();
         //@}
 
         /// \name Range access
         //@{
         /// Return smallest value of range
-        int min(void) const;
+        int min() const;
         /// Return largest value of range
-        int max(void) const;
+        int max() const;
         /// Return width of range (distance between minimum and maximum)
-        unsigned int width(void) const;
+        unsigned int width() const;
         //@}
     };
 
@@ -349,7 +345,7 @@ namespace Gecode {
         /// \name Constructors and initialization
         //@{
         /// Default constructor
-        IntSetValues(void) = default;
+        IntSetValues() = default;
         /// Initialize with values for \a s
         IntSetValues(const IntSet& s);
         /// Initialize with values for \a s
@@ -406,7 +402,7 @@ namespace Gecode {
         /// \name Constructors and initialization
         //@{
         /// Default constructor
-        IntVar(void) = default;
+        IntVar() = default;
         /// Initialize from integer variable \a y
         IntVar(const IntVar& y) = default;
         /// Initialize from integer view \a y
@@ -440,11 +436,11 @@ namespace Gecode {
         /// \name Value access
         //@{
         /// Return minimum of domain
-        int min(void) const;
+        int min() const;
         /// Return maximum of domain
-        int max(void) const;
+        int max() const;
         /// Return median of domain (greatest element not greater than the median)
-        int med(void) const;
+        int med() const;
         /**
          * \brief Return assigned value
          *
@@ -452,22 +448,22 @@ namespace Gecode {
          * is not yet assigned.
          *
          */
-        int val(void) const;
+        int val() const;
 
         /// Return size (cardinality) of domain
-        unsigned int size(void) const;
+        unsigned int size() const;
         /// Return width of domain (distance between maximum and minimum)
-        unsigned int width(void) const;
+        unsigned int width() const;
         /// Return regret of domain minimum (distance to next larger value)
-        unsigned int regret_min(void) const;
+        unsigned int regret_min() const;
         /// Return regret of domain maximum (distance to next smaller value)
-        unsigned int regret_max(void) const;
+        unsigned int regret_max() const;
         //@}
 
         /// \name Domain tests
         //@{
         /// Test whether domain is a range
-        bool range(void) const;
+        bool range() const;
         /// Test whether \a n is contained in domain
         bool in(int n) const;
         //@}
@@ -492,7 +488,7 @@ namespace Gecode {
         /// \name Constructors and initialization
         //@{
         /// Default constructor
-        IntVarRanges(void);
+        IntVarRanges();
         /// Initialize with ranges for integer variable \a x
         IntVarRanges(const IntVar& x);
         /// Initialize with ranges for integer variable \a x
@@ -509,7 +505,7 @@ namespace Gecode {
         /// \name Constructors and initialization
         //@{
         /// Default constructor
-        IntVarValues(void) = default;
+        IntVarValues() = default;
         /// Initialize with values for \a x
         IntVarValues(const IntVar& x);
         /// Initialize with values \a x
@@ -544,7 +540,7 @@ namespace Gecode {
         /// \name Constructors and initialization
         //@{
         /// Default constructor
-        BoolVar(void) = default;
+        BoolVar() = default;
         /// Initialize from Boolean variable \a y
         BoolVar(const BoolVar& y) = default;
         /// Initialize from Boolean view \a y
@@ -566,11 +562,11 @@ namespace Gecode {
         /// \name Value access
         //@{
         /// Return minimum of domain
-        int min(void) const;
+        int min() const;
         /// Return maximum of domain
-        int max(void) const;
+        int max() const;
         /// Return median of domain (greatest element not greater than the median)
-        int med(void) const;
+        int med() const;
         /**
          * \brief Return assigned value
          *
@@ -578,22 +574,22 @@ namespace Gecode {
          * is not yet assigned.
          *
          */
-        int val(void) const;
+        int val() const;
 
         /// Return size (cardinality) of domain
-        unsigned int size(void) const;
+        unsigned int size() const;
         /// Return width of domain (distance between maximum and minimum)
-        unsigned int width(void) const;
+        unsigned int width() const;
         /// Return regret of domain minimum (distance to next larger value)
-        unsigned int regret_min(void) const;
+        unsigned int regret_min() const;
         /// Return regret of domain maximum (distance to next smaller value)
-        unsigned int regret_max(void) const;
+        unsigned int regret_max() const;
         //@}
 
         /// \name Domain tests
         //@{
         /// Test whether domain is a range
-        bool range(void) const;
+        bool range() const;
         /// Test whether \a n is contained in domain
         bool in(int n) const;
         //@}
@@ -601,11 +597,11 @@ namespace Gecode {
         /// \name Boolean domain tests
         //@{
         /// Test whether domain is zero
-        bool zero(void) const;
+        bool zero() const;
         /// Test whether domain is one
-        bool one(void) const;
+        bool one() const;
         /// Test whether domain is neither zero nor one
-        bool none(void) const;
+        bool none() const;
         //@}
 
         /// Assignment operator
@@ -636,7 +632,7 @@ namespace Gecode {
 
     //@{
     /// Passing set arguments
-    typedef ArgArray IntSetArgs;
+    using IntSetArgs = ArgArray;
 
 } // namespace Gecode
 
@@ -650,7 +646,7 @@ namespace Gecode {
         /// \name Constructors and initialization
         //@{
         /// Allocate empty array
-        IntArgs(void);
+        IntArgs();
         /// Allocate array with \a n elements
         explicit IntArgs(int n);
         /// Allocate array and copy elements from \a x
@@ -678,7 +674,7 @@ namespace Gecode {
         /// \name Constructors and initialization
         //@{
         /// Allocate empty array
-        IntVarArgs(void) = default;
+        IntVarArgs() = default;
         /// Allocate array with \a n elements
         explicit IntVarArgs(int n);
         /// Initialize from variable argument array \a a (copy elements)
@@ -736,7 +732,7 @@ namespace Gecode {
         /// \name Constructors and initialization
         //@{
         /// Allocate empty array
-        BoolVarArgs(void) = default;
+        BoolVarArgs() = default;
         /// Allocate array with \a n elements
         explicit BoolVarArgs(int n);
         /// Initialize from variable argument array \a a (copy elements)
@@ -789,7 +785,7 @@ namespace Gecode {
         /// \name Creation and initialization
         //@{
         /// Default constructor (array of size 0)
-        IntVarArray(void) = default;
+        IntVarArray() = default;
         /// Allocate array for \a n integer variables (variables are uninitialized)
         IntVarArray(Space& home, int n);
         /// Initialize from integer variable array \a a (share elements)
@@ -837,7 +833,7 @@ namespace Gecode {
         /// \name Creation and initialization
         //@{
         /// Default constructor (array of size 0)
-        BoolVarArray(void) = default;
+        BoolVarArray() = default;
         /// Allocate array for \a n Boolean variables (variables are uninitialized)
         BoolVarArray(Space& home, int n);
         /// Initialize from Boolean variable array \a a (share elements)
@@ -894,7 +890,7 @@ namespace Gecode {
      * class Model : public Space {
      * public:
      *   OpenIntVarList x;
-     *   Model(void) : x(*this,IntSet(0,2),3) {
+     *   Model() : x(*this,IntSet(0,2),3) {
      *     rel(*this,x.length(),IRT_GQ,1);
      *     distinct(*this,x);
      *     branch(*this,x);
@@ -902,7 +898,7 @@ namespace Gecode {
      *   Model(Model& s) : Space(s) {
      *     x.update(*this,s.x);
      *   }
-     *   virtual Space* copy(void) {
+     *   virtual Space* copy() {
      *     return new Model(*this);
      *   }
      * };
@@ -945,7 +941,7 @@ namespace Gecode {
          * materialization enters its own NoGPI scope. Scopes restore the previous
          * setting on exit, including exceptions.
          */
-        typedef std::function Factory;
+        using Factory = std::function;
         /**
          * \brief Function called after materializing position \a i
          *
@@ -955,9 +951,9 @@ namespace Gecode {
          * materialize() and direct append() call the transition after the new
          * position is available through indexed access.
          */
-        typedef std::function x, int i)> Transition;
+        using Transition = std::function x, int i)>;
         /// Construct an uninitialized list
-        OpenVarList(void) = default;
+        OpenVarList() = default;
         /// Construct a list using \a create for each position
         OpenVarList(Space& home, Factory create, int max = Int::Limits::max);
         /// Construct a list using \a create and transition function \a t
@@ -965,20 +961,20 @@ namespace Gecode {
         /// Update during cloning
         void update(Space& home, OpenVarList& s);
         /// Return the number of constructed positions (their values may be unassigned)
-        int known_length(void) const;
+        int known_length() const;
         /// Return variable at position \a i, where 0 <= \a i < known_length()
         Var operator[](int i) const;
         /// Return the eventual-length variable
-        IntVar length(void) const;
+        IntVar length() const;
         /**
-         * \brief Append variable \a x
+         * \brief Append variable \a y
          *
-         * Raises the minimum length to include \a x, then calls the transition
+         * Raises the minimum length to include \a y, then calls the transition
          * if supplied (see Transition). Exceeding the maximum length fails the
-         * space. Throws Int::ArgumentSame if \a x is an unassigned variable
+         * space. Throws Int::ArgumentSame if \a y is an unassigned variable
          * already in the list.
          */
-        void append(Space& home, Var x);
+        void append(Space& home, Var y);
         /**
          * \brief Materialize the first \a n variables
          *
@@ -1039,22 +1035,22 @@ namespace Gecode {
     template 
     class OpenViewList : public LocalHandle {
     private:
-        typedef typename View::VarType Var;
-        typedef typename OpenVarList::Object Object;
+        using Var = View::VarType;
+        using Object = OpenVarList::Object;
 
     public:
         /// Construct an uninitialized list
-        OpenViewList(void) = default;
+        OpenViewList() = default;
         /// Share the source of the model list \a list
         explicit OpenViewList(const OpenVarList& list);
         /// Update during cloning
         void update(Space& home, OpenViewList& s);
         /// Return the number of constructed positions
-        int known_length(void) const;
+        int known_length() const;
         /// Return the view at constructed position \a i
         View operator[](int i) const;
         /// Return the eventual-length view
-        Int::IntView length(void) const;
+        Int::IntView length() const;
         /// Require and construct at least the first \a n positions
         void materialize(Space& home, int n);
         /// Subscribe \a p to construction of positions
@@ -1077,10 +1073,10 @@ namespace Gecode {
          * Must be deterministic and safe for concurrent calls. Sharing and
          * captured data follow the Factory contract.
          */
-        typedef std::function Domain;
+        using Domain = std::function;
         using OpenVarList::OpenVarList;
         /// Construct an uninitialized list
-        GECODE_INT_EXPORT OpenIntVarList(void) = default;
+        GECODE_INT_EXPORT OpenIntVarList() = default;
         /// Share an integer list constructed through a variable factory
         OpenIntVarList(const OpenVarList& x);
         /// Construct a list with maximal length \a max and full domains
@@ -1112,7 +1108,7 @@ namespace Gecode {
     public:
         using OpenVarList::OpenVarList;
         /// Construct an uninitialized list
-        GECODE_INT_EXPORT OpenBoolVarList(void) = default;
+        GECODE_INT_EXPORT OpenBoolVarList() = default;
         /// Share a Boolean list constructed through a variable factory
         OpenBoolVarList(const OpenVarList& x);
         /// Construct a list with maximal length \a max and domains 0..1
@@ -1175,13 +1171,13 @@ namespace Gecode {
 
     public:
         /// Default constructor without proper initialization
-        Reify(void);
+        Reify();
         /// Construct reification specification
         Reify(BoolVar x, ReifyMode rm = RM_EQV);
         /// Return Boolean control variable
-        BoolVar var(void) const;
+        BoolVar var() const;
         /// Return reification mode
-        ReifyMode mode(void) const;
+        ReifyMode mode() const;
         /// Set Boolean control variable
         void var(BoolVar x);
         /// Set reification mode
@@ -1328,15 +1324,15 @@ namespace Gecode {
      *
      * \ingroup TaskModelInt
      */
-    typedef ArgArray TaskTypeArgs;
+    using TaskTypeArgs = ArgArray;
 
     /// Traits of %TaskTypeArgs
     template <>
     class ArrayTraits> {
     public:
-        typedef TaskTypeArgs StorageType;
-        typedef TaskType ValueType;
-        typedef TaskTypeArgs ArgsType;
+        using StorageType = TaskTypeArgs;
+        using ValueType = TaskType;
+        using ArgsType = TaskTypeArgs;
     };
 
     /**
@@ -1728,7 +1724,7 @@ namespace Gecode {
 
     //@{
     /// Arrays of integers that can be shared among several element constraints
-    typedef SharedArray IntSharedArray;
+    using IntSharedArray = SharedArray;
     /** \brief Post domain consistent propagator for \f$ n_{x_0}=x_1\f$
      *
      *  Throws an exception of type Int::OutOfLimits, if
@@ -2469,7 +2465,7 @@ namespace Gecode {
             int symbol;  ///< symbol
             int o_state; ///< output state
             /// Default constructor
-            Transition(void);
+            Transition();
             /// Initialize members
             Transition(int i_state0, int symbol0, int o_state0);
         };
@@ -2487,15 +2483,15 @@ namespace Gecode {
             /// Initialize to transitions of DFA \a d for symbol \a n
             Transitions(const DFA& d, int n);
             /// Test whether iterator still at a transition
-            bool operator()(void) const;
+            bool operator()() const;
             /// Move iterator to next transition
-            void operator++(void);
+            void operator++();
             /// Return in-state of current transition
-            int i_state(void) const;
+            int i_state() const;
             /// Return symbol of current transition
-            int symbol(void) const;
+            int symbol() const;
             /// Return out-state of current transition
-            int o_state(void) const;
+            int o_state() const;
         };
         /// Iterator for %DFA symbols
         class Symbols {
@@ -2509,11 +2505,11 @@ namespace Gecode {
             /// Initialize to symbols of DFA \a d
             Symbols(const DFA& d);
             /// Test whether iterator still at a symbol
-            bool operator()(void) const;
+            bool operator()() const;
             /// Move iterator to next symbol
-            void operator++(void);
+            void operator++();
             /// Return current symbol
-            int val(void) const;
+            int val() const;
         };
         /**
          * \brief Initialize DFA
@@ -2529,10 +2525,9 @@ namespace Gecode {
         GECODE_INT_EXPORT
         void init(int s, Transition t[], int f[], bool minimize = true);
 
-    public:
         friend class Transitions;
         /// Initialize for DFA accepting the empty word
-        DFA(void) = default;
+        DFA() = default;
         /**
          * \brief Initialize DFA
          *
@@ -2584,34 +2579,34 @@ namespace Gecode {
         GECODE_INT_EXPORT
         bool operator==(const DFA& d) const;
         /// Return the number of states
-        int n_states(void) const;
+        int n_states() const;
         /// Return the number of transitions
-        int n_transitions(void) const;
+        int n_transitions() const;
         /// Return the number of symbols
-        unsigned int n_symbols(void) const;
+        unsigned int n_symbols() const;
         /// Return maximal degree (in-degree and out-degree) of any state
-        unsigned int max_degree(void) const;
+        unsigned int max_degree() const;
         /// Return the number of the first final state
-        int final_fst(void) const;
+        int final_fst() const;
         /// Return the number of the last final state
-        int final_lst(void) const;
+        int final_lst() const;
         /// Return smallest symbol in DFA
-        int symbol_min(void) const;
+        int symbol_min() const;
         /// Return largest symbol in DFA
-        int symbol_max(void) const;
+        int symbol_max() const;
         /// Return hash key
-        std::size_t hash(void) const;
+        std::size_t hash() const;
     };
 
 } // namespace Gecode
 
 #include 
 
-namespace Gecode { namespace Int { namespace Extensional {
+namespace Gecode::Int::Extensional {
 
     class TupleSetAccess;
 
-}}} // namespace Gecode::Int::Extensional
+} // namespace Gecode::Int::Extensional
 
 namespace Gecode {
 
@@ -2658,9 +2653,9 @@ namespace Gecode {
          *
          * The arity of the tuple is left implicit.
          */
-        typedef int* Tuple;
+        using Tuple = int*;
         /// Import bit set data type
-        typedef Gecode::Support::BitSetData BitSetData;
+        using BitSetData = Gecode::Support::BitSetData;
         /// Compressed support data for one tuple-word block
         class CSupportWord {
         public:
@@ -2677,7 +2672,7 @@ namespace Gecode {
             /// Begin of supports
             BitSetData* s;
             /// Return the width
-            unsigned int width(void) const;
+            unsigned int width() const;
             /**
              * \brief Return the dense supports for value \a n
              *
@@ -2697,8 +2692,8 @@ namespace Gecode {
             Range* r;
             /// Base support id for each range (sparse and compressed only)
             unsigned int* base;
-            /// Find start range for value \a n
-            unsigned int start(int n) const;
+            /// Find start range for value \a k
+            unsigned int start(int k) const;
         };
         /**
          * \brief Data stored for a Table
@@ -2714,7 +2709,6 @@ namespace Gecode {
             enum class State { TS_BUILDING, TS_FAILED, TS_DENSE, TS_SPARSE, TS_DENSE_COMPRESSED };
             using enum State;
 
-        public:
             /// Arity
             int arity;
             /// Number of words for support
@@ -2757,13 +2751,13 @@ namespace Gecode {
             unsigned int compressed_n_entries;
 
             /// Return newly added tuple
-            Tuple add(void);
+            Tuple add();
             /// Return tuple with number \a i
             Tuple get(int i) const;
-            /// Set bit \a n in bitset data \a d
-            static void set(BitSetData* d, unsigned int n);
-            /// Get bit \a n in bitset data \a d
-            static bool get(const BitSetData* d, unsigned int n);
+            /// Set bit \a i in bitset data \a d
+            static void set(BitSetData* d, unsigned int i);
+            /// Get bit \a i in bitset data \a d
+            static bool get(const BitSetData* d, unsigned int i);
             /// Map tuple address to index
             unsigned int tuple_to_index(Tuple t) const;
             /// Return first range for position \a i
@@ -2772,15 +2766,15 @@ namespace Gecode {
             const Range* lst(int i) const;
             /// Finalize datastructure (disallows additions of more Tuples)
             GECODE_INT_EXPORT
-            void finalize(void);
+            void finalize();
             /// Finalize datastructure (disallows additions of more Tuples)
             GECODE_INT_EXPORT
             void finalize(ExtensionalPropKind epk);
             /// Resize tuple data
             GECODE_INT_EXPORT
-            void resize(void);
+            void resize();
             /// Release partially or fully constructed support data
-            void clear_support(void);
+            void clear_support();
             /// Select the state for an empty finalized tuple set
             State empty_state(ExtensionalPropKind epk) const;
             /// Select the finalized state for the computed table layout
@@ -2788,23 +2782,23 @@ namespace Gecode {
                                bool compressed_possible, bool support_bits_sparse,
                                unsigned long long dense_bytes) const;
             /// Is datastructure finalized
-            bool finalized(void) const;
+            bool finalized() const;
             /// Has finalization failed
-            bool failed(void) const;
+            bool failed() const;
             /// Is datastructure no longer mutable
-            bool terminal(void) const;
+            bool terminal() const;
 
             /// Initialize as empty tuple set with arity \a a
             Data(int a);
             /// Delete implementation
             GECODE_INT_EXPORT
-            ~Data(void) override;
+            ~Data() override;
         };
 
         /// Get data (must be initialized and finalized)
-        Data& data(void) const;
+        Data& data() const;
         /// Get raw data (must be initialized)
-        Data& raw(void) const;
+        Data& raw() const;
         /// Add tuple \a t to tuple set
         GECODE_INT_EXPORT
         void _add(const IntArgs& t);
@@ -2816,7 +2810,7 @@ namespace Gecode {
         /// \name Initialization
         //@{
         /// Construct an uninitialized tuple set
-        TupleSet(void) = default;
+        TupleSet() = default;
         /// Initialize for a tuple set with arity \a a
         GECODE_INT_EXPORT
         TupleSet(int a);
@@ -2836,7 +2830,7 @@ namespace Gecode {
         GECODE_INT_EXPORT
         TupleSet(int a, const DFA& dfa, ExtensionalPropKind epk);
         /// Test whether tuple set has been initialized
-        operator bool(void) const;
+        operator bool() const;
         /// Test whether tuple set is equal to \a t
         bool operator==(const TupleSet& t) const;
         /**
@@ -2855,16 +2849,16 @@ namespace Gecode {
         /// Add tuple \a t to tuple set
         TupleSet& add(const IntArgs& t);
         /// Is tuple set successfully finalized
-        bool finalized(void) const;
+        bool finalized() const;
         /**
          * \brief Has tuple-set finalization failed
          *
          * A failed tuple set is terminal: no tuples can be added and
          * finalization cannot be attempted again.
          */
-        bool failed(void) const;
+        bool failed() const;
         /// Finalize tuple set with dense support data
-        void finalize(void);
+        void finalize();
         /// Finalize tuple set with representation \a epk
         /**
          * Explicit representation selection materializes only the selected
@@ -2880,29 +2874,29 @@ namespace Gecode {
         /// \name Tuple access
         //@{
         /// Arity of tuple set
-        int arity(void) const;
+        int arity() const;
         /// Number of tuples
-        int tuples(void) const;
+        int tuples() const;
         /// Return number of required bit set words
-        unsigned int words(void) const;
+        unsigned int words() const;
         /// Get tuple \a i
         Tuple operator[](int i) const;
         /// Return minimal value in all tuples
-        int min(void) const;
+        int min() const;
         /// Return maximal value in all tuples
-        int max(void) const;
+        int max() const;
         /// Return hash key
-        std::size_t hash(void) const;
+        std::size_t hash() const;
         /// Return materialized tuple-set representation
-        ExtensionalPropKind representation(void) const;
+        ExtensionalPropKind representation() const;
 
     private:
         /// Return number of sparse support values
-        unsigned int sparse_values(void) const;
+        unsigned int sparse_values() const;
         /// Return tuple-value sparse ids (size tuples()*arity())
-        const unsigned int* sparse_tuple_value_ids(void) const;
+        const unsigned int* sparse_tuple_value_ids() const;
         /// Return sparse support offsets (size sparse_values()+1)
-        const unsigned int* sparse_support_offsets(void) const;
+        const unsigned int* sparse_support_offsets() const;
         /// Return support id for position/value, false if absent
         bool support_id(int p, int n, unsigned int& gid) const;
         /// Return sparse support tuple id range for position/value, false if absent
@@ -2937,25 +2931,25 @@ namespace Gecode {
             /// \name Iteration control
             //@{
             /// Test whether iterator is still at a range
-            bool operator()(void) const;
+            bool operator()() const;
             /// Move iterator to next range (if possible)
-            void operator++(void);
+            void operator++();
             //@}
 
             /// \name %Range access
             //@{
             /// Return smallest value of range
-            int min(void) const;
+            int min() const;
             /// Return largest value of range
-            int max(void) const;
+            int max() const;
             /// Return width of range (distance between minimum and maximum)
-            unsigned int width(void) const;
+            unsigned int width() const;
             //@}
         };
         //@}
     };
 
-    namespace Int { namespace Extensional {
+    namespace Int::Extensional {
 
         /// Internal access to finalized tuple-set support representations
         class TupleSetAccess {
@@ -2976,7 +2970,7 @@ namespace Gecode {
                                                  const TupleSet::CSupportWord*& e);
         };
 
-    }} // namespace Int::Extensional
+    } // namespace Int::Extensional
 
 } // namespace Gecode
 
@@ -3172,7 +3166,7 @@ namespace Gecode {
             const std::function function; ///< Computed distance
             Data(int n, const IntArgs& matrix);
             Data(int n, std::function function);
-            ~Data(void) override;
+            ~Data() override;
         };
 
     public:
@@ -3196,7 +3190,7 @@ namespace Gecode {
          */
         GECODE_INT_EXPORT IntDistance(int n, std::function function);
         /// Number of sites
-        int size(void) const;
+        int size() const;
         /// Distance between valid indices \a a and \a b
         int operator()(int a, int b) const;
     };
@@ -4867,7 +4861,7 @@ namespace Gecode {
      *
      * \ingroup TaskModelIntBranch
      */
-    typedef std::function IntBranchFilter;
+    using IntBranchFilter = std::function;
     /**
      * \brief Branch filter function type for Boolean variables
      *
@@ -4876,7 +4870,7 @@ namespace Gecode {
      *
      * \ingroup TaskModelIntBranch
      */
-    typedef std::function BoolBranchFilter;
+    using BoolBranchFilter = std::function;
 
     /**
      * \brief Branch merit function type for integer variables
@@ -4887,7 +4881,7 @@ namespace Gecode {
      *
      * \ingroup TaskModelIntBranch
      */
-    typedef std::function IntBranchMerit;
+    using IntBranchMerit = std::function;
     /**
      * \brief Branch merit function type for Boolean variables
      *
@@ -4897,7 +4891,7 @@ namespace Gecode {
      *
      * \ingroup TaskModelIntBranch
      */
-    typedef std::function BoolBranchMerit;
+    using BoolBranchMerit = std::function;
 
     /**
      * \brief Branch value function type for integer variables
@@ -4909,7 +4903,7 @@ namespace Gecode {
      *
      * \ingroup TaskModelIntBranch
      */
-    typedef std::function IntBranchVal;
+    using IntBranchVal = std::function;
     /**
      * \brief Branch value function type for Boolean variables
      *
@@ -4920,7 +4914,7 @@ namespace Gecode {
      *
      * \ingroup TaskModelIntBranch
      */
-    typedef std::function BoolBranchVal;
+    using BoolBranchVal = std::function;
 
     /**
      * \brief Branch commit function type for integer variables
@@ -4933,7 +4927,7 @@ namespace Gecode {
      *
      * \ingroup TaskModelIntBranch
      */
-    typedef std::function IntBranchCommit;
+    using IntBranchCommit = std::function;
     /**
      * \brief Branch commit function type for Boolean variables
      *
@@ -4945,7 +4939,7 @@ namespace Gecode {
      *
      * \ingroup TaskModelIntBranch
      */
-    typedef std::function BoolBranchCommit;
+    using BoolBranchCommit = std::function;
 
 } // namespace Gecode
 
@@ -4967,7 +4961,7 @@ namespace Gecode {
          * yet initialized AFC storage is init or the assignment operator.
          *
          */
-        IntAFC(void) = default;
+        IntAFC() = default;
         /**
          * \brief Initialize for integer variables \a x and decay factor \a d
          *
@@ -5003,7 +4997,7 @@ namespace Gecode {
          * yet initialized AFC storage is init or the assignment operator.
          *
          */
-        BoolAFC(void) = default;
+        BoolAFC() = default;
         /**
          * \brief Initialize for Boolean variables \a x and decay factor \a d
          *
@@ -5045,7 +5039,7 @@ namespace Gecode {
          * yet initialized action storage is init or the assignment operator.
          *
          */
-        IntAction(void) = default;
+        IntAction() = default;
         /// Copy constructor
         IntAction(const IntAction& a) = default;
         /// Assignment operator
@@ -5093,7 +5087,7 @@ namespace Gecode {
          * yet initialized action storage is init or the assignment operator.
          *
          */
-        BoolAction(void) = default;
+        BoolAction() = default;
         /// Copy constructor
         BoolAction(const BoolAction& a) = default;
         /// Assignment operator
@@ -5147,7 +5141,7 @@ namespace Gecode {
          * yet initialized CHB storage is init or the assignment operator.
          *
          */
-        IntCHB(void) = default;
+        IntCHB() = default;
         /// Copy constructor
         IntCHB(const IntCHB& chb) = default;
         /// Assignment operator
@@ -5190,7 +5184,7 @@ namespace Gecode {
          * yet initialized action storage is init or the assignment operator.
          *
          */
-        BoolCHB(void) = default;
+        BoolCHB() = default;
         /// Copy constructor
         BoolCHB(const BoolCHB& chb) = default;
         /// Assignment operator
@@ -5226,14 +5220,12 @@ namespace Gecode {
 namespace Gecode {
 
     /// Function type for printing branching alternatives for integer variables
-    typedef std::function
-        IntVarValPrint;
+    using IntVarValPrint = std::function;
 
     /// Function type for printing branching alternatives for Boolean variables
-    typedef std::function
-        BoolVarValPrint;
+    using BoolVarValPrint = std::function;
 
 } // namespace Gecode
 
@@ -5307,7 +5299,7 @@ namespace Gecode {
 
     public:
         /// Initialize with strategy SEL_NONE
-        IntVarBranch(void);
+        IntVarBranch();
         /// Initialize with random number generator \a r
         IntVarBranch(const Rnd& r);
         /// Initialize with selection strategy \a s and tie-break limit function \a t
@@ -5323,7 +5315,7 @@ namespace Gecode {
         /// Initialize with selection strategy \a s, branch merit function \a mf, and tie-break limit function \a t
         IntVarBranch(Select s, IntBranchMerit mf, BranchTbl t);
         /// Return selection strategy
-        Select select(void) const;
+        Select select() const;
         /// Expand AFC, action, and CHB
         void expand(Home home, const IntVarArgs& x);
     };
@@ -5358,7 +5350,7 @@ namespace Gecode {
 
     public:
         /// Initialize with strategy SEL_NONE
-        BoolVarBranch(void);
+        BoolVarBranch();
         /// Initialize with random number generator \a r
         BoolVarBranch(const Rnd& r);
         /// Initialize with selection strategy \a s and tie-break limit function \a t
@@ -5374,7 +5366,7 @@ namespace Gecode {
         /// Initialize with selection strategy \a s, branch merit function \a mf, and tie-break limit function \a t
         BoolVarBranch(Select s, BoolBranchMerit mf, BranchTbl t);
         /// Return selection strategy
-        Select select(void) const;
+        Select select() const;
         /// Expand decay factor into AFC or action
         void expand(Home home, const BoolVarArgs& x);
     };
@@ -5385,7 +5377,7 @@ namespace Gecode {
      */
     //@{
     /// Select first unassigned variable
-    IntVarBranch INT_VAR_NONE(void);
+    IntVarBranch INT_VAR_NONE();
     /// Select random variable (uniform distribution, for tie breaking)
     IntVarBranch INT_VAR_RND(const Rnd& r);
     /// Select variable with least merit according to branch merit function \a bm
@@ -5486,7 +5478,7 @@ namespace Gecode {
     IntVarBranch INT_VAR_REGRET_MAX_MAX(BranchTbl tbl = nullptr);
 
     /// Select first unassigned variable
-    BoolVarBranch BOOL_VAR_NONE(void);
+    BoolVarBranch BOOL_VAR_NONE();
     /// Select random variable (uniform distribution, for tie breaking)
     BoolVarBranch BOOL_VAR_RND(const Rnd& r);
     /// Select variable with least merit according to branch merit function \a bm
@@ -5564,7 +5556,7 @@ namespace Gecode {
         /// Initialize with value function \a f and commit function \a c
         IntValBranch(IntBranchVal v, IntBranchCommit c);
         /// Return selection strategy
-        Select select(void) const;
+        Select select() const;
     };
 
     /**
@@ -5595,7 +5587,7 @@ namespace Gecode {
         /// Initialize with value function \a f and commit function \a c
         BoolValBranch(BoolBranchVal v, BoolBranchCommit c);
         /// Return selection strategy
-        Select select(void) const;
+        Select select() const;
     };
 
     /**
@@ -5604,21 +5596,21 @@ namespace Gecode {
      */
     //@{
     /// Select smallest value
-    IntValBranch INT_VAL_MIN(void);
+    IntValBranch INT_VAL_MIN();
     /// Select greatest value not greater than the median
-    IntValBranch INT_VAL_MED(void);
+    IntValBranch INT_VAL_MED();
     /// Select largest value
-    IntValBranch INT_VAL_MAX(void);
+    IntValBranch INT_VAL_MAX();
     /// Select random value
     IntValBranch INT_VAL_RND(const Rnd& r);
     /// Select values not greater than mean of smallest and largest value
-    IntValBranch INT_VAL_SPLIT_MIN(void);
+    IntValBranch INT_VAL_SPLIT_MIN();
     /// Select values greater than mean of smallest and largest value
-    IntValBranch INT_VAL_SPLIT_MAX(void);
+    IntValBranch INT_VAL_SPLIT_MAX();
     /// Select the smallest range of the variable domain if it has several ranges, otherwise select values not greater than mean of smallest and largest value
-    IntValBranch INT_VAL_RANGE_MIN(void);
+    IntValBranch INT_VAL_RANGE_MIN();
     /// Select the largest range of the variable domain if it has several ranges, otherwise select values greater than mean of smallest and largest value
-    IntValBranch INT_VAL_RANGE_MAX(void);
+    IntValBranch INT_VAL_RANGE_MAX();
     /**
      * \brief Select value as defined by the value function \a v and commit function \a c
      * Uses a commit function as default that posts the constraints that
@@ -5627,14 +5619,14 @@ namespace Gecode {
      */
     IntValBranch INT_VAL(IntBranchVal v, IntBranchCommit c = nullptr);
     /// Try all values starting from smallest
-    IntValBranch INT_VALUES_MIN(void);
+    IntValBranch INT_VALUES_MIN();
     /// Try all values starting from largest
-    IntValBranch INT_VALUES_MAX(void);
+    IntValBranch INT_VALUES_MAX();
 
     /// Select smallest value
-    BoolValBranch BOOL_VAL_MIN(void);
+    BoolValBranch BOOL_VAL_MIN();
     /// Select largest value
-    BoolValBranch BOOL_VAL_MAX(void);
+    BoolValBranch BOOL_VAL_MAX();
     /// Select random value
     BoolValBranch BOOL_VAL_RND(const Rnd& r);
     /**
@@ -5681,7 +5673,7 @@ namespace Gecode {
         /// Initialize with value function \a f and commit function \a c
         IntAssign(IntBranchVal v, IntBranchCommit c);
         /// Return selection strategy
-        Select select(void) const;
+        Select select() const;
     };
 
     /**
@@ -5712,7 +5704,7 @@ namespace Gecode {
         /// Initialize with value function \a f and commit function \a c
         BoolAssign(BoolBranchVal v, BoolBranchCommit c);
         /// Return selection strategy
-        Select select(void) const;
+        Select select() const;
     };
 
     /**
@@ -5721,11 +5713,11 @@ namespace Gecode {
      */
     //@{
     /// Select smallest value
-    IntAssign INT_ASSIGN_MIN(void);
+    IntAssign INT_ASSIGN_MIN();
     /// Select greatest value not greater than the median
-    IntAssign INT_ASSIGN_MED(void);
+    IntAssign INT_ASSIGN_MED();
     /// Select largest value
-    IntAssign INT_ASSIGN_MAX(void);
+    IntAssign INT_ASSIGN_MAX();
     /// Select random value
     IntAssign INT_ASSIGN_RND(const Rnd& r);
     /**
@@ -5737,9 +5729,9 @@ namespace Gecode {
     IntAssign INT_ASSIGN(IntBranchVal v, IntBranchCommit c = nullptr);
 
     /// Select smallest value
-    BoolAssign BOOL_ASSIGN_MIN(void);
+    BoolAssign BOOL_ASSIGN_MIN();
     /// Select largest value
-    BoolAssign BOOL_ASSIGN_MAX(void);
+    BoolAssign BOOL_ASSIGN_MAX();
     /// Select random value
     BoolAssign BOOL_ASSIGN_RND(const Rnd& r);
     /**
@@ -5952,9 +5944,9 @@ namespace Gecode {
 // LDSB-related declarations.
 namespace Gecode {
 
-    namespace Int { namespace LDSB {
+    namespace Int::LDSB {
         class SymmetryObject;
-    }} // namespace Int::LDSB
+    } // namespace Int::LDSB
 
     /**
      * \brief A reference-counted pointer to a SymmetryObject
@@ -5966,30 +5958,29 @@ namespace Gecode {
         /// Symmetry object that this handle refers to.
         Int::LDSB::SymmetryObject* ref;
         /// Increment counter
-        void increment(void);
+        void increment();
         /// Decrement counter
-        void decrement(void);
+        void decrement();
 
-    public:
         /// Default constructor
-        SymmetryHandle(void);
+        SymmetryHandle();
         /// Initialies with a SymmetryObject
         SymmetryHandle(Int::LDSB::SymmetryObject* o);
         /// Copy constructor
         SymmetryHandle(const SymmetryHandle& h);
         /// Assignment operator
-        const SymmetryHandle& operator=(const SymmetryHandle& h);
+        SymmetryHandle& operator=(const SymmetryHandle& h);
         /// Destructor
-        ~SymmetryHandle(void);
+        ~SymmetryHandle();
     };
     class Symmetries;
     /// Traits of %Symmetries
     template <>
     class ArrayTraits> {
     public:
-        typedef Symmetries StorageType;
-        typedef SymmetryHandle ValueType;
-        typedef Symmetries ArgsType;
+        using StorageType = Symmetries;
+        using ValueType = SymmetryHandle;
+        using ArgsType = Symmetries;
     };
 
     /**
@@ -6244,19 +6235,19 @@ namespace Gecode {
         /// \name Iteration control
         //@{
         /// Test whether iterator is still at a range or done
-        bool operator()(void) const;
+        bool operator()() const;
         /// Move iterator to next range (if possible)
-        void operator++(void);
+        void operator++();
         //@}
 
         /// \name Range access
         //@{
         /// Return smallest value of range
-        int min(void) const;
+        int min() const;
         /// Return largest value of range
-        int max(void) const;
+        int max() const;
         /// Return width of range (distance between minimum and maximum)
-        unsigned int width(void) const;
+        unsigned int width() const;
         //@}
     };
 
@@ -6273,12 +6264,12 @@ namespace Gecode {
      * \brief Tracer for integer variables
      * \ingroup TaskIntTrace
      */
-    typedef ViewTracer IntTracer;
+    using IntTracer = ViewTracer;
     /**
      * \brief Trace recorder for integer variables
      * \ingroup TaskIntTrace
      */
-    typedef ViewTraceRecorder IntTraceRecorder;
+    using IntTraceRecorder = ViewTraceRecorder;
 
     /**
      * \brief Standard integer variable tracer
@@ -6311,12 +6302,12 @@ namespace Gecode {
      * \brief Tracer for Boolean variables
      * \ingroup TaskIntTrace
      */
-    typedef ViewTracer BoolTracer;
+    using BoolTracer = ViewTracer;
     /**
      * \brief Trace recorder for Boolean variables
      * \ingroup TaskIntTrace
      */
-    typedef ViewTraceRecorder BoolTraceRecorder;
+    using BoolTraceRecorder = ViewTraceRecorder;
 
     /**
      * \brief Standard Boolean variable tracer
diff --git a/gecode/int/arithmetic.hh b/gecode/int/arithmetic.hh
index 8e9cf226ef..d3b857a273 100644
--- a/gecode/int/arithmetic.hh
+++ b/gecode/int/arithmetic.hh
@@ -46,7 +46,7 @@
  * \brief Numerical (arithmetic) propagators
  */
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     /**
      * \brief Bounds consistent absolute value propagator
@@ -115,11 +115,11 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         static ExecStatus post(Home home, View x0, View x1);
     };
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     /**
      * \brief Bounds consistent ternary maximum propagator
@@ -245,11 +245,11 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         static ExecStatus post(Home home, ViewArray& x, View y);
     };
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     /**
      * \brief Argument maximum propagator
@@ -292,11 +292,11 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         static ExecStatus post(Home home, IdxViewArray& x, VB y);
     };
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     /**
      * \brief Operations for square and square-root propagators
@@ -307,9 +307,9 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     class SqrOps {
     public:
         /// Return whether exponent is even
-        bool even(void) const;
+        bool even() const;
         /// Return exponent
-        int exp(void) const;
+        int exp() const;
         /// Set exponent to \a m
         void exp(int m);
         /// Return \f$x^2\f$
@@ -344,9 +344,9 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         /// Initialize with exponent \a n
         PowOps(int n);
         /// Return whether exponent is even
-        bool even(void) const;
+        bool even() const;
         /// Return exponent
-        int exp(void) const;
+        int exp() const;
         /// Set exponent to \a m
         void exp(int m);
         /// Return \f$x^n\f$ where \f$n>0\f$
@@ -360,11 +360,11 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         int ceil_nth_root(int x) const;
     };
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     /**
      * \brief Bounds consistent positive power propagator
@@ -488,11 +488,11 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         static ExecStatus post(Home home, IntView x0, IntView x1, Ops ops);
     };
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     /**
      * \brief Positive bounds consistent n-th root propagator
@@ -618,11 +618,11 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         static ExecStatus post(Home home, IntView x0, IntView x1, Ops ops);
     };
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     /**
      * \brief Bounds or domain consistent propagator for \f$x_0\times x_1=x_0\f$
@@ -775,11 +775,11 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         ExecStatus propagate(Space& home, const ModEventDelta& med) override;
     };
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     /**
      * \brief Bounds propagator for \f$\gcd(x_0,x_1)=x_2\f$
@@ -795,7 +795,7 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         /// Constructor for cloning \a p
         Gcd(Space& home, Gcd& p);
         /// Constructor for posting
-        Gcd(Home home, IntView x0, IntView x1, IntView x2);
+        Gcd(Home home, IntView y0, IntView y1, IntView y2);
 
     public:
         /// Post propagator
@@ -823,7 +823,7 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         /// Reification control
         BoolView b;
         /// Constructor for posting
-        ReGcd(Home home, IntView x0, IntView x1, IntView x2, BoolView b);
+        ReGcd(Home home, IntView y0, IntView y1, IntView y2, BoolView b);
         /// Constructor for cloning \a p
         ReGcd(Space& home, ReGcd& p);
 
@@ -842,11 +842,11 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         size_t dispose(Space& home) override;
     };
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     /**
      * \brief Reified bounds propagator for divisibility
@@ -862,7 +862,7 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         using ReBinaryPropagator::x1;
         using ReBinaryPropagator::b;
         /// Constructor for posting
-        ReDivides(Home home, IntView x0, IntView x1, BoolView b);
+        ReDivides(Home home, IntView y0, IntView y1, BoolView b);
         /// Constructor for cloning \a p
         ReDivides(Space& home, ReDivides& p);
 
@@ -879,11 +879,11 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         size_t dispose(Space& home) override;
     };
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     /** \brief Bounds propagator for an exact n-ary product
      *
@@ -897,7 +897,7 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         /// Whether the remaining product is negated
         bool neg;
         /// Constructor for posting
-        Product(Home home, ViewArray& x, IntView y, bool neg);
+        Product(Home home, ViewArray& z, IntView w, bool neg);
         /// Constructor for cloning \a p
         Product(Space& home, Product& p);
 
@@ -929,7 +929,7 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         /// Reification control
         BoolView b;
         /// Constructor for posting
-        ReProduct(Home home, ViewArray& x, IntView y, BoolView b);
+        ReProduct(Home home, ViewArray& z, IntView w, BoolView c);
         /// Constructor for cloning \a p
         ReProduct(Space& home, ReProduct& p);
 
@@ -948,11 +948,11 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         size_t dispose(Space& home) override;
     };
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     /** \brief Bounds propagator for a fixed-modulus n-ary product
      *
@@ -970,7 +970,7 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         /// Exact product of removed factors, or zero when not representable
         int a;
         /// Constructor for posting
-        ProductMod(Home home, ViewArray& x, int m, IntView y, int c, int a);
+        ProductMod(Home home, ViewArray& z, int m, IntView w, int c, int a);
         /// Constructor for cloning \a p
         ProductMod(Space& home, ProductMod& p);
 
@@ -1001,7 +1001,7 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         /// Canonical residue
         IntView y;
         /// Constructor for posting
-        ProductModVar(Home home, ViewArray& x, IntView m, IntView y);
+        ProductModVar(Home home, ViewArray& z, IntView m, IntView w);
         /// Constructor for cloning \a p
         ProductModVar(Space& home, ProductModVar& p);
 
@@ -1037,7 +1037,7 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         /// Reification control
         BoolView b;
         /// Constructor for posting
-        ReProductModVar(Home home, ViewArray& x, IntView m, IntView y, BoolView b);
+        ReProductModVar(Home home, ViewArray& z, IntView m, IntView w, BoolView c);
         /// Constructor for cloning \a p
         ReProductModVar(Space& home, ReProductModVar& p);
 
@@ -1073,7 +1073,7 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         /// Positive modulus
         int m;
         /// Constructor for posting
-        ReProductMod(Home home, ViewArray& x, int m, IntView y, BoolView b);
+        ReProductMod(Home home, ViewArray& z, int m, IntView w, BoolView c);
         /// Constructor for cloning \a p
         ReProductMod(Space& home, ReProductMod& p);
 
@@ -1092,11 +1092,11 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         size_t dispose(Space& home) override;
     };
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     /**
      * \brief Bounds consistent positive division propagator
@@ -1182,7 +1182,7 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         ExecStatus propagate(Space& home, const ModEventDelta& med) override;
     };
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 #include 
 
diff --git a/gecode/int/arithmetic/abs.hpp b/gecode/int/arithmetic/abs.hpp
index 614eed8e87..a2e1d9f398 100644
--- a/gecode/int/arithmetic/abs.hpp
+++ b/gecode/int/arithmetic/abs.hpp
@@ -34,7 +34,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     template  class Eq>
     ExecStatus
@@ -48,18 +48,19 @@ namespace Gecode { namespace Int { namespace Arithmetic {
             if (x0.min() >= 0) {
                 GECODE_ME_CHECK(x0.eq(home, x1.val()));
                 return home.ES_SUBSUMED(p);
-            } else if (x0.max() <= 0) {
+            }
+            if (x0.max() <= 0) {
                 GECODE_ME_CHECK(x0.eq(home, -x1.val()));
                 return home.ES_SUBSUMED(p);
-            } else if (x1.val() == 0) {
+            }
+            if (x1.val() == 0) {
                 GECODE_ME_CHECK(x0.eq(home, 0));
                 return home.ES_SUBSUMED(p);
-            } else {
-                int mp[2] = {-x1.val(), x1.val()};
-                Iter::Values::Array i(mp, 2);
-                GECODE_ME_CHECK(x0.inter_v(home, i, false));
-                return home.ES_SUBSUMED(p);
             }
+            int mp[2] = {-x1.val(), x1.val()};
+            Iter::Values::Array i(mp, 2);
+            GECODE_ME_CHECK(x0.inter_v(home, i, false));
+            return home.ES_SUBSUMED(p);
         }
 
         if (x0.min() >= 0)
@@ -91,20 +92,21 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     AbsBnd::post(Home home, View x0, View x1) {
         if (x0.min() >= 0) {
             return Rel::EqBnd::post(home, x0, x1);
-        } else if (x0.max() <= 0) {
+        }
+        if (x0.max() <= 0) {
             return Rel::EqBnd::post(home, MinusView(x0), x1);
-        } else {
-            assert(!x0.assigned());
-            GECODE_ME_CHECK(x1.gq(home, 0));
-            if (x1.assigned()) {
-                int mp[2] = {-x1.val(), x1.val()};
-                Iter::Values::Array i(mp, 2);
-                GECODE_ME_CHECK(x0.inter_v(home, i, false));
-            } else if (x0 != x1) {
-                GECODE_ME_CHECK(x1.lq(home, std::max(-x0.min(), x0.max())));
-                (void)new (home) AbsBnd(home, x0, x1);
-            }
         }
+        assert(!x0.assigned());
+        GECODE_ME_CHECK(x1.gq(home, 0));
+        if (x1.assigned()) {
+            int mp[2] = {-x1.val(), x1.val()};
+            Iter::Values::Array i(mp, 2);
+            GECODE_ME_CHECK(x0.inter_v(home, i, false));
+        } else if (x0 != x1) {
+            GECODE_ME_CHECK(x1.lq(home, std::max(-x0.min(), x0.max())));
+            (void)new (home) AbsBnd(home, x0, x1);
+        }
+
         return ES_OK;
     }
 
@@ -124,8 +126,7 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     AbsBnd::cost(const Space&, const ModEventDelta& med) const {
         if (View::me(med) == ME_INT_VAL)
             return PropCost::unary(PropCost::LO);
-        else
-            return PropCost::binary(PropCost::LO);
+        return PropCost::binary(PropCost::LO);
     }
 
     template 
@@ -144,20 +145,21 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     AbsDom::post(Home home, View x0, View x1) {
         if (x0.min() >= 0) {
             return Rel::EqDom::post(home, x0, x1);
-        } else if (x0.max() <= 0) {
+        }
+        if (x0.max() <= 0) {
             return Rel::EqDom::post(home, MinusView(x0), x1);
-        } else {
-            assert(!x0.assigned());
-            GECODE_ME_CHECK(x1.gq(home, 0));
-            if (x1.assigned()) {
-                int mp[2] = {-x1.val(), x1.val()};
-                Iter::Values::Array i(mp, 2);
-                GECODE_ME_CHECK(x0.inter_v(home, i, false));
-            } else if (x0 != x1) {
-                GECODE_ME_CHECK(x1.lq(home, std::max(-x0.min(), x0.max())));
-                (void)new (home) AbsDom(home, x0, x1);
-            }
         }
+        assert(!x0.assigned());
+        GECODE_ME_CHECK(x1.gq(home, 0));
+        if (x1.assigned()) {
+            int mp[2] = {-x1.val(), x1.val()};
+            Iter::Values::Array i(mp, 2);
+            GECODE_ME_CHECK(x0.inter_v(home, i, false));
+        } else if (x0 != x1) {
+            GECODE_ME_CHECK(x1.lq(home, std::max(-x0.min(), x0.max())));
+            (void)new (home) AbsDom(home, x0, x1);
+        }
+
         return ES_OK;
     }
 
@@ -177,8 +179,7 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     AbsDom::cost(const Space&, const ModEventDelta& med) const {
         if (View::me(med) == ME_INT_VAL)
             return PropCost::unary(PropCost::LO);
-        else
-            return PropCost::binary((View::me(med) == ME_INT_DOM) ? PropCost::HI : PropCost::LO);
+        return PropCost::binary((View::me(med) == ME_INT_DOM) ? PropCost::HI : PropCost::LO);
     }
 
     template 
@@ -230,6 +231,6 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         return ES_FIX;
     }
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 // STATISTICS: int-prop
diff --git a/gecode/int/arithmetic/argmax.hpp b/gecode/int/arithmetic/argmax.hpp
index 5fb0720354..13647d520e 100644
--- a/gecode/int/arithmetic/argmax.hpp
+++ b/gecode/int/arithmetic/argmax.hpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     template 
     forceinline
@@ -256,6 +256,6 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         return sizeof(*this);
     }
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 // STATISTICS: int-prop
diff --git a/gecode/int/arithmetic/divides.hpp b/gecode/int/arithmetic/divides.hpp
index fd88b2ef38..f701bd9e25 100644
--- a/gecode/int/arithmetic/divides.hpp
+++ b/gecode/int/arithmetic/divides.hpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     forceinline bool
     divides_value(int divisor, int dividend) {
@@ -202,6 +202,6 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         return sizeof(*this);
     }
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 // STATISTICS: int-prop
diff --git a/gecode/int/arithmetic/divmod.hpp b/gecode/int/arithmetic/divmod.hpp
index d700b9eb33..bc3316327a 100644
--- a/gecode/int/arithmetic/divmod.hpp
+++ b/gecode/int/arithmetic/divmod.hpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     /*
      * Positive bounds consistent division
@@ -321,7 +321,7 @@ namespace Gecode { namespace Int { namespace Arithmetic {
             }
 
             // abs(x2) is less than abs(x1)
-            int x1max = std::max(x1.max(), std::max(-x1.max(), std::max(x1.min(), -x1.min())));
+            int x1max = std::max({x1.max(), -x1.max(), x1.min(), -x1.min()});
             GECODE_ME_CHECK(x2.le(home, x1max));
             GECODE_ME_CHECK(x2.gr(home, -x1max));
 
@@ -331,7 +331,7 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         } while (!sign_is_same && (x0.min() > 0 || x0.max() < 0 || x2.min() > 0 || x2.max() < 0));
 
         if (sign_is_same) {
-            int x2max = std::max(x2.max(), std::max(-x2.max(), std::max(x2.min(), -x2.min())));
+            int x2max = std::max({x2.max(), -x2.max(), x2.min(), -x2.min()});
             int x1absmin = any(x1) ? 0 : (pos(x1) ? x1.min() : -x1.max());
             if (x2max < x1absmin)
                 return home.ES_SUBSUMED(*this);
@@ -339,6 +339,6 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         return ES_FIX;
     }
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 // STATISTICS: int-prop
diff --git a/gecode/int/arithmetic/gcd.hpp b/gecode/int/arithmetic/gcd.hpp
index cbadce559c..b4ae1168ad 100644
--- a/gecode/int/arithmetic/gcd.hpp
+++ b/gecode/int/arithmetic/gcd.hpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     forceinline int
     gcd_value(int a, int b) {
@@ -417,6 +417,6 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         return sizeof(*this);
     }
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 // STATISTICS: int-prop
diff --git a/gecode/int/arithmetic/max.hpp b/gecode/int/arithmetic/max.hpp
index e1a480e11d..bf86fb40e1 100644
--- a/gecode/int/arithmetic/max.hpp
+++ b/gecode/int/arithmetic/max.hpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     /*
      * Ternary bounds consistent maximum
@@ -204,8 +204,9 @@ namespace Gecode { namespace Int { namespace Arithmetic {
             if (x[i].max() < maxmin) {
                 x.move_lst(i, home, p, pc);
                 status |= MPS_REMOVED;
-            } else if (!x[i].assigned())
+            } else if (!x[i].assigned()) {
                 status &= ~MPS_ASSIGNED;
+            }
         }
         if (x.size() == 0)
             return ES_FAILED;
@@ -357,8 +358,7 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     NaryMaxDom::cost(const Space&, const ModEventDelta& med) const {
         if (View::me(med) == ME_INT_DOM)
             return PropCost::linear(PropCost::HI, y.size());
-        else
-            return PropCost::linear(PropCost::LO, x.size());
+        return PropCost::linear(PropCost::LO, x.size());
     }
 
     template 
@@ -389,6 +389,6 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         return ES_FIX;
     }
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 // STATISTICS: int-prop
diff --git a/gecode/int/arithmetic/mult.cpp b/gecode/int/arithmetic/mult.cpp
index 58f5b5b3a1..e74f2a60a3 100644
--- a/gecode/int/arithmetic/mult.cpp
+++ b/gecode/int/arithmetic/mult.cpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     /*
      * Bounds consistent multiplication
@@ -184,8 +184,8 @@ namespace Gecode { namespace Int { namespace Arithmetic {
             long long int b = mll(x0.min(), x1.max());
             long long int c = mll(x0.max(), x1.min());
             long long int d = mll(x0.max(), x1.max());
-            GECODE_ME_CHECK(x2.gq(home, std::min(std::min(a, b), std::min(c, d))));
-            GECODE_ME_CHECK(x2.lq(home, std::max(std::max(a, b), std::max(c, d))));
+            GECODE_ME_CHECK(x2.gq(home, std::min({a, b, c, d})));
+            GECODE_ME_CHECK(x2.lq(home, std::max({a, b, c, d})));
             (void)new (home) MultBnd(home, x0, x1, x2);
         }
         return ES_OK;
@@ -213,8 +213,7 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     MultDom::cost(const Space&, const ModEventDelta& med) const {
         if (IntView::me(med) == ME_INT_DOM)
             return PropCost::ternary(PropCost::HI);
-        else
-            return PropCost::ternary(PropCost::LO);
+        return PropCost::ternary(PropCost::LO);
     }
 
     ExecStatus
@@ -361,8 +360,8 @@ namespace Gecode { namespace Int { namespace Arithmetic {
             long long int b = mll(x0.min(), x1.max());
             long long int c = mll(x0.max(), x1.min());
             long long int d = mll(x0.max(), x1.max());
-            GECODE_ME_CHECK(x2.gq(home, std::min(std::min(a, b), std::min(c, d))));
-            GECODE_ME_CHECK(x2.lq(home, std::max(std::max(a, b), std::max(c, d))));
+            GECODE_ME_CHECK(x2.gq(home, std::min({a, b, c, d})));
+            GECODE_ME_CHECK(x2.lq(home, std::max({a, b, c, d})));
             (void)new (home) MultDom(home, x0, x1, x2);
         }
         return ES_OK;
@@ -377,6 +376,6 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         return MultPlusDom::post(home, MinusView(x0), x1, MinusView(x2));
     }
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 // STATISTICS: int-prop
diff --git a/gecode/int/arithmetic/mult.hpp b/gecode/int/arithmetic/mult.hpp
index eb1a331572..121caab9b3 100644
--- a/gecode/int/arithmetic/mult.hpp
+++ b/gecode/int/arithmetic/mult.hpp
@@ -36,7 +36,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     /*
      * Arithmetic help functions
@@ -97,9 +97,8 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     MultZeroOne::equal(View x, int n) {
         if (pc == PC_INT_DOM) {
             return rtest_eq_dom(x, n);
-        } else {
-            return rtest_eq_bnd(x, n);
         }
+        return rtest_eq_bnd(x, n);
     }
 
     template 
@@ -313,8 +312,7 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     MultPlusDom::cost(const Space&, const ModEventDelta& med) const {
         if (VA::me(med) == ME_INT_DOM)
             return PropCost::ternary(PropCost::HI);
-        else
-            return PropCost::ternary(PropCost::LO);
+        return PropCost::ternary(PropCost::LO);
     }
 
     template 
@@ -351,6 +349,6 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     MultDom::MultDom(Space& home, MultDom& p)
         : TernaryPropagator(home, p) {}
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 // STATISTICS: int-prop
diff --git a/gecode/int/arithmetic/nroot.hpp b/gecode/int/arithmetic/nroot.hpp
index 383e88b88d..261a72902f 100644
--- a/gecode/int/arithmetic/nroot.hpp
+++ b/gecode/int/arithmetic/nroot.hpp
@@ -35,7 +35,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     /*
      * Positive bounds consistent nth root
@@ -182,7 +182,8 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         if (ops.exp() == 0) {
             GECODE_ME_CHECK(x1.eq(home, 1));
             return ES_OK;
-        } else if (ops.exp() == 1) {
+        }
+        if (ops.exp() == 1) {
             return Rel::EqBnd::post(home, x0, x1);
         }
 
@@ -329,10 +330,9 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     NrootPlusDom::cost(const Space&, const ModEventDelta& med) const {
         if (IntView::me(med) == ME_INT_VAL)
             return PropCost::unary(PropCost::LO);
-        else if (IntView::me(med) == ME_INT_DOM)
+        if (IntView::me(med) == ME_INT_DOM)
             return PropCost::binary(PropCost::HI);
-        else
-            return PropCost::binary(PropCost::LO);
+        return PropCost::binary(PropCost::LO);
     }
 
     template 
@@ -379,7 +379,8 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         if (ops.exp() == 0) {
             GECODE_ME_CHECK(x1.eq(home, 1));
             return ES_OK;
-        } else if (ops.exp() == 1) {
+        }
+        if (ops.exp() == 1) {
             return Rel::EqDom::post(home, x0, x1);
         }
 
@@ -428,10 +429,9 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     NrootDom::cost(const Space&, const ModEventDelta& med) const {
         if (IntView::me(med) == ME_INT_VAL)
             return PropCost::unary(PropCost::LO);
-        else if (IntView::me(med) == ME_INT_DOM)
+        if (IntView::me(med) == ME_INT_DOM)
             return PropCost::binary(PropCost::HI);
-        else
-            return PropCost::binary(PropCost::LO);
+        return PropCost::binary(PropCost::LO);
     }
 
     template 
@@ -467,6 +467,6 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         return x0.assigned() && x1.assigned() ? home.ES_SUBSUMED(*this) : ES_FIX;
     }
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 // STATISTICS: int-prop
diff --git a/gecode/int/arithmetic/open.hpp b/gecode/int/arithmetic/open.hpp
index 65cf29ff7a..4dfe2d19ec 100644
--- a/gecode/int/arithmetic/open.hpp
+++ b/gecode/int/arithmetic/open.hpp
@@ -36,7 +36,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     /// Track maxima; negated views implement min(x) = -max(-x)
     template 
@@ -169,7 +169,7 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         }
     };
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 #endif
 
diff --git a/gecode/int/arithmetic/pow-ops.hpp b/gecode/int/arithmetic/pow-ops.hpp
index 15a156f1eb..2a2a72a5b2 100644
--- a/gecode/int/arithmetic/pow-ops.hpp
+++ b/gecode/int/arithmetic/pow-ops.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     forceinline
     PowOps::PowOps(int n0)
@@ -42,12 +42,12 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     }
 
     forceinline bool
-    PowOps::even(void) const {
+    PowOps::even() const {
         return even(n);
     }
 
     forceinline int
-    PowOps::exp(void) const {
+    PowOps::exp() const {
         return n;
     }
 
@@ -181,12 +181,12 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     }
 
     forceinline bool
-    SqrOps::even(void) const {
+    SqrOps::even() const {
         return true;
     }
 
     forceinline int
-    SqrOps::exp(void) const {
+    SqrOps::exp() const {
         return 2;
     }
 
@@ -251,6 +251,6 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         return static_cast(u);
     }
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 // STATISTICS: int-other
diff --git a/gecode/int/arithmetic/pow.hpp b/gecode/int/arithmetic/pow.hpp
index dc42210376..b19bc99f01 100644
--- a/gecode/int/arithmetic/pow.hpp
+++ b/gecode/int/arithmetic/pow.hpp
@@ -35,7 +35,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     /*
      * Positive bounds consistent power
@@ -155,7 +155,8 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         if (ops.exp() == 0) {
             GECODE_ME_CHECK(x1.eq(home, 1));
             return ES_OK;
-        } else if (ops.exp() == 1) {
+        }
+        if (ops.exp() == 1) {
             return Rel::EqBnd::post(home, x0, x1);
         }
 
@@ -291,8 +292,7 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         val(int x) const {
             if (x < 0)
                 return -ops.floor_nth_root(-x);
-            else
-                return ops.floor_nth_root(x);
+            return ops.floor_nth_root(x);
         }
     };
 
@@ -334,10 +334,9 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     PowPlusDom::cost(const Space&, const ModEventDelta& med) const {
         if (VA::me(med) == ME_INT_VAL)
             return PropCost::unary(PropCost::LO);
-        else if (VA::me(med) == ME_INT_DOM)
+        if (VA::me(med) == ME_INT_DOM)
             return PropCost::binary(PropCost::HI);
-        else
-            return PropCost::binary(PropCost::LO);
+        return PropCost::binary(PropCost::LO);
     }
 
     template 
@@ -389,7 +388,8 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         if (ops.exp() == 0) {
             GECODE_ME_CHECK(x1.eq(home, 1));
             return ES_OK;
-        } else if (ops.exp() == 1) {
+        }
+        if (ops.exp() == 1) {
             return Rel::EqDom::post(home, x0, x1);
         }
 
@@ -449,10 +449,9 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     PowDom::cost(const Space&, const ModEventDelta& med) const {
         if (IntView::me(med) == ME_INT_VAL)
             return PropCost::unary(PropCost::LO);
-        else if (IntView::me(med) == ME_INT_DOM)
+        if (IntView::me(med) == ME_INT_DOM)
             return PropCost::binary(PropCost::HI);
-        else
-            return PropCost::binary(PropCost::LO);
+        return PropCost::binary(PropCost::LO);
     }
 
     template 
@@ -515,6 +514,6 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         return x0.assigned() ? home.ES_SUBSUMED(*this) : ES_FIX;
     }
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 // STATISTICS: int-prop
diff --git a/gecode/int/arithmetic/product-mod.hpp b/gecode/int/arithmetic/product-mod.hpp
index 35e02fa735..a3f4c74493 100644
--- a/gecode/int/arithmetic/product-mod.hpp
+++ b/gecode/int/arithmetic/product-mod.hpp
@@ -30,8 +30,9 @@
  */
 
 #include 
+#include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     /// Multiply intervals exactly; saturation would make modular deductions unsound.
     inline bool
@@ -52,8 +53,8 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     product_mod_interval(const ViewArray& x, ProductInterval& p, int a = 1) {
         p.min = a;
         p.max = a;
-        for (int i = 0; i < x.size(); i++) {
-            ProductInterval q = {x[i].min(), x[i].max()};
+        for (auto xi : x) {
+            ProductInterval q = {xi.min(), xi.max()};
             if (!product_mod_interval_mul(p, q, p))
                 return false;
         }
@@ -83,11 +84,11 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     product_mod_coefficient(const ViewArray& x, int m, int& free_count) {
         long long int p = 1 % m;
         free_count = 0;
-        for (int i = 0; i < x.size(); i++) {
-            if (!x[i].assigned()) {
+        for (auto xi : x) {
+            if (!xi.assigned()) {
                 free_count++;
             } else {
-                long long int q = static_cast(x[i].val()) % m;
+                long long int q = static_cast(xi.val()) % m;
                 if (q < 0)
                     q += m;
                 p = (p * q) % m;
@@ -123,12 +124,12 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     /// A nonzero residue excludes bounds-visible zero factors.
     inline ExecStatus
     product_mod_nonzero(Space& home, ViewArray& x, bool& modified) {
-        for (int i = 0; i < x.size(); i++) {
+        for (auto& xi : x) {
             ModEvent me = ME_INT_NONE;
-            if (x[i].min() == 0)
-                me = x[i].gq(home, 1);
-            else if (x[i].max() == 0)
-                me = x[i].lq(home, -1);
+            if (xi.min() == 0)
+                me = xi.gq(home, 1);
+            else if (xi.max() == 0)
+                me = xi.lq(home, -1);
             if (me_failed(me))
                 return ES_FAILED;
             modified |= me_modified(me);
@@ -358,8 +359,8 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     /// Whether the modulus occurs among the factors.
     inline bool
     product_mod_var_mod_factor(const ViewArray& x, const IntView& m) {
-        for (int i = 0; i < x.size(); i++)
-            if (x[i] == m)
+        for (auto xi : x)
+            if (xi == m)
                 return true;
         return false;
     }
@@ -368,10 +369,10 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     inline bool
     product_mod_var_exact(const ViewArray& x, long long int& p) {
         long long int q = 1;
-        for (int i = 0; i < x.size(); i++) {
-            if (!x[i].assigned())
+        for (auto xi : x) {
+            if (!xi.assigned())
                 return false;
-            const long long int v = x[i].val();
+            const long long int v = xi.val();
             if (Limits::overflow_mul(q, v))
                 return false;
             q *= v;
@@ -405,8 +406,7 @@ namespace Gecode { namespace Int { namespace Arithmetic {
             if ((q0 == 0) || ((ad % q0) != 0))
                 return false;
             const unsigned long long int candidate = ad / q0;
-            if ((candidate < static_cast(least)) ||
-                (candidate > static_cast(greatest)) ||
+            if (std::cmp_less(candidate, least) || std::cmp_greater(candidate, greatest) ||
                 (candidate > static_cast(Limits::max)))
                 return false;
             least = greatest = static_cast(candidate);
@@ -425,8 +425,8 @@ namespace Gecode { namespace Int { namespace Arithmetic {
             modified = false;
             if (y.min() > 0)
                 GECODE_ES_CHECK(product_mod_nonzero(home, x, modified));
-            for (int i = 0; i < x.size(); i++)
-                if (x[i].min() < 0)
+            for (auto xi : x)
+                if (xi.min() < 0)
                     return ES_OK;
             ProductInterval p;
             if (!product_mod_interval(x, p))
@@ -625,8 +625,8 @@ namespace Gecode { namespace Int { namespace Arithmetic {
             GECODE_ME_CHECK(y.eq(home, 0));
             return home.ES_SUBSUMED(*this);
         }
-        for (int i = 0; i < x.size(); i++)
-            if (x[i].assigned() && (x[i].val() == 0)) {
+        for (auto& xi : x)
+            if (xi.assigned() && (xi.val() == 0)) {
                 GECODE_ME_CHECK(y.eq(home, 0));
                 return home.ES_SUBSUMED(*this);
             }
@@ -909,6 +909,6 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         return sizeof(*this);
     }
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 // STATISTICS: int-prop
diff --git a/gecode/int/arithmetic/product.hpp b/gecode/int/arithmetic/product.hpp
index 5ef15b9dde..d173875351 100644
--- a/gecode/int/arithmetic/product.hpp
+++ b/gecode/int/arithmetic/product.hpp
@@ -31,7 +31,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Arithmetic {
+namespace Gecode::Int::Arithmetic {
 
     /// A representable, conservative interval for an exact product.
     struct ProductInterval {
@@ -233,8 +233,8 @@ namespace Gecode { namespace Int { namespace Arithmetic {
     product_status(const ViewArray& x, const IntView& y) {
         if ((x.size() == 1) && (x[0] == y))
             return RT_TRUE;
-        for (int i = 0; i < x.size(); i++)
-            if (x[i].assigned() && (x[i].val() == 0)) {
+        for (auto xi : x)
+            if (xi.assigned() && (xi.val() == 0)) {
                 if (!y.in(0))
                     return RT_FALSE;
                 return y.assigned() ? RT_TRUE : RT_MAYBE;
@@ -322,18 +322,18 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         // Preserve adjacent equal views while removing assigned units in place.
         int n = 0;
         bool zero = false;
-        for (int i = 0; i < x.size(); i++) {
-            if (x[i].assigned()) {
-                if (x[i].val() == 0) {
+        for (auto& xi : x) {
+            if (xi.assigned()) {
+                if (xi.val() == 0) {
                     zero = true;
                     continue;
                 }
-                if ((x[i].val() == 1) || (x[i].val() == -1)) {
-                    neg ^= x[i].val() == -1;
+                if ((xi.val() == 1) || (xi.val() == -1)) {
+                    neg ^= xi.val() == -1;
                     continue;
                 }
             }
-            x[n++] = x[i];
+            x[n++] = xi;
         }
         if (n < x.size()) {
             x.size(n);
@@ -376,11 +376,11 @@ namespace Gecode { namespace Int { namespace Arithmetic {
 
         // A nonzero result excludes a bounds-visible zero endpoint.
         if (!y.in(0))
-            for (int i = 0; i < x.size(); i++) {
-                if ((x[i].min() == 0) && (x[i].max() > 0))
-                    GECODE_ME_CHECK(x[i].gq(home, 1));
-                else if ((x[i].max() == 0) && (x[i].min() < 0))
-                    GECODE_ME_CHECK(x[i].lq(home, -1));
+            for (auto& xi : x) {
+                if ((xi.min() == 0) && (xi.max() > 0))
+                    GECODE_ME_CHECK(xi.gq(home, 1));
+                else if ((xi.max() == 0) && (xi.min() < 0))
+                    GECODE_ME_CHECK(xi.lq(home, -1));
             }
 
         // Zero can only arise from a zero factor.
@@ -406,12 +406,12 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         bool stable = true;
         bool strict = true;
         bool negative = neg;
-        for (int i = 0; i < x.size(); i++) {
-            if (x[i].max() <= 0) {
+        for (auto xi : x) {
+            if (xi.max() <= 0) {
                 negative = !negative;
-                strict &= x[i].max() < 0;
-            } else if (x[i].min() >= 0) {
-                strict &= x[i].min() > 0;
+                strict &= xi.max() < 0;
+            } else if (xi.min() >= 0) {
+                strict &= xi.min() > 0;
             } else {
                 stable = false;
                 strict = false;
@@ -498,12 +498,12 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         // Result propagation above can have excluded zero during this call.
         bool endpoint_modified = false;
         if (!y.in(0))
-            for (int i = 0; i < x.size(); i++) {
+            for (auto& xi : x) {
                 ModEvent me = ME_INT_NONE;
-                if ((x[i].min() == 0) && (x[i].max() > 0))
-                    me = x[i].gq(home, 1);
-                else if ((x[i].max() == 0) && (x[i].min() < 0))
-                    me = x[i].lq(home, -1);
+                if ((xi.min() == 0) && (xi.max() > 0))
+                    me = xi.gq(home, 1);
+                else if ((xi.max() == 0) && (xi.min() < 0))
+                    me = xi.lq(home, -1);
                 if (me_failed(me))
                     return ES_FAILED;
                 endpoint_modified |= me_modified(me);
@@ -632,6 +632,6 @@ namespace Gecode { namespace Int { namespace Arithmetic {
         return sizeof(*this);
     }
 
-}}} // namespace Gecode::Int::Arithmetic
+} // namespace Gecode::Int::Arithmetic
 
 // STATISTICS: int-prop
diff --git a/gecode/int/array-traits.hpp b/gecode/int/array-traits.hpp
index b736edf9f7..f5a313b12e 100644
--- a/gecode/int/array-traits.hpp
+++ b/gecode/int/array-traits.hpp
@@ -42,99 +42,99 @@ namespace Gecode {
     template <>
     class ArrayTraits> {
     public:
-        typedef IntVarArgs StorageType;
-        typedef IntVar ValueType;
-        typedef IntVarArgs ArgsType;
+        using StorageType = IntVarArgs;
+        using ValueType = IntVar;
+        using ArgsType = IntVarArgs;
     };
 
     /// Traits of %IntVarArray
     template <>
     class ArrayTraits> {
     public:
-        typedef IntVarArray StorageType;
-        typedef IntVar ValueType;
-        typedef IntVarArgs ArgsType;
+        using StorageType = IntVarArray;
+        using ValueType = IntVar;
+        using ArgsType = IntVarArgs;
     };
 
     /// Traits of %BoolVarArgs
     template <>
     class ArrayTraits> {
     public:
-        typedef BoolVarArgs StorageType;
-        typedef BoolVar ValueType;
-        typedef BoolVarArgs ArgsType;
+        using StorageType = BoolVarArgs;
+        using ValueType = BoolVar;
+        using ArgsType = BoolVarArgs;
     };
 
     /// Traits of %BoolVarArray
     template <>
     class ArrayTraits> {
     public:
-        typedef BoolVarArray StorageType;
-        typedef BoolVar ValueType;
-        typedef BoolVarArgs ArgsType;
+        using StorageType = BoolVarArray;
+        using ValueType = BoolVar;
+        using ArgsType = BoolVarArgs;
     };
 
     /// Traits of %IntArgs
     template <>
     class ArrayTraits> {
     public:
-        typedef IntArgs StorageType;
-        typedef int ValueType;
-        typedef IntArgs ArgsType;
+        using StorageType = IntArgs;
+        using ValueType = int;
+        using ArgsType = IntArgs;
     };
 
     /// Traits of %IntSetArgs
     template <>
     class ArrayTraits> {
     public:
-        typedef IntSetArgs StorageType;
-        typedef IntSet ValueType;
-        typedef IntSetArgs ArgsType;
+        using StorageType = IntSetArgs;
+        using ValueType = IntSet;
+        using ArgsType = IntSetArgs;
     };
 
     /// Traits of %IntVarArray
     template <>
     class ArrayTraits {
     public:
-        typedef IntVarArray StorageType;
-        typedef IntVar ValueType;
-        typedef IntVarArgs ArgsType;
+        using StorageType = IntVarArray;
+        using ValueType = IntVar;
+        using ArgsType = IntVarArgs;
     };
 
     /// Traits of %IntVarArgs
     template <>
     class ArrayTraits {
     public:
-        typedef IntVarArgs StorageType;
-        typedef IntVar ValueType;
-        typedef IntVarArgs ArgsType;
+        using StorageType = IntVarArgs;
+        using ValueType = IntVar;
+        using ArgsType = IntVarArgs;
     };
 
     /// Traits of %IntArgs
     template <>
     class ArrayTraits {
     public:
-        typedef IntArgs StorageType;
-        typedef int ValueType;
-        typedef IntArgs ArgsType;
+        using StorageType = IntArgs;
+        using ValueType = int;
+        using ArgsType = IntArgs;
     };
 
     /// Traits of %BoolVarArray
     template <>
     class ArrayTraits {
     public:
-        typedef BoolVarArray StorageType;
-        typedef BoolVar ValueType;
-        typedef BoolVarArgs ArgsType;
+        using StorageType = BoolVarArray;
+        using ValueType = BoolVar;
+        using ArgsType = BoolVarArgs;
     };
 
     /// Traits of %BoolVarArgs
     template <>
     class ArrayTraits {
     public:
-        typedef BoolVarArgs StorageType;
-        typedef BoolVar ValueType;
-        typedef BoolVarArgs ArgsType;
+        using StorageType = BoolVarArgs;
+        using ValueType = BoolVar;
+        using ArgsType = BoolVarArgs;
     };
 
 } // namespace Gecode
diff --git a/gecode/int/array.hpp b/gecode/int/array.hpp
index 3a4eff04e5..ae6c3366f2 100644
--- a/gecode/int/array.hpp
+++ b/gecode/int/array.hpp
@@ -38,7 +38,7 @@ namespace Gecode {
      */
 
     forceinline
-    IntArgs::IntArgs(void)
+    IntArgs::IntArgs()
         : ArgArray(0) {}
 
     forceinline
diff --git a/gecode/int/bin-packing.cpp b/gecode/int/bin-packing.cpp
index e119d12700..f44749e8d5 100644
--- a/gecode/int/bin-packing.cpp
+++ b/gecode/int/bin-packing.cpp
@@ -43,8 +43,8 @@ namespace Gecode {
             throw ArgumentSame("Int::binpacking");
         if (b.size() != s.size())
             throw ArgumentSizeMismatch("Int::binpacking");
-        for (int i = 0; i < s.size(); i++)
-            Limits::nonnegative(s[i], "Int::binpacking");
+        for (int si : s)
+            Limits::nonnegative(si, "Int::binpacking");
         GECODE_POST;
 
         ViewArray lv(home, l.size());
@@ -75,10 +75,10 @@ namespace Gecode {
         // Check input sizes
         if ((n * d != s.size()) || (m * d != l.size()) || (d != c.size()))
             throw ArgumentSizeMismatch("Int::binpacking");
-        for (int i = 0; i < s.size(); i++)
-            Limits::nonnegative(s[i], "Int::binpacking");
-        for (int i = 0; i < c.size(); i++)
-            Limits::nonnegative(c[i], "Int::binpacking");
+        for (int si : s)
+            Limits::nonnegative(si, "Int::binpacking");
+        for (int ci : c)
+            Limits::nonnegative(ci, "Int::binpacking");
 
         if (home.failed())
             return IntSet::empty;
diff --git a/gecode/int/bin-packing.hh b/gecode/int/bin-packing.hh
index b47b551703..21598818d1 100644
--- a/gecode/int/bin-packing.hh
+++ b/gecode/int/bin-packing.hh
@@ -46,7 +46,7 @@
  * \brief %Bin-packing propagators
  */
 
-namespace Gecode { namespace Int { namespace BinPacking {
+namespace Gecode::Int::BinPacking {
 
     /**
      * \brief Item combining bin and size information
@@ -59,16 +59,16 @@ namespace Gecode { namespace Int { namespace BinPacking {
 
     public:
         /// Default constructor
-        Item(void);
+        Item();
         /// Constructor
         Item(IntView b, int s);
 
         /// Return bin of item
-        IntView bin(void) const;
+        IntView bin() const;
         /// Set bin of item to \a b
         void bin(IntView b);
         /// Return size of item
-        int size(void) const;
+        int size() const;
         /// Set size of item to \a s
         void size(int s);
 
@@ -94,15 +94,15 @@ namespace Gecode { namespace Int { namespace BinPacking {
 
     public:
         /// Default constructor
-        SizeSet(void) = default;
+        SizeSet() = default;
         /// Initialize for at most \a n_max items
         SizeSet(Region& region, int n_max);
         /// Add new size \a s
         void add(int s);
         /// Return cardinality of set (number of entries)
-        int card(void) const;
+        int card() const;
         /// Return total size
-        int total(void) const;
+        int total() const;
         /// Return size of item \a i
         int operator[](int i) const;
     };
@@ -115,15 +115,15 @@ namespace Gecode { namespace Int { namespace BinPacking {
 
     public:
         /// Default constructor
-        SizeSetMinusOne(void);
+        SizeSetMinusOne();
         /// Initialize for at most \n n_max entries
         SizeSetMinusOne(Region& region, int n);
         /// Discard size \a s
         void minus(int s);
         /// Return cardinality of set (number of entries)
-        int card(void) const;
+        int card() const;
         /// Return total size
-        int total(void) const;
+        int total() const;
         /// Return size of item \a i
         int operator[](int i) const;
     };
@@ -206,11 +206,11 @@ namespace Gecode { namespace Int { namespace BinPacking {
         static LambdaRange l_vb2(int c);
         static LambdaRange l_fs1(int c);
         static LambdaRange l_rad2(int c);
-        static LambdaRange sanitize_lambda_range(LambdaRange lambda, int n_weights, int max_weight);
+        static LambdaRange sanitize_lambda_range(LambdaRange lambda, int n_not_zero_weights, int max_weight);
         /// Lower bound
         template 
         static int calc_dff_lower_bound_single_lambda(const int* weights, int n_weights, int capacity, int lambda);
-        template 
+        template 
         static int calc_dff_lower_bound(const int* weights, int n_weights, int capacity, int n_not_zero_weights,
                                         int max_weight, bool sanitize = false);
     };
@@ -225,13 +225,13 @@ namespace Gecode { namespace Int { namespace BinPacking {
         /// Number of bins
         unsigned int bins;
         /// Return number of nodes
-        int nodes(void) const;
+        int nodes() const;
 
         /// Sets of graph nodes
         class NodeSet : public Support::RawBitSetBase {
         public:
             /// Keep uninitialized
-            NodeSet(void) = default;
+            NodeSet() = default;
             /// Initialize node set for \a n nodes
             NodeSet(Region& r, int n);
             /// Initialize node set as copy of \a ns with \a n nodes
@@ -256,7 +256,7 @@ namespace Gecode { namespace Int { namespace BinPacking {
              * is the maximal number of nodes. Return whether both \a ac
              * and \a bc are empty.
              */
-            static bool iwn(NodeSet& iwa, const NodeSet& a, NodeSet& iwb, const NodeSet& b, const NodeSet& c, int n);
+            static bool iwn(NodeSet& cwa, const NodeSet& a, NodeSet& cwb, const NodeSet& b, const NodeSet& c, int n);
         };
 
         /// Class for node in graph
@@ -269,7 +269,7 @@ namespace Gecode { namespace Int { namespace BinPacking {
             /// Weight (initialized with degree before graph is reduced)
             unsigned int w;
             /// Default constructor
-            Node(void);
+            Node();
         };
         /// The nodes in the graph
         Node* node;
@@ -288,13 +288,13 @@ namespace Gecode { namespace Int { namespace BinPacking {
             /// \name Iteration control
             //@{
             /// Move iterator to next node (if possible)
-            void operator++(void);
+            void operator++();
             //@}
 
             /// \name %Node access
             //@{
             /// Return current node
-            int operator()(void) const;
+            int operator()() const;
             //@}
         };
 
@@ -331,7 +331,7 @@ namespace Gecode { namespace Int { namespace BinPacking {
         /// Largest clique so far
         Clique max;
         /// Report the current clique
-        ExecStatus clique(void);
+        ExecStatus clique();
         /// Found a clique of node \a i
         ExecStatus clique(int i);
         /// Found a clique of nodes \a i and \a j
@@ -347,14 +347,14 @@ namespace Gecode { namespace Int { namespace BinPacking {
         /// Test whether nodes \a i and \a j are adjacent
         bool adjacent(int i, int j) const;
         /// Post additional constraints
-        ExecStatus post(void);
+        ExecStatus post();
         /// Return maximal clique found
-        IntSet maximum_clique(void) const;
+        IntSet maximum_clique() const;
         /// Destructor
-        ~ConflictGraph(void) = default;
+        ~ConflictGraph() = default;
     };
 
-}}} // namespace Gecode::Int::BinPacking
+} // namespace Gecode::Int::BinPacking
 
 #include 
 #include 
diff --git a/gecode/int/bin-packing/conflict-graph.cpp b/gecode/int/bin-packing/conflict-graph.cpp
index 3cf9f3bc0f..c82bce6905 100644
--- a/gecode/int/bin-packing/conflict-graph.cpp
+++ b/gecode/int/bin-packing/conflict-graph.cpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace BinPacking {
+namespace Gecode::Int::BinPacking {
 
     ExecStatus
     ConflictGraph::bk(NodeSet& p, NodeSet& x) {
@@ -83,6 +83,6 @@ namespace Gecode { namespace Int { namespace BinPacking {
         return ES_OK;
     }
 
-}}} // namespace Gecode::Int::BinPacking
+} // namespace Gecode::Int::BinPacking
 
 // STATISTICS: int-prop
diff --git a/gecode/int/bin-packing/conflict-graph.hpp b/gecode/int/bin-packing/conflict-graph.hpp
index 25f3e13d88..f9969a4172 100644
--- a/gecode/int/bin-packing/conflict-graph.hpp
+++ b/gecode/int/bin-packing/conflict-graph.hpp
@@ -35,10 +35,10 @@
 #include 
 #include 
 
-namespace Gecode { namespace Int { namespace BinPacking {
+namespace Gecode::Int::BinPacking {
 
     forceinline int
-    ConflictGraph::nodes(void) const {
+    ConflictGraph::nodes() const {
         return b.size();
     }
 
@@ -105,17 +105,17 @@ namespace Gecode { namespace Int { namespace BinPacking {
 
     forceinline
     // NOLINTNEXTLINE(modernize-use-equals-default)
-    ConflictGraph::Node::Node(void) {}
+    ConflictGraph::Node::Node() {}
 
     forceinline
     ConflictGraph::Nodes::Nodes(const NodeSet& ns0)
         : ns(ns0), c(ns.next(0)) {}
     forceinline void
-    ConflictGraph::Nodes::operator++(void) {
+    ConflictGraph::Nodes::operator++() {
         c = ns.next(c + 1);
     }
     forceinline int
-    ConflictGraph::Nodes::operator()(void) const {
+    ConflictGraph::Nodes::operator()() const {
         return static_cast(c);
     }
 
@@ -201,7 +201,7 @@ namespace Gecode { namespace Int { namespace BinPacking {
     }
 
     forceinline ExecStatus
-    ConflictGraph::clique(void) {
+    ConflictGraph::clique() {
         // Remember clique
         if ((cur.c > max.c) || ((cur.c == max.c) && (cur.w > max.w))) {
             max.n.copy(nodes(), cur.n);
@@ -215,7 +215,7 @@ namespace Gecode { namespace Int { namespace BinPacking {
         int i = 0;
         for (Nodes c(cur.n); c() < nodes(); ++c)
             bv[i++] = b[c()];
-        assert(i == static_cast(cur.c));
+        assert(std::cmp_equal(i, cur.c));
         return Distinct::Dom::post(home, bv);
     }
 
@@ -267,7 +267,7 @@ namespace Gecode { namespace Int { namespace BinPacking {
     }
 
     forceinline ExecStatus
-    ConflictGraph::post(void) {
+    ConflictGraph::post() {
         // Find some simple cliques of sizes 2 and 3.
         Region reg;
         {
@@ -344,17 +344,17 @@ namespace Gecode { namespace Int { namespace BinPacking {
     }
 
     inline IntSet
-    ConflictGraph::maximum_clique(void) const {
+    ConflictGraph::maximum_clique() const {
         Region reg;
         int* n = reg.alloc(max.c);
         int j = 0;
         for (Nodes i(max.n); i() < nodes(); ++i)
             n[j++] = i();
-        assert(j == static_cast(max.c));
+        assert(std::cmp_equal(j, max.c));
         IntSet s(n, static_cast(max.c));
         return s;
     }
 
-}}} // namespace Gecode::Int::BinPacking
+} // namespace Gecode::Int::BinPacking
 
 // STATISTICS: int-prop
diff --git a/gecode/int/bin-packing/propagate.cpp b/gecode/int/bin-packing/propagate.cpp
index 2e85dbb22e..f9f773b2a1 100644
--- a/gecode/int/bin-packing/propagate.cpp
+++ b/gecode/int/bin-packing/propagate.cpp
@@ -36,7 +36,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace BinPacking {
+namespace Gecode::Int::BinPacking {
 
     /*
      * Packing propagator
@@ -99,7 +99,8 @@ namespace Gecode { namespace Int { namespace BinPacking {
     TellCache::tell(Space& home, IntView x) {
         if (_eq == -2) {
             return ES_FAILED;
-        } else if (_eq >= 0) {
+        }
+        if (_eq >= 0) {
             GECODE_ME_CHECK(x.eq(home, _eq));
         }
         Iter::Values::Array nqi(_nq, _n_nq);
@@ -369,10 +370,10 @@ namespace Gecode { namespace Int { namespace BinPacking {
         // Total size of items
         int s = 0;
         // Constrain bins
-        for (int i = 0; i < bs.size(); i++) {
-            s += bs[i].size();
-            GECODE_ME_CHECK(bs[i].bin().gq(home, 0));
-            GECODE_ME_CHECK(bs[i].bin().le(home, l.size()));
+        for (auto b : bs) {
+            s += b.size();
+            GECODE_ME_CHECK(b.bin().gq(home, 0));
+            GECODE_ME_CHECK(b.bin().le(home, l.size()));
         }
         // Eliminate zero sized items (which are at the end as the size are sorted)
         {
@@ -383,21 +384,20 @@ namespace Gecode { namespace Int { namespace BinPacking {
         }
         if (bs.size() == 0) {
             // No items to be packed
-            for (int i = 0; i < l.size(); i++)
-                GECODE_ME_CHECK(l[i].eq(home, 0));
+            for (auto& li : l)
+                GECODE_ME_CHECK(li.eq(home, 0));
             return ES_OK;
-        } else if (l.size() == 0) {
+        }
+        if (l.size() == 0) {
             // No bins available
             return ES_FAILED;
-        } else {
-            // Constrain load
-            for (int j = 0; j < l.size(); j++) {
-                GECODE_ME_CHECK(l[j].gq(home, 0));
-                GECODE_ME_CHECK(l[j].lq(home, s));
-            }
-            (void)new (home) Pack(home, l, bs, ipl);
-            return ES_OK;
+        } // Constrain load
+        for (auto& j : l) {
+            GECODE_ME_CHECK(j.gq(home, 0));
+            GECODE_ME_CHECK(j.lq(home, s));
         }
+        (void)new (home) Pack(home, l, bs, ipl);
+        return ES_OK;
     }
 
     void
@@ -436,6 +436,6 @@ namespace Gecode { namespace Int { namespace BinPacking {
         delta_reductions[2] = capacity_base_reduction - smallest_virtual_weight - smallest_virtual_weight + 1;
     }
 
-}}} // namespace Gecode::Int::BinPacking
+} // namespace Gecode::Int::BinPacking
 
 // STATISTICS: int-prop
diff --git a/gecode/int/bin-packing/propagate.hpp b/gecode/int/bin-packing/propagate.hpp
index 1bff5d7f10..cd02786197 100644
--- a/gecode/int/bin-packing/propagate.hpp
+++ b/gecode/int/bin-packing/propagate.hpp
@@ -34,21 +34,21 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace BinPacking {
+namespace Gecode::Int::BinPacking {
 
     /*
      * Item
      *
      */
     forceinline
-    Item::Item(void)
+    Item::Item()
         : s(0) {}
     forceinline
     Item::Item(IntView b, int s0)
         : DerivedView(b), s(s0) {}
 
     forceinline IntView
-    Item::bin(void) const {
+    Item::bin() const {
         return x;
     }
     forceinline void
@@ -56,7 +56,7 @@ namespace Gecode { namespace Int { namespace BinPacking {
         x = b;
     }
     forceinline int
-    Item::size(void) const {
+    Item::size() const {
         return s;
     }
     forceinline void
@@ -94,11 +94,11 @@ namespace Gecode { namespace Int { namespace BinPacking {
         s[n++] = s0;
     }
     forceinline int
-    SizeSet::card(void) const {
+    SizeSet::card() const {
         return n;
     }
     forceinline int
-    SizeSet::total(void) const {
+    SizeSet::total() const {
         return t;
     }
     forceinline int
@@ -108,7 +108,7 @@ namespace Gecode { namespace Int { namespace BinPacking {
 
     forceinline
     // NOLINTNEXTLINE(modernize-use-equals-default)
-    SizeSetMinusOne::SizeSetMinusOne(void) {}
+    SizeSetMinusOne::SizeSetMinusOne() {}
     forceinline
     SizeSetMinusOne::SizeSetMinusOne(Region& region, int n_max)
         : SizeSet(region, n_max), p(-1) {}
@@ -121,12 +121,12 @@ namespace Gecode { namespace Int { namespace BinPacking {
         assert(p < n);
     }
     forceinline int
-    SizeSetMinusOne::card(void) const {
+    SizeSetMinusOne::card() const {
         assert(p >= 0);
         return n - 1;
     }
     forceinline int
-    SizeSetMinusOne::total(void) const {
+    SizeSetMinusOne::total() const {
         assert(p >= 0);
         return t - s[p];
     }
@@ -146,8 +146,8 @@ namespace Gecode { namespace Int { namespace BinPacking {
         : Propagator(home), l(l0), bs(bs0), ipl(ba(ipl0) == IPL_DEF ? IPL_ADVANCED : ipl0), t(0) {
         l.subscribe(home, *this, PC_INT_BND);
         bs.subscribe(home, *this, PC_INT_DOM);
-        for (int i = 0; i < bs.size(); i++)
-            t += bs[i].size();
+        for (auto b : bs)
+            t += b.size();
     }
 
     forceinline
@@ -350,9 +350,8 @@ namespace Gecode { namespace Int { namespace BinPacking {
         if (n != 0) {
             int l_max = std::min(static_cast(std::numeric_limits::max() / n), lambda_range.max);
             return {lambda_range.min, l_max};
-        } else {
-            return {0, -1};
         }
+        return {0, -1};
     }
 
     template 
@@ -370,11 +369,11 @@ namespace Gecode { namespace Int { namespace BinPacking {
         return static_cast(ceil_div_pp(sum_transformed_weights, static_cast(transformed_capacity)));
     }
 
-    template 
+    template 
     forceinline int
     Pack::calc_dff_lower_bound(const int* weights, int n_weights, int capacity, int n_not_zero_weights, int max_weight,
                                bool sanitize) {
-        LambdaRange lambda_range = l(capacity);
+        LambdaRange lambda_range = range(capacity);
         lambda_range = sanitize ? sanitize_lambda_range(lambda_range, n_not_zero_weights, max_weight) : lambda_range;
         if (lambda_range.min >= lambda_range.max)
             return 0;
@@ -391,6 +390,6 @@ namespace Gecode { namespace Int { namespace BinPacking {
         return lower_bound;
     }
 
-}}} // namespace Gecode::Int::BinPacking
+} // namespace Gecode::Int::BinPacking
 
 // STATISTICS: int-prop
diff --git a/gecode/int/bool.cpp b/gecode/int/bool.cpp
index 551a0cb837..957f1d3bfe 100644
--- a/gecode/int/bool.cpp
+++ b/gecode/int/bool.cpp
@@ -337,34 +337,34 @@ namespace Gecode {
         GECODE_POST;
         switch (irt) {
         case IRT_EQ:
-            for (int i = 0; i < x.size(); i++) {
-                GECODE_ES_FAIL((Bool::Eq::post(home, x[i], y)));
+            for (auto xi : x) {
+                GECODE_ES_FAIL((Bool::Eq::post(home, xi, y)));
             }
             break;
         case IRT_NQ: {
             NegBoolView n(y);
-            for (int i = 0; i < x.size(); i++) {
-                GECODE_ES_FAIL((Bool::Eq::post(home, x[i], n)));
+            for (auto xi : x) {
+                GECODE_ES_FAIL((Bool::Eq::post(home, xi, n)));
             }
         } break;
         case IRT_GQ:
-            for (int i = 0; i < x.size(); i++) {
-                GECODE_ES_FAIL(Bool::Lq::post(home, y, x[i]));
+            for (auto xi : x) {
+                GECODE_ES_FAIL(Bool::Lq::post(home, y, xi));
             }
             break;
         case IRT_LQ:
-            for (int i = 0; i < x.size(); i++) {
-                GECODE_ES_FAIL(Bool::Lq::post(home, x[i], y));
+            for (auto xi : x) {
+                GECODE_ES_FAIL(Bool::Lq::post(home, xi, y));
             }
             break;
         case IRT_GR:
-            for (int i = 0; i < x.size(); i++) {
-                GECODE_ES_FAIL(Bool::Le::post(home, y, x[i]));
+            for (auto xi : x) {
+                GECODE_ES_FAIL(Bool::Le::post(home, y, xi));
             }
             break;
         case IRT_LT:
-            for (int i = 0; i < x.size(); i++) {
-                GECODE_ES_FAIL(Bool::Le::post(home, x[i], y));
+            for (auto xi : x) {
+                GECODE_ES_FAIL(Bool::Le::post(home, xi, y));
             }
             break;
         default:
@@ -380,15 +380,13 @@ namespace Gecode {
             switch (irt) {
             case IRT_LQ:
             case IRT_EQ:
-                for (int i = 0; i < x.size(); i++) {
-                    BoolView xi(x[i]);
+                for (BoolView xi : x) {
                     GECODE_ME_FAIL(xi.zero(home));
                 }
                 break;
             case IRT_NQ:
             case IRT_GR:
-                for (int i = 0; i < x.size(); i++) {
-                    BoolView xi(x[i]);
+                for (BoolView xi : x) {
                     GECODE_ME_FAIL(xi.one(home));
                 }
                 break;
@@ -404,15 +402,13 @@ namespace Gecode {
             switch (irt) {
             case IRT_GQ:
             case IRT_EQ:
-                for (int i = 0; i < x.size(); i++) {
-                    BoolView xi(x[i]);
+                for (BoolView xi : x) {
                     GECODE_ME_FAIL(xi.one(home));
                 }
                 break;
             case IRT_NQ:
             case IRT_LT:
-                for (int i = 0; i < x.size(); i++) {
-                    BoolView xi(x[i]);
+                for (BoolView xi : x) {
                     GECODE_ME_FAIL(xi.zero(home));
                 }
                 break;
@@ -806,24 +802,24 @@ namespace Gecode {
                 yv.unique();
                 GECODE_ES_FAIL((Bool::ClauseTrue::post(home, xv, yv)));
             } else {
-                for (int i = 0; i < x.size(); i++) {
-                    BoolView b(x[i]);
+                for (auto xi : x) {
+                    BoolView b(xi);
                     GECODE_ME_FAIL(b.one(home));
                 }
-                for (int i = 0; i < y.size(); i++) {
-                    BoolView b(y[i]);
+                for (auto yi : y) {
+                    BoolView b(yi);
                     GECODE_ME_FAIL(b.zero(home));
                 }
             }
             break;
         case BOT_OR:
             if (n == 0) {
-                for (int i = 0; i < x.size(); i++) {
-                    BoolView b(x[i]);
+                for (auto xi : x) {
+                    BoolView b(xi);
                     GECODE_ME_FAIL(b.zero(home));
                 }
-                for (int i = 0; i < y.size(); i++) {
-                    BoolView b(y[i]);
+                for (auto yi : y) {
+                    BoolView b(yi);
                     GECODE_ME_FAIL(b.one(home));
                 }
             } else {
diff --git a/gecode/int/bool.hh b/gecode/int/bool.hh
index e6b58d787f..901c84878f 100644
--- a/gecode/int/bool.hh
+++ b/gecode/int/bool.hh
@@ -42,7 +42,7 @@
  * \brief Boolean propagators
  */
 
-namespace Gecode { namespace Int { namespace Bool {
+namespace Gecode::Int::Bool {
 
     /*
      * Base Classes
@@ -118,7 +118,7 @@ namespace Gecode { namespace Int { namespace Bool {
         /// Perform propagation
         ExecStatus propagate(Space& home, const ModEventDelta& med) override;
         /// Post propagator \f$ x_0 = x_1\f$
-        static ExecStatus post(Home home, BVA x0, BVB x1);
+        static ExecStatus post(Home home, BVA b0, BVB b1);
     };
 
     /**
@@ -395,7 +395,7 @@ namespace Gecode { namespace Int { namespace Bool {
         /// Update subscription
         ExecStatus resubscribe(Space& home, BV& x0, BV x1);
         /// Constructor for posting
-        NaryOrTrue(Home home, ViewArray& x);
+        NaryOrTrue(Home home, ViewArray& b);
         /// Constructor for cloning \a p
         NaryOrTrue(Space& home, NaryOrTrue& p);
 
@@ -582,7 +582,7 @@ namespace Gecode { namespace Int { namespace Bool {
         /// Constructor for cloning \a p
         IteBase(Space& home, IteBase& p);
         /// Constructor for creation
-        IteBase(Home home, BoolView b, V0 x0, V1 x1, V2 x2);
+        IteBase(Home home, BoolView b, V0 y0, V1 y1, V2 y2);
 
     public:
         /// Cost function (defined as low ternary)
@@ -649,7 +649,7 @@ namespace Gecode { namespace Int { namespace Bool {
         static ExecStatus post(Home home, BoolView b, V0 x0, V1 x1, V2 x2);
     };
 
-}}} // namespace Gecode::Int::Bool
+} // namespace Gecode::Int::Bool
 
 #include 
 #include 
diff --git a/gecode/int/bool/base.hpp b/gecode/int/bool/base.hpp
index e30d4b54bf..711e9c8442 100644
--- a/gecode/int/bool/base.hpp
+++ b/gecode/int/bool/base.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Bool {
+namespace Gecode::Int::Bool {
 
     /*
      * Binary Boolean propagators
@@ -137,6 +137,6 @@ namespace Gecode { namespace Int { namespace Bool {
         return sizeof(*this);
     }
 
-}}} // namespace Gecode::Int::Bool
+} // namespace Gecode::Int::Bool
 
 // STATISTICS: int-prop
diff --git a/gecode/int/bool/clause.hpp b/gecode/int/bool/clause.hpp
index fdf3277797..1c352cd2c3 100644
--- a/gecode/int/bool/clause.hpp
+++ b/gecode/int/bool/clause.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Bool {
+namespace Gecode::Int::Bool {
 
     /*
      * Boolean clause propagator (disjunctive, true)
@@ -100,8 +100,7 @@ namespace Gecode { namespace Int { namespace Bool {
         }
         if ((x.size() == 0) && (y.size() == 0))
             return new (home) BinOrTrue(home, *this, x0, x1);
-        else
-            return new (home) ClauseTrue(home, *this);
+        return new (home) ClauseTrue(home, *this);
     }
 
     template 
@@ -123,7 +122,8 @@ namespace Gecode { namespace Int { namespace Bool {
             return NaryOrTrue::post(home, x);
         if ((x.size() == 1) && (y.size() == 1)) {
             return BinOrTrue::post(home, x[0], y[0]);
-        } else if (!shared(x, y)) {
+        }
+        if (!shared(x, y)) {
             (void)new (home) ClauseTrue(home, x, y);
         }
         return ES_OK;
@@ -275,7 +275,8 @@ namespace Gecode { namespace Int { namespace Bool {
             return NaryOr::post(home, x, z);
         if ((x.size() == 1) && (y.size() == 1)) {
             return Or::post(home, x[0], y[0], z);
-        } else if (shared(x, y)) {
+        }
+        if (shared(x, y)) {
             GECODE_ME_CHECK(z.one_none(home));
         } else {
             (void)new (home) Clause(home, x, y, z);
@@ -361,6 +362,6 @@ namespace Gecode { namespace Int { namespace Bool {
         return home.ES_SUBSUMED(*this);
     }
 
-}}} // namespace Gecode::Int::Bool
+} // namespace Gecode::Int::Bool
 
 // STATISTICS: int-prop
diff --git a/gecode/int/bool/eq.hpp b/gecode/int/bool/eq.hpp
index 36ad49705d..252a48b672 100644
--- a/gecode/int/bool/eq.hpp
+++ b/gecode/int/bool/eq.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Bool {
+namespace Gecode::Int::Bool {
 
     template 
     forceinline
@@ -190,6 +190,6 @@ namespace Gecode { namespace Int { namespace Bool {
         return ES_FIX;
     }
 
-}}} // namespace Gecode::Int::Bool
+} // namespace Gecode::Int::Bool
 
 // STATISTICS: int-prop
diff --git a/gecode/int/bool/eqv.cpp b/gecode/int/bool/eqv.cpp
index ebd3b701cd..d7fea83745 100644
--- a/gecode/int/bool/eqv.cpp
+++ b/gecode/int/bool/eqv.cpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Bool {
+namespace Gecode::Int::Bool {
 
     /*
      * N-ary Boolean equivalence propagator
@@ -66,10 +66,9 @@ namespace Gecode { namespace Int { namespace Bool {
         if (n == 2) {
             if (pm2 == 1) {
                 return Bool::Eq::post(home, x[0], x[1]);
-            } else {
-                NegBoolView nx(x[1]);
-                return Bool::Eq::post(home, x[0], nx);
             }
+            NegBoolView nx(x[1]);
+            return Bool::Eq::post(home, x[0], nx);
         }
         x.size(n);
         (void)new (home) NaryEqv(home, x, pm2);
@@ -83,10 +82,12 @@ namespace Gecode { namespace Int { namespace Bool {
         if (x.size() == 0) {
             if (x0.assigned() && x1.assigned()) {
                 return (pm2 == 1) ? home.ES_SUBSUMED(*this) : ES_FAILED;
-            } else if (x0.assigned()) {
+            }
+            if (x0.assigned()) {
                 GECODE_ME_CHECK(x1.eq(home, 1 ^ pm2));
                 return home.ES_SUBSUMED(*this);
-            } else if (x1.assigned()) {
+            }
+            if (x1.assigned()) {
                 GECODE_ME_CHECK(x0.eq(home, 1 ^ pm2));
                 return home.ES_SUBSUMED(*this);
             }
@@ -94,6 +95,6 @@ namespace Gecode { namespace Int { namespace Bool {
         return ES_FIX;
     }
 
-}}} // namespace Gecode::Int::Bool
+} // namespace Gecode::Int::Bool
 
 // STATISTICS: int-prop
diff --git a/gecode/int/bool/eqv.hpp b/gecode/int/bool/eqv.hpp
index 30159d981a..2ce4127ff1 100644
--- a/gecode/int/bool/eqv.hpp
+++ b/gecode/int/bool/eqv.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Bool {
+namespace Gecode::Int::Bool {
 
     template 
     forceinline
@@ -59,7 +59,8 @@ namespace Gecode { namespace Int { namespace Bool {
                 if (b1.one()) {
                     GECODE_ME_CHECK(b2.one(home));
                     return ES_OK;
-                } else if (b1.zero()) {
+                }
+                if (b1.zero()) {
                     GECODE_ME_CHECK(b2.zero(home));
                     return ES_OK;
                 }
@@ -68,7 +69,8 @@ namespace Gecode { namespace Int { namespace Bool {
                 if (b1.one()) {
                     GECODE_ME_CHECK(b2.zero(home));
                     return ES_OK;
-                } else if (b1.zero()) {
+                }
+                if (b1.zero()) {
                     GECODE_ME_CHECK(b2.one(home));
                     return ES_OK;
                 }
@@ -209,6 +211,6 @@ namespace Gecode { namespace Int { namespace Bool {
         }
     }
 
-}}} // namespace Gecode::Int::Bool
+} // namespace Gecode::Int::Bool
 
 // STATISTICS: int-prop
diff --git a/gecode/int/bool/ite.hpp b/gecode/int/bool/ite.hpp
index b539add16e..e99000e145 100644
--- a/gecode/int/bool/ite.hpp
+++ b/gecode/int/bool/ite.hpp
@@ -34,7 +34,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Bool {
+namespace Gecode::Int::Bool {
 
     template 
     forceinline
@@ -132,16 +132,14 @@ namespace Gecode { namespace Int { namespace Bool {
             GECODE_ME_CHECK(b.zero_none(home));
             if (eq21 == RT_TRUE)
                 return home.ES_SUBSUMED(*this);
-            else
-                GECODE_REWRITE(*this, (Rel::EqBnd::post(home(*this), x2, x1)));
+            GECODE_REWRITE(*this, (Rel::EqBnd::post(home(*this), x2, x1)));
         }
 
         if (eq21 == RT_FALSE) {
             GECODE_ME_CHECK(b.one_none(home));
             if (eq20 == RT_TRUE)
                 return home.ES_SUBSUMED(*this);
-            else
-                GECODE_REWRITE(*this, (Rel::EqBnd::post(home(*this), x2, x0)));
+            GECODE_REWRITE(*this, (Rel::EqBnd::post(home(*this), x2, x0)));
         }
 
         if ((eq20 == RT_TRUE) && (eq21 == RT_TRUE))
@@ -184,8 +182,7 @@ namespace Gecode { namespace Int { namespace Bool {
     IteDom::cost(const Space&, const ModEventDelta& med) const {
         if (V0::me(med) == ME_INT_DOM)
             return PropCost::ternary(PropCost::HI);
-        else
-            return PropCost::ternary(PropCost::LO);
+        return PropCost::ternary(PropCost::LO);
     }
 
     template 
@@ -210,16 +207,14 @@ namespace Gecode { namespace Int { namespace Bool {
                 GECODE_ME_CHECK(b.zero_none(home));
                 if (eq21 == RT_TRUE)
                     return home.ES_SUBSUMED(*this);
-                else
-                    GECODE_REWRITE(*this, (Rel::EqDom::post(home(*this), x2, x1)));
+                GECODE_REWRITE(*this, (Rel::EqDom::post(home(*this), x2, x1)));
             }
 
             if (eq21 == RT_FALSE) {
                 GECODE_ME_CHECK(b.one_none(home));
                 if (eq20 == RT_TRUE)
                     return home.ES_SUBSUMED(*this);
-                else
-                    GECODE_REWRITE(*this, (Rel::EqDom::post(home(*this), x2, x0)));
+                GECODE_REWRITE(*this, (Rel::EqDom::post(home(*this), x2, x0)));
             }
 
             if ((eq20 == RT_TRUE) && (eq21 == RT_TRUE))
@@ -238,16 +233,14 @@ namespace Gecode { namespace Int { namespace Bool {
             GECODE_ME_CHECK(b.zero_none(home));
             if (eq21 == RT_TRUE)
                 return home.ES_SUBSUMED(*this);
-            else
-                GECODE_REWRITE(*this, (Rel::EqDom::post(home(*this), x2, x1)));
+            GECODE_REWRITE(*this, (Rel::EqDom::post(home(*this), x2, x1)));
         }
 
         if (eq21 == RT_FALSE) {
             GECODE_ME_CHECK(b.one_none(home));
             if (eq20 == RT_TRUE)
                 return home.ES_SUBSUMED(*this);
-            else
-                GECODE_REWRITE(*this, (Rel::EqDom::post(home(*this), x2, x0)));
+            GECODE_REWRITE(*this, (Rel::EqDom::post(home(*this), x2, x0)));
         }
 
         assert((eq20 != RT_TRUE) || (eq21 != RT_TRUE));
@@ -264,6 +257,6 @@ namespace Gecode { namespace Int { namespace Bool {
         return ES_FIX;
     }
 
-}}} // namespace Gecode::Int::Bool
+} // namespace Gecode::Int::Bool
 
 // STATISTICS: int-prop
diff --git a/gecode/int/bool/lq.hpp b/gecode/int/bool/lq.hpp
index d04d5a671a..1cd5ede34e 100644
--- a/gecode/int/bool/lq.hpp
+++ b/gecode/int/bool/lq.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Bool {
+namespace Gecode::Int::Bool {
 
     /*
      * Less or equal propagator
@@ -58,7 +58,8 @@ namespace Gecode { namespace Int { namespace Bool {
     Lq::post(Home home, BV b0, BV b1) {
         if (b0.zero()) {
             return ES_OK;
-        } else if (b0.one()) {
+        }
+        if (b0.one()) {
             GECODE_ME_CHECK(b1.one(home));
         } else if (b1.zero()) {
             GECODE_ME_CHECK(b0.zero(home));
@@ -229,6 +230,6 @@ namespace Gecode { namespace Int { namespace Bool {
         return ES_OK;
     }
 
-}}} // namespace Gecode::Int::Bool
+} // namespace Gecode::Int::Bool
 
 // STATISTICS: int-prop
diff --git a/gecode/int/bool/or.hpp b/gecode/int/bool/or.hpp
index 9b6f58cd99..677990b836 100644
--- a/gecode/int/bool/or.hpp
+++ b/gecode/int/bool/or.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Bool {
+namespace Gecode::Int::Bool {
 
     /// Binary Boolean disjunction propagator (subsumed)
     template 
@@ -204,10 +204,9 @@ namespace Gecode { namespace Int { namespace Bool {
         assert(x0.none() && x1.none());
         if (x2.one())
             return new (home) OrTrueSubsumed(home, *this, x0, x1);
-        else if (x2.zero())
+        if (x2.zero())
             return new (home) BinOrTrue(home, *this, x0, x1);
-        else
-            return new (home) TerOrTrue(home, *this);
+        return new (home) TerOrTrue(home, *this);
     }
 
     template 
@@ -313,14 +312,13 @@ namespace Gecode { namespace Int { namespace Bool {
         assert(x0.none() && x1.none());
         if (x2.one() || x3.one())
             return new (home) OrTrueSubsumed(home, *this, x0, x1);
-        else if (x2.zero() && x3.zero())
+        if (x2.zero() && x3.zero())
             return new (home) BinOrTrue(home, *this, x0, x1);
-        else if (x2.zero())
+        if (x2.zero())
             return new (home) TerOrTrue(home, *this, x0, x1, x3);
-        else if (x3.zero())
+        if (x3.zero())
             return new (home) TerOrTrue(home, *this, x0, x1, x2);
-        else
-            return new (home) QuadOrTrue(home, *this);
+        return new (home) QuadOrTrue(home, *this);
     }
 
     template 
@@ -484,15 +482,16 @@ namespace Gecode { namespace Int { namespace Bool {
         if (x2.one()) {
             assert(x0.none() && x1.none());
             return new (home) BinOrTrue(home, *this, x0, x1);
-        } else if (x0.zero()) {
+        }
+        if (x0.zero()) {
             assert(x1.none() && x2.none());
             return new (home) Eq(home, *this, x1, x2);
-        } else if (x1.zero()) {
+        }
+        if (x1.zero()) {
             assert(x0.none() && x2.none());
             return new (home) Eq(home, *this, x0, x2);
-        } else {
-            return new (home) Or(home, *this);
         }
+        return new (home) Or(home, *this);
     }
 
     template 
@@ -830,8 +829,7 @@ namespace Gecode { namespace Int { namespace Bool {
         // Decides whether the propagator must be run
         if (VX::zero(d) && (++n_zero < x.size()))
             return ES_FIX;
-        else
-            return ES_NOFIX;
+        return ES_NOFIX;
     }
 
     template 
@@ -876,6 +874,6 @@ namespace Gecode { namespace Int { namespace Bool {
         return home.ES_SUBSUMED(*this);
     }
 
-}}} // namespace Gecode::Int::Bool
+} // namespace Gecode::Int::Bool
 
 // STATISTICS: int-prop
diff --git a/gecode/int/branch.hh b/gecode/int/branch.hh
index dd94e19f79..f51c7876f2 100644
--- a/gecode/int/branch.hh
+++ b/gecode/int/branch.hh
@@ -44,7 +44,7 @@
  * \brief Integer branchers
  */
 
-namespace Gecode { namespace Int { namespace Branch {
+namespace Gecode::Int::Branch {
 
     /**
      * \defgroup FuncIntViewSel Merit-based integer view selection for branchers
@@ -152,7 +152,7 @@ namespace Gecode { namespace Int { namespace Branch {
         /// Return AFC over size as merit for view \a x at position \a i
         double operator()(const Space& home, View x, int i);
         /// Whether dispose must always be called (that is, notice is needed)
-        bool notice(void) const;
+        bool notice() const;
         /// Dispose view selection
         void dispose(Space& home);
     };
@@ -179,7 +179,7 @@ namespace Gecode { namespace Int { namespace Branch {
         /// Return action over size as merit for view \a x at position \a i
         double operator()(const Space& home, View x, int i);
         /// Whether dispose must always be called (that is, notice is needed)
-        bool notice(void) const;
+        bool notice() const;
         /// Dispose view selection
         void dispose(Space& home);
     };
@@ -206,7 +206,7 @@ namespace Gecode { namespace Int { namespace Branch {
         /// Return size over action as merit for view \a x at position \a i
         double operator()(const Space& home, View x, int i);
         /// Whether dispose must always be called (that is, notice is needed)
-        bool notice(void) const;
+        bool notice() const;
         /// Dispose view selection
         void dispose(Space& home);
     };
@@ -247,11 +247,11 @@ namespace Gecode { namespace Int { namespace Branch {
         unsigned int operator()(const Space& home, View x, int i);
     };
 
-}}} // namespace Gecode::Int::Branch
+} // namespace Gecode::Int::Branch
 
 #include 
 
-namespace Gecode { namespace Int { namespace Branch {
+namespace Gecode::Int::Branch {
 
     /// Return view selectors for integer views
     GECODE_INT_EXPORT
@@ -260,9 +260,9 @@ namespace Gecode { namespace Int { namespace Branch {
     GECODE_INT_EXPORT
     ViewSel* view_selection(Space& home, const BoolVarBranch& bvb);
 
-}}} // namespace Gecode::Int::Branch
+} // namespace Gecode::Int::Branch
 
-namespace Gecode { namespace Int { namespace Branch {
+namespace Gecode::Int::Branch {
 
     /**
      * \defgroup FuncIntValSel Integer value selection for brancher
@@ -369,7 +369,7 @@ namespace Gecode { namespace Int { namespace Branch {
             r = r.split(a);
         }
         bool
-        random(void) const {
+        random() const {
             return true;
         }
         /// Constructor for initialization
@@ -379,7 +379,7 @@ namespace Gecode { namespace Int { namespace Branch {
         /// Return value of view \a x at position \a i
         int val(const Space& home, View x, int i);
         /// Whether dispose must always be called (that is, notice is needed)
-        bool notice(void) const;
+        bool notice() const;
         /// Delete value selection
         void dispose(Space& home);
     };
@@ -416,11 +416,11 @@ namespace Gecode { namespace Int { namespace Branch {
         int val(const Space& home, IntView x, int i);
     };
 
-}}} // namespace Gecode::Int::Branch
+} // namespace Gecode::Int::Branch
 
 #include 
 
-namespace Gecode { namespace Int { namespace Branch {
+namespace Gecode::Int::Branch {
 
     /// No-good literal for equality
     template 
@@ -498,11 +498,11 @@ namespace Gecode { namespace Int { namespace Branch {
         NGL* copy(Space& home) override;
     };
 
-}}} // namespace Gecode::Int::Branch
+} // namespace Gecode::Int::Branch
 
 #include 
 
-namespace Gecode { namespace Int { namespace Branch {
+namespace Gecode::Int::Branch {
 
     /**
      * \defgroup FuncIntValCommit Integer value commit classes
@@ -604,11 +604,11 @@ namespace Gecode { namespace Int { namespace Branch {
         void print(const Space& home, unsigned int a, View x, int i, int n, std::ostream& o) const;
     };
 
-}}} // namespace Gecode::Int::Branch
+} // namespace Gecode::Int::Branch
 
 #include 
 
-namespace Gecode { namespace Int { namespace Branch {
+namespace Gecode::Int::Branch {
 
     /// Return value and commit for integer views
     GECODE_INT_EXPORT
@@ -626,9 +626,9 @@ namespace Gecode { namespace Int { namespace Branch {
     GECODE_INT_EXPORT
     ValSelCommitBase* value_selection_commit(Space& home, const BoolAssign& ba);
 
-}}} // namespace Gecode::Int::Branch
+} // namespace Gecode::Int::Branch
 
-namespace Gecode { namespace Int { namespace Branch {
+namespace Gecode::Int::Branch {
 
     /**
      * \brief %Brancher by view and values selection
@@ -678,13 +678,13 @@ namespace Gecode { namespace Int { namespace Branch {
     void post_view_values_brancher(Home home, ViewArray& x, ViewSel* vs[n], IntBranchFilter bf,
                                    IntVarValPrint vvp);
 
-}}} // namespace Gecode::Int::Branch
+} // namespace Gecode::Int::Branch
 
 #include 
 
 #ifdef GECODE_HAS_CBS
 
-namespace Gecode { namespace Int { namespace Branch {
+namespace Gecode::Int::Branch {
 
     /**
      * \brief %Brancher using counting-based search
@@ -710,22 +710,21 @@ namespace Gecode { namespace Int { namespace Branch {
                 /// The map we want to share
                 std::unordered_map _var_id_to_pos;
 
-            public:
                 /// Default constructor
-                VarIdToPosO(void) = default;
+                VarIdToPosO() = default;
                 /// Delete implementation
-                ~VarIdToPosO(void) override = default;
+                ~VarIdToPosO() override = default;
             };
 
         public:
             /// Default constructor
-            VarIdToPos(void) = default;
+            VarIdToPos() = default;
             /// Allocation of the shared handle
-            void init(void);
+            void init();
             /// Tests if a variable id is in the map
             bool is_in(unsigned int var_id) const;
             /// Returns the position of the variable id in \a x
-            int operator[](unsigned int var_id) const;
+            int operator[](unsigned int i) const;
             /// Inserts a new position for a variable id
             void insert(unsigned int var_id, unsigned int pos);
         } var_id_to_pos;
@@ -761,7 +760,7 @@ namespace Gecode { namespace Int { namespace Branch {
          *
          * will have an entry in this map.
          */
-        std::unordered_map, std::equal_to,
+        std::unordered_map, std::equal_to<>,
                            space_allocator>>
             log_prop;
 
@@ -792,7 +791,7 @@ namespace Gecode { namespace Int { namespace Branch {
         bool in_brancher(unsigned int var_id) const;
     };
 
-}}} // namespace Gecode::Int::Branch
+} // namespace Gecode::Int::Branch
 
 #include 
 
diff --git a/gecode/int/branch/action.hpp b/gecode/int/branch/action.hpp
index af04d2a5b1..3c9777c5cf 100644
--- a/gecode/int/branch/action.hpp
+++ b/gecode/int/branch/action.hpp
@@ -32,15 +32,9 @@
 
 namespace Gecode {
 
-    forceinline IntAction&
-    IntAction::operator=(const IntAction& a) {
-        return static_cast(Action::operator=(a));
-    }
+    forceinline IntAction& IntAction::operator=(const IntAction& a) = default;
 
-    forceinline BoolAction&
-    BoolAction::operator=(const BoolAction& a) {
-        return static_cast(Action::operator=(a));
-    }
+    forceinline BoolAction& BoolAction::operator=(const BoolAction& a) = default;
 
 } // namespace Gecode
 
diff --git a/gecode/int/branch/assign.hpp b/gecode/int/branch/assign.hpp
index e39d895e66..a74c91ff96 100644
--- a/gecode/int/branch/assign.hpp
+++ b/gecode/int/branch/assign.hpp
@@ -45,22 +45,22 @@ namespace Gecode {
         : ValBranch(std::move(v), std::move(c)), s(SEL_VAL_COMMIT) {}
 
     forceinline IntAssign::Select
-    IntAssign::select(void) const {
+    IntAssign::select() const {
         return s;
     }
 
     inline IntAssign
-    INT_ASSIGN_MIN(void) {
+    INT_ASSIGN_MIN() {
         return IntAssign(IntAssign::SEL_MIN);
     }
 
     inline IntAssign
-    INT_ASSIGN_MED(void) {
+    INT_ASSIGN_MED() {
         return IntAssign(IntAssign::SEL_MED);
     }
 
     inline IntAssign
-    INT_ASSIGN_MAX(void) {
+    INT_ASSIGN_MAX() {
         return IntAssign(IntAssign::SEL_MAX);
     }
 
@@ -87,17 +87,17 @@ namespace Gecode {
         : ValBranch(std::move(v), std::move(c)), s(SEL_VAL_COMMIT) {}
 
     forceinline BoolAssign::Select
-    BoolAssign::select(void) const {
+    BoolAssign::select() const {
         return s;
     }
 
     inline BoolAssign
-    BOOL_ASSIGN_MIN(void) {
+    BOOL_ASSIGN_MIN() {
         return BoolAssign(BoolAssign::SEL_MIN);
     }
 
     inline BoolAssign
-    BOOL_ASSIGN_MAX(void) {
+    BOOL_ASSIGN_MAX() {
         return BoolAssign(BoolAssign::SEL_MAX);
     }
 
diff --git a/gecode/int/branch/cbs.hpp b/gecode/int/branch/cbs.hpp
index 71dc4b9c87..ea33a1d18e 100644
--- a/gecode/int/branch/cbs.hpp
+++ b/gecode/int/branch/cbs.hpp
@@ -32,7 +32,7 @@
 
 #ifdef GECODE_HAS_CBS
 
-namespace Gecode { namespace Int { namespace Branch {
+namespace Gecode::Int::Branch {
 
     template 
     forceinline void
@@ -215,8 +215,7 @@ namespace Gecode { namespace Int { namespace Branch {
         int val = pvc.val();
         if (a == 0)
             return me_failed(x[pos].eq(home, val)) ? ES_FAILED : ES_OK;
-        else
-            return me_failed(x[pos].nq(home, val)) ? ES_FAILED : ES_OK;
+        return me_failed(x[pos].nq(home, val)) ? ES_FAILED : ES_OK;
     }
 
     template 
@@ -230,7 +229,7 @@ namespace Gecode { namespace Int { namespace Branch {
             o << "x[" << pos << "] != " << val;
     }
 
-}}} // namespace Gecode::Int::Branch
+} // namespace Gecode::Int::Branch
 
 #endif
 
diff --git a/gecode/int/branch/chb.hpp b/gecode/int/branch/chb.hpp
index 63040c4ac0..78b1f8810a 100644
--- a/gecode/int/branch/chb.hpp
+++ b/gecode/int/branch/chb.hpp
@@ -32,15 +32,9 @@
 
 namespace Gecode {
 
-    forceinline IntCHB&
-    IntCHB::operator=(const IntCHB& chb) {
-        return static_cast(CHB::operator=(chb));
-    }
+    forceinline IntCHB& IntCHB::operator=(const IntCHB& chb) = default;
 
-    forceinline BoolCHB&
-    BoolCHB::operator=(const BoolCHB& chb) {
-        return static_cast(CHB::operator=(chb));
-    }
+    forceinline BoolCHB& BoolCHB::operator=(const BoolCHB& chb) = default;
 
 } // namespace Gecode
 
diff --git a/gecode/int/branch/merit.hpp b/gecode/int/branch/merit.hpp
index 0d74845f9c..221e52fcfb 100644
--- a/gecode/int/branch/merit.hpp
+++ b/gecode/int/branch/merit.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Branch {
+namespace Gecode::Int::Branch {
 
     // Minimum merit
     template 
@@ -108,7 +108,7 @@ namespace Gecode { namespace Int { namespace Branch {
     }
     template 
     forceinline bool
-    MeritAFCSize::notice(void) const {
+    MeritAFCSize::notice() const {
         return false;
     }
     template 
@@ -134,7 +134,7 @@ namespace Gecode { namespace Int { namespace Branch {
     }
     template 
     forceinline bool
-    MeritActionSize::notice(void) const {
+    MeritActionSize::notice() const {
         return true;
     }
     template 
@@ -159,7 +159,7 @@ namespace Gecode { namespace Int { namespace Branch {
     }
     template 
     forceinline bool
-    MeritCHBSize::notice(void) const {
+    MeritCHBSize::notice() const {
         return true;
     }
     template 
@@ -198,6 +198,6 @@ namespace Gecode { namespace Int { namespace Branch {
         return x.regret_max();
     }
 
-}}} // namespace Gecode::Int::Branch
+} // namespace Gecode::Int::Branch
 
 // STATISTICS: int-branch
diff --git a/gecode/int/branch/ngl.hpp b/gecode/int/branch/ngl.hpp
index 390233e6f0..529c28ce90 100644
--- a/gecode/int/branch/ngl.hpp
+++ b/gecode/int/branch/ngl.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Branch {
+namespace Gecode::Int::Branch {
 
     template 
     forceinline
@@ -50,8 +50,7 @@ namespace Gecode { namespace Int { namespace Branch {
     EqNGL::status(const Space&) const {
         if (x.assigned())
             return (x.val() == n) ? NGL::SUBSUMED : NGL::FAILED;
-        else
-            return x.in(n) ? NGL::NONE : NGL::FAILED;
+        return x.in(n) ? NGL::NONE : NGL::FAILED;
     }
     template 
     ExecStatus
@@ -77,8 +76,7 @@ namespace Gecode { namespace Int { namespace Branch {
     NqNGL::status(const Space&) const {
         if (x.assigned())
             return (x.val() == n) ? NGL::FAILED : NGL::SUBSUMED;
-        else
-            return x.in(n) ? NGL::NONE : NGL::SUBSUMED;
+        return x.in(n) ? NGL::NONE : NGL::SUBSUMED;
     }
     template 
     ExecStatus
@@ -104,10 +102,9 @@ namespace Gecode { namespace Int { namespace Branch {
     LqNGL::status(const Space&) const {
         if (x.max() <= n)
             return NGL::SUBSUMED;
-        else if (x.min() > n)
+        if (x.min() > n)
             return NGL::FAILED;
-        else
-            return NGL::NONE;
+        return NGL::NONE;
     }
     template 
     ExecStatus
@@ -133,10 +130,9 @@ namespace Gecode { namespace Int { namespace Branch {
     GqNGL::status(const Space&) const {
         if (x.min() >= n)
             return NGL::SUBSUMED;
-        else if (x.max() < n)
+        if (x.max() < n)
             return NGL::FAILED;
-        else
-            return NGL::NONE;
+        return NGL::NONE;
     }
     template 
     ExecStatus
@@ -144,6 +140,6 @@ namespace Gecode { namespace Int { namespace Branch {
         return me_failed(x.le(home, n)) ? ES_FAILED : ES_OK;
     }
 
-}}} // namespace Gecode::Int::Branch
+} // namespace Gecode::Int::Branch
 
 // STATISTICS: int-branch
diff --git a/gecode/int/branch/open.hpp b/gecode/int/branch/open.hpp
index 0ef2a46002..4e33dd416a 100644
--- a/gecode/int/branch/open.hpp
+++ b/gecode/int/branch/open.hpp
@@ -35,13 +35,13 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Branch {
+namespace Gecode::Int::Branch {
 
     /// Standard view/value selectors over the materialized prefix
     template 
     class OpenListBrancher : public Brancher {
     protected:
-        typedef typename View::VarType Var;
+        using Var = View::VarType;
         OpenViewList list;
         ViewSel* vs[n];
         /// Binary value selector, or null for one alternative per domain value
@@ -341,7 +341,7 @@ namespace Gecode { namespace Int { namespace Branch {
         while ((n < 4) && (selectors[n - 1].select() != VarBranch::SEL_NONE) &&
                (selectors[n - 1].select() != VarBranch::SEL_RND) && (selectors[n].select() != VarBranch::SEL_NONE))
             n++;
-        typedef typename View::VarType Var;
+        using Var = View::VarType;
         typename ArrayTraits>::ArgsType x(list.known_length());
         for (int i = 0; i < x.size(); i++)
             x[i] = list[i];
@@ -367,7 +367,7 @@ namespace Gecode { namespace Int { namespace Branch {
         }
     }
 
-}}} // namespace Gecode::Int::Branch
+} // namespace Gecode::Int::Branch
 
 #endif
 
diff --git a/gecode/int/branch/traits.hpp b/gecode/int/branch/traits.hpp
index 24980c1813..50e434b25f 100644
--- a/gecode/int/branch/traits.hpp
+++ b/gecode/int/branch/traits.hpp
@@ -37,15 +37,15 @@ namespace Gecode {
     class BranchTraits {
     public:
         /// Type for the branching filter function
-        typedef IntBranchFilter Filter;
+        using Filter = IntBranchFilter;
         /// Type for the branching merit function
-        typedef IntBranchMerit Merit;
+        using Merit = IntBranchMerit;
         /// Type for the branching value function
-        typedef IntBranchVal Val;
+        using Val = IntBranchVal;
         /// Return type of the branching value function
-        typedef int ValType;
+        using ValType = int;
         /// Type for the branching commit function
-        typedef IntBranchCommit Commit;
+        using Commit = IntBranchCommit;
     };
 
     /// Traits of %BoolVar for branching
@@ -53,15 +53,15 @@ namespace Gecode {
     class BranchTraits {
     public:
         /// Type for the branching filter function
-        typedef BoolBranchFilter Filter;
+        using Filter = BoolBranchFilter;
         /// Type for the branching merit function
-        typedef BoolBranchMerit Merit;
+        using Merit = BoolBranchMerit;
         /// Type for the branching value function
-        typedef BoolBranchVal Val;
+        using Val = BoolBranchVal;
         /// Return type of the branching value function
-        typedef int ValType;
+        using ValType = int;
         /// Type for the branching commit function
-        typedef BoolBranchCommit Commit;
+        using Commit = BoolBranchCommit;
     };
 
 } // namespace Gecode
diff --git a/gecode/int/branch/val-commit.hpp b/gecode/int/branch/val-commit.hpp
index 2400a3d5ee..e1c33f8541 100644
--- a/gecode/int/branch/val-commit.hpp
+++ b/gecode/int/branch/val-commit.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Branch {
+namespace Gecode::Int::Branch {
 
     template 
     forceinline
@@ -50,8 +50,7 @@ namespace Gecode { namespace Int { namespace Branch {
     ValCommitEq::ngl(Space& home, unsigned int a, View x, int n) const {
         if (a == 0)
             return new (home) EqNGL(home, x, n);
-        else
-            return nullptr;
+        return nullptr;
     }
     template 
     forceinline void
@@ -77,8 +76,7 @@ namespace Gecode { namespace Int { namespace Branch {
     ValCommitLq::ngl(Space& home, unsigned int a, View x, int n) const {
         if (a == 0)
             return new (home) LqNGL(home, x, n);
-        else
-            return nullptr;
+        return nullptr;
     }
     template 
     forceinline void
@@ -104,8 +102,7 @@ namespace Gecode { namespace Int { namespace Branch {
     ValCommitGq::ngl(Space& home, unsigned int a, View x, int n) const {
         if (a == 0)
             return new (home) GqNGL(home, x, n);
-        else
-            return nullptr;
+        return nullptr;
     }
     template 
     forceinline void
@@ -131,8 +128,7 @@ namespace Gecode { namespace Int { namespace Branch {
     ValCommitGr::ngl(Space& home, unsigned int a, View x, int n) const {
         if (a == 0)
             return new (home) GqNGL(home, x, n + 1);
-        else
-            return nullptr;
+        return nullptr;
     }
     template 
     forceinline void
@@ -140,6 +136,6 @@ namespace Gecode { namespace Int { namespace Branch {
         o << "var[" << i << "] " << ((a == 0) ? ">" : "<=") << " " << n;
     }
 
-}}} // namespace Gecode::Int::Branch
+} // namespace Gecode::Int::Branch
 
 // STATISTICS: int-branch
diff --git a/gecode/int/branch/val-sel-commit.cpp b/gecode/int/branch/val-sel-commit.cpp
index 72e0796602..3a4809c025 100644
--- a/gecode/int/branch/val-sel-commit.cpp
+++ b/gecode/int/branch/val-sel-commit.cpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Branch {
+namespace Gecode::Int::Branch {
 
     ValSelCommitBase*
     value_selection_commit(Space& home, const IntValBranch& ivb) {
@@ -127,6 +127,6 @@ namespace Gecode { namespace Int { namespace Branch {
         }
     }
 
-}}} // namespace Gecode::Int::Branch
+} // namespace Gecode::Int::Branch
 
 // STATISTICS: int-branch
diff --git a/gecode/int/branch/val-sel.hpp b/gecode/int/branch/val-sel.hpp
index 258193c933..ab64e3cd5b 100644
--- a/gecode/int/branch/val-sel.hpp
+++ b/gecode/int/branch/val-sel.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Branch {
+namespace Gecode::Int::Branch {
 
     template 
     forceinline
@@ -111,8 +111,8 @@ namespace Gecode { namespace Int { namespace Branch {
     }
     template 
     forceinline bool
-    ValSelRnd::notice(void) const {
-        return !std::is_trivially_destructible::value;
+    ValSelRnd::notice() const {
+        return !std::is_trivially_destructible_v;
     }
     template 
     forceinline void
@@ -130,10 +130,9 @@ namespace Gecode { namespace Int { namespace Branch {
     ValSelRangeMin::val(const Space&, IntView x, int) {
         if (x.range()) {
             return (x.width() == 2) ? x.min() : (x.min() + (x.max() - x.min()) / 2);
-        } else {
-            ViewRanges r(x);
-            return r.max();
         }
+        ViewRanges r(x);
+        return r.max();
     }
 
     forceinline
@@ -146,17 +145,16 @@ namespace Gecode { namespace Int { namespace Branch {
     ValSelRangeMax::val(const Space&, IntView x, int) {
         if (x.range()) {
             return (x.width() == 2) ? x.max() : (x.max() - (x.max() - x.min()) / 2);
-        } else {
-            int min;
-            ViewRanges r(x);
-            do {
-                min = r.min();
-                ++r;
-            } while (r());
-            return min;
         }
+        int min;
+        ViewRanges r(x);
+        do {
+            min = r.min();
+            ++r;
+        } while (r());
+        return min;
     }
 
-}}} // namespace Gecode::Int::Branch
+} // namespace Gecode::Int::Branch
 
 // STATISTICS: int-branch
diff --git a/gecode/int/branch/val.hpp b/gecode/int/branch/val.hpp
index 2423fdcd18..6cb4b02cd0 100644
--- a/gecode/int/branch/val.hpp
+++ b/gecode/int/branch/val.hpp
@@ -45,22 +45,22 @@ namespace Gecode {
         : ValBranch(std::move(v), std::move(c)), s(SEL_VAL_COMMIT) {}
 
     forceinline IntValBranch::Select
-    IntValBranch::select(void) const {
+    IntValBranch::select() const {
         return s;
     }
 
     inline IntValBranch
-    INT_VAL_MIN(void) {
+    INT_VAL_MIN() {
         return IntValBranch(IntValBranch::SEL_MIN);
     }
 
     inline IntValBranch
-    INT_VAL_MED(void) {
+    INT_VAL_MED() {
         return IntValBranch(IntValBranch::SEL_MED);
     }
 
     inline IntValBranch
-    INT_VAL_MAX(void) {
+    INT_VAL_MAX() {
         return IntValBranch(IntValBranch::SEL_MAX);
     }
 
@@ -70,22 +70,22 @@ namespace Gecode {
     }
 
     inline IntValBranch
-    INT_VAL_SPLIT_MIN(void) {
+    INT_VAL_SPLIT_MIN() {
         return IntValBranch(IntValBranch::SEL_SPLIT_MIN);
     }
 
     inline IntValBranch
-    INT_VAL_SPLIT_MAX(void) {
+    INT_VAL_SPLIT_MAX() {
         return IntValBranch(IntValBranch::SEL_SPLIT_MAX);
     }
 
     inline IntValBranch
-    INT_VAL_RANGE_MIN(void) {
+    INT_VAL_RANGE_MIN() {
         return IntValBranch(IntValBranch::SEL_RANGE_MIN);
     }
 
     inline IntValBranch
-    INT_VAL_RANGE_MAX(void) {
+    INT_VAL_RANGE_MAX() {
         return IntValBranch(IntValBranch::SEL_RANGE_MAX);
     }
 
@@ -95,12 +95,12 @@ namespace Gecode {
     }
 
     inline IntValBranch
-    INT_VALUES_MIN(void) {
+    INT_VALUES_MIN() {
         return IntValBranch(IntValBranch::SEL_VALUES_MIN);
     }
 
     inline IntValBranch
-    INT_VALUES_MAX(void) {
+    INT_VALUES_MAX() {
         return IntValBranch(IntValBranch::SEL_VALUES_MAX);
     }
 
@@ -117,17 +117,17 @@ namespace Gecode {
         : ValBranch(std::move(v), std::move(c)), s(SEL_VAL_COMMIT) {}
 
     forceinline BoolValBranch::Select
-    BoolValBranch::select(void) const {
+    BoolValBranch::select() const {
         return s;
     }
 
     inline BoolValBranch
-    BOOL_VAL_MIN(void) {
+    BOOL_VAL_MIN() {
         return BoolValBranch(BoolValBranch::SEL_MIN);
     }
 
     inline BoolValBranch
-    BOOL_VAL_MAX(void) {
+    BOOL_VAL_MAX() {
         return BoolValBranch(BoolValBranch::SEL_MAX);
     }
 
diff --git a/gecode/int/branch/var.hpp b/gecode/int/branch/var.hpp
index ac0ddb5125..19acf339cb 100644
--- a/gecode/int/branch/var.hpp
+++ b/gecode/int/branch/var.hpp
@@ -35,7 +35,7 @@
 namespace Gecode {
 
     forceinline
-    IntVarBranch::IntVarBranch(void)
+    IntVarBranch::IntVarBranch()
         : s(SEL_NONE) {}
 
     forceinline
@@ -67,7 +67,7 @@ namespace Gecode {
         : VarBranch(std::move(mf), std::move(t)), s(s0) {}
 
     forceinline IntVarBranch::Select
-    IntVarBranch::select(void) const {
+    IntVarBranch::select() const {
         return s;
     }
 
@@ -100,7 +100,7 @@ namespace Gecode {
     }
 
     inline IntVarBranch
-    INT_VAR_NONE(void) {
+    INT_VAR_NONE() {
         return IntVarBranch(IntVarBranch::SEL_NONE, nullptr);
     }
 
@@ -310,7 +310,7 @@ namespace Gecode {
     }
 
     forceinline
-    BoolVarBranch::BoolVarBranch(void)
+    BoolVarBranch::BoolVarBranch()
         : s(SEL_NONE) {}
 
     forceinline
@@ -342,7 +342,7 @@ namespace Gecode {
         : VarBranch(std::move(mf), std::move(t)), s(s0) {}
 
     forceinline BoolVarBranch::Select
-    BoolVarBranch::select(void) const {
+    BoolVarBranch::select() const {
         return s;
     }
 
@@ -369,7 +369,7 @@ namespace Gecode {
     }
 
     inline BoolVarBranch
-    BOOL_VAR_NONE(void) {
+    BOOL_VAR_NONE() {
         return BoolVarBranch(BoolVarBranch::SEL_NONE, nullptr);
     }
 
diff --git a/gecode/int/branch/view-sel.cpp b/gecode/int/branch/view-sel.cpp
index fa6527cc96..f1de3c4785 100644
--- a/gecode/int/branch/view-sel.cpp
+++ b/gecode/int/branch/view-sel.cpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Branch {
+namespace Gecode::Int::Branch {
 
     ViewSel*
     view_selection(Space& home, const IntVarBranch& ivb) {
@@ -236,6 +236,6 @@ namespace Gecode { namespace Int { namespace Branch {
         return nullptr;
     }
 
-}}} // namespace Gecode::Int::Branch
+} // namespace Gecode::Int::Branch
 
 // STATISTICS: int-branch
diff --git a/gecode/int/branch/view-values.cpp b/gecode/int/branch/view-values.cpp
index 861fd642dd..7604fcceae 100644
--- a/gecode/int/branch/view-values.cpp
+++ b/gecode/int/branch/view-values.cpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Branch {
+namespace Gecode::Int::Branch {
 
     PosValuesChoice::PosValuesChoice(const Brancher& b, const Pos& p, IntView x) : PosChoice(b, x.size(), p), n(0) {
         for (ViewRanges r(x); r(); ++r)
@@ -59,7 +59,7 @@ namespace Gecode { namespace Int { namespace Branch {
         }
     }
 
-    PosValuesChoice::~PosValuesChoice(void) {
+    PosValuesChoice::~PosValuesChoice() {
         heap.free(pm, n + 1);
     }
 
@@ -73,6 +73,6 @@ namespace Gecode { namespace Int { namespace Branch {
         }
     }
 
-}}} // namespace Gecode::Int::Branch
+} // namespace Gecode::Int::Branch
 
 // STATISTICS: int-branch
diff --git a/gecode/int/branch/view-values.hpp b/gecode/int/branch/view-values.hpp
index c2ddf70e74..efb6021cf7 100644
--- a/gecode/int/branch/view-values.hpp
+++ b/gecode/int/branch/view-values.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Branch {
+namespace Gecode::Int::Branch {
 
     /// %Choice storing position and values for integer views
     class GECODE_VTABLE_EXPORT PosValuesChoice : public PosChoice {
@@ -59,7 +59,7 @@ namespace Gecode { namespace Int { namespace Branch {
         int val(unsigned int a) const;
         /// Deallocate
         GECODE_INT_EXPORT
-        ~PosValuesChoice(void) override;
+        ~PosValuesChoice() override;
         /// Archive into \a e
         GECODE_INT_EXPORT
         void archive(Archive& e) const override;
@@ -195,6 +195,6 @@ namespace Gecode { namespace Int { namespace Branch {
         }
     }
 
-}}} // namespace Gecode::Int::Branch
+} // namespace Gecode::Int::Branch
 
 // STATISTICS: int-branch
diff --git a/gecode/int/channel.hh b/gecode/int/channel.hh
index ba6ccef443..d83cebf338 100644
--- a/gecode/int/channel.hh
+++ b/gecode/int/channel.hh
@@ -41,10 +41,10 @@
  * \brief %Channel propagators
  */
 
-namespace Gecode { namespace Int { namespace Channel {
+namespace Gecode::Int::Channel {
 
     /// Processing stack
-    typedef Support::StaticStack ProcessStack;
+    using ProcessStack = Support::StaticStack;
 
     /**
      * \brief Base-class for channel propagators
@@ -239,7 +239,7 @@ namespace Gecode { namespace Int { namespace Channel {
         size_t dispose(Space& home) override;
     };
 
-}}} // namespace Gecode::Int::Channel
+} // namespace Gecode::Int::Channel
 
 #include 
 #include 
diff --git a/gecode/int/channel/base.hpp b/gecode/int/channel/base.hpp
index a6937a231f..f45e4fd4ed 100644
--- a/gecode/int/channel/base.hpp
+++ b/gecode/int/channel/base.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Channel {
+namespace Gecode::Int::Channel {
 
     template 
     forceinline
@@ -72,6 +72,6 @@ namespace Gecode { namespace Int { namespace Channel {
         return sizeof(*this);
     }
 
-}}} // namespace Gecode::Int::Channel
+} // namespace Gecode::Int::Channel
 
 // STATISTICS: int-prop
diff --git a/gecode/int/channel/dom.hpp b/gecode/int/channel/dom.hpp
index 481987af0f..903d7ff424 100644
--- a/gecode/int/channel/dom.hpp
+++ b/gecode/int/channel/dom.hpp
@@ -34,7 +34,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Channel {
+namespace Gecode::Int::Channel {
 
     /**
      * \brief Combine view with information for domain propagation
@@ -54,13 +54,13 @@ namespace Gecode { namespace Int { namespace Channel {
         /// Initialize
         void init(View x, int n);
         /// Update during cloning
-        void update(Space& home, DomInfo& vcb);
+        void update(Space& home, DomInfo& di);
         /// Check whether propagation for assignment is to be done
-        bool doval(void) const;
+        bool doval() const;
         /// Check whether propagation for domain is to be done
-        bool dodom(void) const;
+        bool dodom() const;
         /// Record that view got assigned
-        void assigned(void);
+        void assigned();
         /// Record that one value got removed
         void removed(int i);
         /// Update the size and bounds information after pruning
@@ -87,19 +87,19 @@ namespace Gecode { namespace Int { namespace Channel {
 
     template 
     forceinline bool
-    DomInfo::doval(void) const {
+    DomInfo::doval() const {
         return (size != 1) && view.assigned();
     }
 
     template 
     forceinline bool
-    DomInfo::dodom(void) const {
+    DomInfo::dodom() const {
         return size != view.size();
     }
 
     template 
     forceinline void
-    DomInfo::assigned(void) {
+    DomInfo::assigned() {
         size = 1;
     }
 
@@ -181,8 +181,7 @@ namespace Gecode { namespace Int { namespace Channel {
     Dom::cost(const Space&, const ModEventDelta& med) const {
         if (View::me(med) == ME_INT_VAL)
             return PropCost::quadratic(PropCost::LO, 2 * n);
-        else
-            return PropCost::quadratic(PropCost::HI, 2 * n);
+        return PropCost::quadratic(PropCost::HI, 2 * n);
     }
 
     template 
@@ -217,18 +216,15 @@ namespace Gecode { namespace Int { namespace Channel {
                     assert(ya.empty());
                 } while (!xa.empty() || !ya.empty());
                 return home.ES_NOFIX_PARTIAL(*this, View::med(ME_INT_DOM));
-            } else {
-                do {
-                    // Propagate assigned views for x
-                    GECODE_ES_CHECK(
-                        (prop_val>(home, n, x, ox, y, oy, n_na, xa, ya)));
-                    // Propagate assigned views for y
-                    GECODE_ES_CHECK(
-                        (prop_val>(home, n, y, oy, x, ox, n_na, ya, xa)));
-                    assert(ya.empty());
-                } while (!xa.empty());
-                return home.ES_FIX_PARTIAL(*this, View::med(ME_INT_DOM));
             }
+            do {
+                // Propagate assigned views for x
+                GECODE_ES_CHECK((prop_val>(home, n, x, ox, y, oy, n_na, xa, ya)));
+                // Propagate assigned views for y
+                GECODE_ES_CHECK((prop_val>(home, n, y, oy, x, ox, n_na, ya, xa)));
+                assert(ya.empty());
+            } while (!xa.empty());
+            return home.ES_FIX_PARTIAL(*this, View::med(ME_INT_DOM));
         }
 
         // Process changed views for y
@@ -291,9 +287,8 @@ namespace Gecode { namespace Int { namespace Channel {
                 if (!xy[i].view.assigned())
                     return ES_NOFIX;
             return home.ES_SUBSUMED(*this);
-        } else {
-            return (n_na == 0) ? home.ES_SUBSUMED(*this) : ES_FIX;
         }
+        return (n_na == 0) ? home.ES_SUBSUMED(*this) : ES_FIX;
     }
 
     template 
@@ -315,6 +310,6 @@ namespace Gecode { namespace Int { namespace Channel {
         return ES_OK;
     }
 
-}}} // namespace Gecode::Int::Channel
+} // namespace Gecode::Int::Channel
 
 // STATISTICS: int-prop
diff --git a/gecode/int/channel/link-multi.cpp b/gecode/int/channel/link-multi.cpp
index c13a4eda7b..950e3a5575 100644
--- a/gecode/int/channel/link-multi.cpp
+++ b/gecode/int/channel/link-multi.cpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Channel {
+namespace Gecode::Int::Channel {
 
     /// Iterates the values to be removed as defined by an array of Boolean views
     class BoolIter {
@@ -48,11 +48,11 @@ namespace Gecode { namespace Int { namespace Channel {
         /// Initialize iterator
         BoolIter(const ViewArray& x0, int o0);
         /// Test whether further values available
-        bool operator()(void) const;
+        bool operator()() const;
         /// Return value
-        int val(void) const;
+        int val() const;
         /// Move to the next value
-        void operator++(void);
+        void operator++();
     };
 
     forceinline
@@ -62,16 +62,16 @@ namespace Gecode { namespace Int { namespace Channel {
             i++;
     }
     forceinline bool
-    BoolIter::operator()(void) const {
+    BoolIter::operator()() const {
         return i < x.size();
     }
     forceinline int
-    BoolIter::val(void) const {
+    BoolIter::val() const {
         assert(x[i].zero());
         return i + o;
     }
     forceinline void
-    BoolIter::operator++(void) {
+    BoolIter::operator++() {
         do {
             i++;
         } while ((i < x.size()) && !x[i].zero());
@@ -95,8 +95,7 @@ namespace Gecode { namespace Int { namespace Channel {
     LinkMulti::cost(const Space&, const ModEventDelta& med) const {
         if ((status == S_ONE) || (IntView::me(med) == ME_INT_VAL))
             return PropCost::unary(PropCost::LO);
-        else
-            return PropCost::linear(PropCost::LO, x.size());
+        return PropCost::linear(PropCost::LO, x.size());
     }
 
     void
@@ -237,6 +236,6 @@ namespace Gecode { namespace Int { namespace Channel {
         return ES_FIX;
     }
 
-}}} // namespace Gecode::Int::Channel
+} // namespace Gecode::Int::Channel
 
 // STATISTICS: int-prop
diff --git a/gecode/int/channel/link-multi.hpp b/gecode/int/channel/link-multi.hpp
index 1b5c0e9326..43b699af3b 100644
--- a/gecode/int/channel/link-multi.hpp
+++ b/gecode/int/channel/link-multi.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Channel {
+namespace Gecode::Int::Channel {
 
     forceinline
     LinkMulti::LinkMulti(Home home, ViewArray& x, IntView y, int o0)
@@ -80,6 +80,6 @@ namespace Gecode { namespace Int { namespace Channel {
         return ES_OK;
     }
 
-}}} // namespace Gecode::Int::Channel
+} // namespace Gecode::Int::Channel
 
 // STATISTICS: int-prop
diff --git a/gecode/int/channel/link-single.cpp b/gecode/int/channel/link-single.cpp
index ca0e9c399c..18ae350e87 100644
--- a/gecode/int/channel/link-single.cpp
+++ b/gecode/int/channel/link-single.cpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Channel {
+namespace Gecode::Int::Channel {
 
     forceinline
     LinkSingle::LinkSingle(Space& home, LinkSingle& p)
@@ -66,6 +66,6 @@ namespace Gecode { namespace Int { namespace Channel {
         return home.ES_SUBSUMED(*this);
     }
 
-}}} // namespace Gecode::Int::Channel
+} // namespace Gecode::Int::Channel
 
 // STATISTICS: int-prop
diff --git a/gecode/int/channel/link-single.hpp b/gecode/int/channel/link-single.hpp
index 9bd98e482c..5e8e7a8267 100644
--- a/gecode/int/channel/link-single.hpp
+++ b/gecode/int/channel/link-single.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Channel {
+namespace Gecode::Int::Channel {
 
     forceinline
     LinkSingle::LinkSingle(Home home, BoolView x0, IntView x1)
@@ -61,6 +61,6 @@ namespace Gecode { namespace Int { namespace Channel {
         return ES_OK;
     }
 
-}}} // namespace Gecode::Int::Channel
+} // namespace Gecode::Int::Channel
 
 // STATISTICS: int-prop
diff --git a/gecode/int/channel/val.hpp b/gecode/int/channel/val.hpp
index fc08481bf3..aa246cba4a 100644
--- a/gecode/int/channel/val.hpp
+++ b/gecode/int/channel/val.hpp
@@ -34,7 +34,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Channel {
+namespace Gecode::Int::Channel {
 
     /**
      * \brief Combine view with information for value propagation
@@ -52,15 +52,15 @@ namespace Gecode { namespace Int { namespace Channel {
         /// Update during cloning
         void update(Space& home, ValInfo& vi);
         /// Check whether propagation for assignment is to be done
-        bool doval(void) const;
+        bool doval() const;
         /// Check whether propagation for domain is to be done
-        bool dodom(void) const;
+        bool dodom() const;
         /// Record that view got assigned
-        void assigned(void);
+        void assigned();
         /// Record that one value got removed
         void removed(int i);
         /// Update the cardinality and bounds information after pruning
-        void done(void);
+        void done();
     };
 
     template 
@@ -79,19 +79,19 @@ namespace Gecode { namespace Int { namespace Channel {
 
     template 
     forceinline bool
-    ValInfo::doval(void) const {
+    ValInfo::doval() const {
         return !a && view.assigned();
     }
 
     template 
     forceinline bool
-    ValInfo::dodom(void) const {
+    ValInfo::dodom() const {
         return false;
     }
 
     template 
     forceinline void
-    ValInfo::assigned(void) {
+    ValInfo::assigned() {
         a = true;
     }
 
@@ -101,7 +101,7 @@ namespace Gecode { namespace Int { namespace Channel {
 
     template 
     forceinline void
-    ValInfo::done(void) {}
+    ValInfo::done() {}
 
     // Propagate assigned views for x
     template 
@@ -243,6 +243,6 @@ namespace Gecode { namespace Int { namespace Channel {
         return ES_OK;
     }
 
-}}} // namespace Gecode::Int::Channel
+} // namespace Gecode::Int::Channel
 
 // STATISTICS: int-prop
diff --git a/gecode/int/circuit.cpp b/gecode/int/circuit.cpp
index 9e2db34c85..9a21a0aabe 100644
--- a/gecode/int/circuit.cpp
+++ b/gecode/int/circuit.cpp
@@ -47,7 +47,7 @@ namespace Gecode {
         ViewArray xv(home, x);
 
         if (offset == 0) {
-            typedef Int::NoOffset NOV;
+            using NOV = Int::NoOffset;
             NOV no;
             if (vbd(ipl) == IPL_DOM) {
                 GECODE_ES_FAIL((Int::Circuit::Dom::post(home, xv, no)));
@@ -55,7 +55,7 @@ namespace Gecode {
                 GECODE_ES_FAIL((Int::Circuit::Val::post(home, xv, no)));
             }
         } else {
-            typedef Int::Offset OV;
+            using OV = Int::Offset;
             OV off(-offset);
             if (vbd(ipl) == IPL_DOM) {
                 GECODE_ES_FAIL((Int::Circuit::Dom::post(home, xv, off)));
@@ -124,7 +124,7 @@ namespace Gecode {
 
         if (offset == 0) {
             element(home, x, e, n);
-            typedef Int::NoOffset NOV;
+            using NOV = Int::NoOffset;
             NOV no;
             if (vbd(ipl) == IPL_DOM) {
                 GECODE_ES_FAIL((Int::Circuit::Dom::post(home, xv, no)));
@@ -139,7 +139,7 @@ namespace Gecode {
             for (int i = 0; i < n; i++)
                 ox[offset + i] = x[i];
             element(home, ox, e, offset + n);
-            typedef Int::Offset OV;
+            using OV = Int::Offset;
             OV off(-offset);
             if (vbd(ipl) == IPL_DOM) {
                 GECODE_ES_FAIL((Int::Circuit::Dom::post(home, xv, off)));
diff --git a/gecode/int/circuit.hh b/gecode/int/circuit.hh
index b37bb28b58..2ff7eb9d12 100644
--- a/gecode/int/circuit.hh
+++ b/gecode/int/circuit.hh
@@ -41,7 +41,7 @@
  * \brief %Circuit propagators
  */
 
-namespace Gecode { namespace Int { namespace Circuit {
+namespace Gecode::Int::Circuit {
 
     /**
      * \brief Base-class for circuit propagator
@@ -151,7 +151,7 @@ namespace Gecode { namespace Int { namespace Circuit {
         static ExecStatus post(Home home, ViewArray& x, Offset& o);
     };
 
-}}} // namespace Gecode::Int::Circuit
+} // namespace Gecode::Int::Circuit
 
 #include 
 #include 
diff --git a/gecode/int/circuit/base.hpp b/gecode/int/circuit/base.hpp
index f990320fa8..f9bb3d008f 100644
--- a/gecode/int/circuit/base.hpp
+++ b/gecode/int/circuit/base.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Circuit {
+namespace Gecode::Int::Circuit {
 
     template 
     forceinline
@@ -85,7 +85,7 @@ namespace Gecode { namespace Int { namespace Circuit {
 
         /// Information needed for checking scc's
         Region r;
-        typedef typename Offset::ViewType OView;
+        using OView = Offset::ViewType;
         NodeInfo* si = r.alloc>(n);
         unsigned int n_edges = 0;
         for (int i = 0; i < n; i++) {
@@ -247,7 +247,7 @@ namespace Gecode { namespace Int { namespace Circuit {
         // A stack that records all indices i such that end[i] != -1
         Support::StaticStack tell(r, n);
 
-        typedef typename Offset::ViewType OView;
+        using OView = Offset::ViewType;
         for (int i = 0; i < y.size(); i++) {
             assert(!y[i].assigned());
             // Non-assigned views serve as starting points for assigned paths
@@ -292,6 +292,6 @@ namespace Gecode { namespace Int { namespace Circuit {
         return sizeof(*this);
     }
 
-}}} // namespace Gecode::Int::Circuit
+} // namespace Gecode::Int::Circuit
 
 // STATISTICS: int-prop
diff --git a/gecode/int/circuit/dom.hpp b/gecode/int/circuit/dom.hpp
index 1e449bf4a7..0995232481 100644
--- a/gecode/int/circuit/dom.hpp
+++ b/gecode/int/circuit/dom.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Circuit {
+namespace Gecode::Int::Circuit {
 
     /*
      * The actual propagator
@@ -57,8 +57,7 @@ namespace Gecode { namespace Int { namespace Circuit {
     Dom::cost(const Space&, const ModEventDelta& med) const {
         if (View::me(med) == Int::ME_INT_VAL)
             return PropCost::linear(PropCost::LO, x.size());
-        else
-            return PropCost::quadratic(PropCost::HI, x.size());
+        return PropCost::quadratic(PropCost::HI, x.size());
     }
 
     template 
@@ -128,6 +127,6 @@ namespace Gecode { namespace Int { namespace Circuit {
         return ES_OK;
     }
 
-}}} // namespace Gecode::Int::Circuit
+} // namespace Gecode::Int::Circuit
 
 // STATISTICS: int-prop
diff --git a/gecode/int/circuit/val.hpp b/gecode/int/circuit/val.hpp
index 8969737ca0..b61332e8a6 100644
--- a/gecode/int/circuit/val.hpp
+++ b/gecode/int/circuit/val.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Circuit {
+namespace Gecode::Int::Circuit {
 
     /*
      * The actual propagator
@@ -94,6 +94,6 @@ namespace Gecode { namespace Int { namespace Circuit {
         return ES_OK;
     }
 
-}}} // namespace Gecode::Int::Circuit
+} // namespace Gecode::Int::Circuit
 
 // STATISTICS: int-prop
diff --git a/gecode/int/count.hh b/gecode/int/count.hh
index ba75ccd5a2..a4b157d676 100644
--- a/gecode/int/count.hh
+++ b/gecode/int/count.hh
@@ -42,7 +42,7 @@
  * \brief Counting propagators
  */
 
-namespace Gecode { namespace Int { namespace Count {
+namespace Gecode::Int::Count {
 
     /**
      * Relations for domain consistent counting
@@ -122,11 +122,11 @@ namespace Gecode { namespace Int { namespace Count {
     ExecStatus prune(Home home, ViewArray& x, const IntSet& y);
     //@}
 
-}}} // namespace Gecode::Int::Count
+} // namespace Gecode::Int::Count
 
 #include 
 
-namespace Gecode { namespace Int { namespace Count {
+namespace Gecode::Int::Count {
 
     /**
      * \brief Baseclass for count propagators (integer)
@@ -250,14 +250,14 @@ namespace Gecode { namespace Int { namespace Count {
         static ExecStatus post(Home home, ViewArray& x, const VY& y, int c);
     };
 
-}}} // namespace Gecode::Int::Count
+} // namespace Gecode::Int::Count
 
 #include 
 #include 
 #include 
 #include 
 
-namespace Gecode { namespace Int { namespace Count {
+namespace Gecode::Int::Count {
 
     /**
      * \brief Base-class for count propagators (view)
@@ -291,9 +291,9 @@ namespace Gecode { namespace Int { namespace Count {
         /// Count how many views are equal now
         void count(Space& home);
         /// How many views are at least equal
-        int at_least(void) const;
+        int at_least() const;
         /// How many views are at most equal
-        int at_most(void) const;
+        int at_most() const;
         /// Test whether there is sharing of \a z with \a x or \a y
         static bool sharing(const ViewArray& x, const VY& y, const VZ& z);
     };
@@ -406,7 +406,7 @@ namespace Gecode { namespace Int { namespace Count {
         static ExecStatus post(Home home, ViewArray& x, const VY& y, VZ z, int c);
     };
 
-}}} // namespace Gecode::Int::Count
+} // namespace Gecode::Int::Count
 
 #include 
 #include 
diff --git a/gecode/int/count/int-base.hpp b/gecode/int/count/int-base.hpp
index a5c53c698d..6f39530e1e 100644
--- a/gecode/int/count/int-base.hpp
+++ b/gecode/int/count/int-base.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Count {
+namespace Gecode::Int::Count {
 
     template 
     forceinline
@@ -77,6 +77,6 @@ namespace Gecode { namespace Int { namespace Count {
         Gecode::Int::Count::reschedule(home, *this, y);
     }
 
-}}} // namespace Gecode::Int::Count
+} // namespace Gecode::Int::Count
 
 // STATISTICS: int-prop
diff --git a/gecode/int/count/int-eq.hpp b/gecode/int/count/int-eq.hpp
index 8ee4f410ca..22e7751ac0 100644
--- a/gecode/int/count/int-eq.hpp
+++ b/gecode/int/count/int-eq.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Count {
+namespace Gecode::Int::Count {
 
     template 
     forceinline
@@ -146,6 +146,6 @@ namespace Gecode { namespace Int { namespace Count {
         return ES_FIX;
     }
 
-}}} // namespace Gecode::Int::Count
+} // namespace Gecode::Int::Count
 
 // STATISTICS: int-prop
diff --git a/gecode/int/count/int-gq.hpp b/gecode/int/count/int-gq.hpp
index c4b7b79d97..21659ff5c1 100644
--- a/gecode/int/count/int-gq.hpp
+++ b/gecode/int/count/int-gq.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Count {
+namespace Gecode::Int::Count {
 
     template 
     forceinline
@@ -140,6 +140,6 @@ namespace Gecode { namespace Int { namespace Count {
         return ES_FIX;
     }
 
-}}} // namespace Gecode::Int::Count
+} // namespace Gecode::Int::Count
 
 // STATISTICS: int-prop
diff --git a/gecode/int/count/int-lq.hpp b/gecode/int/count/int-lq.hpp
index 311b34de74..a211dd1aa5 100644
--- a/gecode/int/count/int-lq.hpp
+++ b/gecode/int/count/int-lq.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Count {
+namespace Gecode::Int::Count {
 
     template 
     forceinline
@@ -139,6 +139,6 @@ namespace Gecode { namespace Int { namespace Count {
         return ES_FIX;
     }
 
-}}} // namespace Gecode::Int::Count
+} // namespace Gecode::Int::Count
 
 // STATISTICS: int-prop
diff --git a/gecode/int/count/rel.hpp b/gecode/int/count/rel.hpp
index ee0807b7c8..ec80a7103e 100644
--- a/gecode/int/count/rel.hpp
+++ b/gecode/int/count/rel.hpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Count {
+namespace Gecode::Int::Count {
 
     /*
      * Counting domain consistent equality
@@ -297,6 +297,6 @@ namespace Gecode { namespace Int { namespace Count {
         return ES_OK;
     }
 
-}}} // namespace Gecode::Int::Count
+} // namespace Gecode::Int::Count
 
 // STATISTICS: int-prop
diff --git a/gecode/int/count/view-base.hpp b/gecode/int/count/view-base.hpp
index a3b0805bf2..d8f248441c 100644
--- a/gecode/int/count/view-base.hpp
+++ b/gecode/int/count/view-base.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Count {
+namespace Gecode::Int::Count {
 
     template 
     forceinline
@@ -103,13 +103,13 @@ namespace Gecode { namespace Int { namespace Count {
 
     template 
     forceinline int
-    ViewBase::at_least(void) const {
+    ViewBase::at_least() const {
         return -c;
     }
 
     template 
     forceinline int
-    ViewBase::at_most(void) const {
+    ViewBase::at_most() const {
         return x.size() - c;
     }
 
@@ -129,6 +129,6 @@ namespace Gecode { namespace Int { namespace Count {
         return false;
     }
 
-}}} // namespace Gecode::Int::Count
+} // namespace Gecode::Int::Count
 
 // STATISTICS: int-prop
diff --git a/gecode/int/count/view-eq.hpp b/gecode/int/count/view-eq.hpp
index 7c94fe8ad1..99b9f2354d 100644
--- a/gecode/int/count/view-eq.hpp
+++ b/gecode/int/count/view-eq.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Count {
+namespace Gecode::Int::Count {
 
     template 
     forceinline
@@ -102,6 +102,6 @@ namespace Gecode { namespace Int { namespace Count {
         return shr ? ES_NOFIX : ES_FIX;
     }
 
-}}} // namespace Gecode::Int::Count
+} // namespace Gecode::Int::Count
 
 // STATISTICS: int-prop
diff --git a/gecode/int/count/view-gq.hpp b/gecode/int/count/view-gq.hpp
index e8a9115529..da55528ba1 100644
--- a/gecode/int/count/view-gq.hpp
+++ b/gecode/int/count/view-gq.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Count {
+namespace Gecode::Int::Count {
 
     template 
     forceinline
@@ -97,6 +97,6 @@ namespace Gecode { namespace Int { namespace Count {
         return shr ? ES_NOFIX : ES_FIX;
     }
 
-}}} // namespace Gecode::Int::Count
+} // namespace Gecode::Int::Count
 
 // STATISTICS: int-prop
diff --git a/gecode/int/count/view-lq.hpp b/gecode/int/count/view-lq.hpp
index 4e7913be74..c98f4060b1 100644
--- a/gecode/int/count/view-lq.hpp
+++ b/gecode/int/count/view-lq.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Count {
+namespace Gecode::Int::Count {
 
     template 
     forceinline
@@ -83,6 +83,6 @@ namespace Gecode { namespace Int { namespace Count {
         return shr ? ES_NOFIX : ES_FIX;
     }
 
-}}} // namespace Gecode::Int::Count
+} // namespace Gecode::Int::Count
 
 // STATISTICS: int-prop
diff --git a/gecode/int/cumulative.cpp b/gecode/int/cumulative.cpp
index b5fd9d0cb2..3c3c50e3e0 100644
--- a/gecode/int/cumulative.cpp
+++ b/gecode/int/cumulative.cpp
@@ -36,10 +36,10 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Cumulative {
+namespace Gecode::Int::Cumulative {
 
     template 
-    void
+    static void
     cumulative(Home home, Cap c, const TaskTypeArgs& t, const IntVarArgs& s, const IntArgs& p, const IntArgs& u,
                IntPropLevel ipl) {
         if ((s.size() != p.size()) || (s.size() != u.size()) || (s.size() != t.size()))
@@ -58,14 +58,14 @@ namespace Gecode { namespace Int { namespace Cumulative {
         int min_u = INT_MAX;
         int min_u2 = INT_MAX;
         int max_u = INT_MIN;
-        for (int i = 0; i < u.size(); i++) {
-            if (u[i] < min_u) {
+        for (int ui : u) {
+            if (ui < min_u) {
                 min_u2 = min_u;
-                min_u = u[i];
-            } else if (u[i] < min_u2)
-                min_u2 = u[i];
-            if (u[i] > max_u)
-                max_u = u[i];
+                min_u = ui;
+            } else if (ui < min_u2) {
+                min_u2 = ui;
+            }
+            max_u = std::max(ui, max_u);
         }
         bool disjunctive = (min_u > c.max() / 2) || (min_u2 > c.max() / 2 && min_u + min_u2 > c.max());
         if (disjunctive) {
@@ -73,14 +73,14 @@ namespace Gecode { namespace Int { namespace Cumulative {
             unary(home, t, s, p, ipl);
         } else {
             bool fixp = true;
-            for (int i = 0; i < t.size(); i++)
-                if (t[i] != TT_FIXED_PROCESSING) {
+            for (auto ti : t)
+                if (ti != TT_FIXED_PROCESSING) {
                     fixp = false;
                     break;
                 }
             int non_optionals = 0;
-            for (int i = 0; i < u.size(); i++)
-                if (u[i] > 0)
+            for (int ui : u)
+                if (ui > 0)
                     non_optionals++;
             if (fixp) {
                 TaskArray tasks(home, non_optionals);
@@ -103,7 +103,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
     }
 
     template 
-    void
+    static void
     cumulative(Home home, Cap c, const TaskTypeArgs& t, const IntVarArgs& s, const IntArgs& p, const IntArgs& u,
                const BoolVarArgs& m, IntPropLevel ipl) {
         using namespace Gecode::Int;
@@ -122,8 +122,8 @@ namespace Gecode { namespace Int { namespace Cumulative {
         GECODE_POST;
 
         bool all_mandatory = true;
-        for (int i = 0; i < m.size(); i++) {
-            if (!m[i].one()) {
+        for (auto mi : m) {
+            if (!mi.one()) {
                 all_mandatory = false;
                 break;
             }
@@ -132,14 +132,14 @@ namespace Gecode { namespace Int { namespace Cumulative {
             cumulative(home, c, t, s, p, u, ipl);
         } else {
             bool fixp = true;
-            for (int i = 0; i < t.size(); i++)
-                if (t[i] != TT_FIXED_PROCESSING) {
+            for (auto ti : t)
+                if (ti != TT_FIXED_PROCESSING) {
                     fixp = false;
                     break;
                 }
             int non_optionals = 0;
-            for (int i = 0; i < u.size(); i++)
-                if (u[i] > 0)
+            for (int ui : u)
+                if (ui > 0)
                     non_optionals++;
             if (fixp) {
                 TaskArray tasks(home, non_optionals);
@@ -162,7 +162,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
     }
 
     template 
-    void
+    static void
     cumulative(Home home, Cap c, const IntVarArgs& s, const IntArgs& p, const IntArgs& u, IntPropLevel ipl) {
         using namespace Gecode::Int;
         using namespace Gecode::Int::Cumulative;
@@ -182,14 +182,14 @@ namespace Gecode { namespace Int { namespace Cumulative {
         int min_u = INT_MAX;
         int min_u2 = INT_MAX;
         int max_u = INT_MIN;
-        for (int i = 0; i < u.size(); i++) {
-            if (u[i] < min_u) {
+        for (int ui : u) {
+            if (ui < min_u) {
                 min_u2 = min_u;
-                min_u = u[i];
-            } else if (u[i] < min_u2)
-                min_u2 = u[i];
-            if (u[i] > max_u)
-                max_u = u[i];
+                min_u = ui;
+            } else if (ui < min_u2) {
+                min_u2 = ui;
+            }
+            max_u = std::max(ui, max_u);
         }
         bool disjunctive = (min_u > c.max() / 2) || (min_u2 > c.max() / 2 && min_u + min_u2 > c.max());
         if (disjunctive) {
@@ -197,8 +197,8 @@ namespace Gecode { namespace Int { namespace Cumulative {
             unary(home, s, p, ipl);
         } else {
             int non_optionals = 0;
-            for (int i = 0; i < u.size(); i++)
-                if (u[i] > 0)
+            for (int ui : u)
+                if (ui > 0)
                     non_optionals++;
             TaskArray t(home, non_optionals);
             int cur = 0;
@@ -211,7 +211,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
     }
 
     template 
-    void
+    static void
     cumulative(Home home, Cap c, const IntVarArgs& s, const IntArgs& p, const IntArgs& u, const BoolVarArgs& m,
                IntPropLevel ipl) {
         using namespace Gecode::Int;
@@ -255,7 +255,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
     }
 
     template 
-    void
+    static void
     cumulative(Home home, Cap c, const IntVarArgs& s, const IntVarArgs& p, const IntVarArgs& e, const IntArgs& u,
                IntPropLevel ipl) {
         using namespace Gecode::Int;
@@ -272,12 +272,12 @@ namespace Gecode { namespace Int { namespace Cumulative {
         mul_check(c.max(), w, s.size());
 
         GECODE_POST;
-        for (int i = 0; i < p.size(); i++)
-            GECODE_ME_FAIL(IntView(p[i]).gq(home, 0));
+        for (auto pi : p)
+            GECODE_ME_FAIL(IntView(pi).gq(home, 0));
 
         bool fix_p = true;
-        for (int i = 0; i < p.size(); i++) {
-            if (!p[i].assigned()) {
+        for (auto pi : p) {
+            if (!pi.assigned()) {
                 fix_p = false;
                 break;
             }
@@ -289,8 +289,8 @@ namespace Gecode { namespace Int { namespace Cumulative {
             cumulative(home, c, s, pp, u, ipl);
         } else {
             int non_optionals = 0;
-            for (int i = 0; i < u.size(); i++)
-                if (u[i] > 0)
+            for (int ui : u)
+                if (ui > 0)
                     non_optionals++;
             TaskArray t(home, non_optionals);
             int cur = 0;
@@ -303,7 +303,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
     }
 
     template 
-    void
+    static void
     cumulative(Home home, Cap c, const IntVarArgs& s, const IntVarArgs& p, const IntVarArgs& e, const IntArgs& u,
                const BoolVarArgs& m, IntPropLevel ipl) {
         using namespace Gecode::Int;
@@ -321,12 +321,12 @@ namespace Gecode { namespace Int { namespace Cumulative {
         mul_check(c.max(), w, s.size());
 
         GECODE_POST;
-        for (int i = 0; i < p.size(); i++)
-            GECODE_ME_FAIL(IntView(p[i]).gq(home, 0));
+        for (auto pi : p)
+            GECODE_ME_FAIL(IntView(pi).gq(home, 0));
 
         bool all_mandatory = true;
-        for (int i = 0; i < m.size(); i++) {
-            if (!m[i].one()) {
+        for (auto mi : m) {
+            if (!mi.one()) {
                 all_mandatory = false;
                 break;
             }
@@ -335,8 +335,8 @@ namespace Gecode { namespace Int { namespace Cumulative {
             cumulative(home, c, s, p, e, u, ipl);
         } else {
             int non_optionals = 0;
-            for (int i = 0; i < u.size(); i++)
-                if (u[i] > 0)
+            for (int ui : u)
+                if (ui > 0)
                     non_optionals++;
             TaskArray t(home, non_optionals);
             int cur = 0;
@@ -348,7 +348,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
         }
     }
 
-}}} // namespace Gecode::Int::Cumulative
+} // namespace Gecode::Int::Cumulative
 
 namespace Gecode {
 
diff --git a/gecode/int/cumulative.hh b/gecode/int/cumulative.hh
index b05cc00d37..4f390a0c80 100644
--- a/gecode/int/cumulative.hh
+++ b/gecode/int/cumulative.hh
@@ -53,7 +53,7 @@
  * \brief %Scheduling for cumulative resources
  */
 
-namespace Gecode { namespace Int { namespace Cumulative {
+namespace Gecode::Int::Cumulative {
 
     /// Throw exception if multiplication of \a x and \a y overflows
     void mul_check(long long int x, long long int y);
@@ -61,11 +61,11 @@ namespace Gecode { namespace Int { namespace Cumulative {
     /// Throw exception if multiplication of \a x, \a y, and \a z overflows
     void mul_check(long long int x, long long int y, long long int z);
 
-}}} // namespace Gecode::Int::Cumulative
+} // namespace Gecode::Int::Cumulative
 
 #include 
 
-namespace Gecode { namespace Int { namespace Cumulative {
+namespace Gecode::Int::Cumulative {
 
     /// Cumulative (mandatory) task with fixed processing time
     class ManFixPTask : public Unary::ManFixPTask {
@@ -77,7 +77,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
         /// \name Constructors and initialization
         //@{
         /// Default constructor
-        ManFixPTask(void);
+        ManFixPTask();
         /// Initialize task with start time \a s, processing time \a p, and required resource \a c
         ManFixPTask(IntVar s, int p, int c);
         /// Initialize task with start time \a s, processing time \a p, and required resource \a c
@@ -89,9 +89,9 @@ namespace Gecode { namespace Int { namespace Cumulative {
         /// \name Value access
         //@{
         /// Return required capacity
-        int c(void) const;
+        int c() const;
         /// Return required energy
-        long long int e(void) const;
+        long long int e() const;
         //@}
 
         /// \name Cloning
@@ -118,7 +118,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
         /// \name Constructors and initialization
         //@{
         /// Default constructor
-        ManFixPSETask(void);
+        ManFixPSETask();
         /**
          * \brief Initialize task
          *
@@ -142,9 +142,9 @@ namespace Gecode { namespace Int { namespace Cumulative {
         /// \name Value access
         //@{
         /// Return required capacity
-        int c(void) const;
+        int c() const;
         /// Return required energy
-        long long int e(void) const;
+        long long int e() const;
         //@}
 
         /// \name Cloning
@@ -171,7 +171,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
         /// \name Constructors and initialization
         //@{
         /// Default constructor
-        ManFlexTask(void);
+        ManFlexTask();
         /// Initialize with start time \a s, processing time \a p, end time \a e
         ManFlexTask(IntVar s, IntVar p, IntVar e, int c);
         /// Initialize with start time \a s, processing time \a p, end time \a e
@@ -183,9 +183,9 @@ namespace Gecode { namespace Int { namespace Cumulative {
         /// \name Value access
         //@{
         /// Return required capacity
-        int c(void) const;
+        int c() const;
         /// Return required energy
-        long long int e(void) const;
+        long long int e() const;
         //@}
 
         /// \name Cloning
@@ -211,14 +211,14 @@ namespace Gecode { namespace Int { namespace Cumulative {
         /// \name Constructors and initialization
         //@{
         /// Default constructor
-        OptFixPTask(void);
+        OptFixPTask();
         /// Initialize with start time \a s, processing time \a p, required capacity \a c, and mandatory flag \a m
         OptFixPTask(IntVar s, int p, int c, BoolVar m);
         /// Initialize with start time \a s, processing time \a p, required capacity \a c, and mandatory flag \a m
         void init(IntVar s, int p, int c, BoolVar m);
         //@}
         /// Cast to corresponding unary task
-        operator Unary::OptFixPTask(void);
+        operator Unary::OptFixPTask();
     };
 
     /**
@@ -237,14 +237,14 @@ namespace Gecode { namespace Int { namespace Cumulative {
         /// \name Constructors and initialization
         //@{
         /// Default constructor
-        OptFixPSETask(void);
+        OptFixPSETask();
         /// Initialize with start time \a s, processing time \a p, required capacity \a c, and mandatory flag \a m
         OptFixPSETask(TaskType t, IntVar s, int p, int c, BoolVar m);
         /// Initialize with start time \a s, processing time \a p, required capacity \a c, and mandatory flag \a m
         void init(TaskType t, IntVar s, int p, int c, BoolVar m);
         //@}
         /// Cast to corresponding unary task
-        operator Unary::OptFixPSETask(void);
+        operator Unary::OptFixPSETask();
     };
 
     /**
@@ -263,14 +263,14 @@ namespace Gecode { namespace Int { namespace Cumulative {
         /// \name Constructors and initialization
         //@{
         /// Default constructor
-        OptFlexTask(void);
+        OptFlexTask();
         /// Initialize with start time \a s, processing time \a p, end time \a e, and mandatory flag \a m
         OptFlexTask(IntVar s, IntVar p, IntVar e, int c, BoolVar m);
         /// Initialize with start time \a s, processing time \a p, end time \a e, and mandatory flag \a m
         void init(IntVar s, IntVar p, IntVar e, int c, BoolVar m);
         //@}
         /// Cast to corresponding unary task
-        operator Unary::OptFlexTask(void);
+        operator Unary::OptFlexTask();
     };
 
     /**
@@ -280,47 +280,47 @@ namespace Gecode { namespace Int { namespace Cumulative {
     template 
     std::basic_ostream& operator<<(std::basic_ostream& os, const OptFlexTask& t);
 
-}}} // namespace Gecode::Int::Cumulative
+} // namespace Gecode::Int::Cumulative
 
 #include 
 
-namespace Gecode { namespace Int { namespace Cumulative {
+namespace Gecode::Int::Cumulative {
 
     /// Forward mandatory fixed task view
-    typedef ManFixPTask ManFixPTaskFwd;
+    using ManFixPTaskFwd = ManFixPTask;
 
     /// Backward (dual) mandatory fixed task view
-    typedef FwdToBwd ManFixPTaskBwd;
+    using ManFixPTaskBwd = FwdToBwd;
 
     /// Forward mandatory fixed task view
-    typedef ManFixPSETask ManFixPSETaskFwd;
+    using ManFixPSETaskFwd = ManFixPSETask;
 
     /// Backward (dual) mandatory fixed task view
-    typedef FwdToBwd ManFixPSETaskBwd;
+    using ManFixPSETaskBwd = FwdToBwd;
 
     /// Forward optional fixed task view
-    typedef OptFixPTask OptFixPTaskFwd;
+    using OptFixPTaskFwd = OptFixPTask;
 
     /// Backward (dual) optional fixed task view
-    typedef FwdToBwd OptFixPTaskBwd;
+    using OptFixPTaskBwd = FwdToBwd;
 
     /// Forward optional fixed task view
-    typedef OptFixPSETask OptFixPSETaskFwd;
+    using OptFixPSETaskFwd = OptFixPSETask;
 
     /// Backward (dual) optional fixed task view
-    typedef FwdToBwd OptFixPSETaskBwd;
+    using OptFixPSETaskBwd = FwdToBwd;
 
     /// Forward mandatory flexible task view
-    typedef ManFlexTask ManFlexTaskFwd;
+    using ManFlexTaskFwd = ManFlexTask;
 
     /// Backward (dual) mandatory flexible task view
-    typedef FwdToBwd ManFlexTaskBwd;
+    using ManFlexTaskBwd = FwdToBwd;
 
     /// Forward optional flexible task view
-    typedef OptFlexTask OptFlexTaskFwd;
+    using OptFlexTaskFwd = OptFlexTask;
 
     /// Backward (dual) optional flexible task view
-    typedef FwdToBwd OptFlexTaskBwd;
+    using OptFlexTaskBwd = FwdToBwd;
 
     /**
      * \brief Print backward task view in format est:p:lct
@@ -350,18 +350,18 @@ namespace Gecode { namespace Int { namespace Cumulative {
     template 
     std::basic_ostream& operator<<(std::basic_ostream& os, const OptFixPSETaskBwd& t);
 
-}}} // namespace Gecode::Int::Cumulative
+} // namespace Gecode::Int::Cumulative
 
 #include 
 
-namespace Gecode { namespace Int {
+namespace Gecode::Int {
 
     /// Task view traits for forward task views
     template <>
     class TaskViewTraits {
     public:
         /// The task type
-        typedef Cumulative::ManFixPTask Task;
+        using Task = Cumulative::ManFixPTask;
     };
 
     /// Task view traits for backward task views
@@ -369,7 +369,7 @@ namespace Gecode { namespace Int {
     class TaskViewTraits {
     public:
         /// The task type
-        typedef Cumulative::ManFixPTask Task;
+        using Task = Cumulative::ManFixPTask;
     };
 
     /// Task view traits for forward task views
@@ -377,7 +377,7 @@ namespace Gecode { namespace Int {
     class TaskViewTraits {
     public:
         /// The task type
-        typedef Cumulative::ManFixPSETask Task;
+        using Task = Cumulative::ManFixPSETask;
     };
 
     /// Task view traits for backward task views
@@ -385,7 +385,7 @@ namespace Gecode { namespace Int {
     class TaskViewTraits {
     public:
         /// The task type
-        typedef Cumulative::ManFixPSETask Task;
+        using Task = Cumulative::ManFixPSETask;
     };
 
     /// Task view traits for forward optional task views
@@ -393,7 +393,7 @@ namespace Gecode { namespace Int {
     class TaskViewTraits {
     public:
         /// The task type
-        typedef Cumulative::OptFixPTask Task;
+        using Task = Cumulative::OptFixPTask;
     };
 
     /// Task view traits for backward task views
@@ -401,7 +401,7 @@ namespace Gecode { namespace Int {
     class TaskViewTraits {
     public:
         /// The task type
-        typedef Cumulative::OptFixPTask Task;
+        using Task = Cumulative::OptFixPTask;
     };
 
     /// Task view traits for forward optional task views
@@ -409,7 +409,7 @@ namespace Gecode { namespace Int {
     class TaskViewTraits {
     public:
         /// The task type
-        typedef Cumulative::OptFixPSETask Task;
+        using Task = Cumulative::OptFixPSETask;
     };
 
     /// Task view traits for backward task views
@@ -417,7 +417,7 @@ namespace Gecode { namespace Int {
     class TaskViewTraits {
     public:
         /// The task type
-        typedef Cumulative::OptFixPSETask Task;
+        using Task = Cumulative::OptFixPSETask;
     };
 
     /// Task view traits for forward task views
@@ -425,7 +425,7 @@ namespace Gecode { namespace Int {
     class TaskViewTraits {
     public:
         /// The task type
-        typedef Cumulative::ManFlexTask Task;
+        using Task = Cumulative::ManFlexTask;
     };
 
     /// Task view traits for backward task views
@@ -433,7 +433,7 @@ namespace Gecode { namespace Int {
     class TaskViewTraits {
     public:
         /// The task type
-        typedef Cumulative::ManFlexTask Task;
+        using Task = Cumulative::ManFlexTask;
     };
 
     /// Task view traits for forward optional task views
@@ -441,7 +441,7 @@ namespace Gecode { namespace Int {
     class TaskViewTraits {
     public:
         /// The task type
-        typedef Cumulative::OptFlexTask Task;
+        using Task = Cumulative::OptFlexTask;
     };
 
     /// Task view traits for backward task views
@@ -449,7 +449,7 @@ namespace Gecode { namespace Int {
     class TaskViewTraits {
     public:
         /// The task type
-        typedef Cumulative::OptFlexTask Task;
+        using Task = Cumulative::OptFlexTask;
     };
 
     /// Task traits for mandatory fixed tasks
@@ -457,11 +457,11 @@ namespace Gecode { namespace Int {
     class TaskTraits {
     public:
         /// The forward task view type
-        typedef Cumulative::ManFixPTaskFwd TaskViewFwd;
+        using TaskViewFwd = Cumulative::ManFixPTaskFwd;
         /// The backward task view type
-        typedef Cumulative::ManFixPTaskBwd TaskViewBwd;
+        using TaskViewBwd = Cumulative::ManFixPTaskBwd;
         /// The corresponding unary task type
-        typedef Unary::ManFixPTask UnaryTask;
+        using UnaryTask = Unary::ManFixPTask;
     };
 
     /// Task traits for mandatory fixed tasks
@@ -469,11 +469,11 @@ namespace Gecode { namespace Int {
     class TaskTraits {
     public:
         /// The forward task view type
-        typedef Cumulative::ManFixPSETaskFwd TaskViewFwd;
+        using TaskViewFwd = Cumulative::ManFixPSETaskFwd;
         /// The backward task view type
-        typedef Cumulative::ManFixPSETaskBwd TaskViewBwd;
+        using TaskViewBwd = Cumulative::ManFixPSETaskBwd;
         /// The corresponding unary task type
-        typedef Unary::ManFixPSETask UnaryTask;
+        using UnaryTask = Unary::ManFixPSETask;
     };
 
     /// Task traits for optional fixed tasks
@@ -481,13 +481,13 @@ namespace Gecode { namespace Int {
     class TaskTraits {
     public:
         /// The forward task view type
-        typedef Cumulative::OptFixPTaskFwd TaskViewFwd;
+        using TaskViewFwd = Cumulative::OptFixPTaskFwd;
         /// The backward task view type
-        typedef Cumulative::OptFixPTaskBwd TaskViewBwd;
+        using TaskViewBwd = Cumulative::OptFixPTaskBwd;
         /// The corresponding mandatory task
-        typedef Cumulative::ManFixPTask ManTask;
+        using ManTask = Cumulative::ManFixPTask;
         /// The corresponding unary task type
-        typedef Unary::OptFixPTask UnaryTask;
+        using UnaryTask = Unary::OptFixPTask;
     };
 
     /// Task traits for optional fixed tasks
@@ -495,13 +495,13 @@ namespace Gecode { namespace Int {
     class TaskTraits {
     public:
         /// The forward task view type
-        typedef Cumulative::OptFixPSETaskFwd TaskViewFwd;
+        using TaskViewFwd = Cumulative::OptFixPSETaskFwd;
         /// The backward task view type
-        typedef Cumulative::OptFixPSETaskBwd TaskViewBwd;
+        using TaskViewBwd = Cumulative::OptFixPSETaskBwd;
         /// The corresponding mandatory task
-        typedef Cumulative::ManFixPSETask ManTask;
+        using ManTask = Cumulative::ManFixPSETask;
         /// The corresponding unary task type
-        typedef Unary::OptFixPSETask UnaryTask;
+        using UnaryTask = Unary::OptFixPSETask;
     };
 
     /// Task traits for mandatory flexible tasks
@@ -509,11 +509,11 @@ namespace Gecode { namespace Int {
     class TaskTraits {
     public:
         /// The forward task view type
-        typedef Cumulative::ManFlexTaskFwd TaskViewFwd;
+        using TaskViewFwd = Cumulative::ManFlexTaskFwd;
         /// The backward task view type
-        typedef Cumulative::ManFlexTaskBwd TaskViewBwd;
+        using TaskViewBwd = Cumulative::ManFlexTaskBwd;
         /// The corresponding unary task type
-        typedef Unary::ManFlexTask UnaryTask;
+        using UnaryTask = Unary::ManFlexTask;
     };
 
     /// Task traits for optional flexible tasks
@@ -521,18 +521,18 @@ namespace Gecode { namespace Int {
     class TaskTraits {
     public:
         /// The forward task view type
-        typedef Cumulative::OptFlexTaskFwd TaskViewFwd;
+        using TaskViewFwd = Cumulative::OptFlexTaskFwd;
         /// The backward task view type
-        typedef Cumulative::OptFlexTaskBwd TaskViewBwd;
+        using TaskViewBwd = Cumulative::OptFlexTaskBwd;
         /// The corresponding mandatory task
-        typedef Cumulative::ManFlexTask ManTask;
+        using ManTask = Cumulative::ManFlexTask;
         /// The corresponding unary task type
-        typedef Unary::OptFlexTask UnaryTask;
+        using UnaryTask = Unary::OptFlexTask;
     };
 
-}} // namespace Gecode::Int
+} // namespace Gecode::Int
 
-namespace Gecode { namespace Int { namespace Cumulative {
+namespace Gecode::Int::Cumulative {
 
     /// Node for an omega tree
     class OmegaNode {
@@ -567,7 +567,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
         /// Remove task with index \a i
         void remove(int i);
         /// Return energy envelope of all tasks
-        long long int env(void) const;
+        long long int env() const;
     };
 
     /// Node for an extended omega tree
@@ -652,20 +652,20 @@ namespace Gecode { namespace Int { namespace Cumulative {
         /// Remove task with index \a i from lambda
         void remove_lambda(int i);
         /// Whether has responsible task
-        bool lempty(void) const;
+        bool lempty() const;
         /// Return responsible task
-        int responsible(void) const;
+        int responsible() const;
         /// Return energy envelope of all tasks
-        long long int env(void) const;
+        long long int env() const;
         /// Return energy envelope of all tasks excluding lambda tasks
-        long long int lenv(void) const;
+        long long int lenv() const;
     };
 
-}}} // namespace Gecode::Int::Cumulative
+} // namespace Gecode::Int::Cumulative
 
 #include 
 
-namespace Gecode { namespace Int { namespace Cumulative {
+namespace Gecode::Int::Cumulative {
 
     /// Check for subsumption (all tasks must be assigned)
     template 
@@ -782,7 +782,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
     template 
     ExecStatus post_optional(Home home, Cap c, TaskArray& t, IntPropLevel ipl);
 
-}}} // namespace Gecode::Int::Cumulative
+} // namespace Gecode::Int::Cumulative
 
 #include 
 #include 
diff --git a/gecode/int/cumulative/edge-finding.hpp b/gecode/int/cumulative/edge-finding.hpp
index 7356bfd0f8..cdccedc11d 100644
--- a/gecode/int/cumulative/edge-finding.hpp
+++ b/gecode/int/cumulative/edge-finding.hpp
@@ -38,7 +38,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Cumulative {
+namespace Gecode::Int::Cumulative {
 
     /// Sort by capacity
     template 
@@ -180,6 +180,6 @@ namespace Gecode { namespace Int { namespace Cumulative {
         return ES_OK;
     }
 
-}}} // namespace Gecode::Int::Cumulative
+} // namespace Gecode::Int::Cumulative
 
 // STATISTICS: int-prop
diff --git a/gecode/int/cumulative/knapsack-overload.hpp b/gecode/int/cumulative/knapsack-overload.hpp
index 0a3d8a7c51..ea157197de 100644
--- a/gecode/int/cumulative/knapsack-overload.hpp
+++ b/gecode/int/cumulative/knapsack-overload.hpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Cumulative {
+namespace Gecode::Int::Cumulative {
 
     // Knapsack-augmented overload checking
     namespace Kaoc {
@@ -234,6 +234,6 @@ namespace Gecode { namespace Int { namespace Cumulative {
         return supported_knapsack_overload(t, c);
     }
 
-}}} // namespace Gecode::Int::Cumulative
+} // namespace Gecode::Int::Cumulative
 
 // STATISTICS: int-prop
diff --git a/gecode/int/cumulative/limits.hpp b/gecode/int/cumulative/limits.hpp
index d7b2424d45..4382476769 100644
--- a/gecode/int/cumulative/limits.hpp
+++ b/gecode/int/cumulative/limits.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Cumulative {
+namespace Gecode::Int::Cumulative {
 
     inline void
     mul_check(long long int x, long long int y) {
@@ -44,6 +44,6 @@ namespace Gecode { namespace Int { namespace Cumulative {
             throw OutOfLimits("cumulative");
     }
 
-}}} // namespace Gecode::Int::Cumulative
+} // namespace Gecode::Int::Cumulative
 
 // STATISTICS: int-prop
diff --git a/gecode/int/cumulative/man-prop.hpp b/gecode/int/cumulative/man-prop.hpp
index bc8c214189..dd632e4ef8 100644
--- a/gecode/int/cumulative/man-prop.hpp
+++ b/gecode/int/cumulative/man-prop.hpp
@@ -32,7 +32,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Cumulative {
+namespace Gecode::Int::Cumulative {
 
     template 
     forceinline
@@ -65,9 +65,8 @@ namespace Gecode { namespace Int { namespace Cumulative {
                 for (int i = 0; i < t.size(); i++)
                     mt[i] = t[i];
                 return Unary::ManProp::UnaryTask, PL>::post(home, mt);
-            } else {
-                (void)new (home) ManProp(home, c, t);
             }
+            (void)new (home) ManProp(home, c, t);
         }
         return ES_OK;
     }
@@ -129,6 +128,6 @@ namespace Gecode { namespace Int { namespace Cumulative {
         return ES_NOFIX;
     }
 
-}}} // namespace Gecode::Int::Cumulative
+} // namespace Gecode::Int::Cumulative
 
 // STATISTICS: int-prop
diff --git a/gecode/int/cumulative/opt-prop.hpp b/gecode/int/cumulative/opt-prop.hpp
index f571f61aae..d5e7f6edcf 100644
--- a/gecode/int/cumulative/opt-prop.hpp
+++ b/gecode/int/cumulative/opt-prop.hpp
@@ -34,7 +34,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Cumulative {
+namespace Gecode::Int::Cumulative {
 
     template 
     forceinline
@@ -71,7 +71,8 @@ namespace Gecode { namespace Int { namespace Cumulative {
                 if (t[0].mandatory()) {
                     GECODE_ME_CHECK(c.gq(home, t[0].c()));
                     return ES_OK;
-                } else if (c.min() >= t[0].c()) {
+                }
+                if (c.min() >= t[0].c()) {
                     return ES_OK;
                 }
             } else {
@@ -178,6 +179,6 @@ namespace Gecode { namespace Int { namespace Cumulative {
         return ES_NOFIX;
     }
 
-}}} // namespace Gecode::Int::Cumulative
+} // namespace Gecode::Int::Cumulative
 
 // STATISTICS: int-prop
diff --git a/gecode/int/cumulative/overload.hpp b/gecode/int/cumulative/overload.hpp
index 31ec80b5ff..494c3e6c42 100644
--- a/gecode/int/cumulative/overload.hpp
+++ b/gecode/int/cumulative/overload.hpp
@@ -32,7 +32,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Cumulative {
+namespace Gecode::Int::Cumulative {
 
     // Overload checking for mandatory tasks
     template 
@@ -53,6 +53,6 @@ namespace Gecode { namespace Int { namespace Cumulative {
         return ES_OK;
     }
 
-}}} // namespace Gecode::Int::Cumulative
+} // namespace Gecode::Int::Cumulative
 
 // STATISTICS: int-prop
diff --git a/gecode/int/cumulative/post.hpp b/gecode/int/cumulative/post.hpp
index ef1ad5de2e..1e3ab81a91 100644
--- a/gecode/int/cumulative/post.hpp
+++ b/gecode/int/cumulative/post.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Cumulative {
+namespace Gecode::Int::Cumulative {
 
     template 
     forceinline ExecStatus
@@ -64,6 +64,6 @@ namespace Gecode { namespace Int { namespace Cumulative {
         return ES_OK;
     }
 
-}}} // namespace Gecode::Int::Cumulative
+} // namespace Gecode::Int::Cumulative
 
 // STATISTICS: int-post
diff --git a/gecode/int/cumulative/subsumption.hpp b/gecode/int/cumulative/subsumption.hpp
index 5441010019..ac83607d4d 100644
--- a/gecode/int/cumulative/subsumption.hpp
+++ b/gecode/int/cumulative/subsumption.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Cumulative {
+namespace Gecode::Int::Cumulative {
 
     template 
     forceinline ExecStatus
@@ -63,6 +63,6 @@ namespace Gecode { namespace Int { namespace Cumulative {
         return home.ES_SUBSUMED(p);
     }
 
-}}} // namespace Gecode::Int::Cumulative
+} // namespace Gecode::Int::Cumulative
 
 // STATISTICS: int-prop
diff --git a/gecode/int/cumulative/task-view.hpp b/gecode/int/cumulative/task-view.hpp
index 8f21bdd114..c9bc8077ce 100644
--- a/gecode/int/cumulative/task-view.hpp
+++ b/gecode/int/cumulative/task-view.hpp
@@ -32,7 +32,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Cumulative {
+namespace Gecode::Int::Cumulative {
 
     template 
     std::basic_ostream&
@@ -76,6 +76,6 @@ namespace Gecode { namespace Int { namespace Cumulative {
         return os << s.str();
     }
 
-}}} // namespace Gecode::Int::Cumulative
+} // namespace Gecode::Int::Cumulative
 
 // STATISTICS: int-var
diff --git a/gecode/int/cumulative/task.hpp b/gecode/int/cumulative/task.hpp
index 6ff56e3884..4eab861af3 100644
--- a/gecode/int/cumulative/task.hpp
+++ b/gecode/int/cumulative/task.hpp
@@ -32,7 +32,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Cumulative {
+namespace Gecode::Int::Cumulative {
 
     /*
      * Mandatory fixed task
@@ -40,7 +40,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
 
     forceinline
     // NOLINTNEXTLINE(modernize-use-equals-default)
-    ManFixPTask::ManFixPTask(void) {}
+    ManFixPTask::ManFixPTask() {}
     forceinline
     ManFixPTask::ManFixPTask(IntVar s, int p, int c)
         : Unary::ManFixPTask(s, p), _c(c) {}
@@ -56,11 +56,11 @@ namespace Gecode { namespace Int { namespace Cumulative {
     }
 
     forceinline int
-    ManFixPTask::c(void) const {
+    ManFixPTask::c() const {
         return _c;
     }
     forceinline long long int
-    ManFixPTask::e(void) const {
+    ManFixPTask::e() const {
         return static_cast(pmin()) * c();
     }
 
@@ -86,7 +86,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
 
     forceinline
     // NOLINTNEXTLINE(modernize-use-equals-default)
-    ManFixPSETask::ManFixPSETask(void) {}
+    ManFixPSETask::ManFixPSETask() {}
     forceinline
     ManFixPSETask::ManFixPSETask(TaskType t, IntVar s, int p, int c)
         : Unary::ManFixPSETask(t, s, p), _c(c) {}
@@ -102,11 +102,11 @@ namespace Gecode { namespace Int { namespace Cumulative {
     }
 
     forceinline int
-    ManFixPSETask::c(void) const {
+    ManFixPSETask::c() const {
         return _c;
     }
     forceinline long long int
-    ManFixPSETask::e(void) const {
+    ManFixPSETask::e() const {
         return static_cast(pmin()) * c();
     }
 
@@ -132,7 +132,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
 
     forceinline
     // NOLINTNEXTLINE(modernize-use-equals-default)
-    ManFlexTask::ManFlexTask(void) {}
+    ManFlexTask::ManFlexTask() {}
     forceinline
     ManFlexTask::ManFlexTask(IntVar s, IntVar p, IntVar e, int c)
         : Unary::ManFlexTask(s, p, e), _c(c) {}
@@ -148,11 +148,11 @@ namespace Gecode { namespace Int { namespace Cumulative {
     }
 
     forceinline int
-    ManFlexTask::c(void) const {
+    ManFlexTask::c() const {
         return _c;
     }
     forceinline long long int
-    ManFlexTask::e(void) const {
+    ManFlexTask::e() const {
         return static_cast(pmin()) * c();
     }
 
@@ -179,7 +179,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
 
     forceinline
     // NOLINTNEXTLINE(modernize-use-equals-default)
-    OptFixPTask::OptFixPTask(void) {}
+    OptFixPTask::OptFixPTask() {}
     forceinline
     OptFixPTask::OptFixPTask(IntVar s, int p, int c, BoolVar m) {
         ManFixPTask::init(s, p, c);
@@ -191,7 +191,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
         _m = m;
     }
     forceinline OptFixPTask::
-    operator Unary::OptFixPTask(void) {
+    operator Unary::OptFixPTask() {
         return Unary::OptFixPTask(_s, _p, _m);
     }
 
@@ -212,7 +212,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
 
     forceinline
     // NOLINTNEXTLINE(modernize-use-equals-default)
-    OptFixPSETask::OptFixPSETask(void) {}
+    OptFixPSETask::OptFixPSETask() {}
     forceinline
     OptFixPSETask::OptFixPSETask(TaskType t, IntVar s, int p, int c, BoolVar m) {
         ManFixPSETask::init(t, s, p, c);
@@ -224,7 +224,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
         _m = m;
     }
     forceinline OptFixPSETask::
-    operator Unary::OptFixPSETask(void) {
+    operator Unary::OptFixPSETask() {
         return Unary::OptFixPSETask(_t, _s, _p, _m);
     }
 
@@ -245,7 +245,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
 
     forceinline
     // NOLINTNEXTLINE(modernize-use-equals-default)
-    OptFlexTask::OptFlexTask(void) {}
+    OptFlexTask::OptFlexTask() {}
     forceinline
     OptFlexTask::OptFlexTask(IntVar s, IntVar p, IntVar e, int c, BoolVar m) {
         ManFlexTask::init(s, p, e, c);
@@ -257,7 +257,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
         _m = m;
     }
     forceinline OptFlexTask::
-    operator Unary::OptFlexTask(void) {
+    operator Unary::OptFlexTask() {
         return Unary::OptFlexTask(_s, _p, _e, _m);
     }
 
@@ -272,6 +272,6 @@ namespace Gecode { namespace Int { namespace Cumulative {
         return os << s.str();
     }
 
-}}} // namespace Gecode::Int::Cumulative
+} // namespace Gecode::Int::Cumulative
 
 // STATISTICS: int-var
diff --git a/gecode/int/cumulative/time-tabling.hpp b/gecode/int/cumulative/time-tabling.hpp
index f7cdbbd623..362abd82a8 100644
--- a/gecode/int/cumulative/time-tabling.hpp
+++ b/gecode/int/cumulative/time-tabling.hpp
@@ -1,3 +1,5 @@
+#include 
+
 /*
  *  Main authors:
  *     Christian Schulte 
@@ -32,7 +34,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Cumulative {
+namespace Gecode::Int::Cumulative {
 
     /// Sort order for tasks by decreasing capacity
     template 
@@ -87,8 +89,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
                 // Process events for zero-length task
                 for (; (e->type() == Event::ZRO) && (e->time() == time); e++) {
                     ccur -= t[e->idx()].c();
-                    if (ccur < cmin)
-                        cmin = ccur;
+                    cmin = std::min(ccur, cmin);
                     if (ccur < 0)
                         return ES_FAILED;
                     ccur += t[e->idx()].c();
@@ -101,8 +102,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
                     if (t[e->idx()].mandatory()) {
                         tasks.clear(static_cast(e->idx()));
                         ccur -= t[e->idx()].c();
-                        if (ccur < cmin)
-                            cmin = ccur;
+                        cmin = std::min(ccur, cmin);
                         nrstime = time + 1;
                         if (ccur < 0)
                             return ES_FAILED;
@@ -125,6 +125,6 @@ namespace Gecode { namespace Int { namespace Cumulative {
         return ES_NOFIX;
     }
 
-}}} // namespace Gecode::Int::Cumulative
+} // namespace Gecode::Int::Cumulative
 
 // STATISTICS: int-prop
diff --git a/gecode/int/cumulative/tree.hpp b/gecode/int/cumulative/tree.hpp
index 7075dec3ca..a81a2b771c 100644
--- a/gecode/int/cumulative/tree.hpp
+++ b/gecode/int/cumulative/tree.hpp
@@ -35,7 +35,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Int { namespace Cumulative {
+namespace Gecode::Int::Cumulative {
 
     /*
      * Omega tree
@@ -81,7 +81,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
 
     template 
     forceinline long long int
-    OmegaTree::env(void) const {
+    OmegaTree::env() const {
         return root().env;
     }
 
@@ -245,28 +245,28 @@ namespace Gecode { namespace Int { namespace Cumulative {
 
     template 
     forceinline bool
-    OmegaLambdaTree::lempty(void) const {
+    OmegaLambdaTree::lempty() const {
         return root().res_lenv < 0;
     }
 
     template 
     forceinline int
-    OmegaLambdaTree::responsible(void) const {
+    OmegaLambdaTree::responsible() const {
         return root().res_lenv;
     }
 
     template 
     forceinline long long int
-    OmegaLambdaTree::env(void) const {
+    OmegaLambdaTree::env() const {
         return root().env;
     }
 
     template 
     forceinline long long int
-    OmegaLambdaTree::lenv(void) const {
+    OmegaLambdaTree::lenv() const {
         return root().lenv;
     }
 
-}}} // namespace Gecode::Int::Cumulative
+} // namespace Gecode::Int::Cumulative
 
 // STATISTICS: int-prop
diff --git a/gecode/int/cumulatives.cpp b/gecode/int/cumulatives.cpp
index 321d479373..5e276ed68e 100644
--- a/gecode/int/cumulatives.cpp
+++ b/gecode/int/cumulatives.cpp
@@ -59,13 +59,13 @@ namespace Gecode {
         template <>
         class ViewType {
         public:
-            typedef Int::ConstIntView Result;
+            using Result = Int::ConstIntView;
         };
 
         template <>
         class ViewType {
         public:
-            typedef Int::IntView Result;
+            using Result = Int::IntView;
         };
 
         template 
diff --git a/gecode/int/cumulatives.hh b/gecode/int/cumulatives.hh
index cb6593fc29..81bfb40ebf 100644
--- a/gecode/int/cumulatives.hh
+++ b/gecode/int/cumulatives.hh
@@ -35,7 +35,9 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Cumulatives {
+#include 
+
+namespace Gecode::Int::Cumulatives {
 
     /** \namespace Gecode::Int::Cumulatives
      *  \brief %Cumulatives propagators
@@ -114,7 +116,7 @@ namespace Gecode { namespace Int { namespace Cumulatives {
         size_t dispose(Space& home) override;
     };
 
-}}} // namespace Gecode::Int::Cumulatives
+} // namespace Gecode::Int::Cumulatives
 
 #include 
 
diff --git a/gecode/int/cumulatives/val.hpp b/gecode/int/cumulatives/val.hpp
index 3397f6f72b..d84f84013d 100644
--- a/gecode/int/cumulatives/val.hpp
+++ b/gecode/int/cumulatives/val.hpp
@@ -39,7 +39,7 @@
  *   Constraint with Negative Heights. CP 2002, pages 63-79, Springer-Verlag.
  */
 
-namespace Gecode { namespace Int { namespace Cumulatives {
+namespace Gecode::Int::Cumulatives {
 
     template 
     forceinline
@@ -133,7 +133,7 @@ namespace Gecode { namespace Int { namespace Cumulatives {
 
         // Default constructor for region-allocated memory
         // NOLINTNEXTLINE(modernize-use-equals-default)
-        Event(void) {}
+        Event() {}
 
         /// Order events based on date.
         bool
@@ -190,7 +190,7 @@ namespace Gecode { namespace Int { namespace Cumulatives {
                             if (me_failed(s[t].minus_r(home, a, false)) || me_failed(e[t].minus_r(home, b, false)))
                                 return ES_FAILED;
                         }
-                        if (me_failed(p[t].lq(home, std::max(std::max(low - s[t].min(), e[t].max() - up - 1), 0)))) {
+                        if (me_failed(p[t].lq(home, std::max({low - s[t].min(), e[t].max() - up - 1, 0})))) {
                             return ES_FAILED;
                         }
                     }
@@ -221,17 +221,6 @@ namespace Gecode { namespace Int { namespace Cumulatives {
         return ES_OK;
     }
 
-    namespace {
-        template 
-        class Less {
-        public:
-            bool
-            operator()(const C& lhs, const C& rhs) {
-                return lhs < rhs;
-            }
-        };
-    } // namespace
-
     template 
     ExecStatus
     Val::propagate(Space& home, const ModEventDelta&) {
@@ -286,7 +275,7 @@ namespace Gecode { namespace Int { namespace Cumulatives {
             }
 
             // Sort the events according to date
-            Less less;
+            std::less<> less;
             Support::insertion(&events[0], events_size, less);
 
             // Sweep line along d, starting at 0
@@ -325,6 +314,6 @@ namespace Gecode { namespace Int { namespace Cumulatives {
         return subsumed ? home.ES_SUBSUMED(*this) : ES_NOFIX;
     }
 
-}}} // namespace Gecode::Int::Cumulatives
+} // namespace Gecode::Int::Cumulatives
 
 // STATISTICS: int-prop
diff --git a/gecode/int/distinct.hh b/gecode/int/distinct.hh
index e2c50729fb..8582e85f83 100644
--- a/gecode/int/distinct.hh
+++ b/gecode/int/distinct.hh
@@ -49,7 +49,7 @@
  * \brief %Distinct propagators
  */
 
-namespace Gecode { namespace Int { namespace Distinct {
+namespace Gecode::Int::Distinct {
 
     /**
      * \brief Naive value distinct propagator
@@ -220,15 +220,15 @@ namespace Gecode { namespace Int { namespace Distinct {
         using ViewValGraph::Graph::scc;
         using ViewValGraph::Graph::match;
         /// Construct graph as not yet initialized
-        Graph(void) = default;
+        Graph() = default;
         /// Initialize graph
         ExecStatus init(Space& home, ViewArray& x);
         /// Mark edges in graph, return true if pruning is at all possible
-        bool mark(void);
+        bool mark();
         /// Prune unmarked edges, \a assigned is true if a view got assigned
         ExecStatus prune(Space& home, bool& assigned);
         /// Synchronize graph with new view domains
-        bool sync(void);
+        bool sync();
     };
 
     /**
@@ -249,13 +249,13 @@ namespace Gecode { namespace Int { namespace Distinct {
 
     public:
         /// Initialize with non-initialized view-value graph
-        DomCtrl(void) = default;
+        DomCtrl() = default;
         /// Check whether a view-value graph is available
-        bool available(void);
+        bool available();
         /// Initialize view-value graph for views \a x
         ExecStatus init(Space& home, ViewArray& x);
         /// Synchronize available view-value graph
-        ExecStatus sync(void);
+        ExecStatus sync();
         /// Perform propagation, \a assigned is true if a view gets assigned
         ExecStatus propagate(Space& home, bool& assigned);
     };
@@ -352,7 +352,7 @@ namespace Gecode { namespace Int { namespace Distinct {
         /// Constructor for cloning \a p
         EqIte(Space& home, EqIte& p);
         /// Constructor for creation
-        EqIte(Home home, IntView x0, IntView x1, int c0, int c1);
+        EqIte(Home home, IntView x0, IntView x1, int d0, int d1);
 
     public:
         /// Copy propagator during cloning
@@ -368,7 +368,7 @@ namespace Gecode { namespace Int { namespace Distinct {
         static ExecStatus post(Home home, IntView x0, IntView x1, int c0, int c1);
     };
 
-}}} // namespace Gecode::Int::Distinct
+} // namespace Gecode::Int::Distinct
 
 #include 
 #include 
diff --git a/gecode/int/distinct/bnd.hpp b/gecode/int/distinct/bnd.hpp
index 1dfa328a07..dd868a434a 100644
--- a/gecode/int/distinct/bnd.hpp
+++ b/gecode/int/distinct/bnd.hpp
@@ -1,3 +1,5 @@
+#include 
+
 /*
  *  Main authors:
  *     Christian Schulte 
@@ -30,7 +32,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Distinct {
+namespace Gecode::Int::Distinct {
 
     template 
     forceinline
@@ -78,8 +80,7 @@ namespace Gecode { namespace Int { namespace Distinct {
     Bnd::cost(const Space&, const ModEventDelta& med) const {
         if (View::me(med) == ME_INT_VAL)
             return PropCost::linear(PropCost::LO, y.size());
-        else
-            return PropCost::quadratic(PropCost::LO, x.size());
+        return PropCost::quadratic(PropCost::LO, x.size());
     }
 
     template 
@@ -195,7 +196,7 @@ namespace Gecode { namespace Int { namespace Distinct {
 
     template 
     forceinline ExecStatus
-    prop_bnd(Space& home, ViewArray& x, int* minsorted, int* maxsorted) {
+    prop_bnd(Space& home, ViewArray& x, const int* minsorted, const int* maxsorted) {
         const int n = x.size();
 
         Region r;
@@ -314,7 +315,7 @@ namespace Gecode { namespace Int { namespace Distinct {
 
         unsigned int d = static_cast(max_x) - static_cast(min_x) + 1;
 
-        if (d < static_cast(n))
+        if (std::cmp_less(d, n))
             return ES_FAILED;
 
         if (d > 2 * static_cast(n)) {
@@ -361,8 +362,7 @@ namespace Gecode { namespace Int { namespace Distinct {
         // The Hall bounds reach max_x+3, which overflows int near the limit
         if ((d > (static_cast(Int::Limits::max) / 2U)) || (max_x > Int::Limits::max - 2))
             return prop_bnd(home, x, minsorted, maxsorted);
-        else
-            return prop_bnd(home, x, minsorted, maxsorted);
+        return prop_bnd(home, x, minsorted, maxsorted);
     }
 
     template 
@@ -480,6 +480,6 @@ namespace Gecode { namespace Int { namespace Distinct {
         return ES_OK;
     }
 
-}}} // namespace Gecode::Int::Distinct
+} // namespace Gecode::Int::Distinct
 
 // STATISTICS: int-prop
diff --git a/gecode/int/distinct/cbs.cpp b/gecode/int/distinct/cbs.cpp
index a12ce9bf04..8c7e823501 100644
--- a/gecode/int/distinct/cbs.cpp
+++ b/gecode/int/distinct/cbs.cpp
@@ -36,7 +36,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Distinct {
+namespace Gecode::Int::Distinct {
 
     /*
      * Program used to precompute both factors using GNU gmp and the c++ MPFR
@@ -10202,7 +10202,7 @@ namespace Gecode { namespace Int { namespace Distinct {
         37249, 37442, 37636, 37830, 38025, 38220, 38416, 38612, 38809, 39006, 39204, 39402, 39601, 39800, 40000, 40200,
     };
 
-}}} // namespace Gecode::Int::Distinct
+} // namespace Gecode::Int::Distinct
 
 #endif
 
diff --git a/gecode/int/distinct/cbs.hpp b/gecode/int/distinct/cbs.hpp
index d453f659dc..ecd42b5591 100644
--- a/gecode/int/distinct/cbs.hpp
+++ b/gecode/int/distinct/cbs.hpp
@@ -35,7 +35,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Int { namespace Distinct {
+namespace Gecode::Int::Distinct {
 
     /**
      * \brief Minc and Brégman factors
@@ -143,7 +143,7 @@ namespace Gecode { namespace Int { namespace Distinct {
         UB ub{1, 1};
         for (int i = 0; i < x.size(); i++) {
             unsigned int s = x[i].size();
-            if ((s >= MAX_MINC_FACTORS) || (s >= WIDTH_LIANG_BAI_FACTORS))
+            if (s >= std::min(MAX_MINC_FACTORS, WIDTH_LIANG_BAI_FACTORS))
                 throw Gecode::Exception("Int::Distinct::cbsdistinct",
                                         "Variable cardinality too big for using counting-based"
                                         "search with distinct constraints");
@@ -220,7 +220,7 @@ namespace Gecode { namespace Int { namespace Distinct {
         }
     }
 
-}}} // namespace Gecode::Int::Distinct
+} // namespace Gecode::Int::Distinct
 
 #endif
 
diff --git a/gecode/int/distinct/dom-ctrl.hpp b/gecode/int/distinct/dom-ctrl.hpp
index 476538394b..f07e652b3f 100644
--- a/gecode/int/distinct/dom-ctrl.hpp
+++ b/gecode/int/distinct/dom-ctrl.hpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Distinct {
+namespace Gecode::Int::Distinct {
 
     /*
      * The propagation controller
@@ -41,7 +41,7 @@ namespace Gecode { namespace Int { namespace Distinct {
 
     template 
     forceinline bool
-    DomCtrl::available(void) {
+    DomCtrl::available() {
         return g;
     }
 
@@ -53,7 +53,7 @@ namespace Gecode { namespace Int { namespace Distinct {
 
     template 
     ExecStatus
-    DomCtrl::sync(void) {
+    DomCtrl::sync() {
         g.purge();
         return g.sync() ? ES_OK : ES_FAILED;
     }
@@ -67,6 +67,6 @@ namespace Gecode { namespace Int { namespace Distinct {
         return g.prune(home, assigned);
     }
 
-}}} // namespace Gecode::Int::Distinct
+} // namespace Gecode::Int::Distinct
 
 // STATISTICS: int-prop
diff --git a/gecode/int/distinct/dom.hpp b/gecode/int/distinct/dom.hpp
index 3a92c2fa73..2aaa6ea914 100644
--- a/gecode/int/distinct/dom.hpp
+++ b/gecode/int/distinct/dom.hpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Distinct {
+namespace Gecode::Int::Distinct {
 
     template 
     forceinline
@@ -64,8 +64,7 @@ namespace Gecode { namespace Int { namespace Distinct {
     Dom::cost(const Space&, const ModEventDelta& med) const {
         if (View::me(med) == ME_INT_VAL)
             return PropCost::linear(PropCost::LO, x.size());
-        else
-            return PropCost::quadratic(PropCost::HI, x.size());
+        return PropCost::quadratic(PropCost::HI, x.size());
     }
 
     template 
@@ -126,6 +125,6 @@ namespace Gecode { namespace Int { namespace Distinct {
         return ES_FIX;
     }
 
-}}} // namespace Gecode::Int::Distinct
+} // namespace Gecode::Int::Distinct
 
 // STATISTICS: int-prop
diff --git a/gecode/int/distinct/eqite.cpp b/gecode/int/distinct/eqite.cpp
index fefb7ae3a5..2b0b21b29c 100644
--- a/gecode/int/distinct/eqite.cpp
+++ b/gecode/int/distinct/eqite.cpp
@@ -34,7 +34,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Distinct {
+namespace Gecode::Int::Distinct {
 
     PropCost
     EqIte::cost(const Space&, const ModEventDelta&) const {
@@ -75,8 +75,7 @@ namespace Gecode { namespace Int { namespace Distinct {
             GECODE_ME_CHECK(x0.nq(home, c0));
             if (eq_else == RT_TRUE)
                 return home.ES_SUBSUMED(*this);
-            else
-                GECODE_REWRITE(*this, (Rel::EqDom::post(home(*this), x0, x1)));
+            GECODE_REWRITE(*this, (Rel::EqDom::post(home(*this), x0, x1)));
         }
 
         if (eq_else == RT_FALSE) {
@@ -97,6 +96,6 @@ namespace Gecode { namespace Int { namespace Distinct {
         return ES_FIX;
     }
 
-}}} // namespace Gecode::Int::Distinct
+} // namespace Gecode::Int::Distinct
 
 // STATISTICS: int-prop
diff --git a/gecode/int/distinct/eqite.hpp b/gecode/int/distinct/eqite.hpp
index 44d7e55502..f4720cdbdc 100644
--- a/gecode/int/distinct/eqite.hpp
+++ b/gecode/int/distinct/eqite.hpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Distinct {
+namespace Gecode::Int::Distinct {
 
     forceinline
     EqIte::EqIte(Home home, IntView x0, IntView x1, int d0, int d1)
@@ -51,6 +51,6 @@ namespace Gecode { namespace Int { namespace Distinct {
         return ES_OK;
     }
 
-}}} // namespace Gecode::Int::Distinct
+} // namespace Gecode::Int::Distinct
 
 // STATISTICS: int-prop
diff --git a/gecode/int/distinct/graph.hpp b/gecode/int/distinct/graph.hpp
index 7dbf432d3b..f24866fdbe 100644
--- a/gecode/int/distinct/graph.hpp
+++ b/gecode/int/distinct/graph.hpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Distinct {
+namespace Gecode::Int::Distinct {
 
     template 
     forceinline ExecStatus
@@ -104,7 +104,7 @@ namespace Gecode { namespace Int { namespace Distinct {
 
     template 
     forceinline bool
-    Graph::sync(void) {
+    Graph::sync() {
         using namespace ViewValGraph;
         Region r;
         // Stack for view nodes to be rematched
@@ -169,7 +169,7 @@ namespace Gecode { namespace Int { namespace Distinct {
 
     template 
     forceinline bool
-    Graph::mark(void) {
+    Graph::mark() {
         using namespace ViewValGraph;
 
         Region r;
@@ -226,9 +226,8 @@ namespace Gecode { namespace Int { namespace Distinct {
         if (n_view_visited < n_view) {
             scc();
             return true;
-        } else {
-            return false;
         }
+        return false;
     }
 
     template 
@@ -253,6 +252,6 @@ namespace Gecode { namespace Int { namespace Distinct {
         return ES_OK;
     }
 
-}}} // namespace Gecode::Int::Distinct
+} // namespace Gecode::Int::Distinct
 
 // STATISTICS: int-prop
diff --git a/gecode/int/distinct/open.hpp b/gecode/int/distinct/open.hpp
index 4aa4d5869f..404c6cafd5 100644
--- a/gecode/int/distinct/open.hpp
+++ b/gecode/int/distinct/open.hpp
@@ -38,7 +38,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Int { namespace Distinct {
+namespace Gecode::Int::Distinct {
 
     template 
     class Open : public OpenListPropagator {
@@ -144,7 +144,7 @@ namespace Gecode { namespace Int { namespace Distinct {
             GrowableIntSetRanges history(assigned);
             GECODE_ES_CHECK(exclude_values(home, history, first_new, current, count));
 
-            typedef Iter::Values::ToRanges BatchRanges;
+            using BatchRanges = Iter::Values::ToRanges;
             while (count > 0) {
                 Support::quicksort(current, count);
                 for (int i = 1; i < count; i++)
@@ -198,7 +198,7 @@ namespace Gecode { namespace Int { namespace Distinct {
         }
     };
 
-}}} // namespace Gecode::Int::Distinct
+} // namespace Gecode::Int::Distinct
 
 #endif
 
diff --git a/gecode/int/distinct/ter-dom.hpp b/gecode/int/distinct/ter-dom.hpp
index 3c9211b56c..520bc5919e 100644
--- a/gecode/int/distinct/ter-dom.hpp
+++ b/gecode/int/distinct/ter-dom.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Distinct {
+namespace Gecode::Int::Distinct {
 
     /*
      * Ternary domain consistent distinct
@@ -99,6 +99,6 @@ namespace Gecode { namespace Int { namespace Distinct {
 #undef GECODE_INT_HALL_ONE
 #undef GECODE_INT_HALL_TWO
 
-}}} // namespace Gecode::Int::Distinct
+} // namespace Gecode::Int::Distinct
 
 // STATISTICS: int-prop
diff --git a/gecode/int/distinct/val.hpp b/gecode/int/distinct/val.hpp
index 76cf945cbe..91bedfb042 100644
--- a/gecode/int/distinct/val.hpp
+++ b/gecode/int/distinct/val.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Distinct {
+namespace Gecode::Int::Distinct {
 
     /*
      * Eliminating singleton variables
@@ -191,6 +191,6 @@ namespace Gecode { namespace Int { namespace Distinct {
         return ES_OK;
     }
 
-}}} // namespace Gecode::Int::Distinct
+} // namespace Gecode::Int::Distinct
 
 // STATISTICS: int-prop
diff --git a/gecode/int/div.hh b/gecode/int/div.hh
index fa4644f3f2..9838fa4cb6 100644
--- a/gecode/int/div.hh
+++ b/gecode/int/div.hh
@@ -35,7 +35,7 @@
 
 #include 
 
-namespace Gecode { namespace Int {
+namespace Gecode::Int {
 
     /// Compute \f$\lceil x/y\rceil\f$ where \a x is non-negative and \a y is positive
     template 
@@ -62,7 +62,7 @@ namespace Gecode { namespace Int {
     template 
     IntType floor_div_xx(IntType x, IntType y);
 
-}} // namespace Gecode::Int
+} // namespace Gecode::Int
 
 #include 
 
diff --git a/gecode/int/div.hpp b/gecode/int/div.hpp
index 816cd62875..cd721ba488 100644
--- a/gecode/int/div.hpp
+++ b/gecode/int/div.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int {
+namespace Gecode::Int {
 
     template 
     forceinline IntType
@@ -87,6 +87,6 @@ namespace Gecode { namespace Int {
         return (x >= 0) ? floor_div_px(x, y) : -ceil_div_px(-x, y);
     }
 
-}} // namespace Gecode::Int
+} // namespace Gecode::Int
 
 // STATISTICS: int-prop
diff --git a/gecode/int/dom.cpp b/gecode/int/dom.cpp
index 37bd92534a..93501b8361 100644
--- a/gecode/int/dom.cpp
+++ b/gecode/int/dom.cpp
@@ -49,8 +49,8 @@ namespace Gecode {
         using namespace Int;
         Limits::check(n, "Int::dom");
         GECODE_POST;
-        for (int i = 0; i < x.size(); i++) {
-            IntView xv(x[i]);
+        for (auto xi : x) {
+            IntView xv(xi);
             GECODE_ME_FAIL(xv.eq(home, n));
         }
     }
@@ -72,8 +72,8 @@ namespace Gecode {
         Limits::check(min, "Int::dom");
         Limits::check(max, "Int::dom");
         GECODE_POST;
-        for (int i = 0; i < x.size(); i++) {
-            IntView xv(x[i]);
+        for (auto xi : x) {
+            IntView xv(xi);
             GECODE_ME_FAIL(xv.gq(home, min));
             GECODE_ME_FAIL(xv.lq(home, max));
         }
@@ -96,9 +96,9 @@ namespace Gecode {
         Limits::check(is.min(), "Int::dom");
         Limits::check(is.max(), "Int::dom");
         GECODE_POST;
-        for (int i = 0; i < x.size(); i++) {
+        for (auto xi : x) {
             IntSetRanges ris(is);
-            IntView xv(x[i]);
+            IntView xv(xi);
             GECODE_ME_FAIL(xv.inter_r(home, ris, false));
         }
     }
diff --git a/gecode/int/dom.hh b/gecode/int/dom.hh
index c1bdd4faee..7681969b11 100644
--- a/gecode/int/dom.hh
+++ b/gecode/int/dom.hh
@@ -43,7 +43,7 @@
  * \brief Domain propagators
  */
 
-namespace Gecode { namespace Int { namespace Dom {
+namespace Gecode::Int::Dom {
 
     /**
      * \brief Reified range dom-propagator
@@ -104,7 +104,7 @@ namespace Gecode { namespace Int { namespace Dom {
         size_t dispose(Space& home) override;
     };
 
-}}} // namespace Gecode::Int::Dom
+} // namespace Gecode::Int::Dom
 
 #include 
 #include 
diff --git a/gecode/int/dom/range.hpp b/gecode/int/dom/range.hpp
index c51232b262..d30a75029b 100644
--- a/gecode/int/dom/range.hpp
+++ b/gecode/int/dom/range.hpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Dom {
+namespace Gecode::Int::Dom {
 
     template 
     forceinline
@@ -44,7 +44,8 @@ namespace Gecode { namespace Int { namespace Dom {
     ReRange::post(Home home, View x, int min, int max, BoolView b) {
         if (min == max) {
             return Rel::ReEqDomInt::post(home, x, min, b);
-        } else if ((min > max) || (max < x.min()) || (min > x.max())) {
+        }
+        if ((min > max) || (max < x.min()) || (min > x.max())) {
             if (rm == RM_RIMP)
                 return ES_OK;
             GECODE_ME_CHECK(b.zero(home));
@@ -88,21 +89,25 @@ namespace Gecode { namespace Int { namespace Dom {
                 GECODE_ME_CHECK(x0.lq(home, max));
             }
             return home.ES_SUBSUMED(*this);
-        } else if (b.zero()) {
+        }
+        if (b.zero()) {
             if (rm != RM_IMP) {
                 Iter::Ranges::Singleton r(min, max);
                 GECODE_ME_CHECK(x0.minus_r(home, r, false));
             }
             return home.ES_SUBSUMED(*this);
-        } else if ((x0.max() <= max) && (x0.min() >= min)) {
+        }
+        if ((x0.max() <= max) && (x0.min() >= min)) {
             if (rm != RM_IMP)
                 GECODE_ME_CHECK(b.one_none(home));
             return home.ES_SUBSUMED(*this);
-        } else if ((x0.max() < min) || (x0.min() > max)) {
+        }
+        if ((x0.max() < min) || (x0.min() > max)) {
             if (rm != RM_RIMP)
                 GECODE_ME_CHECK(b.zero_none(home));
             return home.ES_SUBSUMED(*this);
-        } else if (!x0.range()) {
+        }
+        if (!x0.range()) {
             ViewRanges i_x(x0);
             Iter::Ranges::Singleton i_mm(min, max);
 
@@ -125,6 +130,6 @@ namespace Gecode { namespace Int { namespace Dom {
         return ES_FIX;
     }
 
-}}} // namespace Gecode::Int::Dom
+} // namespace Gecode::Int::Dom
 
 // STATISTICS: int-prop
diff --git a/gecode/int/dom/set.hpp b/gecode/int/dom/set.hpp
index c81af35798..73c8405ce0 100644
--- a/gecode/int/dom/set.hpp
+++ b/gecode/int/dom/set.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Dom {
+namespace Gecode::Int::Dom {
 
     template 
     forceinline
@@ -120,6 +120,6 @@ namespace Gecode { namespace Int { namespace Dom {
         return ES_FIX;
     }
 
-}}} // namespace Gecode::Int::Dom
+} // namespace Gecode::Int::Dom
 
 // STATISTICS: int-prop
diff --git a/gecode/int/element.cpp b/gecode/int/element.cpp
index 84f0973dfc..f8b4b8f845 100644
--- a/gecode/int/element.cpp
+++ b/gecode/int/element.cpp
@@ -40,8 +40,8 @@ namespace Gecode {
         if (c.size() == 0)
             throw TooFewArguments("Int::element");
         GECODE_POST;
-        for (int i = 0; i < c.size(); i++)
-            Limits::check(c[i], "Int::element");
+        for (int ci : c)
+            Limits::check(ci, "Int::element");
         GECODE_ES_FAIL((Element::post_int(home, c, x0, x1)));
     }
 
@@ -51,8 +51,8 @@ namespace Gecode {
         if (c.size() == 0)
             throw TooFewArguments("Int::element");
         GECODE_POST;
-        for (int i = 0; i < c.size(); i++)
-            Limits::check(c[i], "Int::element");
+        for (int ci : c)
+            Limits::check(ci, "Int::element");
         if (offset == 0) {
             GECODE_ES_FAIL((Element::post_int(home, c, x0, x1)));
         } else {
@@ -67,8 +67,8 @@ namespace Gecode {
         if (c.size() == 0)
             throw TooFewArguments("Int::element");
         GECODE_POST;
-        for (int i = 0; i < c.size(); i++)
-            Limits::check(c[i], "Int::element");
+        for (int ci : c)
+            Limits::check(ci, "Int::element");
         GECODE_ES_FAIL((Element::post_int(home, c, x0, x1)));
     }
 
@@ -78,8 +78,8 @@ namespace Gecode {
         if (c.size() == 0)
             throw TooFewArguments("Int::element");
         GECODE_POST;
-        for (int i = 0; i < c.size(); i++)
-            Limits::check(c[i], "Int::element");
+        for (int ci : c)
+            Limits::check(ci, "Int::element");
         if (offset == 0) {
             GECODE_ES_FAIL((Element::post_int(home, c, x0, x1)));
         } else {
@@ -95,8 +95,8 @@ namespace Gecode {
             throw TooFewArguments("Int::element");
         Limits::check(x1, "Int::element");
         GECODE_POST;
-        for (int i = 0; i < c.size(); i++)
-            Limits::check(c[i], "Int::element");
+        for (int ci : c)
+            Limits::check(ci, "Int::element");
         ConstIntView cx1(x1);
         GECODE_ES_FAIL((Element::post_int(home, c, x0, cx1)));
     }
@@ -108,8 +108,8 @@ namespace Gecode {
             throw TooFewArguments("Int::element");
         Limits::check(x1, "Int::element");
         GECODE_POST;
-        for (int i = 0; i < c.size(); i++)
-            Limits::check(c[i], "Int::element");
+        for (int ci : c)
+            Limits::check(ci, "Int::element");
         ConstIntView cx1(x1);
         if (offset == 0) {
             GECODE_ES_FAIL((Element::post_int(home, c, x0, cx1)));
diff --git a/gecode/int/element.hh b/gecode/int/element.hh
index 3e7162a946..6ef60f5fc8 100644
--- a/gecode/int/element.hh
+++ b/gecode/int/element.hh
@@ -44,7 +44,7 @@
  * \brief %Element propagators
  */
 
-namespace Gecode { namespace Int { namespace Element {
+namespace Gecode::Int::Element {
 
     /**
      * \brief %Element propagator for array of integers
@@ -70,9 +70,9 @@ namespace Gecode { namespace Int { namespace Element {
             Idx idx;      ///< The index
             Val val;      ///< The value
             /// Mark that this pair should be removed
-            void mark(void);
+            void mark();
             /// Return whether this pair is marked for removal
-            bool marked(void) const;
+            bool marked() const;
         };
         /**
          * \brief Value iterator for indices in index-value map
@@ -88,11 +88,11 @@ namespace Gecode { namespace Int { namespace Element {
             /// Initialize with start
             IterIdxUnmark(IdxVal* iv);
             /// Test whether more pairs to be iterated
-            bool operator()(void) const;
+            bool operator()() const;
             /// Move to next index value pair (next index)
-            void operator++(void);
+            void operator++();
             /// Return index of current index value pair
-            Idx val(void) const;
+            Idx val() const;
         };
         /**
          * \brief Value iterator for values in index-value map
@@ -108,11 +108,11 @@ namespace Gecode { namespace Int { namespace Element {
             /// Initialize with start
             IterVal(IdxVal* iv);
             /// Test whether more pairs to be iterated
-            bool operator()(void) const;
+            bool operator()() const;
             /// Move to next index value pair (next value)
-            void operator++(void);
+            void operator++();
             /// Return value of current index value pair
-            Val val(void) const;
+            Val val() const;
         };
         /**
          * \brief Value iterator for values in index-value map
@@ -130,11 +130,11 @@ namespace Gecode { namespace Int { namespace Element {
             /// Initialize with start
             IterValUnmark(IdxVal* iv);
             /// Test whether more pairs to be iterated
-            bool operator()(void) const;
+            bool operator()() const;
             /// Move to next index value pair (next value)
-            void operator++(void);
+            void operator++();
             /// Return value of current index value pair
-            Val val(void) const;
+            Val val() const;
         };
         /// Sorting pointers to (index,value) pairs in value order
         class ByVal {
@@ -150,13 +150,13 @@ namespace Gecode { namespace Int { namespace Element {
         /// View for index
         V0 x0;
         /// Type for index size
-        typedef typename Gecode::Support::IntTypeTraits::utype IdxSize;
+        using IdxSize = Gecode::Support::IntTypeTraits::utype;
         /// Size of \a x0 at last execution
         IdxSize s0;
         /// View for result
         V1 x1;
         /// Type for value size
-        typedef typename Gecode::Support::IntTypeTraits::utype ValSize;
+        using ValSize = Gecode::Support::IntTypeTraits::utype;
         /// Size of \a x1 at last execution
         ValSize s1;
         /// Shared array of integer values
@@ -164,15 +164,15 @@ namespace Gecode { namespace Int { namespace Element {
         /// The index-value data structure
         IdxVal* iv;
         /// Prune index according to \a x0
-        void prune_idx(void);
+        void prune_idx();
         /// Prune values according to \a x1
-        void prune_val(void);
+        void prune_val();
         /// Prune when \a x1 is assigned
         static ExecStatus assigned_val(Space& home, IntSharedArray& c, V0 x0, V1 x1);
         /// Constructor for cloning \a p
         Int(Space& home, Int& p);
         /// Constructor for creation
-        Int(Home home, IntSharedArray& i, V0 x0, V1 x1);
+        Int(Home home, IntSharedArray& c0, V0 y0, V1 y1);
 
     public:
         /// Perform copying during cloning
@@ -184,7 +184,7 @@ namespace Gecode { namespace Int { namespace Element {
         /// Perform propagation
         ExecStatus propagate(Space& home, const ModEventDelta& med) override;
         /// Post propagator for \f$i_{x_0}=x_1\f$
-        static ExecStatus post(Home home, IntSharedArray& i, V0 x0, V1 x1);
+        static ExecStatus post(Home home, IntSharedArray& c, V0 x0, V1 x1);
         /// Delete propagator and return its size
         size_t dispose(Space& home) override;
     };
@@ -209,7 +209,7 @@ namespace Gecode { namespace Int { namespace Element {
         /// Constructor for cloning \a p
         View(Space& home, View& p);
         /// Constructor for creation
-        View(Home home, IdxViewArray& iv, VB x0, VC x1);
+        View(Home home, IdxViewArray& iv, VB y0, VC y1);
 
     public:
         // Cost function (defined as low linear)
@@ -342,7 +342,7 @@ namespace Gecode { namespace Int { namespace Element {
         GECODE_INT_EXPORT ExecStatus propagate(Space& home, const ModEventDelta& med) override;
     };
 
-}}} // namespace Gecode::Int::Element
+} // namespace Gecode::Int::Element
 
 #include 
 #include 
diff --git a/gecode/int/element/int.hpp b/gecode/int/element/int.hpp
index 5b42003cc8..f25c5d7b4a 100644
--- a/gecode/int/element/int.hpp
+++ b/gecode/int/element/int.hpp
@@ -30,17 +30,17 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Element {
+namespace Gecode::Int::Element {
 
     // Index value pairs
     template 
     forceinline void
-    Int::IdxVal::mark(void) {
+    Int::IdxVal::mark() {
         idx = -1;
     }
     template 
     forceinline bool
-    Int::IdxVal::marked(void) const {
+    Int::IdxVal::marked() const {
         return idx < 0;
     }
 
@@ -57,12 +57,12 @@ namespace Gecode { namespace Int { namespace Element {
     }
     template 
     forceinline bool
-    Int::IterIdxUnmark::operator()(void) const {
+    Int::IterIdxUnmark::operator()() const {
         return i != 0;
     }
     template 
     forceinline void
-    Int::IterIdxUnmark::operator++(void) {
+    Int::IterIdxUnmark::operator++() {
         int p = i;
         i = iv[p].idx_next;
         while ((i != 0) && iv[i].marked())
@@ -71,7 +71,7 @@ namespace Gecode { namespace Int { namespace Element {
     }
     template 
     forceinline Idx
-    Int::IterIdxUnmark::val(void) const {
+    Int::IterIdxUnmark::val() const {
         assert(!iv[i].marked());
         return iv[i].idx;
     }
@@ -82,17 +82,17 @@ namespace Gecode { namespace Int { namespace Element {
         : iv(iv0), i(iv[0].val_next) {}
     template 
     forceinline bool
-    Int::IterVal::operator()(void) const {
+    Int::IterVal::operator()() const {
         return i != 0;
     }
     template 
     forceinline void
-    Int::IterVal::operator++(void) {
+    Int::IterVal::operator++() {
         i = iv[i].val_next;
     }
     template 
     forceinline Val
-    Int::IterVal::val(void) const {
+    Int::IterVal::val() const {
         assert(!iv[i].marked());
         return iv[i].val;
     }
@@ -109,12 +109,12 @@ namespace Gecode { namespace Int { namespace Element {
     }
     template 
     forceinline bool
-    Int::IterValUnmark::operator()(void) const {
+    Int::IterValUnmark::operator()() const {
         return i != 0;
     }
     template 
     forceinline void
-    Int::IterValUnmark::operator++(void) {
+    Int::IterValUnmark::operator++() {
         int p = i;
         i = iv[p].val_next;
         while ((i != 0) && iv[i].marked())
@@ -123,7 +123,7 @@ namespace Gecode { namespace Int { namespace Element {
     }
     template 
     forceinline Val
-    Int::IterValUnmark::val(void) const {
+    Int::IterValUnmark::val() const {
         assert(!iv[i].marked());
         return iv[i].val;
     }
@@ -195,8 +195,7 @@ namespace Gecode { namespace Int { namespace Element {
     Int::cost(const Space&, const ModEventDelta& med) const {
         if ((V0::me(med) == ME_INT_VAL) || (V1::me(med) == ME_INT_VAL))
             return PropCost::unary(PropCost::LO);
-        else
-            return PropCost::binary(PropCost::HI);
+        return PropCost::binary(PropCost::HI);
     }
 
     template 
@@ -208,7 +207,7 @@ namespace Gecode { namespace Int { namespace Element {
 
     template 
     void
-    Int::prune_idx(void) {
+    Int::prune_idx() {
         Idx p = 0;
         Idx i = iv[p].idx_next;
         ViewRanges v(x0);
@@ -234,7 +233,7 @@ namespace Gecode { namespace Int { namespace Element {
 
     template 
     void
-    Int::prune_val(void) {
+    Int::prune_val() {
         Idx p = 0;
         Idx i = iv[p].val_next;
         ViewRanges v(x1);
@@ -386,12 +385,11 @@ namespace Gecode { namespace Int { namespace Element {
                 s0 = static_cast(x0.size());
                 s1 = static_cast(x1.size());
                 return assigned ? home.ES_SUBSUMED(*this) : ES_NOFIX;
-            } else {
-                GECODE_ME_CHECK(x1.narrow_v(home, v, false));
-                s0 = static_cast(x0.size());
-                s1 = static_cast(x1.size());
-                return (x0.assigned() || x1.assigned()) ? home.ES_SUBSUMED(*this) : ES_FIX;
             }
+            GECODE_ME_CHECK(x1.narrow_v(home, v, false));
+            s0 = static_cast(x0.size());
+            s1 = static_cast(x1.size());
+            return (x0.assigned() || x1.assigned()) ? home.ES_SUBSUMED(*this) : ES_FIX;
         }
     }
 
@@ -437,6 +435,6 @@ namespace Gecode { namespace Int { namespace Element {
         return Int::post(home, c, x0, x1);
     }
 
-}}} // namespace Gecode::Int::Element
+} // namespace Gecode::Int::Element
 
 // STATISTICS: int-prop
diff --git a/gecode/int/element/pair.cpp b/gecode/int/element/pair.cpp
index 4ac54533cc..474085cfb3 100644
--- a/gecode/int/element/pair.cpp
+++ b/gecode/int/element/pair.cpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Element {
+namespace Gecode::Int::Element {
 
     Actor*
     Pair::copy(Space& home) {
@@ -62,15 +62,15 @@ namespace Gecode { namespace Int { namespace Element {
         /// \name Iteration control
         //@{
         /// Test whether iterator is still at a value or done
-        bool operator()(void) const;
+        bool operator()() const;
         /// Move iterator to next value (if possible)
-        void operator++(void);
+        void operator++();
         //@}
 
         /// \name Value access
         //@{
         /// Return current value
-        int val(void) const;
+        int val() const;
         //@}
     };
 
@@ -80,7 +80,7 @@ namespace Gecode { namespace Int { namespace Element {
         : x(x0), xv(x0), yv(y0), w(w0) {}
     template 
     forceinline void
-    PairValues::operator++(void) {
+    PairValues::operator++() {
         ++xv;
         if (!xv()) {
             xv.init(x);
@@ -89,12 +89,12 @@ namespace Gecode { namespace Int { namespace Element {
     }
     template 
     forceinline bool
-    PairValues::operator()(void) const {
+    PairValues::operator()() const {
         return yv();
     }
     template 
     forceinline int
-    PairValues::val(void) const {
+    PairValues::val() const {
         return xv.val() + w * yv.val();
     }
 
@@ -127,7 +127,8 @@ namespace Gecode { namespace Int { namespace Element {
         if (x0.assigned() && x1.assigned()) {
             GECODE_ME_CHECK(x2.eq(home, x0.val() + w * x1.val()));
             return home.ES_SUBSUMED(*this);
-        } else if (x1.assigned()) {
+        }
+        if (x1.assigned()) {
             OffsetView x0x1w(x0, x1.val() * w);
             GECODE_REWRITE(*this, (Rel::EqDom::post(home(*this), x0x1w, x2)));
         }
@@ -178,7 +179,8 @@ namespace Gecode { namespace Int { namespace Element {
         if (x0.assigned() && x1.assigned()) {
             GECODE_ME_CHECK(x2.eq(home, x0.val() + w * x1.val()));
             return home.ES_SUBSUMED(*this);
-        } else if (x1.assigned()) {
+        }
+        if (x1.assigned()) {
             OffsetView x0x1w(x0.base(), x0.offset() + x1.val() * w);
             GECODE_REWRITE(*this, (Rel::EqDom::post(home(*this), x0x1w, x2)));
         }
@@ -195,6 +197,6 @@ namespace Gecode { namespace Int { namespace Element {
         return ES_NOFIX;
     }
 
-}}} // namespace Gecode::Int::Element
+} // namespace Gecode::Int::Element
 
 // STATISTICS: int-prop
diff --git a/gecode/int/element/pair.hpp b/gecode/int/element/pair.hpp
index 080d01e340..3c5b21d01e 100644
--- a/gecode/int/element/pair.hpp
+++ b/gecode/int/element/pair.hpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Element {
+namespace Gecode::Int::Element {
 
     forceinline
     Pair::Pair(Home home, IntView x0, IntView x1, IntView x2, int w0)
@@ -96,6 +96,6 @@ namespace Gecode { namespace Int { namespace Element {
     PairWithOffsets::PairWithOffsets(Space& home, PairWithOffsets& p)
         : TernaryPropagator(home, p), w(p.w) {}
 
-}}} // namespace Gecode::Int::Element
+} // namespace Gecode::Int::Element
 
 // STATISTICS: int-prop
diff --git a/gecode/int/element/view.hpp b/gecode/int/element/view.hpp
index 18432ee604..08bb68308c 100644
--- a/gecode/int/element/view.hpp
+++ b/gecode/int/element/view.hpp
@@ -36,7 +36,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Element {
+namespace Gecode::Int::Element {
 
     /**
      * \brief Class for bounds-equality test
@@ -157,12 +157,12 @@ namespace Gecode { namespace Int { namespace Element {
         const IdxView*cur, *end;
 
     public:
-        IterIdxView(void) = default;
+        IterIdxView() = default;
         IterIdxView(const IdxView*, const IdxView*);
         void init(const IdxView*, const IdxView*);
-        bool operator()(void) const;
-        void operator++(void);
-        int val(void) const;
+        bool operator()() const;
+        void operator++();
+        int val() const;
     };
 
     template 
@@ -177,17 +177,17 @@ namespace Gecode { namespace Int { namespace Element {
     }
     template 
     forceinline bool
-    IterIdxView::operator()(void) const {
+    IterIdxView::operator()() const {
         return cur < end;
     }
     template 
     forceinline void
-    IterIdxView::operator++(void) {
+    IterIdxView::operator++() {
         cur++;
     }
     template 
     forceinline int
-    IterIdxView::val(void) const {
+    IterIdxView::val() const {
         return cur->idx;
     }
 
@@ -269,10 +269,10 @@ namespace Gecode { namespace Int { namespace Element {
         if (x0.assigned()) {
             (void)new (home) Rel::EqBnd(home, iv[x0.val()].view, x1);
             return ES_OK;
-        } else {
-            assert(iv.size() > 1);
-            (void)new (home) ViewBnd(home, iv, x0, x1);
         }
+        assert(iv.size() > 1);
+        (void)new (home) ViewBnd(home, iv, x0, x1);
+
         return ES_OK;
     }
 
@@ -342,10 +342,10 @@ namespace Gecode { namespace Int { namespace Element {
         if (x0.assigned()) {
             (void)new (home) Rel::EqDom(home, iv[x0.val()].view, x1);
             return ES_OK;
-        } else {
-            assert(iv.size() > 1);
-            (void)new (home) ViewDom(home, iv, x0, x1);
         }
+        assert(iv.size() > 1);
+        (void)new (home) ViewDom(home, iv, x0, x1);
+
         return ES_OK;
     }
 
@@ -404,19 +404,18 @@ namespace Gecode { namespace Int { namespace Element {
                 if (iv[i].view.in(x1.val()))
                     return shared(x0, x1) ? ES_NOFIX : ES_FIX;
             return ES_FAILED;
-        } else {
-            Region r;
-            ViewRanges* i_view = r.alloc>(iv.size());
-            for (int i = 0; i < iv.size(); i++)
-                i_view[i].init(iv[i].view);
-            Iter::Ranges::NaryUnion i_val(r, i_view, iv.size());
-            ModEvent me = x1.inter_r(home, i_val);
-            r.free>(i_view, iv.size());
-            GECODE_ME_CHECK(me);
-            return (shared(x0, x1) || me_modified(me)) ? ES_NOFIX : ES_FIX;
         }
+        Region r;
+        ViewRanges* i_view = r.alloc>(iv.size());
+        for (int i = 0; i < iv.size(); i++)
+            i_view[i].init(iv[i].view);
+        Iter::Ranges::NaryUnion i_val(r, i_view, iv.size());
+        ModEvent me = x1.inter_r(home, i_val);
+        r.free>(i_view, iv.size());
+        GECODE_ME_CHECK(me);
+        return (shared(x0, x1) || me_modified(me)) ? ES_NOFIX : ES_FIX;
     }
 
-}}} // namespace Gecode::Int::Element
+} // namespace Gecode::Int::Element
 
 // STATISTICS: int-prop
diff --git a/gecode/int/exception.cpp b/gecode/int/exception.cpp
index 79b6e5812f..e0f723b2c3 100644
--- a/gecode/int/exception.cpp
+++ b/gecode/int/exception.cpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int {
+namespace Gecode::Int {
 
     OutOfLimits::OutOfLimits(const char* l) : Exception(l, "Number out of limits") {}
 
@@ -73,6 +73,6 @@ namespace Gecode { namespace Int {
     LDSBBadValueSelection::LDSBBadValueSelection(const char* l)
         : Exception(l, "Value selection incompatible with LDSB") {}
 
-}} // namespace Gecode::Int
+} // namespace Gecode::Int
 
 // STATISTICS: int-other
diff --git a/gecode/int/exception.hpp b/gecode/int/exception.hpp
index ec8d18a6ab..c95270534f 100644
--- a/gecode/int/exception.hpp
+++ b/gecode/int/exception.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int {
+namespace Gecode::Int {
 
     /**
      * \defgroup FuncThrowInt Integer exceptions
@@ -160,6 +160,6 @@ namespace Gecode { namespace Int {
 
     //@}
 
-}} // namespace Gecode::Int
+} // namespace Gecode::Int
 
 // STATISTICS: int-other
diff --git a/gecode/int/exec.hh b/gecode/int/exec.hh
index 2aa329eb36..a3418ca379 100644
--- a/gecode/int/exec.hh
+++ b/gecode/int/exec.hh
@@ -40,7 +40,7 @@
  * \brief Synchronized execution
  */
 
-namespace Gecode { namespace Int { namespace Exec {
+namespace Gecode::Int::Exec {
 
     /**
      * \brief Conditional propagator
@@ -75,7 +75,7 @@ namespace Gecode { namespace Int { namespace Exec {
         size_t dispose(Space& home) override;
     };
 
-}}} // namespace Gecode::Int::Exec
+} // namespace Gecode::Int::Exec
 
 #include 
 
diff --git a/gecode/int/exec/when.cpp b/gecode/int/exec/when.cpp
index d74c9c289b..6c7035693b 100644
--- a/gecode/int/exec/when.cpp
+++ b/gecode/int/exec/when.cpp
@@ -32,7 +32,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Exec {
+namespace Gecode::Int::Exec {
 
     Actor*
     When::copy(Space& home) {
@@ -63,6 +63,6 @@ namespace Gecode { namespace Int { namespace Exec {
         return sizeof(*this);
     }
 
-}}} // namespace Gecode::Int::Exec
+} // namespace Gecode::Int::Exec
 
 // STATISTICS: int-prop
diff --git a/gecode/int/exec/when.hpp b/gecode/int/exec/when.hpp
index c1667abb54..72c6926cec 100644
--- a/gecode/int/exec/when.hpp
+++ b/gecode/int/exec/when.hpp
@@ -30,7 +30,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Exec {
+namespace Gecode::Int::Exec {
 
     forceinline
     When::When(Home home, BoolView x, std::function t0, std::function e0)
@@ -51,15 +51,15 @@ namespace Gecode { namespace Int { namespace Exec {
         if (x.zero()) {
             e(home);
             return home.failed() ? ES_FAILED : ES_OK;
-        } else if (x.one()) {
+        }
+        if (x.one()) {
             t(home);
             return home.failed() ? ES_FAILED : ES_OK;
-        } else {
-            (void)new (home) When(home, x, std::move(t), std::move(e));
-            return ES_OK;
         }
+        (void)new (home) When(home, x, std::move(t), std::move(e));
+        return ES_OK;
     }
 
-}}} // namespace Gecode::Int::Exec
+} // namespace Gecode::Int::Exec
 
 // STATISTICS: int-prop
diff --git a/gecode/int/extensional-tuple-set.cpp b/gecode/int/extensional-tuple-set.cpp
index 35b44ec2b1..6e7d5a6276 100644
--- a/gecode/int/extensional-tuple-set.cpp
+++ b/gecode/int/extensional-tuple-set.cpp
@@ -36,7 +36,7 @@
 
 #include 
 
-namespace Gecode { namespace Int { namespace Extensional {
+namespace Gecode::Int::Extensional {
 
     /**
      * \brief Iterate table values in a delta interval
@@ -79,12 +79,12 @@ namespace Gecode { namespace Int { namespace Extensional {
         }
 
         bool
-        operator()(void) const {
+        operator()() const {
             return r != e;
         }
 
         void
-        operator++(void) {
+        operator++() {
             if (value != last) {
                 value++;
                 return;
@@ -94,7 +94,7 @@ namespace Gecode { namespace Int { namespace Extensional {
         }
 
         int
-        val(void) const {
+        val() const {
             assert(r != e);
             return value;
         }
@@ -115,7 +115,7 @@ namespace Gecode { namespace Int { namespace Extensional {
         SparseAdvisor(Space& home, SparseAdvisor& advisor)
             : ViewAdvisor(home, advisor), variable(advisor.variable) {}
         int
-        index(void) const {
+        index() const {
             return variable;
         }
         void
@@ -126,7 +126,7 @@ namespace Gecode { namespace Int { namespace Extensional {
 
     /// Return the domain-size product, saturated just above \a limit
     template 
-    unsigned long long
+    static unsigned long long
     domain_product(const ViewArray& x, unsigned long long limit, int excluded = -1) {
         unsigned long long product = 1ULL;
         for (int i = 0; i < x.size(); i++) {
@@ -148,6 +148,8 @@ namespace Gecode { namespace Int { namespace Extensional {
      */
     template 
     class SparseTupleState {
+        friend Derived;
+
     protected:
         TupleSet ts;
         int arity;
@@ -160,7 +162,7 @@ namespace Gecode { namespace Int { namespace Extensional {
         const unsigned int* tv;
 
         forceinline Derived&
-        derived(void) {
+        derived() {
             return static_cast(*this);
         }
 
@@ -259,6 +261,7 @@ namespace Gecode { namespace Int { namespace Extensional {
             }
         }
 
+    private:
         SparseTupleState(Home home, ViewArray& x, const TupleSet& ts0)
             : ts(ts0), arity(x.size()), n_tuples(static_cast(ts0.tuples())),
               n_vals(TupleSetAccess::sparse_values(ts0)),
@@ -306,8 +309,8 @@ namespace Gecode { namespace Int { namespace Extensional {
     template 
     class SparseInc : public Propagator, protected SparseTupleState, View> {
     protected:
-        typedef Extensional::SparseAdvisor SparseAdvisor;
-        typedef SparseTupleState, View> State;
+        using SparseAdvisor = Extensional::SparseAdvisor;
+        using State = SparseTupleState, View>;
         friend class SparseTupleState, View>;
         using State::active_limit;
         using State::arity;
@@ -340,7 +343,7 @@ namespace Gecode { namespace Int { namespace Extensional {
         }
 
         void
-        init_gid_maps(void) {
+        init_gid_maps() {
             for (unsigned int i = 0U; i < n_vals; i++)
                 gid_var[i] = -1;
             for (int a = 0; a < x.size(); a++) {
@@ -362,7 +365,7 @@ namespace Gecode { namespace Int { namespace Extensional {
         }
 
         void
-        init_support_counts(void) {
+        init_support_counts() {
             assert(tv != nullptr);
             const unsigned int* offsets = TupleSetAccess::sparse_support_offsets(ts);
             if (offsets != nullptr) {
@@ -475,7 +478,7 @@ namespace Gecode { namespace Int { namespace Extensional {
         }
 
         bool
-        at_most_one(void) const {
+        at_most_one() const {
             Advisors as(c);
             if (!as())
                 return true;
@@ -703,8 +706,8 @@ namespace Gecode { namespace Int { namespace Extensional {
     template 
     class SparseReifInc : public Propagator, protected SparseTupleState, View> {
     protected:
-        typedef Extensional::SparseAdvisor SparseAdvisor;
-        typedef SparseTupleState, View> State;
+        using SparseAdvisor = Extensional::SparseAdvisor;
+        using State = SparseTupleState, View>;
         friend class SparseTupleState, View>;
         using State::active_limit;
         using State::arity;
@@ -853,7 +856,7 @@ namespace Gecode { namespace Int { namespace Extensional {
     };
 
     template 
-    ExecStatus
+    static ExecStatus
     post_tuple_set(Home home, ViewArray& x, const TupleSet& t, bool pos) {
         switch (t.representation()) {
         case EPK_DENSE:
@@ -870,7 +873,7 @@ namespace Gecode { namespace Int { namespace Extensional {
         }
     }
 
-    forceinline ReifyMode
+    static forceinline ReifyMode
     negated_reify_mode(ReifyMode mode) {
         switch (mode) {
         case RM_EQV:
@@ -886,7 +889,7 @@ namespace Gecode { namespace Int { namespace Extensional {
     }
 
     template 
-    ExecStatus
+    static ExecStatus
     post_sparse_reified(Home home, ViewArray& x, const TupleSet& t, CtrlView b, ReifyMode mode) {
         switch (mode) {
         case RM_EQV:
@@ -901,7 +904,7 @@ namespace Gecode { namespace Int { namespace Extensional {
     }
 
     template 
-    ExecStatus
+    static ExecStatus
     post_dense_reified(Home home, ViewArray& x, const TupleSet& t, CtrlView b, ReifyMode mode) {
         switch (mode) {
         case RM_EQV:
@@ -916,7 +919,7 @@ namespace Gecode { namespace Int { namespace Extensional {
     }
 
     template 
-    ExecStatus
+    static ExecStatus
     post_compressed_reified(Home home, ViewArray& x, const TupleSet& t, CtrlView b, ReifyMode mode) {
         switch (mode) {
         case RM_EQV:
@@ -931,7 +934,7 @@ namespace Gecode { namespace Int { namespace Extensional {
     }
 
     template 
-    ExecStatus
+    static ExecStatus
     post_reified_tuple_set(Home home, ViewArray& x, const TupleSet& t, CtrlView b, ReifyMode mode) {
         switch (t.representation()) {
         case EPK_DENSE:
@@ -947,7 +950,7 @@ namespace Gecode { namespace Int { namespace Extensional {
         }
     }
 
-    forceinline ExecStatus
+    static forceinline ExecStatus
     post_reified_constant(Home home, BoolView b, ReifyMode mode, bool value) {
         switch (mode) {
         case RM_EQV:
@@ -971,7 +974,7 @@ namespace Gecode { namespace Int { namespace Extensional {
         return ES_OK;
     }
 
-}}} // namespace Gecode::Int::Extensional
+} // namespace Gecode::Int::Extensional
 
 namespace Gecode {
 
diff --git a/gecode/int/extensional.hh b/gecode/int/extensional.hh
index 7d719b0c84..6b5c882ab2 100644
--- a/gecode/int/extensional.hh
+++ b/gecode/int/extensional.hh
@@ -46,7 +46,7 @@
  * \brief %Extensional propagators
  */
 
-namespace Gecode { namespace Int { namespace Extensional {
+namespace Gecode::Int::Extensional {
 
     /// Compressed tuple-word support list
     class CompressedSupport {
@@ -58,15 +58,15 @@ namespace Gecode { namespace Int { namespace Extensional {
 
     public:
         /// Initialize as empty support list
-        CompressedSupport(void);
+        CompressedSupport();
         /// Initialize from support word range
         CompressedSupport(const TupleSet::CSupportWord* b0, const TupleSet::CSupportWord* e0);
         /// Return first support word
-        const TupleSet::CSupportWord* begin(void) const;
+        const TupleSet::CSupportWord* begin() const;
         /// Return one past last support word
-        const TupleSet::CSupportWord* end(void) const;
+        const TupleSet::CSupportWord* end() const;
         /// Whether support list is empty
-        bool empty(void) const;
+        bool empty() const;
     };
 
     /**
@@ -92,7 +92,7 @@ namespace Gecode { namespace Int { namespace Extensional {
             Degree i_deg; ///< The in-degree (number of incoming edges)
             Degree o_deg; ///< The out-degree (number of outgoing edges)
             /// Initialize with zeroes
-            void init(void);
+            void init();
         };
         /// %Edge defined by in-state and out-state
         class Edge {
@@ -108,7 +108,7 @@ namespace Gecode { namespace Int { namespace Extensional {
             Edge* edges;    ///< Supporting edges in layered graph
         };
         /// Type for support size
-        typedef typename Gecode::Support::IntTypeTraits::utype ValSize;
+        using ValSize = Gecode::Support::IntTypeTraits::utype;
         /// %Layer for a view in the layered graph
         class Layer {
         public:
@@ -125,17 +125,17 @@ namespace Gecode { namespace Int { namespace Extensional {
             const Support* s2; ///< End of support
         public:
             /// Default constructor
-            LayerValues(void) = default;
+            LayerValues() = default;
             /// Initialize for support of layer \a l
             LayerValues(const Layer& l);
             /// Initialize for support of layer \a l
             void init(const Layer& l);
             /// Test whether more values supported
-            bool operator()(void) const;
+            bool operator()() const;
             /// Move to next supported value
-            void operator++(void);
+            void operator++();
             /// Return supported value
-            int val(void) const;
+            int val() const;
         };
         /// %Advisors for views (by position in array)
         class Index : public Advisor {
@@ -154,9 +154,9 @@ namespace Gecode { namespace Int { namespace Extensional {
             int _lst; ///< Last index
         public:
             /// Initialize range as empty
-            IndexRange(void);
+            IndexRange();
             /// Reset range to be empty
-            void reset(void);
+            void reset();
             /// Add index \a i to range
             void add(int i);
             /// Add index range \a ir to range
@@ -164,11 +164,11 @@ namespace Gecode { namespace Int { namespace Extensional {
             /// Shift index range by \a n elements to the left
             void lshift(int n);
             /// Test whether range is empty
-            bool empty(void) const;
+            bool empty() const;
             /// Return first position
-            int fst(void) const;
+            int fst() const;
             /// Return last position
-            int lst(void) const;
+            int lst() const;
         };
         /// The advisor council
         Council c;
@@ -201,7 +201,7 @@ namespace Gecode { namespace Int { namespace Extensional {
         /// Decrement in degree for out state of edge \a e for layer \a i
         bool o_dec(int i, const Edge& e);
         /// Perform consistency check on data structures
-        void audit(void);
+        void audit();
         /// Initialize layered graph
         template 
         ExecStatus initialize(Space& home, const VarArgArray& x, const DFA& dfa);
@@ -233,14 +233,14 @@ namespace Gecode { namespace Int { namespace Extensional {
     template 
     ExecStatus post_lgp(Home home, const VarArgArray& x, const DFA& dfa);
 
-}}} // namespace Gecode::Int::Extensional
+} // namespace Gecode::Int::Extensional
 
 #include 
 
-namespace Gecode { namespace Int { namespace Extensional {
+namespace Gecode::Int::Extensional {
 
     /// Import type
-    typedef Gecode::Support::BitSetData BitSetData;
+    using BitSetData = Gecode::Support::BitSetData;
 
     /*
      * Forward declarations
@@ -272,7 +272,7 @@ namespace Gecode { namespace Int { namespace Extensional {
 
     public:
         /// Initialize bit set for a number of words \a n
-        BitSet(Space& home, unsigned int n, bool indexed = false);
+        BitSet(Space& home, unsigned int n, bool track_positions = false);
         /// Initialize during cloning
         template 
         BitSet(Space& home, const BitSet& bs);
@@ -285,13 +285,13 @@ namespace Gecode { namespace Int { namespace Extensional {
         /// Initialize during cloning (unused)
         BitSet(Space& home, const TinyBitSet<4U>& tbs);
         /// Get the number of active words
-        unsigned int limit(void) const;
+        unsigned int limit() const;
         /// Check whether the set is empty
-        bool empty(void) const;
+        bool empty() const;
         /// Make the set empty
-        void flush(void);
+        void flush();
         /// Return the highest active index
-        unsigned int width(void) const;
+        unsigned int width() const;
         /// Clear all active words in \a mask
         void clear_mask(BitSetData* mask) const;
         /// Add \a support to \a mask
@@ -316,24 +316,24 @@ namespace Gecode { namespace Int { namespace Extensional {
         /// Perform "nand" with compressed support list
         void nand_with_mask(const CompressedSupport& support);
         /// Return the number of ones
-        unsigned long long int ones(void) const;
+        unsigned long long int ones() const;
         /// Return the number of ones after intersection with \a mask
         unsigned long long int ones(const BitSetData* mask) const;
         /// Return the number of ones after intersection with compressed support list
         unsigned long long int ones(const CompressedSupport& support) const;
         /// Return an upper bound on the number of bits
-        unsigned long long int bits(void) const;
+        unsigned long long int bits() const;
         /// Return the number of required bit set words
-        unsigned int words(void) const;
+        unsigned int words() const;
         /// Return the number of required bit set words
-        unsigned int size(void) const;
+        unsigned int size() const;
     };
 
-}}} // namespace Gecode::Int::Extensional
+} // namespace Gecode::Int::Extensional
 
 #include 
 
-namespace Gecode { namespace Int { namespace Extensional {
+namespace Gecode::Int::Extensional {
 
     /// Tiny bit-set
     template 
@@ -350,18 +350,18 @@ namespace Gecode { namespace Int { namespace Extensional {
         TinyBitSet(Space& home, unsigned int n, bool indexed = false);
         /// Initialize during cloning
         template 
-        TinyBitSet(Space& home, const TinyBitSet& tbs);
+        TinyBitSet(Space& home, const TinyBitSet& sbs);
         /// Initialize during cloning
         template 
         TinyBitSet(Space& home, const BitSet& bs);
         /// Get the limit
-        int limit(void) const;
+        int limit() const;
         /// Check whether the set is empty
-        bool empty(void) const;
+        bool empty() const;
         /// Make the set empty
-        void flush(void);
+        void flush();
         /// Return the highest active index
-        unsigned int width(void) const;
+        unsigned int width() const;
         /// Clear the first \a limit words in \a mask
         void clear_mask(BitSetData* mask);
         /// Add \b to \a mask
@@ -388,27 +388,27 @@ namespace Gecode { namespace Int { namespace Extensional {
         /// Perform "nand" with and the "or" of \a a and \a b
         void nand_with_masks(const BitSetData* a, const BitSetData* b);
         /// Return the number of ones
-        unsigned long long int ones(void) const;
+        unsigned long long int ones() const;
         /// Return the number of ones after intersection with \a b
         unsigned long long int ones(const BitSetData* b) const;
         /// Return the number of ones after intersection with compressed support list
         unsigned long long int ones(const CompressedSupport& s) const;
         /// Return an upper bound on the number of bits
-        unsigned long long int bits(void) const;
+        unsigned long long int bits() const;
         /// Return the number of required bit set words
-        unsigned int words(void) const;
+        unsigned int words() const;
         /// Return the total number of words
-        unsigned int size(void) const;
+        unsigned int size() const;
     };
 
-}}} // namespace Gecode::Int::Extensional
+} // namespace Gecode::Int::Extensional
 
 #include 
 
-namespace Gecode { namespace Int { namespace Extensional {
+namespace Gecode::Int::Extensional {
 
     /// Tuple type
-    typedef TupleSet::Tuple Tuple;
+    using Tuple = TupleSet::Tuple;
 
     /// Optional variable index stored by a compact-table advisor
     template 
@@ -421,7 +421,7 @@ namespace Gecode { namespace Int { namespace Extensional {
         /// Initialize without storing \a i
         CompactAdvisorIndex(int i);
         /// Return a dummy index
-        int index(void) const;
+        int index() const;
     };
 
     /// Compact-table advisor with a variable index
@@ -433,7 +433,7 @@ namespace Gecode { namespace Int { namespace Extensional {
         /// Initialize with index \a i
         CompactAdvisorIndex(int i);
         /// Return the variable index
-        int index(void) const;
+        int index() const;
     };
 
     /// Advisor shared by compact-table support representations
@@ -441,7 +441,7 @@ namespace Gecode { namespace Int { namespace Extensional {
     class CompactAdvisor : public ViewAdvisor, private CompactAdvisorIndex {
     protected:
         /// Range type for supports
-        typedef TupleSet::Range Range;
+        using Range = TupleSet::Range;
         /// First range of support data structure
         const Range* _fst;
         /// Last range of support data structure
@@ -454,13 +454,13 @@ namespace Gecode { namespace Int { namespace Extensional {
         /// Clone advisor \a a
         CompactAdvisor(Space& home, CompactAdvisor& a);
         /// Adjust supports to the current view bounds
-        void adjust(void);
+        void adjust();
         /// Return the variable index
-        int index(void) const;
+        int index() const;
         /// Return first range of support data structure
-        const Range* fst(void) const;
+        const Range* fst() const;
         /// Return last range of support data structure
-        const Range* lst(void) const;
+        const Range* lst() const;
         /// Dispose advisor
         void dispose(Space& home, Council& c);
     };
@@ -493,15 +493,15 @@ namespace Gecode { namespace Int { namespace Extensional {
         /// Copy constructor
         CompactStatus(const CompactStatus& status) = default;
         /// Return status type
-        StatusType type(void) const;
+        StatusType type() const;
         /// Test whether only advisor \a a was touched
         bool single(Advisor& a) const;
         /// Record that advisor \a a was touched
         void touched(Advisor& a);
         /// Record that no advisor has been touched
-        void none(void);
+        void none();
         /// Record that propagation is in progress
-        void propagating(void);
+        void propagating();
     };
 
     /// Shared implementation of positive compact-table propagation
@@ -519,9 +519,9 @@ namespace Gecode { namespace Int { namespace Extensional {
     class Compact : public Propagator {
     protected:
         /// Range type for supports
-        typedef TupleSet::Range Range;
+        using Range = TupleSet::Range;
         /// Advisor for updating current table
-        typedef CompactAdvisor CTAdvisor;
+        using CTAdvisor = CompactAdvisor;
         //@}
         /// \name Support iterators
         //@{
@@ -543,7 +543,7 @@ namespace Gecode { namespace Int { namespace Extensional {
             /// The value's support
             const BitSetData* support_words;
             /// Find a new value (only for negative case)
-            void find(void);
+            void find();
 
         public:
             /// Initialize from initialized propagator
@@ -551,13 +551,13 @@ namespace Gecode { namespace Int { namespace Extensional {
             /// Initialize during initialization
             ValidSupports(const TupleSet& ts, int i, View x);
             /// Move to next supports
-            void operator++(void);
+            void operator++();
             /// Whether there are still supports left
-            bool operator()(void) const;
+            bool operator()() const;
             /// Return support representation
-            const BitSetData* support(void) const;
+            const BitSetData* support() const;
             /// Return supported value
-            int val(void) const;
+            int val() const;
         };
         /// Iterator over lost supports
         class LostSupports {
@@ -579,21 +579,21 @@ namespace Gecode { namespace Int { namespace Extensional {
             /// Initialize iterator for values between \a first_value and \a last_value
             LostSupports(const Compact& p, CTAdvisor& a, int first_value, int last_value);
             /// Move iterator to next value
-            void operator++(void);
+            void operator++();
             /// Whether iterator is done
-            bool operator()(void) const;
+            bool operator()() const;
             /// Return support representation
-            const BitSetData* support(void) const;
+            const BitSetData* support() const;
         };
         //@}
         /// \name Testing the number of unassigned variables
         //@{
         /// Whether all variables are assigned
-        bool all(void) const;
+        bool all() const;
         /// Whether at most one variable is unassigned
-        bool at_most_one(void) const;
+        bool at_most_one() const;
         //@}
-    protected:
+
         /// Number of words in supports
         const unsigned int n_words;
         /// The tuple set
@@ -640,11 +640,11 @@ namespace Gecode { namespace Int { namespace Extensional {
         friend class PosCompactAlgorithm;
 
     public:
-        typedef View ViewType;
-        typedef typename Compact::ValidSupports ValidSupports;
-        typedef typename Compact::Range Range;
-        typedef typename Compact::CTAdvisor CTAdvisor;
-        typedef typename Compact::LostSupports LostSupports;
+        using ViewType = View;
+        using ValidSupports = Compact::ValidSupports;
+        using Range = Compact::Range;
+        using CTAdvisor = Compact::CTAdvisor;
+        using LostSupports = Compact::LostSupports;
 
         using Compact::setup;
         using Compact::supports;
@@ -654,22 +654,21 @@ namespace Gecode { namespace Int { namespace Extensional {
         using Compact::ts;
 
         /// Status management
-        typedef CompactStatus Status;
+        using Status = CompactStatus;
         /// Status type
-        typedef typename Status::StatusType StatusType;
+        using StatusType = Status::StatusType;
         /// Propagator status
         Status status;
         /// Current table
         Table table;
         /// Check whether the table is empty
-        bool empty(void) const;
+        bool empty() const;
         /// Constructor for cloning \a p
         template 
         PosCompact(Space& home, TableProp& p);
         /// Constructor for posting
         PosCompact(Home home, ViewArray& x, const TupleSet& ts);
 
-    public:
         /// Schedule function
         void reschedule(Space& home) override;
         /// Perform propagation
@@ -712,10 +711,10 @@ namespace Gecode { namespace Int { namespace Extensional {
         friend class NegCompactAlgorithm;
 
     public:
-        typedef View ViewType;
-        typedef typename Compact::ValidSupports ValidSupports;
-        typedef typename Compact::Range Range;
-        typedef typename Compact::CTAdvisor CTAdvisor;
+        using ViewType = View;
+        using ValidSupports = Compact::ValidSupports;
+        using Range = Compact::Range;
+        using CTAdvisor = Compact::CTAdvisor;
 
         using Compact::setup;
         using Compact::full;
@@ -732,7 +731,6 @@ namespace Gecode { namespace Int { namespace Extensional {
         /// Constructor for posting
         NegCompact(Home home, ViewArray& x, const TupleSet& ts);
 
-    public:
         /// Schedule function
         void reschedule(Space& home) override;
         /// Perform propagation
@@ -761,11 +759,11 @@ namespace Gecode { namespace Int { namespace Extensional {
         friend class ReCompactAlgorithm;
 
     public:
-        typedef View ViewType;
+        using ViewType = View;
         static constexpr ReifyMode mode = rm;
-        typedef typename Compact::ValidSupports ValidSupports;
-        typedef typename Compact::Range Range;
-        typedef typename Compact::CTAdvisor CTAdvisor;
+        using ValidSupports = Compact::ValidSupports;
+        using Range = Compact::Range;
+        using CTAdvisor = Compact::CTAdvisor;
 
         using Compact::setup;
         using Compact::full;
@@ -787,7 +785,6 @@ namespace Gecode { namespace Int { namespace Extensional {
         static ExecStatus post_pos(Home home, ViewArray& x, const TupleSet& ts);
         static ExecStatus post_neg(Home home, ViewArray& x, const TupleSet& ts);
 
-    public:
         /// Schedule function
         void reschedule(Space& home) override;
         /// Perform propagation
@@ -809,7 +806,7 @@ namespace Gecode { namespace Int { namespace Extensional {
     template 
     ExecStatus post_reified_compact_compressed(Home home, ViewArray& x, const TupleSet& ts, CtrlView b);
 
-}}} // namespace Gecode::Int::Extensional
+} // namespace Gecode::Int::Extensional
 
 #include 
 
diff --git a/gecode/int/extensional/bit-set.hpp b/gecode/int/extensional/bit-set.hpp
index fb540a16da..9d5ef81a91 100644
--- a/gecode/int/extensional/bit-set.hpp
+++ b/gecode/int/extensional/bit-set.hpp
@@ -34,10 +34,10 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Extensional {
+namespace Gecode::Int::Extensional {
 
     forceinline
-    CompressedSupport::CompressedSupport(void)
+    CompressedSupport::CompressedSupport()
         : b(nullptr), e(nullptr) {}
 
     forceinline
@@ -45,17 +45,17 @@ namespace Gecode { namespace Int { namespace Extensional {
         : b(b0), e(e0) {}
 
     forceinline const TupleSet::CSupportWord*
-    CompressedSupport::begin(void) const {
+    CompressedSupport::begin() const {
         return b;
     }
 
     forceinline const TupleSet::CSupportWord*
-    CompressedSupport::end(void) const {
+    CompressedSupport::end() const {
         return e;
     }
 
     forceinline bool
-    CompressedSupport::empty(void) const {
+    CompressedSupport::empty() const {
         return (b == nullptr) || (b >= e);
     }
 
@@ -78,31 +78,31 @@ namespace Gecode { namespace Int { namespace Extensional {
 
     template 
     forceinline unsigned int
-    BitSet::limit(void) const {
+    BitSet::limit() const {
         return static_cast(_active_words);
     }
 
     template 
     forceinline bool
-    BitSet::empty(void) const {
+    BitSet::empty() const {
         return _active_words == 0U;
     }
 
     template 
     forceinline unsigned int
-    BitSet::words(void) const {
+    BitSet::words() const {
         return static_cast(_active_words);
     }
 
     template 
     forceinline unsigned int
-    BitSet::size(void) const {
+    BitSet::size() const {
         return words();
     }
 
     template 
     forceinline unsigned int
-    BitSet::width(void) const {
+    BitSet::width() const {
         assert(!empty());
         IndexType width = _word_index[0];
         for (IndexType i = 1; i < _active_words; i++)
@@ -151,7 +151,7 @@ namespace Gecode { namespace Int { namespace Extensional {
 
     template 
     forceinline void
-    BitSet::flush(void) {
+    BitSet::flush() {
         _active_words = 0U;
         assert(empty());
     }
@@ -435,7 +435,7 @@ namespace Gecode { namespace Int { namespace Extensional {
 
     template 
     forceinline unsigned long long int
-    BitSet::ones(void) const {
+    BitSet::ones() const {
         unsigned long long int count = 0U;
         for (IndexType i = 0; i < _active_words; i++)
             count += static_cast(_word_bits[i].ones());
@@ -444,11 +444,11 @@ namespace Gecode { namespace Int { namespace Extensional {
 
     template 
     forceinline unsigned long long int
-    BitSet::bits(void) const {
+    BitSet::bits() const {
         return (static_cast(_active_words) *
                 static_cast(BitSetData::bpb));
     }
 
-}}} // namespace Gecode::Int::Extensional
+} // namespace Gecode::Int::Extensional
 
 // STATISTICS: int-prop
diff --git a/gecode/int/extensional/compact.hpp b/gecode/int/extensional/compact.hpp
index 097475059d..59f0c269a7 100644
--- a/gecode/int/extensional/compact.hpp
+++ b/gecode/int/extensional/compact.hpp
@@ -35,7 +35,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Int { namespace Extensional {
+namespace Gecode::Int::Extensional {
 
     /*
      * Shared compact-table advisor
@@ -45,7 +45,7 @@ namespace Gecode { namespace Int { namespace Extensional {
     CompactAdvisorIndex::CompactAdvisorIndex(int) {}
 
     forceinline int
-    CompactAdvisorIndex::index(void) const {
+    CompactAdvisorIndex::index() const {
         return 0;
     }
 
@@ -54,13 +54,13 @@ namespace Gecode { namespace Int { namespace Extensional {
         : _index(i) {}
 
     forceinline int
-    CompactAdvisorIndex::index(void) const {
+    CompactAdvisorIndex::index() const {
         return _index;
     }
 
     template 
     forceinline void
-    CompactAdvisor::adjust(void) {
+    CompactAdvisor::adjust() {
         if (pos) {
             {
                 int n = view().min();
@@ -109,19 +109,19 @@ namespace Gecode { namespace Int { namespace Extensional {
 
     template 
     forceinline int
-    CompactAdvisor::index(void) const {
+    CompactAdvisor::index() const {
         return CompactAdvisorIndex::index();
     }
 
     template 
-    forceinline const typename CompactAdvisor::Range*
-    CompactAdvisor::fst(void) const {
+    forceinline const CompactAdvisor::Range*
+    CompactAdvisor::fst() const {
         return _fst;
     }
 
     template 
-    forceinline const typename CompactAdvisor::Range*
-    CompactAdvisor::lst(void) const {
+    forceinline const CompactAdvisor::Range*
+    CompactAdvisor::lst() const {
         return _lst;
     }
 
@@ -141,8 +141,8 @@ namespace Gecode { namespace Int { namespace Extensional {
         : s(std::to_underlying(t)) {}
 
     template 
-    forceinline typename CompactStatus::StatusType
-    CompactStatus::type(void) const {
+    forceinline CompactStatus::StatusType
+    CompactStatus::type() const {
         return static_cast(s & 0b11);
     }
 
@@ -165,13 +165,13 @@ namespace Gecode { namespace Int { namespace Extensional {
 
     template 
     forceinline void
-    CompactStatus::none(void) {
+    CompactStatus::none() {
         s = std::to_underlying(NONE);
     }
 
     template 
     forceinline void
-    CompactStatus::propagating(void) {
+    CompactStatus::propagating() {
         s = std::to_underlying(PROPAGATING);
     }
 
@@ -229,7 +229,7 @@ namespace Gecode { namespace Int { namespace Extensional {
             }
         }
 
-        if (std::is_same>::value)
+        if (std::is_same_v>)
             return Factory::template copy>(home, source);
 
         switch (Gecode::Support::u_type(width)) {
@@ -238,7 +238,7 @@ namespace Gecode { namespace Int { namespace Extensional {
         case Gecode::Support::IT_SHORT:
             return Factory::template copy>(home, source);
         case Gecode::Support::IT_INT:
-            if (std::is_same>::value)
+            if (std::is_same_v>)
                 return Factory::template copy>(home, source);
             GECODE_NEVER;
         default:
@@ -363,7 +363,7 @@ namespace Gecode { namespace Int { namespace Extensional {
      *
      */
     template 
-    const typename Compact::Range*
+    const Compact::Range*
     Compact::range(CTAdvisor& a, int n) {
         assert((n > a.fst()->max) && (n < a.lst()->min));
 
@@ -387,12 +387,10 @@ namespace Gecode { namespace Int { namespace Extensional {
         if (pos) {
             assert((f->min <= n) && (n <= f->max));
             return f;
-        } else {
-            if ((f <= l) && (f->min <= n) && (n <= f->max))
-                return f;
-            else
-                return nullptr;
         }
+        if ((f <= l) && (f->min <= n) && (n <= f->max))
+            return f;
+        return nullptr;
     }
 
     template 
@@ -430,7 +428,7 @@ namespace Gecode { namespace Int { namespace Extensional {
 
     template 
     forceinline void
-    Compact::ValidSupports::find(void) {
+    Compact::ValidSupports::find() {
         assert(!pos);
         assert(value <= max_value);
         while (true) {
@@ -490,7 +488,7 @@ namespace Gecode { namespace Int { namespace Extensional {
     }
     template 
     forceinline void
-    Compact::ValidSupports::operator++(void) {
+    Compact::ValidSupports::operator++() {
         value++;
         if (pos) {
             if (value <= view_ranges.max()) {
@@ -517,18 +515,18 @@ namespace Gecode { namespace Int { namespace Extensional {
     }
     template 
     forceinline bool
-    Compact::ValidSupports::operator()(void) const {
+    Compact::ValidSupports::operator()() const {
         return value <= max_value;
     }
     template 
     forceinline const BitSetData*
-    Compact::ValidSupports::support(void) const {
+    Compact::ValidSupports::support() const {
         assert(support_words == support_range->supports(n_words, value));
         return support_words;
     }
     template 
     forceinline int
-    Compact::ValidSupports::val(void) const {
+    Compact::ValidSupports::val() const {
         return value;
     }
 
@@ -551,7 +549,7 @@ namespace Gecode { namespace Int { namespace Extensional {
     }
     template 
     forceinline void
-    Compact::LostSupports::operator++(void) {
+    Compact::LostSupports::operator++() {
         value++;
         support_words += n_words;
         while ((value <= last_value) && (value > support_range->max)) {
@@ -562,12 +560,12 @@ namespace Gecode { namespace Int { namespace Extensional {
     }
     template 
     forceinline bool
-    Compact::LostSupports::operator()(void) const {
+    Compact::LostSupports::operator()() const {
         return value <= last_value;
     }
     template 
     forceinline const TupleSet::BitSetData*
-    Compact::LostSupports::support(void) const {
+    Compact::LostSupports::support() const {
         assert((value >= support_range->min) && (value <= support_range->max));
         assert(support_words == support_range->supports(n_words, value));
         return support_words;
@@ -575,12 +573,12 @@ namespace Gecode { namespace Int { namespace Extensional {
 
     template 
     forceinline bool
-    Compact::all(void) const {
+    Compact::all() const {
         return compact_all(c);
     }
     template 
     forceinline bool
-    Compact::at_most_one(void) const {
+    Compact::at_most_one() const {
         return compact_atmostone(c);
     }
 
@@ -693,7 +691,7 @@ namespace Gecode { namespace Int { namespace Extensional {
 
         static ExecStatus
         advise(Actor& actor, Space& home, Advisor& advisor0, const Delta& delta) {
-            typename Actor::CTAdvisor& advisor = static_cast(advisor0);
+            typename Actor::CTAdvisor& advisor = static_cast(advisor0);
             if (actor.table.empty())
                 return actor.disabled() ? home.ES_NOFIX_DISPOSE(actor.c, advisor) : ES_FAILED;
 
@@ -830,7 +828,7 @@ namespace Gecode { namespace Int { namespace Extensional {
 
         static ExecStatus
         advise(Actor& actor, Space& home, Advisor& advisor0) {
-            typename Actor::CTAdvisor& advisor = static_cast(advisor0);
+            typename Actor::CTAdvisor& advisor = static_cast(advisor0);
             if (actor.table.empty())
                 return home.ES_NOFIX_DISPOSE(actor.c, advisor);
 
@@ -903,7 +901,7 @@ namespace Gecode { namespace Int { namespace Extensional {
 
         static ExecStatus
         advise(Actor& actor, Space& home, Advisor& advisor0) {
-            typename Actor::CTAdvisor& advisor = static_cast(advisor0);
+            typename Actor::CTAdvisor& advisor = static_cast(advisor0);
             if (actor.table.empty() || actor.b.assigned())
                 return home.ES_NOFIX_DISPOSE(actor.c, advisor);
 
@@ -952,7 +950,7 @@ namespace Gecode { namespace Int { namespace Extensional {
     template 
     Actor*
     PosCompact::copy(Space& home) {
-        typedef CompactActorFactory Factory;
+        using Factory = CompactActorFactory;
         return compact_copy(home, *this);
     }
 
@@ -1054,7 +1052,7 @@ namespace Gecode { namespace Int { namespace Extensional {
     template 
     Actor*
     NegCompact::copy(Space& home) {
-        typedef CompactActorFactory Factory;
+        using Factory = CompactActorFactory;
         return compact_copy(home, *this);
     }
 
@@ -1159,7 +1157,7 @@ namespace Gecode { namespace Int { namespace Extensional {
     template 
     Actor*
     ReCompact::copy(Space& home) {
-        typedef ReCompactActorFactory Factory;
+        using Factory = ReCompactActorFactory;
         return compact_copy(home, *this);
     }
 
@@ -1289,9 +1287,9 @@ namespace Gecode { namespace Int { namespace Extensional {
     template 
     class CompactCompressed : public Propagator {
     protected:
-        typedef TupleSet::Range Range;
-        typedef TupleSet::CSupportWord CSupportWord;
-        typedef CompactAdvisor CTAdvisor;
+        using Range = TupleSet::Range;
+        using CSupportWord = TupleSet::CSupportWord;
+        using CTAdvisor = CompactAdvisor;
 
         class ValidSupports {
         protected:
@@ -1305,7 +1303,7 @@ namespace Gecode { namespace Int { namespace Extensional {
             const CSupportWord* support_end;
             bool valid;
             void
-            find(void) {
+            find() {
                 while (view_ranges() && (support_range <= last_support_range)) {
                     if (value < view_ranges.min())
                         value = view_ranges.min();
@@ -1358,20 +1356,20 @@ namespace Gecode { namespace Int { namespace Extensional {
                 }
             }
             void
-            operator++(void) {
+            operator++() {
                 value++;
                 find();
             }
             bool
-            operator()(void) const {
+            operator()() const {
                 return valid;
             }
             int
-            val(void) const {
+            val() const {
                 return value;
             }
             CompressedSupport
-            support(void) const {
+            support() const {
                 return CompressedSupport(support_begin, support_end);
             }
         };
@@ -1388,10 +1386,9 @@ namespace Gecode { namespace Int { namespace Extensional {
             const CSupportWord* support_end;
             bool valid;
             void
-            find(void) {
+            find() {
                 while ((value <= last_value) && (support_range <= last_support_range)) {
-                    if (value < support_range->min)
-                        value = support_range->min;
+                    value = std::max(value, support_range->min);
                     if (value > last_value)
                         break;
                     while ((support_range <= last_support_range) && (value > support_range->max))
@@ -1419,30 +1416,29 @@ namespace Gecode { namespace Int { namespace Extensional {
                 find();
             }
             void
-            operator++(void) {
+            operator++() {
                 value++;
                 find();
             }
             bool
-            operator()(void) const {
+            operator()() const {
                 return valid;
             }
             CompressedSupport
-            support(void) const {
+            support() const {
                 return CompressedSupport(support_begin, support_end);
             }
         };
 
         bool
-        all(void) const {
+        all() const {
             return compact_all(c);
         }
         bool
-        at_most_one(void) const {
+        at_most_one() const {
             return compact_atmostone(c);
         }
 
-    protected:
         const unsigned int n_words;
         TupleSet ts;
         Council c;
@@ -1497,11 +1493,11 @@ namespace Gecode { namespace Int { namespace Extensional {
         friend class PosCompactAlgorithm;
 
     public:
-        typedef View ViewType;
-        typedef CompactCompressed Base;
-        typedef typename Base::ValidSupports ValidSupports;
-        typedef typename Base::CTAdvisor CTAdvisor;
-        typedef typename Base::LostSupports LostSupports;
+        using ViewType = View;
+        using Base = CompactCompressed;
+        using ValidSupports = Base::ValidSupports;
+        using CTAdvisor = Base::CTAdvisor;
+        using LostSupports = Base::LostSupports;
 
         using Base::all;
         using Base::at_most_one;
@@ -1510,8 +1506,8 @@ namespace Gecode { namespace Int { namespace Extensional {
         using Base::supports;
         using Base::ts;
 
-        typedef CompactStatus Status;
-        typedef typename Status::StatusType StatusType;
+        using Status = CompactStatus;
+        using StatusType = Status::StatusType;
 
         Status status;
         Table table;
@@ -1527,7 +1523,7 @@ namespace Gecode { namespace Int { namespace Extensional {
 
         Actor*
         copy(Space& home) override {
-            typedef CompactActorFactory Factory;
+            using Factory = CompactActorFactory;
             return compact_copy(home, *this);
         }
 
@@ -1607,10 +1603,10 @@ namespace Gecode { namespace Int { namespace Extensional {
         friend class NegCompactAlgorithm;
 
     public:
-        typedef View ViewType;
-        typedef CompactCompressed Base;
-        typedef typename Base::ValidSupports ValidSupports;
-        typedef typename Base::CTAdvisor CTAdvisor;
+        using ViewType = View;
+        using Base = CompactCompressed;
+        using ValidSupports = Base::ValidSupports;
+        using CTAdvisor = Base::CTAdvisor;
 
         using Base::at_most_one;
         using Base::c;
@@ -1630,7 +1626,7 @@ namespace Gecode { namespace Int { namespace Extensional {
 
         Actor*
         copy(Space& home) override {
-            typedef CompactActorFactory Factory;
+            using Factory = CompactActorFactory;
             return compact_copy(home, *this);
         }
 
@@ -1709,11 +1705,11 @@ namespace Gecode { namespace Int { namespace Extensional {
         friend class ReCompactAlgorithm;
 
     public:
-        typedef View ViewType;
+        using ViewType = View;
         static constexpr ReifyMode mode = rm;
-        typedef CompactCompressed Base;
-        typedef typename Base::ValidSupports ValidSupports;
-        typedef typename Base::CTAdvisor CTAdvisor;
+        using Base = CompactCompressed;
+        using ValidSupports = Base::ValidSupports;
+        using CTAdvisor = Base::CTAdvisor;
 
         using Base::c;
         using Base::full;
@@ -1738,7 +1734,7 @@ namespace Gecode { namespace Int { namespace Extensional {
 
         Actor*
         copy(Space& home) override {
-            typedef ReCompactActorFactory Factory;
+            using Factory = ReCompactActorFactory;
             return compact_copy(home, *this);
         }
 
@@ -1842,6 +1838,6 @@ namespace Gecode { namespace Int { namespace Extensional {
         return ES_OK;
     }
 
-}}} // namespace Gecode::Int::Extensional
+} // namespace Gecode::Int::Extensional
 
 // STATISTICS: int-prop
diff --git a/gecode/int/extensional/dfa.cpp b/gecode/int/extensional/dfa.cpp
index dd725139b6..d566608988 100644
--- a/gecode/int/extensional/dfa.cpp
+++ b/gecode/int/extensional/dfa.cpp
@@ -35,7 +35,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Int { namespace Extensional {
+namespace Gecode::Int::Extensional {
 
     /**
      * \brief Sort transition array by input state
@@ -136,9 +136,9 @@ namespace Gecode { namespace Int { namespace Extensional {
     };
 
     /// Return the compact index for an external state identifier
-    forceinline int
+    static forceinline int
     state_index(const std::vector& states, int state) {
-        return static_cast(std::lower_bound(states.begin(), states.end(), state) - states.begin());
+        return static_cast(std::ranges::lower_bound(states, state) - states.begin());
     }
 
     /// Information about states
@@ -149,7 +149,7 @@ namespace Gecode { namespace Int { namespace Extensional {
         SI_FINAL = 4       ///< State is final
     };
 
-}}} // namespace Gecode::Int::Extensional
+} // namespace Gecode::Int::Extensional
 
 namespace Gecode {
 
@@ -186,8 +186,8 @@ namespace Gecode {
             }
             for (int* f = &f_spec[0]; *f >= 0; f++)
                 states.push_back(*f);
-            std::sort(states.begin(), states.end());
-            states.erase(std::unique(states.begin(), states.end()), states.end());
+            std::ranges::sort(states);
+            states.erase(std::ranges::unique(states).begin(), states.end());
             n_states = static_cast(states.size());
             start = state_index(states, start);
         } else {
diff --git a/gecode/int/extensional/dfa.hpp b/gecode/int/extensional/dfa.hpp
index 7cab49768c..6bbe74ce87 100644
--- a/gecode/int/extensional/dfa.hpp
+++ b/gecode/int/extensional/dfa.hpp
@@ -31,6 +31,7 @@
  */
 
 #include 
+#include 
 
 namespace Gecode {
 
@@ -68,25 +69,25 @@ namespace Gecode {
         /// Size of table (as binary logarithm)
         int n_log;
         /// Fill hash table
-        void fill(void);
+        void fill();
         /// Initialize automaton implementation with \a nt transitions
         DFAI(int nt);
         /// Delete automaton implemenentation
-        ~DFAI(void) override;
+        ~DFAI() override;
     };
 
     forceinline
     DFA::DFAI::DFAI(int nt)
         : trans(nt == 0 ? nullptr : heap.alloc(nt)) {}
 
-    forceinline DFA::DFAI::~DFAI(void) {
+    forceinline DFA::DFAI::~DFAI() {
         if (n_trans > 0)
             heap.rfree(trans);
         heap.rfree(table);
     }
 
     forceinline void
-    DFA::DFAI::fill(void) {
+    DFA::DFAI::fill() {
         key = static_cast(n_states);
         cmb_hash(key, n_trans);
         cmb_hash(key, n_symbols);
@@ -94,7 +95,7 @@ namespace Gecode {
         cmb_hash(key, final_lst);
         // Compute smallest logarithm larger than n_symbols
         n_log = 1;
-        while (n_symbols >= static_cast(1 << n_log))
+        while (std::cmp_greater_equal(n_symbols, 1 << n_log))
             n_log++;
         // Allocate memory
         table = heap.alloc(1 << n_log);
@@ -124,55 +125,55 @@ namespace Gecode {
     }
 
     forceinline int
-    DFA::n_states(void) const {
+    DFA::n_states() const {
         const DFAI* d = static_cast(object());
         return (d == nullptr) ? 1 : d->n_states;
     }
 
     forceinline unsigned int
-    DFA::n_symbols(void) const {
+    DFA::n_symbols() const {
         const DFAI* d = static_cast(object());
         return (d == nullptr) ? 0 : d->n_symbols;
     }
 
     forceinline int
-    DFA::n_transitions(void) const {
+    DFA::n_transitions() const {
         const DFAI* d = static_cast(object());
         return (d == nullptr) ? 0 : d->n_trans;
     }
 
     forceinline unsigned int
-    DFA::max_degree(void) const {
+    DFA::max_degree() const {
         const DFAI* d = static_cast(object());
         return (d == nullptr) ? 0 : d->max_degree;
     }
 
     forceinline int
-    DFA::final_fst(void) const {
+    DFA::final_fst() const {
         const DFAI* d = static_cast(object());
         return (d == nullptr) ? 0 : d->final_fst;
     }
 
     forceinline int
-    DFA::final_lst(void) const {
+    DFA::final_lst() const {
         const DFAI* d = static_cast(object());
         return (d == nullptr) ? 0 : d->final_lst;
     }
 
     forceinline int
-    DFA::symbol_min(void) const {
+    DFA::symbol_min() const {
         const DFAI* d = static_cast(object());
         return ((d != nullptr) && (d->n_trans > 0)) ? d->trans[0].symbol : Int::Limits::min;
     }
 
     forceinline int
-    DFA::symbol_max(void) const {
+    DFA::symbol_max() const {
         const DFAI* d = static_cast(object());
         return ((d != nullptr) && (d->n_trans > 0)) ? d->trans[d->n_trans - 1].symbol : Int::Limits::max;
     }
 
     forceinline std::size_t
-    DFA::hash(void) const {
+    DFA::hash() const {
         const DFAI* d = static_cast(object());
         return (d != nullptr) ? d->key : 0;
     }
@@ -184,7 +185,7 @@ namespace Gecode {
 
     forceinline
     // NOLINTNEXTLINE(modernize-use-equals-default)
-    DFA::Transition::Transition(void) {}
+    DFA::Transition::Transition() {}
 
     forceinline
     DFA::Transition::Transition(int i_state0, int symbol0, int o_state0)
@@ -222,27 +223,27 @@ namespace Gecode {
     }
 
     forceinline bool
-    DFA::Transitions::operator()(void) const {
+    DFA::Transitions::operator()() const {
         return c_trans < e_trans;
     }
 
     forceinline void
-    DFA::Transitions::operator++(void) {
+    DFA::Transitions::operator++() {
         c_trans++;
     }
 
     forceinline int
-    DFA::Transitions::i_state(void) const {
+    DFA::Transitions::i_state() const {
         return c_trans->i_state;
     }
 
     forceinline int
-    DFA::Transitions::symbol(void) const {
+    DFA::Transitions::symbol() const {
         return c_trans->symbol;
     }
 
     forceinline int
-    DFA::Transitions::o_state(void) const {
+    DFA::Transitions::o_state() const {
         return c_trans->o_state;
     }
 
@@ -263,12 +264,12 @@ namespace Gecode {
     }
 
     forceinline bool
-    DFA::Symbols::operator()(void) const {
+    DFA::Symbols::operator()() const {
         return c_trans < e_trans;
     }
 
     forceinline void
-    DFA::Symbols::operator++(void) {
+    DFA::Symbols::operator++() {
         int s = c_trans->symbol;
         do {
             c_trans++;
@@ -276,7 +277,7 @@ namespace Gecode {
     }
 
     forceinline int
-    DFA::Symbols::val(void) const {
+    DFA::Symbols::val() const {
         return c_trans->symbol;
     }
 
@@ -287,7 +288,7 @@ namespace Gecode {
         st.copyfmt(os);
         st.width(0);
         st << "Start state: 0" << '\n' << "States:      0..." << d.n_states() - 1 << '\n' << "Transitions:";
-        for (int s = 0; s < static_cast(d.n_states()); s++) {
+        for (int s = 0; s < d.n_states(); s++) {
             DFA::Transitions t(d);
             int n = 0;
             while (t()) {
diff --git a/gecode/int/extensional/layered-graph.hpp b/gecode/int/extensional/layered-graph.hpp
index 57d1855392..f828a82b71 100644
--- a/gecode/int/extensional/layered-graph.hpp
+++ b/gecode/int/extensional/layered-graph.hpp
@@ -34,7 +34,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Int { namespace Extensional {
+namespace Gecode::Int::Extensional {
 
     /**
      * \brief Traits class for variables
@@ -54,7 +54,7 @@ namespace Gecode { namespace Int { namespace Extensional {
     class VarTraits {
     public:
         /// The variable type of an IntView
-        typedef Int::IntView View;
+        using View = Int::IntView;
     };
 
     /**
@@ -66,7 +66,7 @@ namespace Gecode { namespace Int { namespace Extensional {
     class VarTraits {
     public:
         /// The variable type of an IntView
-        typedef Int::BoolView View;
+        using View = Int::BoolView;
     };
 
     /*
@@ -74,40 +74,38 @@ namespace Gecode { namespace Int { namespace Extensional {
      */
     template 
     forceinline void
-    LayeredGraph::State::init(void) {
+    LayeredGraph::State::init() {
         i_deg = o_deg = 0;
     }
 
     template 
-    forceinline typename LayeredGraph::State&
+    forceinline LayeredGraph::State&
     LayeredGraph::i_state(int i, StateIdx is) {
         return layers[i].states[is];
     }
     template 
-    forceinline typename LayeredGraph::State&
+    forceinline LayeredGraph::State&
     LayeredGraph::i_state(int i, const Edge& e) {
         return i_state(i, e.i_state);
     }
     template 
     forceinline bool
-    LayeredGraph::i_dec(
-        int i, const typename LayeredGraph::Edge& e) {
+    LayeredGraph::i_dec(int i, const LayeredGraph::Edge& e) {
         return --i_state(i, e).o_deg == 0;
     }
     template 
-    forceinline typename LayeredGraph::State&
+    forceinline LayeredGraph::State&
     LayeredGraph::o_state(int i, StateIdx os) {
         return layers[i + 1].states[os];
     }
     template 
-    forceinline typename LayeredGraph::State&
+    forceinline LayeredGraph::State&
     LayeredGraph::o_state(int i, const Edge& e) {
         return o_state(i, e.o_state);
     }
     template 
     forceinline bool
-    LayeredGraph::o_dec(
-        int i, const typename LayeredGraph::Edge& e) {
+    LayeredGraph::o_dec(int i, const LayeredGraph::Edge& e) {
         return --o_state(i, e).i_deg == 0;
     }
 
@@ -126,17 +124,17 @@ namespace Gecode { namespace Int { namespace Extensional {
     }
     template 
     forceinline bool
-    LayeredGraph::LayerValues ::operator()(void) const {
+    LayeredGraph::LayerValues ::operator()() const {
         return s1 < s2;
     }
     template 
     forceinline void
-    LayeredGraph::LayerValues::operator++(void) {
+    LayeredGraph::LayerValues::operator++() {
         s1++;
     }
     template 
     forceinline int
-    LayeredGraph::LayerValues::val(void) const {
+    LayeredGraph::LayerValues::val() const {
         return s1->val;
     }
 
@@ -160,11 +158,11 @@ namespace Gecode { namespace Int { namespace Extensional {
      */
     template 
     forceinline
-    LayeredGraph::IndexRange::IndexRange(void)
+    LayeredGraph::IndexRange::IndexRange()
         : _fst(INT_MAX), _lst(INT_MIN) {}
     template 
     forceinline void
-    LayeredGraph::IndexRange::reset(void) {
+    LayeredGraph::IndexRange::reset() {
         _fst = INT_MAX;
         _lst = INT_MIN;
     }
@@ -182,7 +180,7 @@ namespace Gecode { namespace Int { namespace Extensional {
     }
     template 
     forceinline bool
-    LayeredGraph::IndexRange::empty(void) const {
+    LayeredGraph::IndexRange::empty() const {
         return _fst > _lst;
     }
     template 
@@ -199,12 +197,12 @@ namespace Gecode { namespace Int { namespace Extensional {
     }
     template 
     forceinline int
-    LayeredGraph::IndexRange::fst(void) const {
+    LayeredGraph::IndexRange::fst() const {
         return _fst;
     }
     template 
     forceinline int
-    LayeredGraph::IndexRange::lst(void) const {
+    LayeredGraph::IndexRange::lst() const {
         return _lst;
     }
 
@@ -223,7 +221,7 @@ namespace Gecode { namespace Int { namespace Extensional {
 
     template 
     forceinline void
-    LayeredGraph::audit(void) {
+    LayeredGraph::audit() {
 #ifdef GECODE_AUDIT
         // Check states and edge information to be consistent
         unsigned int n_e = 0; // Number of edges
@@ -303,7 +301,8 @@ namespace Gecode { namespace Int { namespace Extensional {
                         j++;
                     }
                 }
-                if ((layers[i].size = j) == 0)
+                layers[i].size = j;
+                if (j == 0)
                     return ES_FAILED;
                 std::swap(i_reachable, o_reachable);
                 std::swap(i_reached, o_reached);
@@ -389,7 +388,8 @@ namespace Gecode { namespace Int { namespace Extensional {
                     total_edges += n_support_edges;
                 }
             }
-            if ((layers[i].size = n_supports) == 0)
+            layers[i].size = n_supports;
+            if (n_supports == 0)
                 return ES_FAILED;
             layers[i].n_states = static_cast(n_i_mapped);
             total_states += n_i_mapped;
@@ -405,8 +405,8 @@ namespace Gecode { namespace Int { namespace Extensional {
             std::swap(n_i_mapped, n_o_mapped);
         }
 
-        if ((total_states > static_cast((std::numeric_limits::max)())) ||
-            (total_edges > static_cast((std::numeric_limits::max)())))
+        if ((total_states > static_cast(std::numeric_limits::max())) ||
+            (total_edges > static_cast(std::numeric_limits::max())))
             throw OutOfLimits("Int::regular");
         n_states = static_cast(total_states);
         n_edges = static_cast(total_edges);
@@ -475,9 +475,8 @@ namespace Gecode { namespace Int { namespace Extensional {
             if (View::modification_event(d) == ME_INT_VAL) {
                 a.dispose(home, c);
                 return c.empty() ? ES_NOFIX : ES_FIX;
-            } else {
-                return ES_FIX;
             }
+            return ES_FIX;
         }
 
         bool i_mod = false;
@@ -586,9 +585,8 @@ namespace Gecode { namespace Int { namespace Extensional {
                 return c.empty() ? ES_NOFIX : ES_FIX;
             }
             return ES_FIX;
-        } else {
-            return (View::modification_event(d) == ME_INT_VAL) ? home.ES_NOFIX_DISPOSE(c, a) : ES_NOFIX;
         }
+        return (View::modification_event(d) == ME_INT_VAL) ? home.ES_NOFIX_DISPOSE(c, a) : ES_NOFIX;
     }
 
     template 
@@ -685,8 +683,7 @@ namespace Gecode { namespace Int { namespace Extensional {
         // Check subsumption
         if (c.empty())
             return home.ES_SUBSUMED(*this);
-        else
-            return ES_FIX;
+        return ES_FIX;
     }
 
     template 
@@ -971,6 +968,6 @@ namespace Gecode { namespace Int { namespace Extensional {
         return ES_OK;
     }
 
-}}} // namespace Gecode::Int::Extensional
+} // namespace Gecode::Int::Extensional
 
 // STATISTICS: int-prop
diff --git a/gecode/int/extensional/open.hpp b/gecode/int/extensional/open.hpp
index e9d680e60b..2838e36b01 100644
--- a/gecode/int/extensional/open.hpp
+++ b/gecode/int/extensional/open.hpp
@@ -37,7 +37,7 @@
 #include 
 #include 
 
-namespace Gecode { namespace Int { namespace Extensional {
+namespace Gecode::Int::Extensional {
 
     /// Shortest accepting suffix length from each state, or -1 if none exists
     inline SharedArray
@@ -145,7 +145,7 @@ namespace Gecode { namespace Int { namespace Extensional {
             const int k = dfa.n_states();
             const unsigned long long cells =
                 static_cast(n + 1) * static_cast(k);
-            if (cells > static_cast((std::numeric_limits::max)()))
+            if (cells > static_cast(std::numeric_limits::max()))
                 throw OutOfLimits("Int::extensional");
 
             unsigned char* backward = r.alloc(static_cast(cells));
@@ -304,7 +304,7 @@ namespace Gecode { namespace Int { namespace Extensional {
         }
     };
 
-}}} // namespace Gecode::Int::Extensional
+} // namespace Gecode::Int::Extensional
 
 #endif
 
diff --git a/gecode/int/extensional/tiny-bit-set.hpp b/gecode/int/extensional/tiny-bit-set.hpp
index 036179d9df..c1506792f3 100644
--- a/gecode/int/extensional/tiny-bit-set.hpp
+++ b/gecode/int/extensional/tiny-bit-set.hpp
@@ -34,7 +34,7 @@
  *
  */
 
-namespace Gecode { namespace Int { namespace Extensional {
+namespace Gecode::Int::Extensional {
 
     /*
      * Tiny bit-set
@@ -165,7 +165,7 @@ namespace Gecode { namespace Int { namespace Extensional {
 
     template 
     forceinline void
-    TinyBitSet::flush(void) {
+    TinyBitSet::flush() {
         for (unsigned int i = 0U; i < sz; i++)
             _bits[i].init(false);
         assert(empty());
@@ -214,7 +214,7 @@ namespace Gecode { namespace Int { namespace Extensional {
 
     template 
     forceinline unsigned long long int
-    TinyBitSet::ones(void) const {
+    TinyBitSet::ones() const {
         unsigned long long int o = 0U;
         for (unsigned int i = 0U; i < sz; i++)
             o += static_cast(_bits[i].ones());
@@ -223,13 +223,13 @@ namespace Gecode { namespace Int { namespace Extensional {
 
     template 
     forceinline unsigned long long int
-    TinyBitSet::bits(void) const {
+    TinyBitSet::bits() const {
         return (static_cast(sz) * static_cast(BitSetData::bpb));
     }
 
     template 
     forceinline bool
-    TinyBitSet::empty(void) const { // Linear complexity...
+    TinyBitSet::empty() const { // Linear complexity...
         for (unsigned int i = 0U; i < sz; i++)
             if (!_bits[i].none())
                 return false;
@@ -238,7 +238,7 @@ namespace Gecode { namespace Int { namespace Extensional {
 
     template 
     forceinline unsigned int
-    TinyBitSet::width(void) const {
+    TinyBitSet::width() const {
         assert(!empty());
         /// Find the index of the last non-zero word
         for (unsigned int i = sz; i--;)
@@ -250,16 +250,16 @@ namespace Gecode { namespace Int { namespace Extensional {
 
     template 
     forceinline unsigned int
-    TinyBitSet::words(void) const {
+    TinyBitSet::words() const {
         return width();
     }
 
     template 
     forceinline unsigned int
-    TinyBitSet::size(void) const {
+    TinyBitSet::size() const {
         return sz;
     }
 
-}}} // namespace Gecode::Int::Extensional
+} // namespace Gecode::Int::Extensional
 
 // STATISTICS: int-prop
diff --git a/gecode/int/extensional/tuple-set.cpp b/gecode/int/extensional/tuple-set.cpp
index 548c4c2b98..dc65316f32 100644
--- a/gecode/int/extensional/tuple-set.cpp
+++ b/gecode/int/extensional/tuple-set.cpp
@@ -37,11 +37,12 @@
 #include 
 #include 
 #include 
+#include 
 
-namespace Gecode { namespace Int { namespace Extensional {
+namespace Gecode::Int::Extensional {
 
     /// Import tuple type
-    typedef ::Gecode::TupleSet::Tuple Tuple;
+    using Tuple = ::Gecode::TupleSet::Tuple;
 
     /// Tuple comparison
     class TupleCompare {
@@ -92,7 +93,7 @@ namespace Gecode { namespace Int { namespace Extensional {
         return a[p] < b[p];
     }
 
-}}} // namespace Gecode::Int::Extensional
+} // namespace Gecode::Int::Extensional
 
 namespace Gecode {
 
@@ -112,7 +113,7 @@ namespace Gecode {
      *
      */
     void
-    TupleSet::Data::clear_support(void) {
+    TupleSet::Data::clear_support() {
         free_buffer(range);
         free_buffer(range_base);
         free_buffer(support);
@@ -187,7 +188,7 @@ namespace Gecode {
     }
 
     void
-    TupleSet::Data::finalize(void) {
+    TupleSet::Data::finalize() {
         finalize(EPK_DENSE);
     }
 
@@ -205,7 +206,7 @@ namespace Gecode {
 
         public:
             FinalizeGuard(Data& d0) : d(d0), committed(false) {}
-            ~FinalizeGuard(void) {
+            ~FinalizeGuard() {
                 if (!committed) {
                     d.clear_support();
                     d.n_words = 0U;
@@ -455,8 +456,8 @@ namespace Gecode {
                 }
                 for (unsigned int i = 0U; i < n_offsets; i++)
                     support_offsets[i] = 0U;
-                for (unsigned int tid = 0U; tid < static_cast(n_tuples); tid++) {
-                    const Tuple t = td + tid * arity;
+                for (unsigned int tid = 0U; std::cmp_less(tid, n_tuples); tid++) {
+                    const int* t = td + tid * arity;
                     for (int a = 0; a < arity; a++) {
                         const unsigned int range_index = vd[a].start(t[a]);
                         const unsigned int support_id =
@@ -475,7 +476,7 @@ namespace Gecode {
                     unsigned int* next_support = (n_vals > 0U) ? region.alloc(n_vals) : nullptr;
                     for (unsigned int i = 0U; i < n_vals; i++)
                         next_support[i] = sparse_offsets[i];
-                    for (unsigned int tid = 0U; tid < static_cast(n_tuples); tid++) {
+                    for (unsigned int tid = 0U; std::cmp_less(tid, n_tuples); tid++) {
                         for (int a = 0; a < arity; a++) {
                             const unsigned int support_id = sparse_tv[tid * arity + a];
                             sparse_tuples[next_support[support_id]++] = tid;
@@ -488,8 +489,8 @@ namespace Gecode {
                         next_support[i] = support_offsets[i];
                     // Tuple ids are visited in increasing order, so each support list
                     // is already sorted by tuple id (and hence by word index).
-                    for (unsigned int tid = 0U; tid < static_cast(n_tuples); tid++) {
-                        const Tuple t = td + tid * arity;
+                    for (unsigned int tid = 0U; std::cmp_less(tid, n_tuples); tid++) {
+                        const int* t = td + tid * arity;
                         for (int a = 0; a < arity; a++) {
                             const unsigned int range_index = vd[a].start(t[a]);
                             const unsigned int support_id =
@@ -563,7 +564,7 @@ namespace Gecode {
     }
 
     void
-    TupleSet::Data::resize(void) {
+    TupleSet::Data::resize() {
         assert(n_free == 0);
         int n = static_cast(1 + n_tuples * 1.5);
         if (arity > 0)
@@ -571,7 +572,7 @@ namespace Gecode {
         n_free = n - n_tuples;
     }
 
-    TupleSet::Data::~Data(void) {
+    TupleSet::Data::~Data() {
         clear_support();
         free_buffer(td);
         free_buffer(vd);
diff --git a/gecode/int/extensional/tuple-set.hpp b/gecode/int/extensional/tuple-set.hpp
index 6fdd3fd434..1b3fde6a65 100644
--- a/gecode/int/extensional/tuple-set.hpp
+++ b/gecode/int/extensional/tuple-set.hpp
@@ -41,7 +41,7 @@ namespace Gecode {
      *
      */
     forceinline unsigned int
-    TupleSet::Range::width(void) const {
+    TupleSet::Range::width() const {
         return static_cast(max - min + 1);
     }
 
@@ -68,22 +68,22 @@ namespace Gecode {
           compressed_words(nullptr), compressed_n_entries(0U) {}
 
     forceinline bool
-    TupleSet::Data::finalized(void) const {
+    TupleSet::Data::finalized() const {
         return (state == TS_DENSE) || (state == TS_SPARSE) || (state == TS_DENSE_COMPRESSED);
     }
 
     forceinline bool
-    TupleSet::Data::failed(void) const {
+    TupleSet::Data::failed() const {
         return state == TS_FAILED;
     }
 
     forceinline bool
-    TupleSet::Data::terminal(void) const {
+    TupleSet::Data::terminal() const {
         return state != TS_BUILDING;
     }
 
     forceinline TupleSet::Tuple
-    TupleSet::Data::add(void) {
+    TupleSet::Data::add() {
         if (n_free == 0)
             resize();
         assert(n_free > 0);
@@ -130,6 +130,7 @@ namespace Gecode {
     }
 
     forceinline unsigned int
+    // NOLINTNEXTLINE(readability-non-const-parameter): Tuple is already a pointer to const
     TupleSet::Data::tuple_to_index(Tuple t) const {
         return static_cast((t - td) / static_cast(arity));
     }
@@ -154,12 +155,12 @@ namespace Gecode {
     }
 
     forceinline TupleSet::
-    operator bool(void) const {
+    operator bool() const {
         return object() != nullptr;
     }
 
     forceinline void
-    TupleSet::finalize(void) {
+    TupleSet::finalize() {
         Data* d = static_cast(object());
         if (d == nullptr)
             throw Int::UninitializedTupleSet("TupleSet::finalize()");
@@ -181,19 +182,19 @@ namespace Gecode {
     }
 
     forceinline bool
-    TupleSet::finalized(void) const {
+    TupleSet::finalized() const {
         const Data* d = static_cast(object());
         return (d != nullptr) && d->finalized();
     }
 
     forceinline bool
-    TupleSet::failed(void) const {
+    TupleSet::failed() const {
         const Data* d = static_cast(object());
         return (d != nullptr) && d->failed();
     }
 
     forceinline TupleSet::Data&
-    TupleSet::data(void) const {
+    TupleSet::data() const {
         Data* d = static_cast(object());
         if (d == nullptr)
             throw Int::UninitializedTupleSet("TupleSet");
@@ -202,7 +203,7 @@ namespace Gecode {
         return *d;
     }
     forceinline TupleSet::Data&
-    TupleSet::raw(void) const {
+    TupleSet::raw() const {
         Data* d = static_cast(object());
         if (d == nullptr)
             throw Int::UninitializedTupleSet("TupleSet");
@@ -214,23 +215,23 @@ namespace Gecode {
         return !(*this == t);
     }
     forceinline int
-    TupleSet::arity(void) const {
+    TupleSet::arity() const {
         return raw().arity;
     }
     forceinline int
-    TupleSet::tuples(void) const {
+    TupleSet::tuples() const {
         return raw().n_tuples;
     }
     forceinline unsigned int
-    TupleSet::words(void) const {
+    TupleSet::words() const {
         return data().n_words;
     }
     forceinline int
-    TupleSet::min(void) const {
+    TupleSet::min() const {
         return data().min;
     }
     forceinline int
-    TupleSet::max(void) const {
+    TupleSet::max() const {
         return data().max;
     }
     forceinline TupleSet::Tuple
@@ -260,12 +261,12 @@ namespace Gecode {
     }
 
     forceinline std::size_t
-    TupleSet::hash(void) const {
+    TupleSet::hash() const {
         return data().key;
     }
 
     forceinline ExtensionalPropKind
-    TupleSet::representation(void) const {
+    TupleSet::representation() const {
         switch (data().state) {
         case Data::TS_DENSE:
             return EPK_DENSE;
@@ -282,17 +283,17 @@ namespace Gecode {
     }
 
     forceinline unsigned int
-    TupleSet::sparse_values(void) const {
+    TupleSet::sparse_values() const {
         return data().sparse_n_vals;
     }
 
     forceinline const unsigned int*
-    TupleSet::sparse_tuple_value_ids(void) const {
+    TupleSet::sparse_tuple_value_ids() const {
         return data().sparse_tv;
     }
 
     forceinline const unsigned int*
-    TupleSet::sparse_support_offsets(void) const {
+    TupleSet::sparse_support_offsets() const {
         return data().sparse_offsets;
     }
 
@@ -307,11 +308,11 @@ namespace Gecode {
         unsigned int l = 0U, h = v.n;
         while (l < h) {
             const unsigned int m = l + ((h - l) >> 1);
-            if (n < v.r[m].min)
+            if (n < v.r[m].min) {
                 h = m;
-            else if (n > v.r[m].max)
+            } else if (n > v.r[m].max) {
                 l = m + 1U;
-            else {
+            } else {
                 gid = v.base[m] + static_cast(n - v.r[m].min);
                 return true;
             }
@@ -344,7 +345,7 @@ namespace Gecode {
         return true;
     }
 
-    namespace Int { namespace Extensional {
+    namespace Int::Extensional {
 
         forceinline bool
         support_offsets_size(unsigned long long n_vals, unsigned int& n_offsets) {
@@ -386,7 +387,7 @@ namespace Gecode {
             return ts.dense_compressed_support(p, n, b, e);
         }
 
-    }} // namespace Int::Extensional
+    } // namespace Int::Extensional
 
     template 
     std::basic_ostream&
@@ -418,24 +419,24 @@ namespace Gecode {
     }
 
     forceinline bool
-    TupleSet::Ranges::operator()(void) const {
+    TupleSet::Ranges::operator()() const {
         return c < l;
     }
     forceinline void
-    TupleSet::Ranges::operator++(void) {
+    TupleSet::Ranges::operator++() {
         c++;
     }
 
     forceinline int
-    TupleSet::Ranges::min(void) const {
+    TupleSet::Ranges::min() const {
         return c->min;
     }
     forceinline int
-    TupleSet::Ranges::max(void) const {
+    TupleSet::Ranges::max() const {
         return c->max;
     }
     forceinline unsigned int
-    TupleSet::Ranges::width(void) const {
+    TupleSet::Ranges::width() const {
         return c->width();
     }
 
diff --git a/gecode/int/gcc.cpp b/gecode/int/gcc.cpp
index 58af0822a5..9d21f2c6b0 100644
--- a/gecode/int/gcc.cpp
+++ b/gecode/int/gcc.cpp
@@ -71,8 +71,8 @@ namespace Gecode {
         template 
         void
         remove_duplicates(Home home, A& c, IntArgs& v) {
-            typedef typename A::value_type S;
-            typedef std::pair P;
+            using S = A::value_type;
+            using P = std::pair;
             Region re;
             P* a = re.alloc

(c.size()); for (int i = 0; i < c.size(); i++) @@ -112,8 +112,8 @@ namespace Gecode { if (x.size() == 0) { // Without variables, every value occurs zero times - for (int i = 0; i < c.size(); i++) - GECODE_ME_FAIL(IntView(c[i]).eq(home, 0)); + for (auto ci : c) + GECODE_ME_FAIL(IntView(ci).eq(home, 0)); return; } if (v.size() == 0) { @@ -170,8 +170,8 @@ namespace Gecode { if (x.size() == 0) { // Without variables, every value occurs zero times - for (int i = 0; i < c.size(); i++) - if (!c[i].in(0)) { + for (const auto& ci : c) + if (!ci.in(0)) { home.fail(); return; } diff --git a/gecode/int/gcc.hh b/gecode/int/gcc.hh index ceff0f7a9c..2225a34d69 100644 --- a/gecode/int/gcc.hh +++ b/gecode/int/gcc.hh @@ -50,7 +50,7 @@ #include #include -namespace Gecode { namespace Int { namespace GCC { +namespace Gecode::Int::GCC { /** * \brief Value consistent global cardinality propagator @@ -253,7 +253,7 @@ namespace Gecode { namespace Int { namespace GCC { static ExecStatus post(Home home, ViewArray& x, ViewArray& k); }; -}}} // namespace Gecode::Int::GCC +} // namespace Gecode::Int::GCC #include #include diff --git a/gecode/int/gcc/bnd-sup.hpp b/gecode/int/gcc/bnd-sup.hpp index d27ba66253..17e8830691 100644 --- a/gecode/int/gcc/bnd-sup.hpp +++ b/gecode/int/gcc/bnd-sup.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Int { namespace GCC { +namespace Gecode::Int::GCC { /** * \defgroup GCCBndSup Support for GCC bounds propagation @@ -244,22 +244,22 @@ namespace Gecode { namespace Int { namespace GCC { /// \name Initialization //@{ /// Constructor - PartialSum(void); + PartialSum(); /// Initialization - void init(Space& home, ViewArray& k, bool up); + void init(Space& home, ViewArray& elements, bool up); /// Mark datstructure as requiring reinitialization - void reinit(void); + void reinit(); /// Test whether already initialized - operator bool(void) const; + operator bool() const; //@} /// \name Access //@{ /// Compute the maximum capacity of an interval int sumup(int from, int to) const; /// Return smallest bound of variables - int min_value(void) const; + int min_value() const; /// Return largest bound of variables - int max_value(void) const; + int max_value() const; /// Skip neighbouring array entries if their values do not differ int skip_non_null_elements_right(int v) const; /// Skip neighbouring array entries if their values do not differ @@ -288,12 +288,12 @@ namespace Gecode { namespace Int { namespace GCC { template forceinline - PartialSum::PartialSum(void) + PartialSum::PartialSum() : sum(nullptr), size(-1) {} template forceinline PartialSum:: - operator bool(void) const { + operator bool() const { return size != -1; } template @@ -365,7 +365,7 @@ namespace Gecode { namespace Int { namespace GCC { template forceinline void - PartialSum::reinit(void) { + PartialSum::reinit() { size = -1; } @@ -374,23 +374,22 @@ namespace Gecode { namespace Int { namespace GCC { PartialSum::sumup(int from, int to) const { if (from <= to) { return sum[to - first_value] - sum[from - first_value - 1]; - } else { - assert(to - first_value - 1 >= 0); - assert(to - first_value - 1 < size); - assert(from - first_value >= 0); - assert(from - first_value < size); - return sum[to - first_value - 1] - sum[from - first_value]; } + assert(to - first_value - 1 >= 0); + assert(to - first_value - 1 < size); + assert(from - first_value >= 0); + assert(from - first_value < size); + return sum[to - first_value - 1] - sum[from - first_value]; } template forceinline int - PartialSum::min_value(void) const { + PartialSum::min_value() const { return first_value + 3; } template forceinline int - PartialSum::max_value(void) const { + PartialSum::max_value() const { return last_value - 2; } @@ -592,6 +591,6 @@ namespace Gecode { namespace Int { namespace GCC { } //@} -}}} // namespace Gecode::Int::GCC +} // namespace Gecode::Int::GCC // STATISTICS: int-prop diff --git a/gecode/int/gcc/bnd.hpp b/gecode/int/gcc/bnd.hpp index c948488be4..d8bbbf3c5f 100644 --- a/gecode/int/gcc/bnd.hpp +++ b/gecode/int/gcc/bnd.hpp @@ -1,3 +1,5 @@ +#include + /* * Main authors: * Patrick Pekczynski @@ -36,7 +38,7 @@ * */ -namespace Gecode { namespace Int { namespace GCC { +namespace Gecode::Int::GCC { template forceinline @@ -76,8 +78,7 @@ namespace Gecode { namespace Int { namespace GCC { int n_k = Card::propagate ? k.size() : 0; if (IntView::me(med) == ME_INT_VAL) return PropCost::linear(PropCost::LO, y.size() + n_k); - else - return PropCost::quadratic(PropCost::LO, x.size() + n_k); + return PropCost::quadratic(PropCost::LO, x.size() + n_k); } template @@ -261,12 +262,11 @@ namespace Gecode { namespace Int { namespace GCC { */ // CLEARLY THIS WAS NOT STABLE == UNSTABLE if (hall[z].d == lps.sumup(hall[y].bounds, hall[z].bounds - 1)) { - if (hall[y].h > y) - /* - * y is not the end of the potentially stable set - * thus ensure that the potentially stable superset is marked - */ - y = hall[y].h; + y = std::max(hall[y].h, y); /* + * y is not the end of the potentially stable set + * thus ensure that the potentially stable superset is marked + */ + // Equivalent to pathmax since the path is fully compressed pathset_h(hall, hall[y].h, j - 1, y); // mark the new unstable set [j,y] @@ -365,9 +365,7 @@ namespace Gecode { namespace Int { namespace GCC { } // UNSTABLE SET if (hall[z].d == lps.sumup(hall[z].bounds, hall[y].bounds - 1)) { - if (hall[y].h < y) { - y = hall[y].h; - } + y = std::min(hall[y].h, y); int succj = j + 1; // mark new unstable set [y,j] pathset_h(hall, hall[y].h, succj, y); @@ -816,6 +814,6 @@ namespace Gecode { namespace Int { namespace GCC { return ES_OK; } -}}} // namespace Gecode::Int::GCC +} // namespace Gecode::Int::GCC // STATISTICS: int-prop diff --git a/gecode/int/gcc/dom-sup.hpp b/gecode/int/gcc/dom-sup.hpp index 3a4e8bc15c..1bf657de41 100644 --- a/gecode/int/gcc/dom-sup.hpp +++ b/gecode/int/gcc/dom-sup.hpp @@ -1,3 +1,5 @@ +#include + /* * Main authors: * Patrick Pekczynski @@ -36,7 +38,7 @@ * */ -namespace Gecode { namespace Int { namespace GCC { +namespace Gecode::Int::GCC { /** * \brief Bounds constraint (BC) type @@ -82,7 +84,7 @@ namespace Gecode { namespace Int { namespace GCC { /// \name Constructors and initialization //@{ /// Default constructor - Node(void) = default; + Node() = default; /// Constructor for index \a i that sets type to \a t Node(NodeFlag nf, int i); //@} @@ -90,19 +92,19 @@ namespace Gecode { namespace Int { namespace GCC { /// \name Access //@{ /// Return the type of the node (false for a variable node) - bool type(void) const; + bool type() const; /// Return reference to the incident edges - Edge** adj(void); + Edge** adj(); /// Return pointer to the first incident edge - Edge* first(void) const; + Edge* first() const; /// Return pointer to the last incident edge - Edge* last(void) const; + Edge* last() const; /// Return pointer to the node's inedge - Edge* inedge(void) const; + Edge* inedge() const; /// Get index of either variable or value - int index(void) const; + int index() const; /// check whether a node has been removed from the graph - bool removed(void) const; + bool removed() const; //@} /// \name Update @@ -140,9 +142,9 @@ namespace Gecode { namespace Int { namespace GCC { /// \name Constructors and initialization //@{ /// Default constructor - VarNode(void) = default; - /// Creates a variable node with index \a i - VarNode(int i); + VarNode() = default; + /// Creates a variable node with index \a x + VarNode(int x); //@} /// \name Access @@ -156,7 +158,7 @@ namespace Gecode { namespace Int { namespace GCC { /// \name Update //@{ /// Set the pointer of the matching edge to m - void set_match(BC bc, Edge* m); + void set_match(BC bc, Edge* p); /// Set node to matched void match(BC bc); /// Unmatch the node @@ -191,7 +193,7 @@ namespace Gecode { namespace Int { namespace GCC { /// \name Constructors and destructors //@{ /// Default constructor - ValNode(void) = default; + ValNode() = default; /** * \brief Constructor for value node * @@ -205,31 +207,31 @@ namespace Gecode { namespace Int { namespace GCC { /// \name Access //@{ /// get max cap for LBC - int maxlow(void) const; + int maxlow() const; /// Mark the value node as conflicting in case of variable cardinalities void card_conflict(int c); /// Check whether the value node is conflicting - int card_conflict(void) const; + int card_conflict() const; /// Reduce the conflict counter - void red_conflict(void); + void red_conflict(); /// increases the value counter - void inc(void); + void inc(); /// returns the current number of occurrences of the value - int kcount(void) const; + int kcount() const; /// returns the number of incident matching edges on a value node int incid_match(BC bc) const; /// returns the index in cardinality array k - int kindex(void) const; + int kindex() const; /// returns \a true if the node is matched in BC, \a false otherwise bool matched(BC bc) const; /// tests whether the node is a sink - bool sink(void) const; + bool sink() const; /// tests whether the node is a source - bool source(void) const; + bool source() const; /// return the minimal node capacity as stored in \a k - int kmin(void) const; + int kmin() const; /// return the maximal node capacity as stored in \a k - int kmax(void) const; + int kmax() const; /// return minimal or maximal capacity int kbound(BC bc) const; //@} @@ -255,11 +257,11 @@ namespace Gecode { namespace Int { namespace GCC { /// unmatch the node void unmatch(BC bc); /// node reset to original capacity values - void reset(void); + void reset(); /// set the minimal k-capacity to min - void kmin(int min); + void kmin(int klb); /// set the maximal k-capacity to max - void kmax(int max); + void kmax(int kub); //@} }; @@ -300,12 +302,12 @@ namespace Gecode { namespace Int { namespace GCC { /// \name Constructors //@{ /// Default constructor - Edge(void) = default; + Edge() = default; /** - * \brief Construct edge \f$e(x,v)\f$ from variable node \a x + * \brief Construct edge \f$e(x,v)\f$ from variable node \a var * and value node \a y */ - Edge(VarNode* x, ValNode* v); + Edge(VarNode* var, ValNode* v); //@} /// \name Access @@ -315,7 +317,7 @@ namespace Gecode { namespace Int { namespace GCC { /// return whether the edge is matched bool matched(BC bc) const; /// return whether the edge has been deleted from the graph - bool deleted(void) const; + bool deleted() const; /** * \brief return a pointer to the next edge * If \a t is false the function returns the next edge incident on \a x @@ -323,17 +325,17 @@ namespace Gecode { namespace Int { namespace GCC { */ Edge* next(bool t) const; /// return the pointer to the next edge incident on \a x - Edge* next(void) const; + Edge* next() const; /// return the pointer to the previous edge incident on \a x - Edge* prev(void) const; + Edge* prev() const; /// return the pointer to the next edge incident on \a v - Edge* vnext(void) const; + Edge* vnext() const; /// return the pointer to the previous edge incident on \a v - Edge* vprev(void) const; + Edge* vprev() const; /// return the pointer to the variable node \a x of this edge - VarNode* get_var(void) const; + VarNode* get_var() const; /// return the pointer to the value node \a v of this edge - ValNode* get_val(void) const; + ValNode* get_val() const; /** * \brief return pointer to \a x if \a t = true otherwise return \a v * @@ -354,21 +356,21 @@ namespace Gecode { namespace Int { namespace GCC { /// Unmatch the edge and the incident nodes void unmatch(BC bc); /// Unmatch the edge and ( \a x if t=false, \a v otherwise ) - void unmatch(BC bc, bool t); + void unmatch(BC bc, bool node); /// Unlink the edge from the linked list of edges - void unlink(void); + void unlink(); /// Mark the edge as deleted during synchronization - void del_edge(void); + void del_edge(); /// Insert the edge again - void insert_edge(void); + void insert_edge(); /// return the reference to the next edge incident on \a x - Edge** next_ref(void); + Edge** next_ref(); /// return the reference to the previous edge incident on \a x - Edge** prev_ref(void); + Edge** prev_ref(); /// return the reference to the next edge incident on \a v - Edge** vnext_ref(void); + Edge** vnext_ref(); /// return the reference to the previous edge incident on \a v - Edge** vprev_ref(void); + Edge** vprev_ref(); //@} /// \name Memory management @@ -390,9 +392,9 @@ namespace Gecode { namespace Int { namespace GCC { class VarValGraph { private: /// Temporary stack for nodes - typedef Support::StaticStack NodeStack; + using NodeStack = Support::StaticStack; /// Bitset - typedef Support::BitSet BitSet; + using BitSet = Support::BitSet; /// Variable partition representing the problem variables VarNode** vars; /** @@ -462,14 +464,14 @@ namespace Gecode { namespace Int { namespace GCC { * k[i].min()\f$ */ template - ExecStatus maximum_matching(void); + ExecStatus maximum_matching(); /// Compute possible free alternating paths in the graph template - void free_alternating_paths(void); + void free_alternating_paths(); /// Compute possible strongly connected components of the graph template - void strongly_connected_components(void); + void strongly_connected_components(); /** * \brief Test whether the current maximal matching on the graph * can be augmented by an alternating path starting and ending with @@ -506,15 +508,15 @@ namespace Gecode { namespace Int { namespace GCC { : e(nullptr), fst(nullptr), lst(nullptr), ie(nullptr), idx(i), nf(static_cast(nf0)), noe(0) {} forceinline Edge** - Node::adj(void) { + Node::adj() { return &e; } forceinline Edge* - Node::first(void) const { + Node::first() const { return fst; } forceinline Edge* - Node::last(void) const { + Node::last() const { return lst; } forceinline void @@ -526,11 +528,11 @@ namespace Gecode { namespace Int { namespace GCC { lst = p; } forceinline bool - Node::type(void) const { + Node::type() const { return (nf & NF_VAL) != 0; } forceinline Edge* - Node::inedge(void) const { + Node::inedge() const { return ie; } forceinline void @@ -538,7 +540,7 @@ namespace Gecode { namespace Int { namespace GCC { ie = p; } forceinline bool - Node::removed(void) const { + Node::removed() const { return noe == 0; } forceinline void @@ -546,7 +548,7 @@ namespace Gecode { namespace Int { namespace GCC { idx = i; } forceinline int - Node::index(void) const { + Node::index() const { return idx; } @@ -568,8 +570,7 @@ namespace Gecode { namespace Int { namespace GCC { VarNode::matched(BC bc) const { if (bc == UBC) return (nf & NF_M_UBC) != 0; - else - return (nf & NF_M_LBC) != 0; + return (nf & NF_M_LBC) != 0; } forceinline void @@ -603,8 +604,7 @@ namespace Gecode { namespace Int { namespace GCC { VarNode::get_match(BC bc) const { if (bc == UBC) return ubm; - else - return lbm; + return lbm; } /* @@ -624,7 +624,7 @@ namespace Gecode { namespace Int { namespace GCC { } forceinline int - ValNode::maxlow(void) const { + ValNode::maxlow() const { if (_klb == _kub) { assert(ublow == lb); } @@ -637,13 +637,13 @@ namespace Gecode { namespace Int { namespace GCC { } forceinline void - ValNode::red_conflict(void) { + ValNode::red_conflict() { noc--; assert(noc >= 0); } forceinline int - ValNode::card_conflict(void) const { + ValNode::card_conflict() const { return noc; } @@ -651,8 +651,7 @@ namespace Gecode { namespace Int { namespace GCC { ValNode::cap(BC bc) const { if (bc == UBC) return ub; - else - return lb; + return lb; } forceinline bool ValNode::matched(BC bc) const { @@ -660,7 +659,7 @@ namespace Gecode { namespace Int { namespace GCC { } forceinline void - ValNode::reset(void) { + ValNode::reset() { lb = _klb; ublow = _kub; ub = _kub; @@ -671,18 +670,17 @@ namespace Gecode { namespace Int { namespace GCC { ValNode::kbound(BC bc) const { if (bc == UBC) { return _kub; - } else { - return _klb; } + return _klb; } forceinline int - ValNode::kmax(void) const { + ValNode::kmax() const { return _kub; } forceinline int - ValNode::kmin(void) const { + ValNode::kmin() const { return _klb; } @@ -735,12 +733,12 @@ namespace Gecode { namespace Int { namespace GCC { } forceinline void - ValNode::inc(void) { + ValNode::inc() { _kcount++; } forceinline int - ValNode::kcount(void) const { + ValNode::kcount() const { return _kcount; } @@ -755,7 +753,7 @@ namespace Gecode { namespace Int { namespace GCC { } forceinline int - ValNode::kindex(void) const { + ValNode::kindex() const { return _kidx; } @@ -764,19 +762,18 @@ namespace Gecode { namespace Int { namespace GCC { ValNode::incid_match(BC bc) const { if (bc == LBC) return _kub - ublow + _kcount; - else - return _kub - ub + _kcount; + return _kub - ub + _kcount; } forceinline bool - ValNode::sink(void) const { + ValNode::sink() const { // there are only incoming edges // in case of the UBC-matching return _kub - ub == noe; } forceinline bool - ValNode::source(void) const { + ValNode::source() const { // there are only incoming edges // in case of the UBC-matching return _klb - lb == noe; @@ -787,7 +784,7 @@ namespace Gecode { namespace Int { namespace GCC { * */ forceinline void - Edge::unlink(void) { + Edge::unlink() { // unlink from variable side Edge* p = prev_edge; Edge* n = next_edge; @@ -846,58 +843,56 @@ namespace Gecode { namespace Int { namespace GCC { Edge::used(BC bc) const { if (bc == UBC) return (ef & EF_MARKED_UBC) != 0; - else - return (ef & EF_MARKED_LBC) != 0; + return (ef & EF_MARKED_LBC) != 0; } forceinline Edge* - Edge::next(void) const { + Edge::next() const { return next_edge; } forceinline Edge* Edge::next(bool t) const { if (t) { return next_vedge; - } else { - return next_edge; } + return next_edge; } forceinline Edge* - Edge::vnext(void) const { + Edge::vnext() const { return next_vedge; } forceinline Edge** - Edge::vnext_ref(void) { + Edge::vnext_ref() { return &next_vedge; } forceinline Edge* - Edge::prev(void) const { + Edge::prev() const { return prev_edge; } forceinline Edge** - Edge::prev_ref(void) { + Edge::prev_ref() { return &prev_edge; } forceinline Edge* - Edge::vprev(void) const { + Edge::vprev() const { return prev_vedge; } forceinline Edge** - Edge::vprev_ref(void) { + Edge::vprev_ref() { return &prev_vedge; } forceinline Edge** - Edge::next_ref(void) { + Edge::next_ref() { return &next_edge; } forceinline VarNode* - Edge::get_var(void) const { + Edge::get_var() const { assert(x != nullptr); return x; } forceinline ValNode* - Edge::get_val(void) const { + Edge::get_val() const { assert(v != nullptr); return v; } @@ -906,8 +901,7 @@ namespace Gecode { namespace Int { namespace GCC { Edge::get_mate(bool type) const { if (type) return x; - else - return v; + return v; } forceinline void @@ -953,22 +947,21 @@ namespace Gecode { namespace Int { namespace GCC { Edge::matched(BC bc) const { if (bc == UBC) return (ef & EF_MATCHED_UBC) != 0; - else - return (ef & EF_MATCHED_LBC) != 0; + return (ef & EF_MATCHED_LBC) != 0; } forceinline void - Edge::del_edge(void) { + Edge::del_edge() { ef |= EF_DELETED; } forceinline void - Edge::insert_edge(void) { + Edge::insert_edge() { ef &= ~EF_DELETED; } forceinline bool - Edge::deleted(void) const { + Edge::deleted() const { return (ef & EF_DELETED) != 0; } @@ -1158,18 +1151,15 @@ namespace Gecode { namespace Int { namespace GCC { // augmenting path of length l > 1 e->match(bc); break; - } else { - // augmenting path of length l = 1 - e->match(bc); - ns.pop(); - return true; - } - } else { - w->inedge(e); - visited.set(static_cast(w->index())); - // find matching edge m incident with w - ns.push(w); + } // augmenting path of length l = 1 + e->match(bc); + ns.pop(); + return true; } + w->inedge(e); + visited.set(static_cast(w->index())); + // find matching edge m incident with w + ns.push(w); } } else { // tried all outgoing edges without finding an augmenting path @@ -1232,9 +1222,9 @@ namespace Gecode { namespace Int { namespace GCC { // set to full capacity for later rescheduling if (v->cap(UBC)) v->cap(UBC, k[i].max()); - v->maxlow(k[i].max() - (inc_lbc)); + v->maxlow(k[i].max() - inc_lbc); if (v->kmin() == v->kmax()) - v->cap(LBC, k[i].max() - (inc_lbc)); + v->cap(LBC, k[i].max() - inc_lbc); int matched = inc_ubc - v->kcount(); v->card_conflict(std::min(rm, matched)); } @@ -1264,7 +1254,7 @@ namespace Gecode { namespace Int { namespace GCC { for (int i = n_var; i--;) { VarNode* vrn = vars[i]; - if (static_cast(x[i].size()) != vrn->noe) { + if (std::cmp_not_equal(x[i].size(), vrn->noe)) { // if the variable is already assigned if (x[i].assigned()) { int v = x[i].val(); @@ -1474,7 +1464,7 @@ namespace Gecode { namespace Int { namespace GCC { template template inline ExecStatus - VarValGraph::maximum_matching(void) { + VarValGraph::maximum_matching() { int card_match = 0; // find an initial matching in O(n*d) // greedy algorithm @@ -1540,7 +1530,7 @@ namespace Gecode { namespace Int { namespace GCC { template template forceinline void - VarValGraph::free_alternating_paths(void) { + VarValGraph::free_alternating_paths() { Region r; NodeStack ns(r, n_node); BitSet visited(r, static_cast(n_node)); @@ -1713,7 +1703,7 @@ namespace Gecode { namespace Int { namespace GCC { template template forceinline void - VarValGraph::strongly_connected_components(void) { + VarValGraph::strongly_connected_components() { Region r; BitSet inscc(r, static_cast(n_node)); BitSet in_unfinished(r, static_cast(n_node)); @@ -1736,6 +1726,6 @@ namespace Gecode { namespace Int { namespace GCC { return home.ralloc(t); } -}}} // namespace Gecode::Int::GCC +} // namespace Gecode::Int::GCC // STATISTICS: int-prop diff --git a/gecode/int/gcc/dom.hpp b/gecode/int/gcc/dom.hpp index 26af39876e..0ce68cddf3 100644 --- a/gecode/int/gcc/dom.hpp +++ b/gecode/int/gcc/dom.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Int { namespace GCC { +namespace Gecode::Int::GCC { /* * Analogously to "gcc/bnd.hpp" we split the algorithm @@ -160,7 +160,8 @@ namespace Gecode { namespace Int { namespace GCC { if ((k[j].min() > k[j].counter()) || (k[j].max() < k[j].counter())) return ES_FAILED; return home.ES_SUBSUMED(*this); - } else if ((x.size() == 1) && (x[0].assigned())) { + } + if ((x.size() == 1) && (x[0].assigned())) { int idx; if (!lookup_value(k, x[0].val(), idx)) return ES_FAILED; @@ -223,7 +224,8 @@ namespace Gecode { namespace Int { namespace GCC { if ((k[j].min() > k[j].counter()) || (k[j].max() < k[j].counter())) return ES_FAILED; return home.ES_SUBSUMED(*this); - } else if ((x.size() == 1) && x[0].assigned()) { + } + if ((x.size() == 1) && x[0].assigned()) { int idx; if (!lookup_value(k, x[0].val(), idx)) return ES_FAILED; @@ -307,6 +309,6 @@ namespace Gecode { namespace Int { namespace GCC { return ES_OK; } -}}} // namespace Gecode::Int::GCC +} // namespace Gecode::Int::GCC // STATISTICS: int-prop diff --git a/gecode/int/gcc/post.hpp b/gecode/int/gcc/post.hpp index 26bb3bfca4..1bbddf8f10 100644 --- a/gecode/int/gcc/post.hpp +++ b/gecode/int/gcc/post.hpp @@ -39,7 +39,7 @@ #include #include -namespace Gecode { namespace Int { namespace GCC { +namespace Gecode::Int::GCC { template /// %Sort by increasing cardinality @@ -149,17 +149,15 @@ namespace Gecode { namespace Int { namespace GCC { if (k[i].min() != 1 || k[i].max() != 1) return false; return true; - } else { - return false; } - } else { - for (int i = k.size(); i--;) - if (k[i].min() != 0 || k[i].max() != 1) - return false; - return true; + return false; } + for (int i = k.size(); i--;) + if (k[i].min() != 0 || k[i].max() != 1) + return false; + return true; } -}}} // namespace Gecode::Int::GCC +} // namespace Gecode::Int::GCC // STATISTICS: int-prop diff --git a/gecode/int/gcc/val.hpp b/gecode/int/gcc/val.hpp index 5fb0c51b82..76a3d4b7e0 100644 --- a/gecode/int/gcc/val.hpp +++ b/gecode/int/gcc/val.hpp @@ -35,7 +35,7 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -namespace Gecode { namespace Int { namespace GCC { +namespace Gecode::Int::GCC { template forceinline @@ -111,10 +111,10 @@ namespace Gecode { namespace Int { namespace GCC { // number of unassigned views int non = x.size(); - for (int i = 0; i < x.size(); i++) - if (x[i].assigned()) { + for (auto& xi : x) + if (xi.assigned()) { int idx; - if (!lookup_value(k, x[i].val(), idx)) { + if (!lookup_value(k, xi.val(), idx)) { return ES_FAILED; } count[idx]++; @@ -291,6 +291,6 @@ namespace Gecode { namespace Int { namespace GCC { return ES_OK; } -}}} // namespace Gecode::Int::GCC +} // namespace Gecode::Int::GCC // STATISTICS: int-prop diff --git a/gecode/int/gcc/view.hpp b/gecode/int/gcc/view.hpp index c2737a0f69..4f8ac2891d 100644 --- a/gecode/int/gcc/view.hpp +++ b/gecode/int/gcc/view.hpp @@ -36,7 +36,7 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -namespace Gecode { namespace Int { +namespace Gecode::Int { namespace GCC { /// Return index of \a v in array \a a @@ -51,9 +51,11 @@ namespace Gecode { namespace Int { if (v == a[m].card()) { i = m; return true; - } else if (l == r) { + } + if (l == r) { return false; - } else if (v < a[m].card()) { + } + if (v < a[m].card()) { r = m - 1; } else { l = m + 1; @@ -81,7 +83,7 @@ namespace Gecode { namespace Int { /// \name Initialization //@{ /// Default constructor - CardConst(void); + CardConst(); /// Initialize with \a min, \a max, and cardinality \a c void init(Space& home, int min, int max, int c); //@} @@ -89,19 +91,19 @@ namespace Gecode { namespace Int { /// \name Value access //@{ /// Return minimum of domain - int min(void) const; + int min() const; /// Return maximum of domain - int max(void) const; + int max() const; /// Return cardinality - int card(void) const; + int card() const; /// Return the number of times the value occurs - int counter(void) const; + int counter() const; //@} /// \name Domain tests ///@{ /// Test whether view is assigned - bool assigned(void) const; + bool assigned() const; //@} /// \name Domain update by value @@ -109,7 +111,7 @@ namespace Gecode { namespace Int { /// Set counter to \a n void counter(int n); /// Increment counter - ModEvent inc(void); + ModEvent inc(); /// Restrict domain values to be less or equal than \a n ModEvent lq(Space& home, int n); /// Restrict domain values to be greater or equal than \a n @@ -135,7 +137,7 @@ namespace Gecode { namespace Int { ///@} /// Return used IntView (cannot be used) - IntView base(void) const; + IntView base() const; }; /// Cardinality integer view @@ -153,7 +155,7 @@ namespace Gecode { namespace Int { /// \name Initialization //@{ /// Default constructor - CardView(void); + CardView(); /// Initialize with integer view \a y and value \a c void init(const IntView& y, int c); /// Initialize for set \a s and cardinality \a c @@ -163,15 +165,15 @@ namespace Gecode { namespace Int { /// \name Value access //@{ /// Return minimum of domain - int min(void) const; + int min() const; /// Return maximum of domain - int max(void) const; + int max() const; /// Return size (cardinality) of domain - unsigned int size(void) const; + unsigned int size() const; /// Return the number of times the value occurs - int counter(void) const; + int counter() const; /// Return cardinality - int card(void) const; + int card() const; ///@} /// \name Domain update by value @@ -179,7 +181,7 @@ namespace Gecode { namespace Int { /// Set the counter to the number of times value \a n occurs void counter(int n); /// Increment counter - ModEvent inc(void); + ModEvent inc(); /// Restrict domain values to be less or equal than \a n ModEvent lq(Space& home, int n); /// Restrict domain values to be greater or equal than \a n @@ -203,8 +205,8 @@ namespace Gecode { namespace Int { /// \name Cloning ///@{ - /// Update this view to be a clone of view \a x - void update(Space& home, CardView& x); + /// Update this view to be a clone of view \a y + void update(Space& home, CardView& y); ///@} }; @@ -214,7 +216,7 @@ namespace Gecode { namespace Int { */ forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - CardConst::CardConst(void) {} + CardConst::CardConst() {} forceinline void CardConst::init(Space&, int min, int max, int c) { _min = min; @@ -224,23 +226,23 @@ namespace Gecode { namespace Int { } forceinline int - CardConst::min(void) const { + CardConst::min() const { return _min; } forceinline int - CardConst::max(void) const { + CardConst::max() const { return _max; } forceinline int - CardConst::card(void) const { + CardConst::card() const { return _card; } forceinline int - CardConst::counter(void) const { + CardConst::counter() const { return _counter; } forceinline bool - CardConst::assigned(void) const { + CardConst::assigned() const { return _min == _max; } @@ -249,7 +251,7 @@ namespace Gecode { namespace Int { _counter = n; } forceinline ModEvent - CardConst::inc(void) { + CardConst::inc() { if (++_counter > _max) return ME_INT_FAILED; return ME_INT_NONE; @@ -289,7 +291,7 @@ namespace Gecode { namespace Int { } forceinline IntView - CardConst::base(void) const { + CardConst::base() const { GECODE_NEVER; return IntView(); } @@ -300,7 +302,7 @@ namespace Gecode { namespace Int { */ forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - CardView::CardView(void) {} + CardView::CardView() {} forceinline void CardView::init(const IntView& y, int c) { x = y; @@ -315,23 +317,23 @@ namespace Gecode { namespace Int { } forceinline int - CardView::counter(void) const { + CardView::counter() const { return _counter; } forceinline int - CardView::card(void) const { + CardView::card() const { return _card; } forceinline int - CardView::min(void) const { + CardView::min() const { return x.min(); } forceinline int - CardView::max(void) const { + CardView::max() const { return x.max(); } forceinline unsigned int - CardView::size(void) const { + CardView::size() const { return x.size(); } @@ -340,7 +342,7 @@ namespace Gecode { namespace Int { _counter = n; } forceinline ModEvent - CardView::inc(void) { + CardView::inc() { if (++_counter > this->max()) return ME_INT_FAILED; return ME_GEN_NONE; @@ -392,7 +394,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization ///@{ /// Default constructor - ViewRanges(void); + ViewRanges(); /// Initialize with ranges for view \a x ViewRanges(const GCC::CardView& x); /// Initialize with ranges for view \a x @@ -400,9 +402,7 @@ namespace Gecode { namespace Int { ///@} }; - forceinline - ViewRanges::ViewRanges(void) - : Gecode::Int::ViewRanges() {} + forceinline ViewRanges::ViewRanges() = default; forceinline ViewRanges::ViewRanges(const GCC::CardView& x) @@ -413,6 +413,6 @@ namespace Gecode { namespace Int { Gecode::Int::ViewRanges xi(x.base()); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-prop diff --git a/gecode/int/growable-int-set.hh b/gecode/int/growable-int-set.hh index f37b377728..c07b295c2b 100644 --- a/gecode/int/growable-int-set.hh +++ b/gecode/int/growable-int-set.hh @@ -36,7 +36,7 @@ #include #include -namespace Gecode { namespace Int { +namespace Gecode::Int { class GrowableIntSetRanges; @@ -49,14 +49,14 @@ namespace Gecode { namespace Int { int min; int max; // NOLINTNEXTLINE(modernize-use-equals-default) - Range(void) {} + Range() {} }; Range* _ranges; unsigned int _count; unsigned int _capacity; /// Largest capacity supported by both counts and allocation sizes - static unsigned int max_capacity(void); + static unsigned int max_capacity(); /// Ensure capacity, copying only initialized ranges void reserve(Space& home, unsigned int required); /// First range whose maximum is at least value @@ -68,7 +68,7 @@ namespace Gecode { namespace Int { GrowableIntSet(const GrowableIntSet&) = delete; GrowableIntSet& operator=(const GrowableIntSet&) = delete; /// Initialize an empty set - GrowableIntSet(void); + GrowableIntSet(); /// Test membership bool in(int value) const; /** \brief Add the ranges from a copyable, independent canonical iterator @@ -92,14 +92,14 @@ namespace Gecode { namespace Int { public: GrowableIntSetRanges(const GrowableIntSet& set); - bool operator()(void) const; - void operator++(void); - int min(void) const; - int max(void) const; - unsigned int width(void) const; + bool operator()() const; + void operator++(); + int min() const; + int max() const; + unsigned int width() const; }; -}} // namespace Gecode::Int +} // namespace Gecode::Int #include diff --git a/gecode/int/growable-int-set.hpp b/gecode/int/growable-int-set.hpp index e4426bd28c..7477c91869 100644 --- a/gecode/int/growable-int-set.hpp +++ b/gecode/int/growable-int-set.hpp @@ -30,14 +30,14 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { forceinline - GrowableIntSet::GrowableIntSet(void) + GrowableIntSet::GrowableIntSet() : _ranges(nullptr), _count(0), _capacity(0) {} forceinline unsigned int - GrowableIntSet::max_capacity(void) { + GrowableIntSet::max_capacity() { return static_cast( std::min(static_cast(std::numeric_limits::max()), static_cast(std::numeric_limits::max()) / sizeof(Range))); @@ -180,30 +180,30 @@ namespace Gecode { namespace Int { : current(set._ranges), end((set._count == 0) ? set._ranges : set._ranges + set._count) {} forceinline bool - GrowableIntSetRanges::operator()(void) const { + GrowableIntSetRanges::operator()() const { return current != end; } forceinline void - GrowableIntSetRanges::operator++(void) { + GrowableIntSetRanges::operator++() { ++current; } forceinline int - GrowableIntSetRanges::min(void) const { + GrowableIntSetRanges::min() const { return current->min; } forceinline int - GrowableIntSetRanges::max(void) const { + GrowableIntSetRanges::max() const { return current->max; } forceinline unsigned int - GrowableIntSetRanges::width(void) const { + GrowableIntSetRanges::width() const { return static_cast(current->max) - static_cast(current->min) + 1U; } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-other diff --git a/gecode/int/idx-view.hh b/gecode/int/idx-view.hh index 40085fa2dd..05bbc12c03 100644 --- a/gecode/int/idx-view.hh +++ b/gecode/int/idx-view.hh @@ -37,7 +37,7 @@ #include -namespace Gecode { namespace Int { +namespace Gecode::Int { /** * \brief Class for pair of index and view @@ -72,21 +72,21 @@ namespace Gecode { namespace Int { public: /// Default constructor - IdxViewArray(void); + IdxViewArray(); /// Copy constructor IdxViewArray(const IdxViewArray&); /// Construct an IdxViewArray from \a x - IdxViewArray(Space& home, const typename ViewToVarArg::argtype& x); + IdxViewArray(Space& home, const ViewToVarArg::argtype& x); /// Construct an IdxViewArray of size \a n IdxViewArray(Space& home, int n); /// Return the current size - int size(void) const; + int size() const; /// Set the size to \a n void size(int n); - /// Access element \a n - IdxView& operator[](int n); + /// Access element \a i + IdxView& operator[](int i); /// Access element \a n const IdxView& operator[](int) const; @@ -104,7 +104,7 @@ namespace Gecode { namespace Int { void reschedule(Space& home, Propagator& p, PropCond pc); /// Cloning - void update(Space& home, IdxViewArray& x); + void update(Space& home, IdxViewArray& a); }; /** @@ -114,7 +114,7 @@ namespace Gecode { namespace Int { template std::basic_ostream& operator<<(std::basic_ostream& os, const IdxViewArray& x); -}} // namespace Gecode::Int +} // namespace Gecode::Int #include diff --git a/gecode/int/idx-view.hpp b/gecode/int/idx-view.hpp index 4c128542f9..3bf58b5f15 100644 --- a/gecode/int/idx-view.hpp +++ b/gecode/int/idx-view.hpp @@ -34,31 +34,31 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { /// VarArg type for integer views template <> class ViewToVarArg { public: - typedef IntVarArgs argtype; + using argtype = IntVarArgs; }; /// VarArg type for minus views template <> class ViewToVarArg { public: - typedef IntVarArgs argtype; + using argtype = IntVarArgs; }; /// VarArg type for Boolean views template <> class ViewToVarArg { public: - typedef BoolVarArgs argtype; + using argtype = BoolVarArgs; }; /// VarArg type for Boolean views template <> class ViewToVarArg { public: - typedef BoolVarArgs argtype; + using argtype = BoolVarArgs; }; template @@ -69,7 +69,7 @@ namespace Gecode { namespace Int { template forceinline - IdxViewArray::IdxViewArray(void) + IdxViewArray::IdxViewArray() : xs(nullptr), n(0) {} template @@ -81,7 +81,7 @@ namespace Gecode { namespace Int { template forceinline - IdxViewArray::IdxViewArray(Space& home, const typename ViewToVarArg::argtype& xa) + IdxViewArray::IdxViewArray(Space& home, const ViewToVarArg::argtype& xa) : xs(nullptr) { n = xa.size(); if (n > 0) { @@ -105,7 +105,7 @@ namespace Gecode { namespace Int { template forceinline int - IdxViewArray::size(void) const { + IdxViewArray::size() const { return n; } @@ -179,6 +179,6 @@ namespace Gecode { namespace Int { return os << s.str(); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-prop diff --git a/gecode/int/int-set-1.hpp b/gecode/int/int-set-1.hpp index f39d5678d9..f5adcea752 100644 --- a/gecode/int/int-set-1.hpp +++ b/gecode/int/int-set-1.hpp @@ -113,6 +113,7 @@ namespace Gecode { /// Initialize with integers from vector \a r template <> + // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name): the primary template takes an iterator inline IntSet::IntSet(const std::vector& r) { int n = static_cast(r.size()); if (n > 0) { @@ -130,6 +131,7 @@ namespace Gecode { * second element. */ template <> + // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name): the primary template takes an iterator inline IntSet::IntSet(const std::vector>& r) { int n = static_cast(r.size()); if (n > 0) { @@ -171,7 +173,7 @@ namespace Gecode { } forceinline int - IntSet::ranges(void) const { + IntSet::ranges() const { IntSetObject* o = static_cast(object()); return (o == nullptr) ? 0 : o->n; } @@ -181,30 +183,29 @@ namespace Gecode { IntSetObject* o = static_cast(object()); if ((o == nullptr) || (n < o->r[0].min) || (n > o->r[o->n - 1].max)) return false; - else - return o->in(n); + return o->in(n); } forceinline int - IntSet::min(void) const { + IntSet::min() const { IntSetObject* o = static_cast(object()); return (o == nullptr) ? Int::Limits::max : o->r[0].min; } forceinline int - IntSet::max(void) const { + IntSet::max() const { IntSetObject* o = static_cast(object()); return (o == nullptr) ? Int::Limits::min : o->r[o->n - 1].max; } forceinline unsigned int - IntSet::size(void) const { + IntSet::size() const { IntSetObject* o = static_cast(object()); return (o == nullptr) ? 0U : o->size; } forceinline unsigned int - IntSet::width(void) const { + IntSet::width() const { IntSetObject* o = static_cast(object()); return (o == nullptr) ? 0U : static_cast(max()) - static_cast(min()) + 1U; } @@ -243,24 +244,24 @@ namespace Gecode { } forceinline void - IntSetRanges::operator++(void) { + IntSetRanges::operator++() { i++; } forceinline bool - IntSetRanges::operator()(void) const { + IntSetRanges::operator()() const { return i < e; } forceinline int - IntSetRanges::min(void) const { + IntSetRanges::min() const { return i->min; } forceinline int - IntSetRanges::max(void) const { + IntSetRanges::max() const { return i->max; } forceinline unsigned int - IntSetRanges::width(void) const { + IntSetRanges::width() const { return static_cast(i->max) - static_cast(i->min) + 1U; } diff --git a/gecode/int/int-set.cpp b/gecode/int/int-set.cpp index a5761ac38d..4b9453e642 100644 --- a/gecode/int/int-set.cpp +++ b/gecode/int/int-set.cpp @@ -57,12 +57,12 @@ namespace Gecode { } void - IntSet::fault_reset_allocations(void) { + IntSet::fault_reset_allocations() { IntSetObject::fault_live_objects.store(0, std::memory_order_relaxed); } int - IntSet::fault_live_allocations(void) { + IntSet::fault_live_allocations() { return IntSetObject::fault_live_objects.load(std::memory_order_relaxed); } #endif @@ -92,9 +92,11 @@ namespace Gecode { int m = l + (r - l) / 2; if ((this->r[m].min <= n) && (n <= this->r[m].max)) { return true; - } else if (l == r) { + } + if (l == r) { return false; - } else if (n < this->r[m].min) { + } + if (n < this->r[m].min) { r = m - 1; } else { l = m + 1; @@ -112,7 +114,7 @@ namespace Gecode { return true; } - IntSet::IntSetObject::~IntSetObject(void) { + IntSet::IntSetObject::~IntSetObject() { if (r != nullptr) heap.free(r, n); } diff --git a/gecode/int/inter-distance.cpp b/gecode/int/inter-distance.cpp index 784d463a19..dbf289756d 100644 --- a/gecode/int/inter-distance.cpp +++ b/gecode/int/inter-distance.cpp @@ -38,12 +38,13 @@ #include #include #include +#include -namespace Gecode { namespace Int { namespace InterDistance { +namespace Gecode::Int::InterDistance { namespace { - typedef long long int Time; - typedef std::ptrdiff_t RegionIndex; + using Time = long long int; + using RegionIndex = std::ptrdiff_t; /// Task bounds and ranks in their sorted orders struct Task { @@ -85,8 +86,7 @@ namespace Gecode { namespace Int { namespace InterDistance { /// Change the active-key count at rank i void update(int i, int delta) { - for (unsigned int j = static_cast(i) + 1; j <= static_cast(key_count); - j += j & -j) + for (unsigned int j = static_cast(i) + 1; std::cmp_less_equal(j, key_count); j += j & -j) counts[j] += delta; active_count += delta; } @@ -167,7 +167,7 @@ namespace Gecode { namespace Int { namespace InterDistance { /// First active key, or the end rank int - first_active(void) const { + first_active() const { return next_active(0); } /// First active key greater than key, or the end rank @@ -336,7 +336,7 @@ namespace Gecode { namespace Int { namespace InterDistance { int pending = dc - 1; for (int i = n; i--;) { int rank = release[i]->max_rank; - for (size_t j = static_cast(rank) + 1; j <= static_cast(dc); j += j & -j) + for (size_t j = static_cast(rank) + 1; std::cmp_less_equal(j, dc); j += j & -j) loads[j]++; int d = find(rank); active = std::min(active, d); @@ -499,7 +499,7 @@ namespace Gecode { namespace Int { namespace InterDistance { private: /// Sort task pointers and record release ranks void - sort_tasks(void) { + sort_tasks() { for (int i = 0; i < n; i++) min_sorted[i] = max_sorted[i] = tasks + i; std::sort(min_sorted, min_sorted + n, [](const Task* a, const Task* b) { @@ -569,7 +569,7 @@ namespace Gecode { namespace Int { namespace InterDistance { /// Tabulate earliest completions outside the forbidden start regions void - compute_earliest_completions(void) { + compute_earliest_completions() { for (int i = 0; i < n; i++) { ect_table[i] = min_sorted[i]->min; int er = 0; @@ -603,7 +603,7 @@ namespace Gecode { namespace Int { namespace InterDistance { /// Initialize the adjustment list and the groups of variable bounds void - initialize_adjustments(void) { + initialize_adjustments() { const Time infinity = std::numeric_limits

& x, ViewArray& y, Val c, BoolView b); }; -}}} // namespace Gecode::Int::Linear +} // namespace Gecode::Int::Linear #include #include -namespace Gecode { namespace Int { namespace Linear { +namespace Gecode::Int::Linear { /* * Boolean linear propagators @@ -807,7 +807,7 @@ namespace Gecode { namespace Int { namespace Linear { /// Righthandside int c; /// Normalize by removing unused views - void normalize(void); + void normalize(); /// Constructor for cloning \a p LinBoolInt(Space& home, LinBoolInt& p); /// Constructor for creation @@ -916,7 +916,7 @@ namespace Gecode { namespace Int { namespace Linear { /// Perform propagation ExecStatus propagate(Space& home, const ModEventDelta& med) override; /// Post propagator for \f$\sum_{i=0}^{|x|-1}x_i \neq c\f$ - static ExecStatus post(Home home, ViewArray& b, int c); + static ExecStatus post(Home home, ViewArray& x, int c); /// Delete propagator and return its size size_t dispose(Space& home) override; }; @@ -939,7 +939,7 @@ namespace Gecode { namespace Int { namespace Linear { /// Control variable VB b; /// Normalize by removing unused views - void normalize(void); + void normalize(); /// Constructor for cloning \a p ReLinBoolInt(Space& home, ReLinBoolInt& p); /// Constructor for creation @@ -1024,11 +1024,11 @@ namespace Gecode { namespace Int { namespace Linear { static ExecStatus post(Home home, ViewArray& x, int c, VB b); }; -}}} // namespace Gecode::Int::Linear +} // namespace Gecode::Int::Linear #include -namespace Gecode { namespace Int { namespace Linear { +namespace Gecode::Int::Linear { /** * \brief Base-class for Boolean linear propagators @@ -1138,11 +1138,11 @@ namespace Gecode { namespace Int { namespace Linear { static ExecStatus post(Home home, ViewArray& x, YV y, int c); }; -}}} // namespace Gecode::Int::Linear +} // namespace Gecode::Int::Linear #include -namespace Gecode { namespace Int { namespace Linear { +namespace Gecode::Int::Linear { /// Coefficient and Boolean view class ScaleBool { @@ -1163,7 +1163,7 @@ namespace Gecode { namespace Int { namespace Linear { public: /// Default constructor - ScaleBoolArray(void) = default; + ScaleBoolArray() = default; /// Create array with \a n elements ScaleBoolArray(Space& home, int n); /// Subscribe propagator \a p @@ -1175,17 +1175,17 @@ namespace Gecode { namespace Int { namespace Linear { /// Update \a sba during copying void update(Space& home, ScaleBoolArray& sba); /// Return pointer to first element - ScaleBool* fst(void) const; + ScaleBool* fst() const; /// Return pointer after last element - ScaleBool* lst(void) const; + ScaleBool* lst() const; /// Set pointer to first element void fst(ScaleBool* f); /// Set pointer after last element void lst(ScaleBool* l); /// Test whether array is empty - bool empty(void) const; + bool empty() const; /// Return number of elements - int size(void) const; + int size() const; private: /// For sorting array in decreasing order of coefficients @@ -1196,14 +1196,14 @@ namespace Gecode { namespace Int { namespace Linear { public: /// Sort array in decreasing order of coefficients - void sort(void); + void sort(); }; /// Empty array of scale Boolean views class EmptyScaleBoolArray { public: /// Default constructor - EmptyScaleBoolArray(void) = default; + EmptyScaleBoolArray() = default; /// Create array with \a n elements EmptyScaleBoolArray(Space& home, int n); /// Subscribe propagator \a p @@ -1215,19 +1215,19 @@ namespace Gecode { namespace Int { namespace Linear { /// Update \a sba during copying void update(Space& home, EmptyScaleBoolArray& esba); /// Return pointer to first element - ScaleBool* fst(void) const; + ScaleBool* fst() const; /// Return pointer after last element - ScaleBool* lst(void) const; + ScaleBool* lst() const; /// Set pointer to first element void fst(ScaleBool* f); /// Set pointer after last element void lst(ScaleBool* l); /// Test whether array is empty - bool empty(void) const; + bool empty() const; /// Return number of elements - int size(void) const; + int size() const; /// Sort array in decreasing order of coefficients - void sort(void); + void sort(); }; /** @@ -1340,11 +1340,11 @@ namespace Gecode { namespace Int { namespace Linear { static ExecStatus post(Home home, SBAP& p, SBAN& n, VX x, int c); }; -}}} // namespace Gecode::Int::Linear +} // namespace Gecode::Int::Linear #include -namespace Gecode { namespace Int { namespace Linear { +namespace Gecode::Int::Linear { /** * \brief Class for describing linear term \f$a\cdot x\f$ @@ -1567,7 +1567,7 @@ namespace Gecode { namespace Int { namespace Linear { GECODE_INT_EXPORT void post(Home home, Term* t, int n, IntRelType irt, IntView y, Reify r, IntPropLevel ipl = IPL_DEF); -}}} // namespace Gecode::Int::Linear +} // namespace Gecode::Int::Linear #include diff --git a/gecode/int/linear/bool-int.hpp b/gecode/int/linear/bool-int.hpp index 629b6f586b..c483a51d19 100644 --- a/gecode/int/linear/bool-int.hpp +++ b/gecode/int/linear/bool-int.hpp @@ -36,7 +36,7 @@ #include -namespace Gecode { namespace Int { namespace Linear { +namespace Gecode::Int::Linear { /* * Baseclass for integer Boolean sum using dependencies @@ -53,7 +53,7 @@ namespace Gecode { namespace Int { namespace Linear { template forceinline void - LinBoolInt::normalize(void) { + LinBoolInt::normalize() { if (n_as != n_hs) { // Remove views for which no more subscriptions exist int n_x = x.size(); @@ -164,8 +164,7 @@ namespace Gecode { namespace Int { namespace Linear { return ES_FAILED; if ((c <= 0) || (c == n)) return ES_NOFIX; - else - return ES_FIX; + return ES_FIX; } template @@ -279,8 +278,7 @@ namespace Gecode { namespace Int { namespace Linear { return ES_FAILED; if ((c == 0) || (c == n)) return ES_NOFIX; - else - return ES_FIX; + return ES_FIX; } template @@ -508,7 +506,7 @@ namespace Gecode { namespace Int { namespace Linear { template forceinline void - ReLinBoolInt::normalize(void) { + ReLinBoolInt::normalize() { if (n_s != x.size()) { int n_x = x.size(); for (int i = n_x; i--;) @@ -551,7 +549,7 @@ namespace Gecode { namespace Int { namespace Linear { class BoolNegTraits { public: /// The negated view - typedef NegBoolView NegView; + using NegView = NegBoolView; /// Return negated View static NegBoolView neg(BoolView x) { @@ -565,7 +563,7 @@ namespace Gecode { namespace Int { namespace Linear { class BoolNegTraits { public: /// The negated view - typedef BoolView NegView; + using NegView = BoolView; /// Return negated View static BoolView neg(NegBoolView x) { @@ -601,8 +599,7 @@ namespace Gecode { namespace Int { namespace Linear { n_s--; if ((n_s < c) || (c <= 0)) return ES_NOFIX; - else - return ES_FIX; + return ES_FIX; } template @@ -710,8 +707,7 @@ namespace Gecode { namespace Int { namespace Linear { if ((c < 0) || (c > n_s) || (n_s == 0)) return ES_NOFIX; - else - return ES_FIX; + return ES_FIX; } template @@ -785,6 +781,6 @@ namespace Gecode { namespace Int { namespace Linear { return ES_OK; } -}}} // namespace Gecode::Int::Linear +} // namespace Gecode::Int::Linear // STATISTICS: int-prop diff --git a/gecode/int/linear/bool-post.cpp b/gecode/int/linear/bool-post.cpp index 24b9051490..c6f4ea0cac 100644 --- a/gecode/int/linear/bool-post.cpp +++ b/gecode/int/linear/bool-post.cpp @@ -35,10 +35,10 @@ #include #include -namespace Gecode { namespace Int { namespace Linear { +namespace Gecode::Int::Linear { /// Eliminate assigned views - forceinline void + static forceinline void eliminate(Term* t, int& n, long long int& d) { for (int i = n; i--;) if (t[i].x.one()) { @@ -51,7 +51,7 @@ namespace Gecode { namespace Int { namespace Linear { } /// Rewrite non-strict relations - forceinline void + static forceinline void rewrite(IntRelType& r, long long int& d) { switch (r) { case IRT_EQ: @@ -72,7 +72,7 @@ namespace Gecode { namespace Int { namespace Linear { } } - forceinline void + static forceinline void post_pos_unit(Home home, Term* t_p, int n_p, IntRelType irt, IntView y, int c) { switch (irt) { case IRT_EQ: { @@ -105,7 +105,7 @@ namespace Gecode { namespace Int { namespace Linear { } } - forceinline void + static forceinline void post_pos_unit(Home home, Term* t_p, int n_p, IntRelType irt, ZeroIntView, int c) { switch (irt) { case IRT_EQ: { @@ -137,7 +137,7 @@ namespace Gecode { namespace Int { namespace Linear { } } - forceinline void + static forceinline void post_pos_unit(Home home, Term* t_p, int n_p, IntRelType irt, int c, Reify r, IntPropLevel) { switch (irt) { case IRT_EQ: { @@ -218,7 +218,7 @@ namespace Gecode { namespace Int { namespace Linear { } } - forceinline void + static forceinline void post_neg_unit(Home home, Term* t_n, int n_n, IntRelType irt, IntView y, int c) { switch (irt) { case IRT_EQ: { @@ -253,7 +253,7 @@ namespace Gecode { namespace Int { namespace Linear { } } - forceinline void + static forceinline void post_neg_unit(Home home, Term* t_n, int n_n, IntRelType irt, ZeroIntView, int c) { switch (irt) { case IRT_EQ: { @@ -285,7 +285,7 @@ namespace Gecode { namespace Int { namespace Linear { } } - forceinline void + static forceinline void post_neg_unit(Home home, Term* t_n, int n_n, IntRelType irt, int c, Reify r, IntPropLevel) { switch (irt) { case IRT_EQ: { @@ -366,7 +366,7 @@ namespace Gecode { namespace Int { namespace Linear { } } - forceinline void + static forceinline void post_mixed(Home home, Term* t_p, int n_p, Term* t_n, int n_n, IntRelType irt, IntView y, int c) { ScaleBoolArray b_p(home, n_p); @@ -404,7 +404,7 @@ namespace Gecode { namespace Int { namespace Linear { } } - forceinline void + static forceinline void post_mixed(Home home, Term* t_p, int n_p, Term* t_n, int n_n, IntRelType irt, ZeroIntView y, int c) { ScaleBoolArray b_p(home, n_p); @@ -442,7 +442,7 @@ namespace Gecode { namespace Int { namespace Linear { } template - forceinline void + static forceinline void post_all(Home home, Term* t, int n, IntRelType irt, View x, int c) { Limits::check(c, "Int::linear"); @@ -647,6 +647,6 @@ namespace Gecode { namespace Int { namespace Linear { } } -}}} // namespace Gecode::Int::Linear +} // namespace Gecode::Int::Linear // STATISTICS: int-post diff --git a/gecode/int/linear/bool-scale.hpp b/gecode/int/linear/bool-scale.hpp index a623387f84..14d0c8e9b7 100644 --- a/gecode/int/linear/bool-scale.hpp +++ b/gecode/int/linear/bool-scale.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace Linear { +namespace Gecode::Int::Linear { /* * Array of scale Boolean views @@ -75,11 +75,11 @@ namespace Gecode { namespace Int { namespace Linear { } } forceinline ScaleBool* - ScaleBoolArray::fst(void) const { + ScaleBoolArray::fst() const { return _fst; } forceinline ScaleBool* - ScaleBoolArray::lst(void) const { + ScaleBoolArray::lst() const { return _lst; } forceinline void @@ -91,11 +91,11 @@ namespace Gecode { namespace Int { namespace Linear { _lst = l; } forceinline bool - ScaleBoolArray::empty(void) const { + ScaleBoolArray::empty() const { return _fst == _lst; } forceinline int - ScaleBoolArray::size(void) const { + ScaleBoolArray::size() const { return static_cast(_lst - _fst); } forceinline bool @@ -104,7 +104,7 @@ namespace Gecode { namespace Int { namespace Linear { } inline void - ScaleBoolArray::sort(void) { + ScaleBoolArray::sort() { ScaleDec scale_dec; Support::quicksort(fst(), size(), scale_dec); } @@ -124,11 +124,11 @@ namespace Gecode { namespace Int { namespace Linear { forceinline void EmptyScaleBoolArray::update(Space&, EmptyScaleBoolArray&) {} forceinline ScaleBool* - EmptyScaleBoolArray::fst(void) const { + EmptyScaleBoolArray::fst() const { return nullptr; } forceinline ScaleBool* - EmptyScaleBoolArray::lst(void) const { + EmptyScaleBoolArray::lst() const { return nullptr; } forceinline void @@ -136,15 +136,15 @@ namespace Gecode { namespace Int { namespace Linear { forceinline void EmptyScaleBoolArray::lst(ScaleBool*) {} forceinline bool - EmptyScaleBoolArray::empty(void) const { + EmptyScaleBoolArray::empty() const { return true; } forceinline int - EmptyScaleBoolArray::size(void) const { + EmptyScaleBoolArray::size() const { return 0; } forceinline void - EmptyScaleBoolArray::sort(void) {} + EmptyScaleBoolArray::sort() {} /* * Base-class for Boolean constraints with coefficients @@ -217,21 +217,19 @@ namespace Gecode { namespace Int { namespace Linear { ZeroIntView z; return new (home) EqBoolScale(home, *this, ep, n, z, c + x.val()); - } else { - return new (home) EqBoolScale(home, *this, ep, n, x, c); } - } else if (n.empty()) { + return new (home) EqBoolScale(home, *this, ep, n, x, c); + } + if (n.empty()) { EmptyScaleBoolArray en; if (x.assigned()) { ZeroIntView z; return new (home) EqBoolScale(home, *this, p, en, z, c + x.val()); - } else { - return new (home) EqBoolScale(home, *this, p, en, x, c); } - } else { - return new (home) EqBoolScale(home, *this, p, n, x, c); + return new (home) EqBoolScale(home, *this, p, en, x, c); } + return new (home) EqBoolScale(home, *this, p, n, x, c); } template @@ -434,21 +432,19 @@ namespace Gecode { namespace Int { namespace Linear { ZeroIntView z; return new (home) LqBoolScale(home, *this, ep, n, z, c + x.val()); - } else { - return new (home) LqBoolScale(home, *this, ep, n, x, c); } - } else if (n.empty()) { + return new (home) LqBoolScale(home, *this, ep, n, x, c); + } + if (n.empty()) { EmptyScaleBoolArray en; if (x.assigned()) { ZeroIntView z; return new (home) LqBoolScale(home, *this, p, en, z, c + x.val()); - } else { - return new (home) LqBoolScale(home, *this, p, en, x, c); } - } else { - return new (home) LqBoolScale(home, *this, p, n, x, c); + return new (home) LqBoolScale(home, *this, p, en, x, c); } + return new (home) LqBoolScale(home, *this, p, n, x, c); } template @@ -580,21 +576,19 @@ namespace Gecode { namespace Int { namespace Linear { ZeroIntView z; return new (home) NqBoolScale(home, *this, ep, n, z, c + x.val()); - } else { - return new (home) NqBoolScale(home, *this, ep, n, x, c); } - } else if (n.empty()) { + return new (home) NqBoolScale(home, *this, ep, n, x, c); + } + if (n.empty()) { EmptyScaleBoolArray en; if (x.assigned()) { ZeroIntView z; return new (home) NqBoolScale(home, *this, p, en, z, c + x.val()); - } else { - return new (home) NqBoolScale(home, *this, p, en, x, c); } - } else { - return new (home) NqBoolScale(home, *this, p, n, x, c); + return new (home) NqBoolScale(home, *this, p, en, x, c); } + return new (home) NqBoolScale(home, *this, p, n, x, c); } template @@ -677,6 +671,6 @@ namespace Gecode { namespace Int { namespace Linear { return ES_OK; } -}}} // namespace Gecode::Int::Linear +} // namespace Gecode::Int::Linear // STATISTICS: int-prop diff --git a/gecode/int/linear/bool-view.hpp b/gecode/int/linear/bool-view.hpp index be8aa5b749..ad143710ec 100644 --- a/gecode/int/linear/bool-view.hpp +++ b/gecode/int/linear/bool-view.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace Linear { +namespace Gecode::Int::Linear { /* * Base-class @@ -316,6 +316,6 @@ namespace Gecode { namespace Int { namespace Linear { return ES_FIX; } -}}} // namespace Gecode::Int::Linear +} // namespace Gecode::Int::Linear // STATISTICS: int-prop diff --git a/gecode/int/linear/int-bin.hpp b/gecode/int/linear/int-bin.hpp index 612e435ef9..5c52043ef5 100644 --- a/gecode/int/linear/int-bin.hpp +++ b/gecode/int/linear/int-bin.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace Linear { +namespace Gecode::Int::Linear { /* * Binary linear propagators @@ -436,6 +436,6 @@ namespace Gecode { namespace Int { namespace Linear { return ES_FIX; } -}}} // namespace Gecode::Int::Linear +} // namespace Gecode::Int::Linear // STATISTICS: int-prop diff --git a/gecode/int/linear/int-dom.hpp b/gecode/int/linear/int-dom.hpp index 80e8c4d22d..acf2f391fb 100644 --- a/gecode/int/linear/int-dom.hpp +++ b/gecode/int/linear/int-dom.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace Linear { +namespace Gecode::Int::Linear { /** * \brief %Set for support information @@ -46,7 +46,7 @@ namespace Gecode { namespace Int { namespace Linear { public: /// Default constructor - SupportSet(void) = default; + SupportSet() = default; /// Initialize support set with cardinality \a n void init(Region& r, unsigned int n); /// Record that there is support at position \a i @@ -67,7 +67,7 @@ namespace Gecode { namespace Int { namespace Linear { /// Initialize iterator ResultIter(const SupportSet& s0, const IntView& x); /// Increment to next supported value - void operator++(void); + void operator++(); }; public: @@ -101,7 +101,7 @@ namespace Gecode { namespace Int { namespace Linear { /// Initialize view void init(Region& r, int a, const IntView& x, Val l, Val u); /// Record value at current position as supported - void support(void); + void support(); /// Tell back new variable domain according to support found ModEvent tell(Space& home); }; @@ -182,7 +182,7 @@ namespace Gecode { namespace Int { namespace Linear { } } forceinline void - SupportSet::ResultIter::operator++(void) { + SupportSet::ResultIter::operator++() { do { ViewValues::operator++(); ++p; @@ -221,7 +221,7 @@ namespace Gecode { namespace Int { namespace Linear { } template forceinline void - SupportIter::support(void) { + SupportIter::support() { s.support(p); } template @@ -384,8 +384,7 @@ namespace Gecode { namespace Int { namespace Linear { DomEq::cost(const Space&, const ModEventDelta& med) const { if (View::me(med) != ME_INT_DOM) return PropCost::linear(PropCost::LO, x.size() + y.size()); - else - return PropCost::crazy(PropCost::HI, x.size() + y.size()); + return PropCost::crazy(PropCost::HI, x.size() + y.size()); } template @@ -485,6 +484,6 @@ namespace Gecode { namespace Int { namespace Linear { return ES_FIX; } -}}} // namespace Gecode::Int::Linear +} // namespace Gecode::Int::Linear // STATISTICS: int-prop diff --git a/gecode/int/linear/int-nary.hpp b/gecode/int/linear/int-nary.hpp index f1e19739e6..803b1993bc 100644 --- a/gecode/int/linear/int-nary.hpp +++ b/gecode/int/linear/int-nary.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Int { namespace Linear { +namespace Gecode::Int::Linear { /** * \brief Test if only unit-coefficient arrays used @@ -839,6 +839,6 @@ namespace Gecode { namespace Int { namespace Linear { return ES_FIX; } -}}} // namespace Gecode::Int::Linear +} // namespace Gecode::Int::Linear // STATISTICS: int-prop diff --git a/gecode/int/linear/int-noview.hpp b/gecode/int/linear/int-noview.hpp index e541df4694..d95dea7fa7 100644 --- a/gecode/int/linear/int-noview.hpp +++ b/gecode/int/linear/int-noview.hpp @@ -32,7 +32,7 @@ namespace Gecode { - namespace Int { namespace Linear { + namespace Int::Linear { /** * \brief No view serves as filler for empty view arrays @@ -43,50 +43,50 @@ namespace Gecode { /// \name Constructors and initialization //@{ /// Default constructor - NoView(void) = default; + NoView() = default; //@} /// \name Value access //@{ /// Return minimum of domain int - min(void) const { + min() const { return 0; } /// Return maximum of domain int - max(void) const { + max() const { return 0; } /// Return median of domain (greatest element not greater than the median) int - med(void) const { + med() const { return 0; } /// Return assigned value (only if assigned) int - val(void) const { + val() const { return 0; } /// Return size (cardinality) of domain unsigned int - size(void) const { + size() const { return 1; } /// Return width of domain (distance between maximum and minimum) unsigned int - width(void) const { + width() const { return 1; } /// Return regret of domain minimum (distance to next larger value) unsigned int - regret_min(void) const { + regret_min() const { return 0; } /// Return regret of domain maximum (distance to next smaller value) unsigned int - regret_max(void) const { + regret_max() const { return 0; } //@} @@ -95,12 +95,12 @@ namespace Gecode { //@{ /// Test whether domain is a range bool - range(void) const { + range() const { return true; } /// Test whether view is assigned bool - assigned(void) const { + assigned() const { return true; } @@ -217,7 +217,7 @@ namespace Gecode { return os; } - }} // namespace Int::Linear + } // namespace Int::Linear /** * \brief View array for no view (empty) @@ -229,7 +229,7 @@ namespace Gecode { /// \name Constructors and initialization //@{ /// Default constructor (array of size 0) - ViewArray(void) = default; + ViewArray() = default; /// Allocate array with \a m variables ViewArray(Space& home, int m) { (void)home; @@ -240,17 +240,14 @@ namespace Gecode { /// Initialize ViewArray(Space&, const ViewArray&) {} /// Initialize - const ViewArray& - operator=(const ViewArray&) { - return *this; - } + ViewArray& operator=(const ViewArray&) = default; //@} /// \name Array size //@{ /// Return size of array (number of elements) int - size(void) const { + size() const { return 0; } /// Decrease size of array (number of elements) @@ -270,7 +267,7 @@ namespace Gecode { return n; } /// Return view at position \a i - const Int::Linear::NoView + Int::Linear::NoView operator[](int i) const { (void)i; Int::Linear::NoView n; diff --git a/gecode/int/linear/int-post.cpp b/gecode/int/linear/int-post.cpp index 1a68b7901e..c2723439cb 100644 --- a/gecode/int/linear/int-post.cpp +++ b/gecode/int/linear/int-post.cpp @@ -36,10 +36,10 @@ #include #include -namespace Gecode { namespace Int { namespace Linear { +namespace Gecode::Int::Linear { /// Eliminate assigned views - forceinline void + static forceinline void eliminate(Term* t, int& n, long long int& d) { for (int i = n; i--;) if (t[i].x.assigned()) { @@ -52,7 +52,7 @@ namespace Gecode { namespace Int { namespace Linear { } /// Rewrite all inequations in terms of IRT_LQ - forceinline void + static forceinline void rewrite(IntRelType& irt, long long int& d, Term*& t_p, int& n_p, Term*& t_n, int& n_n) { switch (irt) { case IRT_EQ: @@ -78,7 +78,7 @@ namespace Gecode { namespace Int { namespace Linear { } /// Decide the required precision and check for overflow - forceinline bool + static forceinline bool precision(Term* t_p, int n_p, Term* t_n, int n_n, long long int d) { long long int sl = 0; long long int su = 0; @@ -147,7 +147,7 @@ namespace Gecode { namespace Int { namespace Linear { * */ template - forceinline void + static forceinline void post_nary(Home home, ViewArray& x, ViewArray& y, IntRelType irt, Val c) { switch (irt) { case IRT_EQ: @@ -430,7 +430,7 @@ namespace Gecode { namespace Int { namespace Linear { * */ template - forceinline void + static forceinline void post_nary(Home home, ViewArray& x, ViewArray& y, IntRelType irt, Val c, Reify r) { switch (irt) { case IRT_EQ: @@ -485,7 +485,7 @@ namespace Gecode { namespace Int { namespace Linear { } template - forceinline void + static forceinline void post_reified_int_equality(Home home, IntView& x, int c, CtrlView b, ReifyMode rm, IntPropLevel ipl) { if ((vbd(ipl) == IPL_DOM) || (vbd(ipl) == IPL_DEF)) { switch (rm) { @@ -870,6 +870,6 @@ namespace Gecode { namespace Int { namespace Linear { } } -}}} // namespace Gecode::Int::Linear +} // namespace Gecode::Int::Linear // STATISTICS: int-post diff --git a/gecode/int/linear/int-ter.hpp b/gecode/int/linear/int-ter.hpp index bce16de750..99f283f629 100644 --- a/gecode/int/linear/int-ter.hpp +++ b/gecode/int/linear/int-ter.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace Linear { +namespace Gecode::Int::Linear { /* * Ternary linear propagators @@ -251,6 +251,6 @@ namespace Gecode { namespace Int { namespace Linear { return (x0.max() + x1.max() + x2.max() <= c) ? home.ES_SUBSUMED(*this) : ES_FIX; } -}}} // namespace Gecode::Int::Linear +} // namespace Gecode::Int::Linear // STATISTICS: int-prop diff --git a/gecode/int/linear/post.hpp b/gecode/int/linear/post.hpp index 8cea59cb65..a22d90de93 100644 --- a/gecode/int/linear/post.hpp +++ b/gecode/int/linear/post.hpp @@ -33,7 +33,7 @@ #include #include -namespace Gecode { namespace Int { namespace Linear { +namespace Gecode::Int::Linear { template inline void @@ -50,15 +50,11 @@ namespace Gecode { namespace Int { namespace Linear { min += a * t[i].x.max(); } } - if (min < Limits::min) - min = Limits::min; - if (min > Limits::max) - min = Limits::max; + min = std::max(min, Limits::min); + min = std::min(min, Limits::max); l = static_cast(min); - if (max < Limits::min) - max = Limits::min; - if (max > Limits::max) - max = Limits::max; + max = std::max(max, Limits::min); + max = std::min(max, Limits::max); u = static_cast(max); } @@ -227,6 +223,6 @@ namespace Gecode { namespace Int { namespace Linear { return true; } -}}} // namespace Gecode::Int::Linear +} // namespace Gecode::Int::Linear // STATISTICS: int-post diff --git a/gecode/int/member.hh b/gecode/int/member.hh index b5caf1f838..800806da2d 100644 --- a/gecode/int/member.hh +++ b/gecode/int/member.hh @@ -41,7 +41,7 @@ * \brief Membership propagators */ -namespace Gecode { namespace Int { namespace Member { +namespace Gecode::Int::Member { /** * \brief Membership propagator @@ -112,7 +112,7 @@ namespace Gecode { namespace Int { namespace Member { size_t dispose(Space& home) override; }; -}}} // namespace Gecode::Int::Member +} // namespace Gecode::Int::Member #include #include diff --git a/gecode/int/member/prop.hpp b/gecode/int/member/prop.hpp index ef27b3ed8b..0c3b87b0dc 100644 --- a/gecode/int/member/prop.hpp +++ b/gecode/int/member/prop.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Int { namespace Member { +namespace Gecode::Int::Member { template forceinline @@ -164,6 +164,6 @@ namespace Gecode { namespace Int { namespace Member { return ES_FIX; } -}}} // namespace Gecode::Int::Member +} // namespace Gecode::Int::Member // STATISTICS: int-prop diff --git a/gecode/int/member/re-prop.hpp b/gecode/int/member/re-prop.hpp index a667a13329..8686dc56ab 100644 --- a/gecode/int/member/re-prop.hpp +++ b/gecode/int/member/re-prop.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Int { namespace Member { +namespace Gecode::Int::Member { template forceinline @@ -178,6 +178,6 @@ namespace Gecode { namespace Int { namespace Member { return ES_FIX; } -}}} // namespace Gecode::Int::Member +} // namespace Gecode::Int::Member // STATISTICS: int-prop diff --git a/gecode/int/min-distance.cpp b/gecode/int/min-distance.cpp index 33ce97f446..fa7d5c04bc 100644 --- a/gecode/int/min-distance.cpp +++ b/gecode/int/min-distance.cpp @@ -40,7 +40,7 @@ namespace Gecode { IntDistance::Data::Data(int n0, std::function f) : n(n0), function(std::move(f)) {} - IntDistance::Data::~Data(void) = default; + IntDistance::Data::~Data() = default; IntDistance::IntDistance(int n, const IntArgs& matrix) { Int::Limits::positive(n, "IntDistance"); @@ -64,10 +64,10 @@ namespace Gecode { } // namespace Gecode -namespace Gecode { namespace Int { namespace MinDistance { +namespace Gecode::Int::MinDistance { /// Validate the organization and number of positions - void + static void check(const IntVarArgs& x, MinDistancePropKind kind) { if (x.size() < 2) throw TooFewArguments("Int::minimum_distance"); @@ -77,13 +77,13 @@ namespace Gecode { namespace Int { namespace MinDistance { } /// Shared posting for the two public overloads - ExecStatus + static ExecStatus post(Home home, const IntVarArgs& x, IntView z, const IntDistance& d, const IntSharedArray& r, MinDistancePropKind kind, IntPropLevel ipl) { ViewArray views(home, x); - for (int i = 0; i < views.size(); i++) { - GECODE_ME_CHECK(views[i].gq(home, 0)); - GECODE_ME_CHECK(views[i].le(home, d.size())); + for (auto& view : views) { + GECODE_ME_CHECK(view.gq(home, 0)); + GECODE_ME_CHECK(view.le(home, d.size())); } GECODE_ME_CHECK(z.gq(home, 0)); if (views.assigned()) @@ -101,7 +101,7 @@ namespace Gecode { namespace Int { namespace MinDistance { return ES_OK; } -}}} // namespace Gecode::Int::MinDistance +} // namespace Gecode::Int::MinDistance namespace Gecode { diff --git a/gecode/int/min-distance.hh b/gecode/int/min-distance.hh index dfbe948312..26ac61dd35 100644 --- a/gecode/int/min-distance.hh +++ b/gecode/int/min-distance.hh @@ -47,7 +47,7 @@ * * \brief Minimum-distance propagators over indexed sites */ -namespace Gecode { namespace Int { namespace MinDistance { +namespace Gecode::Int::MinDistance { /// Pair maximum and its witness struct PairCache { @@ -206,7 +206,7 @@ namespace Gecode { namespace Int { namespace MinDistance { size_t dispose(Space& home) override; }; -}}} // namespace Gecode::Int::MinDistance +} // namespace Gecode::Int::MinDistance #include diff --git a/gecode/int/min-distance.hpp b/gecode/int/min-distance.hpp index aaa36ca64e..dfa5c53dc7 100644 --- a/gecode/int/min-distance.hpp +++ b/gecode/int/min-distance.hpp @@ -36,7 +36,7 @@ namespace Gecode { forceinline int - IntDistance::size(void) const { + IntDistance::size() const { return static_cast(object())->n; } diff --git a/gecode/int/min-distance/prop.hpp b/gecode/int/min-distance/prop.hpp index cf5da38ab4..f888542d51 100644 --- a/gecode/int/min-distance/prop.hpp +++ b/gecode/int/min-distance/prop.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace MinDistance { +namespace Gecode::Int::MinDistance { /// Inclusive requirement, with an empty matrix denoting all zeroes forceinline int @@ -461,8 +461,8 @@ namespace Gecode { namespace Int { namespace MinDistance { Region region; bool* present = region.alloc(d.size()); std::fill(present, present + d.size(), false); - for (int i = 0; i < x.size(); i++) - for (ViewValues v(x[i]); v(); ++v) + for (auto xi : x) + for (ViewValues v(xi); v(); ++v) present[v.val()] = true; int* sites = region.alloc(d.size()); int n = 0; @@ -500,6 +500,6 @@ namespace Gecode { namespace Int { namespace MinDistance { return sizeof(*this); } -}}} // namespace Gecode::Int::MinDistance +} // namespace Gecode::Int::MinDistance // STATISTICS: int-prop diff --git a/gecode/int/no-overlap.cpp b/gecode/int/no-overlap.cpp index ec9b2ae309..e079e8a251 100644 --- a/gecode/int/no-overlap.cpp +++ b/gecode/int/no-overlap.cpp @@ -34,17 +34,17 @@ namespace Gecode { - namespace Int { namespace NoOverlap { + namespace Int::NoOverlap { - bool + static bool optional(const BoolVarArgs& m) { - for (int i = 0; i < m.size(); i++) - if (m[i].none()) + for (auto mi : m) + if (mi.none()) return true; return false; } - }} // namespace Int::NoOverlap + } // namespace Int::NoOverlap void no_overlap(Home home, const IntVarArgs& x, const IntArgs& w, const IntVarArgs& y, const IntArgs& h, IntPropLevel) { diff --git a/gecode/int/no-overlap.hh b/gecode/int/no-overlap.hh index 2082cc6630..45be7f57b4 100644 --- a/gecode/int/no-overlap.hh +++ b/gecode/int/no-overlap.hh @@ -40,7 +40,7 @@ * \brief %No-overlap propagators */ -namespace Gecode { namespace Int { namespace NoOverlap { +namespace Gecode::Int::NoOverlap { /** * \brief Dimension combining coordinate and integer size information @@ -60,18 +60,18 @@ namespace Gecode { namespace Int { namespace NoOverlap { public: /// Default constructor - FixDim(void); + FixDim(); /// Constructor FixDim(IntView c, int s); /// Return smallest start coordinate - int ssc(void) const; + int ssc() const; /// Return largest start coordinate - int lsc(void) const; + int lsc() const; /// Return smallest end coordinate - int sec(void) const; + int sec() const; /// Return largest end coordinate - int lec(void) const; + int lec() const; /// Dimension must not overlap with \a d ExecStatus no_overlap(Space& home, FixDim& d); @@ -107,18 +107,18 @@ namespace Gecode { namespace Int { namespace NoOverlap { public: /// Default constructor - FlexDim(void) = default; + FlexDim() = default; /// Constructor FlexDim(IntView c0, IntView s, IntView c1); /// Return smallest start coordinate - int ssc(void) const; + int ssc() const; /// Return largest start coordinate - int lsc(void) const; + int lsc() const; /// Return smallest end coordinate - int sec(void) const; + int sec() const; /// Return largest end coordinate - int lec(void) const; + int lec() const; /// Dimension must not overlap with \a d ExecStatus no_overlap(Space& home, FlexDim& d); @@ -134,11 +134,11 @@ namespace Gecode { namespace Int { namespace NoOverlap { void reschedule(Space& home, Propagator& p); }; -}}} // namespace Gecode::Int::NoOverlap +} // namespace Gecode::Int::NoOverlap #include -namespace Gecode { namespace Int { namespace NoOverlap { +namespace Gecode::Int::NoOverlap { /** * \brief Mandatory box class @@ -155,14 +155,14 @@ namespace Gecode { namespace Int { namespace NoOverlap { /// Access to dimension \a i Dim& operator[](int i); /// Return number of dimensions - static int dim(void); + static int dim(); /// Whether box is mandatory - bool mandatory(void) const; + bool mandatory() const; /// Whether box is optional - bool optional(void) const; + bool optional() const; /// Whether box is excluded - bool excluded(void) const; + bool excluded() const; /// Exclude box ExecStatus exclude(Space& home); @@ -176,7 +176,7 @@ namespace Gecode { namespace Int { namespace NoOverlap { ExecStatus no_overlap(Space& home, ManBox& b); /// Update box during cloning - void update(Space& home, ManBox& r); + void update(Space& home, ManBox& b); /// Subscribe propagator \a p to box void subscribe(Space& home, Propagator& p); @@ -200,17 +200,17 @@ namespace Gecode { namespace Int { namespace NoOverlap { /// Set Boolean view to \a o void optional(BoolView o); /// Whether box is mandatory - bool mandatory(void) const; + bool mandatory() const; /// Whether box is optional - bool optional(void) const; + bool optional() const; /// Whether box is excluded - bool excluded(void) const; + bool excluded() const; /// Exclude box ExecStatus exclude(Space& home); /// Update box during cloning - void update(Space& home, OptBox& r); + void update(Space& home, OptBox& b); /// Subscribe propagator \a p to box void subscribe(Space& home, Propagator& p); @@ -220,11 +220,11 @@ namespace Gecode { namespace Int { namespace NoOverlap { void reschedule(Space& home, Propagator& p); }; -}}} // namespace Gecode::Int::NoOverlap +} // namespace Gecode::Int::NoOverlap #include -namespace Gecode { namespace Int { namespace NoOverlap { +namespace Gecode::Int::NoOverlap { /** * \brief Base class for no-overlap propagator @@ -318,7 +318,7 @@ namespace Gecode { namespace Int { namespace NoOverlap { size_t dispose(Space& home) override; }; -}}} // namespace Gecode::Int::NoOverlap +} // namespace Gecode::Int::NoOverlap #include #include diff --git a/gecode/int/no-overlap/base.hpp b/gecode/int/no-overlap/base.hpp index e305813eb5..ebaa41944e 100644 --- a/gecode/int/no-overlap/base.hpp +++ b/gecode/int/no-overlap/base.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace NoOverlap { +namespace Gecode::Int::NoOverlap { template forceinline @@ -86,6 +86,6 @@ namespace Gecode { namespace Int { namespace NoOverlap { b[i].reschedule(home, *this); } -}}} // namespace Gecode::Int::NoOverlap +} // namespace Gecode::Int::NoOverlap // STATISTICS: int-prop diff --git a/gecode/int/no-overlap/box.hpp b/gecode/int/no-overlap/box.hpp index 779007b50a..2407d09089 100644 --- a/gecode/int/no-overlap/box.hpp +++ b/gecode/int/no-overlap/box.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace NoOverlap { +namespace Gecode::Int::NoOverlap { /* * Mandatory boxes @@ -50,23 +50,23 @@ namespace Gecode { namespace Int { namespace NoOverlap { } template forceinline int - ManBox::dim(void) { + ManBox::dim() { return n; } template forceinline bool - ManBox::mandatory(void) const { + ManBox::mandatory() const { return true; } template forceinline bool - ManBox::excluded(void) const { + ManBox::excluded() const { return false; } template forceinline bool - ManBox::optional(void) const { + ManBox::optional() const { return false; } @@ -149,17 +149,17 @@ namespace Gecode { namespace Int { namespace NoOverlap { } template forceinline bool - OptBox::mandatory(void) const { + OptBox::mandatory() const { return o.one(); } template forceinline bool - OptBox::excluded(void) const { + OptBox::excluded() const { return o.zero(); } template forceinline bool - OptBox::optional(void) const { + OptBox::optional() const { return o.none(); } @@ -196,6 +196,6 @@ namespace Gecode { namespace Int { namespace NoOverlap { o.reschedule(home, p, PC_BOOL_VAL); } -}}} // namespace Gecode::Int::NoOverlap +} // namespace Gecode::Int::NoOverlap // STATISTICS: int-prop diff --git a/gecode/int/no-overlap/dim.hpp b/gecode/int/no-overlap/dim.hpp index e2b2598bd3..1d3dffdd3c 100644 --- a/gecode/int/no-overlap/dim.hpp +++ b/gecode/int/no-overlap/dim.hpp @@ -30,33 +30,33 @@ * */ -namespace Gecode { namespace Int { namespace NoOverlap { +namespace Gecode::Int::NoOverlap { /* * Dimension with integer size * */ forceinline - FixDim::FixDim(void) + FixDim::FixDim() : s(0) {} forceinline FixDim::FixDim(IntView c0, int s0) : c(c0), s(s0) {} forceinline int - FixDim::ssc(void) const { + FixDim::ssc() const { return c.min(); } forceinline int - FixDim::lsc(void) const { + FixDim::lsc() const { return c.max(); } forceinline int - FixDim::sec(void) const { + FixDim::sec() const { return c.min() + s; } forceinline int - FixDim::lec(void) const { + FixDim::lec() const { return c.max() + s; } @@ -118,19 +118,19 @@ namespace Gecode { namespace Int { namespace NoOverlap { : c0(c00), s(s0), c1(c10) {} forceinline int - FlexDim::ssc(void) const { + FlexDim::ssc() const { return c0.min(); } forceinline int - FlexDim::lsc(void) const { + FlexDim::lsc() const { return c0.max(); } forceinline int - FlexDim::sec(void) const { + FlexDim::sec() const { return c1.min(); } forceinline int - FlexDim::lec(void) const { + FlexDim::lec() const { return c1.max(); } @@ -192,6 +192,6 @@ namespace Gecode { namespace Int { namespace NoOverlap { c1.reschedule(home, p, PC_INT_DOM); } -}}} // namespace Gecode::Int::NoOverlap +} // namespace Gecode::Int::NoOverlap // STATISTICS: int-prop diff --git a/gecode/int/no-overlap/man.hpp b/gecode/int/no-overlap/man.hpp index 0d0981fd48..b3996d2d67 100644 --- a/gecode/int/no-overlap/man.hpp +++ b/gecode/int/no-overlap/man.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace NoOverlap { +namespace Gecode::Int::NoOverlap { template forceinline @@ -111,6 +111,6 @@ namespace Gecode { namespace Int { namespace NoOverlap { return ES_NOFIX; } -}}} // namespace Gecode::Int::NoOverlap +} // namespace Gecode::Int::NoOverlap // STATISTICS: int-prop diff --git a/gecode/int/no-overlap/opt.hpp b/gecode/int/no-overlap/opt.hpp index c58febeb4b..c702837ea3 100644 --- a/gecode/int/no-overlap/opt.hpp +++ b/gecode/int/no-overlap/opt.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace NoOverlap { +namespace Gecode::Int::NoOverlap { template forceinline @@ -154,6 +154,6 @@ namespace Gecode { namespace Int { namespace NoOverlap { return ES_NOFIX; } -}}} // namespace Gecode::Int::NoOverlap +} // namespace Gecode::Int::NoOverlap // STATISTICS: int-prop diff --git a/gecode/int/nvalues.hh b/gecode/int/nvalues.hh index 4811f68b94..bd71457553 100644 --- a/gecode/int/nvalues.hh +++ b/gecode/int/nvalues.hh @@ -41,7 +41,7 @@ * \brief Number of values propagators */ -namespace Gecode { namespace Int { namespace NValues { +namespace Gecode::Int::NValues { /// Event type for range-based overlap analysis enum class RangeEventType { @@ -84,14 +84,14 @@ namespace Gecode { namespace Int { namespace NValues { void set(int x, int y); }; -}}} // namespace Gecode::Int::NValues +} // namespace Gecode::Int::NValues #include #include #include -namespace Gecode { namespace Int { namespace NValues { +namespace Gecode::Int::NValues { /// View-value graph for propagation of upper bound class Graph : public ViewValGraph::Graph { @@ -101,28 +101,28 @@ namespace Gecode { namespace Int { namespace NValues { public: /// Construct graph as not yet initialized - Graph(void); + Graph(); /// Return size of maximal matching (excluding assigned views) - int size(void) const; + int size() const; /// Initialize graph including values in \a vs void init(Space& home, const ValSet& vs, const ViewArray& x); /// Synchronize graph with new view domains - void sync(void); + void sync(); /* * \brief Mark all edges used that can appear in some maximal matching * * Return true, if any edge can be in fact pruned. */ - bool mark(void); + bool mark(); /// Prune all values corresponding to unused edges ExecStatus prune(Space& home); }; -}}} // namespace Gecode::Int::NValues +} // namespace Gecode::Int::NValues #include -namespace Gecode { namespace Int { namespace NValues { +namespace Gecode::Int::NValues { /** * \brief Number of values propagator for integer views base class @@ -279,14 +279,14 @@ namespace Gecode { namespace Int { namespace NValues { static ExecStatus post(Home home, ViewArray& x, VY y); }; -}}} // namespace Gecode::Int::NValues +} // namespace Gecode::Int::NValues #include #include #include #include -namespace Gecode { namespace Int { namespace NValues { +namespace Gecode::Int::NValues { /** * \brief Number of values propagator for Boolean views base class @@ -422,7 +422,7 @@ namespace Gecode { namespace Int { namespace NValues { static ExecStatus post(Home home, ViewArray& x, VY y); }; -}}} // namespace Gecode::Int::NValues +} // namespace Gecode::Int::NValues #include #include diff --git a/gecode/int/nvalues/bool-base.hpp b/gecode/int/nvalues/bool-base.hpp index cfa99d7485..6339976bee 100644 --- a/gecode/int/nvalues/bool-base.hpp +++ b/gecode/int/nvalues/bool-base.hpp @@ -30,16 +30,16 @@ * */ -namespace Gecode { namespace Int { namespace NValues { +namespace Gecode::Int::NValues { template forceinline BoolBase::BoolBase(Home home, int status0, ViewArray& x, VY y0) : Propagator(home), status(status0), c(home), y(y0) { y.subscribe(home, *this, PC_INT_BND); - for (int i = 0; i < x.size(); i++) { - assert(!x[i].assigned()); - (void)new (home) ViewAdvisor(home, *this, c, x[i]); + for (auto& xi : x) { + assert(!xi.assigned()); + (void)new (home) ViewAdvisor(home, *this, c, xi); } } @@ -93,6 +93,6 @@ namespace Gecode { namespace Int { namespace NValues { return sizeof(*this); } -}}} // namespace Gecode::Int::NValues +} // namespace Gecode::Int::NValues // STATISTICS: int-prop diff --git a/gecode/int/nvalues/bool-eq.hpp b/gecode/int/nvalues/bool-eq.hpp index eddf1da489..2faf049c32 100644 --- a/gecode/int/nvalues/bool-eq.hpp +++ b/gecode/int/nvalues/bool-eq.hpp @@ -33,7 +33,7 @@ #include #include -namespace Gecode { namespace Int { namespace NValues { +namespace Gecode::Int::NValues { template forceinline @@ -164,6 +164,6 @@ namespace Gecode { namespace Int { namespace NValues { return ES_FIX; } -}}} // namespace Gecode::Int::NValues +} // namespace Gecode::Int::NValues // STATISTICS: int-prop diff --git a/gecode/int/nvalues/bool-gq.hpp b/gecode/int/nvalues/bool-gq.hpp index 98c06b20ec..49524b9af2 100644 --- a/gecode/int/nvalues/bool-gq.hpp +++ b/gecode/int/nvalues/bool-gq.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Int { namespace NValues { +namespace Gecode::Int::NValues { template forceinline @@ -139,6 +139,6 @@ namespace Gecode { namespace Int { namespace NValues { return ES_FIX; } -}}} // namespace Gecode::Int::NValues +} // namespace Gecode::Int::NValues // STATISTICS: int-prop diff --git a/gecode/int/nvalues/bool-lq.hpp b/gecode/int/nvalues/bool-lq.hpp index 8f7737f4da..a5f7500a4e 100644 --- a/gecode/int/nvalues/bool-lq.hpp +++ b/gecode/int/nvalues/bool-lq.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Int { namespace NValues { +namespace Gecode::Int::NValues { template forceinline @@ -141,6 +141,6 @@ namespace Gecode { namespace Int { namespace NValues { return ES_FIX; } -}}} // namespace Gecode::Int::NValues +} // namespace Gecode::Int::NValues // STATISTICS: int-prop diff --git a/gecode/int/nvalues/graph.hpp b/gecode/int/nvalues/graph.hpp index 0df0e5ffa9..14c2f10daf 100644 --- a/gecode/int/nvalues/graph.hpp +++ b/gecode/int/nvalues/graph.hpp @@ -30,14 +30,14 @@ * */ -namespace Gecode { namespace Int { namespace NValues { +namespace Gecode::Int::NValues { forceinline - Graph::Graph(void) + Graph::Graph() : n_matched(0) {} forceinline int - Graph::size(void) const { + Graph::size() const { return n_matched; } @@ -88,7 +88,7 @@ namespace Gecode { namespace Int { namespace NValues { } forceinline void - Graph::sync(void) { + Graph::sync() { using namespace ViewValGraph; Region r; @@ -152,7 +152,7 @@ namespace Gecode { namespace Int { namespace NValues { } forceinline bool - Graph::mark(void) { + Graph::mark() { using namespace ViewValGraph; Region r; @@ -246,9 +246,8 @@ namespace Gecode { namespace Int { namespace NValues { if (n_view_visited < n_view) { scc(); return true; - } else { - return false; } + return false; } forceinline ExecStatus @@ -274,6 +273,6 @@ namespace Gecode { namespace Int { namespace NValues { return ES_OK; } -}}} // namespace Gecode::Int::NValues +} // namespace Gecode::Int::NValues // STATISTICS: int-prop diff --git a/gecode/int/nvalues/int-base.hpp b/gecode/int/nvalues/int-base.hpp index 6088528088..2c737043d0 100644 --- a/gecode/int/nvalues/int-base.hpp +++ b/gecode/int/nvalues/int-base.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Int { namespace NValues { +namespace Gecode::Int::NValues { template forceinline @@ -324,6 +324,6 @@ namespace Gecode { namespace Int { namespace NValues { return ES_OK; } -}}} // namespace Gecode::Int::NValues +} // namespace Gecode::Int::NValues // STATISTICS: int-prop diff --git a/gecode/int/nvalues/int-eq.hpp b/gecode/int/nvalues/int-eq.hpp index 311d33dd49..c18b14fdba 100644 --- a/gecode/int/nvalues/int-eq.hpp +++ b/gecode/int/nvalues/int-eq.hpp @@ -33,7 +33,7 @@ #include #include -namespace Gecode { namespace Int { namespace NValues { +namespace Gecode::Int::NValues { template forceinline @@ -158,6 +158,6 @@ namespace Gecode { namespace Int { namespace NValues { return ES_NOFIX; } -}}} // namespace Gecode::Int::NValues +} // namespace Gecode::Int::NValues // STATISTICS: int-prop diff --git a/gecode/int/nvalues/int-gq.hpp b/gecode/int/nvalues/int-gq.hpp index 7b6135b97d..fe51a3a9fe 100644 --- a/gecode/int/nvalues/int-gq.hpp +++ b/gecode/int/nvalues/int-gq.hpp @@ -33,7 +33,7 @@ #include #include -namespace Gecode { namespace Int { namespace NValues { +namespace Gecode::Int::NValues { template forceinline @@ -120,6 +120,6 @@ namespace Gecode { namespace Int { namespace NValues { return ES_NOFIX; } -}}} // namespace Gecode::Int::NValues +} // namespace Gecode::Int::NValues // STATISTICS: int-prop diff --git a/gecode/int/nvalues/int-lq.hpp b/gecode/int/nvalues/int-lq.hpp index 12ed8f300b..9a0c296216 100644 --- a/gecode/int/nvalues/int-lq.hpp +++ b/gecode/int/nvalues/int-lq.hpp @@ -33,7 +33,7 @@ #include #include -namespace Gecode { namespace Int { namespace NValues { +namespace Gecode::Int::NValues { template forceinline @@ -145,6 +145,6 @@ namespace Gecode { namespace Int { namespace NValues { return ES_NOFIX; } -}}} // namespace Gecode::Int::NValues +} // namespace Gecode::Int::NValues // STATISTICS: int-prop diff --git a/gecode/int/nvalues/range-event.hpp b/gecode/int/nvalues/range-event.hpp index 4610219d31..ccdd42fabe 100644 --- a/gecode/int/nvalues/range-event.hpp +++ b/gecode/int/nvalues/range-event.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace NValues { +namespace Gecode::Int::NValues { forceinline bool RangeEvent::operator<(RangeEvent re) const { @@ -41,6 +41,6 @@ namespace Gecode { namespace Int { namespace NValues { return false; } -}}} // namespace Gecode::Int::NValues +} // namespace Gecode::Int::NValues // STATISTICS: int-prop diff --git a/gecode/int/nvalues/sym-bit-matrix.hpp b/gecode/int/nvalues/sym-bit-matrix.hpp index 3ce5e40157..a029a69fa3 100644 --- a/gecode/int/nvalues/sym-bit-matrix.hpp +++ b/gecode/int/nvalues/sym-bit-matrix.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Int { namespace NValues { +namespace Gecode::Int::NValues { forceinline int SymBitMatrix::pos(int x, int y) const { @@ -60,6 +60,6 @@ namespace Gecode { namespace Int { namespace NValues { Support::BitSet::set(static_cast(pos(x, y))); } -}}} // namespace Gecode::Int::NValues +} // namespace Gecode::Int::NValues // STATISTICS: int-prop diff --git a/gecode/int/open-propagator.hpp b/gecode/int/open-propagator.hpp index 643b867bfb..ba4639cc69 100644 --- a/gecode/int/open-propagator.hpp +++ b/gecode/int/open-propagator.hpp @@ -35,7 +35,7 @@ #include -namespace Gecode { namespace Int { +namespace Gecode::Int { /// Follow list growth and remember which positions have been incorporated template @@ -57,7 +57,7 @@ namespace Gecode { namespace Int { } bool - closed(void) const { + closed() const { return length.max() == list.known_length(); } @@ -82,7 +82,7 @@ namespace Gecode { namespace Int { } }; -}} // namespace Gecode::Int +} // namespace Gecode::Int #endif diff --git a/gecode/int/open-var-list.hpp b/gecode/int/open-var-list.hpp index 518a0b9752..7d9b6610ac 100644 --- a/gecode/int/open-var-list.hpp +++ b/gecode/int/open-var-list.hpp @@ -53,7 +53,7 @@ namespace Gecode { Var* x; int n; int capacity; - typedef std::unordered_set VarImpSet; + using VarImpSet = std::unordered_set; VarImpSet identities; // Only committed positions are indexed. Assigned variables need no alias // check, so their entries need not be removed. @@ -140,7 +140,7 @@ namespace Gecode { } void - reserve(void) { + reserve() { if (n == capacity) { int next = (capacity < 4) ? 4 : capacity + std::min(capacity / 2, Int::Limits::max - capacity); x = heap.realloc(x, capacity, next); @@ -210,13 +210,13 @@ namespace Gecode { } // namespace Gecode -namespace Gecode { namespace Int { +namespace Gecode::Int { /// Materialize positions required by the minimum eventual length template class OpenMaterialize : public Propagator, private LocalHandle { protected: - typedef typename OpenVarList::Object Object; + using Object = OpenVarList::Object; IntView length; OpenMaterialize(Home home, Object* source) : Propagator(home), LocalHandle(source), length(source->length) { @@ -270,7 +270,7 @@ namespace Gecode { namespace Int { } }; -}} // namespace Gecode::Int +} // namespace Gecode::Int namespace Gecode { @@ -305,7 +305,7 @@ namespace Gecode { template int - OpenVarList::known_length(void) const { + OpenVarList::known_length() const { return static_cast(object())->n; } @@ -319,7 +319,7 @@ namespace Gecode { template IntVar - OpenVarList::length(void) const { + OpenVarList::length() const { return static_cast(object())->length; } @@ -385,7 +385,7 @@ namespace Gecode { } // namespace Gecode -namespace Gecode { namespace Int { +namespace Gecode::Int { /// Construct an element view without changing the shared source list template @@ -400,7 +400,7 @@ namespace Gecode { namespace Int { return MinusView(IntView(x)); } -}} // namespace Gecode::Int +} // namespace Gecode::Int namespace Gecode { @@ -415,7 +415,7 @@ namespace Gecode { template int - OpenViewList::known_length(void) const { + OpenViewList::known_length() const { return static_cast(object())->n; } @@ -429,7 +429,7 @@ namespace Gecode { template Int::IntView - OpenViewList::length(void) const { + OpenViewList::length() const { return Int::IntView(static_cast(object())->length); } diff --git a/gecode/int/order.hh b/gecode/int/order.hh index 2d3ffd3679..a743b3f49e 100644 --- a/gecode/int/order.hh +++ b/gecode/int/order.hh @@ -41,7 +41,7 @@ * \brief %Int for ordering two tasks */ -namespace Gecode { namespace Int { namespace Order { +namespace Gecode::Int::Order { /** * \brief %Scheduling propagator for ordering two tasks @@ -82,7 +82,7 @@ namespace Gecode { namespace Int { namespace Order { size_t dispose(Space& home) override; }; -}}} // namespace Gecode::Int::Order +} // namespace Gecode::Int::Order #include diff --git a/gecode/int/order/propagate.cpp b/gecode/int/order/propagate.cpp index 462f673250..21a190eb3a 100644 --- a/gecode/int/order/propagate.cpp +++ b/gecode/int/order/propagate.cpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Int { namespace Order { +namespace Gecode::Int::Order { Actor* OrderProp::copy(Space& home) { @@ -56,10 +56,12 @@ namespace Gecode { namespace Int { namespace Order { if (s0.max() + p0 <= s1.min()) { GECODE_ME_CHECK(b.zero(home)); return home.ES_SUBSUMED(*this); - } else if (s1.max() + p1 <= s0.min()) { + } + if (s1.max() + p1 <= s0.min()) { GECODE_ME_CHECK(b.one(home)); return home.ES_SUBSUMED(*this); - } else if ((s1.min() + p1 > s0.max()) || b.zero()) { + } + if ((s1.min() + p1 > s0.max()) || b.zero()) { GECODE_ME_CHECK(b.zero(home)); GECODE_REWRITE(*this, (Rel::Lq::post(home(*this), OffsetView(s0, p0), s1))); } else if ((s0.min() + p0 > s1.max()) || b.one()) { @@ -78,6 +80,6 @@ namespace Gecode { namespace Int { namespace Order { return sizeof(*this); } -}}} // namespace Gecode::Int::Order +} // namespace Gecode::Int::Order // STATISTICS: int-prop diff --git a/gecode/int/order/propagate.hpp b/gecode/int/order/propagate.hpp index 8f6b51e1aa..e48f35592b 100644 --- a/gecode/int/order/propagate.hpp +++ b/gecode/int/order/propagate.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Int { namespace Order { +namespace Gecode::Int::Order { forceinline OrderProp::OrderProp(Home home, IntView _s0, int _p0, IntView _s1, int _p1, BoolView _b) @@ -68,6 +68,6 @@ namespace Gecode { namespace Int { namespace Order { b.update(home, p.b); } -}}} // namespace Gecode::Int::Order +} // namespace Gecode::Int::Order // STATISTICS: int-prop diff --git a/gecode/int/precede.hh b/gecode/int/precede.hh index 4192e73ad4..5300eb7e1f 100644 --- a/gecode/int/precede.hh +++ b/gecode/int/precede.hh @@ -44,7 +44,7 @@ * \brief Value precedence propagators */ -namespace Gecode { namespace Int { namespace Precede { +namespace Gecode::Int::Precede { /** * \brief Single value precedence propagator @@ -102,7 +102,7 @@ namespace Gecode { namespace Int { namespace Precede { static ExecStatus post(Home home, ViewArray& x, int s, int t); }; -}}} // namespace Gecode::Int::Precede +} // namespace Gecode::Int::Precede #include diff --git a/gecode/int/precede/open.hpp b/gecode/int/precede/open.hpp index a01fc18842..7feed5f80a 100644 --- a/gecode/int/precede/open.hpp +++ b/gecode/int/precede/open.hpp @@ -36,7 +36,7 @@ #include #include -namespace Gecode { namespace Int { namespace Precede { +namespace Gecode::Int::Precede { template class Open : public OpenListPropagator { @@ -176,7 +176,7 @@ namespace Gecode { namespace Int { namespace Precede { } }; -}}} // namespace Gecode::Int::Precede +} // namespace Gecode::Int::Precede #endif diff --git a/gecode/int/precede/single.hpp b/gecode/int/precede/single.hpp index 27f2284cb6..76e974b8aa 100644 --- a/gecode/int/precede/single.hpp +++ b/gecode/int/precede/single.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Int { namespace Precede { +namespace Gecode::Int::Precede { /// Whether \a x is assigned to value \a v template @@ -221,6 +221,6 @@ namespace Gecode { namespace Int { namespace Precede { return (c.empty()) ? home.ES_SUBSUMED(*this) : ES_FIX; } -}}} // namespace Gecode::Int::Precede +} // namespace Gecode::Int::Precede // STATISTICS: int-prop diff --git a/gecode/int/propagator.hpp b/gecode/int/propagator.hpp index 5e984620d0..bdaf3a4b01 100644 --- a/gecode/int/propagator.hpp +++ b/gecode/int/propagator.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { /** * \defgroup TaskPropRePat Reified propagator patterns @@ -59,9 +59,9 @@ namespace Gecode { namespace Int { /// Constructor for cloning \a p ReUnaryPropagator(Space& home, ReUnaryPropagator& p); /// Constructor for rewriting \a p during cloning - ReUnaryPropagator(Space& home, Propagator& p, View x0, CtrlView b); + ReUnaryPropagator(Space& home, Propagator& p, View y0, CtrlView b); /// Constructor for creation - ReUnaryPropagator(Home home, View x0, CtrlView b); + ReUnaryPropagator(Home home, View y0, CtrlView b); public: /// Cost function (defined as low unary) @@ -92,9 +92,9 @@ namespace Gecode { namespace Int { /// Constructor for cloning \a p ReBinaryPropagator(Space& home, ReBinaryPropagator& p); /// Constructor for rewriting \a p during cloning - ReBinaryPropagator(Space& home, Propagator& p, View x0, View x1, CtrlView b); + ReBinaryPropagator(Space& home, Propagator& p, View y0, View y1, CtrlView b); /// Constructor for creation - ReBinaryPropagator(Home home, View x0, View x1, CtrlView b); + ReBinaryPropagator(Home home, View y0, View y1, CtrlView b); public: /// Cost function (defined as low binary) @@ -129,9 +129,9 @@ namespace Gecode { namespace Int { /// Constructor for cloning \a p ReMixBinaryPropagator(Space& home, ReMixBinaryPropagator& p); /// Constructor for creation - ReMixBinaryPropagator(Home home, View0 x0, View1 x1, CtrlView b); + ReMixBinaryPropagator(Home home, View0 y0, View1 y1, CtrlView b); /// Constructor for rewriting \a p during cloning - ReMixBinaryPropagator(Space& home, Propagator& p, View0 x0, View1 x1, CtrlView b); + ReMixBinaryPropagator(Space& home, Propagator& p, View0 y0, View1 y1, CtrlView b); public: /// Cost function (defined as low binary) @@ -318,6 +318,6 @@ namespace Gecode { namespace Int { return sizeof(*this); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-prop diff --git a/gecode/int/reify.hpp b/gecode/int/reify.hpp index 97fa7a10da..62d14a3527 100644 --- a/gecode/int/reify.hpp +++ b/gecode/int/reify.hpp @@ -38,13 +38,13 @@ namespace Gecode { */ forceinline - Reify::Reify(void) + Reify::Reify() : rm(RM_EQV) {} forceinline Reify::Reify(BoolVar x0, ReifyMode rm0) : x(x0), rm(rm0) {} forceinline BoolVar - Reify::var(void) const { + Reify::var() const { return x; } forceinline void @@ -52,7 +52,7 @@ namespace Gecode { x = x0; } forceinline ReifyMode - Reify::mode(void) const { + Reify::mode() const { return rm; } forceinline void diff --git a/gecode/int/rel.cpp b/gecode/int/rel.cpp index 29062595b1..c63b3db8d8 100644 --- a/gecode/int/rel.cpp +++ b/gecode/int/rel.cpp @@ -74,38 +74,32 @@ namespace Gecode { GECODE_POST; switch (irt) { case IRT_EQ: - for (int i = 0; i < x.size(); i++) { - IntView xi(x[i]); + for (IntView xi : x) { GECODE_ME_FAIL(xi.eq(home, n)); } break; case IRT_NQ: - for (int i = 0; i < x.size(); i++) { - IntView xi(x[i]); + for (IntView xi : x) { GECODE_ME_FAIL(xi.nq(home, n)); } break; case IRT_LQ: - for (int i = 0; i < x.size(); i++) { - IntView xi(x[i]); + for (IntView xi : x) { GECODE_ME_FAIL(xi.lq(home, n)); } break; case IRT_LT: - for (int i = 0; i < x.size(); i++) { - IntView xi(x[i]); + for (IntView xi : x) { GECODE_ME_FAIL(xi.le(home, n)); } break; case IRT_GQ: - for (int i = 0; i < x.size(); i++) { - IntView xi(x[i]); + for (IntView xi : x) { GECODE_ME_FAIL(xi.gq(home, n)); } break; case IRT_GR: - for (int i = 0; i < x.size(); i++) { - IntView xi(x[i]); + for (IntView xi : x) { GECODE_ME_FAIL(xi.gr(home, n)); } break; @@ -161,28 +155,28 @@ namespace Gecode { } } break; case IRT_NQ: - for (int i = 0; i < x.size(); i++) { - GECODE_ES_FAIL((Rel::Nq::post(home, x[i], y))); + for (auto xi : x) { + GECODE_ES_FAIL((Rel::Nq::post(home, xi, y))); } break; case IRT_GQ: - for (int i = 0; i < x.size(); i++) { - GECODE_ES_FAIL((Rel::Lq::post(home, y, x[i]))); + for (auto xi : x) { + GECODE_ES_FAIL((Rel::Lq::post(home, y, xi))); } break; case IRT_LQ: - for (int i = 0; i < x.size(); i++) { - GECODE_ES_FAIL((Rel::Lq::post(home, x[i], y))); + for (auto xi : x) { + GECODE_ES_FAIL((Rel::Lq::post(home, xi, y))); } break; case IRT_GR: - for (int i = 0; i < x.size(); i++) { - GECODE_ES_FAIL((Rel::Le::post(home, y, x[i]))); + for (auto xi : x) { + GECODE_ES_FAIL((Rel::Le::post(home, y, xi))); } break; case IRT_LT: - for (int i = 0; i < x.size(); i++) { - GECODE_ES_FAIL((Rel::Le::post(home, x[i], y))); + for (auto xi : x) { + GECODE_ES_FAIL((Rel::Le::post(home, xi, y))); } break; default: @@ -476,14 +470,15 @@ namespace Gecode { case IRT_EQ: if (x.size() != y.size()) { home.fail(); - } else if ((vbd(ipl) == IPL_DOM) || (vbd(ipl) == IPL_DEF)) + } else if ((vbd(ipl) == IPL_DOM) || (vbd(ipl) == IPL_DEF)) { for (int i = 0; i < x.size(); i++) { GECODE_ES_FAIL((Rel::EqDom::post(home, x[i], y[i]))); } - else + } else { for (int i = 0; i < x.size(); i++) { GECODE_ES_FAIL((Rel::EqBnd::post(home, x[i], y[i]))); } + } break; case IRT_NQ: { ViewArray xv(home, x), yv(home, y); diff --git a/gecode/int/rel.hh b/gecode/int/rel.hh index 0cb46eade3..05ce3ca070 100644 --- a/gecode/int/rel.hh +++ b/gecode/int/rel.hh @@ -46,7 +46,7 @@ * \brief Simple relation propagators */ -namespace Gecode { namespace Int { namespace Rel { +namespace Gecode::Int::Rel { /* * Equality propagators @@ -258,7 +258,7 @@ namespace Gecode { namespace Int { namespace Rel { /// \name Linkage access //@{ /// Return next position - Pos* next(void) const; + Pos* next() const; //@} /// \name Memory management @@ -277,7 +277,7 @@ namespace Gecode { namespace Int { namespace Rel { /// Stack of positions Pos* pos; /// Whether no more positions must be propagated - bool empty(void) const; + bool empty() const; /// Pop a position to be propagated and return it int pop(Space& home); /// Push a new position \a p to be propagated @@ -693,7 +693,7 @@ namespace Gecode { namespace Int { namespace Rel { size_t dispose(Space& home) override; }; -}}} // namespace Gecode::Int::Rel +} // namespace Gecode::Int::Rel #include #include diff --git a/gecode/int/rel/eq.hpp b/gecode/int/rel/eq.hpp index 74605bc6b3..35a88ebbb3 100644 --- a/gecode/int/rel/eq.hpp +++ b/gecode/int/rel/eq.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace Rel { +namespace Gecode::Int::Rel { /* * Binary value propagation equality @@ -203,10 +203,9 @@ namespace Gecode { namespace Int { namespace Rel { EqDom::cost(const Space&, const ModEventDelta& med) const { if ((View0::me(med) == ME_INT_VAL) || (View1::me(med) == ME_INT_VAL)) return PropCost::unary(PropCost::LO); - else if ((View0::me(med) == ME_INT_DOM) || (View1::me(med) == ME_INT_DOM)) + if ((View0::me(med) == ME_INT_DOM) || (View1::me(med) == ME_INT_DOM)) return PropCost::binary(PropCost::LO); - else - return PropCost::binary(PropCost::HI); + return PropCost::binary(PropCost::HI); } template @@ -260,7 +259,8 @@ namespace Gecode { namespace Int { namespace Rel { x.unique(); if (x.size() == 2) { return EqDom::post(home, x[0], x[1]); - } else if (x.size() > 2) { + } + if (x.size() > 2) { int l = x[0].min(); int u = x[0].max(); for (int i = 1; i < x.size(); i++) { @@ -292,8 +292,7 @@ namespace Gecode { namespace Int { namespace Rel { NaryEqDom::cost(const Space&, const ModEventDelta& med) const { if (View::me(med) == ME_INT_VAL) return PropCost::unary(PropCost::LO); - else - return PropCost::linear((View::me(med) == ME_INT_DOM) ? PropCost::LO : PropCost::HI, x.size()); + return PropCost::linear((View::me(med) == ME_INT_DOM) ? PropCost::LO : PropCost::HI, x.size()); } template @@ -389,7 +388,8 @@ namespace Gecode { namespace Int { namespace Rel { x.unique(); if (x.size() == 2) { return EqBnd::post(home, x[0], x[1]); - } else if (x.size() > 2) { + } + if (x.size() > 2) { int l = x[0].min(); int u = x[0].max(); for (int i = 1; i < x.size(); i++) { @@ -421,8 +421,7 @@ namespace Gecode { namespace Int { namespace Rel { NaryEqBnd::cost(const Space&, const ModEventDelta& med) const { if (View::me(med) == ME_INT_VAL) return PropCost::unary(PropCost::LO); - else - return PropCost::linear(PropCost::LO, x.size()); + return PropCost::linear(PropCost::LO, x.size()); } template @@ -753,6 +752,6 @@ namespace Gecode { namespace Int { namespace Rel { return home.ES_SUBSUMED(*this); } -}}} // namespace Gecode::Int::Rel +} // namespace Gecode::Int::Rel // STATISTICS: int-prop diff --git a/gecode/int/rel/lex.hpp b/gecode/int/rel/lex.hpp index bf719f7465..a84603fb8e 100644 --- a/gecode/int/rel/lex.hpp +++ b/gecode/int/rel/lex.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace Rel { +namespace Gecode::Int::Rel { /* * Lexical order propagator @@ -167,8 +167,7 @@ namespace Gecode { namespace Int { namespace Rel { if (i == n) { // case: $ if (strict) return ES_FIX; - else - goto rewrite_lq; + goto rewrite_lq; } if (x[i].max() < y[i].min()) // case: < @@ -249,8 +248,7 @@ namespace Gecode { namespace Int { namespace Rel { if (x.size() == 1) { if (strict) return Le::post(home, x[0], y[0]); - else - return Lq::post(home, x[0], y[0]); + return Lq::post(home, x[0], y[0]); } (void)new (home) LexLqLe(home, x, y, strict); return ES_OK; @@ -437,6 +435,6 @@ namespace Gecode { namespace Int { namespace Rel { return ES_FIX; } -}}} // namespace Gecode::Int::Rel +} // namespace Gecode::Int::Rel // STATISTICS: int-prop diff --git a/gecode/int/rel/lq-le.hpp b/gecode/int/rel/lq-le.hpp index fc80a0fca7..1a3ea03d82 100644 --- a/gecode/int/rel/lq-le.hpp +++ b/gecode/int/rel/lq-le.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Int { namespace Rel { +namespace Gecode::Int::Rel { /* * Less or equal propagator @@ -134,8 +134,8 @@ namespace Gecode { namespace Int { namespace Rel { : FreeList(n), p(p0) {} template - forceinline typename NaryLqLe::Pos* - NaryLqLe::Pos::next(void) const { + forceinline NaryLqLe::Pos* + NaryLqLe::Pos::next() const { return static_cast(FreeList::next()); } @@ -163,7 +163,7 @@ namespace Gecode { namespace Int { namespace Rel { template forceinline bool - NaryLqLe::empty(void) const { + NaryLqLe::empty() const { return pos == nullptr; } template @@ -257,9 +257,9 @@ namespace Gecode { namespace Int { namespace Rel { if (x.size() == 2) { if (o == 0) return Lq::post(home, x[0], x[1]); - else - return Le::post(home, x[0], x[1]); - } else if (x.size() >= 2) { + return Le::post(home, x[0], x[1]); + } + if (x.size() >= 2) { (void)new (home) NaryLqLe(home, x); } return ES_OK; @@ -552,6 +552,6 @@ namespace Gecode { namespace Int { namespace Rel { return home.ES_SUBSUMED(*this); } -}}} // namespace Gecode::Int::Rel +} // namespace Gecode::Int::Rel // STATISTICS: int-prop diff --git a/gecode/int/rel/nq.hpp b/gecode/int/rel/nq.hpp index 7660408ba5..6236637b38 100644 --- a/gecode/int/rel/nq.hpp +++ b/gecode/int/rel/nq.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Int { namespace Rel { +namespace Gecode::Int::Rel { /* * Disequality @@ -183,6 +183,6 @@ namespace Gecode { namespace Int { namespace Rel { return ES_FIX; } -}}} // namespace Gecode::Int::Rel +} // namespace Gecode::Int::Rel // STATISTICS: int-prop diff --git a/gecode/int/rel/open.hpp b/gecode/int/rel/open.hpp index 34ebf60f91..a9f1989426 100644 --- a/gecode/int/rel/open.hpp +++ b/gecode/int/rel/open.hpp @@ -36,7 +36,7 @@ #include #include -namespace Gecode { namespace Int { namespace Rel { +namespace Gecode::Int::Rel { /// Propagate a relation over an open chain in one actor template @@ -252,7 +252,7 @@ namespace Gecode { namespace Int { namespace Rel { } }; -}}} // namespace Gecode::Int::Rel +} // namespace Gecode::Int::Rel #endif diff --git a/gecode/int/relax.cpp b/gecode/int/relax.cpp index 5f8fc05782..d9e47a92cb 100644 --- a/gecode/int/relax.cpp +++ b/gecode/int/relax.cpp @@ -33,7 +33,7 @@ #include #include -namespace Gecode { namespace Int { +namespace Gecode::Int { /// Class for posting equalities for non-relaxed variables class Relax { @@ -56,7 +56,7 @@ namespace Gecode { namespace Int { return me_failed(xv.eq(home, sx.val())) ? ES_FAILED : ES_OK; } -}} // namespace Gecode::Int +} // namespace Gecode::Int namespace Gecode { diff --git a/gecode/int/sequence.cpp b/gecode/int/sequence.cpp index 6d9c134a8f..000dfd319c 100644 --- a/gecode/int/sequence.cpp +++ b/gecode/int/sequence.cpp @@ -78,8 +78,8 @@ namespace Gecode { // All variables must take a value in s if (l == q) { - for (int i = 0; i < x.size(); i++) { - IntView xv(x[i]); + for (auto xi : x) { + IntView xv(xi); IntSetRanges ris(s); GECODE_ME_FAIL(xv.inter_r(home, ris, false)); } @@ -88,8 +88,8 @@ namespace Gecode { // No variable can take a value in s if (0 == u) { - for (int i = 0; i < x.size(); i++) { - IntView xv(x[i]); + for (auto xi : x) { + IntView xv(xi); IntSetRanges ris(s); GECODE_ME_FAIL(xv.minus_r(home, ris, false)); } @@ -149,14 +149,14 @@ namespace Gecode { // All variables must take a value in s if (l == q) { if (s.min() == 0) { - for (int i = 0; i < x.size(); i++) { - BoolView xv(x[i]); + for (auto xi : x) { + BoolView xv(xi); GECODE_ME_FAIL(xv.zero(home)); } } else { assert(s.min() == 1); - for (int i = 0; i < x.size(); i++) { - BoolView xv(x[i]); + for (auto xi : x) { + BoolView xv(xi); GECODE_ME_FAIL(xv.one(home)); } } @@ -166,14 +166,14 @@ namespace Gecode { // No variable can take a value in s if (0 == u) { if (s.min() == 0) { - for (int i = 0; i < x.size(); i++) { - BoolView xv(x[i]); + for (auto xi : x) { + BoolView xv(xi); GECODE_ME_FAIL(xv.one(home)); } } else { assert(s.min() == 1); - for (int i = 0; i < x.size(); i++) { - BoolView xv(x[i]); + for (auto xi : x) { + BoolView xv(xi); GECODE_ME_FAIL(xv.zero(home)); } } diff --git a/gecode/int/sequence.hh b/gecode/int/sequence.hh index e0636dfff6..5a1203c648 100644 --- a/gecode/int/sequence.hh +++ b/gecode/int/sequence.hh @@ -36,7 +36,7 @@ #include #include -namespace Gecode { namespace Int { namespace Sequence { +namespace Gecode::Int::Sequence { /** * \namespace Gecode::Int::Sequence @@ -70,7 +70,7 @@ namespace Gecode { namespace Int { namespace Sequence { public: /// Default constructor - ViewValSupportArray(void); + ViewValSupportArray(); /// Copy constructor ViewValSupportArray(const ViewValSupportArray&); /// Construct an ViewValSupportArray from \a x @@ -78,13 +78,13 @@ namespace Gecode { namespace Int { namespace Sequence { /// Construct an ViewValSupportArray of size \a n ViewValSupportArray(Space& home, int n); /// Return the current size - int size(void) const; - /// Access element \a n - ViewValSupport& operator[](int n); + int size() const; + /// Access element \a i + ViewValSupport& operator[](int i); /// Access element \a n const ViewValSupport& operator[](int) const; /// Cloning - void update(Space& home, ViewValSupportArray& x); + void update(Space& home, ViewValSupportArray& a); /// Propagate ExecStatus propagate(Space& home, ViewArray& a, const Val& s, int q, int l, int u); /// Advise @@ -144,7 +144,7 @@ namespace Gecode { namespace Int { namespace Sequence { bool tofail; }; -}}} // namespace Gecode::Int::Sequence +} // namespace Gecode::Int::Sequence #include #include diff --git a/gecode/int/sequence/int.hpp b/gecode/int/sequence/int.hpp index 0cc10d42b7..aedbb03264 100644 --- a/gecode/int/sequence/int.hpp +++ b/gecode/int/sequence/int.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Int { namespace Sequence { +namespace Gecode::Int::Sequence { template forceinline @@ -77,9 +77,8 @@ namespace Gecode { namespace Int { namespace Sequence { if (ES_NOFIX == status) { return home.ES_NOFIX_DISPOSE(ac, a); - } else { - return home.ES_FIX_DISPOSE(ac, a); } + return home.ES_FIX_DISPOSE(ac, a); } if ((status == ES_FAILED) && disabled()) { @@ -174,6 +173,6 @@ namespace Gecode { namespace Int { namespace Sequence { return home.ES_SUBSUMED(*this); } -}}} // namespace Gecode::Int::Sequence +} // namespace Gecode::Int::Sequence // STATISTICS: int-prop diff --git a/gecode/int/sequence/open.hpp b/gecode/int/sequence/open.hpp index 9955502c52..22df75c0b4 100644 --- a/gecode/int/sequence/open.hpp +++ b/gecode/int/sequence/open.hpp @@ -40,7 +40,7 @@ #include -namespace Gecode { namespace Int { namespace Sequence { +namespace Gecode::Int::Sequence { /// Identify the windows affected by a position's domain change class OpenWindowAdvisor : public Advisor { @@ -487,7 +487,7 @@ namespace Gecode { namespace Int { namespace Sequence { } }; -}}} // namespace Gecode::Int::Sequence +} // namespace Gecode::Int::Sequence #endif diff --git a/gecode/int/sequence/set-op.hpp b/gecode/int/sequence/set-op.hpp index dffbb090c6..12adb03442 100644 --- a/gecode/int/sequence/set-op.hpp +++ b/gecode/int/sequence/set-op.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace Sequence { +namespace Gecode::Int::Sequence { /// Status of whether a view takes a value from a set enum class TakesStatus { @@ -46,8 +46,7 @@ namespace Gecode { namespace Int { namespace Sequence { takes(const View& x, int s) { if (x.in(s)) return x.assigned() ? TS_YES : TS_MAYBE; - else - return TS_NO; + return TS_NO; } /// Return whether view \a x takes value from \a s template @@ -149,6 +148,6 @@ namespace Gecode { namespace Int { namespace Sequence { return x.minus_r(home, is, false); } -}}} // namespace Gecode::Int::Sequence +} // namespace Gecode::Int::Sequence // STATISTICS: int-prop diff --git a/gecode/int/sequence/view.hpp b/gecode/int/sequence/view.hpp index d8f5cdeda9..6aa29dcf26 100644 --- a/gecode/int/sequence/view.hpp +++ b/gecode/int/sequence/view.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Int { namespace Sequence { +namespace Gecode::Int::Sequence { /** * \brief Class for advising the propagator @@ -75,7 +75,7 @@ namespace Gecode { namespace Int { namespace Sequence { class ViewValSupport { public: /// Initialize - void init(Space& home, ViewArray& x, const Val& s, int i, int q); + void init(Space& home, ViewArray& a, const Val& s, int i, int q); /// Update void update(Space& home, ViewValSupport& vvs, int n0); /// Advise @@ -85,7 +85,7 @@ namespace Gecode { namespace Int { namespace Sequence { /// Return true if sequence j has been violated bool violated(int j, int q, int l, int u) const; /// Check if retired - bool retired(void) const; + bool retired() const; /// Allocate an instance static ViewValSupport* allocate(Space&, int); @@ -93,9 +93,9 @@ namespace Gecode { namespace Int { namespace Sequence { /// Schedules the invoking support to be concluded (to be shaved) ExecStatus schedule_conclusion(ViewArray& a, const Val& s, int i); /// Returns true if a conclusion to be made has been scheduled - bool conlusion_scheduled(void) const; + bool conlusion_scheduled() const; /// Retires invoking instance - void retire(void); + void retire(); /// Return number of forced to s elements in sequence j int values(int j, int q) const; /// Checks if x[i] has been shaved @@ -109,11 +109,11 @@ namespace Gecode { namespace Int { namespace Sequence { /// Returns true if a[idx] can be not s taking into account a[i]=s if iss or a[i]!=s if ! iss bool alternative_not_possible(ViewArray& a, const Val& s, int i, int idx) const; /// Returns true if there are potential violations marked - bool has_potential_violation(void) const; + bool has_potential_violation() const; /// Returns next potential violation and removes it - int next_potential_violation(void); + int next_potential_violation(); /// Adds potential violation i - void potential_violation(int i); + void potential_violation(int k); // Sets element idx of cumulative array to v void set(int idx, int v, int q, int n); /// Adds potential violations for location idx in cumulative array @@ -132,13 +132,13 @@ namespace Gecode { namespace Int { namespace Sequence { template forceinline bool - ViewValSupport::has_potential_violation(void) const { + ViewValSupport::has_potential_violation() const { return !v.empty(); } template forceinline int - ViewValSupport::next_potential_violation(void) { + ViewValSupport::next_potential_violation() { return static_cast(v.get()); } @@ -150,13 +150,13 @@ namespace Gecode { namespace Int { namespace Sequence { template forceinline bool - ViewValSupport::retired(void) const { + ViewValSupport::retired() const { return nullptr == y; } template forceinline void - ViewValSupport::retire(void) { + ViewValSupport::retire() { y = nullptr; } @@ -214,8 +214,7 @@ namespace Gecode { namespace Int { namespace Sequence { ViewValSupport::shaved(const View& x, const Val& s, int) const { if (iss) return excludes(x, s); - else - return includes(x, s); + return includes(x, s); } template @@ -233,7 +232,7 @@ namespace Gecode { namespace Int { namespace Sequence { template forceinline bool - ViewValSupport::conlusion_scheduled(void) const { + ViewValSupport::conlusion_scheduled() const { return !retired() && y[0] > 0; } @@ -300,7 +299,7 @@ namespace Gecode { namespace Int { namespace Sequence { // repair y on the left while (idx > 0 && - ((y[idx] - y[idx - 1] > 1) || ((y[idx] - y[idx - 1] == 1 && s_not_possible(a, s, i, idx))))) { + ((y[idx] - y[idx - 1] > 1) || (y[idx] - y[idx - 1] == 1 && s_not_possible(a, s, i, idx)))) { if (s_not_possible(a, s, i, idx)) { set(idx - 1, y[idx], q, n); } else { @@ -396,7 +395,7 @@ namespace Gecode { namespace Int { namespace Sequence { } template - ViewValSupportArray::ViewValSupportArray(void) : xs(nullptr), n(0) {} + ViewValSupportArray::ViewValSupportArray() : xs(nullptr), n(0) {} template ViewValSupportArray::ViewValSupportArray(const ViewValSupportArray& a) { @@ -426,7 +425,7 @@ namespace Gecode { namespace Int { namespace Sequence { template forceinline int - ViewValSupportArray::size(void) const { + ViewValSupportArray::size() const { return n; } @@ -476,6 +475,6 @@ namespace Gecode { namespace Int { namespace Sequence { } return status; } -}}} // namespace Gecode::Int::Sequence +} // namespace Gecode::Int::Sequence // STATISTICS: int-prop diff --git a/gecode/int/sequence/violations.hpp b/gecode/int/sequence/violations.hpp index bac421d8a8..1f43e9b98e 100644 --- a/gecode/int/sequence/violations.hpp +++ b/gecode/int/sequence/violations.hpp @@ -30,10 +30,11 @@ * */ +#include #include #include -namespace Gecode { namespace Int { namespace Sequence { +namespace Gecode::Int::Sequence { /// Simple bitsets for recording violations class Violations : public Support::BitSetBase { @@ -43,21 +44,21 @@ namespace Gecode { namespace Int { namespace Sequence { public: /// Default constructor - Violations(void); + Violations(); /// Initialize violation set for \a n violations void init(Space& home, unsigned int n); /// Update violation set during cloning void update(Space& home, Violations& v); /// Return whether set is empty - bool empty(void) const; + bool empty() const; /// Add \a i to violation set void add(unsigned int i); /// Get first element from violation set and remove it - unsigned int get(void); + unsigned int get(); }; forceinline - Violations::Violations(void) + Violations::Violations() : fst(0) {} forceinline void @@ -67,7 +68,7 @@ namespace Gecode { namespace Int { namespace Sequence { } forceinline bool - Violations::empty(void) const { + Violations::empty() const { fst = next(fst); return fst >= size(); } @@ -81,12 +82,11 @@ namespace Gecode { namespace Int { namespace Sequence { forceinline void Violations::add(unsigned int i) { set(i); - if (i < fst) - fst = i; + fst = std::min(i, fst); } forceinline unsigned int - Violations::get(void) { + Violations::get() { assert(!empty()); fst = next(fst); assert(Support::BitSetBase::get(fst)); @@ -95,6 +95,6 @@ namespace Gecode { namespace Int { namespace Sequence { return fst - 1; } -}}} // namespace Gecode::Int::Sequence +} // namespace Gecode::Int::Sequence // STATISTICS: int-prop diff --git a/gecode/int/sorted.hh b/gecode/int/sorted.hh index 23efc15393..5113861991 100644 --- a/gecode/int/sorted.hh +++ b/gecode/int/sorted.hh @@ -41,7 +41,7 @@ * \brief %Sorted propagators */ -namespace Gecode { namespace Int { namespace Sorted { +namespace Gecode::Int::Sorted { /** * \brief Bounds consistent sortedness propagator @@ -87,7 +87,7 @@ namespace Gecode { namespace Int { namespace Sorted { static ExecStatus post(Home home, ViewArray& x, ViewArray& y, ViewArray& z); }; -}}} // namespace Gecode::Int::Sorted +} // namespace Gecode::Int::Sorted #include #include diff --git a/gecode/int/sorted/matching.hpp b/gecode/int/sorted/matching.hpp index 744e058687..456d6d357d 100644 --- a/gecode/int/sorted/matching.hpp +++ b/gecode/int/sorted/matching.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace Sorted { +namespace Gecode::Int::Sorted { /** * \brief Glover's maximum matching in a bipartite graph @@ -51,7 +51,8 @@ namespace Gecode { namespace Int { namespace Sorted { template inline bool - glover(ViewArray& x, ViewArray& y, int tau[], int phi[], OfflineMinItem sequence[], int vertices[]) { + glover(ViewArray& x, ViewArray& y, const int tau[], int phi[], OfflineMinItem sequence[], + int vertices[]) { int xs = x.size(); OfflineMin seq(sequence, vertices, xs); @@ -160,6 +161,6 @@ namespace Gecode { namespace Int { namespace Sorted { return true; } -}}} // namespace Gecode::Int::Sorted +} // namespace Gecode::Int::Sorted // STATISTICS: int-prop diff --git a/gecode/int/sorted/narrowing.hpp b/gecode/int/sorted/narrowing.hpp index d3528e985e..4c1e201799 100644 --- a/gecode/int/sorted/narrowing.hpp +++ b/gecode/int/sorted/narrowing.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace Sorted { +namespace Gecode::Int::Sorted { /** * \brief Compute the sccs of the oriented intersection-graph @@ -50,7 +50,7 @@ namespace Gecode { namespace Int { namespace Sorted { template inline void - compute_sccs(ViewArray& x, ViewArray& y, int phi[], SccComponent sinfo[], int scclist[]) { + compute_sccs(ViewArray& x, ViewArray& y, const int phi[], SccComponent sinfo[], int scclist[]) { // number of sccs is bounded by xs (number of x-nodes) int xs = x.size(); @@ -124,8 +124,8 @@ namespace Gecode { namespace Int { namespace Sorted { template inline bool - narrow_domx(Space& home, ViewArray& x, ViewArray& y, ViewArray& z, int tau[], int[], - int scclist[], SccComponent sinfo[], bool& nofix) { + narrow_domx(Space& home, ViewArray& x, ViewArray& y, ViewArray& z, const int tau[], int[], + const int scclist[], SccComponent sinfo[], bool& nofix) { int xs = x.size(); @@ -213,7 +213,8 @@ namespace Gecode { namespace Int { namespace Sorted { template inline bool - narrow_domy(Space& home, ViewArray& x, ViewArray& y, int phi[], int phiprime[], bool& nofix) { + narrow_domy(Space& home, ViewArray& x, ViewArray& y, const int phi[], const int phiprime[], + bool& nofix) { for (int i = x.size(); i--;) { ModEvent me_lb = y[i].gq(home, x[phiprime[i]].min()); if (me_failed(me_lb)) { @@ -230,6 +231,6 @@ namespace Gecode { namespace Int { namespace Sorted { return true; } -}}} // namespace Gecode::Int::Sorted +} // namespace Gecode::Int::Sorted // STATISTICS: int-prop diff --git a/gecode/int/sorted/order.hpp b/gecode/int/sorted/order.hpp index dca34142df..12eb3b8099 100644 --- a/gecode/int/sorted/order.hpp +++ b/gecode/int/sorted/order.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace Sorted { +namespace Gecode::Int::Sorted { /** * \brief Build \f$\sigma\f$ @@ -71,6 +71,7 @@ namespace Gecode { namespace Int { namespace Sorted { template inline void + // NOLINTNEXTLINE(readability-non-const-parameter): quicksort sorts tau in place sort_tau(ViewArray& x, ViewArray& z, int tau[]) { if (Perm) { TupleMaxIncExt ltmax(x, z); @@ -134,8 +135,8 @@ namespace Gecode { namespace Int { namespace Sorted { template inline bool - perm_bc(Space& home, int tau[], SccComponent sinfo[], int scclist[], ViewArray& x, ViewArray& z, - bool& crossingedge, bool& nofix) { + perm_bc(Space& home, const int tau[], SccComponent sinfo[], const int scclist[], ViewArray& x, + ViewArray& z, bool& crossingedge, bool& nofix) { int ps = x.size(); @@ -193,6 +194,6 @@ namespace Gecode { namespace Int { namespace Sorted { return true; } -}}} // namespace Gecode::Int::Sorted +} // namespace Gecode::Int::Sorted // STATISTICS: int-prop diff --git a/gecode/int/sorted/propagate.hpp b/gecode/int/sorted/propagate.hpp index e4f2afd006..55716280db 100644 --- a/gecode/int/sorted/propagate.hpp +++ b/gecode/int/sorted/propagate.hpp @@ -33,7 +33,7 @@ #include #include -namespace Gecode { namespace Int { namespace Sorted { +namespace Gecode::Int::Sorted { /* * Summary of the propagation algorithm as implemented in the @@ -111,7 +111,8 @@ namespace Gecode { namespace Int { namespace Sorted { if (y[j].min() > max) { allbnd[i].max = j - 1; break; - } else if (y[j].min() <= max && min <= y[j].max()) { + } + if (y[j].min() <= max && min <= y[j].max()) { allbnd[i].max = j; break; } @@ -625,6 +626,6 @@ namespace Gecode { namespace Int { namespace Sorted { return ES_OK; } -}}} // namespace Gecode::Int::Sorted +} // namespace Gecode::Int::Sorted // STATISTICS: int-prop diff --git a/gecode/int/sorted/sortsup.hpp b/gecode/int/sorted/sortsup.hpp index 881a429ea6..d6ab19efef 100644 --- a/gecode/int/sorted/sortsup.hpp +++ b/gecode/int/sorted/sortsup.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace Sorted { +namespace Gecode::Int::Sorted { /** * \brief Storage class for mininmum and maximum of a variable. @@ -85,10 +85,9 @@ namespace Gecode { namespace Int { namespace Sorted { if (subsumed) { if (x[i].val() != y[z[i].val()].val()) { return false; - } else { - if (z[i].val() == i) { - dropfst++; - } + } + if (z[i].val() == i) { + dropfst++; } } } else { @@ -96,9 +95,8 @@ namespace Gecode { namespace Int { namespace Sorted { if (subsumed) { if (x[i].val() != y[i].val()) { return false; - } else { - dropfst++; } + dropfst++; } } } @@ -149,7 +147,7 @@ namespace Gecode { namespace Int { namespace Sorted { int n; public: - OfflineMin(void); + OfflineMin(); OfflineMin(OfflineMinItem[], int[], int); /** * Find the set x belongs to @@ -164,18 +162,20 @@ namespace Gecode { namespace Int { namespace Sorted { /// Unite two sets \a a and \a b and label the union with \a c void unite(int a, int b, int c); /// Initialization of the datastructure - void initialize_sets(void); + void initialize_sets(); /// Return the size of the Offline-Min item - int size(void); + int size(); OfflineMinItem& operator[](int); }; - OfflineMin::OfflineMin(void) { + forceinline + OfflineMin::OfflineMin() { n = 0; sequence = nullptr; vertices = nullptr; } + forceinline OfflineMin::OfflineMin(OfflineMinItem s[], int v[], int size) { n = size; sequence = &s[0]; @@ -226,7 +226,7 @@ namespace Gecode { namespace Int { namespace Sorted { } forceinline void - OfflineMin::initialize_sets(void) { + OfflineMin::initialize_sets() { for (int i = n; i--;) { OfflineMinItem& cur = sequence[i]; cur.rank = 0; // initially each set is empty @@ -241,7 +241,7 @@ namespace Gecode { namespace Int { namespace Sorted { } forceinline int - OfflineMin::size(void) { + OfflineMin::size() { return n; } @@ -270,9 +270,8 @@ namespace Gecode { namespace Int { namespace Sorted { operator()(const int i, const int j) { if (x[i].max() == x[j].max()) { return x[i].min() < x[j].min(); - } else { - return x[i].max() < x[j].max(); } + return x[i].max() < x[j].max(); } }; @@ -299,15 +298,12 @@ namespace Gecode { namespace Int { namespace Sorted { if (x[i].min() == x[j].min()) { if (z[i].max() == z[j].max()) { return z[i].min() < z[j].min(); - } else { - return z[i].max() < z[j].max(); } - } else { - return x[i].min() < x[j].min(); + return z[i].max() < z[j].max(); } - } else { - return x[i].max() < x[j].max(); + return x[i].min() < x[j].min(); } + return x[i].max() < x[j].max(); } }; @@ -327,9 +323,8 @@ namespace Gecode { namespace Int { namespace Sorted { operator()(const View& x, const View& y) { if (x.min() == y.min()) { return x.max() < y.max(); - } else { - return x.min() < y.min(); } + return x.min() < y.min(); } }; @@ -360,15 +355,12 @@ namespace Gecode { namespace Int { namespace Sorted { if (x.x.max() == y.x.max()) { if (x.z.min() == y.z.min()) { return x.z.max() < y.z.max(); - } else { - return x.z.min() < y.z.min(); } - } else { - return x.x.max() < y.x.max(); + return x.z.min() < y.z.min(); } - } else { - return x.x.min() < y.x.min(); + return x.x.max() < y.x.max(); } + return x.x.min() < y.x.min(); } }; @@ -403,11 +395,7 @@ namespace Gecode { namespace Int { namespace Sorted { return false; } } - if (Perm) { - subsumed = false; - } else { - subsumed = true; - } + subsumed = !Perm; } if (y_complete) { @@ -422,11 +410,7 @@ namespace Gecode { namespace Int { namespace Sorted { return false; } } - if (Perm) { - subsumed = false; - } else { - subsumed = true; - } + subsumed = !Perm; noperm_bc = true; } } @@ -550,6 +534,6 @@ namespace Gecode { namespace Int { namespace Sorted { return true; } -}}} // namespace Gecode::Int::Sorted +} // namespace Gecode::Int::Sorted // STATISTICS: int-prop diff --git a/gecode/int/support-values.hh b/gecode/int/support-values.hh index 5670c6816c..d569c851ee 100644 --- a/gecode/int/support-values.hh +++ b/gecode/int/support-values.hh @@ -35,7 +35,7 @@ #include -namespace Gecode { namespace Int { +namespace Gecode::Int { /** * \brief %Support value iterator and recorder @@ -64,7 +64,7 @@ namespace Gecode { namespace Int { /// Access to other information SupportValues& sv; /// Find next unsupported value - void find(void); + void find(); public: /// \name Constructors and initialization @@ -76,15 +76,15 @@ namespace Gecode { namespace Int { /// \name Iteration control //@{ /// Test whether iterator is still at a value or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next value (if possible) - void operator++(void); + void operator++(); //@} /// \name Value access //@{ /// Return current value - int val(void) const; + int val() const; //@} }; @@ -110,28 +110,28 @@ namespace Gecode { namespace Int { /// Initialize for view \a x SupportValues(A& a, View x); /// Destructor - ~SupportValues(void); + ~SupportValues(); /// \name Iteration control //@{ /// Reset iterator - void reset(void); + void reset(); /// Test whether iterator is still at a value or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next value (if possible) - void operator++(void); + void operator++(); //@} /// \name Value access //@{ /// Return current value - int val(void) const; + int val() const; //@} /// \name Support control //@{ /// Mark current (iterator) value as supported - void support(void); + void support(); /// Mark \a n as supported if possible bool support(int n); /// Mark \a n as supported if possible @@ -141,7 +141,7 @@ namespace Gecode { namespace Int { //@} }; -}} // namespace Gecode::Int +} // namespace Gecode::Int #include diff --git a/gecode/int/support-values.hpp b/gecode/int/support-values.hpp index 5d5ee4ddac..50efefcef5 100644 --- a/gecode/int/support-values.hpp +++ b/gecode/int/support-values.hpp @@ -30,11 +30,11 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { template forceinline void - SupportValues::reset(void) { + SupportValues::reset() { rp = rp_fst; v = rp->min; max = rp->min + static_cast((rp + 1)->pos - rp->pos) - 1; @@ -60,14 +60,14 @@ namespace Gecode { namespace Int { } template - forceinline SupportValues::~SupportValues(void) { + forceinline SupportValues::~SupportValues() { bs.dispose(a); a.free(rp_fst, static_cast(rp_lst - rp_fst + 1)); } template forceinline void - SupportValues::operator++(void) { + SupportValues::operator++() { if (++v > max) if (++rp < rp_lst) { v = rp->min; @@ -77,19 +77,19 @@ namespace Gecode { namespace Int { template forceinline bool - SupportValues::operator()(void) const { + SupportValues::operator()() const { return rp < rp_lst; } template forceinline int - SupportValues::val(void) const { + SupportValues::val() const { return v; } template forceinline void - SupportValues::support(void) { + SupportValues::support() { bs.clear(rp->pos + static_cast(v - rp->min)); } @@ -136,7 +136,7 @@ namespace Gecode { namespace Int { template forceinline void - SupportValues::Unsupported::find(void) { + SupportValues::Unsupported::find() { // Skip all supported positions while ((p < sv.x.size()) && !sv.bs.get(p)) p = sv.bs.next(p); @@ -154,20 +154,20 @@ namespace Gecode { namespace Int { template forceinline void - SupportValues::Unsupported::operator++(void) { + SupportValues::Unsupported::operator++() { p++; find(); } template forceinline bool - SupportValues::Unsupported::operator()(void) const { + SupportValues::Unsupported::operator()() const { return rp < sv.rp_lst; } template forceinline int - SupportValues::Unsupported::val(void) const { + SupportValues::Unsupported::val() const { return static_cast(rp->min + (p - rp->pos)); } @@ -178,6 +178,6 @@ namespace Gecode { namespace Int { return x.minus_v(home, u, false); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-prop diff --git a/gecode/int/task.hh b/gecode/int/task.hh index 36a6ed12ea..5a77846f6e 100644 --- a/gecode/int/task.hh +++ b/gecode/int/task.hh @@ -35,7 +35,7 @@ #include -namespace Gecode { namespace Int { +namespace Gecode::Int { /// Class to define an optional from a mandatory task template @@ -48,22 +48,22 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - ManToOptTask(void) = default; + ManToOptTask() = default; //@} /// \name Value access //@{ /// Whether task is mandatory - bool mandatory(void) const; + bool mandatory() const; /// Whether task is excluded - bool excluded(void) const; + bool excluded() const; /// Whether task can still be optional - bool optional(void) const; + bool optional() const; //@} //@{ /// Test whether task is assigned - bool assigned(void) const; + bool assigned() const; //@} /// \name Value update @@ -91,11 +91,11 @@ namespace Gecode { namespace Int { //@} }; -}} // namespace Gecode::Int +} // namespace Gecode::Int #include -namespace Gecode { namespace Int { +namespace Gecode::Int { /// Task mapper: turns a task view into its dual template @@ -104,17 +104,17 @@ namespace Gecode { namespace Int { /// \name Value access //@{ /// Return earliest start time - int est(void) const; + int est() const; /// Return earliest completion time - int ect(void) const; + int ect() const; /// Return latest start time - int lst(void) const; + int lst() const; /// Return latest completion time - int lct(void) const; + int lct() const; /// Return minimum processing time - int pmin(void) const; + int pmin() const; /// Return maximum processing time - int pmax(void) const; + int pmax() const; //@} /// \name Value update @@ -132,11 +132,11 @@ namespace Gecode { namespace Int { //@} }; -}} // namespace Gecode::Int +} // namespace Gecode::Int #include -namespace Gecode { namespace Int { +namespace Gecode::Int { /** * \brief Traits class for mapping task views to tasks @@ -156,9 +156,9 @@ namespace Gecode { namespace Int { template class TaskTraits {}; -}} // namespace Gecode::Int +} // namespace Gecode::Int -namespace Gecode { namespace Int { +namespace Gecode::Int { /// Task array template @@ -173,19 +173,19 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor (array of size 0) - TaskArray(void); + TaskArray(); /// Allocate memory for \a n tasks (no initialization) TaskArray(Space& home, int n); /// Initialize from task array \a a (share elements) - TaskArray(const TaskArray& a); + TaskArray(const TaskArray& a) = default; /// Initialize from task array \a a (share elements) - const TaskArray& operator=(const TaskArray& a); + TaskArray& operator=(const TaskArray& a) = default; //@} /// \name Array size //@{ /// Return size of array (number of elements) - int size(void) const; + int size() const; /// Set size of array (number of elements) to \a n, must not be larger void size(int n); //@} @@ -214,7 +214,6 @@ namespace Gecode { namespace Int { void update(Space&, TaskArray& a); //@} - public: static void* operator new(size_t) = delete; static void operator delete(void*, size_t) = delete; }; @@ -231,7 +230,7 @@ namespace Gecode { namespace Int { class TaskViewArray { protected: /// The underlying task type - typedef typename TaskViewTraits::Task Task; + using Task = TaskViewTraits::Task; /// Access to task array TaskArray& t; @@ -245,7 +244,7 @@ namespace Gecode { namespace Int { /// \name Array information //@{ /// Return size of array (number of elements) - int size(void) const; + int size() const; /// Set size of array (number of elements) to \a n, must not be larger void size(int n); //@} @@ -257,7 +256,7 @@ namespace Gecode { namespace Int { /// Return task view at position \a i const TaskView& operator[](int i) const; //@} - public: + static void* operator new(size_t) = delete; static void operator delete(void*, size_t) = delete; }; @@ -270,11 +269,11 @@ namespace Gecode { namespace Int { std::basic_ostream& operator<<(std::basic_ostream& os, const TaskViewArray& t); -}} // namespace Gecode::Int +} // namespace Gecode::Int #include -namespace Gecode { namespace Int { +namespace Gecode::Int { /// How to sort tasks enum class SortTaskOrder { @@ -297,11 +296,11 @@ namespace Gecode { namespace Int { template void sort(int* map, int n, const TaskViewArray& t); -}} // namespace Gecode::Int +} // namespace Gecode::Int #include -namespace Gecode { namespace Int { +namespace Gecode::Int { /// Allows to iterate over task views according to a specified order template @@ -312,7 +311,7 @@ namespace Gecode { namespace Int { /// Current position int i; /// Default constructor (no initialization) - TaskViewIter(void) = default; + TaskViewIter() = default; public: /// Initialize iterator @@ -320,17 +319,17 @@ namespace Gecode { namespace Int { /// \name Iteration control //@{ /// Test whether iterator is still at a task - bool operator()(void) const; + bool operator()() const; /// How many tasks are left to be iterated - int left(void) const; + int left() const; /// Move iterator to next task - void operator++(void); + void operator++(); //@} /// \name %Task access //@{ /// Return current task position - int task(void) const; + int task() const; //@} }; @@ -346,11 +345,11 @@ namespace Gecode { namespace Int { ManTaskViewIter(Region& r, const TaskViewArray& t); }; -}} // namespace Gecode::Int +} // namespace Gecode::Int #include -namespace Gecode { namespace Int { +namespace Gecode::Int { /// Safe addition in case \a x is -Int::Limits::infinity int plus(int x, int y); @@ -376,9 +375,9 @@ namespace Gecode { namespace Int { int* _leaf; /// Return number of inner nodes - int n_inner(void) const; + int n_inner() const; /// Return number of nodes for balanced binary tree - int n_nodes(void) const; + int n_nodes() const; /// Whether node \a i is index of root static bool n_root(int i); /// Whether node \a i is leaf @@ -394,17 +393,16 @@ namespace Gecode { namespace Int { /// Return index of parent of node \a i static int n_parent(int i); - protected: /// Return leaf for task \a i Node& leaf(int i); /// Return root node - const Node& root(void) const; + const Node& root() const; /// Update tree after leaf for task \a i has changed (\a l whether i refers to a leaf) void update(int i, bool l = true); /// Initialize tree after leaves have been initialized - void init(void); + void init(); /// Update all inner nodes of tree after leaves have been initialized - void update(void); + void update(); /// Initialize tree for tasks \a t TaskTree(Region& r, const TaskViewArray& t); /// Initialize tree using tree \a t @@ -412,11 +410,11 @@ namespace Gecode { namespace Int { TaskTree(Region& r, const TaskTree& t); }; -}} // namespace Gecode::Int +} // namespace Gecode::Int #include -namespace Gecode { namespace Int { +namespace Gecode::Int { /** * \brief %Propagator for tasks @@ -484,12 +482,12 @@ namespace Gecode { namespace Int { static const PropCond pc = PC_INT_DOM; }; -}} // namespace Gecode::Int +} // namespace Gecode::Int #include #include -namespace Gecode { namespace Int { +namespace Gecode::Int { /// Time-tabling event for task class Event { @@ -515,11 +513,11 @@ namespace Gecode { namespace Int { /// Initialize event void init(Type e, int t, int i); /// Return event type - Type type(void) const; + Type type() const; /// Return event time - int time(void) const; + int time() const; /// Return event index - int idx(void) const; + int idx() const; /// Order among events bool operator<(const Event& e) const; /// Allocate from \a r and initialize event array with tasks \a t @@ -534,7 +532,7 @@ namespace Gecode { namespace Int { template std::basic_ostream& operator<<(std::basic_ostream& os, const Event& e); -}} // namespace Gecode::Int +} // namespace Gecode::Int #include diff --git a/gecode/int/task/array.hpp b/gecode/int/task/array.hpp index 5670cbde8e..1c34f1c06f 100644 --- a/gecode/int/task/array.hpp +++ b/gecode/int/task/array.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { /* * Task array @@ -38,7 +38,7 @@ namespace Gecode { namespace Int { template forceinline - TaskArray::TaskArray(void) + TaskArray::TaskArray() : n(0), t(nullptr) {} template forceinline @@ -46,21 +46,9 @@ namespace Gecode { namespace Int { : n(n0), t(n > 0 ? home.alloc(n) : nullptr) { assert(n >= 0); } - template - forceinline - TaskArray::TaskArray(const TaskArray& a) - : n(a.n), t(a.t) {} - template - forceinline const TaskArray& - TaskArray::operator=(const TaskArray& a) { - n = a.n; - t = a.t; - return *this; - } - template forceinline int - TaskArray::size(void) const { + TaskArray::size() const { return n; } template @@ -138,7 +126,7 @@ namespace Gecode { namespace Int { template forceinline int - TaskViewArray::size(void) const { + TaskViewArray::size() const { return t.size(); } @@ -175,6 +163,6 @@ namespace Gecode { namespace Int { return os << s.str(); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-other diff --git a/gecode/int/task/event.hpp b/gecode/int/task/event.hpp index b42b013d02..a8052a8098 100644 --- a/gecode/int/task/event.hpp +++ b/gecode/int/task/event.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { forceinline void Event::init(Event::Type e0, int t0, int i0) { @@ -39,15 +39,15 @@ namespace Gecode { namespace Int { } forceinline Event::Type - Event::type(void) const { + Event::type() const { return static_cast(ei & 7); } forceinline int - Event::time(void) const { + Event::time() const { return t; } forceinline int - Event::idx(void) const { + Event::idx() const { return static_cast(ei >> 3); ; } @@ -163,6 +163,6 @@ namespace Gecode { namespace Int { return e; } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-prop diff --git a/gecode/int/task/fwd-to-bwd.hpp b/gecode/int/task/fwd-to-bwd.hpp index aef410d574..40fd6c6128 100644 --- a/gecode/int/task/fwd-to-bwd.hpp +++ b/gecode/int/task/fwd-to-bwd.hpp @@ -30,39 +30,39 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { /* * Task mapper: map forward task to view to backward task View */ template forceinline int - FwdToBwd::est(void) const { + FwdToBwd::est() const { return -TaskView::lct(); } template forceinline int - FwdToBwd::ect(void) const { + FwdToBwd::ect() const { return -TaskView::lst(); } template forceinline int - FwdToBwd::lst(void) const { + FwdToBwd::lst() const { return -TaskView::ect(); } template forceinline int - FwdToBwd::lct(void) const { + FwdToBwd::lct() const { return -TaskView::est(); } template forceinline int - FwdToBwd::pmin(void) const { + FwdToBwd::pmin() const { return TaskView::pmin(); } template forceinline int - FwdToBwd::pmax(void) const { + FwdToBwd::pmax() const { return TaskView::pmax(); } @@ -92,6 +92,6 @@ namespace Gecode { namespace Int { return TaskView::norun(home, -l, -e); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-var diff --git a/gecode/int/task/iter.hpp b/gecode/int/task/iter.hpp index d8371fe5eb..b9bfbee0e2 100644 --- a/gecode/int/task/iter.hpp +++ b/gecode/int/task/iter.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Int { +namespace Gecode::Int { template forceinline @@ -43,23 +43,23 @@ namespace Gecode { namespace Int { template forceinline bool - TaskViewIter::operator()(void) const { + TaskViewIter::operator()() const { return i >= 0; } template forceinline int - TaskViewIter::left(void) const { + TaskViewIter::left() const { return i + 1; } template forceinline void - TaskViewIter::operator++(void) { + TaskViewIter::operator++() { i--; } template forceinline int - TaskViewIter::task(void) const { + TaskViewIter::task() const { return map[i]; } @@ -75,6 +75,6 @@ namespace Gecode { namespace Int { i--; } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-prop diff --git a/gecode/int/task/man-to-opt.hpp b/gecode/int/task/man-to-opt.hpp index 7da078d361..663b236eaa 100644 --- a/gecode/int/task/man-to-opt.hpp +++ b/gecode/int/task/man-to-opt.hpp @@ -30,27 +30,27 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { template forceinline bool - ManToOptTask::mandatory(void) const { + ManToOptTask::mandatory() const { return _m.one(); } template forceinline bool - ManToOptTask::excluded(void) const { + ManToOptTask::excluded() const { return _m.zero(); } template forceinline bool - ManToOptTask::optional(void) const { + ManToOptTask::optional() const { return _m.none(); } template forceinline bool - ManToOptTask::assigned(void) const { + ManToOptTask::assigned() const { return ManTask::assigned() && _m.assigned(); } @@ -92,6 +92,6 @@ namespace Gecode { namespace Int { ManTask::reschedule(home, p, pc); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-var diff --git a/gecode/int/task/prop.hpp b/gecode/int/task/prop.hpp index 56b77e5ac4..2ccc5caafb 100644 --- a/gecode/int/task/prop.hpp +++ b/gecode/int/task/prop.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { template forceinline @@ -66,6 +66,6 @@ namespace Gecode { namespace Int { return sizeof(*this); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-prop diff --git a/gecode/int/task/purge.hpp b/gecode/int/task/purge.hpp index 6679679681..7f04ee0560 100644 --- a/gecode/int/task/purge.hpp +++ b/gecode/int/task/purge.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { template ExecStatus @@ -66,6 +66,6 @@ namespace Gecode { namespace Int { return (t.size() < 2) ? home.ES_SUBSUMED(p) : ES_OK; } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-prop diff --git a/gecode/int/task/sort.hpp b/gecode/int/task/sort.hpp index 44101e5233..a7ba93484b 100644 --- a/gecode/int/task/sort.hpp +++ b/gecode/int/task/sort.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { /// Sort by earliest start times template @@ -197,6 +197,6 @@ namespace Gecode { namespace Int { } } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-other diff --git a/gecode/int/task/tree.hpp b/gecode/int/task/tree.hpp index 51ac6a325d..242bee4d6b 100644 --- a/gecode/int/task/tree.hpp +++ b/gecode/int/task/tree.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { forceinline int plus(int x, int y) { @@ -48,12 +48,12 @@ namespace Gecode { namespace Int { template forceinline int - TaskTree::n_inner(void) const { + TaskTree::n_inner() const { return tasks.size() - 1; } template forceinline int - TaskTree::n_nodes(void) const { + TaskTree::n_nodes() const { return 2 * tasks.size() - 1; } @@ -105,20 +105,20 @@ namespace Gecode { namespace Int { template forceinline const Node& - TaskTree::root(void) const { + TaskTree::root() const { return node[0]; } template forceinline void - TaskTree::init(void) { + TaskTree::init() { for (int i = n_inner(); i--;) node[i].init(node[n_left(i)], node[n_right(i)]); } template forceinline void - TaskTree::update(void) { + TaskTree::update() { for (int i = n_inner(); i--;) node[i].update(node[n_left(i)], node[n_right(i)]); } @@ -168,6 +168,6 @@ namespace Gecode { namespace Int { _leaf[i] = t._leaf[i]; } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-prop diff --git a/gecode/int/trace/bool-delta.hpp b/gecode/int/trace/bool-delta.hpp index b1f38bc8f2..157ad23f95 100644 --- a/gecode/int/trace/bool-delta.hpp +++ b/gecode/int/trace/bool-delta.hpp @@ -36,23 +36,23 @@ namespace Gecode { BoolTraceDelta::BoolTraceDelta(Int::BoolTraceView, Int::BoolView n, const Delta&) : delta(1 - n.val()) {} forceinline bool - BoolTraceDelta::operator()(void) const { + BoolTraceDelta::operator()() const { return delta >= 0; } forceinline void - BoolTraceDelta::operator++(void) { + BoolTraceDelta::operator++() { delta = -1; } forceinline int - BoolTraceDelta::min(void) const { + BoolTraceDelta::min() const { return delta; } forceinline int - BoolTraceDelta::max(void) const { + BoolTraceDelta::max() const { return delta; } forceinline unsigned int - BoolTraceDelta::width(void) const { + BoolTraceDelta::width() const { return 1U; } diff --git a/gecode/int/trace/bool-trace-view.hpp b/gecode/int/trace/bool-trace-view.hpp index 2eab86ef5a..50f7f4f2d6 100644 --- a/gecode/int/trace/bool-trace-view.hpp +++ b/gecode/int/trace/bool-trace-view.hpp @@ -30,13 +30,13 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { /// Duplicate of a Boolean view class BoolTraceView { public: /// Default constructor (initializes with no view) - BoolTraceView(void) = default; + BoolTraceView() = default; /// Duplicate view \a y BoolTraceView(Space& home, BoolView y); /// Update duplicated view from view \a y and modification delta \a d @@ -58,6 +58,6 @@ namespace Gecode { namespace Int { return x.width() - 1; } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-trace diff --git a/gecode/int/trace/int-trace-view.hpp b/gecode/int/trace/int-trace-view.hpp index 52fc21f178..33958a4086 100644 --- a/gecode/int/trace/int-trace-view.hpp +++ b/gecode/int/trace/int-trace-view.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { /// Duplicate of an integer view class IntTraceView { @@ -40,22 +40,22 @@ namespace Gecode { namespace Int { public: /// Default constructor (initializes with no view) - IntTraceView(void); + IntTraceView(); /// Duplicate view \a y IntTraceView(Space& home, IntView y); /// Give access to ranges - RangeList* ranges(void) const; + RangeList* ranges() const; /// Update duplicated view from view \a y and modification delta \a d void prune(Space& home, IntView y, const Delta& d); /// Update during cloning - void update(Space& home, IntTraceView x); + void update(Space& home, IntTraceView y); /// Return slack measure static unsigned long long int slack(IntView x); }; forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - IntTraceView::IntTraceView(void) {} + IntTraceView::IntTraceView() {} forceinline IntTraceView::IntTraceView(Space& home, IntView y) { @@ -64,7 +64,7 @@ namespace Gecode { namespace Int { } forceinline RangeList* - IntTraceView::ranges(void) const { + IntTraceView::ranges() const { return dom; } @@ -120,6 +120,6 @@ namespace Gecode { namespace Int { return x.width() - 1; } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-trace diff --git a/gecode/int/trace/traits.hpp b/gecode/int/trace/traits.hpp index 9772466ba4..f6515971c8 100644 --- a/gecode/int/trace/traits.hpp +++ b/gecode/int/trace/traits.hpp @@ -36,18 +36,18 @@ namespace Gecode { template <> class TraceTraits { public: - typedef Int::IntTraceView TraceView; - typedef IntTraceDelta TraceDelta; - typedef unsigned long long int SlackValue; + using TraceView = Int::IntTraceView; + using TraceDelta = IntTraceDelta; + using SlackValue = unsigned long long int; }; /// Trace traits for Boolean views template <> class TraceTraits { public: - typedef Int::BoolTraceView TraceView; - typedef BoolTraceDelta TraceDelta; - typedef unsigned int SlackValue; + using TraceView = Int::BoolTraceView; + using TraceDelta = BoolTraceDelta; + using SlackValue = unsigned int; }; } // namespace Gecode diff --git a/gecode/int/unary.cpp b/gecode/int/unary.cpp index 3f1c8ec9b6..d69f15700f 100644 --- a/gecode/int/unary.cpp +++ b/gecode/int/unary.cpp @@ -54,8 +54,8 @@ namespace Gecode { } GECODE_POST; bool all_one = true; - for (int i = 0; i < p.size(); i++) { - if (p[i] != 1) { + for (int pi : p) { + if (pi != 1) { all_one = false; break; } @@ -96,8 +96,8 @@ namespace Gecode { } GECODE_POST; bool fixp = true; - for (int i = 0; i < t.size(); i++) - if (t[i] != TT_FIXED_PROCESSING) { + for (auto ti : t) + if (ti != TT_FIXED_PROCESSING) { fixp = false; break; } @@ -125,8 +125,8 @@ namespace Gecode { Int::Limits::check(static_cast(s[i].max()) + p[i], "Int::unary"); } bool all_mandatory = true; - for (int i = 0; i < m.size(); i++) { - if (!m[i].one()) { + for (auto mi : m) { + if (!mi.one()) { all_mandatory = false; break; } @@ -162,8 +162,8 @@ namespace Gecode { } GECODE_POST; bool all_mandatory = true; - for (int i = 0; i < m.size(); i++) { - if (!m[i].one()) { + for (auto mi : m) { + if (!mi.one()) { all_mandatory = false; break; } @@ -193,13 +193,12 @@ namespace Gecode { if ((n_tasks != p.size()) || (n_tasks != e.size())) throw Int::ArgumentSizeMismatch("Int::unary"); GECODE_POST; - for (int i = 0; i < p.size(); i++) { - IntView pi(p[i]); + for (IntView pi : p) { GECODE_ME_FAIL(pi.gq(home, 0)); } bool fix_p = true; - for (int i = 0; i < p.size(); i++) { - if (!p[i].assigned()) { + for (auto pi : p) { + if (!pi.assigned()) { fix_p = false; break; } @@ -226,13 +225,12 @@ namespace Gecode { if ((n_tasks != p.size()) || (n_tasks != m.size()) || (n_tasks != e.size())) throw Int::ArgumentSizeMismatch("Int::unary"); GECODE_POST; - for (int i = 0; i < p.size(); i++) { - IntView pi(p[i]); + for (IntView pi : p) { GECODE_ME_FAIL(pi.gq(home, 0)); } bool all_mandatory = true; - for (int i = 0; i < m.size(); i++) { - if (!m[i].one()) { + for (auto mi : m) { + if (!mi.one()) { all_mandatory = false; break; } diff --git a/gecode/int/unary.hh b/gecode/int/unary.hh index 4e2b66f220..0e712518fd 100644 --- a/gecode/int/unary.hh +++ b/gecode/int/unary.hh @@ -47,7 +47,7 @@ * \brief %Int for unary resources */ -namespace Gecode { namespace Int { namespace Unary { +namespace Gecode::Int::Unary { /// %Unary (mandatory) task with fixed processing time class ManFixPTask { @@ -61,7 +61,7 @@ namespace Gecode { namespace Int { namespace Unary { /// \name Constructors and initialization //@{ /// Default constructor - ManFixPTask(void); + ManFixPTask(); /// Initialize with start time \a s and processing time \a p ManFixPTask(IntVar s, int p); /// Initialize with start time \a s and processing time \a p @@ -73,31 +73,31 @@ namespace Gecode { namespace Int { namespace Unary { /// \name Value access //@{ /// Return earliest start time - int est(void) const; + int est() const; /// Return earliest completion time - int ect(void) const; + int ect() const; /// Return latest start time - int lst(void) const; + int lst() const; /// Return latest completion time - int lct(void) const; + int lct() const; /// Return minimum processing time - int pmin(void) const; + int pmin() const; /// Return maximum processing time - int pmax(void) const; + int pmax() const; /// Return start time - IntVar st(void) const; + IntVar st() const; /// Whether task is mandatory - bool mandatory(void) const; + bool mandatory() const; /// Whether task is excluded - bool excluded(void) const; + bool excluded() const; /// Whether task can still be optional - bool optional(void) const; + bool optional() const; //@} /// \name Domain tests //@{ /// Test whether task is assigned - bool assigned(void) const; + bool assigned() const; //@} /// \name Value update @@ -152,7 +152,7 @@ namespace Gecode { namespace Int { namespace Unary { /// \name Constructors and initialization //@{ /// Default constructor - ManFixPSETask(void); + ManFixPSETask(); /** * \brief Initialize task * @@ -174,17 +174,17 @@ namespace Gecode { namespace Int { namespace Unary { /// \name Value access //@{ /// Return earliest start time - int est(void) const; + int est() const; /// Return earliest completion time - int ect(void) const; + int ect() const; /// Return latest start time - int lst(void) const; + int lst() const; /// Return latest completion time - int lct(void) const; + int lct() const; /// Return minimum processing time - int pmin(void) const; + int pmin() const; /// Return maximum processing time - int pmax(void) const; + int pmax() const; //@} /// \name Value update @@ -224,7 +224,7 @@ namespace Gecode { namespace Int { namespace Unary { /// \name Constructors and initialization //@{ /// Default constructor - OptFixPTask(void); + OptFixPTask(); /// Initialize with start time \a s, processing time \a p, and mandatory flag \a m OptFixPTask(IntVar s, int p, BoolVar m); /// Initialize with start time \a s, processing time \a p, and mandatory flag \a m @@ -248,7 +248,7 @@ namespace Gecode { namespace Int { namespace Unary { /// \name Constructors and initialization //@{ /// Default constructor - OptFixPSETask(void); + OptFixPSETask(); /// Initialize with start time \a s, processing time \a p, and mandatory flag \a m OptFixPSETask(TaskType t, IntVar s, int p, BoolVar m); /// Initialize with start time \a s, processing time \a p, and mandatory flag \a m @@ -277,7 +277,7 @@ namespace Gecode { namespace Int { namespace Unary { /// \name Constructors and initialization //@{ /// Default constructor - ManFlexTask(void) = default; + ManFlexTask() = default; /// Initialize with start time \a s, processing time \a p, end time \a e ManFlexTask(IntVar s, IntVar p, IntVar e); /// Initialize with start time \a s, processing time \a p, end time \a e @@ -289,35 +289,35 @@ namespace Gecode { namespace Int { namespace Unary { /// \name Value access //@{ /// Return earliest start time - int est(void) const; + int est() const; /// Return earliest completion time - int ect(void) const; + int ect() const; /// Return latest start time - int lst(void) const; + int lst() const; /// Return latest completion time - int lct(void) const; + int lct() const; /// Return minimum processing time - int pmin(void) const; + int pmin() const; /// Return maximum processing time - int pmax(void) const; + int pmax() const; /// Return start time - IntVar st(void) const; + IntVar st() const; /// Return processing time - IntVar p(void) const; + IntVar p() const; /// Return end time - IntVar e(void) const; + IntVar e() const; /// Whether task is mandatory - bool mandatory(void) const; + bool mandatory() const; /// Whether task is excluded - bool excluded(void) const; + bool excluded() const; /// Whether task can still be optional - bool optional(void) const; + bool optional() const; //@} /// \name Domain tests //@{ /// Test whether task is assigned - bool assigned(void) const; + bool assigned() const; //@} /// \name Value update @@ -371,7 +371,7 @@ namespace Gecode { namespace Int { namespace Unary { /// \name Constructors and initialization //@{ /// Default constructor - OptFlexTask(void) = default; + OptFlexTask() = default; /// Initialize with start time \a s, processing time \a p, end time \a e, and mandatory flag \a m OptFlexTask(IntVar s, IntVar p, IntVar e, BoolVar m); /// Initialize with start time \a s, processing time \a p, end time \a e, and mandatory flag \a m @@ -386,47 +386,47 @@ namespace Gecode { namespace Int { namespace Unary { template std::basic_ostream& operator<<(std::basic_ostream& os, const OptFlexTask& t); -}}} // namespace Gecode::Int::Unary +} // namespace Gecode::Int::Unary #include -namespace Gecode { namespace Int { namespace Unary { +namespace Gecode::Int::Unary { /// Forward mandatory fixed task view - typedef ManFixPTask ManFixPTaskFwd; + using ManFixPTaskFwd = ManFixPTask; /// Backward (dual) mandatory fixed task view - typedef FwdToBwd ManFixPTaskBwd; + using ManFixPTaskBwd = FwdToBwd; /// Forward mandatory fixed task view - typedef ManFixPSETask ManFixPSETaskFwd; + using ManFixPSETaskFwd = ManFixPSETask; /// Backward (dual) mandatory fixed task view - typedef FwdToBwd ManFixPSETaskBwd; + using ManFixPSETaskBwd = FwdToBwd; /// Forward optional fixed task view - typedef OptFixPTask OptFixPTaskFwd; + using OptFixPTaskFwd = OptFixPTask; /// Backward (dual) optional fixed task view - typedef FwdToBwd OptFixPTaskBwd; + using OptFixPTaskBwd = FwdToBwd; /// Forward optional fixed task view - typedef OptFixPSETask OptFixPSETaskFwd; + using OptFixPSETaskFwd = OptFixPSETask; /// Backward (dual) optional fixed task view - typedef FwdToBwd OptFixPSETaskBwd; + using OptFixPSETaskBwd = FwdToBwd; /// Forward mandatory flexible task view - typedef ManFlexTask ManFlexTaskFwd; + using ManFlexTaskFwd = ManFlexTask; /// Backward (dual) mandatory flexible task view - typedef FwdToBwd ManFlexTaskBwd; + using ManFlexTaskBwd = FwdToBwd; /// Forward optional flexible task view - typedef OptFlexTask OptFlexTaskFwd; + using OptFlexTaskFwd = OptFlexTask; /// Backward (dual) optional flexible task view - typedef FwdToBwd OptFlexTaskBwd; + using OptFlexTaskBwd = FwdToBwd; /** * \brief Print backward task view in format est:p:lct @@ -472,18 +472,18 @@ namespace Gecode { namespace Int { namespace Unary { template std::basic_ostream& operator<<(std::basic_ostream& os, const OptFlexTaskBwd& t); -}}} // namespace Gecode::Int::Unary +} // namespace Gecode::Int::Unary #include -namespace Gecode { namespace Int { +namespace Gecode::Int { /// Task view traits for forward task views template <> class TaskViewTraits { public: /// The task type - typedef Unary::ManFixPTask Task; + using Task = Unary::ManFixPTask; }; /// Task view traits for backward task views @@ -491,7 +491,7 @@ namespace Gecode { namespace Int { class TaskViewTraits { public: /// The task type - typedef Unary::ManFixPTask Task; + using Task = Unary::ManFixPTask; }; /// Task view traits for forward task views @@ -499,7 +499,7 @@ namespace Gecode { namespace Int { class TaskViewTraits { public: /// The task type - typedef Unary::ManFixPSETask Task; + using Task = Unary::ManFixPSETask; }; /// Task view traits for backward task views @@ -507,7 +507,7 @@ namespace Gecode { namespace Int { class TaskViewTraits { public: /// The task type - typedef Unary::ManFixPSETask Task; + using Task = Unary::ManFixPSETask; }; /// Task view traits for forward optional task views @@ -515,7 +515,7 @@ namespace Gecode { namespace Int { class TaskViewTraits { public: /// The task type - typedef Unary::OptFixPTask Task; + using Task = Unary::OptFixPTask; }; /// Task view traits for backward task views @@ -523,7 +523,7 @@ namespace Gecode { namespace Int { class TaskViewTraits { public: /// The task type - typedef Unary::OptFixPTask Task; + using Task = Unary::OptFixPTask; }; /// Task view traits for forward optional task views @@ -531,7 +531,7 @@ namespace Gecode { namespace Int { class TaskViewTraits { public: /// The task type - typedef Unary::OptFixPSETask Task; + using Task = Unary::OptFixPSETask; }; /// Task view traits for backward task views @@ -539,7 +539,7 @@ namespace Gecode { namespace Int { class TaskViewTraits { public: /// The task type - typedef Unary::OptFixPSETask Task; + using Task = Unary::OptFixPSETask; }; /// Task view traits for forward task views @@ -547,7 +547,7 @@ namespace Gecode { namespace Int { class TaskViewTraits { public: /// The task type - typedef Unary::ManFlexTask Task; + using Task = Unary::ManFlexTask; }; /// Task view traits for backward task views @@ -555,7 +555,7 @@ namespace Gecode { namespace Int { class TaskViewTraits { public: /// The task type - typedef Unary::ManFlexTask Task; + using Task = Unary::ManFlexTask; }; /// Task view traits for forward optional task views @@ -563,7 +563,7 @@ namespace Gecode { namespace Int { class TaskViewTraits { public: /// The task type - typedef Unary::OptFlexTask Task; + using Task = Unary::OptFlexTask; }; /// Task view traits for backward task views @@ -571,7 +571,7 @@ namespace Gecode { namespace Int { class TaskViewTraits { public: /// The task type - typedef Unary::OptFlexTask Task; + using Task = Unary::OptFlexTask; }; /// Task traits for mandatory fixed tasks @@ -579,9 +579,9 @@ namespace Gecode { namespace Int { class TaskTraits { public: /// The forward task view type - typedef Unary::ManFixPTaskFwd TaskViewFwd; + using TaskViewFwd = Unary::ManFixPTaskFwd; /// The backward task view type - typedef Unary::ManFixPTaskBwd TaskViewBwd; + using TaskViewBwd = Unary::ManFixPTaskBwd; }; /// Task traits for mandatory fixed tasks @@ -589,9 +589,9 @@ namespace Gecode { namespace Int { class TaskTraits { public: /// The forward task view type - typedef Unary::ManFixPSETaskFwd TaskViewFwd; + using TaskViewFwd = Unary::ManFixPSETaskFwd; /// The backward task view type - typedef Unary::ManFixPSETaskBwd TaskViewBwd; + using TaskViewBwd = Unary::ManFixPSETaskBwd; }; /// Task traits for optional fixed tasks @@ -599,11 +599,11 @@ namespace Gecode { namespace Int { class TaskTraits { public: /// The forward task view type - typedef Unary::OptFixPTaskFwd TaskViewFwd; + using TaskViewFwd = Unary::OptFixPTaskFwd; /// The backward task view type - typedef Unary::OptFixPTaskBwd TaskViewBwd; + using TaskViewBwd = Unary::OptFixPTaskBwd; /// The corresponding mandatory task - typedef Unary::ManFixPTask ManTask; + using ManTask = Unary::ManFixPTask; }; /// Task traits for optional fixed tasks @@ -611,11 +611,11 @@ namespace Gecode { namespace Int { class TaskTraits { public: /// The forward task view type - typedef Unary::OptFixPSETaskFwd TaskViewFwd; + using TaskViewFwd = Unary::OptFixPSETaskFwd; /// The backward task view type - typedef Unary::OptFixPSETaskBwd TaskViewBwd; + using TaskViewBwd = Unary::OptFixPSETaskBwd; /// The corresponding mandatory task - typedef Unary::ManFixPTask ManTask; + using ManTask = Unary::ManFixPTask; }; /// Task traits for mandatory flexible tasks @@ -623,9 +623,9 @@ namespace Gecode { namespace Int { class TaskTraits { public: /// The forward task view type - typedef Unary::ManFlexTaskFwd TaskViewFwd; + using TaskViewFwd = Unary::ManFlexTaskFwd; /// The backward task view type - typedef Unary::ManFlexTaskBwd TaskViewBwd; + using TaskViewBwd = Unary::ManFlexTaskBwd; }; /// Task traits for optional flexible tasks @@ -633,16 +633,16 @@ namespace Gecode { namespace Int { class TaskTraits { public: /// The forward task view type - typedef Unary::OptFlexTaskFwd TaskViewFwd; + using TaskViewFwd = Unary::OptFlexTaskFwd; /// The backward task view type - typedef Unary::OptFlexTaskBwd TaskViewBwd; + using TaskViewBwd = Unary::OptFlexTaskBwd; /// The corresponding mandatory task - typedef Unary::ManFlexTask ManTask; + using ManTask = Unary::ManFlexTask; }; -}} // namespace Gecode::Int +} // namespace Gecode::Int -namespace Gecode { namespace Int { namespace Unary { +namespace Gecode::Int::Unary { /// Node for an omega tree class OmegaNode { @@ -675,7 +675,7 @@ namespace Gecode { namespace Int { namespace Unary { /// Remove task with index \a i void remove(int i); /// Return earliest completion time of all tasks - int ect(void) const; + int ect() const; /// Return earliest completion time of all tasks but \a i int ect(int i) const; }; @@ -721,20 +721,20 @@ namespace Gecode { namespace Int { namespace Unary { /// Remove task with index \a i from lambda void remove_lambda(int i); /// Whether has responsible task - bool lempty(void) const; + bool lempty() const; /// Return responsible task - int responsible(void) const; + int responsible() const; /// Return earliest completion time of all tasks - int ect(void) const; + int ect() const; /// Return earliest completion time of all tasks excluding lambda tasks - int lect(void) const; + int lect() const; }; -}}} // namespace Gecode::Int::Unary +} // namespace Gecode::Int::Unary #include -namespace Gecode { namespace Int { namespace Unary { +namespace Gecode::Int::Unary { /// Check mandatory tasks \a t for overload template @@ -825,7 +825,7 @@ namespace Gecode { namespace Int { namespace Unary { template ExecStatus post_optional(Home home, TaskArray& t, IntPropLevel ipl); -}}} // namespace Gecode::Int::Unary +} // namespace Gecode::Int::Unary #include #include diff --git a/gecode/int/unary/detectable.hpp b/gecode/int/unary/detectable.hpp index e46662b55e..882e4eaf24 100644 --- a/gecode/int/unary/detectable.hpp +++ b/gecode/int/unary/detectable.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace Unary { +namespace Gecode::Int::Unary { template forceinline ExecStatus @@ -108,6 +108,6 @@ namespace Gecode { namespace Int { namespace Unary { return detectable::TaskViewBwd, PL>(home, p, b); } -}}} // namespace Gecode::Int::Unary +} // namespace Gecode::Int::Unary // STATISTICS: int-prop diff --git a/gecode/int/unary/edge-finding.hpp b/gecode/int/unary/edge-finding.hpp index 5112de1c24..3fa9fa5f8d 100644 --- a/gecode/int/unary/edge-finding.hpp +++ b/gecode/int/unary/edge-finding.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Int { namespace Unary { +namespace Gecode::Int::Unary { template forceinline ExecStatus @@ -68,6 +68,6 @@ namespace Gecode { namespace Int { namespace Unary { return edge_finding(home, b); } -}}} // namespace Gecode::Int::Unary +} // namespace Gecode::Int::Unary // STATISTICS: int-prop diff --git a/gecode/int/unary/man-prop.hpp b/gecode/int/unary/man-prop.hpp index ea0e52b27d..9593ff3bf0 100644 --- a/gecode/int/unary/man-prop.hpp +++ b/gecode/int/unary/man-prop.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace Unary { +namespace Gecode::Int::Unary { template forceinline @@ -76,6 +76,6 @@ namespace Gecode { namespace Int { namespace Unary { return ES_NOFIX; } -}}} // namespace Gecode::Int::Unary +} // namespace Gecode::Int::Unary // STATISTICS: int-prop diff --git a/gecode/int/unary/not-first-not-last.hpp b/gecode/int/unary/not-first-not-last.hpp index de98ebeae0..aecd4c70ac 100644 --- a/gecode/int/unary/not-first-not-last.hpp +++ b/gecode/int/unary/not-first-not-last.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Int { namespace Unary { +namespace Gecode::Int::Unary { template forceinline ExecStatus @@ -128,6 +128,6 @@ namespace Gecode { namespace Int { namespace Unary { return not_last::TaskViewBwd, PL>(home, p, b); } -}}} // namespace Gecode::Int::Unary +} // namespace Gecode::Int::Unary // STATISTICS: int-prop diff --git a/gecode/int/unary/opt-prop.hpp b/gecode/int/unary/opt-prop.hpp index 931531d1b2..da39aa528f 100644 --- a/gecode/int/unary/opt-prop.hpp +++ b/gecode/int/unary/opt-prop.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Int { namespace Unary { +namespace Gecode::Int::Unary { template forceinline @@ -115,6 +115,6 @@ namespace Gecode { namespace Int { namespace Unary { return ES_NOFIX; } -}}} // namespace Gecode::Int::Unary +} // namespace Gecode::Int::Unary // STATISTICS: int-prop diff --git a/gecode/int/unary/overload.hpp b/gecode/int/unary/overload.hpp index c8ab606965..a72c641a04 100644 --- a/gecode/int/unary/overload.hpp +++ b/gecode/int/unary/overload.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace Unary { +namespace Gecode::Int::Unary { // Overload checking for mandatory tasks template @@ -83,6 +83,6 @@ namespace Gecode { namespace Int { namespace Unary { return ES_OK; } -}}} // namespace Gecode::Int::Unary +} // namespace Gecode::Int::Unary // STATISTICS: int-prop diff --git a/gecode/int/unary/post.hpp b/gecode/int/unary/post.hpp index 83dc576966..b5672d9427 100644 --- a/gecode/int/unary/post.hpp +++ b/gecode/int/unary/post.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace Unary { +namespace Gecode::Int::Unary { template forceinline ExecStatus @@ -64,6 +64,6 @@ namespace Gecode { namespace Int { namespace Unary { return ES_OK; } -}}} // namespace Gecode::Int::Unary +} // namespace Gecode::Int::Unary // STATISTICS: int-post diff --git a/gecode/int/unary/subsumption.hpp b/gecode/int/unary/subsumption.hpp index 9a699cb9de..67b8d36c9c 100644 --- a/gecode/int/unary/subsumption.hpp +++ b/gecode/int/unary/subsumption.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace Unary { +namespace Gecode::Int::Unary { template ExecStatus @@ -45,6 +45,6 @@ namespace Gecode { namespace Int { namespace Unary { return home.ES_SUBSUMED(p); } -}}} // namespace Gecode::Int::Unary +} // namespace Gecode::Int::Unary // STATISTICS: int-prop diff --git a/gecode/int/unary/task-view.hpp b/gecode/int/unary/task-view.hpp index 706c7c7b78..09cfd4d2be 100644 --- a/gecode/int/unary/task-view.hpp +++ b/gecode/int/unary/task-view.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Int { namespace Unary { +namespace Gecode::Int::Unary { template std::basic_ostream& @@ -95,6 +95,6 @@ namespace Gecode { namespace Int { namespace Unary { return os << s.str(); } -}}} // namespace Gecode::Int::Unary +} // namespace Gecode::Int::Unary // STATISTICS: int-var diff --git a/gecode/int/unary/task.hpp b/gecode/int/unary/task.hpp index a849ab02a7..d2ed2d39a8 100644 --- a/gecode/int/unary/task.hpp +++ b/gecode/int/unary/task.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Int { namespace Unary { +namespace Gecode::Int::Unary { /** * \brief Clamp a time point for the no-run ranges to the integer limits @@ -53,7 +53,7 @@ namespace Gecode { namespace Int { namespace Unary { forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - ManFixPTask::ManFixPTask(void) {} + ManFixPTask::ManFixPTask() {} forceinline ManFixPTask::ManFixPTask(IntVar s, int p) : _s(s), _p(p) {} @@ -69,49 +69,49 @@ namespace Gecode { namespace Int { namespace Unary { } forceinline int - ManFixPTask::est(void) const { + ManFixPTask::est() const { return _s.min(); } forceinline int - ManFixPTask::ect(void) const { + ManFixPTask::ect() const { return _s.min() + _p; } forceinline int - ManFixPTask::lst(void) const { + ManFixPTask::lst() const { return _s.max(); } forceinline int - ManFixPTask::lct(void) const { + ManFixPTask::lct() const { return _s.max() + _p; } forceinline int - ManFixPTask::pmin(void) const { + ManFixPTask::pmin() const { return _p; } forceinline int - ManFixPTask::pmax(void) const { + ManFixPTask::pmax() const { return _p; } forceinline IntVar - ManFixPTask::st(void) const { + ManFixPTask::st() const { return _s; } forceinline bool - ManFixPTask::mandatory(void) const { + ManFixPTask::mandatory() const { return true; } forceinline bool - ManFixPTask::excluded(void) const { + ManFixPTask::excluded() const { return false; } forceinline bool - ManFixPTask::optional(void) const { + ManFixPTask::optional() const { return false; } forceinline bool - ManFixPTask::assigned(void) const { + ManFixPTask::assigned() const { return _s.assigned(); } @@ -136,9 +136,8 @@ namespace Gecode { namespace Int { namespace Unary { if (e <= l) { Iter::Ranges::Singleton r(norun_bound(static_cast(e) - _p + 1), l); return _s.minus_r(home, r, false); - } else { - return ME_INT_NONE; } + return ME_INT_NONE; } forceinline ModEvent @@ -185,7 +184,7 @@ namespace Gecode { namespace Int { namespace Unary { forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - ManFixPSETask::ManFixPSETask(void) {} + ManFixPSETask::ManFixPSETask() {} forceinline ManFixPSETask::ManFixPSETask(TaskType t, IntVar s, int p) : ManFixPTask(s, p), _t(t) {} @@ -201,11 +200,11 @@ namespace Gecode { namespace Int { namespace Unary { } forceinline int - ManFixPSETask::est(void) const { + ManFixPSETask::est() const { return (_t == TT_FIXED_START) ? _p : _s.min(); } forceinline int - ManFixPSETask::ect(void) const { + ManFixPSETask::ect() const { switch (_t) { case TT_FIXED_PROCESSING: return _s.min() + _p; @@ -219,11 +218,11 @@ namespace Gecode { namespace Int { namespace Unary { return 0; } forceinline int - ManFixPSETask::lst(void) const { + ManFixPSETask::lst() const { return (_t == TT_FIXED_START) ? _p : _s.max(); } forceinline int - ManFixPSETask::lct(void) const { + ManFixPSETask::lct() const { switch (_t) { case TT_FIXED_PROCESSING: return _s.max() + _p; @@ -237,7 +236,7 @@ namespace Gecode { namespace Int { namespace Unary { return 0; } forceinline int - ManFixPSETask::pmin(void) const { + ManFixPSETask::pmin() const { switch (_t) { case TT_FIXED_PROCESSING: return _p; @@ -251,7 +250,7 @@ namespace Gecode { namespace Int { namespace Unary { return 0; } forceinline int - ManFixPSETask::pmax(void) const { + ManFixPSETask::pmax() const { switch (_t) { case TT_FIXED_PROCESSING: return _p; @@ -339,9 +338,8 @@ namespace Gecode { namespace Int { namespace Unary { GECODE_NEVER; } return ME_INT_NONE; - } else { - return ME_INT_NONE; } + return ME_INT_NONE; } forceinline void @@ -381,57 +379,57 @@ namespace Gecode { namespace Int { namespace Unary { } forceinline int - ManFlexTask::est(void) const { + ManFlexTask::est() const { return _s.min(); } forceinline int - ManFlexTask::ect(void) const { + ManFlexTask::ect() const { return _e.min(); } forceinline int - ManFlexTask::lst(void) const { + ManFlexTask::lst() const { return _s.max(); } forceinline int - ManFlexTask::lct(void) const { + ManFlexTask::lct() const { return _e.max(); } forceinline int - ManFlexTask::pmin(void) const { + ManFlexTask::pmin() const { return _p.min(); } forceinline int - ManFlexTask::pmax(void) const { + ManFlexTask::pmax() const { return _p.max(); } forceinline IntVar - ManFlexTask::st(void) const { + ManFlexTask::st() const { return _s; } forceinline IntVar - ManFlexTask::p(void) const { + ManFlexTask::p() const { return _p; } forceinline IntVar - ManFlexTask::e(void) const { + ManFlexTask::e() const { return _e; } forceinline bool - ManFlexTask::mandatory(void) const { + ManFlexTask::mandatory() const { return true; } forceinline bool - ManFlexTask::excluded(void) const { + ManFlexTask::excluded() const { return false; } forceinline bool - ManFlexTask::optional(void) const { + ManFlexTask::optional() const { return false; } forceinline bool - ManFlexTask::assigned(void) const { + ManFlexTask::assigned() const { return _s.assigned() && _p.assigned() && _e.assigned(); } @@ -460,9 +458,8 @@ namespace Gecode { namespace Int { namespace Unary { Iter::Ranges::Singleton er(norun_bound(static_cast(e) + 1), norun_bound(static_cast(_p.min()) + l)); return _e.minus_r(home, er, false); - } else { - return ME_INT_NONE; } + return ME_INT_NONE; } forceinline ModEvent @@ -516,7 +513,7 @@ namespace Gecode { namespace Int { namespace Unary { forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - OptFixPTask::OptFixPTask(void) {} + OptFixPTask::OptFixPTask() {} forceinline OptFixPTask::OptFixPTask(IntVar s, int p, BoolVar m) { ManFixPTask::init(s, p); @@ -544,7 +541,7 @@ namespace Gecode { namespace Int { namespace Unary { forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - OptFixPSETask::OptFixPSETask(void) {} + OptFixPSETask::OptFixPSETask() {} forceinline OptFixPSETask::OptFixPSETask(TaskType t, IntVar s, int p, BoolVar m) { ManFixPSETask::init(t, s, p); @@ -592,6 +589,6 @@ namespace Gecode { namespace Int { namespace Unary { return os << s.str(); } -}}} // namespace Gecode::Int::Unary +} // namespace Gecode::Int::Unary // STATISTICS: int-var diff --git a/gecode/int/unary/time-tabling.hpp b/gecode/int/unary/time-tabling.hpp index f59967aea1..968f7a65b6 100644 --- a/gecode/int/unary/time-tabling.hpp +++ b/gecode/int/unary/time-tabling.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Int { namespace Unary { +namespace Gecode::Int::Unary { template ExecStatus @@ -100,6 +100,6 @@ namespace Gecode { namespace Int { namespace Unary { return ES_NOFIX; } -}}} // namespace Gecode::Int::Unary +} // namespace Gecode::Int::Unary // STATISTICS: int-prop diff --git a/gecode/int/unary/tree.hpp b/gecode/int/unary/tree.hpp index 47965af451..279722f0da 100644 --- a/gecode/int/unary/tree.hpp +++ b/gecode/int/unary/tree.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Int { namespace Unary { +namespace Gecode::Int::Unary { /* * Omega tree @@ -79,7 +79,7 @@ namespace Gecode { namespace Int { namespace Unary { template forceinline int - OmegaTree::ect(void) const { + OmegaTree::ect() const { return root().ect; } @@ -93,9 +93,8 @@ namespace Gecode { namespace Int { namespace Unary { int ect = o.root().ect; o.insert(i); return ect; - } else { - return root().ect; } + return root().ect; } /* @@ -202,28 +201,28 @@ namespace Gecode { namespace Int { namespace Unary { template forceinline bool - OmegaLambdaTree::lempty(void) const { + OmegaLambdaTree::lempty() const { return root().res_ect < 0; } template forceinline int - OmegaLambdaTree::responsible(void) const { + OmegaLambdaTree::responsible() const { return root().res_ect; } template forceinline int - OmegaLambdaTree::ect(void) const { + OmegaLambdaTree::ect() const { return root().ect; } template forceinline int - OmegaLambdaTree::lect(void) const { + OmegaLambdaTree::lect() const { return root().lect; } -}}} // namespace Gecode::Int::Unary +} // namespace Gecode::Int::Unary // STATISTICS: int-prop diff --git a/gecode/int/unshare.cpp b/gecode/int/unshare.cpp index 6ce0ecf531..30bdfb9a26 100644 --- a/gecode/int/unshare.cpp +++ b/gecode/int/unshare.cpp @@ -38,7 +38,7 @@ * \brief Unsharing shared variables */ -namespace Gecode { namespace Int { namespace Unshare { +namespace Gecode::Int::Unshare { /// Sort order for variables template @@ -51,7 +51,7 @@ namespace Gecode { namespace Int { namespace Unshare { }; /// Replace by fresh yet equal integer variables - forceinline void + static forceinline void link(Home home, IntVar** x, int n, IntPropLevel ipl) { if (home.failed()) { for (int i = 1; i < n; i++) @@ -85,7 +85,7 @@ namespace Gecode { namespace Int { namespace Unshare { } /// Replace by fresh yet equal Boolean variables - forceinline void + static forceinline void link(Home home, BoolVar** x, int n, IntPropLevel) { if (home.failed()) { for (int i = 1; i < n; i++) @@ -108,7 +108,7 @@ namespace Gecode { namespace Int { namespace Unshare { /// Replace unassigned shared variables by fresh, yet equal variables template - forceinline void + static forceinline void unshare(Home home, VarArgArray& x, IntPropLevel ipl) { int n = x.size(); if (n < 2) @@ -132,7 +132,7 @@ namespace Gecode { namespace Int { namespace Unshare { } } -}}} // namespace Gecode::Int::Unshare +} // namespace Gecode::Int::Unshare namespace Gecode { diff --git a/gecode/int/val-set.hh b/gecode/int/val-set.hh index 4499e44704..c8da0ac680 100644 --- a/gecode/int/val-set.hh +++ b/gecode/int/val-set.hh @@ -35,7 +35,7 @@ #include -namespace Gecode { namespace Int { +namespace Gecode::Int { /** * \brief Class for storing values of already assigned views @@ -51,17 +51,17 @@ namespace Gecode { namespace Int { public: /// Initialize - ValSet(void); + ValSet(); /// Add value \a v to value set void add(Space& home, int v); /// Return size (number of values) - int size(void) const; + int size() const; /// Test whether set is empty - bool empty(void) const; + bool empty() const; /// Return smallest value (provided the set is not empty) - int min(void) const; + int min() const; /// Return largest value (provided the set is not empty) - int max(void) const; + int max() const; /// Compare view \a x with value set template Iter::Ranges::CompareStatus compare(View x) const; @@ -71,7 +71,7 @@ namespace Gecode { namespace Int { /// Update value set during cloning void update(Space& home, ValSet& vs); /// Flush entries - void flush(void); + void flush(); /// Dispose value set void dispose(Space& home); /// Iterator over ranges @@ -89,24 +89,24 @@ namespace Gecode { namespace Int { /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of range (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; }; -}} // namespace Gecode::Int +} // namespace Gecode::Int #include diff --git a/gecode/int/val-set.hpp b/gecode/int/val-set.hpp index e44124bbd3..163bfcf1d7 100644 --- a/gecode/int/val-set.hpp +++ b/gecode/int/val-set.hpp @@ -30,14 +30,14 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { /* * Value sets * */ forceinline - ValSet::ValSet(void) + ValSet::ValSet() : fst(nullptr), lst(nullptr), n(0) {} forceinline void @@ -50,15 +50,16 @@ namespace Gecode { namespace Int { c->min(v); n++; return; - } else { - *p = new (home) RangeList(v, v, c); - n++; - return; } - } else if (v <= c->max()) { + *p = new (home) RangeList(v, v, c); + n++; + return; + } + if (v <= c->max()) { // Value already included return; - } else if (v == c->max() + 1) { + } + if (v == c->max() + 1) { if ((c->next() != nullptr) && (v + 1 == c->next()->min())) { c->next()->min(c->min()); *p = c->next(); @@ -68,10 +69,9 @@ namespace Gecode { namespace Int { } n++; return; - } else { - p = c->next_ref(); - c = *p; } + p = c->next_ref(); + c = *p; } *p = new (home) RangeList(v, v, nullptr); n++; @@ -79,22 +79,22 @@ namespace Gecode { namespace Int { } forceinline int - ValSet::size(void) const { + ValSet::size() const { return n; } forceinline bool - ValSet::empty(void) const { + ValSet::empty() const { return n == 0; } forceinline int - ValSet::min(void) const { + ValSet::min() const { return fst->min(); } forceinline int - ValSet::max(void) const { + ValSet::max() const { return lst->max(); } @@ -120,7 +120,7 @@ namespace Gecode { namespace Int { } forceinline void - ValSet::flush(void) { + ValSet::flush() { fst = lst = nullptr; } @@ -135,26 +135,26 @@ namespace Gecode { namespace Int { : c(vs.fst) {} forceinline bool - ValSet::Ranges::operator()(void) const { + ValSet::Ranges::operator()() const { return c != nullptr; } forceinline void - ValSet::Ranges::operator++(void) { + ValSet::Ranges::operator++() { c = c->next(); } forceinline int - ValSet::Ranges::min(void) const { + ValSet::Ranges::min() const { return c->min(); } forceinline int - ValSet::Ranges::max(void) const { + ValSet::Ranges::max() const { return c->max(); } forceinline unsigned int - ValSet::Ranges::width(void) const { + ValSet::Ranges::width() const { return c->width(); } @@ -178,6 +178,6 @@ namespace Gecode { namespace Int { return Iter::Ranges::subset(xr, vsr); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-other diff --git a/gecode/int/var-imp.hpp b/gecode/int/var-imp.hpp index e7be318608..a20788a538 100644 --- a/gecode/int/var-imp.hpp +++ b/gecode/int/var-imp.hpp @@ -36,7 +36,7 @@ #include -namespace Gecode { namespace Int { +namespace Gecode::Int { class IntVarImp; class BoolVarImp; @@ -56,7 +56,7 @@ namespace Gecode { namespace Int { int _max; ///< Largest value just pruned public: /// Create integer delta as providing no information - IntDelta(void); + IntDelta(); /// Create integer delta with \a min and \a max IntDelta(int min, int max); /// Create integer delta with \a min @@ -64,20 +64,20 @@ namespace Gecode { namespace Int { private: /// Return minimum - int min(void) const; + int min() const; /// Return maximum - int max(void) const; + int max() const; /// Return width - unsigned int width(void) const; + unsigned int width() const; /// Test whether any domain change has happened - bool any(void) const; + bool any() const; }; -}} // namespace Gecode::Int +} // namespace Gecode::Int #include -namespace Gecode { namespace Int { +namespace Gecode::Int { class IntVarImpFwd; class IntVarImpBwd; @@ -112,7 +112,7 @@ namespace Gecode { namespace Int { /// \name Constructors //@{ /// Default constructor (noop) - RangeList(void); + RangeList(); /// Initialize with minimum \a min and maximum \a max RangeList(int min, int max); /// Initialize with minimum \a min and maximum \a max and predecessor \a p and successor \a n @@ -122,11 +122,11 @@ namespace Gecode { namespace Int { /// \name Access //@{ /// Return minimum - int min(void) const; + int min() const; /// Return maximum - int max(void) const; + int max() const; /// Return width (distance between maximum and minimum) - unsigned int width(void) const; + unsigned int width() const; /// Return next element (from previous \a p) RangeList* next(const RangeList* p) const; @@ -192,17 +192,16 @@ namespace Gecode { namespace Int { /// Link the last element RangeList* _lst; /// Return first element of rangelist - RangeList* fst(void) const; + RangeList* fst() const; /// Set first element of rangelist void fst(RangeList* f); /// Return last element of rangelist - RangeList* lst(void) const; + RangeList* lst() const; /// Set last element of rangelist void lst(RangeList* l); /// Size of holes in the domain unsigned int holes; - protected: /// Constructor for cloning \a x IntVarImp(Space& home, IntVarImp& x); @@ -215,22 +214,22 @@ namespace Gecode { namespace Int { /// \name Value access //@{ /// Return minimum of domain - int min(void) const; + int min() const; /// Return maximum of domain - int max(void) const; + int max() const; /// Return assigned value (only if assigned) - int val(void) const; + int val() const; /// Return median of domain (greatest element not greater than the median) - GECODE_INT_EXPORT int med(void) const; + GECODE_INT_EXPORT int med() const; /// Return size (cardinality) of domain - unsigned int size(void) const; + unsigned int size() const; /// Return width of domain (distance between maximum and minimum) - unsigned int width(void) const; + unsigned int width() const; /// Return regret of domain minimum (distance to next larger value) - unsigned int regret_min(void) const; + unsigned int regret_min() const; /// Return regret of domain maximum (distance to next smaller value) - unsigned int regret_max(void) const; + unsigned int regret_max() const; //@} private: @@ -241,9 +240,9 @@ namespace Gecode { namespace Int { /// \name Domain tests //@{ /// Test whether domain is a range - bool range(void) const; + bool range() const; /// Test whether variable is assigned - bool assigned(void) const; + bool assigned() const; /// Test whether \a n is contained in domain bool in(int n) const; @@ -255,14 +254,14 @@ namespace Gecode { namespace Int { /// \name Range list access for iteration //@{ /// Return range list for forward iteration - const RangeList* ranges_fwd(void) const; + const RangeList* ranges_fwd() const; /// Return range list for backward iteration - const RangeList* ranges_bwd(void) const; + const RangeList* ranges_bwd() const; //@} private: /// Test whether \a n is closer to the minimum or maximum - bool closer_min(int b) const; + bool closer_min(int n) const; /// \name Domain update by value (full domain) //@{ /// Restrict domain values to be less or equal than \a n @@ -289,13 +288,13 @@ namespace Gecode { namespace Int { /// Restrict domain values to be different from \a n ModEvent nq(Space& home, int n); - /// Restrict domain values to be different from \a n - ModEvent nq(Space& home, long long int n); + /// Restrict domain values to be different from \a d + ModEvent nq(Space& home, long long int d); /// Restrict domain values to be equal to \a n ModEvent eq(Space& home, int n); - /// Restrict domain values to be equal to \a n - ModEvent eq(Space& home, long long int n); + /// Restrict domain values to be equal to \a m + ModEvent eq(Space& home, long long int m); //@} /** @@ -403,7 +402,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - IntVarImpFwd(void) = default; + IntVarImpFwd() = default; /// Initialize with ranges from variable implementation \a x IntVarImpFwd(const IntVarImp* x); /// Initialize with ranges from variable implementation \a x @@ -413,19 +412,19 @@ namespace Gecode { namespace Int { /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of range (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; @@ -447,7 +446,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - IntVarImpBwd(void) = default; + IntVarImpBwd() = default; /// Initialize with ranges from variable implementation \a x IntVarImpBwd(const IntVarImp* x); /// Initialize with ranges from variable implementation \a x @@ -457,23 +456,23 @@ namespace Gecode { namespace Int { /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to previous range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of range (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; -}} // namespace Gecode::Int +} // namespace Gecode::Int #include @@ -483,10 +482,10 @@ namespace Gecode { class BoolVar; } // namespace Gecode -namespace Gecode { namespace Int { +namespace Gecode::Int { /// Type for status of a Boolean variable - typedef unsigned int BoolStatus; + using BoolStatus = unsigned int; /** * \brief Boolean variable implementation @@ -531,46 +530,46 @@ namespace Gecode { namespace Int { /// Status of domain not yet assigned static const BoolStatus unassigned_status = 2; /// Return current domain status - BoolStatus status(void) const; + BoolStatus status() const; //@} /// \name Value access //@{ /// Return minimum of domain - int min(void) const; + int min() const; /// Return maximum of domain - int max(void) const; + int max() const; /// Return assigned value (only if assigned) - int val(void) const; + int val() const; /// Return median of domain (greatest element not greater than the median) - int med(void) const; + int med() const; /// Return size (cardinality) of domain - unsigned int size(void) const; + unsigned int size() const; /// Return width of domain (distance between maximum and minimum) - unsigned int width(void) const; + unsigned int width() const; /// Return regret of domain minimum (distance to next larger value) - unsigned int regret_min(void) const; + unsigned int regret_min() const; /// Return regret of domain maximum (distance to next smaller value) - unsigned int regret_max(void) const; + unsigned int regret_max() const; //@} /// \name Boolean domain tests //@{ /// Test whether variable is assigned to zero - bool zero(void) const; + bool zero() const; /// Test whether variable is assigned to one - bool one(void) const; + bool one() const; /// Test whether variable is not yet assigned - bool none(void) const; + bool none() const; //@} /// \name Domain tests //@{ /// Test whether domain is a range - bool range(void) const; + bool range() const; /// Test whether variable is assigned - bool assigned(void) const; + bool assigned() const; /// Test whether \a n is contained in domain bool in(int n) const; @@ -649,7 +648,6 @@ namespace Gecode { namespace Int { GECODE_INT_EXPORT ModEvent one_none(Space& home); //@} - public: /// \name Dependencies //@{ /** @@ -724,7 +722,7 @@ namespace Gecode { namespace Int { //@} }; -}} // namespace Gecode::Int +} // namespace Gecode::Int #include diff --git a/gecode/int/var-imp/bool.cpp b/gecode/int/var-imp/bool.cpp index f18ad50364..a4cc3d269b 100644 --- a/gecode/int/var-imp/bool.cpp +++ b/gecode/int/var-imp/bool.cpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Int { +namespace Gecode::Int { BoolVarImp BoolVarImp::s_one(1); BoolVarImp BoolVarImp::s_zero(0); @@ -72,6 +72,6 @@ namespace Gecode { namespace Int { BoolVarImpBase::subscribe(home, a, assigned(), fail); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-var diff --git a/gecode/int/var-imp/bool.hpp b/gecode/int/var-imp/bool.hpp index 60a4f45e77..aa09da4a50 100644 --- a/gecode/int/var-imp/bool.hpp +++ b/gecode/int/var-imp/bool.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { /* * Creation of new variable implementations @@ -53,53 +53,53 @@ namespace Gecode { namespace Int { * */ forceinline BoolStatus - BoolVarImp::status(void) const { + BoolVarImp::status() const { return bits() & 3; } forceinline int - BoolVarImp::min(void) const { + BoolVarImp::min() const { return static_cast(bits() & 1); } forceinline int - BoolVarImp::max(void) const { + BoolVarImp::max() const { return static_cast((bits() & 2) >> 1); } forceinline int - BoolVarImp::med(void) const { + BoolVarImp::med() const { return min(); } forceinline int - BoolVarImp::val(void) const { + BoolVarImp::val() const { assert(status() != unassigned_status); return min(); } forceinline bool - BoolVarImp::range(void) const { + BoolVarImp::range() const { return true; } forceinline bool - BoolVarImp::assigned(void) const { + BoolVarImp::assigned() const { return status() != unassigned_status; } forceinline unsigned int - BoolVarImp::width(void) const { + BoolVarImp::width() const { return assigned() ? 1U : 2U; } forceinline unsigned int - BoolVarImp::size(void) const { + BoolVarImp::size() const { return assigned() ? 1U : 2U; } forceinline unsigned int - BoolVarImp::regret_min(void) const { + BoolVarImp::regret_min() const { return assigned() ? 1U : 0U; } forceinline unsigned int - BoolVarImp::regret_max(void) const { + BoolVarImp::regret_max() const { return assigned() ? 1U : 0U; } @@ -122,15 +122,15 @@ namespace Gecode { namespace Int { * */ forceinline bool - BoolVarImp::zero(void) const { + BoolVarImp::zero() const { return status() < unassigned_status; } forceinline bool - BoolVarImp::one(void) const { + BoolVarImp::one() const { return status() > unassigned_status; } forceinline bool - BoolVarImp::none(void) const { + BoolVarImp::none() const { return status() == unassigned_status; } @@ -264,12 +264,11 @@ namespace Gecode { namespace Int { BoolVarImp::copy(Space& home) { if (copied()) return static_cast(forward()); - else if (zero()) + if (zero()) return &s_zero; - else if (one()) + if (one()) return &s_one; - else - return new (home) BoolVarImp(home, *this); + return new (home) BoolVarImp(home, *this); } /* @@ -346,10 +345,9 @@ namespace Gecode { namespace Int { if (!i()) return zero_none(home); return ME_INT_NONE; - } else { - assert(i.val() == 1); - return one_none(home); } + assert(i.val() == 1); + return one_none(home); } template forceinline ModEvent @@ -365,10 +363,9 @@ namespace Gecode { namespace Int { if (!i() || (i.val() > 1)) return zero(home); return ME_INT_NONE; - } else { - assert(i.val() == 1); - return one(home); } + assert(i.val() == 1); + return one(home); } template forceinline ModEvent @@ -384,10 +381,9 @@ namespace Gecode { namespace Int { if (!i() || (i.val() > 1)) return one(home); return fail(home); - } else { - assert(i.val() == 1); - return zero(home); } + assert(i.val() == 1); + return zero(home); } /* @@ -414,6 +410,6 @@ namespace Gecode { namespace Int { return BoolVarImpBase::med(me); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-var diff --git a/gecode/int/var-imp/delta.hpp b/gecode/int/var-imp/delta.hpp index 9c5615f5a4..9ca8bfe9bf 100644 --- a/gecode/int/var-imp/delta.hpp +++ b/gecode/int/var-imp/delta.hpp @@ -34,10 +34,10 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { forceinline - IntDelta::IntDelta(void) + IntDelta::IntDelta() : _min(1), _max(0) {} forceinline IntDelta::IntDelta(int min, int max) @@ -46,22 +46,22 @@ namespace Gecode { namespace Int { IntDelta::IntDelta(int min) : _min(min) {} forceinline int - IntDelta::min(void) const { + IntDelta::min() const { return _min; } forceinline int - IntDelta::max(void) const { + IntDelta::max() const { return _max; } forceinline unsigned int - IntDelta::width(void) const { + IntDelta::width() const { return static_cast(_max) - static_cast(_min) + 1U; } forceinline bool - IntDelta::any(void) const { + IntDelta::any() const { return _min > _max; } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-var diff --git a/gecode/int/var-imp/int.cpp b/gecode/int/var-imp/int.cpp index 47aa130ece..c890a5a2a0 100644 --- a/gecode/int/var-imp/int.cpp +++ b/gecode/int/var-imp/int.cpp @@ -36,7 +36,7 @@ #include -namespace Gecode { namespace Int { +namespace Gecode::Int { forceinline bool IntVarImp::closer_min(int n) const { @@ -46,7 +46,7 @@ namespace Gecode { namespace Int { } int - IntVarImp::med(void) const { + IntVarImp::med() const { // Computes the median if (fst() == nullptr) return (dom.min() + dom.max()) / 2 - ((dom.min() + dom.max()) % 2 < 0 ? 1 : 0); @@ -75,16 +75,15 @@ namespace Gecode { namespace Int { c = n; } return (m >= c->min()); - } else { - const RangeList* n = nullptr; - const RangeList* c = lst(); - while (m < c->min()) { - const RangeList* p = c->prev(n); - n = c; - c = p; - } - return (m <= c->max()); } + const RangeList* n = nullptr; + const RangeList* c = lst(); + while (m < c->min()) { + const RangeList* p = c->prev(n); + n = c; + c = p; + } + return (m <= c->max()); } /* @@ -427,6 +426,6 @@ namespace Gecode { namespace Int { IntVarImpBase::subscribe(home, a, dom.min() == dom.max(), fail); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-var diff --git a/gecode/int/var-imp/int.hpp b/gecode/int/var-imp/int.hpp index 56b2a0b7e7..74168831a3 100644 --- a/gecode/int/var-imp/int.hpp +++ b/gecode/int/var-imp/int.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { /* * Range lists @@ -53,7 +53,7 @@ namespace Gecode { namespace Int { forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - IntVarImp::RangeList::RangeList(void) {} + IntVarImp::RangeList::RangeList() {} forceinline IntVarImp::RangeList::RangeList(int min, int max) @@ -100,15 +100,15 @@ namespace Gecode { namespace Int { } forceinline int - IntVarImp::RangeList::min(void) const { + IntVarImp::RangeList::min() const { return _min; } forceinline int - IntVarImp::RangeList::max(void) const { + IntVarImp::RangeList::max() const { return _max; } forceinline unsigned int - IntVarImp::RangeList::width(void) const { + IntVarImp::RangeList::width() const { return range_width(_min, _max); } @@ -165,7 +165,7 @@ namespace Gecode { namespace Int { */ forceinline IntVarImp::RangeList* - IntVarImp::fst(void) const { + IntVarImp::fst() const { return dom.next(nullptr); } @@ -175,7 +175,7 @@ namespace Gecode { namespace Int { } forceinline IntVarImp::RangeList* - IntVarImp::lst(void) const { + IntVarImp::lst() const { return _lst; } @@ -230,57 +230,57 @@ namespace Gecode { namespace Int { */ forceinline int - IntVarImp::min(void) const { + IntVarImp::min() const { return dom.min(); } forceinline int - IntVarImp::max(void) const { + IntVarImp::max() const { return dom.max(); } forceinline int - IntVarImp::val(void) const { + IntVarImp::val() const { assert(dom.min() == dom.max()); return dom.min(); } forceinline bool - IntVarImp::range(void) const { + IntVarImp::range() const { return fst() == nullptr; } forceinline bool - IntVarImp::assigned(void) const { + IntVarImp::assigned() const { return dom.min() == dom.max(); } forceinline unsigned int - IntVarImp::width(void) const { + IntVarImp::width() const { return dom.width(); } forceinline unsigned int - IntVarImp::size(void) const { + IntVarImp::size() const { return dom.width() - holes; } forceinline unsigned int - IntVarImp::regret_min(void) const { + IntVarImp::regret_min() const { if (fst() == nullptr) { return (dom.min() == dom.max()) ? 0U : 1U; - } else if (dom.min() == fst()->max()) { + } + if (dom.min() == fst()->max()) { return static_cast(fst()->next(nullptr)->min()) - static_cast(dom.min()); - } else { - return 1U; } + return 1U; } forceinline unsigned int - IntVarImp::regret_max(void) const { + IntVarImp::regret_max() const { if (fst() == nullptr) { return (dom.min() == dom.max()) ? 0U : 1U; - } else if (dom.max() == lst()->min()) { + } + if (dom.max() == lst()->min()) { return static_cast(dom.max()) - static_cast(lst()->prev(nullptr)->max()); - } else { - return 1U; } + return 1U; } /* @@ -307,12 +307,12 @@ namespace Gecode { namespace Int { */ forceinline const IntVarImp::RangeList* - IntVarImp::ranges_fwd(void) const { + IntVarImp::ranges_fwd() const { return (fst() == nullptr) ? &dom : fst(); } forceinline const IntVarImp::RangeList* - IntVarImp::ranges_bwd(void) const { + IntVarImp::ranges_bwd() const { return (fst() == nullptr) ? &dom : lst(); } @@ -434,26 +434,26 @@ namespace Gecode { namespace Int { } forceinline bool - IntVarImpFwd::operator()(void) const { + IntVarImpFwd::operator()() const { return c != nullptr; } forceinline void - IntVarImpFwd::operator++(void) { + IntVarImpFwd::operator++() { const IntVarImp::RangeList* n = c->next(p); p = c; c = n; } forceinline int - IntVarImpFwd::min(void) const { + IntVarImpFwd::min() const { return c->min(); } forceinline int - IntVarImpFwd::max(void) const { + IntVarImpFwd::max() const { return c->max(); } forceinline unsigned int - IntVarImpFwd::width(void) const { + IntVarImpFwd::width() const { return c->width(); } @@ -472,26 +472,26 @@ namespace Gecode { namespace Int { } forceinline bool - IntVarImpBwd::operator()(void) const { + IntVarImpBwd::operator()() const { return c != nullptr; } forceinline void - IntVarImpBwd::operator++(void) { + IntVarImpBwd::operator++() { const IntVarImp::RangeList* p = c->prev(n); n = c; c = p; } forceinline int - IntVarImpBwd::min(void) const { + IntVarImpBwd::min() const { return c->min(); } forceinline int - IntVarImpBwd::max(void) const { + IntVarImpBwd::max() const { return c->max(); } forceinline unsigned int - IntVarImpBwd::width(void) const { + IntVarImpBwd::width() const { return c->width(); } @@ -1014,8 +1014,7 @@ namespace Gecode { namespace Int { holes = 0; if (assigned()) return notify(home, ME_INT_VAL, d); - else - return notify(home, ME_INT_BND, d); + return notify(home, ME_INT_BND, d); } // The number of removed values @@ -1061,6 +1060,6 @@ namespace Gecode { namespace Int { return IntVarImpBase::med(me); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-var diff --git a/gecode/int/var/bool.hpp b/gecode/int/var/bool.hpp index 72c16c9b38..4af02595d1 100644 --- a/gecode/int/var/bool.hpp +++ b/gecode/int/var/bool.hpp @@ -48,43 +48,43 @@ namespace Gecode { : VarImpVar(y.varimp()) {} forceinline int - BoolVar::val(void) const { + BoolVar::val() const { if (!x->assigned()) throw Int::ValOfUnassignedVar("BoolVar::val"); return x->val(); } forceinline int - BoolVar::min(void) const { + BoolVar::min() const { return x->min(); } forceinline int - BoolVar::med(void) const { + BoolVar::med() const { return x->med(); } forceinline int - BoolVar::max(void) const { + BoolVar::max() const { return x->max(); } forceinline unsigned int - BoolVar::width(void) const { + BoolVar::width() const { return x->width(); } forceinline unsigned int - BoolVar::size(void) const { + BoolVar::size() const { return x->size(); } forceinline unsigned int - BoolVar::regret_min(void) const { + BoolVar::regret_min() const { return x->regret_min(); } forceinline unsigned int - BoolVar::regret_max(void) const { + BoolVar::regret_max() const { return x->regret_max(); } forceinline bool - BoolVar::range(void) const { + BoolVar::range() const { return x->range(); } forceinline bool @@ -93,15 +93,15 @@ namespace Gecode { } forceinline bool - BoolVar::zero(void) const { + BoolVar::zero() const { return x->zero(); } forceinline bool - BoolVar::one(void) const { + BoolVar::one() const { return x->one(); } forceinline bool - BoolVar::none(void) const { + BoolVar::none() const { return x->none(); } diff --git a/gecode/int/var/int.hpp b/gecode/int/var/int.hpp index 34932bcab5..7f563a3008 100644 --- a/gecode/int/var/int.hpp +++ b/gecode/int/var/int.hpp @@ -47,43 +47,43 @@ namespace Gecode { : VarImpVar(y.varimp()) {} forceinline int - IntVar::val(void) const { + IntVar::val() const { if (!x->assigned()) throw Int::ValOfUnassignedVar("IntVar::val"); return x->val(); } forceinline int - IntVar::min(void) const { + IntVar::min() const { return x->min(); } forceinline int - IntVar::med(void) const { + IntVar::med() const { return x->med(); } forceinline int - IntVar::max(void) const { + IntVar::max() const { return x->max(); } forceinline unsigned int - IntVar::width(void) const { + IntVar::width() const { return x->width(); } forceinline unsigned int - IntVar::size(void) const { + IntVar::size() const { return x->size(); } forceinline unsigned int - IntVar::regret_min(void) const { + IntVar::regret_min() const { return x->regret_min(); } forceinline unsigned int - IntVar::regret_max(void) const { + IntVar::regret_max() const { return x->regret_max(); } forceinline bool - IntVar::range(void) const { + IntVar::range() const { return x->range(); } forceinline bool @@ -97,7 +97,7 @@ namespace Gecode { */ forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - IntVarRanges::IntVarRanges(void) {} + IntVarRanges::IntVarRanges() {} forceinline IntVarRanges::IntVarRanges(const IntVar& x) diff --git a/gecode/int/view-val-graph.hh b/gecode/int/view-val-graph.hh index 7504e22a96..e78cbed325 100644 --- a/gecode/int/view-val-graph.hh +++ b/gecode/int/view-val-graph.hh @@ -41,7 +41,7 @@ * \namespace Gecode::Int::ViewValGraph * \brief Support classes for propagators using a view-value graph */ -namespace Gecode { namespace Int { namespace ViewValGraph { +namespace Gecode::Int::ViewValGraph { /** * \brief Class for combining two pointers with a flag @@ -63,11 +63,11 @@ namespace Gecode { namespace Int { namespace ViewValGraph { /// Return the other pointer when \a p is given T* ptr(T* p) const; /// Check whether flag is set - int is_set(void) const; + int is_set() const; /// Set flag - void set(void); + void set(); /// Clear flag - void unset(void); + void unset(); }; /// Bidirectional links for edges and anchors in nodes of view-value graph @@ -80,11 +80,11 @@ namespace Gecode { namespace Int { namespace ViewValGraph { public: /// Initialize as empty (self referenced) - BiLink(void); + BiLink(); /// Return previous element - BiLink* prev(void) const; + BiLink* prev() const; /// Return next element - BiLink* next(void) const; + BiLink* next() const; /// Set previous element to \a l void prev(BiLink* l); /// Set next element to \a l @@ -92,13 +92,13 @@ namespace Gecode { namespace Int { namespace ViewValGraph { /// Add \a l after this element void add(BiLink* l); /// Unlink this element - void unlink(void); + void unlink(); /// Mark element (invalidates next element pointer) - void mark(void); + void mark(); /// Whether element is marked - bool marked(void) const; + bool marked() const; /// Whether element has no previous and next element - bool empty(void) const; + bool empty() const; }; template @@ -121,11 +121,11 @@ namespace Gecode { namespace Int { namespace ViewValGraph { /// Values for computing strongly connected components unsigned int low, min, comp; /// Initialize - Node(void); + Node(); /// Return first edge (organized by bi-links) - Edge* edge_fst(void) const; + Edge* edge_fst() const; /// Return last edge (organized by bi-links) - Edge* edge_lst(void) const; + Edge* edge_lst() const; /// Allocate memory from space static void* operator new(size_t, Space&); @@ -155,17 +155,17 @@ namespace Gecode { namespace Int { namespace ViewValGraph { /// Initialize with value \a v and successor \a n ValNode(int v, ValNode* n); /// Return value of node - int val(void) const; + int val() const; /// Set matching edge to \a m void matching(Edge* m); /// Return matching edge (nullptr if unmatched) - Edge* matching(void) const; + Edge* matching() const; /// Return pointer to next value node fields - ValNode** next_val_ref(void); + ValNode** next_val_ref(); /// Return next value node - ValNode* next_val(void) const; - /// Set next value node to \a v - void next_val(ValNode* v); + ValNode* next_val() const; + /// Set next value node to \a n + void next_val(ValNode* n); }; /** @@ -184,23 +184,23 @@ namespace Gecode { namespace Int { namespace ViewValGraph { public: /// Initialize node for a non-view - ViewNode(void); + ViewNode(); /// Initialize new node for view \a x ViewNode(View x); /// Return first edge of all value edges - Edge* val_edges(void) const; + Edge* val_edges() const; /// Return pointer to first edge fields of all value edges - Edge** val_edges_ref(void); + Edge** val_edges_ref(); /// Test whether node has a fake view - bool fake(void) const; + bool fake() const; /// Return view - View view(void) const; + View view() const; /// Update size of view after change - void update(void); + void update(); /// Return whether view has changed its size - bool changed(void) const; + bool changed() const; /// Whether the node is matched - bool matched(void) const; + bool matched() const; }; /** @@ -216,34 +216,34 @@ namespace Gecode { namespace Int { namespace ViewValGraph { CombPtrFlag> sd; public: - /// Construct new edge between \a x and \a v - Edge(ValNode* v, ViewNode* x); - /// Construct new edge between \a x and \a v with next edge \a n - Edge(ValNode* v, ViewNode* x, Edge* n); + /// Construct new edge between \a d and \a s + Edge(ValNode* s, ViewNode* d); + /// Construct new edge between \a d and \a s with next edge \a n + Edge(ValNode* s, ViewNode* d, Edge* n); /// Return destination of edge when source \a s is given Node* dst(Node* s) const; - /// Return view node when value node \a v is given - ViewNode* view(ValNode* v) const; + /// Return view node when value node \a n is given + ViewNode* view(ValNode* n) const; /// Return value node when view node \a x is given ValNode* val(ViewNode* x) const; /// Whether edge is used (marked or between nodes from the same scc) bool used(Node* v) const; /// Mark node as used - void use(void); + void use(); /// Unmark node as used - void free(void); + void free(); /// Revert edge to node \a d for matching void revert(Node* d); /// Return next edge in list of value edges - Edge* next_edge(void) const; + Edge* next_edge() const; /// Return reference to next edge in list of value edges - Edge** next_edge_ref(void); + Edge** next_edge_ref(); /// Return next edge in list of edges per node - Edge* next(void) const; + Edge* next() const; /// Allocate memory from space static void* operator new(size_t, Space&); @@ -265,26 +265,26 @@ namespace Gecode { namespace Int { namespace ViewValGraph { public: /// \name Constructors and initialization //@{ - /// Initialize with edges for view node \a x - IterPruneVal(ViewNode* x); + /// Initialize with edges for view node \a y + IterPruneVal(ViewNode* y); //@} /// \name Iteration control //@{ /// Test whether iterator is still at a value or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next value (if possible) - void operator++(void); + void operator++(); //@} /// \name Value access //@{ /// Return current value - int val(void) const; + int val() const; //@} }; -}}} // namespace Gecode::Int::ViewValGraph +} // namespace Gecode::Int::ViewValGraph #include #include @@ -292,7 +292,7 @@ namespace Gecode { namespace Int { namespace ViewValGraph { #include #include -namespace Gecode { namespace Int { namespace ViewValGraph { +namespace Gecode::Int::ViewValGraph { /// View-value graph base class template @@ -309,24 +309,24 @@ namespace Gecode { namespace Int { namespace ViewValGraph { /// Marking counter unsigned int count; /// Stack used during matching - typedef Support::StaticStack*, Region> ViewNodeStack; + using ViewNodeStack = Support::StaticStack*, Region>; /// Initialize the edges for the view node \a x void init(Space& home, ViewNode* x); /// Find a matching for node \a x bool match(ViewNodeStack& m, ViewNode* x); /// Compute the strongly connected components - void scc(void); + void scc(); public: /// Construct graph as not yet initialized - Graph(void); + Graph(); /// Test whether graph has been initialized - operator bool(void) const; + operator bool() const; /// Purge graph if necessary (reset information to avoid overflow) - void purge(void); + void purge(); }; -}}} // namespace Gecode::Int::ViewValGraph +} // namespace Gecode::Int::ViewValGraph #include diff --git a/gecode/int/view-val-graph/bi-link.hpp b/gecode/int/view-val-graph/bi-link.hpp index c7d706fdfa..710b34155d 100644 --- a/gecode/int/view-val-graph/bi-link.hpp +++ b/gecode/int/view-val-graph/bi-link.hpp @@ -30,20 +30,20 @@ * */ -namespace Gecode { namespace Int { namespace ViewValGraph { +namespace Gecode::Int::ViewValGraph { forceinline - BiLink::BiLink(void) { + BiLink::BiLink() { _prev = this; _next = this; } forceinline BiLink* - BiLink::prev(void) const { + BiLink::prev() const { return _prev; } forceinline BiLink* - BiLink::next(void) const { + BiLink::next() const { return _next; } forceinline void @@ -63,7 +63,7 @@ namespace Gecode { namespace Int { namespace ViewValGraph { _next = l; } forceinline void - BiLink::unlink(void) { + BiLink::unlink() { BiLink* p = _prev; BiLink* n = _next; p->_next = n; @@ -71,18 +71,18 @@ namespace Gecode { namespace Int { namespace ViewValGraph { } forceinline void - BiLink::mark(void) { + BiLink::mark() { _next = nullptr; } forceinline bool - BiLink::marked(void) const { + BiLink::marked() const { return _next == nullptr; } forceinline bool - BiLink::empty(void) const { + BiLink::empty() const { return _prev == this; } -}}} // namespace Gecode::Int::ViewValGraph +} // namespace Gecode::Int::ViewValGraph // STATISTICS: int-prop diff --git a/gecode/int/view-val-graph/comb-ptr-flag.hpp b/gecode/int/view-val-graph/comb-ptr-flag.hpp index 9f560095cf..40209d7410 100644 --- a/gecode/int/view-val-graph/comb-ptr-flag.hpp +++ b/gecode/int/view-val-graph/comb-ptr-flag.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace ViewValGraph { +namespace Gecode::Int::ViewValGraph { template forceinline @@ -46,19 +46,19 @@ namespace Gecode { namespace Int { namespace ViewValGraph { template forceinline int - CombPtrFlag::is_set(void) const { + CombPtrFlag::is_set() const { return static_cast(cpf & 0b1); } template forceinline void - CombPtrFlag::set(void) { + CombPtrFlag::set() { cpf |= 0b1; } template forceinline void - CombPtrFlag::unset(void) { + CombPtrFlag::unset() { cpf &= ~static_cast(0b1); } @@ -68,6 +68,6 @@ namespace Gecode { namespace Int { namespace ViewValGraph { cpf = reinterpret_cast(p1) ^ reinterpret_cast(p2); } -}}} // namespace Gecode::Int::ViewValGraph +} // namespace Gecode::Int::ViewValGraph // STATISTICS: int-prop diff --git a/gecode/int/view-val-graph/edge.hpp b/gecode/int/view-val-graph/edge.hpp index 8f88fc8967..b40ca26bd1 100644 --- a/gecode/int/view-val-graph/edge.hpp +++ b/gecode/int/view-val-graph/edge.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace ViewValGraph { +namespace Gecode::Int::ViewValGraph { template forceinline @@ -76,28 +76,28 @@ namespace Gecode { namespace Int { namespace ViewValGraph { } template forceinline void - Edge::use(void) { + Edge::use() { sd.set(); } template forceinline void - Edge::free(void) { + Edge::free() { sd.unset(); } template forceinline Edge* - Edge::next_edge(void) const { + Edge::next_edge() const { return _next_edge; } template forceinline Edge** - Edge::next_edge_ref(void) { + Edge::next_edge_ref() { return &_next_edge; } template forceinline Edge* - Edge::next(void) const { + Edge::next() const { return static_cast*>(BiLink::next()); } @@ -113,6 +113,6 @@ namespace Gecode { namespace Int { namespace ViewValGraph { return home.ralloc(s); } -}}} // namespace Gecode::Int::ViewValGraph +} // namespace Gecode::Int::ViewValGraph // STATISTICS: int-prop diff --git a/gecode/int/view-val-graph/graph.hpp b/gecode/int/view-val-graph/graph.hpp index a1c8c7ef64..9788e43159 100644 --- a/gecode/int/view-val-graph/graph.hpp +++ b/gecode/int/view-val-graph/graph.hpp @@ -32,16 +32,16 @@ #include -namespace Gecode { namespace Int { namespace ViewValGraph { +namespace Gecode::Int::ViewValGraph { template forceinline - Graph::Graph(void) + Graph::Graph() : view(nullptr), val(nullptr), n_view(0), n_val(0), count(1U) {} template forceinline Graph:: - operator bool(void) const { + operator bool() const { return view != nullptr; } @@ -136,7 +136,7 @@ namespace Gecode { namespace Int { namespace ViewValGraph { template forceinline void - Graph::purge(void) { + Graph::purge() { if (count > (UINT_MAX >> 1)) { count = 1; for (int i = 0; i < n_view; i++) @@ -148,7 +148,7 @@ namespace Gecode { namespace Int { namespace ViewValGraph { template forceinline void - Graph::scc(void) { + Graph::scc() { Region r; Support::StaticStack*, Region> scc(r, n_val + n_view); @@ -204,6 +204,6 @@ namespace Gecode { namespace Int { namespace ViewValGraph { count = cnt0 + 1; } -}}} // namespace Gecode::Int::ViewValGraph +} // namespace Gecode::Int::ViewValGraph // STATISTICS: int-prop diff --git a/gecode/int/view-val-graph/iter-prune-val.hpp b/gecode/int/view-val-graph/iter-prune-val.hpp index bb65256371..4a93e521be 100644 --- a/gecode/int/view-val-graph/iter-prune-val.hpp +++ b/gecode/int/view-val-graph/iter-prune-val.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace ViewValGraph { +namespace Gecode::Int::ViewValGraph { template forceinline @@ -41,12 +41,12 @@ namespace Gecode { namespace Int { namespace ViewValGraph { } template forceinline bool - IterPruneVal::operator()(void) const { + IterPruneVal::operator()() const { return e != nullptr; } template forceinline void - IterPruneVal::operator++(void) { + IterPruneVal::operator++() { assert(!e->used(x)); do { e = e->next_edge(); @@ -54,11 +54,11 @@ namespace Gecode { namespace Int { namespace ViewValGraph { } template forceinline int - IterPruneVal::val(void) const { + IterPruneVal::val() const { assert(!e->used(x)); return e->val(x)->val(); } -}}} // namespace Gecode::Int::ViewValGraph +} // namespace Gecode::Int::ViewValGraph // STATISTICS: int-prop diff --git a/gecode/int/view-val-graph/node.hpp b/gecode/int/view-val-graph/node.hpp index 245ca8bd81..4c1ed18c72 100644 --- a/gecode/int/view-val-graph/node.hpp +++ b/gecode/int/view-val-graph/node.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { namespace ViewValGraph { +namespace Gecode::Int::ViewValGraph { /* * Nodes @@ -39,18 +39,18 @@ namespace Gecode { namespace Int { namespace ViewValGraph { template forceinline - Node::Node(void) + Node::Node() : min(0) { // Must be initialized such that the node is considered unvisited initially } template forceinline Edge* - Node::edge_fst(void) const { + Node::edge_fst() const { return static_cast*>(BiLink::next()); } template forceinline Edge* - Node::edge_lst(void) const { + Node::edge_lst() const { return static_cast*>(static_cast(const_cast*>(this))); } template @@ -80,7 +80,7 @@ namespace Gecode { namespace Int { namespace ViewValGraph { : _val(v), _matching(nullptr), _next_val(n) {} template forceinline int - ValNode::val(void) const { + ValNode::val() const { return _val; } template @@ -90,17 +90,17 @@ namespace Gecode { namespace Int { namespace ViewValGraph { } template forceinline Edge* - ValNode::matching(void) const { + ValNode::matching() const { return _matching; } template forceinline ValNode** - ValNode::next_val_ref(void) { + ValNode::next_val_ref() { return &_next_val; } template forceinline ValNode* - ValNode::next_val(void) const { + ValNode::next_val() const { return _next_val; } template @@ -116,7 +116,7 @@ namespace Gecode { namespace Int { namespace ViewValGraph { template forceinline - ViewNode::ViewNode(void) + ViewNode::ViewNode() : _view(View(nullptr)) {} template forceinline @@ -124,40 +124,40 @@ namespace Gecode { namespace Int { namespace ViewValGraph { : _size(x.size()), _view(x) {} template forceinline Edge* - ViewNode::val_edges(void) const { + ViewNode::val_edges() const { return _val_edges; } template forceinline Edge** - ViewNode::val_edges_ref(void) { + ViewNode::val_edges_ref() { return &_val_edges; } template forceinline bool - ViewNode::fake(void) const { + ViewNode::fake() const { return _view.varimp() == nullptr; } template forceinline View - ViewNode::view(void) const { + ViewNode::view() const { return _view; } template forceinline bool - ViewNode::changed(void) const { + ViewNode::changed() const { return _size != _view.size(); } template forceinline void - ViewNode::update(void) { + ViewNode::update() { _size = _view.size(); } template forceinline bool - ViewNode::matched(void) const { + ViewNode::matched() const { return Node::edge_fst() != Node::edge_lst(); } -}}} // namespace Gecode::Int::ViewValGraph +} // namespace Gecode::Int::ViewValGraph // STATISTICS: int-prop diff --git a/gecode/int/view.hpp b/gecode/int/view.hpp index 0ccdf94ade..7dea760726 100644 --- a/gecode/int/view.hpp +++ b/gecode/int/view.hpp @@ -36,7 +36,7 @@ #include -namespace Gecode { namespace Int { +namespace Gecode::Int { /** * \brief Range iterator for integer views @@ -55,7 +55,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - ViewRanges(void); + ViewRanges(); /// Initialize with ranges for view \a x ViewRanges(const View& x); /// Initialize with ranges for view \a x @@ -65,19 +65,19 @@ namespace Gecode { namespace Int { /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of range (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; @@ -95,7 +95,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - ViewValues(void) = default; + ViewValues() = default; /// Initialize with values for \a x ViewValues(const View& x); /// Initialize with values \a x @@ -103,11 +103,11 @@ namespace Gecode { namespace Int { //@} }; -}} // namespace Gecode::Int +} // namespace Gecode::Int #include -namespace Gecode { namespace Int { +namespace Gecode::Int { /** * \defgroup TaskActorIntView Integer views @@ -133,7 +133,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - IntView(void) = default; + IntView() = default; /// Initialize from integer variable \a y IntView(const IntVar& y); /// Initialize from integer variable \a y @@ -143,32 +143,32 @@ namespace Gecode { namespace Int { /// \name Value access //@{ /// Return minimum of domain - int min(void) const; + int min() const; /// Return maximum of domain - int max(void) const; + int max() const; /// Return median of domain (greatest element not greater than the median) - int med(void) const; + int med() const; /// Return assigned value (only if assigned) - int val(void) const; + int val() const; #ifdef GECODE_HAS_CBS /// Return reverse transformation of value according to view int base_value(int val) const; #endif /// Return size (cardinality) of domain - unsigned int size(void) const; + unsigned int size() const; /// Return width of domain (distance between maximum and minimum) - unsigned int width(void) const; + unsigned int width() const; /// Return regret of domain minimum (distance to next larger value) - unsigned int regret_min(void) const; + unsigned int regret_min() const; /// Return regret of domain maximum (distance to next smaller value) - unsigned int regret_max(void) const; + unsigned int regret_max() const; //@} /// \name Domain tests //@{ /// Test whether domain is a range - bool range(void) const; + bool range() const; /// Test whether \a n is contained in domain bool in(int n) const; @@ -285,7 +285,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - MinusView(void) = default; + MinusView() = default; /// Initialize with integer view \a y explicit MinusView(const IntView& y); //@} @@ -293,32 +293,32 @@ namespace Gecode { namespace Int { /// \name Value access //@{ /// Return minimum of domain - int min(void) const; + int min() const; /// Return maximum of domain - int max(void) const; + int max() const; /// Return median of domain - int med(void) const; + int med() const; /// Return assigned value (only if assigned) - int val(void) const; + int val() const; #ifdef GECODE_HAS_CBS /// Return reverse transformation of value according to view int base_value(int val) const; #endif /// Return size (cardinality) of domain - unsigned int size(void) const; + unsigned int size() const; /// Return width of domain (distance between maximum and minimum) - unsigned int width(void) const; + unsigned int width() const; /// Return regret of domain minimum (distance to next larger value) - unsigned int regret_min(void) const; + unsigned int regret_min() const; /// Return regret of domain maximum (distance to next smaller value) - unsigned int regret_max(void) const; + unsigned int regret_max() const; //@} /// \name Domain tests //@{ /// Test whether domain is a range - bool range(void) const; + bool range() const; /// Test whether \a n is contained in domain bool in(int n) const; @@ -445,44 +445,44 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - OffsetView(void); - /// Initialize with integer view \a y and offset \a c - OffsetView(const IntView& y, int c); + OffsetView(); + /// Initialize with integer view \a y and offset \a d + OffsetView(const IntView& y, int d); //@} /// \name Value access //@{ /// Return offset - int offset(void) const; + int offset() const; /// Change offset to \a n void offset(int n); /// Return minimum of domain - int min(void) const; + int min() const; /// Return maximum of domain - int max(void) const; + int max() const; /// Return median of domain (greatest element not greater than the median) - int med(void) const; + int med() const; /// Return assigned value (only if assigned) - int val(void) const; + int val() const; #ifdef GECODE_HAS_CBS /// Return reverse transformation of value according to view int base_value(int val) const; #endif /// Return size (cardinality) of domain - unsigned int size(void) const; + unsigned int size() const; /// Return width of domain (distance between maximum and minimum) - unsigned int width(void) const; + unsigned int width() const; /// Return regret of domain minimum (distance to next larger value) - unsigned int regret_min(void) const; + unsigned int regret_min() const; /// Return regret of domain maximum (distance to next smaller value) - unsigned int regret_max(void) const; + unsigned int regret_max() const; //@} /// \name Domain tests //@{ /// Test whether domain is a range - bool range(void) const; + bool range() const; /// Test whether \a n is contained in domain bool in(int n) const; @@ -610,13 +610,13 @@ namespace Gecode { namespace Int { class NoOffset { public: /// The view type - typedef View ViewType; + using ViewType = View; /// Pass through \a x View& operator()(View& x); /// Update during cloning void update(const NoOffset&); /// Access offset - int offset(void) const; + int offset() const; }; template @@ -631,7 +631,7 @@ namespace Gecode { namespace Int { template forceinline int - NoOffset::offset(void) const { + NoOffset::offset() const { return 0; } @@ -641,7 +641,7 @@ namespace Gecode { namespace Int { class Offset { public: /// The view type - typedef OffsetView ViewType; + using ViewType = OffsetView; /// The offset int c; /// Constructor with offset \a off @@ -651,7 +651,7 @@ namespace Gecode { namespace Int { /// Update during cloning void update(const Offset& o); /// Access offset - int offset(void) const; + int offset() const; }; forceinline @@ -664,7 +664,7 @@ namespace Gecode { namespace Int { } forceinline int - Offset::offset(void) const { + Offset::offset() const { return c; } @@ -707,7 +707,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - ScaleView(void); + ScaleView(); /// Initialize as \f$b\cdot y\f$ ScaleView(int b, const IntView& y); //@} @@ -715,34 +715,34 @@ namespace Gecode { namespace Int { /// \name Value access //@{ /// Return scale factor of scale view - int scale(void) const; + int scale() const; /// Return minimum of domain - Val min(void) const; + Val min() const; /// Return maximum of domain - Val max(void) const; + Val max() const; /// Return median of domain (greatest element not greater than the median) - Val med(void) const; + Val med() const; /// Return assigned value (only if assigned) - Val val(void) const; + Val val() const; #ifdef GECODE_HAS_CBS /// Return reverse transformation of value according to view Val base_value(Val val) const; #endif /// Return size (cardinality) of domain - UnsVal size(void) const; + UnsVal size() const; /// Return width of domain (distance between maximum and minimum) - UnsVal width(void) const; + UnsVal width() const; /// Return regret of domain minimum (distance to next larger value) - UnsVal regret_min(void) const; + UnsVal regret_min() const; /// Return regret of domain maximum (distance to next smaller value) - UnsVal regret_max(void) const; + UnsVal regret_max() const; //@} /// \name Domain tests //@{ /// Test whether domain is a range - bool range(void) const; + bool range() const; /// Test whether \a n is contained in domain bool in(Val n) const; //@} @@ -798,13 +798,13 @@ namespace Gecode { namespace Int { * \brief Integer-precision integer scale view * \ingroup TaskActorIntView */ - typedef ScaleView IntScaleView; + using IntScaleView = ScaleView; /** * \brief Long long-precision integer scale view * \ingroup TaskActorIntView */ - typedef ScaleView LLongScaleView; + using LLongScaleView = ScaleView; /** * \brief Print integer-precision integer scale view @@ -843,7 +843,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - ConstIntView(void); + ConstIntView(); /// Initialize with integer value \a n ConstIntView(int n); //@} @@ -851,28 +851,28 @@ namespace Gecode { namespace Int { /// \name Value access //@{ /// Return minimum of domain - int min(void) const; + int min() const; /// Return maximum of domain - int max(void) const; + int max() const; /// Return median of domain (greatest element not greater than the median) - int med(void) const; + int med() const; /// Return assigned value (only if assigned) - int val(void) const; + int val() const; /// Return size (cardinality) of domain - unsigned int size(void) const; + unsigned int size() const; /// Return width of domain (distance between maximum and minimum) - unsigned int width(void) const; + unsigned int width() const; /// Return regret of domain minimum (distance to next larger value) - unsigned int regret_min(void) const; + unsigned int regret_min() const; /// Return regret of domain maximum (distance to next smaller value) - unsigned int regret_max(void) const; + unsigned int regret_max() const; //@} /// \name Domain tests //@{ /// Test whether domain is a range - bool range(void) const; + bool range() const; /// Test whether \a n is contained in domain bool in(int n) const; /// Test whether \a n is contained in domain @@ -998,34 +998,34 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - ZeroIntView(void) = default; + ZeroIntView() = default; //@} /// \name Value access //@{ /// Return minimum of domain - int min(void) const; + int min() const; /// Return maximum of domain - int max(void) const; + int max() const; /// Return median of domain (greatest element not greater than the median) - int med(void) const; + int med() const; /// Return assigned value (only if assigned) - int val(void) const; + int val() const; /// Return size (cardinality) of domain - unsigned int size(void) const; + unsigned int size() const; /// Return width of domain (distance between maximum and minimum) - unsigned int width(void) const; + unsigned int width() const; /// Return regret of domain minimum (distance to next larger value) - unsigned int regret_min(void) const; + unsigned int regret_min() const; /// Return regret of domain maximum (distance to next smaller value) - unsigned int regret_max(void) const; + unsigned int regret_max() const; //@} /// \name Domain tests //@{ /// Test whether domain is a range - bool range(void) const; + bool range() const; /// Test whether \a n is contained in domain bool in(int n) const; /// Test whether \a n is contained in domain @@ -1157,7 +1157,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - CachedView(void); + CachedView(); /// Initialize with integer view \a y explicit CachedView(const View& y); //@} @@ -1165,32 +1165,32 @@ namespace Gecode { namespace Int { /// \name Value access //@{ /// Return minimum of domain - int min(void) const; + int min() const; /// Return maximum of domain - int max(void) const; + int max() const; /// Return median of domain (greatest element not greater than the median) - int med(void) const; + int med() const; /// Return assigned value (only if assigned) - int val(void) const; + int val() const; #ifdef GECODE_HAS_CBS /// Return reverse transformation of value according to view int base_value(int val) const; #endif /// Return size (cardinality) of domain - unsigned int size(void) const; + unsigned int size() const; /// Return width of domain (distance between maximum and minimum) - unsigned int width(void) const; + unsigned int width() const; /// Return regret of domain minimum (distance to next larger value) - unsigned int regret_min(void) const; + unsigned int regret_min() const; /// Return regret of domain maximum (distance to next smaller value) - unsigned int regret_max(void) const; + unsigned int regret_max() const; //@} /// \name Domain tests //@{ /// Test whether domain is a range - bool range(void) const; + bool range() const; /// Test whether \a n is contained in domain bool in(int n) const; @@ -1291,7 +1291,7 @@ namespace Gecode { namespace Int { /// Update cache to current domain void cache(Space& home); /// Check whether cache differs from current domain - bool modified(void) const; + bool modified() const; //@} /// \name Cloning @@ -1326,7 +1326,7 @@ namespace Gecode { namespace Int { */ template class ViewDiffRanges : public Iter::Ranges::Diff> { - typedef Iter::Ranges::Diff> Super; + using Super = Iter::Ranges::Diff>; protected: /// Cached domain iterator @@ -1338,7 +1338,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - ViewDiffRanges(void) = default; + ViewDiffRanges() = default; /// Initialize with ranges for view \a x ViewDiffRanges(const CachedView& x); /// Initialize with ranges for view \a x @@ -1360,7 +1360,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - BoolView(void) = default; + BoolView() = default; /// Initialize from Boolean variable \a y BoolView(const BoolVar& y); /// Initialize from Boolean variable implementation \a y @@ -1378,38 +1378,38 @@ namespace Gecode { namespace Int { /// Status of domain not yet assigned static const BoolStatus unassigned_status = BoolVarImp::unassigned_status; /// Return current domain status - BoolStatus status(void) const; + BoolStatus status() const; //@} /// \name Value access //@{ /// Return minimum of domain - int min(void) const; + int min() const; /// Return maximum of domain - int max(void) const; + int max() const; /// Return median of domain (greatest element not greater than the median) - int med(void) const; + int med() const; /// Return assigned value (only if assigned) - int val(void) const; + int val() const; #ifdef GECODE_HAS_CBS /// Return reverse transformation of value according to view int base_value(int val) const; #endif /// Return size (cardinality) of domain - unsigned int size(void) const; + unsigned int size() const; /// Return width of domain (distance between maximum and minimum) - unsigned int width(void) const; + unsigned int width() const; /// Return regret of domain minimum (distance to next larger value) - unsigned int regret_min(void) const; + unsigned int regret_min() const; /// Return regret of domain maximum (distance to next smaller value) - unsigned int regret_max(void) const; + unsigned int regret_max() const; //@} /// \name Domain tests //@{ /// Test whether domain is a range - bool range(void) const; + bool range() const; /// Test whether \a n is contained in domain bool in(int n) const; /// Test whether \a n is contained in domain @@ -1419,11 +1419,11 @@ namespace Gecode { namespace Int { /// \name Boolean domain tests //@{ /// Test whether view is assigned to be zero - bool zero(void) const; + bool zero() const; /// Test whether view is assigned to be one - bool one(void) const; + bool one() const; /// Test whether view is not yet assigned - bool none(void) const; + bool none() const; //@} /// \name Boolean assignment operations @@ -1552,7 +1552,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - NegBoolView(void) = default; + NegBoolView() = default; /// Initialize with Boolean view \a y explicit NegBoolView(const BoolView& y); //@} @@ -1568,17 +1568,17 @@ namespace Gecode { namespace Int { /// Status of domain not yet assigned static const BoolStatus unassigned_status = BoolView::unassigned_status; /// Return current domain status - BoolStatus status(void) const; + BoolStatus status() const; //@} /// \name Boolean domain tests //@{ /// Test whether view is assigned to be zero - bool zero(void) const; + bool zero() const; /// Test whether view is assigned to be one - bool one(void) const; + bool one() const; /// Test whether view is not yet assigned - bool none(void) const; + bool none() const; //@} /// \name Boolean assignment operations @@ -1629,11 +1629,11 @@ namespace Gecode { namespace Int { /// \name Value access //@{ /// Return minimum of domain - int min(void) const; + int min() const; /// Return maximum of domain - int max(void) const; + int max() const; /// Return assigned value (only if assigned) - int val(void) const; + int val() const; #ifdef GECODE_HAS_CBS /// Return reverse transformation of value according to view int base_value(int val) const; @@ -1671,7 +1671,7 @@ namespace Gecode { namespace Int { template std::basic_ostream& operator<<(std::basic_ostream& os, const NegBoolView& x); -}} // namespace Gecode::Int +} // namespace Gecode::Int #include #include @@ -1692,7 +1692,7 @@ namespace Gecode { namespace Int { #include #include -namespace Gecode { namespace Int { +namespace Gecode::Int { /** * \defgroup TaskActorIntTest Testing relations between integer views @@ -1789,7 +1789,7 @@ namespace Gecode { namespace Int { BoolTest bool_test(const NegBoolView& b0, const NegBoolView& b1); //@} -}} // namespace Gecode::Int +} // namespace Gecode::Int #include #include diff --git a/gecode/int/view/bool-test.hpp b/gecode/int/view/bool-test.hpp index 88059d8d9f..469617a635 100644 --- a/gecode/int/view/bool-test.hpp +++ b/gecode/int/view/bool-test.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { /* * Test sharing between Boolean and negated Boolean views @@ -53,6 +53,6 @@ namespace Gecode { namespace Int { return (b0 == b1) ? BT_SAME : BT_NONE; } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-var diff --git a/gecode/int/view/bool.hpp b/gecode/int/view/bool.hpp index c64b4f1a7d..069d5fe440 100644 --- a/gecode/int/view/bool.hpp +++ b/gecode/int/view/bool.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { /* * Constructors and initialization @@ -52,23 +52,23 @@ namespace Gecode { namespace Int { * */ forceinline BoolStatus - BoolView::status(void) const { + BoolView::status() const { return x->status(); } forceinline int - BoolView::min(void) const { + BoolView::min() const { return x->min(); } forceinline int - BoolView::max(void) const { + BoolView::max() const { return x->max(); } forceinline int - BoolView::med(void) const { + BoolView::med() const { return x->med(); } forceinline int - BoolView::val(void) const { + BoolView::val() const { return x->val(); } #ifdef GECODE_HAS_CBS @@ -79,19 +79,19 @@ namespace Gecode { namespace Int { #endif forceinline unsigned int - BoolView::size(void) const { + BoolView::size() const { return x->size(); } forceinline unsigned int - BoolView::width(void) const { + BoolView::width() const { return x->width(); } forceinline unsigned int - BoolView::regret_min(void) const { + BoolView::regret_min() const { return x->regret_min(); } forceinline unsigned int - BoolView::regret_max(void) const { + BoolView::regret_max() const { return x->regret_max(); } @@ -100,7 +100,7 @@ namespace Gecode { namespace Int { * */ forceinline bool - BoolView::range(void) const { + BoolView::range() const { return x->range(); } forceinline bool @@ -210,15 +210,15 @@ namespace Gecode { namespace Int { * */ forceinline bool - BoolView::zero(void) const { + BoolView::zero() const { return x->zero(); } forceinline bool - BoolView::one(void) const { + BoolView::one() const { return x->one(); } forceinline bool - BoolView::none(void) const { + BoolView::none() const { return x->none(); } @@ -288,7 +288,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - ViewRanges(void) = default; + ViewRanges() = default; /// Initialize with ranges for view \a x ViewRanges(const BoolView& x); /// Initialize with ranges for view \a x @@ -305,6 +305,6 @@ namespace Gecode { namespace Int { Iter::Ranges::Singleton::init(x.min(), x.max()); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-var diff --git a/gecode/int/view/cached.hpp b/gecode/int/view/cached.hpp index a9028fbbb2..e294de23b0 100644 --- a/gecode/int/view/cached.hpp +++ b/gecode/int/view/cached.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { /* * Constructors and initialization @@ -42,7 +42,7 @@ namespace Gecode { namespace Int { */ template forceinline - CachedView::CachedView(void) + CachedView::CachedView() : _size(0) {} template forceinline @@ -55,22 +55,22 @@ namespace Gecode { namespace Int { */ template forceinline int - CachedView::min(void) const { + CachedView::min() const { return x.min(); } template forceinline int - CachedView::max(void) const { + CachedView::max() const { return x.max(); } template forceinline int - CachedView::med(void) const { + CachedView::med() const { return x.med(); } template forceinline int - CachedView::val(void) const { + CachedView::val() const { return x.val(); } #ifdef GECODE_HAS_CBS @@ -83,22 +83,22 @@ namespace Gecode { namespace Int { template forceinline unsigned int - CachedView::width(void) const { + CachedView::width() const { return x.width(); } template forceinline unsigned int - CachedView::size(void) const { + CachedView::size() const { return x.size(); } template forceinline unsigned int - CachedView::regret_min(void) const { + CachedView::regret_min() const { return x.regret_min(); } template forceinline unsigned int - CachedView::regret_max(void) const { + CachedView::regret_max() const { return x.regret_max(); } @@ -108,7 +108,7 @@ namespace Gecode { namespace Int { */ template forceinline bool - CachedView::range(void) const { + CachedView::range() const { return x.range(); } template @@ -320,7 +320,7 @@ namespace Gecode { namespace Int { template forceinline bool - CachedView::modified(void) const { + CachedView::modified() const { return x.size() != _size; } @@ -334,7 +334,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - ViewRanges(void) = default; + ViewRanges() = default; /// Initialize with ranges for view \a x ViewRanges(const CachedView& x); /// Initialize with ranges for view \a x @@ -379,6 +379,6 @@ namespace Gecode { namespace Int { return x.base() == y.base(); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-var diff --git a/gecode/int/view/constint.hpp b/gecode/int/view/constint.hpp index f368123042..7741dc71dd 100644 --- a/gecode/int/view/constint.hpp +++ b/gecode/int/view/constint.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { /* * Constructors and initialization @@ -38,7 +38,7 @@ namespace Gecode { namespace Int { */ forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - ConstIntView::ConstIntView(void) {} + ConstIntView::ConstIntView() {} forceinline ConstIntView::ConstIntView(int n) : x(n) {} @@ -48,36 +48,36 @@ namespace Gecode { namespace Int { * */ forceinline int - ConstIntView::min(void) const { + ConstIntView::min() const { return x; } forceinline int - ConstIntView::max(void) const { + ConstIntView::max() const { return x; } forceinline int - ConstIntView::med(void) const { + ConstIntView::med() const { return x; } forceinline int - ConstIntView::val(void) const { + ConstIntView::val() const { return x; } forceinline unsigned int - ConstIntView::size(void) const { + ConstIntView::size() const { return 1; } forceinline unsigned int - ConstIntView::width(void) const { + ConstIntView::width() const { return 1; } forceinline unsigned int - ConstIntView::regret_min(void) const { + ConstIntView::regret_min() const { return 0; } forceinline unsigned int - ConstIntView::regret_max(void) const { + ConstIntView::regret_max() const { return 0; } @@ -86,7 +86,7 @@ namespace Gecode { namespace Int { * */ forceinline bool - ConstIntView::range(void) const { + ConstIntView::range() const { return true; } forceinline bool @@ -253,7 +253,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - ViewRanges(void) = default; + ViewRanges() = default; /// Initialize with ranges for view \a x ViewRanges(const ConstIntView& x); /// Initialize with ranges for view \a x @@ -263,19 +263,19 @@ namespace Gecode { namespace Int { /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of ranges (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; @@ -284,24 +284,24 @@ namespace Gecode { namespace Int { : n(x.val()) {} forceinline bool - ViewRanges::operator()(void) const { + ViewRanges::operator()() const { return n <= Limits::max; } forceinline void - ViewRanges::operator++(void) { + ViewRanges::operator++() { n = Limits::max + 1; } forceinline int - ViewRanges::min(void) const { + ViewRanges::min() const { return n; } forceinline int - ViewRanges::max(void) const { + ViewRanges::max() const { return n; } forceinline unsigned int - ViewRanges::width(void) const { + ViewRanges::width() const { return 1; } @@ -314,6 +314,6 @@ namespace Gecode { namespace Int { return x.min() == y.min(); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-var diff --git a/gecode/int/view/int.hpp b/gecode/int/view/int.hpp index 0becb7d596..b3ef6a3271 100644 --- a/gecode/int/view/int.hpp +++ b/gecode/int/view/int.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { /* * Constructors and initialization @@ -52,19 +52,19 @@ namespace Gecode { namespace Int { * */ forceinline int - IntView::min(void) const { + IntView::min() const { return x->min(); } forceinline int - IntView::max(void) const { + IntView::max() const { return x->max(); } forceinline int - IntView::med(void) const { + IntView::med() const { return x->med(); } forceinline int - IntView::val(void) const { + IntView::val() const { return x->val(); } #ifdef GECODE_HAS_CBS @@ -75,19 +75,19 @@ namespace Gecode { namespace Int { #endif forceinline unsigned int - IntView::size(void) const { + IntView::size() const { return x->size(); } forceinline unsigned int - IntView::width(void) const { + IntView::width() const { return x->width(); } forceinline unsigned int - IntView::regret_min(void) const { + IntView::regret_min() const { return x->regret_min(); } forceinline unsigned int - IntView::regret_max(void) const { + IntView::regret_max() const { return x->regret_max(); } @@ -96,7 +96,7 @@ namespace Gecode { namespace Int { * */ forceinline bool - IntView::range(void) const { + IntView::range() const { return x->range(); } forceinline bool @@ -237,7 +237,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - ViewRanges(void); + ViewRanges(); /// Initialize with ranges for view \a x ViewRanges(const IntView& x); /// Initialize with ranges for view \a x @@ -247,7 +247,7 @@ namespace Gecode { namespace Int { forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - ViewRanges::ViewRanges(void) {} + ViewRanges::ViewRanges() {} forceinline ViewRanges::ViewRanges(const IntView& x) @@ -258,6 +258,6 @@ namespace Gecode { namespace Int { IntVarImpFwd::init(x.varimp()); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-var diff --git a/gecode/int/view/iter.hpp b/gecode/int/view/iter.hpp index d1c4b6df6e..fb1072b636 100644 --- a/gecode/int/view/iter.hpp +++ b/gecode/int/view/iter.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { template forceinline @@ -50,6 +50,6 @@ namespace Gecode { namespace Int { Iter::Ranges::ToValues>::init(r); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-var diff --git a/gecode/int/view/minus.hpp b/gecode/int/view/minus.hpp index 0dc85a15bc..b47d4e8631 100644 --- a/gecode/int/view/minus.hpp +++ b/gecode/int/view/minus.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { /* * Constructors and initialization @@ -49,15 +49,15 @@ namespace Gecode { namespace Int { * */ forceinline int - MinusView::min(void) const { + MinusView::min() const { return -x.max(); } forceinline int - MinusView::max(void) const { + MinusView::max() const { return -x.min(); } forceinline int - MinusView::val(void) const { + MinusView::val() const { return -x.val(); } #ifdef GECODE_HAS_CBS @@ -68,19 +68,19 @@ namespace Gecode { namespace Int { #endif forceinline unsigned int - MinusView::width(void) const { + MinusView::width() const { return x.width(); } forceinline unsigned int - MinusView::size(void) const { + MinusView::size() const { return x.size(); } forceinline unsigned int - MinusView::regret_min(void) const { + MinusView::regret_min() const { return x.regret_max(); } forceinline unsigned int - MinusView::regret_max(void) const { + MinusView::regret_max() const { return x.regret_min(); } @@ -89,7 +89,7 @@ namespace Gecode { namespace Int { * */ forceinline bool - MinusView::range(void) const { + MinusView::range() const { return x.range(); } forceinline bool @@ -246,7 +246,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - ViewRanges(void); + ViewRanges(); /// Initialize with ranges for view \a x ViewRanges(const MinusView& x); /// Initialize with ranges for view \a x @@ -256,15 +256,15 @@ namespace Gecode { namespace Int { /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; //@} }; forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - ViewRanges::ViewRanges(void) {} + ViewRanges::ViewRanges() {} forceinline ViewRanges::ViewRanges(const MinusView& x) @@ -276,16 +276,16 @@ namespace Gecode { namespace Int { } forceinline int - ViewRanges::min(void) const { + ViewRanges::min() const { return -IntVarImpBwd::max(); } forceinline int - ViewRanges::max(void) const { + ViewRanges::max() const { return -IntVarImpBwd::min(); } inline int - MinusView::med(void) const { + MinusView::med() const { if (x.range()) return (min() + max()) / 2 - ((min() + max()) % 2 < 0 ? 1 : 0); @@ -309,6 +309,6 @@ namespace Gecode { namespace Int { return x.base() == y.base(); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-var diff --git a/gecode/int/view/neg-bool.hpp b/gecode/int/view/neg-bool.hpp index eb7d045aac..a6a2d1f532 100644 --- a/gecode/int/view/neg-bool.hpp +++ b/gecode/int/view/neg-bool.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { /* * Negated Boolean views @@ -54,19 +54,19 @@ namespace Gecode { namespace Int { * */ forceinline BoolStatus - NegBoolView::status(void) const { + NegBoolView::status() const { return x.status(); } forceinline bool - NegBoolView::zero(void) const { + NegBoolView::zero() const { return x.one(); } forceinline bool - NegBoolView::one(void) const { + NegBoolView::one() const { return x.zero(); } forceinline bool - NegBoolView::none(void) const { + NegBoolView::none() const { return x.none(); } @@ -150,15 +150,15 @@ namespace Gecode { namespace Int { * */ forceinline int - NegBoolView::min(void) const { + NegBoolView::min() const { return 1 - x.max(); } forceinline int - NegBoolView::max(void) const { + NegBoolView::max() const { return 1 - x.min(); } forceinline int - NegBoolView::val(void) const { + NegBoolView::val() const { return 1 - x.val(); } #ifdef GECODE_HAS_CBS @@ -216,7 +216,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - ViewRanges(void) = default; + ViewRanges() = default; /// Initialize with ranges for view \a x ViewRanges(const NegBoolView& x); /// Initialize with ranges for view \a x @@ -233,6 +233,6 @@ namespace Gecode { namespace Int { Iter::Ranges::Singleton::init(x.min(), x.max()); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-var diff --git a/gecode/int/view/offset.hpp b/gecode/int/view/offset.hpp index 5216605795..11d2145934 100644 --- a/gecode/int/view/offset.hpp +++ b/gecode/int/view/offset.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { /* * Constructors and initialization @@ -42,7 +42,7 @@ namespace Gecode { namespace Int { */ forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - OffsetView::OffsetView(void) {} + OffsetView::OffsetView() {} forceinline OffsetView::OffsetView(const IntView& y, int d) : DerivedView(y), c(d) {} @@ -52,7 +52,7 @@ namespace Gecode { namespace Int { * */ forceinline int - OffsetView::offset(void) const { + OffsetView::offset() const { return c; } forceinline void @@ -60,19 +60,19 @@ namespace Gecode { namespace Int { c = n; } forceinline int - OffsetView::min(void) const { + OffsetView::min() const { return x.min() + c; } forceinline int - OffsetView::max(void) const { + OffsetView::max() const { return x.max() + c; } forceinline int - OffsetView::med(void) const { + OffsetView::med() const { return x.med() + c; } forceinline int - OffsetView::val(void) const { + OffsetView::val() const { return x.val() + c; } #ifdef GECODE_HAS_CBS @@ -83,19 +83,19 @@ namespace Gecode { namespace Int { #endif forceinline unsigned int - OffsetView::width(void) const { + OffsetView::width() const { return x.width(); } forceinline unsigned int - OffsetView::size(void) const { + OffsetView::size() const { return x.size(); } forceinline unsigned int - OffsetView::regret_min(void) const { + OffsetView::regret_min() const { return x.regret_min(); } forceinline unsigned int - OffsetView::regret_max(void) const { + OffsetView::regret_max() const { return x.regret_max(); } @@ -104,7 +104,7 @@ namespace Gecode { namespace Int { * */ forceinline bool - OffsetView::range(void) const { + OffsetView::range() const { return x.range(); } forceinline bool @@ -274,7 +274,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - ViewRanges(void) = default; + ViewRanges() = default; /// Initialize with ranges for view \a x ViewRanges(const OffsetView& x); /// Initialize with ranges for view \a x @@ -303,6 +303,6 @@ namespace Gecode { namespace Int { return (x.base() == y.base()) && (x.offset() == y.offset()); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-var diff --git a/gecode/int/view/print.hpp b/gecode/int/view/print.hpp index 0d7a6df9c6..d4f269641a 100644 --- a/gecode/int/view/print.hpp +++ b/gecode/int/view/print.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Int { +namespace Gecode::Int { template std::basic_ostream& @@ -152,6 +152,6 @@ namespace Gecode { namespace Int { return os << "[0..1]"; } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-var diff --git a/gecode/int/view/rel-test.hpp b/gecode/int/view/rel-test.hpp index 94a9d86fae..92b65f320d 100644 --- a/gecode/int/view/rel-test.hpp +++ b/gecode/int/view/rel-test.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { /* * Testing equality @@ -55,8 +55,9 @@ namespace Gecode { namespace Int { ++rx; } else if (ry.max() < rx.min()) { ++ry; - } else + } else { return RT_MAYBE; + } } return RT_FALSE; } @@ -119,8 +120,9 @@ namespace Gecode { namespace Int { ++rx; } else if (ry.max() < rx.min()) { ++ry; - } else + } else { return RT_MAYBE; + } } return RT_TRUE; } @@ -245,6 +247,6 @@ namespace Gecode { namespace Int { return RT_MAYBE; } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-var diff --git a/gecode/int/view/scale.hpp b/gecode/int/view/scale.hpp index fc660fe722..95012f3526 100644 --- a/gecode/int/view/scale.hpp +++ b/gecode/int/view/scale.hpp @@ -36,7 +36,7 @@ #include -namespace Gecode { namespace Int { +namespace Gecode::Int { /* * Constructors and initialization @@ -45,7 +45,7 @@ namespace Gecode { namespace Int { template forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - ScaleView::ScaleView(void) {} + ScaleView::ScaleView() {} template forceinline @@ -58,30 +58,30 @@ namespace Gecode { namespace Int { */ template forceinline int - ScaleView::scale(void) const { + ScaleView::scale() const { return a; } template forceinline Val - ScaleView::min(void) const { + ScaleView::min() const { return static_cast(x.min()) * a; } template forceinline Val - ScaleView::max(void) const { + ScaleView::max() const { return static_cast(x.max()) * a; } template forceinline Val - ScaleView::med(void) const { + ScaleView::med() const { return static_cast(x.med()) * a; } template forceinline Val - ScaleView::val(void) const { + ScaleView::val() const { return static_cast(x.val()) * a; } #ifdef GECODE_HAS_CBS @@ -94,25 +94,25 @@ namespace Gecode { namespace Int { template forceinline UnsVal - ScaleView::size(void) const { + ScaleView::size() const { return static_cast(x.size()); } template forceinline UnsVal - ScaleView::width(void) const { + ScaleView::width() const { return static_cast(x.width()) * a; } template forceinline UnsVal - ScaleView::regret_min(void) const { + ScaleView::regret_min() const { return static_cast(x.regret_min()) * a; } template forceinline UnsVal - ScaleView::regret_max(void) const { + ScaleView::regret_max() const { return static_cast(x.regret_max()) * a; } @@ -122,7 +122,7 @@ namespace Gecode { namespace Int { */ template forceinline bool - ScaleView::range(void) const { + ScaleView::range() const { return x.range(); } template @@ -236,7 +236,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - ViewRanges(void) = default; + ViewRanges() = default; /// Initialize with ranges for view \a x ViewRanges(const IntScaleView& x); /// Initialize with ranges for view \a x @@ -266,7 +266,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - ViewRanges(void) = default; + ViewRanges() = default; /// Initialize with ranges for view \a x ViewRanges(const LLongScaleView& x); /// Initialize with ranges for view \a x @@ -295,6 +295,6 @@ namespace Gecode { namespace Int { return (x.base() == y.base()) && (x.scale() == y.scale()); } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-var diff --git a/gecode/int/view/zero.hpp b/gecode/int/view/zero.hpp index 15ca93576e..8a2aacdb3f 100644 --- a/gecode/int/view/zero.hpp +++ b/gecode/int/view/zero.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Int { +namespace Gecode::Int { /* * Constructors and initialization @@ -42,36 +42,36 @@ namespace Gecode { namespace Int { * */ forceinline int - ZeroIntView::min(void) const { + ZeroIntView::min() const { return 0; } forceinline int - ZeroIntView::max(void) const { + ZeroIntView::max() const { return 0; } forceinline int - ZeroIntView::med(void) const { + ZeroIntView::med() const { return 0; } forceinline int - ZeroIntView::val(void) const { + ZeroIntView::val() const { return 0; } forceinline unsigned int - ZeroIntView::size(void) const { + ZeroIntView::size() const { return 1; } forceinline unsigned int - ZeroIntView::width(void) const { + ZeroIntView::width() const { return 1; } forceinline unsigned int - ZeroIntView::regret_min(void) const { + ZeroIntView::regret_min() const { return 0; } forceinline unsigned int - ZeroIntView::regret_max(void) const { + ZeroIntView::regret_max() const { return 0; } @@ -80,7 +80,7 @@ namespace Gecode { namespace Int { * */ forceinline bool - ZeroIntView::range(void) const { + ZeroIntView::range() const { return true; } forceinline bool @@ -228,7 +228,7 @@ namespace Gecode { namespace Int { /// \name Constructors and initialization //@{ /// Default constructor - ViewRanges(void) = default; + ViewRanges() = default; /// Initialize with ranges for view \a x ViewRanges(const ZeroIntView& x); /// Initialize with ranges for view \a x @@ -238,19 +238,19 @@ namespace Gecode { namespace Int { /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of ranges (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; @@ -259,24 +259,24 @@ namespace Gecode { namespace Int { : done(false) {} forceinline bool - ViewRanges::operator()(void) const { + ViewRanges::operator()() const { return !done; } forceinline void - ViewRanges::operator++(void) { + ViewRanges::operator++() { done = true; } forceinline int - ViewRanges::min(void) const { + ViewRanges::min() const { return 0; } forceinline int - ViewRanges::max(void) const { + ViewRanges::max() const { return 0; } forceinline unsigned int - ViewRanges::width(void) const { + ViewRanges::width() const { return 1; } @@ -289,6 +289,6 @@ namespace Gecode { namespace Int { return true; } -}} // namespace Gecode::Int +} // namespace Gecode::Int // STATISTICS: int-var diff --git a/gecode/iter.hh b/gecode/iter.hh index dc0775a56b..fdc1278b9f 100644 --- a/gecode/iter.hh +++ b/gecode/iter.hh @@ -35,17 +35,15 @@ #include -namespace Gecode { - /// Range and value iterators - namespace Iter { - /// Range iterators - namespace Ranges { - } - /// Value iterators - namespace Values { - } - } // namespace Iter -} // namespace Gecode +/// Range and value iterators +namespace Gecode::Iter { + /// Range iterators + namespace Ranges { + } + /// Value iterators + namespace Values { + } +} // namespace Gecode::Iter #include #include diff --git a/gecode/iter/ranges-add.hpp b/gecode/iter/ranges-add.hpp index e12f824c79..2d1b1bb210 100644 --- a/gecode/iter/ranges-add.hpp +++ b/gecode/iter/ranges-add.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief Range iterator for adding a single range to a range iterator @@ -51,17 +51,17 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - AddRange(void) = default; - /// Initialize with ranges \a i and range \a min to \a max - AddRange(I& i, int min, int max); - /// Initialize with ranges \a i and range \a min to \a max - void init(I& i, int min, int max); + AddRange() = default; + /// Initialize with ranges \a i and range \a r_min0 to \a r_max0 + AddRange(I& i, int r_min0, int r_max0); + /// Initialize with ranges \a i and range \a r_min0 to \a r_max0 + void init(I& i, int r_min0, int r_max0); //@} /// \name Iteration control //@{ /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} }; @@ -76,7 +76,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - SubRange(void) = default; + SubRange() = default; /// Initialize with ranges \a i and range \a min to \a max SubRange(I& i, int min, int max); /// Initialize with ranges \a i and range \a min to \a max @@ -86,7 +86,7 @@ namespace Gecode { namespace Iter { namespace Ranges { template forceinline void - AddRange::operator++(void) { + AddRange::operator++() { if (i()) { mi = r_min + i.min(); ma = r_max + i.max(); @@ -127,6 +127,6 @@ namespace Gecode { namespace Iter { namespace Ranges { AddRange::init(i, -r_max, -r_min); } -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-append.hpp b/gecode/iter/ranges-append.hpp index c305531533..5e61018918 100644 --- a/gecode/iter/ranges-append.hpp +++ b/gecode/iter/ranges-append.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief %Range iterator for appending two range iterators @@ -53,7 +53,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - Append(void) = default; + Append() = default; /// Initialize with iterator \a i and \a j Append(I& i, J& j); /// Initialize with iterator \a i and \a j @@ -63,7 +63,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} }; @@ -90,17 +90,17 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - NaryAppend(void) = default; - /// Initialize with \a n iterators in \a i - NaryAppend(I* i, int n); - /// Initialize with \a n iterators in \a i - void init(I* i, int n); + NaryAppend() = default; + /// Initialize with \a n iterators in \a r0 + NaryAppend(I* r0, int n); + /// Initialize with \a n iterators in \a r0 + void init(I* r0, int n); //@} /// \name Iteration control //@{ /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} }; @@ -111,7 +111,7 @@ namespace Gecode { namespace Iter { namespace Ranges { template inline void - Append::operator++(void) { + Append::operator++() { if (i()) { mi = i.min(); ma = i.max(); @@ -157,7 +157,7 @@ namespace Gecode { namespace Iter { namespace Ranges { template inline void - NaryAppend::operator++(void) { + NaryAppend::operator++() { mi = r[active].min(); ma = r[active].max(); ++r[active]; @@ -205,6 +205,6 @@ namespace Gecode { namespace Iter { namespace Ranges { } } -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-array.hpp b/gecode/iter/ranges-array.hpp index 97c92541a1..4c95fab439 100644 --- a/gecode/iter/ranges-array.hpp +++ b/gecode/iter/ranges-array.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief %Range iterator for array of ranges @@ -63,7 +63,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - Array(void) = default; + Array() = default; /// Initialize with \a n ranges from \a r Array(Range* r, unsigned int n); /// Initialize with \a n ranges from \a r @@ -77,21 +77,21 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); /// Reset iterator to start from beginning - void reset(void); + void reset(); //@} /// \name %Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of range (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; @@ -118,32 +118,32 @@ namespace Gecode { namespace Iter { namespace Ranges { } forceinline void - Array::operator++(void) { + Array::operator++() { c++; } forceinline bool - Array::operator()(void) const { + Array::operator()() const { return c < n; } forceinline void - Array::reset(void) { + Array::reset() { c = 0U; } forceinline int - Array::min(void) const { + Array::min() const { return r[c].min; } forceinline int - Array::max(void) const { + Array::max() const { return r[c].max; } forceinline unsigned int - Array::width(void) const { + Array::width() const { return static_cast(r[c].max - r[c].min) + 1; } -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-cache.hpp b/gecode/iter/ranges-cache.hpp index 6aabfd01d9..07c5cbe43f 100644 --- a/gecode/iter/ranges-cache.hpp +++ b/gecode/iter/ranges-cache.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief %Range iterator cache @@ -46,7 +46,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - Cache(void) = default; + Cache() = default; /// Copy constructor Cache(const Cache& m) = default; /// Initialize with ranges from \a i @@ -83,11 +83,8 @@ namespace Gecode { namespace Iter { namespace Ranges { init(r, i); } - forceinline Cache& - Cache::operator=(const Cache& m) { - return static_cast(RangeListIter::operator=(m)); - } + forceinline Cache& Cache::operator=(const Cache& m) = default; -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-compl.hpp b/gecode/iter/ranges-compl.hpp index 59f99255ec..4bb82512e7 100644 --- a/gecode/iter/ranges-compl.hpp +++ b/gecode/iter/ranges-compl.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief Range iterator for computing the complement (described by template arguments) @@ -50,13 +50,13 @@ namespace Gecode { namespace Iter { namespace Ranges { /// Iterator to compute complement for I i; /// Initialize - void start(void); + void start(); public: /// \name Constructors and initialization //@{ /// Default constructor - Compl(void) = default; + Compl() = default; /// Initialize with iterator \a i Compl(I& i); /// Initialize with iterator \a i @@ -66,7 +66,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} }; @@ -88,13 +88,13 @@ namespace Gecode { namespace Iter { namespace Ranges { /// Iterator to compute complement for I i; /// Initialize - void start(void); + void start(); public: /// \name Constructors and initialization //@{ /// Default constructor - ComplVal(void) = default; + ComplVal() = default; /// Initialize with iterator \a i ComplVal(int umin, int umax, I& i); /// Initialize with iterator \a i @@ -104,13 +104,13 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} }; template forceinline void - Compl::start(void) { + Compl::start() { if (i()) { assert((i.min() >= UMIN) && (i.max() <= UMAX)); if (i.min() > UMIN) { @@ -145,7 +145,7 @@ namespace Gecode { namespace Iter { namespace Ranges { template forceinline void - Compl::operator++(void) { + Compl::operator++() { assert(!i() || (i.max() <= UMAX)); if (i() && (i.max() < UMAX)) { mi = i.max() + 1; @@ -158,7 +158,7 @@ namespace Gecode { namespace Iter { namespace Ranges { template forceinline void - ComplVal::start(void) { + ComplVal::start() { if (i()) { assert((i.min() >= universe_min) && (i.max() <= universe_max)); if (i.min() > universe_min) { @@ -195,7 +195,7 @@ namespace Gecode { namespace Iter { namespace Ranges { template forceinline void - ComplVal::operator++(void) { + ComplVal::operator++() { assert(!i() || (i.max() <= universe_max)); if (i() && (i.max() < universe_max)) { mi = i.max() + 1; @@ -206,6 +206,6 @@ namespace Gecode { namespace Iter { namespace Ranges { } } -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-diff.hpp b/gecode/iter/ranges-diff.hpp index e63b672718..ac35880c10 100644 --- a/gecode/iter/ranges-diff.hpp +++ b/gecode/iter/ranges-diff.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief Range iterator for computing set difference @@ -50,7 +50,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - Diff(void) = default; + Diff() = default; /// Initialize with iterator \a i and \a j Diff(I& i, J& j); /// Initialize with iterator \a i and \a j @@ -60,13 +60,13 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} }; template forceinline void - Diff::operator++(void) { + Diff::operator++() { // Precondition: mi <= ma // Task: find next mi greater than ma while (true) { @@ -131,6 +131,6 @@ namespace Gecode { namespace Iter { namespace Ranges { } } -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-empty.hpp b/gecode/iter/ranges-empty.hpp index e2d71a225d..9ae0a499fb 100644 --- a/gecode/iter/ranges-empty.hpp +++ b/gecode/iter/ranges-empty.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief Range iterator for empty range @@ -43,59 +43,59 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - Empty(void) = default; + Empty() = default; /// Initialize - void init(void); + void init(); //@} /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of range (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; forceinline void - Empty::init(void) {} + Empty::init() {} forceinline void - Empty::operator++(void) { + Empty::operator++() { GECODE_NEVER; } forceinline bool - Empty::operator()(void) const { + Empty::operator()() const { return false; } forceinline int - Empty::min(void) const { + Empty::min() const { GECODE_NEVER; return 0; } forceinline int - Empty::max(void) const { + Empty::max() const { GECODE_NEVER; return 0; } forceinline unsigned int - Empty::width(void) const { + Empty::width() const { GECODE_NEVER; return 0; } -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-inter.hpp b/gecode/iter/ranges-inter.hpp index 6df6f0a61b..00cc59fc91 100644 --- a/gecode/iter/ranges-inter.hpp +++ b/gecode/iter/ranges-inter.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief Range iterator for computing intersection (binary) @@ -51,7 +51,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - Inter(void) = default; + Inter() = default; /// Initialize with iterator \a i and \a j Inter(I& i, J& j); /// Initialize with iterator \a i and \a j @@ -61,7 +61,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} }; @@ -79,7 +79,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - NaryInter(void) = default; + NaryInter() = default; /// Initialize with single iterator \a i template NaryInter(Region& r, I& i); @@ -115,7 +115,7 @@ namespace Gecode { namespace Iter { namespace Ranges { template inline void - Inter::operator++(void) { + Inter::operator++() { if (!i() || !j()) goto done; do { @@ -309,10 +309,13 @@ namespace Gecode { namespace Iter { namespace Ranges { forceinline NaryInter& NaryInter::operator=(const NaryInter& m) { - f = nullptr; - return static_cast(RangeListIter::operator=(m)); + if (this != &m) { + f = nullptr; + RangeListIter::operator=(m); + } + return *this; } -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-list.hpp b/gecode/iter/ranges-list.hpp index dd3cac5130..4be3b53b38 100644 --- a/gecode/iter/ranges-list.hpp +++ b/gecode/iter/ranges-list.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief Iterator over range lists @@ -64,7 +64,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// Set range lists void set(RangeList* l); /// Get head of current range list - RangeList* get(void) const; + RangeList* get() const; /// Create new range possibly from freelist \a f and init RangeList* range(int min, int max, RangeList*& f); /// Create new range possibly and init @@ -83,7 +83,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - RangeListIter(void); + RangeListIter(); /// Copy constructor RangeListIter(const RangeListIter& i); /// Initialize @@ -97,25 +97,25 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); /// Reset iterator to start - void reset(void); + void reset(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of range (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} /// Destructor - ~RangeListIter(void); + ~RangeListIter(); }; forceinline @@ -123,7 +123,7 @@ namespace Gecode { namespace Iter { namespace Ranges { : Support::BlockAllocator(r), use_cnt(1) {} forceinline - RangeListIter::RangeListIter(void) + RangeListIter::RangeListIter() : rlio(nullptr), h(nullptr), c(nullptr) {} forceinline @@ -160,7 +160,7 @@ namespace Gecode { namespace Iter { namespace Ranges { return *this; } - forceinline RangeListIter::~RangeListIter(void) { + forceinline RangeListIter::~RangeListIter() { if ((rlio != nullptr) && (--rlio->use_cnt == 0)) { Region& r = rlio->allocator(); rlio->~RLIO(); @@ -174,7 +174,7 @@ namespace Gecode { namespace Iter { namespace Ranges { } forceinline RangeListIter::RangeList* - RangeListIter::get(void) const { + RangeListIter::get() const { return h; } @@ -228,33 +228,33 @@ namespace Gecode { namespace Iter { namespace Ranges { } forceinline bool - RangeListIter::operator()(void) const { + RangeListIter::operator()() const { return c != nullptr; } forceinline void - RangeListIter::operator++(void) { + RangeListIter::operator++() { c = c->next; } forceinline void - RangeListIter::reset(void) { + RangeListIter::reset() { c = h; } forceinline int - RangeListIter::min(void) const { + RangeListIter::min() const { return c->min; } forceinline int - RangeListIter::max(void) const { + RangeListIter::max() const { return c->max; } forceinline unsigned int - RangeListIter::width(void) const { + RangeListIter::width() const { return static_cast(c->max - c->min) + 1; } -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-map.hpp b/gecode/iter/ranges-map.hpp index 501f891078..a1d0312e44 100644 --- a/gecode/iter/ranges-map.hpp +++ b/gecode/iter/ranges-map.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief Range iterator for mapping ranges @@ -46,7 +46,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - Map(void); + Map(); /// Initialize with ranges from \a i Map(I& i); /// Initialize with ranges from \a i and map \a m @@ -60,19 +60,19 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of range (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; @@ -85,13 +85,13 @@ namespace Gecode { namespace Iter { namespace Ranges { /// Map for ranges M m; /// Find next mapped range - void next(void); + void next(); public: /// \name Constructors and initialization //@{ /// Default constructor - Map(void) = default; + Map() = default; /// Initialize with ranges from \a i Map(I& i); /// Initialize with ranges from \a i and map \a m @@ -105,7 +105,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} }; @@ -122,7 +122,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - Map(void) = default; + Map() = default; /// Initialize with ranges from \a i Map(I& i); /// Initialize with ranges from \a i and map \a m @@ -136,25 +136,25 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of range (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; template forceinline void - Map::next(void) { + Map::next() { if (i()) { mi = m.min(i.min()); ma = m.max(i.max()); @@ -197,7 +197,7 @@ namespace Gecode { namespace Iter { namespace Ranges { template forceinline void - Map::operator++(void) { + Map::operator++() { next(); } @@ -224,31 +224,31 @@ namespace Gecode { namespace Iter { namespace Ranges { template forceinline bool - Map::operator()(void) const { + Map::operator()() const { return i(); } template forceinline void - Map::operator++(void) { + Map::operator++() { ++i; } template forceinline int - Map::min(void) const { + Map::min() const { return m.min(i.min()); } template forceinline int - Map::max(void) const { + Map::max() const { return m.max(i.max()); } template forceinline unsigned int - Map::width(void) const { + Map::width() const { return static_cast(max() - min()) + 1; } -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-minmax.hpp b/gecode/iter/ranges-minmax.hpp index 95c47dc751..b93b86419a 100644 --- a/gecode/iter/ranges-minmax.hpp +++ b/gecode/iter/ranges-minmax.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief Base for range iterators with explicit min and max @@ -50,13 +50,13 @@ namespace Gecode { namespace Iter { namespace Ranges { /// Maximum of current range int ma; /// %Set range such that iteration stops - void finish(void); + void finish(); public: /// \name Constructors and initialization //@{ /// Default constructor - MinMax(void) = default; + MinMax() = default; /// Initialize with range \a min to \a max MinMax(int min, int max); //@} @@ -64,22 +64,22 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of range (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; forceinline void - MinMax::finish(void) { + MinMax::finish() { mi = 1; ma = 0; } @@ -89,23 +89,23 @@ namespace Gecode { namespace Iter { namespace Ranges { : mi(min), ma(max) {} forceinline bool - MinMax::operator()(void) const { + MinMax::operator()() const { return mi <= ma; } forceinline int - MinMax::min(void) const { + MinMax::min() const { return mi; } forceinline int - MinMax::max(void) const { + MinMax::max() const { return ma; } forceinline unsigned int - MinMax::width(void) const { + MinMax::width() const { return static_cast(ma - mi) + 1; } -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-minus.hpp b/gecode/iter/ranges-minus.hpp index e7d5285b99..5b57dbb8c3 100644 --- a/gecode/iter/ranges-minus.hpp +++ b/gecode/iter/ranges-minus.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief Range iterator for pointwise minus of a range iterator @@ -48,7 +48,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - Minus(void) = default; + Minus() = default; /// Copy constructor Minus(const Minus& m) = default; /// Initialize with ranges from \a i @@ -83,11 +83,8 @@ namespace Gecode { namespace Iter { namespace Ranges { init(r, i); } - forceinline Minus& - Minus::operator=(const Minus& m) { - return static_cast(RangeListIter::operator=(m)); - } + forceinline Minus& Minus::operator=(const Minus& m) = default; -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-negative.hpp b/gecode/iter/ranges-negative.hpp index f0c71ddcc9..a28490064f 100644 --- a/gecode/iter/ranges-negative.hpp +++ b/gecode/iter/ranges-negative.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief Range iterator for negative part of a range iterator @@ -52,7 +52,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - Negative(void) = default; + Negative() = default; /// Initialize with ranges from \a i Negative(I& i); /// Initialize with ranges from \a i @@ -62,19 +62,19 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of range (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; @@ -91,39 +91,37 @@ namespace Gecode { namespace Iter { namespace Ranges { template forceinline void - Negative::operator++(void) { + Negative::operator++() { ++i; } template forceinline bool - Negative::operator()(void) const { + Negative::operator()() const { if (strict) { return i() && (i.min() < 0); - } else { - return i() && (i.min() <= 0); } + return i() && (i.min() <= 0); } template forceinline int - Negative::min(void) const { + Negative::min() const { return i.min(); } template forceinline int - Negative::max(void) const { + Negative::max() const { if (strict) { return std::min(i.max(), -1); - } else { - return std::min(i.max(), 0); } + return std::min(i.max(), 0); } template forceinline unsigned int - Negative::width(void) const { + Negative::width() const { return static_cast(max() - min() + 1); } -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-offset.hpp b/gecode/iter/ranges-offset.hpp index 95e39291a4..3b3f94debc 100644 --- a/gecode/iter/ranges-offset.hpp +++ b/gecode/iter/ranges-offset.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief Range iterator for pointwise offset (by some constant) @@ -49,7 +49,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - Offset(void) = default; + Offset() = default; /// Initialize with ranges from \a i and offset \a c Offset(I& i, int c); /// Initialize with ranges from \a i and offset \a c @@ -59,19 +59,19 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of range (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; @@ -87,31 +87,31 @@ namespace Gecode { namespace Iter { namespace Ranges { template forceinline void - Offset::operator++(void) { + Offset::operator++() { ++i; } template forceinline bool - Offset::operator()(void) const { + Offset::operator()() const { return i(); } template forceinline int - Offset::min(void) const { + Offset::min() const { return i.min() + c; } template forceinline int - Offset::max(void) const { + Offset::max() const { return i.max() + c; } template forceinline unsigned int - Offset::width(void) const { + Offset::width() const { return i.width(); } -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-operations.hpp b/gecode/iter/ranges-operations.hpp index e54840d0a3..9e945bd20d 100644 --- a/gecode/iter/ranges-operations.hpp +++ b/gecode/iter/ranges-operations.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \defgroup FuncIterRangesOp Operations on range iterators @@ -154,6 +154,6 @@ namespace Gecode { namespace Iter { namespace Ranges { return disjoint ? CS_DISJOINT : CS_NONE; } -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-positive.hpp b/gecode/iter/ranges-positive.hpp index bec045f400..ba88aceaff 100644 --- a/gecode/iter/ranges-positive.hpp +++ b/gecode/iter/ranges-positive.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief Range iterator for positive part of a range iterator @@ -51,7 +51,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - Positive(void) = default; + Positive() = default; /// Initialize with ranges from \a i Positive(I& i); /// Initialize with ranges from \a i @@ -61,19 +61,19 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of range (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; @@ -98,35 +98,34 @@ namespace Gecode { namespace Iter { namespace Ranges { template forceinline void - Positive::operator++(void) { + Positive::operator++() { ++i; } template forceinline bool - Positive::operator()(void) const { + Positive::operator()() const { return i(); } template forceinline int - Positive::min(void) const { + Positive::min() const { if (strict) { return std::max(i.min(), 1); - } else { - return std::max(i.min(), 0); } + return std::max(i.min(), 0); } template forceinline int - Positive::max(void) const { + Positive::max() const { return i.max(); } template forceinline unsigned int - Positive::width(void) const { + Positive::width() const { return static_cast(max() - min() + 1); } -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-rangelist.hpp b/gecode/iter/ranges-rangelist.hpp index 6616ec3e21..ac2ef9ef8f 100644 --- a/gecode/iter/ranges-rangelist.hpp +++ b/gecode/iter/ranges-rangelist.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief %Range iterator for range lists @@ -49,7 +49,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - RangeList(void) = default; + RangeList() = default; /// Initialize with range list \a s RangeList(const Gecode::RangeList* s); /// Initialize with range list \a s @@ -59,19 +59,19 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of range (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; @@ -85,28 +85,28 @@ namespace Gecode { namespace Iter { namespace Ranges { } forceinline bool - RangeList::operator()(void) const { + RangeList::operator()() const { return c != nullptr; } forceinline void - RangeList::operator++(void) { + RangeList::operator++() { c = c->next(); } forceinline int - RangeList::min(void) const { + RangeList::min() const { return c->min(); } forceinline int - RangeList::max(void) const { + RangeList::max() const { return c->max(); } forceinline unsigned int - RangeList::width(void) const { + RangeList::width() const { return c->width(); } -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-scale.hpp b/gecode/iter/ranges-scale.hpp index 05c538cc6f..ddd79d499d 100644 --- a/gecode/iter/ranges-scale.hpp +++ b/gecode/iter/ranges-scale.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief Range iterator for pointwise product with a positive integer @@ -60,7 +60,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - ScaleUp(void) = default; + ScaleUp() = default; /// Initialize with ranges from \a i and scale factor \a a ScaleUp(I& i, int a); /// Initialize with ranges from \a i and scale factor \a a @@ -70,19 +70,19 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - Val min(void) const; + Val min() const; /// Return largest value of range - Val max(void) const; + Val max() const; /// Return width of range (distance between minimum and maximum) - UnsVal width(void) const; + UnsVal width() const; //@} }; @@ -103,7 +103,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - ScaleDown(void) = default; + ScaleDown() = default; /// Initialize with ranges from \a i and scale factor \a a ScaleDown(I& i, int a); /// Initialize with ranges from \a i and scale factor \a a @@ -113,7 +113,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} }; @@ -144,7 +144,7 @@ namespace Gecode { namespace Iter { namespace Ranges { template forceinline void - ScaleUp::operator++(void) { + ScaleUp::operator++() { if (a == 1) { ++i; } else { @@ -160,29 +160,29 @@ namespace Gecode { namespace Iter { namespace Ranges { } template forceinline bool - ScaleUp::operator()(void) const { + ScaleUp::operator()() const { return (a == 1) ? i() : (cur <= end); } template forceinline Val - ScaleUp::min(void) const { + ScaleUp::min() const { return (a == 1) ? static_cast(i.min()) : cur; } template forceinline Val - ScaleUp::max(void) const { + ScaleUp::max() const { return (a == 1) ? static_cast(i.max()) : cur; } template forceinline UnsVal - ScaleUp::width(void) const { + ScaleUp::width() const { return (a == 1) ? static_cast(i.width()) : static_cast(1); } template forceinline void - ScaleDown::operator++(void) { + ScaleDown::operator++() { finish(); while ((mi > ma) && i()) { mi = static_cast(ceil(static_cast(i.min()) / a)); @@ -216,6 +216,6 @@ namespace Gecode { namespace Iter { namespace Ranges { operator++(); } -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-singleton-append.hpp b/gecode/iter/ranges-singleton-append.hpp index 935a163cf7..8df8850365 100644 --- a/gecode/iter/ranges-singleton-append.hpp +++ b/gecode/iter/ranges-singleton-append.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief %Range iterator for appending a singleton with a range iterator @@ -52,7 +52,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - SingletonAppend(void) = default; + SingletonAppend() = default; /// Initialize with singleton (\a i0, \a i1) and iterator \a j SingletonAppend(int i0, int i1, J& j); /// Initialize with singleton (\a i0, \a i1) and iterator \a j @@ -62,7 +62,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} }; @@ -73,7 +73,7 @@ namespace Gecode { namespace Iter { namespace Ranges { template inline void - SingletonAppend::operator++(void) { + SingletonAppend::operator++() { if (j()) { mi = j.min(); ma = j.max(); @@ -99,6 +99,6 @@ namespace Gecode { namespace Iter { namespace Ranges { j = j0; } -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-singleton.hpp b/gecode/iter/ranges-singleton.hpp index 09bf57b7e0..a562c3bed5 100644 --- a/gecode/iter/ranges-singleton.hpp +++ b/gecode/iter/ranges-singleton.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief Range iterator for singleton range @@ -43,7 +43,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - Singleton(void) = default; + Singleton() = default; /// Initialize with range \a min to \a max Singleton(int min, int max); /// Initialize with range \a min to \a max @@ -53,7 +53,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} }; @@ -68,11 +68,11 @@ namespace Gecode { namespace Iter { namespace Ranges { } forceinline void - Singleton::operator++(void) { + Singleton::operator++() { mi = 1; ma = 0; } -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-size.hpp b/gecode/iter/ranges-size.hpp index b8c2f10ae3..7572404630 100644 --- a/gecode/iter/ranges-size.hpp +++ b/gecode/iter/ranges-size.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief %Range iterator with size counting @@ -53,7 +53,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - Size(void); + Size(); /// Initialize with ranges from \a i Size(I& i); /// Initialize with ranges from \a i @@ -63,31 +63,31 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void); + bool operator()(); /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name %Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of range (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} /// \name %Size access //@{ /// Return accumulated size - unsigned int size(void) const; + unsigned int size() const; //@} }; template forceinline - Size::Size(void) + Size::Size() : _size(0) {} template @@ -102,38 +102,38 @@ namespace Gecode { namespace Iter { namespace Ranges { template forceinline void - Size::operator++(void) { + Size::operator++() { _size += i.width(); ++i; } template forceinline bool - Size::operator()(void) { + Size::operator()() { return i(); } template forceinline int - Size::min(void) const { + Size::min() const { return i.min(); } template forceinline int - Size::max(void) const { + Size::max() const { return i.max(); } template forceinline unsigned int - Size::width(void) const { + Size::width() const { return i.width(); } template forceinline unsigned int - Size::size(void) const { + Size::size() const { return _size; } -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-union.hpp b/gecode/iter/ranges-union.hpp index 25b34424a8..e0b711b5a4 100644 --- a/gecode/iter/ranges-union.hpp +++ b/gecode/iter/ranges-union.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief Range iterator for computing union (binary) @@ -51,7 +51,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - Union(void) = default; + Union() = default; /// Initialize with iterator \a i and \a j Union(I& i, J& j); /// Initialize with iterator \a i and \a j @@ -61,7 +61,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} }; @@ -85,7 +85,7 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Constructors and initialization //@{ /// Default constructor - NaryUnion(void); + NaryUnion(); /// Initialize with single iterator \a i template NaryUnion(Region& r, I& i); @@ -121,7 +121,7 @@ namespace Gecode { namespace Iter { namespace Ranges { template inline void - Union::operator++(void) { + Union::operator++() { const bool i_valid = i(); const bool j_valid = j(); if (!i_valid && !j_valid) { @@ -294,7 +294,7 @@ namespace Gecode { namespace Iter { namespace Ranges { } forceinline - NaryUnion::NaryUnion(void) + NaryUnion::NaryUnion() : f(nullptr) {} template @@ -370,10 +370,13 @@ namespace Gecode { namespace Iter { namespace Ranges { forceinline NaryUnion& NaryUnion::operator=(const NaryUnion& m) { - f = nullptr; - return static_cast(RangeListIter::operator=(m)); + if (this != &m) { + f = nullptr; + RangeListIter::operator=(m); + } + return *this; } -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/ranges-values.hpp b/gecode/iter/ranges-values.hpp index 959569b713..2d3f77ec73 100644 --- a/gecode/iter/ranges-values.hpp +++ b/gecode/iter/ranges-values.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Ranges { +namespace Gecode::Iter::Ranges { /** * \brief Value iterator from range iterator @@ -47,13 +47,13 @@ namespace Gecode { namespace Iter { namespace Ranges { /// End of current range int max; /// Initialize iterator - void start(void); + void start(); public: /// \name Constructors and initialization //@{ /// Default constructor - ToValues(void) = default; + ToValues() = default; /// Initialize with values from range iterator \a i ToValues(I& i); /// Initialize with values from range iterator \a i @@ -63,21 +63,21 @@ namespace Gecode { namespace Iter { namespace Ranges { /// \name Iteration control //@{ /// Test whether iterator is still at a value or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next value (if possible) - void operator++(void); + void operator++(); //@} /// \name Value access //@{ /// Return current value - int val(void) const; + int val() const; //@} }; template forceinline void - ToValues::start(void) { + ToValues::start() { if (i()) { cur = i.min(); max = i.max(); @@ -103,13 +103,13 @@ namespace Gecode { namespace Iter { namespace Ranges { template forceinline bool - ToValues::operator()(void) const { + ToValues::operator()() const { return (cur <= max); } template forceinline void - ToValues::operator++(void) { + ToValues::operator++() { ++cur; if (cur > max) { ++i; @@ -122,10 +122,10 @@ namespace Gecode { namespace Iter { namespace Ranges { template forceinline int - ToValues::val(void) const { + ToValues::val() const { return cur; } -}}} // namespace Gecode::Iter::Ranges +} // namespace Gecode::Iter::Ranges // STATISTICS: iter-any diff --git a/gecode/iter/values-array.hpp b/gecode/iter/values-array.hpp index 598bc13729..8f7f286e70 100644 --- a/gecode/iter/values-array.hpp +++ b/gecode/iter/values-array.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Values { +namespace Gecode::Iter::Values { /** * \brief %Value iterator for array of integers @@ -55,7 +55,7 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Constructors and initialization //@{ /// Default constructor - Array(void) = default; + Array() = default; /// Initialize with \a n values from \a v Array(int* v, unsigned int n); /// Initialize with \a n values from \a v @@ -69,17 +69,17 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Iteration control //@{ /// Test whether iterator is still at a value or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next value (if possible) - void operator++(void); + void operator++(); /// Reset iterator to start from beginning - void reset(void); + void reset(); //@} /// \name %Value access //@{ /// Return current value - int val(void) const; + int val() const; //@} }; @@ -106,23 +106,23 @@ namespace Gecode { namespace Iter { namespace Values { } forceinline void - Array::operator++(void) { + Array::operator++() { c++; } forceinline bool - Array::operator()(void) const { + Array::operator()() const { return c < n; } forceinline void - Array::reset(void) { + Array::reset() { c = 0; } forceinline int - Array::val(void) const { + Array::val() const { return v[c]; } -}}} // namespace Gecode::Iter::Values +} // namespace Gecode::Iter::Values // STATISTICS: iter-any diff --git a/gecode/iter/values-bitset.hpp b/gecode/iter/values-bitset.hpp index d725396064..17752bc6d6 100644 --- a/gecode/iter/values-bitset.hpp +++ b/gecode/iter/values-bitset.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Values { +namespace Gecode::Iter::Values { /** * \brief Value iterator for values in a bitset @@ -47,7 +47,7 @@ namespace Gecode { namespace Iter { namespace Values { /// Limit value unsigned int limit; /// Move to next set bit - void move(void); + void move(); public: /// \name Constructors and initialization @@ -61,15 +61,15 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Iteration control //@{ /// Test whether iterator is still at a value or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next value (if possible) - void operator++(void); + void operator++(); //@} /// \name Value access //@{ /// Return current value - int val(void) const; + int val() const; //@} }; @@ -86,21 +86,21 @@ namespace Gecode { namespace Iter { namespace Values { template forceinline void - BitSet::operator++(void) { + BitSet::operator++() { cur = bs.next(cur + 1); } template forceinline bool - BitSet::operator()(void) const { + BitSet::operator()() const { return cur < limit; } template forceinline int - BitSet::val(void) const { + BitSet::val() const { return static_cast(cur); } -}}} // namespace Gecode::Iter::Values +} // namespace Gecode::Iter::Values // STATISTICS: iter-any diff --git a/gecode/iter/values-bitsetoffset.hpp b/gecode/iter/values-bitsetoffset.hpp index 4a843a30ad..f91673f723 100644 --- a/gecode/iter/values-bitsetoffset.hpp +++ b/gecode/iter/values-bitsetoffset.hpp @@ -33,7 +33,7 @@ * */ -namespace Gecode { namespace Iter { namespace Values { +namespace Gecode::Iter::Values { /** * \brief Value iterator for values in an offset bitset @@ -50,7 +50,7 @@ namespace Gecode { namespace Iter { namespace Values { /// Limit value int limit; /// Move to next set bit - void move(void); + void move(); public: /// \name Constructors and initialization @@ -64,15 +64,15 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Iteration control //@{ /// Test whether iterator is still at a value or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next value (if possible) - void operator++(void); + void operator++(); //@} /// \name Value access //@{ /// Return current value - int val(void) const; + int val() const; //@} }; @@ -88,21 +88,21 @@ namespace Gecode { namespace Iter { namespace Values { template forceinline void - BitSetOffset::operator++(void) { + BitSetOffset::operator++() { cur = bs.next(cur + 1); } template forceinline bool - BitSetOffset::operator()(void) const { + BitSetOffset::operator()() const { return cur < limit; } template forceinline int - BitSetOffset::val(void) const { + BitSetOffset::val() const { return static_cast(cur); } -}}} // namespace Gecode::Iter::Values +} // namespace Gecode::Iter::Values // STATISTICS: iter-any diff --git a/gecode/iter/values-inter.hpp b/gecode/iter/values-inter.hpp index a79e79868a..ec1d563f1c 100644 --- a/gecode/iter/values-inter.hpp +++ b/gecode/iter/values-inter.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Values { +namespace Gecode::Iter::Values { /** * \brief Value iterator for the intersection of two value iterators @@ -46,13 +46,13 @@ namespace Gecode { namespace Iter { namespace Values { /// Second iterator J j; /// Find next element from intersection - void next(void); + void next(); public: /// \name Constructors and initialization //@{ /// Default constructor - Inter(void) = default; + Inter() = default; /// Initialize with values from \a i and \a j Inter(I& i, J& j); /// Initialize with values from \a i and \a j @@ -62,21 +62,21 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Iteration control //@{ /// Test whether iterator is still at a value or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next value (if possible) - void operator++(void); + void operator++(); //@} /// \name Value access //@{ /// Return current value - int val(void) const; + int val() const; //@} }; template forceinline void - Inter::next(void) { + Inter::next() { do { while (i() && j() && (i.val() < j.val())) ++i; @@ -102,7 +102,7 @@ namespace Gecode { namespace Iter { namespace Values { template forceinline void - Inter::operator++(void) { + Inter::operator++() { ++i; ++j; next(); @@ -110,17 +110,17 @@ namespace Gecode { namespace Iter { namespace Values { template forceinline bool - Inter::operator()(void) const { + Inter::operator()() const { return i() && j(); } template forceinline int - Inter::val(void) const { + Inter::val() const { assert(i.val() == j.val()); return i.val(); } -}}} // namespace Gecode::Iter::Values +} // namespace Gecode::Iter::Values // STATISTICS: iter-any diff --git a/gecode/iter/values-list.hpp b/gecode/iter/values-list.hpp index 819826af1e..43741228cc 100644 --- a/gecode/iter/values-list.hpp +++ b/gecode/iter/values-list.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Values { +namespace Gecode::Iter::Values { /** * \brief Iterator over value lists @@ -68,7 +68,7 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Constructors and initialization //@{ /// Default constructor - ValueListIter(void); + ValueListIter(); /// Copy constructor ValueListIter(const ValueListIter& i); /// Initialize @@ -82,21 +82,21 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Iteration control //@{ /// Test whether iterator is still at a value or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next value (if possible) - void operator++(void); + void operator++(); /// Reset iterator to start - void reset(void); + void reset(); //@} /// \name Value access //@{ /// Return value - int val(void) const; + int val() const; //@} /// Destructor - ~ValueListIter(void); + ~ValueListIter(); }; forceinline @@ -104,7 +104,7 @@ namespace Gecode { namespace Iter { namespace Values { : Support::BlockAllocator(r), use_cnt(1) {} forceinline - ValueListIter::ValueListIter(void) + ValueListIter::ValueListIter() : vlio(nullptr) {} forceinline @@ -139,7 +139,7 @@ namespace Gecode { namespace Iter { namespace Values { return *this; } - forceinline ValueListIter::~ValueListIter(void) { + forceinline ValueListIter::~ValueListIter() { if (--vlio->use_cnt == 0) { Region& r = vlio->allocator(); vlio->~VLIO(); @@ -153,25 +153,25 @@ namespace Gecode { namespace Iter { namespace Values { } forceinline bool - ValueListIter::operator()(void) const { + ValueListIter::operator()() const { return c != nullptr; } forceinline void - ValueListIter::operator++(void) { + ValueListIter::operator++() { c = c->next; } forceinline void - ValueListIter::reset(void) { + ValueListIter::reset() { c = h; } forceinline int - ValueListIter::val(void) const { + ValueListIter::val() const { return c->val; } -}}} // namespace Gecode::Iter::Values +} // namespace Gecode::Iter::Values // STATISTICS: iter-any diff --git a/gecode/iter/values-map.hpp b/gecode/iter/values-map.hpp index 171bdda361..b9c0d1100f 100644 --- a/gecode/iter/values-map.hpp +++ b/gecode/iter/values-map.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Values { +namespace Gecode::Iter::Values { /** * \brief Value iterator for mapping values of a value iterator @@ -52,7 +52,7 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Constructors and initialization //@{ /// Default constructor - Map(void) = default; + Map() = default; /// Initialize with values from \a i Map(I& i); /// Initialize with values from \a i and map \a m @@ -66,15 +66,15 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Iteration control //@{ /// Test whether iterator is still at a value or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next value (if possible) - void operator++(void); + void operator++(); //@} /// \name Value access //@{ /// Return current value - int val(void) const; + int val() const; //@} }; @@ -103,7 +103,7 @@ namespace Gecode { namespace Iter { namespace Values { template forceinline void - Map::operator++(void) { + Map::operator++() { if (strict) { ++i; } else { @@ -115,16 +115,16 @@ namespace Gecode { namespace Iter { namespace Values { } template forceinline bool - Map::operator()(void) const { + Map::operator()() const { return i(); } template forceinline int - Map::val(void) const { + Map::val() const { return m.val(i.val()); } -}}} // namespace Gecode::Iter::Values +} // namespace Gecode::Iter::Values // STATISTICS: iter-any diff --git a/gecode/iter/values-minus.hpp b/gecode/iter/values-minus.hpp index aa8e249789..9434f4ac3a 100644 --- a/gecode/iter/values-minus.hpp +++ b/gecode/iter/values-minus.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Values { +namespace Gecode::Iter::Values { /** * \brief Value iterator for pointwise minus of a value iterator @@ -48,7 +48,7 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Constructors and initialization //@{ /// Default constructor - Minus(void) = default; + Minus() = default; /// Copy constructor Minus(const Minus& m) = default; /// Initialize with values from \a i @@ -82,11 +82,8 @@ namespace Gecode { namespace Iter { namespace Values { init(r, i); } - forceinline Minus& - Minus::operator=(const Minus& m) { - return static_cast(ValueListIter::operator=(m)); - } + forceinline Minus& Minus::operator=(const Minus& m) = default; -}}} // namespace Gecode::Iter::Values +} // namespace Gecode::Iter::Values // STATISTICS: iter-any diff --git a/gecode/iter/values-negative.hpp b/gecode/iter/values-negative.hpp index aa92089744..98e89289f2 100644 --- a/gecode/iter/values-negative.hpp +++ b/gecode/iter/values-negative.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Values { +namespace Gecode::Iter::Values { /** * \brief Value iterator for selecting only negative values @@ -48,7 +48,7 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Constructors and initialization //@{ /// Default constructor - Negative(void) = default; + Negative() = default; /// Initialize with values from \a i Negative(I& i); /// Initialize with values from \a i @@ -58,15 +58,15 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Iteration control //@{ /// Test whether iterator is still at a value or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next value (if possible) - void operator++(void); + void operator++(); //@} /// \name Value access //@{ /// Return current value - int val(void) const; + int val() const; //@} }; @@ -83,25 +83,24 @@ namespace Gecode { namespace Iter { namespace Values { template forceinline void - Negative::operator++(void) { + Negative::operator++() { ++i; } template forceinline bool - Negative::operator()(void) const { + Negative::operator()() const { if (strict) { return i() && (i.val() < 0); - } else { - return i() && (i.val() <= 0); } + return i() && (i.val() <= 0); } template forceinline int - Negative::val(void) const { + Negative::val() const { return i.val(); } -}}} // namespace Gecode::Iter::Values +} // namespace Gecode::Iter::Values // STATISTICS: iter-any diff --git a/gecode/iter/values-offset.hpp b/gecode/iter/values-offset.hpp index a685bf89f7..1b6ede143f 100644 --- a/gecode/iter/values-offset.hpp +++ b/gecode/iter/values-offset.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Values { +namespace Gecode::Iter::Values { /** * \brief Value iterator for pointwise offset (by some constant) @@ -49,7 +49,7 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Constructors and initialization //@{ /// Default constructor - Offset(void) = default; + Offset() = default; /// Initialize with values from \a i and offset \a c Offset(I& i, int c); /// Initialize with values from \a i and offset \a c @@ -59,15 +59,15 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Iteration control //@{ /// Test whether iterator is still at a value or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next value (if possible) - void operator++(void); + void operator++(); //@} /// \name Value access //@{ /// Return current value - int val(void) const; + int val() const; //@} }; @@ -85,21 +85,21 @@ namespace Gecode { namespace Iter { namespace Values { template forceinline void - Offset::operator++(void) { + Offset::operator++() { ++i; } template forceinline bool - Offset::operator()(void) const { + Offset::operator()() const { return i(); } template forceinline int - Offset::val(void) const { + Offset::val() const { return i.val() + c; } -}}} // namespace Gecode::Iter::Values +} // namespace Gecode::Iter::Values // STATISTICS: iter-any diff --git a/gecode/iter/values-positive.hpp b/gecode/iter/values-positive.hpp index 69c2025b35..99e0dbbc55 100644 --- a/gecode/iter/values-positive.hpp +++ b/gecode/iter/values-positive.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Values { +namespace Gecode::Iter::Values { /** * \brief Value iterator for selecting only positive values @@ -48,7 +48,7 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Constructors and initialization //@{ /// Default constructor - Positive(void) = default; + Positive() = default; /// Initialize with values from \a i Positive(I& i); /// Initialize with values from \a i @@ -58,15 +58,15 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Iteration control //@{ /// Test whether iterator is still at a value or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next value (if possible) - void operator++(void); + void operator++(); //@} /// \name Value access //@{ /// Return current value - int val(void) const; + int val() const; //@} }; @@ -98,21 +98,21 @@ namespace Gecode { namespace Iter { namespace Values { template forceinline void - Positive::operator++(void) { + Positive::operator++() { ++i; } template forceinline bool - Positive::operator()(void) const { + Positive::operator()() const { return i(); } template forceinline int - Positive::val(void) const { + Positive::val() const { return i.val(); } -}}} // namespace Gecode::Iter::Values +} // namespace Gecode::Iter::Values // STATISTICS: iter-any diff --git a/gecode/iter/values-ranges.hpp b/gecode/iter/values-ranges.hpp index e192c9c4d5..f784de88be 100644 --- a/gecode/iter/values-ranges.hpp +++ b/gecode/iter/values-ranges.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Values { +namespace Gecode::Iter::Values { /** * \brief Range iterator from value iterator @@ -51,7 +51,7 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Constructors and initialization //@{ /// Default constructor - ToRanges(void) = default; + ToRanges() = default; /// Initialize with value iterator \a i ToRanges(I& i); /// Initialize with value iterator \a i @@ -61,13 +61,13 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Iteration control //@{ /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} }; template forceinline void - ToRanges::operator++(void) { + ToRanges::operator++() { if (!i()) { finish(); return; @@ -95,6 +95,6 @@ namespace Gecode { namespace Iter { namespace Values { operator++(); } -}}} // namespace Gecode::Iter::Values +} // namespace Gecode::Iter::Values // STATISTICS: iter-any diff --git a/gecode/iter/values-singleton.hpp b/gecode/iter/values-singleton.hpp index 49ca634243..7ab4a1d50d 100644 --- a/gecode/iter/values-singleton.hpp +++ b/gecode/iter/values-singleton.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Values { +namespace Gecode::Iter::Values { /** * \brief Value iterator for single value @@ -49,7 +49,7 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Constructors and initialization //@{ /// Default constructor - Singleton(void) = default; + Singleton() = default; /// Initialize with value \a v Singleton(int v); /// Initialize with value \a v @@ -59,15 +59,15 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Iteration control //@{ /// Test whether iterator is still at a value or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next value (if possible) - void operator++(void); + void operator++(); //@} /// \name %Value access //@{ /// Return current value - int val(void) const; + int val() const; //@} }; @@ -82,19 +82,19 @@ namespace Gecode { namespace Iter { namespace Values { } forceinline void - Singleton::operator++(void) { + Singleton::operator++() { done = true; } forceinline bool - Singleton::operator()(void) const { + Singleton::operator()() const { return !done; } forceinline int - Singleton::val(void) const { + Singleton::val() const { return v; } -}}} // namespace Gecode::Iter::Values +} // namespace Gecode::Iter::Values // STATISTICS: iter-any diff --git a/gecode/iter/values-union.hpp b/gecode/iter/values-union.hpp index 99a60eb9d9..491bf4a223 100644 --- a/gecode/iter/values-union.hpp +++ b/gecode/iter/values-union.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Values { +namespace Gecode::Iter::Values { /** * \brief Value iterator for the union of two value iterators @@ -54,7 +54,7 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Constructors and initialization //@{ /// Default constructor - Union(void); + Union(); /// Initialize with values from \a i and \a j Union(I& i, J& j); /// Initialize with values from \a i and \a j @@ -64,26 +64,26 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Iteration control //@{ /// Test whether iterator is still at a value or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next value (if possible) - void operator++(void); + void operator++(); //@} /// \name Value access //@{ /// Return current value - int val(void) const; + int val() const; //@} }; template forceinline - Union::Union(void) + Union::Union() : v(0) {} template forceinline void - Union::operator++(void) { + Union::operator++() { if (i()) { if (j()) { if (i.val() == j.val()) { @@ -128,16 +128,16 @@ namespace Gecode { namespace Iter { namespace Values { template forceinline bool - Union::operator()(void) const { + Union::operator()() const { return !done; } template forceinline int - Union::val(void) const { + Union::val() const { return v; } -}}} // namespace Gecode::Iter::Values +} // namespace Gecode::Iter::Values // STATISTICS: iter-any diff --git a/gecode/iter/values-unique.hpp b/gecode/iter/values-unique.hpp index 87d6e276c0..a8144ff4bc 100644 --- a/gecode/iter/values-unique.hpp +++ b/gecode/iter/values-unique.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Iter { namespace Values { +namespace Gecode::Iter::Values { /** * \brief Remove duplicate values from from value iterator @@ -51,7 +51,7 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Constructors and initialization //@{ /// Default constructor - Unique(void) = default; + Unique() = default; /// Initialize with value iterator \a i Unique(I& i); /// Initialize with value iterator \a i @@ -61,15 +61,15 @@ namespace Gecode { namespace Iter { namespace Values { /// \name Iteration control //@{ /// Test whether iterator is still at a value or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next unique value (if possible) - void operator++(void); + void operator++(); //@} /// \name Value access //@{ /// Return current value - int val(void) const; + int val() const; //@} }; @@ -86,7 +86,7 @@ namespace Gecode { namespace Iter { namespace Values { template forceinline void - Unique::operator++(void) { + Unique::operator++() { int n = i; do { ++i; @@ -94,16 +94,16 @@ namespace Gecode { namespace Iter { namespace Values { } template forceinline bool - Unique::operator()(void) const { + Unique::operator()() const { return i(); } template forceinline int - Unique::val(void) const { + Unique::val() const { return i.val(); } -}}} // namespace Gecode::Iter::Values +} // namespace Gecode::Iter::Values // STATISTICS: iter-any diff --git a/gecode/kernel.hh b/gecode/kernel.hh index 0d523b3b15..9403df7da6 100644 --- a/gecode/kernel.hh +++ b/gecode/kernel.hh @@ -84,26 +84,22 @@ * */ -namespace Gecode { - - /// Kernel configuration parameters - namespace Kernel { namespace Config { - /// Rescale factor for action and afc values - const double rescale = 1e-50; - /// Rescale action and afc values when larger than this - const double rescale_limit = DBL_MAX * rescale; - - /// Initial value for alpha in CHB - const double chb_alpha_init = 0.4; - /// Limit for decreasing alpha in CHB - const double chb_alpha_limit = 0.06; - /// Alpha decrement in CHB - const double chb_alpha_decrement = 1e-6; - /// Initial value for Q-score in CHB - const double chb_qscore_init = 0.05; - }} // namespace Kernel::Config - -} // namespace Gecode +/// Kernel configuration parameters +namespace Gecode::Kernel::Config { + /// Rescale factor for action and afc values + const double rescale = 1e-50; + /// Rescale action and afc values when larger than this + const double rescale_limit = DBL_MAX * rescale; + + /// Initial value for alpha in CHB + const double chb_alpha_init = 0.4; + /// Limit for decreasing alpha in CHB + const double chb_alpha_limit = 0.06; + /// Alpha decrement in CHB + const double chb_alpha_decrement = 1e-6; + /// Initial value for Q-score in CHB + const double chb_qscore_init = 0.05; +} // namespace Gecode::Kernel::Config /* * General exceptions and kernel exceptions diff --git a/gecode/kernel/archive.cpp b/gecode/kernel/archive.cpp index 3d048b0bd8..700c0b6e61 100644 --- a/gecode/kernel/archive.cpp +++ b/gecode/kernel/archive.cpp @@ -44,7 +44,7 @@ namespace Gecode { Archive::Archive(const Archive& e) : _size(e._n), _n(e._n), _a(nullptr), _pos(e._pos) { if (_n > 0) { _a = heap.alloc(_n); - heap.copy(_a, e._a, _n); + Gecode::Heap::copy(_a, e._a, _n); } } @@ -53,7 +53,7 @@ namespace Gecode { if (this != &e) { if (e._n > 0) { _a = heap.realloc(_a, _size, e._n); - heap.copy(_a, e._a, e._n); + Gecode::Heap::copy(_a, e._a, e._n); } else if (_a != nullptr) { heap.free(_a, _size); _a = nullptr; @@ -63,7 +63,7 @@ namespace Gecode { return *this; } - Archive::~Archive(void) { + Archive::~Archive() { if (_a != nullptr) heap.free(_a, _size); } diff --git a/gecode/kernel/archive.hpp b/gecode/kernel/archive.hpp index d15351c87e..6365ab698d 100644 --- a/gecode/kernel/archive.hpp +++ b/gecode/kernel/archive.hpp @@ -53,9 +53,9 @@ namespace Gecode { public: /// Construct empty representation - Archive(void); + Archive(); /// Destructor - GECODE_KERNEL_EXPORT ~Archive(void); + GECODE_KERNEL_EXPORT ~Archive(); /// Copy constructor GECODE_KERNEL_EXPORT Archive(const Archive& e); /// Assignment operator @@ -63,11 +63,11 @@ namespace Gecode { /// Add \a i to the contents void put(unsigned int i); /// Return size - int size(void) const; + int size() const; /// Return array element \a i unsigned int operator[](int i) const; /// Return next element to read - unsigned int get(void); + unsigned int get(); }; /** Add \a i to the end of \a e @@ -150,7 +150,7 @@ namespace Gecode { */ forceinline - Archive::Archive(void) + Archive::Archive() : _size(0), _n(0), _a(nullptr), _pos(0) {} forceinline void @@ -161,7 +161,7 @@ namespace Gecode { } forceinline int - Archive::size(void) const { + Archive::size() const { return _n; } @@ -172,7 +172,7 @@ namespace Gecode { } forceinline unsigned int - Archive::get(void) { + Archive::get() { assert(_pos < _n); return _a[_pos++]; } diff --git a/gecode/kernel/branch/action.cpp b/gecode/kernel/branch/action.cpp index 5f8ef7bdfb..5581416ae8 100644 --- a/gecode/kernel/branch/action.cpp +++ b/gecode/kernel/branch/action.cpp @@ -36,7 +36,7 @@ namespace Gecode { Support::Mutex Action::Storage::m; - Action::Storage::~Storage(void) { + Action::Storage::~Storage() { if (n > 0) heap.free(a, n); } diff --git a/gecode/kernel/branch/action.hpp b/gecode/kernel/branch/action.hpp index b1977b15ce..b3f4cbc67e 100644 --- a/gecode/kernel/branch/action.hpp +++ b/gecode/kernel/branch/action.hpp @@ -55,24 +55,23 @@ namespace Gecode { double* a; /// Initialize action values template - Storage(Home home, ViewArray& x, double d, - const typename BranchTraits::Merit& bm); + Storage(Home home, ViewArray& x, double d, const BranchTraits::Merit& bm); /// Update action value at position \a i void update(int i); /// Delete object GECODE_KERNEL_EXPORT - ~Storage(void) override; + ~Storage() override; }; /// Return object of correct type - Storage& object(void) const; + Storage& object() const; /// Set object to \a o void object(Storage& o); /// Update action value at position \a i void update(int i); /// Acquire mutex - void acquire(void); + void acquire(); /// Release mutex - void release(void); + void release(); public: /// \name Constructors and initialization @@ -84,7 +83,7 @@ namespace Gecode { * yet initialized action storage is init and the assignment operator. * */ - Action(void) = default; + Action() = default; /// Copy constructor GECODE_KERNEL_EXPORT Action(const Action& a) = default; @@ -99,7 +98,7 @@ namespace Gecode { */ template Action(Home home, ViewArray& x, double d, bool p, bool f, - const typename BranchTraits::Merit& bm); + const BranchTraits::Merit& bm); /** * \brief Initialize for views \a x and decay factor \a d and action as defined by \a bm * @@ -108,21 +107,21 @@ namespace Gecode { */ template void init(Home home, ViewArray& x, double d, bool p, bool f, - const typename BranchTraits::Merit& bm); + const BranchTraits::Merit& bm); /// Default (empty) action information GECODE_KERNEL_EXPORT static const Action def; //@} /// Destructor GECODE_KERNEL_EXPORT - ~Action(void) = default; + ~Action() = default; /// \name Information access //@{ /// Return action value at position \a i double operator[](int i) const; /// Return number of action values - int size(void) const; + int size() const; //@} /// \name Decay factor for aging @@ -153,17 +152,17 @@ namespace Gecode { /// Constructor for cloning \a a Idx(Space& home, Idx& a); /// Mark index as propagated - void propagate(void); + void propagate(); /// Mark index as failed - void fail(void); + void fail(); /// Whether index has been propagated - bool propagated(void) const; + bool propagated() const; /// Whether index has been failed - bool failed(void) const; + bool failed() const; /// Clear any information - void clear(void); + void clear(); /// Get index of view - int idx(void) const; + int idx() const; }; /// Access to action information Action a; @@ -214,32 +213,32 @@ namespace Gecode { : Advisor(home, a), _info(a._info) {} template forceinline void - Action::Recorder::Idx::propagate(void) { + Action::Recorder::Idx::propagate() { _info |= 1U; } template forceinline void - Action::Recorder::Idx::fail(void) { + Action::Recorder::Idx::fail() { _info |= 2U; } template forceinline bool - Action::Recorder::Idx::propagated(void) const { + Action::Recorder::Idx::propagated() const { return (_info & 1U) != 0; } template forceinline bool - Action::Recorder::Idx::failed(void) const { + Action::Recorder::Idx::failed() const { return (_info & 2U) != 0; } template forceinline void - Action::Recorder::Idx::clear(void) { + Action::Recorder::Idx::clear() { _info &= ~3U; } template forceinline int - Action::Recorder::Idx::idx(void) const { + Action::Recorder::Idx::idx() const { return static_cast(_info >> 2); } @@ -272,7 +271,7 @@ namespace Gecode { template forceinline Action::Storage::Storage(Home home, ViewArray& x, double d, - const typename BranchTraits::Merit& bm) + const BranchTraits::Merit& bm) : n(x.size()), invd(1.0 / d), a((n > 0) ? heap.alloc(n) : nullptr) { if (bm) for (int i = 0; i < n; i++) { @@ -302,7 +301,7 @@ namespace Gecode { */ forceinline Action::Storage& - Action::object(void) const { + Action::object() const { return static_cast(*SharedHandle::object()); } @@ -321,22 +320,22 @@ namespace Gecode { return object().a[i]; } forceinline int - Action::size(void) const { + Action::size() const { return object().n; } forceinline void - Action::acquire(void) { - object().m.acquire(); + Action::acquire() { + Gecode::Action::Storage::m.acquire(); } forceinline void - Action::release(void) { - object().m.release(); + Action::release() { + Gecode::Action::Storage::m.release(); } template forceinline Action::Action(Home home, ViewArray& x, double d, bool p, bool f, - const typename BranchTraits::Merit& bm) { + const BranchTraits::Merit& bm) { assert(!*this); if (!p && !f) return; @@ -353,7 +352,7 @@ namespace Gecode { template forceinline void Action::init(Home home, ViewArray& x, double d, bool p, bool f, - const typename BranchTraits::Merit& bm) { + const BranchTraits::Merit& bm) { assert(!*this); if (!p && !f) return; @@ -434,9 +433,8 @@ namespace Gecode { if (p) { a.propagate(); return ES_NOFIX; - } else { - return x[a.idx()].assigned() ? home.ES_FIX_DISPOSE(c, a) : ES_FIX; } + return x[a.idx()].assigned() ? home.ES_FIX_DISPOSE(c, a) : ES_FIX; } template diff --git a/gecode/kernel/branch/afc.hpp b/gecode/kernel/branch/afc.hpp index 540350197e..fb89beb14e 100644 --- a/gecode/kernel/branch/afc.hpp +++ b/gecode/kernel/branch/afc.hpp @@ -51,7 +51,7 @@ namespace Gecode { * yet initialized AFC storage is init and the assignment operator. * */ - AFC(void); + AFC(); /** \brief Initialize for variables \a x and decay factor \a d * * If several AFC objects are created for a space or its clones, @@ -69,7 +69,7 @@ namespace Gecode { template void init(Home home, const VarArgArray& x, double d, bool share = true); /// Test whether already initialized - operator bool(void) const; + operator bool() const; /// Default (empty) AFC information GECODE_KERNEL_EXPORT static const AFC def; //@} @@ -77,7 +77,7 @@ namespace Gecode { /// \name Information access //@{ /// Return number of AFC values - int size(void) const; + int size() const; //@} /// \name Decay factor for aging @@ -101,17 +101,17 @@ namespace Gecode { * */ forceinline int - AFC::size(void) const { + AFC::size() const { assert(n >= 0); return n; } forceinline - AFC::AFC(void) + AFC::AFC() : n(-1) {} forceinline AFC:: - operator bool(void) const { + operator bool() const { return n >= 0; } diff --git a/gecode/kernel/branch/chb.cpp b/gecode/kernel/branch/chb.cpp index 428e65a8d7..67ffd673c0 100644 --- a/gecode/kernel/branch/chb.cpp +++ b/gecode/kernel/branch/chb.cpp @@ -36,7 +36,7 @@ namespace Gecode { Support::Mutex CHB::Storage::m; - CHB::Storage::~Storage(void) { + CHB::Storage::~Storage() { if (n > 0) heap.free(chb, n); } diff --git a/gecode/kernel/branch/chb.hpp b/gecode/kernel/branch/chb.hpp index 0a86a4bfb9..3d120c4099 100644 --- a/gecode/kernel/branch/chb.hpp +++ b/gecode/kernel/branch/chb.hpp @@ -69,27 +69,27 @@ namespace Gecode { Info* chb; /// Initialize CHB info template - Storage(Home home, ViewArray& x, const typename BranchTraits::Merit& bm); + Storage(Home home, ViewArray& x, const BranchTraits::Merit& bm); /// Delete object GECODE_KERNEL_EXPORT - ~Storage(void) override; + ~Storage() override; /// Bump failure count and alpha - void bump(void); + void bump(); /// Update chb information at position \a i void update(int i, bool failed); }; /// Return object of correct type - Storage& object(void) const; + Storage& object() const; /// Set object to \a o void object(Storage& o); /// Update chb value at position \a i void update(int i); /// Acquire mutex - void acquire(void); + void acquire(); /// Release mutex - void release(void); + void release(); /// Bump failure count and alpha - void bump(void); + void bump(); /// Update chb information at position \a i void update(int i, bool failed); @@ -103,7 +103,7 @@ namespace Gecode { * yet initialized chb storage is init and the assignment operator. * */ - CHB(void) = default; + CHB() = default; /// Copy constructor GECODE_KERNEL_EXPORT CHB(const CHB& a) = default; @@ -116,28 +116,28 @@ namespace Gecode { * For empty \a x, store no values and post no recorder. */ template - CHB(Home home, ViewArray& x, const typename BranchTraits::Merit& bm); + CHB(Home home, ViewArray& x, const BranchTraits::Merit& bm); /** * \brief Initialize for views \a x and Q-score as defined by \a bm * * For empty \a x, store no values and post no recorder. */ template - void init(Home home, ViewArray& x, const typename BranchTraits::Merit& bm); + void init(Home home, ViewArray& x, const BranchTraits::Merit& bm); /// Default (empty) chb information GECODE_KERNEL_EXPORT static const CHB def; //@} /// Destructor GECODE_KERNEL_EXPORT - ~CHB(void) = default; + ~CHB() = default; /// \name Information access //@{ /// Return chb value at position \a i double operator[](int i) const; /// Return number of chb values - int size(void) const; + int size() const; //@} }; @@ -158,13 +158,13 @@ namespace Gecode { /// Constructor for cloning \a a Idx(Space& home, Idx& a); /// Mark advisor as modified - void mark(void); + void mark(); /// Mark advisor as unmodified - void unmark(void); + void unmark(); /// Whether advisor's view has been marked - bool marked(void) const; + bool marked() const; /// Get index of view - int idx(void) const; + int idx() const; }; /// Access to chb information CHB chb; @@ -199,7 +199,7 @@ namespace Gecode { * \relates CHB */ template - std::basic_ostream& operator<<(std::basic_ostream& os, const CHB& a); + std::basic_ostream& operator<<(std::basic_ostream& os, const CHB& chb); /* * Advisor for chb recorder @@ -215,23 +215,23 @@ namespace Gecode { : Advisor(home, a), _info(a._info) {} template forceinline void - CHB::Recorder::Idx::mark(void) { + CHB::Recorder::Idx::mark() { _info |= 1; } template forceinline bool - CHB::Recorder::Idx::marked(void) const { + CHB::Recorder::Idx::marked() const { return (_info & 1) != 0; } template forceinline void - CHB::Recorder::Idx::unmark(void) { + CHB::Recorder::Idx::unmark() { assert(marked()); _info -= 1; } template forceinline int - CHB::Recorder::Idx::idx(void) const { + CHB::Recorder::Idx::idx() const { return _info >> 1; } @@ -262,7 +262,7 @@ namespace Gecode { */ template forceinline - CHB::Storage::Storage(Home home, ViewArray& x, const typename BranchTraits::Merit& bm) + CHB::Storage::Storage(Home home, ViewArray& x, const BranchTraits::Merit& bm) : n(x.size()), nf(0U), alpha(Kernel::Config::chb_alpha_init), chb((n > 0) ? heap.alloc(n) : nullptr) { if (bm) { for (int i = 0; i < n; i++) { @@ -278,7 +278,7 @@ namespace Gecode { } } forceinline void - CHB::Storage::bump(void) { + CHB::Storage::bump() { nf++; if (alpha > Kernel::Config::chb_alpha_limit) { alpha -= Kernel::Config::chb_alpha_decrement; @@ -302,7 +302,7 @@ namespace Gecode { */ forceinline CHB::Storage& - CHB::object(void) const { + CHB::object() const { return static_cast(*SharedHandle::object()); } @@ -317,19 +317,19 @@ namespace Gecode { return object().chb[i].qs; } forceinline int - CHB::size(void) const { + CHB::size() const { return object().n; } forceinline void - CHB::acquire(void) { - object().m.acquire(); + CHB::acquire() { + Gecode::CHB::Storage::m.acquire(); } forceinline void - CHB::release(void) { - object().m.release(); + CHB::release() { + Gecode::CHB::Storage::m.release(); } forceinline void - CHB::bump(void) { + CHB::bump() { object().bump(); } forceinline void @@ -339,7 +339,7 @@ namespace Gecode { template forceinline - CHB::CHB(Home home, ViewArray& x, const typename BranchTraits::Merit& bm) { + CHB::CHB(Home home, ViewArray& x, const BranchTraits::Merit& bm) { assert(!*this); object(*new Storage(home, x, bm)); if (x.size() > 0) @@ -347,7 +347,7 @@ namespace Gecode { } template forceinline void - CHB::init(Home home, ViewArray& x, const typename BranchTraits::Merit& bm) { + CHB::init(Home home, ViewArray& x, const BranchTraits::Merit& bm) { assert(!*this); object(*new Storage(home, x, bm)); if (x.size() > 0) diff --git a/gecode/kernel/branch/filter.hpp b/gecode/kernel/branch/filter.hpp index 8c5aa1604f..51b345083e 100644 --- a/gecode/kernel/branch/filter.hpp +++ b/gecode/kernel/branch/filter.hpp @@ -43,7 +43,7 @@ namespace Gecode { class BrancherFilter { public: /// The corresponding variable type - typedef typename View::VarType Var; + using Var = View::VarType; protected: SharedData> f; @@ -54,11 +54,11 @@ namespace Gecode { /// Initialize during cloning BrancherFilter(BrancherFilter& bf); /// Whether filtering is enabled - operator bool(void) const; + operator bool() const; /// Invoke filter function bool operator()(const Space& home, View x, int i) const; /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const; + bool notice() const; /// Delete object void dispose(Space& home); }; @@ -68,21 +68,21 @@ namespace Gecode { class BrancherNoFilter { public: /// The corresponding variable type - typedef typename View::VarType Var; + using Var = View::VarType; - public: /// Initialize from the empty filter \a bf BrancherNoFilter(const BranchFilter& bf); /// Initialize from the empty filter \a bf, moved in as for BrancherFilter + // NOLINTNEXTLINE(cppcoreguidelines-rvalue-reference-param-not-moved): an empty filter holds nothing to move BrancherNoFilter(BranchFilter&& bf); /// Initialize during cloning BrancherNoFilter(BrancherNoFilter& bf); /// Whether filtering is enabled - operator bool(void) const; + operator bool() const; /// Invoke filter function bool operator()(const Space& home, View x, int i) const; /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const; + bool notice() const; /// Delete object void dispose(Space& home); }; @@ -102,7 +102,7 @@ namespace Gecode { template forceinline BrancherFilter:: - operator bool(void) const { + operator bool() const { return true; } @@ -116,7 +116,7 @@ namespace Gecode { template forceinline bool - BrancherFilter::notice(void) const { + BrancherFilter::notice() const { return true; } @@ -135,6 +135,7 @@ namespace Gecode { template forceinline + // NOLINTNEXTLINE(cppcoreguidelines-rvalue-reference-param-not-moved): an empty filter holds nothing to move BrancherNoFilter::BrancherNoFilter(BranchFilter&& bf) { assert(!bf); (void)bf; @@ -147,7 +148,7 @@ namespace Gecode { template forceinline BrancherNoFilter:: - operator bool(void) const { + operator bool() const { return false; } @@ -158,7 +159,7 @@ namespace Gecode { } template forceinline bool - BrancherNoFilter::notice(void) const { + BrancherNoFilter::notice() const { return false; } diff --git a/gecode/kernel/branch/function.cpp b/gecode/kernel/branch/function.cpp index 681f2678dc..86189510f0 100644 --- a/gecode/kernel/branch/function.cpp +++ b/gecode/kernel/branch/function.cpp @@ -34,7 +34,7 @@ #include -namespace Gecode { namespace Kernel { +namespace Gecode::Kernel { /// %Brancher for calling a function class FunctionBranch : public Brancher { @@ -135,7 +135,7 @@ namespace Gecode { namespace Kernel { return sizeof(*this); } -}} // namespace Gecode::Kernel +} // namespace Gecode::Kernel namespace Gecode { diff --git a/gecode/kernel/branch/merit.hpp b/gecode/kernel/branch/merit.hpp index 27b9d007a7..a425fb7dac 100644 --- a/gecode/kernel/branch/merit.hpp +++ b/gecode/kernel/branch/merit.hpp @@ -45,17 +45,17 @@ namespace Gecode { class MeritBase { public: /// View type - typedef View_ View; + using View = View_; /// Corresponding variable type - typedef typename View::VarType Var; + using Var = View::VarType; /// Type of merit - typedef Val_ Val; + using Val = Val_; /// Constructor for initialization MeritBase(Space& home, const VarBranch& vb); /// Constructor for cloning MeritBase(Space& home, MeritBase& mb); /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const; + bool notice() const; /// Delete view merit class void dispose(Space& home); }; @@ -69,7 +69,7 @@ namespace Gecode { public: /// Corresponding merit function type - typedef typename BranchTraits::Merit Function; + using Function = BranchTraits::Merit; protected: /// The user-defined merit function @@ -83,7 +83,7 @@ namespace Gecode { /// Return degree as merit for view \a x at position \a i double operator()(const Space& home, View x, int i); /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const; + bool notice() const; /// Delete view merit class void dispose(Space& home); }; @@ -123,7 +123,7 @@ namespace Gecode { /// Return AFC as merit for view \a x at position \a i double operator()(const Space& home, View x, int i); /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const; + bool notice() const; /// Dispose view selection void dispose(Space& home); }; @@ -147,7 +147,7 @@ namespace Gecode { /// Return action as merit for view \a x at position \a i double operator()(const Space& home, View x, int i); /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const; + bool notice() const; /// Dispose view selection void dispose(Space& home); }; @@ -172,7 +172,7 @@ namespace Gecode { /// Return action as merit for view \a x at position \a i double operator()(const Space& home, View x, int i); /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const; + bool notice() const; /// Dispose view selection void dispose(Space& home); }; @@ -187,7 +187,7 @@ namespace Gecode { MeritBase::MeritBase(Space&, MeritBase&) {} template forceinline bool - MeritBase::notice(void) const { + MeritBase::notice() const { return false; } template @@ -215,7 +215,7 @@ namespace Gecode { } template forceinline bool - MeritFunction::notice(void) const { + MeritFunction::notice() const { return true; } template @@ -255,7 +255,7 @@ namespace Gecode { } template forceinline bool - MeritAFC::notice(void) const { + MeritAFC::notice() const { // Given that AFC is just a fake, this not really necessary return false; } @@ -282,7 +282,7 @@ namespace Gecode { } template forceinline bool - MeritAction::notice(void) const { + MeritAction::notice() const { return true; } template @@ -307,7 +307,7 @@ namespace Gecode { } template forceinline bool - MeritCHB::notice(void) const { + MeritCHB::notice() const { return true; } template diff --git a/gecode/kernel/branch/print.hpp b/gecode/kernel/branch/print.hpp index d05ec090bc..bc6fe9c6b1 100644 --- a/gecode/kernel/branch/print.hpp +++ b/gecode/kernel/branch/print.hpp @@ -44,7 +44,7 @@ namespace Gecode { class BrancherPrint { public: /// The corresponding variable type - typedef typename View::VarType Var; + using Var = View::VarType; protected: SharedData> p; @@ -55,12 +55,12 @@ namespace Gecode { /// Initialize during cloning BrancherPrint(BrancherPrint& bp); /// Whether printing is enabled - operator bool(void) const; + operator bool() const; /// Invoke print function void operator()(const Space& home, const Brancher& b, unsigned int a, View x, int i, const Val& m, std::ostream& o) const; /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const; + bool notice() const; /// Delete void dispose(Space& home); }; @@ -70,22 +70,22 @@ namespace Gecode { class BrancherNoPrint { public: /// The corresponding variable type - typedef typename View::VarType Var; + using Var = View::VarType; - public: /// Initialize from the empty print function \a vvp BrancherNoPrint(const VarValPrint& vvp); /// Initialize from the empty print function \a vvp, moved in as for BrancherPrint + // NOLINTNEXTLINE(cppcoreguidelines-rvalue-reference-param-not-moved): an empty print function holds nothing to move BrancherNoPrint(VarValPrint&& vvp); /// Initialize during cloning BrancherNoPrint(BrancherNoPrint& bp); /// Whether printing is enabled - operator bool(void) const; + operator bool() const; /// Invoke print function void operator()(const Space& home, const Brancher& b, unsigned int a, View x, int i, const Val& m, std::ostream& o) const; /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const; + bool notice() const; /// Delete void dispose(Space& home); }; @@ -105,7 +105,7 @@ namespace Gecode { template forceinline BrancherPrint:: - operator bool(void) const { + operator bool() const { return true; } @@ -120,7 +120,7 @@ namespace Gecode { template forceinline bool - BrancherPrint::notice(void) const { + BrancherPrint::notice() const { return true; } @@ -139,6 +139,7 @@ namespace Gecode { template forceinline + // NOLINTNEXTLINE(cppcoreguidelines-rvalue-reference-param-not-moved): an empty print function holds nothing to move BrancherNoPrint::BrancherNoPrint(VarValPrint&& vvp) { assert(!vvp); (void)vvp; @@ -151,7 +152,7 @@ namespace Gecode { template forceinline BrancherNoPrint:: - operator bool(void) const { + operator bool() const { return false; } @@ -161,7 +162,7 @@ namespace Gecode { std::ostream&) const {} template forceinline bool - BrancherNoPrint::notice(void) const { + BrancherNoPrint::notice() const { return false; } diff --git a/gecode/kernel/branch/val-commit.hpp b/gecode/kernel/branch/val-commit.hpp index f0847c83f8..922025d5c9 100644 --- a/gecode/kernel/branch/val-commit.hpp +++ b/gecode/kernel/branch/val-commit.hpp @@ -43,19 +43,18 @@ namespace Gecode { class ValCommit { public: /// View type - typedef View_ View; + using View = View_; /// Corresponding variable type - typedef typename View::VarType Var; + using Var = View::VarType; /// Value type - typedef Val_ Val; + using Val = Val_; - public: /// Constructor for initialization ValCommit(Space& home, const ValBranch& vb); /// Constructor for cloning ValCommit(Space& home, ValCommit& vs); /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const; + bool notice() const; /// Delete value commit void dispose(Space& home); }; @@ -63,13 +62,13 @@ namespace Gecode { /// Class for user-defined value commit template class ValCommitFunction : public ValCommit::ValType> { - typedef typename ValCommit::ValType>::Val Val; + using Val = ValCommit::ValType>::Val; public: /// The corresponding variable type - typedef typename View::VarType Var; + using Var = View::VarType; /// The corresponding commit function - typedef typename BranchTraits::Commit CommitFunction; + using CommitFunction = BranchTraits::Commit; protected: /// The user-defined commit function @@ -87,7 +86,7 @@ namespace Gecode { /// Print on \a o the alternative \a with view \a x at position \a i and value \a n void print(const Space& home, unsigned int a, View x, int i, const Val& n, std::ostream& o) const; /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const; + bool notice() const; /// Delete value commit void dispose(Space& home); }; @@ -102,7 +101,7 @@ namespace Gecode { ValCommit::ValCommit(Space&, ValCommit&) {} template forceinline bool - ValCommit::notice(void) const { + ValCommit::notice() const { return false; } template @@ -141,7 +140,7 @@ namespace Gecode { } template forceinline bool - ValCommitFunction::notice(void) const { + ValCommitFunction::notice() const { return true; } template diff --git a/gecode/kernel/branch/val-sel-commit.hpp b/gecode/kernel/branch/val-sel-commit.hpp index 1e9bff968c..4191249451 100644 --- a/gecode/kernel/branch/val-sel-commit.hpp +++ b/gecode/kernel/branch/val-sel-commit.hpp @@ -49,17 +49,16 @@ namespace Gecode { } /// \copydoc Gecode::ViewSel::random virtual bool - random(void) const { + random() const { return false; } /// View type - typedef View_ View; + using View = View_; /// Corresponding variable type - typedef typename View::VarType Var; + using Var = View::VarType; /// Value type - typedef Val_ Val; + using Val = Val_; - public: /// Constructor for initialization ValSelCommitBase(Space& home, const ValBranch& vb); /// Constructor for cloning @@ -75,11 +74,11 @@ namespace Gecode { /// Perform cloning virtual ValSelCommitBase* copy(Space& home) = 0; /// Whether dispose must always be called (that is, notice is needed) - virtual bool notice(void) const = 0; + virtual bool notice() const = 0; /// Delete value selection virtual void dispose(Space& home) = 0; /// Unused destructor - virtual ~ValSelCommitBase(void); + virtual ~ValSelCommitBase(); /// \name Memory management //@{ /// Allocate memory from space @@ -95,9 +94,9 @@ namespace Gecode { template class ValSelCommit : public ValSelCommitBase { protected: - typedef typename ValSelCommitBase::Var Var; - typedef typename ValSelCommitBase::Val Val; - typedef typename ValSelCommitBase::View View; + using Var = ValSelCommitBase::Var; + using Val = ValSelCommitBase::Val; + using View = ValSelCommitBase::View; /// The value selection object used ValSel s; /// The commit object used @@ -109,7 +108,8 @@ namespace Gecode { s.random_split(a); } bool - random(void) const override { + random() const override { + // NOLINTNEXTLINE(clang-analyzer-security.insecureAPI.rand): a member random(), not the C library function return s.random(); } /// Constructor for initialization @@ -131,7 +131,7 @@ namespace Gecode { /// Perform cloning ValSelCommit* copy(Space& home) override; /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const override; + bool notice() const override; /// Delete value selection void dispose(Space& home) override; }; @@ -144,7 +144,7 @@ namespace Gecode { forceinline ValSelCommitBase::ValSelCommitBase(Space&, ValSelCommitBase&) {} template - ValSelCommitBase::~ValSelCommitBase(void) = default; + ValSelCommitBase::~ValSelCommitBase() = default; template forceinline void @@ -169,7 +169,7 @@ namespace Gecode { : ValSelCommitBase(home, vsc), s(home, vsc.s), c(home, vsc.c) {} template - typename ValSelCommit::Val + ValSelCommit::Val ValSelCommit::val(const Space& home, View x, int i) { return s.val(home, x, i); } @@ -201,7 +201,7 @@ namespace Gecode { template bool - ValSelCommit::notice(void) const { + ValSelCommit::notice() const { return s.notice() || c.notice(); } diff --git a/gecode/kernel/branch/val-sel.hpp b/gecode/kernel/branch/val-sel.hpp index 559b3f8c96..b9b78ffe94 100644 --- a/gecode/kernel/branch/val-sel.hpp +++ b/gecode/kernel/branch/val-sel.hpp @@ -49,23 +49,22 @@ namespace Gecode { } /// \copydoc Gecode::ViewSel::random bool - random(void) const { + random() const { return false; } /// View type - typedef View_ View; + using View = View_; /// Corresponding variable type - typedef typename View::VarType Var; + using Var = View::VarType; /// Value type - typedef Val_ Val; + using Val = Val_; - public: /// Constructor for initialization ValSel(Space& home, const ValBranch& vb); /// Constructor for cloning ValSel(Space& home, ValSel& vs); /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const; + bool notice() const; /// Delete value selection void dispose(Space& home); }; @@ -75,11 +74,11 @@ namespace Gecode { class ValSelFunction : public ValSel::ValType> { public: /// The corresponding variable type - typedef typename ValSel::ValType>::Var Var; + using Var = ValSel::ValType>::Var; /// The corresponding value type - typedef typename ValSel::ValType>::Val Val; + using Val = ValSel::ValType>::Val; /// The corresponding value function - typedef typename BranchTraits::Val ValFunction; + using ValFunction = BranchTraits::Val; protected: /// The user-defined value function @@ -93,7 +92,7 @@ namespace Gecode { /// Return user-defined value of view \a x at position \a i Val val(const Space& home, View x, int i); /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const; + bool notice() const; /// Delete value selection void dispose(Space& home); }; @@ -108,7 +107,7 @@ namespace Gecode { ValSel::ValSel(Space&, ValSel&) {} template forceinline bool - ValSel::notice(void) const { + ValSel::notice() const { return false; } template @@ -128,7 +127,7 @@ namespace Gecode { ValSelFunction::ValSelFunction(Space& home, ValSelFunction& vs) : ValSel(home, vs), v(vs.v) {} template - forceinline typename ValSelFunction::Val + forceinline ValSelFunction::Val ValSelFunction::val(const Space& home, View x, int i) { typename View::VarType y(x.varimp()); GECODE_VALID_FUNCTION(v()); @@ -136,7 +135,7 @@ namespace Gecode { } template forceinline bool - ValSelFunction::notice(void) const { + ValSelFunction::notice() const { return true; } template diff --git a/gecode/kernel/branch/val.hpp b/gecode/kernel/branch/val.hpp index d1426ce9ae..c955dd65b1 100644 --- a/gecode/kernel/branch/val.hpp +++ b/gecode/kernel/branch/val.hpp @@ -40,9 +40,9 @@ namespace Gecode { class ValBranch { public: /// The corresponding branching value function - typedef typename BranchTraits::Val BranchVal; + using BranchVal = BranchTraits::Val; /// The corresponding branching commit function - typedef typename BranchTraits::Commit BranchCommit; + using BranchCommit = BranchTraits::Commit; protected: /// Random number generator @@ -54,21 +54,21 @@ namespace Gecode { public: /// Initialize - ValBranch(void); + ValBranch(); /// Initialize with random number generator \a r ValBranch(const Rnd& r); /// Initialize with value function \a v and commit function \a c ValBranch(BranchVal v, BranchCommit c); /// Return random number generator - Rnd rnd(void) const; + Rnd rnd() const; /// Return value function - BranchVal val(void) const; + BranchVal val() const; /// Return commit function - BranchCommit commit(void) const; + BranchCommit commit() const; }; template - inline ValBranch::ValBranch(void) : vf(nullptr), cf(nullptr) {} + inline ValBranch::ValBranch() : vf(nullptr), cf(nullptr) {} template inline ValBranch::ValBranch(const Rnd& r0) : r(r0), vf(nullptr), cf(nullptr) {} @@ -78,19 +78,19 @@ namespace Gecode { template inline Rnd - ValBranch::rnd(void) const { + ValBranch::rnd() const { return r; } template - inline typename ValBranch::BranchVal - ValBranch::val(void) const { + inline ValBranch::BranchVal + ValBranch::val() const { return vf; } template - inline typename ValBranch::BranchCommit - ValBranch::commit(void) const { + inline ValBranch::BranchCommit + ValBranch::commit() const { return cf; } diff --git a/gecode/kernel/branch/var.hpp b/gecode/kernel/branch/var.hpp index af2360433a..d6d2875544 100644 --- a/gecode/kernel/branch/var.hpp +++ b/gecode/kernel/branch/var.hpp @@ -44,7 +44,7 @@ namespace Gecode { * * \ingroup TaskModelBranch */ - typedef std::function BranchTbl; + using BranchTbl = std::function; /** * \brief Variable branching information @@ -54,7 +54,7 @@ namespace Gecode { class VarBranch { public: /// Corresponding merit function - typedef typename BranchTraits::Merit MeritFunction; + using MeritFunction = BranchTraits::Merit; protected: /// Tie-breaking limit function @@ -74,7 +74,7 @@ namespace Gecode { public: /// Initialize - VarBranch(void); + VarBranch(); /// Initialize with tie-break limit function \a t VarBranch(BranchTbl t); /// Initialize with random number generator \a r @@ -90,30 +90,30 @@ namespace Gecode { /// Initialize with merit function \a f and tie-break limit function \a t VarBranch(MeritFunction f, BranchTbl t); /// Return tie-break limit function - BranchTbl tbl(void) const; + BranchTbl tbl() const; /// Return random number generator - Rnd rnd(void) const; + Rnd rnd() const; /// Return decay factor - double decay(void) const; + double decay() const; /// Return AFC - AFC afc(void) const; + AFC afc() const; /// Set AFC to \a a void afc(const AFC& a); /// Return action - Action action(void) const; + Action action() const; /// Set action to \a a void action(const Action& a); /// Return CHB - CHB chb(void) const; + CHB chb() const; /// Set CHB to \a chb void chb(const CHB& chb); /// Return merit function - MeritFunction merit(void) const; + MeritFunction merit() const; }; // Variable branching template - inline VarBranch::VarBranch(void) : _tbl(nullptr), _decay(1.0) {} + inline VarBranch::VarBranch() : _tbl(nullptr), _decay(1.0) {} template inline VarBranch::VarBranch(BranchTbl t) : _tbl(std::move(t)), _decay(1.0) {} @@ -148,25 +148,25 @@ namespace Gecode { template inline BranchTbl - VarBranch::tbl(void) const { + VarBranch::tbl() const { return _tbl; } template inline Rnd - VarBranch::rnd(void) const { + VarBranch::rnd() const { return _rnd; } template inline double - VarBranch::decay(void) const { + VarBranch::decay() const { return _decay; } template inline AFC - VarBranch::afc(void) const { + VarBranch::afc() const { return _afc; } @@ -178,7 +178,7 @@ namespace Gecode { template inline Action - VarBranch::action(void) const { + VarBranch::action() const { return _act; } @@ -190,7 +190,7 @@ namespace Gecode { template inline CHB - VarBranch::chb(void) const { + VarBranch::chb() const { return _chb; } @@ -201,8 +201,8 @@ namespace Gecode { } template - inline typename VarBranch::MeritFunction - VarBranch::merit(void) const { + inline VarBranch::MeritFunction + VarBranch::merit() const { return _mf; } diff --git a/gecode/kernel/branch/view-sel.hpp b/gecode/kernel/branch/view-sel.hpp index 470e5cde2e..e09f2657dd 100644 --- a/gecode/kernel/branch/view-sel.hpp +++ b/gecode/kernel/branch/view-sel.hpp @@ -55,13 +55,13 @@ namespace Gecode { } /// Whether the selector has random state, so that its brancher must split it virtual bool - random(void) const { + random() const { return false; } /// Define the view type - typedef View_ View; + using View = View_; /// The corresponding variable type - typedef typename View::VarType Var; + using Var = View::VarType; /// \name Initialization //@{ /// Constructor for creation @@ -93,11 +93,11 @@ namespace Gecode { /// Create copy during cloning virtual ViewSel* copy(Space& home) = 0; /// Whether dispose must always be called (that is, notice is needed) - virtual bool notice(void) const; + virtual bool notice() const; /// Dispose view selection virtual void dispose(Space& home); /// Unused destructor - virtual ~ViewSel(void); + virtual ~ViewSel(); //@} /// \name Memory management //@{ @@ -114,7 +114,7 @@ namespace Gecode { template class ViewSelNone : public ViewSel { protected: - typedef typename ViewSel::Var Var; + using Var = ViewSel::Var; public: /// \name Initialization @@ -150,7 +150,7 @@ namespace Gecode { template class ViewSelRnd : public ViewSel { protected: - typedef typename ViewSel::Var Var; + using Var = ViewSel::Var; /// The random number generator used Random r; @@ -160,7 +160,7 @@ namespace Gecode { r = r.split(a); } bool - random(void) const override { + random() const override { return true; } /// Construct a selector with a user-supplied value-type generator. @@ -192,7 +192,7 @@ namespace Gecode { /// Create copy during cloning ViewSel* copy(Space& home) override; /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const override; + bool notice() const override; /// Delete view selection void dispose(Space& home) override; //@} @@ -218,10 +218,10 @@ namespace Gecode { template class ViewSelChoose : public ViewSel { protected: - typedef typename ViewSel::Var Var; - typedef typename ViewSel::View View; + using Var = ViewSel::Var; + using View = ViewSel::View; /// Type of merit - typedef typename Merit::Val Val; + using Val = Merit::Val; /// How to choose Choose c; /// The merit object used @@ -253,7 +253,7 @@ namespace Gecode { /// \name Resource management and cloning //@{ /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const override; + bool notice() const override; /// Delete view selection void dispose(Space& home) override; //@} @@ -263,9 +263,9 @@ namespace Gecode { template class ViewSelChooseTbl : public ViewSelChoose { protected: - typedef typename ViewSelChoose::Val Val; - typedef typename ViewSelChoose::View View; - typedef typename ViewSelChoose::Var Var; + using Val = ViewSelChoose::Val; + using View = ViewSelChoose::View; + using Var = ViewSelChoose::Var; using ViewSelChoose::c; using ViewSelChoose::m; /// Tie-break limit function @@ -291,7 +291,7 @@ namespace Gecode { /// \name Resource management and cloning //@{ /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const override; + bool notice() const override; /// Delete view selection void dispose(Space& home) override; //@} @@ -300,8 +300,8 @@ namespace Gecode { /// Select view with least merit template class ViewSelMin : public ViewSelChoose { - typedef typename ViewSelChoose::View View; - typedef typename ViewSelChoose::Var Var; + using View = ViewSelChoose::View; + using Var = ViewSelChoose::Var; public: /// \name Initialization @@ -321,8 +321,8 @@ namespace Gecode { /// Select view with least merit taking tie-break limit into account template class ViewSelMinTbl : public ViewSelChooseTbl { - typedef typename ViewSelChooseTbl::View View; - typedef typename ViewSelChooseTbl::Var Var; + using View = ViewSelChooseTbl::View; + using Var = ViewSelChooseTbl::Var; public: /// \name Initialization @@ -342,8 +342,8 @@ namespace Gecode { /// Select view with largest merit template class ViewSelMax : public ViewSelChoose { - typedef typename ViewSelChoose::View View; - typedef typename ViewSelChoose::Var Var; + using View = ViewSelChoose::View; + using Var = ViewSelChoose::Var; public: /// \name Initialization @@ -363,8 +363,8 @@ namespace Gecode { /// Select view with largest merit taking tie-break limit into account template class ViewSelMaxTbl : public ViewSelChooseTbl { - typedef typename ViewSelChooseTbl::View View; - typedef typename ViewSelChooseTbl::Var Var; + using View = ViewSelChooseTbl::View; + using Var = ViewSelChooseTbl::Var; public: /// \name Initialization @@ -401,14 +401,14 @@ namespace Gecode { } template bool - ViewSel::notice(void) const { + ViewSel::notice() const { return false; } template void ViewSel::dispose(Space&) {} template - ViewSel::~ViewSel(void) = default; + ViewSel::~ViewSel() = default; template forceinline void ViewSel::operator delete(void*) {} @@ -545,8 +545,8 @@ namespace Gecode { } template forceinline bool - ViewSelRnd::notice(void) const { - return !std::is_trivially_destructible::value; + ViewSelRnd::notice() const { + return !std::is_trivially_destructible_v; } template forceinline void @@ -703,7 +703,7 @@ namespace Gecode { template bool - ViewSelChoose::notice(void) const { + ViewSelChoose::notice() const { return m.notice(); } @@ -840,7 +840,7 @@ namespace Gecode { } template bool - ViewSelChooseTbl::notice(void) const { + ViewSelChooseTbl::notice() const { return true; } template diff --git a/gecode/kernel/branch/view-val.hpp b/gecode/kernel/branch/view-val.hpp index 46c0f215b2..fd87af44cf 100644 --- a/gecode/kernel/branch/view-val.hpp +++ b/gecode/kernel/branch/view-val.hpp @@ -50,7 +50,7 @@ namespace Gecode { public: /// Initialize choice for brancher \a b, number of alternatives \a a, position \a p, and value \a n PosValChoice(const Brancher& b, unsigned int a, const Pos& p, const Val& n); - const Val& val(void) const; + const Val& val() const; /// Archive into \a e void archive(Archive& e) const override; }; @@ -93,7 +93,7 @@ namespace Gecode { using ViewBrancher::x; using ViewBrancher::f; /// The corresponding variable - typedef typename View::VarType Var; + using Var = View::VarType; /// Value selection and commit object ValSelCommitBase* vsc; /// Print function @@ -150,7 +150,7 @@ namespace Gecode { template forceinline const Val& - PosValChoice::val(void) const { + PosValChoice::val() const { return _val; } @@ -215,6 +215,7 @@ namespace Gecode { : ViewBrancher(home, x, vs, std::move(bf)), vsc(vsc0), p(std::move(vvp)) { vsc->random_split(this->id()); vsc->random_split(0U); + // NOLINTNEXTLINE(clang-analyzer-security.insecureAPI.rand): a member random(), not the C library function this->random_state = this->random_state || vsc->random(); if (vsc->notice() || f.notice() || p.notice()) home.notice(*this, AP_DISPOSE, true); diff --git a/gecode/kernel/branch/view.hpp b/gecode/kernel/branch/view.hpp index f0cd33eed3..5f1d7da075 100644 --- a/gecode/kernel/branch/view.hpp +++ b/gecode/kernel/branch/view.hpp @@ -62,7 +62,7 @@ namespace Gecode { /// Initialize choice for brancher \a b, number of alternatives \a a, and position \a p PosChoice(const Brancher& b, unsigned int a, const Pos& p); /// Return position in array - const Pos& pos(void) const; + const Pos& pos() const; /// Archive into \a e void archive(Archive& e) const override; }; @@ -77,7 +77,7 @@ namespace Gecode { class ViewBrancher : public Brancher { protected: /// The corresponding variable - typedef typename View::VarType Var; + using Var = View::VarType; /// Views to branch on ViewArray x; /// Unassigned views start at x[start] @@ -124,7 +124,7 @@ namespace Gecode { PosChoice::PosChoice(const Brancher& b, unsigned int a, const Pos& p) : Choice(b, a), _pos(p) {} forceinline const Pos& - PosChoice::pos(void) const { + PosChoice::pos() const { return _pos; } forceinline void @@ -143,6 +143,7 @@ namespace Gecode { // Key each selector by brancher and role; value selectors use role 0. vs[i]->random_split(id()); vs[i]->random_split(1U + static_cast(i)); + // NOLINTNEXTLINE(clang-analyzer-security.insecureAPI.rand): a member random(), not the C library function random_state = random_state || vs[i]->random(); } for (int i = 0; i < n; i++) diff --git a/gecode/kernel/core.cpp b/gecode/kernel/core.cpp index 40ee09ce38..cdc8320fad 100644 --- a/gecode/kernel/core.cpp +++ b/gecode/kernel/core.cpp @@ -51,7 +51,7 @@ namespace Gecode { void VarImpDisposerBase::dispose(Space&, VarImpBase*) {} - VarImpDisposerBase::~VarImpDisposerBase(void) = default; + VarImpDisposerBase::~VarImpDisposerBase() = default; /* * Actor @@ -59,7 +59,7 @@ namespace Gecode { */ Actor* Actor::sentinel; - Actor::~Actor(void) = default; + Actor::~Actor() = default; /* * Propagator @@ -112,7 +112,7 @@ namespace Gecode { VarImpDisposerBase* Space::vd[AllVarConf::idx_d]; #endif - Space::Space(void) : mm(ssd.data().sm), no_gpi(false) { + Space::Space() : mm(ssd.data().sm), no_gpi(false) { #ifdef GECODE_HAS_CBS var_id_counter = 0; #endif @@ -200,7 +200,7 @@ namespace Gecode { *f = *(--d_cur); } - Space::~Space(void) { + Space::~Space() { if (is_partial_clone()) { if (pc.c.source != nullptr) { recover(*pc.c.source); @@ -239,7 +239,7 @@ namespace Gecode { */ TraceRecorder* - Space::find_trace_recorder(void) { + Space::find_trace_recorder() { for (Actor** a = d_fst; a < d_cur; a++) { if (TraceRecorder* tr = dynamic_cast(*a)) if (!tr->disabled()) { @@ -559,7 +559,7 @@ namespace Gecode { } const Choice* - Space::choice(void) { + Space::choice() { if (!stable()) throw SpaceNotStable("Space::choice"); if (failed() || (b_status == &bl)) { @@ -671,9 +671,8 @@ namespace Gecode { if (Brancher* b = brancher(c.bid)) { // There is a matching brancher return b->ngl(*this, c, a); - } else { - return nullptr; } + return nullptr; } void @@ -737,8 +736,8 @@ namespace Gecode { _vars_d[i] = nullptr; #endif try { - for (int i = 0; i < AllVarConf::idx_c; i++) - pc.c.vars_u[i] = nullptr; + for (auto& head : pc.c.vars_u) + head = nullptr; pc.c.vars_noidx = nullptr; pc.c.local = nullptr; pc.c.source = &s; @@ -801,7 +800,7 @@ namespace Gecode { } Space* - Space::_clone(void) { + Space::_clone() { if (failed()) throw SpaceFailed("Space::clone"); if (!stable()) @@ -942,7 +941,7 @@ namespace Gecode { } void - Space::afc_unshare(void) { + Space::afc_unshare() { if (ssd.data().gpi.unshare()) { for (Propagators ps(*this); ps(); ++ps) { Propagator& p = ps.propagator(); @@ -970,11 +969,11 @@ namespace Gecode { } bool - NGL::notice(void) const { + NGL::notice() const { return false; } - NGL::~NGL(void) = default; + NGL::~NGL() = default; /* * Groups @@ -992,7 +991,7 @@ namespace Gecode { unsigned int Group::next = GROUPID_DEF + 1; Support::Mutex Group::m; - Group::Group(void) { + Group::Group() { { Support::Lock l(m); gid = next++; diff --git a/gecode/kernel/core.hpp b/gecode/kernel/core.hpp index a58538f056..bd2e2deeeb 100644 --- a/gecode/kernel/core.hpp +++ b/gecode/kernel/core.hpp @@ -47,6 +47,7 @@ * */ +#include #include #include @@ -85,7 +86,7 @@ namespace Gecode { */ //@{ /// Type for modification events - typedef int ModEvent; + using ModEvent = int; /// Generic modification event: failed variable const ModEvent ME_GEN_FAILED = -1; @@ -95,7 +96,7 @@ namespace Gecode { const ModEvent ME_GEN_ASSIGNED = 1; /// Type for propagation conditions - typedef int PropCond; + using PropCond = int; /// Propagation condition to be ignored (convenience) const PropCond PC_GEN_NONE = -1; /// Propagation condition for an assigned variable @@ -112,7 +113,7 @@ namespace Gecode { * a variable or view. * \ingroup TaskActor */ - typedef int ModEventDelta; + using ModEventDelta = int; } // namespace Gecode @@ -211,7 +212,7 @@ namespace Gecode { /// Dispose list of variable implementations starting at \a x GECODE_KERNEL_EXPORT virtual void dispose(Space& home, VarImpBase* x); /// Destructor (not used) - GECODE_KERNEL_EXPORT virtual ~VarImpDisposerBase(void); + GECODE_KERNEL_EXPORT virtual ~VarImpDisposerBase(); }; /** @@ -224,7 +225,7 @@ namespace Gecode { class VarImpDisposer : public VarImpDisposerBase { public: /// Constructor (registers disposer with kernel) - VarImpDisposer(void); + VarImpDisposer(); /// Dispose list of variable implementations starting at \a x void dispose(Space& home, VarImpBase* x) override; }; @@ -373,11 +374,11 @@ namespace Gecode { /// Creation VarImp(Space& home); /// Creation of static instances - VarImp(void); + VarImp(); #ifdef GECODE_HAS_CBS /// Return variable id - unsigned int id(void) const; + unsigned int id() const; #endif /// \name Dependencies @@ -415,14 +416,14 @@ namespace Gecode { * Note that the degree of a variable implementation is not available * during cloning. */ - unsigned int degree(void) const; + unsigned int degree() const; /** * \brief Return accumulated failure count (plus degree) * * Note that the accumulated failure count of a variable implementation * is not available during cloning. */ - double afc(void) const; + double afc() const; //@} /// \name Cloning variables @@ -430,11 +431,11 @@ namespace Gecode { /// Constructor for cloning VarImp(Space& home, VarImp& x); /// Is variable already copied - bool copied(void) const; + bool copied() const; /// Use forward pointer if variable already copied - VarImp* forward(void) const; + VarImp* forward() const; /// Return next copied variable - VarImp* next(void) const; + VarImp* next() const; //@} /// \name Variable implementation-dependent propagator support @@ -472,9 +473,9 @@ namespace Gecode { /// \name Bit management //@{ /// Provide access to free bits - unsigned int bits(void) const; + unsigned int bits() const; /// Provide access to free bits - unsigned int& bits(void); + unsigned int& bits(); //@} protected: @@ -543,7 +544,6 @@ namespace Gecode { /// Actual cost ActualCost ac; - public: /// Propagation cost modifier enum class Mod { LO, ///< Cheap @@ -559,7 +559,7 @@ namespace Gecode { public: /// For recording information (no propagation allowed) - static PropCost record(void); + static PropCost record(); /// Exponential complexity for modifier \a m and size measure \a n static PropCost crazy(PropCost::Mod m, unsigned int n); /// Exponential complexity for modifier \a m and size measure \a n @@ -641,23 +641,23 @@ namespace Gecode { public: //@{ /// Routines for double-linked list - ActorLink* prev(void) const; + ActorLink* prev() const; void prev(ActorLink*); - ActorLink* next(void) const; + ActorLink* next() const; void next(ActorLink*); - ActorLink** next_ref(void); + ActorLink** next_ref(); //@} /// Initialize links (self-linked) - void init(void); + void init(); /// Remove from predecessor and successor - void unlink(void); + void unlink(); /// Insert \a al directly after this void head(ActorLink* al); /// Insert \a al directly before this void tail(ActorLink* al); /// Test whether actor link is empty (points to itself) - bool empty(void) const; + bool empty() const; /// Static cast for a non-null pointer (to give a hint to optimizer) template static ActorLink* cast(T* a); @@ -704,9 +704,9 @@ namespace Gecode { /// No-op for exceptions static void operator delete(void* p, Space& home); //@} - public: + /// To avoid warnings - GECODE_KERNEL_EXPORT virtual ~Actor(void); + GECODE_KERNEL_EXPORT virtual ~Actor(); /// Not used static void* operator new(size_t s); /// Not used @@ -751,13 +751,13 @@ namespace Gecode { //@{ /// Constructor GECODE_KERNEL_EXPORT - Group(void); + Group(); /// Return a unique id for the group - unsigned int id(void) const; + unsigned int id() const; /// Check whether actor group \a a is included in this group bool in(Group a) const; /// Check whether this is a real group (and not just default) - bool in(void) const; + bool in() const; //@} /// Group of all actors GECODE_KERNEL_EXPORT @@ -785,7 +785,7 @@ namespace Gecode { /// \name Construction //@{ /// Constructor - PropagatorGroup(void) = default; + PropagatorGroup() = default; /// To augment a space argument Home operator()(Space& home); //@} @@ -850,7 +850,7 @@ namespace Gecode { /// \name Construction //@{ /// Constructor - BrancherGroup(void) = default; + BrancherGroup() = default; /// To augment a space argument Home operator()(Space& home); //@} @@ -859,8 +859,8 @@ namespace Gecode { /// Move branchers from group \a g to this group GECODE_KERNEL_EXPORT BrancherGroup& move(Space& home, BrancherGroup g); - /// Move brancher \a b to this group - BrancherGroup& move(Space& home, Brancher& b); + /// Move brancher \a p to this group + BrancherGroup& move(Space& home, Brancher& p); /** * \brief Move brancher with id \a id to this group * @@ -916,7 +916,7 @@ namespace Gecode { /// Homes are not assignable: a home never changes its space Home& operator=(const Home& h) = delete; /// Retrieve the space of the home - operator Space&(void); + operator Space&(); //@} /// \name Extended information //@{ @@ -927,18 +927,18 @@ namespace Gecode { /// Return a home extended by a brancher group Home operator()(BrancherGroup bg); /// Return propagator (or nullptr) for currently rewritten propagator - Propagator* propagator(void) const; + Propagator* propagator() const; /// Return propagator group - PropagatorGroup propagator_group(void) const; + PropagatorGroup propagator_group() const; /// Return brancher group - BrancherGroup brancher_group(void) const; + BrancherGroup brancher_group() const; //@} /// \name Forwarding of common space operations //@{ /// Check whether corresponding space is failed - bool failed(void) const; + bool failed() const; /// Mark space as failed - void fail(void); + void fail(); /// Notice actor property void notice(Actor& a, ActorProperty p, bool duplicate = false); //@} @@ -975,17 +975,17 @@ namespace Gecode { /// Record that a post function with propagator group \a g is executing void post(PropagatorGroup g); /// Record that nothing is known at this point - void other(void); + void other(); public: /// Return what is currently executing - What what(void) const; + What what() const; /// Return currently executing propagator - const Propagator& propagator(void) const; + const Propagator& propagator() const; /// Return currently executing brancher - const Brancher& brancher(void) const; + const Brancher& brancher() const; /// Return propagator group of currently executing post function - PropagatorGroup post(void) const; + PropagatorGroup post() const; }; /** @@ -1008,7 +1008,7 @@ namespace Gecode { /// Set information PostInfo(Home home); /// Reset information - ~PostInfo(void); + ~PostInfo(); }; /** @@ -1041,13 +1041,13 @@ namespace Gecode { public: /// Return propagator identifier - unsigned int id(void) const; + unsigned int id() const; /// Return propagator group - PropagatorGroup group(void) const; + PropagatorGroup group() const; /// Return pointer to non-subsumed propagator - const Propagator* propagator(void) const; + const Propagator* propagator() const; /// Return propagator status - Status status(void) const; + Status status() const; }; /** @@ -1068,15 +1068,15 @@ namespace Gecode { public: /// Return brancher identifier - unsigned int id(void) const; + unsigned int id() const; /// Return brancher group - BrancherGroup group(void) const; + BrancherGroup group() const; /// Return brancher - const Brancher& brancher(void) const; + const Brancher& brancher() const; /// Return choice - const Choice& choice(void) const; + const Choice& choice() const; /// Return alternative - unsigned int alternative(void) const; + unsigned int alternative() const; }; /** @@ -1107,11 +1107,11 @@ namespace Gecode { public: /// Return post status - Status status(void) const; + Status status() const; /// Return propagator group - PropagatorGroup group(void) const; + PropagatorGroup group() const; /// Return number of posted propagators - unsigned int propagators(void) const; + unsigned int propagators() const; }; /** @@ -1150,7 +1150,7 @@ namespace Gecode { /// Static cast for a non-null pointer (to give a hint to optimizer) static const Propagator* cast(const ActorLink* al); /// Whether propagator information is local to the space - bool local_info(void) const; + bool local_info() const; /// Disable propagator void disable(Space& home); /// Enable propagator @@ -1162,9 +1162,9 @@ namespace Gecode { /// Constructor for cloning \a p Propagator(Space& home, Propagator& p); /// Return forwarding pointer during copying - Propagator* fwd(void) const; + Propagator* fwd() const; /// Provide access to propagator information - Kernel::GPI::Info& gpi(void); + Kernel::GPI::Info& gpi(); public: /// \name Propagation @@ -1211,7 +1211,7 @@ namespace Gecode { * executing propagator and hence can only be called within the * propagate function of a propagator. */ - ModEventDelta modification_event_delta(void) const; + ModEventDelta modification_event_delta() const; /** * \brief Advise function * @@ -1256,7 +1256,7 @@ namespace Gecode { /// \name Information //@{ /// Return the accumulated failure count - double afc(void) const; + double afc() const; //@} #ifdef GECODE_HAS_CBS /// \name Marginal distribution @@ -1268,7 +1268,7 @@ namespace Gecode { * propagator. A callback is used to transmit each result. */ /// Signature for function transmitting marginal distributions - typedef std::function SendMarginal; + using SendMarginal = std::function; virtual void solution_distribution(Space& home, const SendMarginal& send) const; /** * \brief Sum of variable cardinalities @@ -1278,20 +1278,20 @@ namespace Gecode { * in branching decisions */ /// Signature for function testing if variables are candidates to branching decisions - typedef std::function InDecision; + using InDecision = std::function; virtual void domain_size_sum(const InDecision& in, unsigned int& size, unsigned int& size_b) const; //@} #endif /// \name Id and group support //@{ /// Return propagator id - unsigned int id(void) const; + unsigned int id() const; /// Return group propagator belongs to - PropagatorGroup group(void) const; + PropagatorGroup group() const; /// Add propagator to group \a g void group(PropagatorGroup g); /// Whether propagator is currently disabled - bool disabled(void) const; + bool disabled() const; //@} }; @@ -1313,11 +1313,11 @@ namespace Gecode { public: /// Default constructor - Council(void) = default; + Council() = default; /// Construct advisor council Council(Space& home); /// Test whether council has advisor left - bool empty(void) const; + bool empty() const; /// Update during cloning (copies all advisors) void update(Space& home, Council& c); /// Dispose council @@ -1338,11 +1338,11 @@ namespace Gecode { /// Initialize Advisors(const Council& c); /// Test whether there advisors left - bool operator()(void) const; + bool operator()() const; /// Move iterator to next advisor - void operator++(void); + void operator++(); /// Return advisor - A& advisor(void) const; + A& advisor() const; }; /** @@ -1366,7 +1366,7 @@ namespace Gecode { private: /// Is the advisor disposed? - bool disposed(void) const; + bool disposed() const; /// Static cast static Advisor* cast(ActorLink* al); /// Static cast @@ -1376,7 +1376,7 @@ namespace Gecode { protected: /// Return the advisor's propagator - Propagator& propagator(void) const; + Propagator& propagator() const; public: /// Constructor for creation @@ -1425,7 +1425,7 @@ namespace Gecode { }; using enum Status; /// Constructor for creation - NGL(void); + NGL(); /// Constructor for creation NGL(Space& home); /// Constructor for cloning \a ngl @@ -1444,15 +1444,15 @@ namespace Gecode { virtual NGL* copy(Space& home) = 0; /// Whether dispose must always be called (returns false) GECODE_KERNEL_EXPORT - virtual bool notice(void) const; + virtual bool notice() const; /// Dispose virtual size_t dispose(Space& home); /// \name Internal management routines //@{ /// Test whether literal is a leaf - bool leaf(void) const; + bool leaf() const; /// Return pointer to next literal - NGL* next(void) const; + NGL* next() const; /// Mark literal as leaf or not void leaf(bool l); /// %Set pointer to next literal @@ -1469,9 +1469,9 @@ namespace Gecode { /// Needed for exceptions static void operator delete(void* p); //@} - public: + /// To avoid warnings - GECODE_KERNEL_EXPORT virtual ~NGL(void); + GECODE_KERNEL_EXPORT virtual ~NGL(); /// Not used static void* operator new(size_t s); }; @@ -1493,17 +1493,17 @@ namespace Gecode { unsigned int alt; ///< Number of alternatives /// Return id of the creating brancher - unsigned int id(void) const; + unsigned int id() const; protected: /// Initialize for particular brancher \a b and alternatives \a a - Choice(const Brancher& b, const unsigned int a); + Choice(const Brancher& b, unsigned int a); public: /// Return number of alternatives - unsigned int alternatives(void) const; + unsigned int alternatives() const; /// Destructor - GECODE_KERNEL_EXPORT virtual ~Choice(void); + GECODE_KERNEL_EXPORT virtual ~Choice(); /// Archive into \a e GECODE_KERNEL_EXPORT virtual void archive(Archive& e) const; @@ -1608,9 +1608,9 @@ namespace Gecode { /// \name Id and group support //@{ /// Return brancher id - unsigned int id(void) const; + unsigned int id() const; /// Return group brancher belongs to - BrancherGroup group(void) const; + BrancherGroup group() const; /// Add brancher to group \a g void group(BrancherGroup g); //@} @@ -1657,7 +1657,7 @@ namespace Gecode { protected: /// Create local handle pointing to nullptr object - LocalHandle(void); + LocalHandle(); /// Create local handle that points to local object \a lo LocalHandle(LocalObject* lo); /// Copy constructor @@ -1669,7 +1669,7 @@ namespace Gecode { protected: /// Access to the local object - LocalObject* object(void) const; + LocalObject* object() const; /// Modify local object void object(LocalObject* n); }; @@ -1685,7 +1685,7 @@ namespace Gecode { public: /// Initialize - NoGoods(void); + NoGoods(); /// Copy constructor NoGoods(const NoGoods& ng); /// Assignment operator @@ -1694,11 +1694,11 @@ namespace Gecode { GECODE_KERNEL_EXPORT virtual void post(Space& home) const; /// Return number of no-goods posted - unsigned long int ng(void) const; + unsigned long int ng() const; /// %Set number of no-goods posted to \a n void ng(unsigned long int n); /// Destructor - virtual ~NoGoods(void); + virtual ~NoGoods(); /// Empty no-goods GECODE_KERNEL_EXPORT static NoGoods eng; @@ -1858,9 +1858,9 @@ namespace Gecode { /// Contexts are not assigned MetaContext& operator=(const MetaContext&) = delete; /// Return the engine calling the hook - MetaEngine engine(void) const; + MetaEngine engine() const; /// Return why the hook is called - MetaEvent event(void) const; + MetaEvent event() const; /** * \brief Return the episode, counting from zero * @@ -1869,31 +1869,31 @@ namespace Gecode { * \c Start); in spoke(), the episode that starts. PBS always passes * zero. */ - unsigned long int episode(void) const; + unsigned long int episode() const; /// Return the asset of a portfolio, counting from zero (zero for RBS) - unsigned int asset(void) const; + unsigned int asset() const; /// Return the number of assets of a portfolio (one for RBS) - unsigned int assets(void) const; + unsigned int assets() const; /** * \brief Return the most recent solution, or nullptr if none * * The engine owns the solution, and the pointer is valid only while * the hook runs: clone the solution to keep it. */ - const Space* last(void) const; + const Space* last() const; /** * \brief Return the statistics of the finished episode * * Empty for \c Start. Use the statistics of the engine for totals. */ - const Search::Statistics& statistics(void) const; + const Search::Statistics& statistics() const; /** * \brief Return the no-goods of the finished episode * * Empty unless the spoke of that episode has SpokeCoverage::Full, so * they can always be posted in the hub. */ - const NoGoods& nogoods(void) const; + const NoGoods& nogoods() const; }; /// Context passed to Space::hub() @@ -1914,7 +1914,7 @@ namespace Gecode { public: /// Return the decision - MetaDecision decision(void) const; + MetaDecision decision() const; /** * \brief Set the decision to \a d, the last one set counts * @@ -1940,7 +1940,7 @@ namespace Gecode { public: /// Return the coverage - SpokeCoverage coverage(void) const; + SpokeCoverage coverage() const; /// Set the coverage to \a c, the last one set counts void coverage(SpokeCoverage c); }; @@ -1988,9 +1988,9 @@ namespace Gecode { /// Number of propagator executions unsigned long long int propagate; /// Initialize - StatusStatistics(void); + StatusStatistics(); /// Reset information - void reset(void); + void reset(); /// Return sum with \a s StatusStatistics operator+(const StatusStatistics& s); /// Increment by statistics \a s @@ -2004,9 +2004,9 @@ namespace Gecode { class CloneStatistics { public: /// Initialize - CloneStatistics(void); + CloneStatistics(); /// Reset information - void reset(void); + void reset(); /// Return sum with \a s CloneStatistics operator+(const CloneStatistics& s); /// Increment by statistics \a s @@ -2020,9 +2020,9 @@ namespace Gecode { class CommitStatistics { public: /// Initialize - CommitStatistics(void); + CommitStatistics(); /// Reset information - void reset(void); + void reset(); /// Return sum with \a s CommitStatistics operator+(const CommitStatistics& s); /// Increment by statistics \a s @@ -2167,7 +2167,7 @@ namespace Gecode { VarImpBase* _vars_d[AllVarConf::idx_d]; /// Return reference to variables (dispose) template - VarImpBase* vars_d(void) const; + VarImpBase* vars_d() const; /// %Set reference to variables (dispose) template void vars_d(VarImpBase* x); @@ -2177,13 +2177,13 @@ namespace Gecode { //@} /// Recover variables without indexing structure - void recover_noidx(void); + void recover_noidx(); /// Recover after failed clone construction void recover(Space& source); /// Test whether clone construction has not reached a disposable state - bool is_partial_clone(void) const; + bool is_partial_clone() const; /// First actor for forced disposal Actor** d_fst; @@ -2212,7 +2212,7 @@ namespace Gecode { * of the Space class is not invoked during cloning. * */ - GECODE_KERNEL_EXPORT Space* _clone(void); + GECODE_KERNEL_EXPORT Space* _clone(); /** * \brief Commit choice \a c for alternative \a a @@ -2284,7 +2284,7 @@ namespace Gecode { /// Find trace recorder if exists GECODE_KERNEL_EXPORT - TraceRecorder* find_trace_recorder(void); + TraceRecorder* find_trace_recorder(); /// Trace posting event GECODE_KERNEL_EXPORT void post(const PostInfo& pi); @@ -2334,7 +2334,7 @@ namespace Gecode { /// Suppress global information for new propagators in \a home explicit NoGPI(Space& home); /// Restore the previous setting - ~NoGPI(void); + ~NoGPI(); }; /** @@ -2357,7 +2357,7 @@ namespace Gecode { /// Enable global information for new propagators in \a home explicit UseGPI(Space& home); /// Restore the previous setting - ~UseGPI(void); + ~UseGPI(); }; /** @@ -2365,7 +2365,7 @@ namespace Gecode { * \ingroup TaskModelScript */ GECODE_KERNEL_EXPORT - Space(void); + Space(); /** * \brief Constructor for cloning * @@ -2386,7 +2386,7 @@ namespace Gecode { * \ingroup TaskModelScript */ GECODE_KERNEL_EXPORT - virtual ~Space(void); + virtual ~Space(); /** * \brief Copying member function * @@ -2397,7 +2397,7 @@ namespace Gecode { * * \ingroup TaskModelScript */ - virtual Space* copy(void) = 0; + virtual Space* copy() = 0; /** * \brief Constrain function for best solution search * @@ -2506,7 +2506,7 @@ namespace Gecode { GECODE_KERNEL_EXPORT SpaceStatus status(StatusStatistics& stat); /// Query space status without collecting statistics - SpaceStatus status(void); + SpaceStatus status(); /** * \brief Reserve in this space the brancher ids that clone \a s uses * @@ -2551,7 +2551,7 @@ namespace Gecode { * \ingroup TaskSearch */ GECODE_KERNEL_EXPORT - const Choice* choice(void); + const Choice* choice(); /** * \brief Create new choice from \a e @@ -2581,7 +2581,7 @@ namespace Gecode { * \ingroup TaskSearch */ /// Clone space without collecting statistics - Space* clone(void) const; + Space* clone() const; /// Clone space Space* clone(CloneStatistics& stat) const; @@ -2828,7 +2828,7 @@ namespace Gecode { * a propagate or commit member function. The system will crash! * \ingroup TaskActor */ - void fail(void); + void fail(); /** * \brief Check whether space is failed * @@ -2837,12 +2837,12 @@ namespace Gecode { * actors are allowed to be created. * \ingroup TaskActor */ - bool failed(void) const; + bool failed() const; /** * \brief Return if space is stable (at fixpoint or failed) * \ingroup TaskActor */ - bool stable(void) const; + bool stable() const; /// \name Conversion from Space to Home //@{ @@ -3043,7 +3043,7 @@ namespace Gecode { void* rrealloc(void* b, size_t n, size_t m); /// Allocate from freelist-managed memory template - void* fl_alloc(void); + void* fl_alloc(); /** * \brief Return freelist-managed memory to freelist * @@ -3058,7 +3058,7 @@ namespace Gecode { * \brief Constructs a single object of type \a T from space heap using the default constructor. */ template - T& construct(void); + T& construct(); /** * \brief Constructs a single object of type \a T from space heap using a unary constructor. * @@ -3101,9 +3101,9 @@ namespace Gecode { /// %Set AFC decay factor to \a d void afc_decay(double d); /// Return AFC decay factor - double afc_decay(void) const; + double afc_decay() const; /// Unshare AFC information for all propagators - GECODE_KERNEL_EXPORT void afc_unshare(void); + GECODE_KERNEL_EXPORT void afc_unshare(); //@} protected: @@ -3127,11 +3127,11 @@ namespace Gecode { /// Initialize Propagators(Space& home); /// Test whether there are propagators left - bool operator()(void) const; + bool operator()() const; /// Move iterator to next propagator - void operator++(void); + void operator++(); /// Return propagator - Propagator& propagator(void) const; + Propagator& propagator() const; }; /** * \brief Class to iterate over scheduled propagators of a space @@ -3153,11 +3153,11 @@ namespace Gecode { /// Initialize ScheduledPropagators(Space& home); /// Test whether there are propagators left - bool operator()(void) const; + bool operator()() const; /// Move iterator to next propagator - void operator++(void); + void operator++(); /// Return propagator - Propagator& propagator(void) const; + Propagator& propagator() const; }; /** * \brief Class to iterate over idle propagators of a space @@ -3175,11 +3175,11 @@ namespace Gecode { /// Initialize IdlePropagators(Space& home); /// Test whether there are propagators left - bool operator()(void) const; + bool operator()() const; /// Move iterator to next propagator - void operator++(void); + void operator++(); /// Return propagator - Propagator& propagator(void) const; + Propagator& propagator() const; }; /** * \brief Class to iterate over branchers of a space @@ -3197,11 +3197,11 @@ namespace Gecode { /// Initialize Branchers(Space& home); /// Test whether there are branchers left - bool operator()(void) const; + bool operator()() const; /// Move iterator to next brancher - void operator++(void); + void operator++(); /// Return propagator - Brancher& brancher(void) const; + Brancher& brancher() const; }; }; @@ -3217,11 +3217,11 @@ namespace Gecode { /// Initialize Propagators(const Space& home, PropagatorGroup g); /// Test whether there are propagators left - bool operator()(void) const; + bool operator()() const; /// Move iterator to next propagator - void operator++(void); + void operator++(); /// Return propagator - const Propagator& propagator(void) const; + const Propagator& propagator() const; }; /// Class to iterate over branchers in a group @@ -3236,11 +3236,11 @@ namespace Gecode { /// Initialize Branchers(const Space& home, BrancherGroup g); /// Test whether there are branchers left - bool operator()(void) const; + bool operator()() const; /// Move iterator to next brancher - void operator++(void); + void operator++(); /// Return propagator - const Brancher& brancher(void) const; + const Brancher& brancher() const; }; /* @@ -3255,7 +3255,7 @@ namespace Gecode { } forceinline void Space::rfree(void* p, size_t s) { - return mm.reuse(p, s); + mm.reuse(p, s); } forceinline void* Space::rrealloc(void* _b, size_t n, size_t m) { @@ -3267,15 +3267,14 @@ namespace Gecode { rfree(b, n); } return p; - } else { - rfree(b + m, n - m); - return b; } + rfree(b + m, n - m); + return b; } template forceinline void* - Space::fl_alloc(void) { + Space::fl_alloc() { return mm.template fl_alloc(ssd.data().sm); } template @@ -3350,10 +3349,9 @@ namespace Gecode { (void)new (p + i) T(); free(b, n); return p; - } else { - free(b + m, n - m); - return b; } + free(b + m, n - m); + return b; } template forceinline T* @@ -3433,7 +3431,7 @@ namespace Gecode { #ifdef GECODE_HAS_VAR_DISPOSE template forceinline VarImpBase* - Space::vars_d(void) const { + Space::vars_d() const { return _vars_d[VIC::idx_d]; } template @@ -3444,7 +3442,7 @@ namespace Gecode { #endif forceinline bool - Space::is_partial_clone(void) const { + Space::is_partial_clone() const { return d_fst == &Actor::sentinel; } @@ -3495,7 +3493,7 @@ namespace Gecode { * */ forceinline - NoGoods::NoGoods(void) + NoGoods::NoGoods() : n(0) {} forceinline NoGoods::NoGoods(const NoGoods& ng0) @@ -3506,14 +3504,14 @@ namespace Gecode { return *this; } forceinline unsigned long int - NoGoods::ng(void) const { + NoGoods::ng() const { return n.load(std::memory_order_acquire); } forceinline void NoGoods::ng(unsigned long int n0) { n.store(n0, std::memory_order_release); } - forceinline NoGoods::~NoGoods(void) = default; + forceinline NoGoods::~NoGoods() = default; /* * Contexts of meta search hooks @@ -3525,35 +3523,35 @@ namespace Gecode { : _engine(engine), _event(event), _episode(episode), _asset(asset), _assets(assets), _last(last), _statistics(statistics), _nogoods(nogoods) {} forceinline MetaEngine - MetaContext::engine(void) const { + MetaContext::engine() const { return _engine; } forceinline MetaEvent - MetaContext::event(void) const { + MetaContext::event() const { return _event; } forceinline unsigned long int - MetaContext::episode(void) const { + MetaContext::episode() const { return _episode; } forceinline unsigned int - MetaContext::asset(void) const { + MetaContext::asset() const { return _asset; } forceinline unsigned int - MetaContext::assets(void) const { + MetaContext::assets() const { return _assets; } forceinline const Space* - MetaContext::last(void) const { + MetaContext::last() const { return _last; } forceinline const Search::Statistics& - MetaContext::statistics(void) const { + MetaContext::statistics() const { return _statistics; } forceinline const NoGoods& - MetaContext::nogoods(void) const { + MetaContext::nogoods() const { return _nogoods; } @@ -3570,7 +3568,7 @@ namespace Gecode { assert(legal(event, d)); } forceinline MetaDecision - HubContext::decision(void) const { + HubContext::decision() const { return _decision; } forceinline void @@ -3587,7 +3585,7 @@ namespace Gecode { : MetaContext(engine, event, episode, asset, assets, last, statistics, nogoods), _coverage(SpokeCoverage::Full) {} forceinline SpokeCoverage - SpokeContext::coverage(void) const { + SpokeContext::coverage() const { return _coverage; } forceinline void @@ -3613,17 +3611,17 @@ namespace Gecode { * */ forceinline ActorLink* - ActorLink::prev(void) const { + ActorLink::prev() const { return _prev; } forceinline ActorLink* - ActorLink::next(void) const { + ActorLink::next() const { return _next; } forceinline ActorLink** - ActorLink::next_ref(void) { + ActorLink::next_ref() { return &_next; } @@ -3638,7 +3636,7 @@ namespace Gecode { } forceinline void - ActorLink::unlink(void) { + ActorLink::unlink() { ActorLink* p = _prev; ActorLink* n = _next; p->_next = n; @@ -3646,7 +3644,7 @@ namespace Gecode { } forceinline void - ActorLink::init(void) { + ActorLink::init() { _next = this; _prev = this; } @@ -3672,7 +3670,7 @@ namespace Gecode { } forceinline bool - ActorLink::empty(void) const { + ActorLink::empty() const { return _next == this; } @@ -3682,7 +3680,7 @@ namespace Gecode { // Turning al into a reference is for gcc, assume is for MSVC GECODE_NOT_NULL(a); ActorLink& t = *a; - return static_cast(&t); + return (&t); } template @@ -3691,7 +3689,7 @@ namespace Gecode { // Turning al into a reference is for gcc, assume is for MSVC GECODE_NOT_NULL(a); const ActorLink& t = *a; - return static_cast(&t); + return (&t); } /* @@ -3720,7 +3718,7 @@ namespace Gecode { } forceinline SpaceStatus - Space::status(void) { + Space::status() { StatusStatistics stat; return status(stat); } @@ -3733,7 +3731,7 @@ namespace Gecode { } forceinline Space* - Space::clone(void) const { + Space::clone() const { CloneStatistics stat; return clone(stat); } @@ -3769,7 +3767,7 @@ namespace Gecode { } forceinline double - Space::afc_decay(void) const { + Space::afc_decay() const { return ssd.data().gpi.decay(); } @@ -3791,7 +3789,7 @@ namespace Gecode { Home::Home(Space& s0, Propagator* p0, PropagatorGroup pg0, BrancherGroup bg0) : s(s0), p(p0), pg(pg0), bg(bg0) {} forceinline Home:: - operator Space&(void) { + operator Space&() { return s; } forceinline Home @@ -3819,15 +3817,15 @@ namespace Gecode { return Home(*this, nullptr, PropagatorGroup::def, bg); } forceinline Propagator* - Home::propagator(void) const { + Home::propagator() const { return p; } forceinline PropagatorGroup - Home::propagator_group(void) const { + Home::propagator_group() const { return pg; } forceinline BrancherGroup - Home::brancher_group(void) const { + Home::brancher_group() const { return bg; } @@ -3848,26 +3846,26 @@ namespace Gecode { who = (static_cast(g.id()) << 2) | std::to_underlying(POST); } forceinline void - ViewTraceInfo::other(void) { + ViewTraceInfo::other() { who = std::to_underlying(OTHER); } forceinline ViewTraceInfo::What - ViewTraceInfo::what(void) const { + ViewTraceInfo::what() const { return static_cast(who & 0b11); } forceinline const Propagator& - ViewTraceInfo::propagator(void) const { + ViewTraceInfo::propagator() const { assert(what() == PROPAGATOR); // Because PROPAGATOR == 0 return *reinterpret_cast(who); } forceinline const Brancher& - ViewTraceInfo::brancher(void) const { + ViewTraceInfo::brancher() const { assert(what() == BRANCHER); return *reinterpret_cast(who & ~static_cast(0b11)); } forceinline PropagatorGroup - ViewTraceInfo::post(void) const { + ViewTraceInfo::post() const { assert(what() == POST); return PropagatorGroup(static_cast(who >> 2)); } @@ -3882,7 +3880,7 @@ namespace Gecode { h.pc.p.vti.post(pg); } - forceinline PostInfo::~PostInfo(void) { + forceinline PostInfo::~PostInfo() { if (!nested) { if (h.pc.p.bid_sc & Space::sc_trace) h.post(*this); @@ -3898,19 +3896,19 @@ namespace Gecode { PropagateTraceInfo::PropagateTraceInfo(unsigned int i0, PropagatorGroup g0, const Propagator* p0, Status s0) : i(i0), g(g0), p(p0), s(s0) {} forceinline unsigned int - PropagateTraceInfo::id(void) const { + PropagateTraceInfo::id() const { return i; } forceinline PropagatorGroup - PropagateTraceInfo::group(void) const { + PropagateTraceInfo::group() const { return g; } forceinline const Propagator* - PropagateTraceInfo::propagator(void) const { + PropagateTraceInfo::propagator() const { return p; } forceinline PropagateTraceInfo::Status - PropagateTraceInfo::status(void) const { + PropagateTraceInfo::status() const { return s; } @@ -3922,23 +3920,23 @@ namespace Gecode { CommitTraceInfo::CommitTraceInfo(const Brancher& b0, const Choice& c0, unsigned int a0) : b(b0), c(c0), a(a0) {} forceinline unsigned int - CommitTraceInfo::id(void) const { + CommitTraceInfo::id() const { return b.id(); } forceinline BrancherGroup - CommitTraceInfo::group(void) const { + CommitTraceInfo::group() const { return b.group(); } forceinline const Brancher& - CommitTraceInfo::brancher(void) const { + CommitTraceInfo::brancher() const { return b; } forceinline const Choice& - CommitTraceInfo::choice(void) const { + CommitTraceInfo::choice() const { return c; } forceinline unsigned int - CommitTraceInfo::alternative(void) const { + CommitTraceInfo::alternative() const { return a; } @@ -3950,15 +3948,15 @@ namespace Gecode { PostTraceInfo::PostTraceInfo(PropagatorGroup g0, Status s0, unsigned int n0) : g(g0), s(s0), n(n0) {} forceinline PropagatorGroup - PostTraceInfo::group(void) const { + PostTraceInfo::group() const { return g; } forceinline PostTraceInfo::Status - PostTraceInfo::status(void) const { + PostTraceInfo::status() const { return s; } forceinline unsigned int - PostTraceInfo::propagators(void) const { + PostTraceInfo::propagators() const { return n; } @@ -3968,7 +3966,7 @@ namespace Gecode { home.no_gpi = true; } - forceinline Space::NoGPI::~NoGPI(void) { + forceinline Space::NoGPI::~NoGPI() { home.no_gpi = previous; } @@ -3978,7 +3976,7 @@ namespace Gecode { home.no_gpi = false; } - forceinline Space::UseGPI::~UseGPI(void) { + forceinline Space::UseGPI::~UseGPI() { home.no_gpi = previous; } @@ -4003,17 +4001,17 @@ namespace Gecode { } forceinline Propagator* - Propagator::fwd(void) const { + Propagator::fwd() const { return static_cast(prev()); } forceinline bool - Propagator::local_info(void) const { + Propagator::local_info() const { return (reinterpret_cast(gpi_disabled) & 0b10) != 0; } forceinline bool - Propagator::disabled(void) const { + Propagator::disabled() const { return Support::marked(gpi_disabled); } @@ -4030,7 +4028,7 @@ namespace Gecode { } forceinline Kernel::GPI::Info& - Propagator::gpi(void) { + Propagator::gpi() { return *static_cast(Support::clear_pointer_tag_bits<2>(gpi_disabled)); } @@ -4065,12 +4063,12 @@ namespace Gecode { } forceinline ModEventDelta - Propagator::modification_event_delta(void) const { + Propagator::modification_event_delta() const { return u.med; } forceinline double - Propagator::afc(void) const { + Propagator::afc() const { return const_cast(*this).gpi().afc; } @@ -4086,12 +4084,12 @@ namespace Gecode { #endif forceinline unsigned int - Propagator::id(void) const { + Propagator::id() const { return const_cast(*this).gpi().pid; } forceinline PropagatorGroup - Propagator::group(void) const { + Propagator::group() const { return PropagatorGroup(const_cast(*this).gpi().gid); } @@ -4155,9 +4153,9 @@ namespace Gecode { if ((home.pc.p.bid_sc >> Space::sc_bits) == 0U) throw TooManyBranchers("Brancher::Brancher"); // If no brancher available, make it the first one - if (home.b_status == &static_cast(home).bl) { + if (home.b_status == &home.bl) { home.b_status = this; - if (home.b_commit == &static_cast(home).bl) + if (home.b_commit == &home.bl) home.b_commit = this; } home.bl.tail(this); @@ -4171,12 +4169,12 @@ namespace Gecode { } forceinline unsigned int - Brancher::id(void) const { + Brancher::id() const { return bid; } forceinline BrancherGroup - Brancher::group(void) const { + Brancher::group() const { return BrancherGroup(gid); } @@ -4291,13 +4289,13 @@ namespace Gecode { } forceinline - LocalHandle::LocalHandle(void) + LocalHandle::LocalHandle() : o(nullptr) {} forceinline LocalHandle::LocalHandle(LocalObject* lo) : o(lo) {} forceinline LocalObject* - LocalHandle::object(void) const { + LocalHandle::object() const { return o; } forceinline void @@ -4318,27 +4316,27 @@ namespace Gecode { : bid(b.id()), alt(a) {} forceinline unsigned int - Choice::alternatives(void) const { + Choice::alternatives() const { return alt; } forceinline unsigned int - Choice::id(void) const { + Choice::id() const { return bid; } - forceinline Choice::~Choice(void) = default; + forceinline Choice::~Choice() = default; /* * No-good literal * */ forceinline bool - NGL::leaf(void) const { + NGL::leaf() const { return Support::marked(nl); } forceinline NGL* - NGL::next(void) const { + NGL::next() const { return static_cast(Support::clear_pointer_tag_bits(nl)); } forceinline void @@ -4357,7 +4355,7 @@ namespace Gecode { } forceinline - NGL::NGL(void) + NGL::NGL() : nl(nullptr) {} forceinline NGL::NGL(Space&) @@ -4388,7 +4386,7 @@ namespace Gecode { Advisor::Advisor(Space&, Advisor&) {} forceinline bool - Advisor::disposed(void) const { + Advisor::disposed() const { return prev() == nullptr; } @@ -4408,7 +4406,7 @@ namespace Gecode { } forceinline Propagator& - Advisor::propagator(void) const { + Advisor::propagator() const { assert(!disposed()); return *Propagator::cast(ActorLink::prev()); } @@ -4462,7 +4460,7 @@ namespace Gecode { template forceinline bool - Council::empty(void) const { + Council::empty() const { ActorLink* a = advisors; while ((a != nullptr) && static_cast(a)->disposed()) a = a->next(); @@ -4551,13 +4549,13 @@ namespace Gecode { template forceinline bool - Advisors::operator()(void) const { + Advisors::operator()() const { return a != nullptr; } template forceinline void - Advisors::operator++(void) { + Advisors::operator++() { do { a = a->next(); } while ((a != nullptr) && static_cast(a)->disposed()); @@ -4565,7 +4563,7 @@ namespace Gecode { template forceinline A& - Advisors::advisor(void) const { + Advisors::advisor() const { return *static_cast(a); } @@ -4578,12 +4576,11 @@ namespace Gecode { ActorLink::cast(p)->unlink(); ActorLink* c = &pc.p.queue[std::to_underlying(p->cost(*this, p->u.med).ac)]; c->tail(ActorLink::cast(p)); - if (c > pc.p.active) - pc.p.active = c; + pc.p.active = std::max(c, pc.p.active); } forceinline void - Space::fail(void) { + Space::fail() { pc.p.active = &pc.p.queue[std::to_underlying(PropCost::AC_MAX) + 1] + 1; /* * Now active points beyond the last queue. This is essential as @@ -4592,21 +4589,21 @@ namespace Gecode { */ } forceinline void - Home::fail(void) { + Home::fail() { s.fail(); } forceinline bool - Space::failed(void) const { + Space::failed() const { return pc.p.active > &pc.p.queue[std::to_underlying(PropCost::AC_MAX) + 1]; } forceinline bool - Home::failed(void) const { + Home::failed() const { return s.failed(); } forceinline bool - Space::stable(void) const { + Space::stable() const { return ((pc.p.active < &pc.p.queue[0]) || (pc.p.active > &pc.p.queue[std::to_underlying(PropCost::AC_MAX) + 1])); } @@ -4697,7 +4694,7 @@ namespace Gecode { template forceinline - VarImp::VarImp(void) + VarImp::VarImp() #ifdef GECODE_HAS_CBS : var_id(0) #endif @@ -4712,21 +4709,21 @@ namespace Gecode { #ifdef GECODE_HAS_CBS template forceinline unsigned int - VarImp::id(void) const { + VarImp::id() const { return var_id; } #endif template forceinline unsigned int - VarImp::degree(void) const { + VarImp::degree() const { assert(!copied()); return entries; } template forceinline double - VarImp::afc(void) const { + VarImp::afc() const { double d = 0.0; // Count the afc of each propagator { @@ -4757,13 +4754,13 @@ namespace Gecode { template forceinline unsigned int - VarImp::bits(void) const { + VarImp::bits() const { return free_and_bits; } template forceinline unsigned int& - VarImp::bits(void) { + VarImp::bits() { return free_and_bits; } @@ -4783,20 +4780,20 @@ namespace Gecode { template forceinline bool - VarImp::copied(void) const { + VarImp::copied() const { return Support::marked(b.fwd); } template forceinline VarImp* - VarImp::forward(void) const { + VarImp::forward() const { assert(copied()); return static_cast*>(Support::unmark(b.fwd)); } template forceinline VarImp* - VarImp::next(void) const { + VarImp::next() const { assert(copied()); return u.next; } @@ -5263,7 +5260,7 @@ namespace Gecode { * */ template - VarImpDisposer::VarImpDisposer(void) { + VarImpDisposer::VarImpDisposer() { #ifdef GECODE_HAS_VAR_DISPOSE Space::vd[VarImp::idx_d] = this; #endif @@ -5284,11 +5281,11 @@ namespace Gecode { */ forceinline void - StatusStatistics::reset(void) { + StatusStatistics::reset() { propagate = 0; } forceinline - StatusStatistics::StatusStatistics(void) { + StatusStatistics::StatusStatistics() { reset(); } forceinline StatusStatistics& @@ -5303,10 +5300,10 @@ namespace Gecode { } forceinline void - CloneStatistics::reset(void) {} + CloneStatistics::reset() {} forceinline - CloneStatistics::CloneStatistics(void) { + CloneStatistics::CloneStatistics() { reset(); } forceinline CloneStatistics @@ -5320,10 +5317,10 @@ namespace Gecode { } forceinline void - CommitStatistics::reset(void) {} + CommitStatistics::reset() {} forceinline - CommitStatistics::CommitStatistics(void) { + CommitStatistics::CommitStatistics() { reset(); } forceinline CommitStatistics @@ -5349,16 +5346,15 @@ namespace Gecode { PropCost::cost(PropCost::Mod m, PropCost::ActualCost lo, PropCost::ActualCost hi, unsigned int n) { if (n < 2) return (m == LO) ? AC_UNARY_LO : AC_UNARY_HI; - else if (n == 2) + if (n == 2) return (m == LO) ? AC_BINARY_LO : AC_BINARY_HI; - else if (n == 3) + if (n == 3) return (m == LO) ? AC_TERNARY_LO : AC_TERNARY_HI; - else - return (m == LO) ? lo : hi; + return (m == LO) ? lo : hi; } forceinline PropCost - PropCost::record(void) { + PropCost::record() { return AC_RECORD; } forceinline PropCost @@ -5435,11 +5431,11 @@ namespace Gecode { } } forceinline bool - Space::Propagators::operator()(void) const { + Space::Propagators::operator()() const { return c != nullptr; } forceinline void - Space::Propagators::operator++(void) { + Space::Propagators::operator++() { c = c->next(); if (c == e) { if (q == nullptr) { @@ -5465,7 +5461,7 @@ namespace Gecode { } } forceinline Propagator& - Space::Propagators::propagator(void) const { + Space::Propagators::propagator() const { return *Propagator::cast(c); } @@ -5484,11 +5480,11 @@ namespace Gecode { q = c = e = nullptr; } forceinline bool - Space::ScheduledPropagators::operator()(void) const { + Space::ScheduledPropagators::operator()() const { return c != nullptr; } forceinline void - Space::ScheduledPropagators::operator++(void) { + Space::ScheduledPropagators::operator++() { c = c->next(); if (c == e) { if (q == nullptr) { @@ -5508,7 +5504,7 @@ namespace Gecode { } } forceinline Propagator& - Space::ScheduledPropagators::propagator(void) const { + Space::ScheduledPropagators::propagator() const { return *Propagator::cast(c); } @@ -5518,15 +5514,15 @@ namespace Gecode { e = &home.pl; } forceinline bool - Space::IdlePropagators::operator()(void) const { + Space::IdlePropagators::operator()() const { return c != e; } forceinline void - Space::IdlePropagators::operator++(void) { + Space::IdlePropagators::operator++() { c = c->next(); } forceinline Propagator& - Space::IdlePropagators::propagator(void) const { + Space::IdlePropagators::propagator() const { return *Propagator::cast(c); } @@ -5534,15 +5530,15 @@ namespace Gecode { Space::Branchers::Branchers(Space& home) : c(home.bl.next()), e(&home.bl) {} forceinline bool - Space::Branchers::operator()(void) const { + Space::Branchers::operator()() const { return c != e; } forceinline void - Space::Branchers::operator++(void) { + Space::Branchers::operator++() { c = c->next(); } forceinline Brancher& - Space::Branchers::brancher(void) const { + Space::Branchers::brancher() const { return *Brancher::cast(c); } @@ -5559,12 +5555,12 @@ namespace Gecode { } forceinline bool - Group::in(void) const { + Group::in() const { return (gid != GROUPID_ALL) && (gid != GROUPID_DEF); } forceinline unsigned int - Group::id(void) const { + Group::id() const { return gid; } @@ -5621,17 +5617,17 @@ namespace Gecode { ++ps; } forceinline bool - Propagators::operator()(void) const { + Propagators::operator()() const { return ps(); } forceinline void - Propagators::operator++(void) { + Propagators::operator++() { do ++ps; while (ps() && !g.in(ps.propagator().group())); } forceinline const Propagator& - Propagators::propagator(void) const { + Propagators::propagator() const { return ps.propagator(); } @@ -5642,17 +5638,17 @@ namespace Gecode { ++bs; } forceinline bool - Branchers::operator()(void) const { + Branchers::operator()() const { return bs(); } forceinline void - Branchers::operator++(void) { + Branchers::operator++() { do ++bs; while (bs() && !g.in(bs.brancher().group())); } forceinline const Brancher& - Branchers::brancher(void) const { + Branchers::brancher() const { return bs.brancher(); } @@ -5662,7 +5658,7 @@ namespace Gecode { */ template forceinline T& - Space::construct(void) { + Space::construct() { return alloc(1); } template diff --git a/gecode/kernel/data/array.cpp b/gecode/kernel/data/array.cpp index a7b2c6007d..0e65227824 100644 --- a/gecode/kernel/data/array.cpp +++ b/gecode/kernel/data/array.cpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Kernel { +namespace Gecode::Kernel { bool duplicates(void** p, int n) { @@ -53,7 +53,7 @@ namespace Gecode { namespace Kernel { do { if (p[i] == q[j]) return true; - else if (p[i] < q[j]) + if (p[i] < q[j]) i++; else j++; @@ -61,6 +61,6 @@ namespace Gecode { namespace Kernel { return false; } -}} // namespace Gecode::Kernel +} // namespace Gecode::Kernel // STATISTICS: kernel-other diff --git a/gecode/kernel/data/array.hpp b/gecode/kernel/data/array.hpp index 442316c78b..c7aa4cbb87 100644 --- a/gecode/kernel/data/array.hpp +++ b/gecode/kernel/data/array.hpp @@ -36,13 +36,14 @@ * */ +#include #include #include #include #include #include -namespace Gecode { namespace Kernel { +namespace Gecode::Kernel { /// Occurrence information for a view template @@ -70,7 +71,7 @@ namespace Gecode { namespace Kernel { GECODE_KERNEL_EXPORT bool duplicates(void** p, int n, void** q, int m); -}} // namespace Gecode::Kernel +} // namespace Gecode::Kernel namespace Gecode { @@ -121,32 +122,32 @@ namespace Gecode { /// \name Associated types //@{ /// Type of the variable stored in this array - typedef Var value_type; + using value_type = Var; /// Type of a reference to the value type - typedef Var& reference; + using reference = Var&; /// Type of a constant reference to the value type - typedef const Var& const_reference; + using const_reference = const Var&; /// Type of a pointer to the value type - typedef Var* pointer; + using pointer = Var*; /// Type of a read-only pointer to the value type - typedef const Var* const_pointer; + using const_pointer = const Var*; /// Type of the iterator used to iterate through this array's elements - typedef Var* iterator; + using iterator = Var*; /// Type of the iterator used to iterate read-only through this array's elements - typedef const Var* const_iterator; + using const_iterator = const Var*; /// Type of the iterator used to iterate backwards through this array's elements - typedef std::reverse_iterator reverse_iterator; + using reverse_iterator = std::reverse_iterator; /// Type of the iterator used to iterate backwards and read-only through this array's elements - typedef std::reverse_iterator const_reverse_iterator; + using const_reverse_iterator = std::reverse_iterator; //@} //@{ /// \name Constructors and initialization //@{ /// Default constructor (array of size 0) - VarArray(void); - /// Allocate array with \a m variables - VarArray(Space& home, int m); + VarArray(); + /// Allocate array with \a n0 variables + VarArray(Space& home, int n0); /// Initialize from variable argument array \a a (copy elements) VarArray(Space& home, const VarArgArray&); /// Initialize from variable array \a a (share elements) @@ -158,7 +159,7 @@ namespace Gecode { /// \name Array size //@{ /// Return size of array (number of elements) - int size(void) const; + int size() const; //@} /// \name Array elements @@ -172,31 +173,31 @@ namespace Gecode { * If \a n is -1, then all possible elements starting from \a start * with increment \a inc are returned. */ - typename ArrayTraits>::ArgsType slice(int start, int inc = 1, int n = -1); + ArrayTraits>::ArgsType slice(int start, int inc = 1, int n = -1); //@} /// \name Array iteration //@{ /// Return an iterator at the beginning of the array - iterator begin(void); + iterator begin(); /// Return a read-only iterator at the beginning of the array - const_iterator begin(void) const; + const_iterator begin() const; /// Return an iterator past the end of the array - iterator end(void); + iterator end(); /// Return a read-only iterator past the end of the array - const_iterator end(void) const; + const_iterator end() const; /// Return a reverse iterator at the end of the array - reverse_iterator rbegin(void); + reverse_iterator rbegin(); /// Return a reverse and read-only iterator at the end of the array - const_reverse_iterator rbegin(void) const; + const_reverse_iterator rbegin() const; /// Return a reverse iterator past the beginning of the array - reverse_iterator rend(void); + reverse_iterator rend(); /// Return a reverse and read-only iterator past the beginning of the array - const_reverse_iterator rend(void) const; + const_reverse_iterator rend() const; //@} /// Test if all variables are assigned - bool assigned(void) const; + bool assigned() const; /// \name Cloning //@{ @@ -214,31 +215,31 @@ namespace Gecode { * \relates VarArray */ template - typename ArrayTraits>::ArgsType operator+(const VarArray& x, const VarArgArray& y); + ArrayTraits>::ArgsType operator+(const VarArray& x, const VarArgArray& y); /** Concatenate \a x and \a y and return result * \relates VarArray */ template - typename ArrayTraits>::ArgsType operator+(const VarArray& x, const VarArray& y); + ArrayTraits>::ArgsType operator+(const VarArray& x, const VarArray& y); /** Concatenate \a x and \a y and return result * \relates VarArray */ template - typename ArrayTraits>::ArgsType operator+(const VarArgArray& x, const VarArray& y); + ArrayTraits>::ArgsType operator+(const VarArgArray& x, const VarArray& y); /** Concatenate \a x and \a y and return result * \relates VarArray */ template - typename ArrayTraits>::ArgsType operator+(const VarArray& x, const T& y); + ArrayTraits>::ArgsType operator+(const VarArray& x, const T& y); /** Concatenate \a x and \a y and return result * \relates VarArray */ template - typename ArrayTraits>::ArgsType operator+(const T& x, const VarArray& y); + ArrayTraits>::ArgsType operator+(const T& x, const VarArray& y); /** * \brief View arrays @@ -259,33 +260,33 @@ namespace Gecode { /// \name Associated types //@{ /// Type of the view stored in this array - typedef View value_type; + using value_type = View; /// Type of a reference to the value type - typedef View& reference; + using reference = View&; /// Type of a constant reference to the value type - typedef const View& const_reference; + using const_reference = const View&; /// Type of a pointer to the value type - typedef View* pointer; + using pointer = View*; /// Type of a read-only pointer to the value type - typedef const View* const_pointer; + using const_pointer = const View*; /// Type of the iterator used to iterate through this array's elements - typedef View* iterator; + using iterator = View*; /// Type of the iterator used to iterate read-only through this array's elements - typedef const View* const_iterator; + using const_iterator = const View*; /// Type of the iterator used to iterate backwards through this array's elements - typedef std::reverse_iterator reverse_iterator; + using reverse_iterator = std::reverse_iterator; /// Type of the iterator used to iterate backwards and read-only through this array's elements - typedef std::reverse_iterator const_reverse_iterator; + using const_reverse_iterator = std::reverse_iterator; //@} /// \name Constructors and initialization //@{ /// Default constructor (array of size 0) - ViewArray(void); - /// Allocate array with \a m views - ViewArray(Space& home, int m); - /// Allocate array with \a m views - ViewArray(Region& r, int m); + ViewArray(); + /// Allocate array with \a n0 views + ViewArray(Space& home, int n0); + /// Allocate array with \a n0 views + ViewArray(Region& r, int n0); /// Initialize from view array \a a (share elements) ViewArray(const ViewArray& a) = default; /// Initialize from view array \a a (copy elements) @@ -333,7 +334,7 @@ namespace Gecode { /// \name Array size //@{ /// Return size of array (number of elements) - int size(void) const; + int size() const; /// Decrease size of array (number of elements) void size(int n); //@} @@ -349,21 +350,21 @@ namespace Gecode { /// \name Array iteration //@{ /// Return an iterator at the beginning of the array - iterator begin(void); + iterator begin(); /// Return a read-only iterator at the beginning of the array - const_iterator begin(void) const; + const_iterator begin() const; /// Return an iterator past the end of the array - iterator end(void); + iterator end(); /// Return a read-only iterator past the end of the array - const_iterator end(void) const; + const_iterator end() const; /// Return a reverse iterator at the end of the array - reverse_iterator rbegin(void); + reverse_iterator rbegin(); /// Return a reverse and read-only iterator at the end of the array - const_reverse_iterator rbegin(void) const; + const_reverse_iterator rbegin() const; /// Return a reverse iterator past the beginning of the array - reverse_iterator rend(void); + reverse_iterator rend(); /// Return a reverse and read-only iterator past the beginning of the array - const_reverse_iterator rend(void) const; + const_reverse_iterator rend() const; //@} /// \name Dependencies @@ -388,8 +389,8 @@ namespace Gecode { /// \name Cloning //@{ - /// Update array to be a clone of array \a a - void update(Space& home, ViewArray& a); + /// Update array to be a clone of array \a y + void update(Space& home, ViewArray& y); //@} /// \name Moving elements @@ -458,7 +459,7 @@ namespace Gecode { //@} /// Test if all variables are assigned - bool assigned(void) const; + bool assigned() const; /// \name View equality //@{ @@ -467,7 +468,7 @@ namespace Gecode { * * Note that assigned views are ignored. */ - bool same(void) const; + bool same() const; /** * \brief Test whether array contains a view being the same as \a y * @@ -475,7 +476,7 @@ namespace Gecode { */ bool same(const View& y) const; /// Remove all duplicate views from array (changes element order) - void unique(void); + void unique(); //@} /// Allocate memory from heap (disabled) @@ -569,35 +570,35 @@ namespace Gecode { /// \name Associated types //@{ /// Type of the view stored in this array - typedef T value_type; + using value_type = T; /// Type of a reference to the value type - typedef T& reference; + using reference = T&; /// Type of a constant reference to the value type - typedef const T& const_reference; + using const_reference = const T&; /// Type of a pointer to the value type - typedef T* pointer; + using pointer = T*; /// Type of a read-only pointer to the value type - typedef const T* const_pointer; + using const_pointer = const T*; /// Type of the iterator used to iterate through this array's elements - typedef T* iterator; + using iterator = T*; /// Type of the iterator used to iterate read-only through this array's elements - typedef const T* const_iterator; + using const_iterator = const T*; /// Type of the iterator used to iterate backwards through this array's elements - typedef std::reverse_iterator reverse_iterator; + using reverse_iterator = std::reverse_iterator; /// Type of the iterator used to iterate backwards and read-only through this array's elements - typedef std::reverse_iterator const_reverse_iterator; + using const_reverse_iterator = std::reverse_iterator; //@} /// \name Constructors and initialization //@{ /// Allocate empty array - ArgArrayBase(void); + ArgArrayBase(); /// Allocate array with \a n elements explicit ArgArrayBase(int n); /// Initialize from argument array \a a (copy elements) ArgArrayBase(const ArgArrayBase& a); /// Initialize from view array \a a (copy elements) - const ArgArrayBase& operator=(const ArgArrayBase& a); + ArgArrayBase& operator=(const ArgArrayBase& a); /// Initialize from vector \a a ArgArrayBase(const std::vector& a); /// Initialize from initializer list \a a @@ -610,7 +611,7 @@ namespace Gecode { /// \name Array size //@{ /// Return size of array (number of elements) - int size(void) const; + int size() const; //@} /// \name Array elements @@ -624,27 +625,27 @@ namespace Gecode { /// \name Array iteration //@{ /// Return an iterator at the beginning of the array - iterator begin(void); + iterator begin(); /// Return a read-only iterator at the beginning of the array - const_iterator begin(void) const; + const_iterator begin() const; /// Return an iterator past the end of the array - iterator end(void); + iterator end(); /// Return a read-only iterator past the end of the array - const_iterator end(void) const; + const_iterator end() const; /// Return a reverse iterator at the end of the array - reverse_iterator rbegin(void); + reverse_iterator rbegin(); /// Return a reverse and read-only iterator at the end of the array - const_reverse_iterator rbegin(void) const; + const_reverse_iterator rbegin() const; /// Return a reverse iterator past the beginning of the array - reverse_iterator rend(void); + reverse_iterator rend(); /// Return a reverse and read-only iterator past the beginning of the array - const_reverse_iterator rend(void) const; + const_reverse_iterator rend() const; //@} /// \name Destructor //@{ /// Destructor - ~ArgArrayBase(void); + ~ArgArrayBase(); //@} }; @@ -655,19 +656,19 @@ namespace Gecode { * \relates ArgArray */ template - typename ArrayTraits>::ArgsType operator+(const ArgArray& x, const ArgArray& y); + ArrayTraits>::ArgsType operator+(const ArgArray& x, const ArgArray& y); /** Concatenate \a x and \a y and return result * \relates ArgArray */ template - typename ArrayTraits>::ArgsType operator+(const ArgArray& x, const T& y); + ArrayTraits>::ArgsType operator+(const ArgArray& x, const T& y); /** Concatenate \a x and \a y and return result * \relates ArgArray */ template - typename ArrayTraits>::ArgsType operator+(const T& x, const ArgArray& y); + ArrayTraits>::ArgsType operator+(const T& x, const ArgArray& y); /** * \brief Argument array for non-primitive types @@ -690,11 +691,11 @@ namespace Gecode { /// \name Constructors and initialization //@{ /// Allocate empty array - ArgArray(void) = default; + ArgArray() = default; /// Allocate array with \a n elements explicit ArgArray(int n); - /// Allocate array with \a n elements and initialize with elements from array \a e - ArgArray(int n, const T* e); + /// Allocate array with \a n elements and initialize with elements from array \a a0 + ArgArray(int n, const T* a0); /// Initialize from argument array \a a (copy elements) ArgArray(const ArgArray& a); /// Initialize from vector \a a @@ -708,19 +709,19 @@ namespace Gecode { /// \name Array elements //@{ /// Return slice \f$y\f$ of length \a n such that forall \f$0\leq i>::ArgsType slice(int start, int inc = 1, int n = -1); + ArrayTraits>::ArgsType slice(int start, int inc = 1, int n = -1); //@} /// \name Appending elements //@{ /// Insert a new element \a x at the end of the array (increase size by 1) - typename ArrayTraits>::ArgsType& operator<<(const T& x); + ArrayTraits>::ArgsType& operator<<(const T& x); /// Append \a x to the end of the array - typename ArrayTraits>::ArgsType& operator<<(const ArgArray& x); + ArrayTraits>::ArgsType& operator<<(const ArgArray& x); //@} - friend typename ArrayTraits>::ArgsType operator+ <>(const ArgArray& x, const ArgArray& y); - friend typename ArrayTraits>::ArgsType operator+ <>(const ArgArray& x, const T& y); - friend typename ArrayTraits>::ArgsType operator+ <>(const T& x, const ArgArray& y); + friend ArrayTraits>::ArgsType operator+ <>(const ArgArray& x, const ArgArray& y); + friend ArrayTraits>::ArgsType operator+ <>(const ArgArray& x, const T& y); + friend ArrayTraits>::ArgsType operator+ <>(const T& x, const ArgArray& y); /// Assignment operator ArgArray& operator=(const ArgArray&) = default; @@ -730,9 +731,9 @@ namespace Gecode { template <> class ArrayTraits> { public: - typedef ArgArray StorageType; - typedef double ValueType; - typedef ArgArray ArgsType; + using StorageType = ArgArray; + using ValueType = double; + using ArgsType = ArgArray; }; template @@ -742,19 +743,19 @@ namespace Gecode { * \relates ArgArray */ template - typename ArrayTraits>::ArgsType operator+(const VarArgArray& x, const VarArgArray& y); + ArrayTraits>::ArgsType operator+(const VarArgArray& x, const VarArgArray& y); /** Concatenate \a x and \a y and return result * \relates ArgArray */ template - typename ArrayTraits>::ArgsType operator+(const VarArgArray& x, const Var& y); + ArrayTraits>::ArgsType operator+(const VarArgArray& x, const Var& y); /** Concatenate \a x and \a y and return result * \relates ArgArray */ template - typename ArrayTraits>::ArgsType operator+(const Var& x, const VarArgArray& y); + ArrayTraits>::ArgsType operator+(const Var& x, const VarArgArray& y); /** * \brief Argument array for variables @@ -778,13 +779,13 @@ namespace Gecode { /// \name Constructors and initialization //@{ /// Allocate empty array - VarArgArray(void) = default; + VarArgArray() = default; /// Allocate array with \a n elements explicit VarArgArray(int n); /// Initialize from variable argument array \a a (copy elements) VarArgArray(const VarArgArray& a); - /// Initialize from variable array \a a (copy elements) - VarArgArray(const VarArray& a); + /// Initialize from variable array \a x (copy elements) + VarArgArray(const VarArray& x); /// Initialize from vector \a a VarArgArray(const std::vector& a); /// Initialize from initializer list \a a @@ -796,23 +797,23 @@ namespace Gecode { /// \name Array elements //@{ /// Return slice \f$y\f$ of length \a n such that forall \f$0\leq i>::ArgsType slice(int start, int inc = 1, int n = -1); + ArrayTraits>::ArgsType slice(int start, int inc = 1, int n = -1); //@} /// \name Appending elements //@{ /// Insert a new element \a x at the end of the array (increase size by 1) - typename ArrayTraits>::ArgsType& operator<<(const Var& x); + ArrayTraits>::ArgsType& operator<<(const Var& x); /// Append \a x to the end of the array - typename ArrayTraits>::ArgsType& operator<<(const VarArgArray& x); + ArrayTraits>::ArgsType& operator<<(const VarArgArray& x); //@} /// Test if all variables are assigned - bool assigned(void) const; + bool assigned() const; - friend typename ArrayTraits>::ArgsType operator+ + friend ArrayTraits>::ArgsType operator+ <>(const VarArgArray& x, const VarArgArray& y); - friend typename ArrayTraits>::ArgsType operator+ <>(const VarArgArray& x, const Var& y); - friend typename ArrayTraits>::ArgsType operator+ <>(const Var& x, const VarArgArray& y); + friend ArrayTraits>::ArgsType operator+ <>(const VarArgArray& x, const Var& y); + friend ArrayTraits>::ArgsType operator+ <>(const Var& x, const VarArgArray& y); /// Assignment operator VarArgArray& operator=(const VarArgArray&) = default; @@ -886,7 +887,7 @@ namespace Gecode { template forceinline - VarArray::VarArray(void) + VarArray::VarArray() : n(0), x(nullptr) {} template @@ -899,7 +900,7 @@ namespace Gecode { template forceinline int - VarArray::size(void) const { + VarArray::size() const { return n; } @@ -918,7 +919,7 @@ namespace Gecode { } template - typename ArrayTraits>::ArgsType + ArrayTraits>::ArgsType VarArray::slice(int start, int inc, int max_n) { assert(n == 0 || start < n); if (n == 0 || max_n < 0) @@ -937,50 +938,50 @@ namespace Gecode { } template - forceinline typename VarArray::iterator - VarArray::begin(void) { + forceinline VarArray::iterator + VarArray::begin() { return x; } template - forceinline typename VarArray::const_iterator - VarArray::begin(void) const { + forceinline VarArray::const_iterator + VarArray::begin() const { return x; } template - forceinline typename VarArray::iterator - VarArray::end(void) { + forceinline VarArray::iterator + VarArray::end() { return x + n; } template - forceinline typename VarArray::const_iterator - VarArray::end(void) const { + forceinline VarArray::const_iterator + VarArray::end() const { return x + n; } template - forceinline typename VarArray::reverse_iterator - VarArray::rbegin(void) { + forceinline VarArray::reverse_iterator + VarArray::rbegin() { return reverse_iterator(x + n); } template - forceinline typename VarArray::const_reverse_iterator - VarArray::rbegin(void) const { + forceinline VarArray::const_reverse_iterator + VarArray::rbegin() const { return const_reverse_iterator(x + n); } template - forceinline typename VarArray::reverse_iterator - VarArray::rend(void) { + forceinline VarArray::reverse_iterator + VarArray::rend() { return reverse_iterator(x); } template - forceinline typename VarArray::const_reverse_iterator - VarArray::rend(void) const { + forceinline VarArray::const_reverse_iterator + VarArray::rend() const { return const_reverse_iterator(x); } @@ -999,7 +1000,7 @@ namespace Gecode { template forceinline bool - VarArray::assigned(void) const { + VarArray::assigned() const { for (int i = 0; i < n; i++) if (!x[i].assigned()) return false; @@ -1007,7 +1008,7 @@ namespace Gecode { } template - typename ArrayTraits>::ArgsType + ArrayTraits>::ArgsType operator+(const VarArray& x, const VarArray& y) { typename ArrayTraits>::ArgsType r(x.size() + y.size()); for (int i = 0; i < x.size(); i++) @@ -1018,7 +1019,7 @@ namespace Gecode { } template - typename ArrayTraits>::ArgsType + ArrayTraits>::ArgsType operator+(const VarArray& x, const VarArgArray& y) { typename ArrayTraits>::ArgsType r(x.size() + y.size()); for (int i = 0; i < x.size(); i++) @@ -1029,7 +1030,7 @@ namespace Gecode { } template - typename ArrayTraits>::ArgsType + ArrayTraits>::ArgsType operator+(const VarArgArray& x, const VarArray& y) { typename ArrayTraits>::ArgsType r(x.size() + y.size()); for (int i = 0; i < x.size(); i++) @@ -1040,7 +1041,7 @@ namespace Gecode { } template - typename ArrayTraits>::ArgsType + ArrayTraits>::ArgsType operator+(const VarArray& x, const Var& y) { typename ArrayTraits>::ArgsType r(x.size() + 1); for (int i = 0; i < x.size(); i++) @@ -1050,7 +1051,7 @@ namespace Gecode { } template - typename ArrayTraits>::ArgsType + ArrayTraits>::ArgsType operator+(const Var& x, const VarArray& y) { typename ArrayTraits>::ArgsType r(y.size() + 1); r[0] = x; @@ -1066,7 +1067,7 @@ namespace Gecode { template forceinline - ViewArray::ViewArray(void) + ViewArray::ViewArray() : n(0), x(nullptr) {} template @@ -1105,7 +1106,7 @@ namespace Gecode { template forceinline int - ViewArray::size(void) const { + ViewArray::size() const { return n; } @@ -1130,50 +1131,50 @@ namespace Gecode { } template - forceinline typename ViewArray::iterator - ViewArray::begin(void) { + forceinline ViewArray::iterator + ViewArray::begin() { return x; } template - forceinline typename ViewArray::const_iterator - ViewArray::begin(void) const { + forceinline ViewArray::const_iterator + ViewArray::begin() const { return x; } template - forceinline typename ViewArray::iterator - ViewArray::end(void) { + forceinline ViewArray::iterator + ViewArray::end() { return x + n; } template - forceinline typename ViewArray::const_iterator - ViewArray::end(void) const { + forceinline ViewArray::const_iterator + ViewArray::end() const { return x + n; } template - forceinline typename ViewArray::reverse_iterator - ViewArray::rbegin(void) { + forceinline ViewArray::reverse_iterator + ViewArray::rbegin() { return reverse_iterator(x + n); } template - forceinline typename ViewArray::const_reverse_iterator - ViewArray::rbegin(void) const { + forceinline ViewArray::const_reverse_iterator + ViewArray::rbegin() const { return const_reverse_iterator(x + n); } template - forceinline typename ViewArray::reverse_iterator - ViewArray::rend(void) { + forceinline ViewArray::reverse_iterator + ViewArray::rend() { return reverse_iterator(x); } template - forceinline typename ViewArray::const_reverse_iterator - ViewArray::rend(void) const { + forceinline ViewArray::const_reverse_iterator + ViewArray::rend() const { return const_reverse_iterator(x); } @@ -1337,7 +1338,7 @@ namespace Gecode { template forceinline bool - ViewArray::assigned(void) const { + ViewArray::assigned() const { for (int i = 0; i < n; i++) if (!x[i].assigned()) return false; @@ -1346,7 +1347,7 @@ namespace Gecode { template bool - ViewArray::same(void) const { + ViewArray::same() const { if (n < 2) return false; Region r; @@ -1377,7 +1378,7 @@ namespace Gecode { template void - ViewArray::unique(void) { + ViewArray::unique() { if (n < 2) return; Region r; @@ -1485,8 +1486,7 @@ namespace Gecode { if (n + i >= capacity) { assert(n + i >= onstack_size); int new_capacity = (3 * capacity) / 2; - if (new_capacity <= n + i) - new_capacity = n + i; + new_capacity = std::max(new_capacity, n + i); T* new_a = allocate(new_capacity); heap.copy(new_a, a, n); if (capacity > onstack_size) @@ -1498,7 +1498,7 @@ namespace Gecode { template forceinline - ArgArrayBase::ArgArrayBase(void) + ArgArrayBase::ArgArrayBase() : n(0), capacity(onstack_size), a(allocate(0)) {} template @@ -1528,13 +1528,13 @@ namespace Gecode { } template - forceinline ArgArrayBase::~ArgArrayBase(void) { + forceinline ArgArrayBase::~ArgArrayBase() { if (capacity > onstack_size) heap.free(a, capacity); } template - forceinline const ArgArrayBase& + forceinline ArgArrayBase& ArgArrayBase::operator=(const ArgArrayBase& aa) { if (&aa != this) { if (capacity > onstack_size) @@ -1549,7 +1549,7 @@ namespace Gecode { template forceinline int - ArgArrayBase::size(void) const { + ArgArrayBase::size() const { return n; } @@ -1568,50 +1568,50 @@ namespace Gecode { } template - forceinline typename ArgArrayBase::iterator - ArgArrayBase::begin(void) { + forceinline ArgArrayBase::iterator + ArgArrayBase::begin() { return a; } template - forceinline typename ArgArrayBase::const_iterator - ArgArrayBase::begin(void) const { + forceinline ArgArrayBase::const_iterator + ArgArrayBase::begin() const { return a; } template - forceinline typename ArgArrayBase::iterator - ArgArrayBase::end(void) { + forceinline ArgArrayBase::iterator + ArgArrayBase::end() { return a + n; } template - forceinline typename ArgArrayBase::const_iterator - ArgArrayBase::end(void) const { + forceinline ArgArrayBase::const_iterator + ArgArrayBase::end() const { return a + n; } template - forceinline typename ArgArrayBase::reverse_iterator - ArgArrayBase::rbegin(void) { + forceinline ArgArrayBase::reverse_iterator + ArgArrayBase::rbegin() { return reverse_iterator(a + n); } template - forceinline typename ArgArrayBase::const_reverse_iterator - ArgArrayBase::rbegin(void) const { + forceinline ArgArrayBase::const_reverse_iterator + ArgArrayBase::rbegin() const { return const_reverse_iterator(a + n); } template - forceinline typename ArgArrayBase::reverse_iterator - ArgArrayBase::rend(void) { + forceinline ArgArrayBase::reverse_iterator + ArgArrayBase::rend() { return reverse_iterator(a); } template - forceinline typename ArgArrayBase::const_reverse_iterator - ArgArrayBase::rend(void) const { + forceinline ArgArrayBase::const_reverse_iterator + ArgArrayBase::rend() const { return const_reverse_iterator(a); } @@ -1725,37 +1725,37 @@ namespace Gecode { : ArgArrayBase(first, last) {} template - forceinline typename ArrayTraits>::ArgsType + forceinline ArrayTraits>::ArgsType ArgArray::slice(int start, int inc, int max_n) { return ArgArrayBase::template slice>::ArgsType>(start, inc, max_n); } template - forceinline typename ArrayTraits>::ArgsType& + forceinline ArrayTraits>::ArgsType& ArgArray::operator<<(const T& x) { return ArgArrayBase::template append>::ArgsType>(x); } template - forceinline typename ArrayTraits>::ArgsType& + forceinline ArrayTraits>::ArgsType& ArgArray::operator<<(const ArgArray& x) { return ArgArrayBase::template append>::ArgsType>(x); } template - typename ArrayTraits>::ArgsType + ArrayTraits>::ArgsType operator+(const ArgArray& x, const ArgArray& y) { return x.template concat>::ArgsType>(y); } template - typename ArrayTraits>::ArgsType + ArrayTraits>::ArgsType operator+(const ArgArray& x, const T& y) { return x.template concat>::ArgsType>(y); } template - typename ArrayTraits>::ArgsType + ArrayTraits>::ArgsType operator+(const T& x, const ArgArray& y) { ArgArray xa(1); xa[0] = x; @@ -1800,37 +1800,37 @@ namespace Gecode { } template - forceinline typename ArrayTraits>::ArgsType + forceinline ArrayTraits>::ArgsType VarArgArray::slice(int start, int inc, int max_n) { return ArgArrayBase::template slice>::ArgsType>(start, inc, max_n); } template - forceinline typename ArrayTraits>::ArgsType& + forceinline ArrayTraits>::ArgsType& VarArgArray::operator<<(const Var& x) { return ArgArrayBase::template append>::ArgsType>(x); } template - forceinline typename ArrayTraits>::ArgsType& + forceinline ArrayTraits>::ArgsType& VarArgArray::operator<<(const VarArgArray& x) { return ArgArrayBase::template append>::ArgsType>(x); } template - typename ArrayTraits>::ArgsType + ArrayTraits>::ArgsType operator+(const VarArgArray& x, const VarArgArray& y) { return x.template concat>::ArgsType>(y); } template - typename ArrayTraits>::ArgsType + ArrayTraits>::ArgsType operator+(const VarArgArray& x, const Var& y) { return x.template concat>::ArgsType>(y); } template - typename ArrayTraits>::ArgsType + ArrayTraits>::ArgsType operator+(const Var& x, const VarArgArray& y) { VarArgArray xa(1); xa[0] = x; @@ -1839,7 +1839,7 @@ namespace Gecode { template forceinline bool - VarArgArray::assigned(void) const { + VarArgArray::assigned() const { for (int i = 0; i < n; i++) if (!a[i].assigned()) return false; diff --git a/gecode/kernel/data/rnd.hpp b/gecode/kernel/data/rnd.hpp index bf034644e3..b081fb83f8 100644 --- a/gecode/kernel/data/rnd.hpp +++ b/gecode/kernel/data/rnd.hpp @@ -76,7 +76,7 @@ namespace Gecode { public: /// Generator seeded with 1 - RndGenerator(void) : r(1) {} + RndGenerator() : r(1) {} /// Seed explicitly, so an integer never converts to a generator explicit RndGenerator(uint64_t seed) : r(seed) {} /// Use the state of \a source @@ -107,15 +107,15 @@ namespace Gecode { r.seed(value); } void - time(void) { + time() { seed(static_cast(::time(nullptr))); } void - hw(void) { - seed((uint64_t(Support::hwrnd()) << 32) | Support::hwrnd()); + hw() { + seed((static_cast(Support::hwrnd()) << 32) | Support::hwrnd()); } std::string - state(void) const { + state() const { return r.state_string(); } void @@ -123,7 +123,7 @@ namespace Gecode { r.state(text); } static const char* - name(void) { + name() { return Engine::name(); } template diff --git a/gecode/kernel/data/shared-array.hpp b/gecode/kernel/data/shared-array.hpp index 16c4e70a74..cab502eac3 100644 --- a/gecode/kernel/data/shared-array.hpp +++ b/gecode/kernel/data/shared-array.hpp @@ -63,7 +63,7 @@ namespace Gecode { /// Allocate for \a n elements SAO(int n); /// Delete object - ~SAO(void) override; + ~SAO() override; /// Access element at position \a i T& operator[](int i); @@ -71,39 +71,39 @@ namespace Gecode { const T& operator[](int i) const; /// Return number of elements - int size(void) const; + int size() const; /// Return beginning of array (for iterators) - T* begin(void); + T* begin(); /// Return beginning of array (for iterators) - const T* begin(void) const; + const T* begin() const; /// Return end of array (for iterators) - T* end(void); + T* end(); /// Return end of array (for iterators) - const T* end(void) const; + const T* end() const; }; public: /// \name Associated types //@{ /// Type of the view stored in this array - typedef T value_type; + using value_type = T; /// Type of a reference to the value type - typedef T& reference; + using reference = T&; /// Type of a constant reference to the value type - typedef const T& const_reference; + using const_reference = const T&; /// Type of a pointer to the value type - typedef T* pointer; + using pointer = T*; /// Type of a read-only pointer to the value type - typedef const T* const_pointer; + using const_pointer = const T*; /// Type of the iterator used to iterate through this array's elements - typedef T* iterator; + using iterator = T*; /// Type of the iterator used to iterate read-only through this array's elements - typedef const T* const_iterator; + using const_iterator = const T*; /// Type of the iterator used to iterate backwards through this array's elements - typedef std::reverse_iterator reverse_iterator; + using reverse_iterator = std::reverse_iterator; /// Type of the iterator used to iterate backwards and read-only through this array's elements - typedef std::reverse_iterator const_reverse_iterator; + using const_reverse_iterator = std::reverse_iterator; //@} /** @@ -113,7 +113,7 @@ namespace Gecode { * yet initialized shared array is init and the assignment operator . * */ - SharedArray(void) = default; + SharedArray() = default; /// Initialize as array with \a n elements SharedArray(int n); /** @@ -135,7 +135,7 @@ namespace Gecode { const T& operator[](int i) const; /// Return number of elements - int size(void) const; + int size() const; /// Test equality with \a sa bool operator==(const SharedArray& sa) const; @@ -143,21 +143,21 @@ namespace Gecode { /// \name Array iteration //@{ /// Return an iterator at the beginning of the array - iterator begin(void); + iterator begin(); /// Return a read-only iterator at the beginning of the array - const_iterator begin(void) const; + const_iterator begin() const; /// Return an iterator past the end of the array - iterator end(void); + iterator end(); /// Return a read-only iterator past the end of the array - const_iterator end(void) const; + const_iterator end() const; /// Return a reverse iterator at the end of the array - reverse_iterator rbegin(void); + reverse_iterator rbegin(); /// Return a reverse and read-only iterator at the end of the array - const_reverse_iterator rbegin(void) const; + const_reverse_iterator rbegin() const; /// Return a reverse iterator past the beginning of the array - reverse_iterator rend(void); + reverse_iterator rend(); /// Return a reverse and read-only iterator past the beginning of the array - const_reverse_iterator rend(void) const; + const_reverse_iterator rend() const; //@} /// Assignment operator @@ -188,7 +188,7 @@ namespace Gecode { } template - SharedArray::SAO::~SAO(void) { + SharedArray::SAO::~SAO() { if (n > 0) { heap.free(a, n); } @@ -210,31 +210,31 @@ namespace Gecode { template forceinline int - SharedArray::SAO::size(void) const { + SharedArray::SAO::size() const { return n; } template forceinline T* - SharedArray::SAO::begin(void) { + SharedArray::SAO::begin() { return a; } template forceinline const T* - SharedArray::SAO::begin(void) const { + SharedArray::SAO::begin() const { return a; } template forceinline T* - SharedArray::SAO::end(void) { + SharedArray::SAO::end() { return a + n; } template forceinline const T* - SharedArray::SAO::end(void) const { + SharedArray::SAO::end() const { return a + n; } @@ -293,63 +293,63 @@ namespace Gecode { template forceinline int - SharedArray::size(void) const { + SharedArray::size() const { assert(object() != nullptr); return static_cast(object())->size(); } template - forceinline typename SharedArray::iterator - SharedArray::begin(void) { + forceinline SharedArray::iterator + SharedArray::begin() { assert(object() != nullptr); return static_cast(object())->begin(); } template - forceinline typename SharedArray::const_iterator - SharedArray::begin(void) const { + forceinline SharedArray::const_iterator + SharedArray::begin() const { assert(object() != nullptr); return static_cast(object())->begin(); } template - forceinline typename SharedArray::iterator - SharedArray::end(void) { + forceinline SharedArray::iterator + SharedArray::end() { assert(object() != nullptr); return static_cast(object())->end(); } template - forceinline typename SharedArray::const_iterator - SharedArray::end(void) const { + forceinline SharedArray::const_iterator + SharedArray::end() const { assert(object() != nullptr); return static_cast(object())->end(); } template - forceinline typename SharedArray::reverse_iterator - SharedArray::rbegin(void) { + forceinline SharedArray::reverse_iterator + SharedArray::rbegin() { assert(object() != nullptr); return reverse_iterator(static_cast(object())->end()); } template - forceinline typename SharedArray::const_reverse_iterator - SharedArray::rbegin(void) const { + forceinline SharedArray::const_reverse_iterator + SharedArray::rbegin() const { assert(object() != nullptr); return const_reverse_iterator(static_cast(object())->end()); } template - forceinline typename SharedArray::reverse_iterator - SharedArray::rend(void) { + forceinline SharedArray::reverse_iterator + SharedArray::rend() { assert(object() != nullptr); return reverse_iterator(static_cast(object())->begin()); } template - forceinline typename SharedArray::const_reverse_iterator - SharedArray::rend(void) const { + forceinline SharedArray::const_reverse_iterator + SharedArray::rend() const { assert(object() != nullptr); return const_reverse_iterator(static_cast(object())->begin()); } diff --git a/gecode/kernel/data/shared-data.hpp b/gecode/kernel/data/shared-data.hpp index 639f143813..4db603ffe3 100644 --- a/gecode/kernel/data/shared-data.hpp +++ b/gecode/kernel/data/shared-data.hpp @@ -49,7 +49,7 @@ namespace Gecode { /// Initialization by moving \a d0 SDO(Data&& d0); /// Destructor - ~SDO(void) override; + ~SDO() override; }; public: @@ -64,15 +64,15 @@ namespace Gecode { SharedData(Data&& d) requires std::is_move_constructible_v; /// Create as uninitialized - SharedData(void) = default; + SharedData() = default; /// Copy constructor SharedData(const SharedData& sd); /// Assignment operator SharedData& operator=(const SharedData& sd); /// Provide access to data - const Data& operator()(void) const; + const Data& operator()() const; /// Destructors - ~SharedData(void) = default; + ~SharedData() = default; }; template @@ -86,7 +86,7 @@ namespace Gecode { : d(std::move(d0)) {} template - forceinline SharedData::SDO::~SDO(void) = default; + forceinline SharedData::SDO::~SDO() = default; template forceinline @@ -107,12 +107,13 @@ namespace Gecode { template forceinline SharedData& SharedData::operator=(const SharedData& sd) { - return static_cast(SharedHandle::operator=(sd)); + SharedHandle::operator=(sd); + return *this; } template forceinline const Data& - SharedData::operator()(void) const { + SharedData::operator()() const { return static_cast(object())->d; } diff --git a/gecode/kernel/gpi.cpp b/gecode/kernel/gpi.cpp index d0c1999b8b..26c96f72ac 100644 --- a/gecode/kernel/gpi.cpp +++ b/gecode/kernel/gpi.cpp @@ -32,10 +32,10 @@ #include -namespace Gecode { namespace Kernel { +namespace Gecode::Kernel { Support::Mutex GPI::m; -}} // namespace Gecode::Kernel +} // namespace Gecode::Kernel // STATISTICS: kernel-prop diff --git a/gecode/kernel/gpi.hpp b/gecode/kernel/gpi.hpp index 400777a435..dabf4e1d91 100644 --- a/gecode/kernel/gpi.hpp +++ b/gecode/kernel/gpi.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Kernel { +namespace Gecode::Kernel { /// Global propagator information class GPI { @@ -63,9 +63,9 @@ namespace Gecode { namespace Kernel { /// Number of free blocks int free; /// Initialize - Block(void); + Block(); /// Rescale used afc values in entries - void rescale(void); + void rescale(); }; /// The current block Block* b; @@ -82,11 +82,11 @@ namespace Gecode { namespace Kernel { public: /// Initialize - GPI(void); + GPI(); /// Set decay factor to \a d void decay(double d); /// Return decay factor - double decay(void) const; + double decay() const; /// Increment failure count void fail(Info& c); /// Allocate info for existing propagator with pid \a p @@ -94,13 +94,13 @@ namespace Gecode { namespace Kernel { /// Allocate new actor info Info* allocate(unsigned int gid); /// Allocate a new propagator id without allocating information - unsigned int next_pid(void); + unsigned int next_pid(); /// Return next free propagator id - unsigned int pid(void) const; + unsigned int pid() const; /// Provide access to unshare info and set to true - bool unshare(void); + bool unshare(); /// Delete - ~GPI(void); + ~GPI(); }; forceinline void @@ -111,17 +111,17 @@ namespace Gecode { namespace Kernel { } forceinline - GPI::Block::Block(void) + GPI::Block::Block() : next(nullptr), free(n_info) {} forceinline void - GPI::Block::rescale(void) { + GPI::Block::rescale() { for (int i = free; i < n_info; i++) info[i].afc *= Kernel::Config::rescale; } forceinline - GPI::GPI(void) + GPI::GPI() : b(&fst), invd(1.0), npid(0U), us(false) {} forceinline void @@ -135,26 +135,26 @@ namespace Gecode { namespace Kernel { } forceinline double - GPI::decay(void) const { + GPI::decay() const { double d; - const_cast(*this).m.acquire(); + Gecode::Kernel::GPI::m.acquire(); d = 1.0 / invd; - const_cast(*this).m.release(); + Gecode::Kernel::GPI::m.release(); return d; } forceinline unsigned int - GPI::next_pid(void) { + GPI::next_pid() { return npid.fetch_add(1, std::memory_order_seq_cst); } forceinline unsigned int - GPI::pid(void) const { + GPI::pid() const { return npid.load(std::memory_order_acquire); } forceinline bool - GPI::unshare(void) { + GPI::unshare() { bool u; m.acquire(); u = us; @@ -200,7 +200,7 @@ namespace Gecode { namespace Kernel { return c; } - forceinline GPI::~GPI(void) { + forceinline GPI::~GPI() { Block* n = b; while (n != &fst) { Block* d = n; @@ -209,6 +209,6 @@ namespace Gecode { namespace Kernel { } } -}} // namespace Gecode::Kernel +} // namespace Gecode::Kernel // STATISTICS: kernel-prop diff --git a/gecode/kernel/memory/allocators.hpp b/gecode/kernel/memory/allocators.hpp index 1b8958f7e1..1651f5a38d 100644 --- a/gecode/kernel/memory/allocators.hpp +++ b/gecode/kernel/memory/allocators.hpp @@ -57,10 +57,10 @@ namespace Gecode { \code struct MySpace : public Space { - typedef std::set, Gecode::space_allocator > S; + using S = std::set, Gecode::space_allocator >; S safe_set; - MySpace(void) + MySpace() : safe_set(S::key_compare(), S::allocator_type(*this)) {} @@ -100,10 +100,10 @@ namespace Gecode { \code struct MySpace : public Space { - typedef std::set, Gecode::space_allocator > S; + using S = std::set, Gecode::space_allocator >; S& fast_set; - MySpace(void) + MySpace() : fast_set(construct(S::key_compare(), S::allocator_type(*this))) {} @@ -127,7 +127,7 @@ namespace Gecode { \code Space& home = ...; - typedef std::set, Gecode::region_allocator > SR; + using SR = std::set, Gecode::region_allocator >; // Create a set with the region allocator. Note that the set destructor is still quite costly... { Region r; @@ -154,13 +154,13 @@ namespace Gecode { */ template <> struct space_allocator { - typedef void* pointer; - typedef const void* const_pointer; - typedef void value_type; + using pointer = void*; + using const_pointer = const void*; + using value_type = void; /// Rebinding helper (returns the type of a similar allocator for type \a U) template struct rebind { - typedef space_allocator other; + using other = space_allocator; }; }; @@ -176,24 +176,24 @@ namespace Gecode { template struct space_allocator { /// Type of objects the allocator creates. This is identical to \a T. - typedef T value_type; + using value_type = T; /// Type that can represent the size of the largest object. - typedef size_t size_type; + using size_type = size_t; /// Type that can represent the difference between any two pointers. - typedef ptrdiff_t difference_type; + using difference_type = ptrdiff_t; /// Type of pointers returned by the allocator. - typedef T* pointer; + using pointer = T*; /// Const version of pointer. - typedef T const* const_pointer; + using const_pointer = T const*; /// Non-const reference to \a T. - typedef T& reference; + using reference = T&; /// Const reference to \a T. - typedef T const& const_reference; + using const_reference = T const&; /// Rebinding helper (returns the type of a similar allocator for type \a U). template struct rebind { /// The allocator type for \a U - typedef space_allocator other; + using other = space_allocator; }; /// The space that we allocate objects from @@ -238,7 +238,7 @@ namespace Gecode { } /// Returns the largest size for which a call to allocate might succeed. size_type - max_size(void) const noexcept { + max_size() const noexcept { return std::numeric_limits::max() / sizeof(T); } /** @@ -318,13 +318,13 @@ namespace Gecode { */ template <> struct region_allocator { - typedef void* pointer; - typedef const void* const_pointer; - typedef void value_type; + using pointer = void*; + using const_pointer = const void*; + using value_type = void; /// Rebinding helper (returns the type of a similar allocator for type \a U) template struct rebind { - typedef region_allocator other; + using other = region_allocator; }; }; @@ -339,25 +339,25 @@ namespace Gecode { template struct region_allocator { /// Type of objects the allocator creates. This is identical to \a T. - typedef T value_type; + using value_type = T; /// Type that can represent the size of the largest object. - typedef size_t size_type; + using size_type = size_t; /// Type that can represent the difference between any two pointers. - typedef ptrdiff_t difference_type; + using difference_type = ptrdiff_t; /// Type of pointers returned by the allocator. - typedef T* pointer; + using pointer = T*; /// Const version of pointer. - typedef T const* const_pointer; + using const_pointer = T const*; /// Non-const reference to \a T. - typedef T& reference; + using reference = T&; /// Const reference to \a T. - typedef T const& const_reference; + using const_reference = T const&; /// Rebinding helper (returns the type of a similar allocator for type \a U). template struct rebind { /// The allocator type for \a U - typedef region_allocator other; + using other = region_allocator; }; /// The region that we allocate objects from @@ -392,7 +392,7 @@ namespace Gecode { } /// Returns the largest size for which a call to allocate might succeed. size_type - max_size(void) const noexcept { + max_size() const noexcept { return std::numeric_limits::max() / sizeof(T); } diff --git a/gecode/kernel/memory/config.hpp b/gecode/kernel/memory/config.hpp index bdd7bae506..536077991b 100644 --- a/gecode/kernel/memory/config.hpp +++ b/gecode/kernel/memory/config.hpp @@ -40,119 +40,115 @@ #define GECODE_FREELIST_SIZE_MAX64 3 #endif -namespace Gecode { namespace Kernel { - +/** + * \brief Parameters defining memory management policy for spaces + * \ingroup FuncMemSpace + */ +namespace Gecode::Kernel::MemoryConfig { /** - * \brief Parameters defining memory management policy for spaces - * \ingroup FuncMemSpace + * \brief How many heap chunks should be cached at most */ - namespace MemoryConfig { - /** - * \brief How many heap chunks should be cached at most - */ - const unsigned int n_hc_cache = 4 * 4; + const unsigned int n_hc_cache = 4 * 4; - /** - * \brief Minimal size of a heap chunk requested from the OS - */ - const size_t hcsz_min = 1024; - /** - * \brief Maximal size of a heap chunk requested from the OS - * - * Maximal is not strictly true, if a contiguous memory chunk is - * requested that exceeds \a hcsz_max, a chunk will be allocated - * that fits that request. - */ - const size_t hcsz_max = 32 * 1024; - /** - * \brief Increment ratio for chunk size - * - * If a space has requested \a hcsz_inc_ratio chunks of heap memory, - * the chunk size is doubled. - */ - const int hcsz_inc_ratio = 8; - /** - * \brief Decrement ratio for chunk size - * - * When a space is cloned, the new clone normally inherits the - * current chunk size from the original space. However, if the - * original space has requested less than \a hcsz_dec_ratio - * heap chunks of the current chunk size, the current chunk size - * for the clone is halfed. - */ - const int hcsz_dec_ratio = 8; + /** + * \brief Minimal size of a heap chunk requested from the OS + */ + const size_t hcsz_min = 1024; + /** + * \brief Maximal size of a heap chunk requested from the OS + * + * Maximal is not strictly true, if a contiguous memory chunk is + * requested that exceeds \a hcsz_max, a chunk will be allocated + * that fits that request. + */ + const size_t hcsz_max = 32 * 1024; + /** + * \brief Increment ratio for chunk size + * + * If a space has requested \a hcsz_inc_ratio chunks of heap memory, + * the chunk size is doubled. + */ + const int hcsz_inc_ratio = 8; + /** + * \brief Decrement ratio for chunk size + * + * When a space is cloned, the new clone normally inherits the + * current chunk size from the original space. However, if the + * original space has requested less than \a hcsz_dec_ratio + * heap chunks of the current chunk size, the current chunk size + * for the clone is halfed. + */ + const int hcsz_dec_ratio = 8; - /** - * \brief Unit size for free lists - * - * The unit size (given as binary logarithm) defines how big - * a unit of memory for free lists is. Also, it defines the - * alignment. Sizes of free list objects must be multiples of - * the unit size. - * - * Currently, for 32 bit machines, the unit size is 4 bytes. - * For 64 bit machines, it is 8 bytes. - */ - const int fl_unit_size = ((sizeof(void*) == 4) ? 2 : 3); - /** - * \brief Minimal size for free list element - * - * The minimal size is given in the number of free list units. - * - * Currently, for 32 bit machines, the minimal size is 8 bytes. - * For 64 bit machines, it is 16 bytes. - */ - const int fl_size_min = ((sizeof(void*) == 4) ? 2 : 2); - /** - * \brief Maximal size for free list element - * - * The maximal size is given in the number of free list units. - * - * Currently, for 32 bit machines, the maximal size is 12 bytes. - * For 64 bit machines, it is 24 bytes. - */ - const int fl_size_max = ((sizeof(void*) == 4) ? GECODE_FREELIST_SIZE_MAX32 : GECODE_FREELIST_SIZE_MAX64); - /** - * \brief Number of free lists elements to allocate - * - * When a request for a free list element can not be fulfilled, as - * the free list is empty and there is also no reusable memory - * available, allocate \a fl_refill free list elements. - */ - const int fl_refill = 8; - /** - * \brief Memory alignment - * - * Memory alignment is controlled by the macro GECODE_MEMORY_ALIGNMENT. - * If it is not defined, it assumed to be 8. Otherwise, the defined - * value is used. - */ + /** + * \brief Unit size for free lists + * + * The unit size (given as binary logarithm) defines how big + * a unit of memory for free lists is. Also, it defines the + * alignment. Sizes of free list objects must be multiples of + * the unit size. + * + * Currently, for 32 bit machines, the unit size is 4 bytes. + * For 64 bit machines, it is 8 bytes. + */ + const int fl_unit_size = ((sizeof(void*) == 4) ? 2 : 3); + /** + * \brief Minimal size for free list element + * + * The minimal size is given in the number of free list units. + * + * Currently, for 32 bit machines, the minimal size is 8 bytes. + * For 64 bit machines, it is 16 bytes. + */ + const int fl_size_min = 2; + /** + * \brief Maximal size for free list element + * + * The maximal size is given in the number of free list units. + * + * Currently, for 32 bit machines, the maximal size is 12 bytes. + * For 64 bit machines, it is 24 bytes. + */ + const int fl_size_max = ((sizeof(void*) == 4) ? GECODE_FREELIST_SIZE_MAX32 : GECODE_FREELIST_SIZE_MAX64); + /** + * \brief Number of free lists elements to allocate + * + * When a request for a free list element can not be fulfilled, as + * the free list is empty and there is also no reusable memory + * available, allocate \a fl_refill free list elements. + */ + const int fl_refill = 8; + /** + * \brief Memory alignment + * + * Memory alignment is controlled by the macro GECODE_MEMORY_ALIGNMENT. + * If it is not defined, it assumed to be 8. Otherwise, the defined + * value is used. + */ #ifndef GECODE_MEMORY_ALIGNMENT #define GECODE_MEMORY_ALIGNMENT static_cast(8U) #endif - /** - * \brief Size of region area - * - * The region area can be used in a stack fashion through access - * from a space. If the a request exceeds the current free space, - * memory will be allocated from the heap. - */ - const size_t region_area_size = 32 * 1024; - - /// Align size \a s to the required alignment \a a - void align(size_t& s, size_t a = GECODE_MEMORY_ALIGNMENT); + /** + * \brief Size of region area + * + * The region area can be used in a stack fashion through access + * from a space. If the a request exceeds the current free space, + * memory will be allocated from the heap. + */ + const size_t region_area_size = 32 * 1024; - /* - * Alignment - * - */ - forceinline void - align(size_t& s, size_t a) { - s += ((a - (s & (a - 1))) & (a - 1)); - } + /// Align size \a s to the required alignment \a a + void align(size_t& s, size_t a = GECODE_MEMORY_ALIGNMENT); - } // namespace MemoryConfig + /* + * Alignment + * + */ + forceinline void + align(size_t& s, size_t a) { + s += ((a - (s & (a - 1))) & (a - 1)); + } -}} // namespace Gecode::Kernel +} // namespace Gecode::Kernel::MemoryConfig // STATISTICS: kernel-memory diff --git a/gecode/kernel/memory/manager.cpp b/gecode/kernel/memory/manager.cpp index 10927a898a..a0610d270f 100644 --- a/gecode/kernel/memory/manager.cpp +++ b/gecode/kernel/memory/manager.cpp @@ -32,10 +32,10 @@ #include -namespace Gecode { namespace Kernel { +namespace Gecode::Kernel { Support::Mutex& - SharedMemory::m(void) { + SharedMemory::m() { static Support::Mutex _m; return _m; } @@ -47,6 +47,6 @@ namespace Gecode { namespace Kernel { alloc_fill(sm, sz, false); } -}} // namespace Gecode::Kernel +} // namespace Gecode::Kernel // STATISTICS: kernel-memory diff --git a/gecode/kernel/memory/manager.hpp b/gecode/kernel/memory/manager.hpp index 6890edc5ed..1d6866baee 100644 --- a/gecode/kernel/memory/manager.hpp +++ b/gecode/kernel/memory/manager.hpp @@ -39,7 +39,7 @@ #include -namespace Gecode { namespace Kernel { +namespace Gecode::Kernel { /// Memory chunk with size information class MemoryChunk { @@ -68,13 +68,13 @@ namespace Gecode { namespace Kernel { HeapChunk* hc; } heap; /// A mutex for access - GECODE_KERNEL_EXPORT static Support::Mutex& m(void); + GECODE_KERNEL_EXPORT static Support::Mutex& m(); public: /// Initialize - SharedMemory(void); + SharedMemory(); /// Destructor - ~SharedMemory(void); + ~SharedMemory(); /// \name Heap management //@ /// Return heap chunk, preferable of size \a s, but at least of size \a l @@ -84,7 +84,7 @@ namespace Gecode { namespace Kernel { //@} }; -}} // namespace Gecode::Kernel +} // namespace Gecode::Kernel namespace Gecode { @@ -103,20 +103,20 @@ namespace Gecode { public: /// Use uninitialized - FreeList(void) = default; + FreeList() = default; /// Initialize with next freelist object \a n FreeList(FreeList* n); /// Return next freelist object - FreeList* next(void) const; + FreeList* next() const; /// Return pointer to next link in freelist object - FreeList** next_ref(void); + FreeList** next_ref(); /// Set next freelist object to \a n void next(FreeList* n); }; } // namespace Gecode -namespace Gecode { namespace Kernel { +namespace Gecode::Kernel { /// Manage memory for space class MemoryManager { @@ -150,7 +150,7 @@ namespace Gecode { namespace Kernel { */ void* alloc(SharedMemory& sm, size_t s); /// Get the memory area for subscriptions - void* subscriptions(void) const; + void* subscriptions() const; private: /// Start of free lists @@ -180,9 +180,9 @@ namespace Gecode { namespace Kernel { void reuse(void* p, size_t s); }; -}} // namespace Gecode::Kernel +} // namespace Gecode::Kernel -namespace Gecode { namespace Kernel { +namespace Gecode::Kernel { /* * Shared memory area @@ -190,11 +190,11 @@ namespace Gecode { namespace Kernel { */ forceinline - SharedMemory::SharedMemory(void) { + SharedMemory::SharedMemory() { heap.n_hc = 0; heap.hc = nullptr; } - forceinline SharedMemory::~SharedMemory(void) { + forceinline SharedMemory::~SharedMemory() { while (heap.hc != nullptr) { HeapChunk* hc = heap.hc; heap.hc = static_cast(hc->next); @@ -236,7 +236,7 @@ namespace Gecode { namespace Kernel { } } -}} // namespace Gecode::Kernel +} // namespace Gecode::Kernel namespace Gecode { @@ -250,12 +250,12 @@ namespace Gecode { : _next(n) {} forceinline FreeList* - FreeList::next(void) const { + FreeList::next() const { return _next; } forceinline FreeList** - FreeList::next_ref(void) { + FreeList::next_ref() { return &_next; } @@ -266,7 +266,7 @@ namespace Gecode { } // namespace Gecode -namespace Gecode { namespace Kernel { +namespace Gecode::Kernel { /* * The active memory manager @@ -298,7 +298,7 @@ namespace Gecode { namespace Kernel { } forceinline void* - MemoryManager::subscriptions(void) const { + MemoryManager::subscriptions() const { return &cur_hc->area[0]; } @@ -313,7 +313,7 @@ namespace Gecode { namespace Kernel { size_t overhead = sizeof(HeapChunk) - sizeof(double); sz += overhead; // Round size to next multiple of current heap chunk size - size_t allocate = ((sz > cur_hcsz) ? (static_cast(sz / cur_hcsz) + 1) * cur_hcsz : cur_hcsz); + size_t allocate = ((sz > cur_hcsz) ? ((sz / cur_hcsz) + 1) * cur_hcsz : cur_hcsz); // Request a chunk of preferably size allocate, but at least size sz HeapChunk* hc = sm.alloc(allocate, sz); start = ptr_cast(&hc->area[0]); @@ -338,8 +338,8 @@ namespace Gecode { namespace Kernel { MemoryManager::MemoryManager(SharedMemory& sm) : cur_hcsz(MemoryConfig::hcsz_min), requested(0), slack(nullptr) { alloc_fill(sm, cur_hcsz, true); - for (size_t i = 0; i < MemoryConfig::fl_size_max - MemoryConfig::fl_size_min + 1; i++) - fl[i] = nullptr; + for (auto& list : fl) + list = nullptr; } forceinline @@ -353,8 +353,8 @@ namespace Gecode { namespace Kernel { // Skip the memory area at the beginning for subscriptions lsz -= s_sub; start += s_sub; - for (size_t i = 0; i < MemoryConfig::fl_size_max - MemoryConfig::fl_size_min + 1; i++) - fl[i] = nullptr; + for (auto& list : fl) + list = nullptr; } forceinline void @@ -386,7 +386,7 @@ namespace Gecode { namespace Kernel { #endif size_t aligned_s = s; - void* aligned_p = std::align(std::min(static_cast(GECODE_MEMORY_ALIGNMENT), s), + void* aligned_p = std::align(std::min(GECODE_MEMORY_ALIGNMENT, s), MemoryConfig::fl_size_min << MemoryConfig::fl_unit_size, p, aligned_s); if (aligned_p == nullptr || aligned_s < (MemoryConfig::fl_size_min << MemoryConfig::fl_unit_size)) @@ -470,6 +470,6 @@ namespace Gecode { namespace Kernel { } } -}} // namespace Gecode::Kernel +} // namespace Gecode::Kernel // STATISTICS: kernel-memory diff --git a/gecode/kernel/memory/region.cpp b/gecode/kernel/memory/region.cpp index 6debaa1d7f..0d7564da57 100644 --- a/gecode/kernel/memory/region.cpp +++ b/gecode/kernel/memory/region.cpp @@ -32,14 +32,16 @@ #include +#include + namespace Gecode { - Region::Pool::Pool(void) : c(new Chunk), n_c(2U) { + Region::Pool::Pool() : c(new Chunk), n_c(2U) { c->next = new Chunk; c->next->next = nullptr; } Region::Chunk* - Region::Pool::chunk(void) { + Region::Pool::chunk() { Chunk* n; { Support::Lock l(m); @@ -66,7 +68,7 @@ namespace Gecode { n_c++; } } - Region::Pool::~Pool(void) { + Region::Pool::~Pool() { Support::Lock l(m); // If that were the case there would be a memory leak! assert(c != nullptr); @@ -78,7 +80,7 @@ namespace Gecode { } Region::Pool& - Region::pool(void) { + Region::pool() { thread_local static Region::Pool _p; return _p; } @@ -102,7 +104,7 @@ namespace Gecode { HeapInfo* n = static_cast(heap.ralloc(sizeof(HeapInfo) + (2 * h->n - 1) * sizeof(void*))); n->size = 2 * h->n; n->n = h->n; - memcpy(&n->blocks[0], &h->blocks[0], h->n * sizeof(void*)); + std::copy_n(&h->blocks[0], h->n, &n->blocks[0]); hi = Support::mark(n); heap.rfree(h); h = n; @@ -113,7 +115,7 @@ namespace Gecode { } void - Region::heap_free(void) { + Region::heap_free() { assert(hi != nullptr); if (Support::marked(hi)) { HeapInfo* h = static_cast(Support::unmark(hi)); diff --git a/gecode/kernel/memory/region.hpp b/gecode/kernel/memory/region.hpp index bbb83afdb7..718a89602f 100644 --- a/gecode/kernel/memory/region.hpp +++ b/gecode/kernel/memory/region.hpp @@ -67,7 +67,7 @@ namespace Gecode { /// Return memory if available bool alloc(size_t s, void*& p); /// Free allocated memory (reset chunk) - void reset(void); + void reset(); }; /// The heap chunk in use Chunk* chunk; @@ -83,13 +83,13 @@ namespace Gecode { public: /// Initialize pool - Pool(void); + Pool(); /// Get a new chunk - Chunk* chunk(void); + Chunk* chunk(); /// Return chunk and possible free unused chunk \a u void chunk(Chunk* u); /// Delete pool - ~Pool(void); + ~Pool(); }; /// Just use a single static pool for heap chunks GECODE_KERNEL_EXPORT static Pool& pool(); @@ -114,18 +114,18 @@ namespace Gecode { /// Allocate memory from heap GECODE_KERNEL_EXPORT void* heap_alloc(size_t s); /// Free memory previously allocated from heap - GECODE_KERNEL_EXPORT void heap_free(void); + GECODE_KERNEL_EXPORT void heap_free(); public: /// Initialize region - Region(void); + Region(); /** * \brief Free allocate memory * * Note that in fact not all memory is freed, memory that has been * allocated for large allocation requests will not be freed. */ - void free(void); + void free(); /// \name Typed allocation routines //@{ /** @@ -275,7 +275,7 @@ namespace Gecode { * \brief Constructs a single object of type \a T from region using the default constructor. */ template - T& construct(void); + T& construct(); /** * \brief Constructs a single object of type \a T from region using a unary constructor. * @@ -313,7 +313,7 @@ namespace Gecode { T& construct(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4, A5 const& a5); //@} /// Return memory - ~Region(void); + ~Region(); /// Allocate memory from heap (disabled) static void* operator new(size_t s) = delete; @@ -343,16 +343,16 @@ namespace Gecode { } forceinline void - Region::Chunk::reset(void) { + Region::Chunk::reset() { free = Kernel::MemoryConfig::region_area_size; } forceinline - Region::Region(void) + Region::Region() : chunk(pool().chunk()), hi(nullptr) {} forceinline void - Region::free(void) { + Region::free() { chunk->reset(); } @@ -361,14 +361,13 @@ namespace Gecode { void* p; if (chunk->alloc(s, p)) return p; - else - return heap_alloc(s); + return heap_alloc(s); } forceinline void Region::rfree(void*, size_t) {} - forceinline Region::~Region(void) { + forceinline Region::~Region() { pool().chunk(chunk); if (hi != nullptr) heap_free(); @@ -440,10 +439,9 @@ namespace Gecode { (void)new (p + i) T(); free(b, n); return p; - } else { - free(b + m, n - m); - return b; } + free(b + m, n - m); + return b; } template forceinline T* @@ -469,7 +467,7 @@ namespace Gecode { */ template forceinline T& - Region::construct(void) { + Region::construct() { return alloc(1); } template diff --git a/gecode/kernel/propagator/advisor.hpp b/gecode/kernel/propagator/advisor.hpp index 7c0d966c0c..b82b77b3c2 100644 --- a/gecode/kernel/propagator/advisor.hpp +++ b/gecode/kernel/propagator/advisor.hpp @@ -51,7 +51,7 @@ namespace Gecode { /// Constructor for cloning \a a ViewAdvisor(Space& home, ViewAdvisor& a); /// Access view - View view(void) const; + View view() const; /// Replace view (also replaces subscription to view) void view(Space& home, View y); /// Delete advisor @@ -74,7 +74,7 @@ namespace Gecode { } template forceinline View - ViewAdvisor::view(void) const { + ViewAdvisor::view() const { return x; } template diff --git a/gecode/kernel/propagator/pattern.hpp b/gecode/kernel/propagator/pattern.hpp index 8ce419a242..b69aed2656 100644 --- a/gecode/kernel/propagator/pattern.hpp +++ b/gecode/kernel/propagator/pattern.hpp @@ -58,9 +58,9 @@ namespace Gecode { /// Constructor for cloning \a p UnaryPropagator(Space& home, UnaryPropagator& p); /// Constructor for rewriting \a p during cloning - UnaryPropagator(Space& home, Propagator& p, View x0); + UnaryPropagator(Space& home, Propagator& p, View y0); /// Constructor for creation - UnaryPropagator(Home home, View x0); + UnaryPropagator(Home home, View y0); public: /// Cost function (defined as PC_UNARY_LO) @@ -88,9 +88,9 @@ namespace Gecode { /// Constructor for cloning \a p BinaryPropagator(Space& home, BinaryPropagator& p); /// Constructor for creation - BinaryPropagator(Home home, View x0, View x1); + BinaryPropagator(Home home, View y0, View y1); /// Constructor for rewriting \a p during cloning - BinaryPropagator(Space& home, Propagator& p, View x0, View x1); + BinaryPropagator(Space& home, Propagator& p, View y0, View y1); public: /// Cost function (defined as low binary) @@ -118,9 +118,9 @@ namespace Gecode { /// Constructor for cloning \a p TernaryPropagator(Space& home, TernaryPropagator& p); /// Constructor for creation - TernaryPropagator(Home home, View x0, View x1, View x2); + TernaryPropagator(Home home, View y0, View y1, View y2); /// Constructor for rewriting \a p during cloning - TernaryPropagator(Space& home, Propagator& p, View x0, View x1, View x2); + TernaryPropagator(Space& home, Propagator& p, View y0, View y1, View y2); public: /// Cost function (defined as low ternary) @@ -150,7 +150,7 @@ namespace Gecode { /// Constructor for rewriting \a p during cloning NaryPropagator(Space& home, Propagator& p, ViewArray& x); /// Constructor for creation - NaryPropagator(Home home, ViewArray& x); + NaryPropagator(Home home, ViewArray& y); public: /// Cost function (defined as low linear) @@ -214,9 +214,9 @@ namespace Gecode { /// Constructor for cloning MixBinaryPropagator(Space& home, MixBinaryPropagator& p); /// Constructor for creation - MixBinaryPropagator(Home home, View0 x0, View1 x1); + MixBinaryPropagator(Home home, View0 y0, View1 y1); /// Constructor for rewriting \a p during cloning - MixBinaryPropagator(Space& home, Propagator& p, View0 x0, View1 x1); + MixBinaryPropagator(Space& home, Propagator& p, View0 y0, View1 y1); public: /// Cost function (defined as low binary) @@ -249,9 +249,9 @@ namespace Gecode { /// Constructor for cloning MixTernaryPropagator(Space& home, MixTernaryPropagator& p); /// Constructor for creation - MixTernaryPropagator(Home home, View0 x0, View1 x1, View2 x2); + MixTernaryPropagator(Home home, View0 y0, View1 y1, View2 y2); /// Constructor for rewriting \a p during cloning - MixTernaryPropagator(Space& home, Propagator& p, View0 x0, View1 x1, View2 x2); + MixTernaryPropagator(Space& home, Propagator& p, View0 y0, View1 y1, View2 y2); public: /// Cost function (defined as low ternary) diff --git a/gecode/kernel/propagator/subscribed.hpp b/gecode/kernel/propagator/subscribed.hpp index 3240f692d1..7816f2b47f 100644 --- a/gecode/kernel/propagator/subscribed.hpp +++ b/gecode/kernel/propagator/subscribed.hpp @@ -67,11 +67,11 @@ namespace Gecode { template void init(DerivedView& x); /// Test whether there are propagators left - bool operator()(void) const; + bool operator()() const; /// Move iterator to next propagator - void operator++(void); + void operator++(); /// Return propagator - Propagator& propagator(void) const; + Propagator& propagator() const; }; template @@ -118,15 +118,15 @@ namespace Gecode { } forceinline bool - SubscribedPropagators::operator()(void) const { + SubscribedPropagators::operator()() const { return c < ea; } forceinline void - SubscribedPropagators::operator++(void) { + SubscribedPropagators::operator++() { c++; } forceinline Propagator& - SubscribedPropagators::propagator(void) const { + SubscribedPropagators::propagator() const { return (c < ep) ? *Propagator::cast(*c) : Advisor::cast(*c)->propagator(); } diff --git a/gecode/kernel/propagator/wait.hpp b/gecode/kernel/propagator/wait.hpp index 6751af4b2a..cc909616a9 100644 --- a/gecode/kernel/propagator/wait.hpp +++ b/gecode/kernel/propagator/wait.hpp @@ -146,10 +146,9 @@ namespace Gecode { if (x.assigned()) { c(home); return home.failed() ? ES_FAILED : ES_OK; - } else { - (void)new (home) UnaryWait(home, x, std::move(c)); - return ES_OK; } + (void)new (home) UnaryWait(home, x, std::move(c)); + return ES_OK; } template size_t @@ -212,13 +211,11 @@ namespace Gecode { GECODE_VALID_FUNCTION(c()); c()(home); return home.failed() ? ES_FAILED : home.ES_SUBSUMED(*this); - } else { - // Create new subscription - x.move_lst(0); - assert(!x[0].assigned()); - x[0].subscribe(home, *this, PC_GEN_ASSIGNED, false); - return ES_OK; - } + } // Create new subscription + x.move_lst(0); + assert(!x[0].assigned()); + x[0].subscribe(home, *this, PC_GEN_ASSIGNED, false); + return ES_OK; } template forceinline ExecStatus @@ -231,15 +228,13 @@ namespace Gecode { if (x.size() == 0) { c(home); return home.failed() ? ES_FAILED : ES_OK; - } else { - x.unique(); - if (x.size() == 1) { - return UnaryWait::post(home, x[0], std::move(c)); - } else { - (void)new (home) NaryWait(home, x, std::move(c)); - return ES_OK; - } } + x.unique(); + if (x.size() == 1) { + return UnaryWait::post(home, x[0], std::move(c)); + } + (void)new (home) NaryWait(home, x, std::move(c)); + return ES_OK; } template size_t diff --git a/gecode/kernel/range-list.hpp b/gecode/kernel/range-list.hpp index f8f5538482..de941d4176 100644 --- a/gecode/kernel/range-list.hpp +++ b/gecode/kernel/range-list.hpp @@ -56,7 +56,7 @@ namespace Gecode { /// \name Constructors //@{ /// Default constructor (noop) - RangeList(void); + RangeList(); /// Initialize with minimum \a min and maximum \a max RangeList(int min, int max); /// Initialize with minimum \a min and maximum \a max and successor \a n @@ -66,16 +66,16 @@ namespace Gecode { /// \name Access //@{ /// Return minimum - int min(void) const; + int min() const; /// Return maximum - int max(void) const; + int max() const; /// Return width (distance between maximum and minimum) - unsigned int width(void) const; + unsigned int width() const; /// Return next element - RangeList* next(void) const; + RangeList* next() const; /// Return pointer to next element - RangeList** next_ref(void); + RangeList** next_ref(); //@} /// \name Update @@ -128,7 +128,7 @@ namespace Gecode { forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - RangeList::RangeList(void) {} + RangeList::RangeList() {} forceinline RangeList::RangeList(int min, int max, RangeList* n) @@ -139,12 +139,12 @@ namespace Gecode { : _min(min), _max(max) {} forceinline RangeList* - RangeList::next(void) const { + RangeList::next() const { return static_cast(FreeList::next()); } forceinline RangeList** - RangeList::next_ref(void) { + RangeList::next_ref() { return reinterpret_cast(FreeList::next_ref()); } @@ -162,15 +162,15 @@ namespace Gecode { } forceinline int - RangeList::min(void) const { + RangeList::min() const { return _min; } forceinline int - RangeList::max(void) const { + RangeList::max() const { return _max; } forceinline unsigned int - RangeList::width(void) const { + RangeList::width() const { return static_cast(_max - _min + 1); } diff --git a/gecode/kernel/shared-object.hpp b/gecode/kernel/shared-object.hpp index e89fce44e1..35669577de 100644 --- a/gecode/kernel/shared-object.hpp +++ b/gecode/kernel/shared-object.hpp @@ -58,22 +58,22 @@ namespace Gecode { public: /// Initialize - Object(void); + Object(); /// Delete shared object - virtual ~Object(void); + virtual ~Object(); }; private: /// The shared object Object* o; /// Subscribe handle to object - void subscribe(void); + void subscribe(); /// Cancel subscription of handle to object - void cancel(void); + void cancel(); public: /// Create shared handle with no object pointing to - SharedHandle(void); + SharedHandle(); /// Create shared handle that points to shared object \a so SharedHandle(SharedHandle::Object* so); /// Copy constructor maintaining reference count @@ -81,35 +81,35 @@ namespace Gecode { /// Assignment operator maintaining reference count SharedHandle& operator=(const SharedHandle& sh); /// Destructor that maintains reference count - ~SharedHandle(void); + ~SharedHandle(); /// Whether handle points to an object - explicit operator bool(void) const; + explicit operator bool() const; protected: /// Access to the shared object - SharedHandle::Object* object(void) const; + SharedHandle::Object* object() const; /// Modify shared object void object(SharedHandle::Object* n); }; forceinline - SharedHandle::Object::Object(void) + SharedHandle::Object::Object() : rc(0) {} - forceinline SharedHandle::Object::~Object(void) { + forceinline SharedHandle::Object::~Object() { assert(!rc); } forceinline SharedHandle::Object* - SharedHandle::object(void) const { + SharedHandle::object() const { return o; } forceinline void - SharedHandle::subscribe(void) { + SharedHandle::subscribe() { if (o != nullptr) o->rc.inc(); } forceinline void - SharedHandle::cancel(void) { + SharedHandle::cancel() { if ((o != nullptr) && o->rc.dec()) delete o; o = nullptr; @@ -123,7 +123,7 @@ namespace Gecode { } } forceinline - SharedHandle::SharedHandle(void) + SharedHandle::SharedHandle() : o(nullptr) {} forceinline SharedHandle::SharedHandle(SharedHandle::Object* so) @@ -145,10 +145,10 @@ namespace Gecode { return *this; } forceinline SharedHandle:: - operator bool(void) const { + operator bool() const { return o != nullptr; } - forceinline SharedHandle::~SharedHandle(void) { + forceinline SharedHandle::~SharedHandle() { cancel(); } diff --git a/gecode/kernel/shared-space-data.hpp b/gecode/kernel/shared-space-data.hpp index 99d60cd56c..9067d32c49 100644 --- a/gecode/kernel/shared-space-data.hpp +++ b/gecode/kernel/shared-space-data.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Kernel { +namespace Gecode::Kernel { /// Class to store data shared among several spaces class SharedSpaceData : public SharedHandle { @@ -43,26 +43,26 @@ namespace Gecode { namespace Kernel { /// The global propagator information GPI gpi; /// Default constructor - Data(void) = default; + Data() = default; /// Destructor - ~Data(void) override; + ~Data() override; }; /// Initialize - SharedSpaceData(void); + SharedSpaceData(); /// Initialize from \a ssd SharedSpaceData(const SharedSpaceData& ssd) = default; /// Assignment operator - SharedSpaceData& operator=(const SharedSpaceData& r); + SharedSpaceData& operator=(const SharedSpaceData& ssd); /// Delete - ~SharedSpaceData(void) = default; + ~SharedSpaceData() = default; /// Provide access - Data& data(void) const; + Data& data() const; }; - forceinline SharedSpaceData::Data::~Data(void) = default; + forceinline SharedSpaceData::Data::~Data() = default; forceinline - SharedSpaceData::SharedSpaceData(void) + SharedSpaceData::SharedSpaceData() : SharedHandle(new Data) {} forceinline SharedSpaceData& @@ -72,10 +72,10 @@ namespace Gecode { namespace Kernel { } forceinline SharedSpaceData::Data& - SharedSpaceData::data(void) const { + SharedSpaceData::data() const { return static_cast(*object()); } -}} // namespace Gecode::Kernel +} // namespace Gecode::Kernel // STATISTICS: kernel-memory diff --git a/gecode/kernel/trace/filter.cpp b/gecode/kernel/trace/filter.cpp index 33026f01e3..112b6d4410 100644 --- a/gecode/kernel/trace/filter.cpp +++ b/gecode/kernel/trace/filter.cpp @@ -39,7 +39,7 @@ namespace Gecode { * */ bool - TFE::Node::decrement(void) { + TFE::Node::decrement() { if (--use == 0) { if ((l != nullptr) && l->decrement()) delete l; @@ -60,7 +60,7 @@ namespace Gecode { } inline TFE - TFE::negate(void) const { + TFE::negate() const { Node* m = new Node; m->t = NT_NEGATE; m->n = n->n; @@ -78,7 +78,7 @@ namespace Gecode { } TFE - TFE::other(void) { + TFE::other() { TFE e; e.init(Group::all, (1 << std::to_underlying(ViewTraceInfo::OTHER))); return e; @@ -116,7 +116,7 @@ namespace Gecode { return operator+=(e.negate()); } - TFE::~TFE(void) { + TFE::~TFE() { if (n->decrement()) delete n; } @@ -147,7 +147,7 @@ namespace Gecode { forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - TraceFilter::TFO::StackFrame::StackFrame(void) {} + TraceFilter::TFO::StackFrame::StackFrame() {} forceinline TraceFilter::TFO::StackFrame::StackFrame(TFE::Node* n0, bool neg0) : n(n0), neg(neg0) {} @@ -180,12 +180,12 @@ namespace Gecode { } while (!next.empty()); } - TraceFilter::TFO::~TFO(void) { + TraceFilter::TFO::~TFO() { if (f != nullptr) heap.free(f, n); } - TraceFilter::TraceFilter(void) : SharedHandle(new TFO) {} + TraceFilter::TraceFilter() : SharedHandle(new TFO) {} TraceFilter::TraceFilter(const TFE& e) : SharedHandle(new TFO(e)) {} @@ -193,10 +193,7 @@ namespace Gecode { TraceFilter::TraceFilter(BrancherGroup g) : SharedHandle(new TFO(g)) {} - TraceFilter& - TraceFilter::operator=(const TraceFilter& tf) { - return static_cast(SharedHandle::operator=(tf)); - } + TraceFilter& TraceFilter::operator=(const TraceFilter& tf) = default; TraceFilter TraceFilter::all; diff --git a/gecode/kernel/trace/filter.hpp b/gecode/kernel/trace/filter.hpp index 1785c26804..ab1f4fc14b 100644 --- a/gecode/kernel/trace/filter.hpp +++ b/gecode/kernel/trace/filter.hpp @@ -39,7 +39,7 @@ namespace Gecode { * \ingroup TaskTrace */ class TFE { - friend GECODE_KERNEL_EXPORT TFE operator-(const TFE& r); + friend GECODE_KERNEL_EXPORT TFE operator-(const TFE& e); friend GECODE_KERNEL_EXPORT TFE propagator(PropagatorGroup g); friend GECODE_KERNEL_EXPORT TFE post(PropagatorGroup g); friend class TraceFilter; @@ -68,21 +68,21 @@ namespace Gecode { /// Subexpressions Node *l, *r; /// Default constructor - Node(void); + Node(); /// Decrement reference count and possibly free memory GECODE_KERNEL_EXPORT - bool decrement(void); + bool decrement(); }; /// Pointer to trace filter expression node Node* n; /// Initialize with no node - TFE(void); + TFE(); /// Initialize with node \a n TFE(Node* n); /// Initialize with propagator group \a g and flags \a what void init(Group g, char what); /// Return negated the expression - TFE negate(void) const; + TFE negate() const; public: /// An expression for a propagator group \a g @@ -93,7 +93,7 @@ namespace Gecode { TFE(BrancherGroup g); /// Expression for other than propagator, brancher, or post GECODE_KERNEL_EXPORT - static TFE other(void); + static TFE other(); /// Copy constructor GECODE_KERNEL_EXPORT TFE(const TFE& e); @@ -108,7 +108,7 @@ namespace Gecode { TFE& operator-=(const TFE& e); /// Destructor GECODE_KERNEL_EXPORT - ~TFE(void); + ~TFE(); }; /// Disjunctive combination of trace filter expressions \a l and \a r @@ -152,7 +152,7 @@ namespace Gecode { /// Whether it is negated bool neg; /// Default constructor - StackFrame(void); + StackFrame(); /// Initialize StackFrame(TFE::Node* n, bool neg); }; @@ -164,7 +164,7 @@ namespace Gecode { GECODE_KERNEL_EXPORT void fill(TFE::Node* n); /// Initialize without any filter and with fixpoint and done tracing - TFO(void); + TFO(); /// Initialize with trace filter expression \a e TFO(const TFE& e); /// Initialize with propagator group \a g @@ -179,13 +179,13 @@ namespace Gecode { bool operator()(BrancherGroup bg) const; /// Destructor GECODE_KERNEL_EXPORT - ~TFO(void) override; + ~TFO() override; }; public: /// Initialize without any filter GECODE_KERNEL_EXPORT - TraceFilter(void); + TraceFilter(); /// Initialize with trace filter expression \a e GECODE_KERNEL_EXPORT TraceFilter(const TFE& e); @@ -218,10 +218,10 @@ namespace Gecode { */ forceinline - TFE::Node::Node(void) + TFE::Node::Node() : use(1), l(nullptr), r(nullptr) {} forceinline - TFE::TFE(void) + TFE::TFE() : n(nullptr) {} forceinline TFE::TFE(TFE::Node* n0) @@ -247,7 +247,7 @@ namespace Gecode { * */ forceinline - TraceFilter::TFO::TFO(void) + TraceFilter::TFO::TFO() : n(0), f(nullptr) {} forceinline TraceFilter::TFO::TFO(const TFE& e) diff --git a/gecode/kernel/trace/recorder.hpp b/gecode/kernel/trace/recorder.hpp index feb2711e3e..3962a6dca4 100644 --- a/gecode/kernel/trace/recorder.hpp +++ b/gecode/kernel/trace/recorder.hpp @@ -59,11 +59,11 @@ namespace Gecode { class ViewTraceRecorder : public Propagator { public: /// The corresponding duplicate view type - typedef typename TraceTraits::TraceView TraceView; + using TraceView = TraceTraits::TraceView; /// The corresponding trace delta type - typedef typename TraceTraits::TraceDelta TraceDelta; + using TraceDelta = TraceTraits::TraceDelta; /// The corresponding slack value type - typedef typename TraceTraits::SlackValue SlackValue; + using SlackValue = TraceTraits::SlackValue; /// Collection of slack values class Slack { template @@ -79,11 +79,11 @@ namespace Gecode { public: /// Return initial slack value - SlackValue initial(void) const; + SlackValue initial() const; /// Return previous slack value - SlackValue previous(void) const; + SlackValue previous() const; /// Return current slack value - SlackValue current(void) const; + SlackValue current() const; }; protected: @@ -99,7 +99,7 @@ namespace Gecode { /// Constructor for cloning \a a Idx(Space& home, Idx& a); /// Get index of view - int idx(void) const; + int idx() const; }; /// Duplicate views (old information) ViewArray o; @@ -138,11 +138,11 @@ namespace Gecode { /// \name Trace information //@{ /// Return variable being traced at position \a i - const typename View::VarType operator[](int i) const; + View::VarType operator[](int i) const; /// Return number of variables being traced - int size(void) const; + int size() const; /// Provide access to slack information - const Slack& slack(void) const; + const Slack& slack() const; //@} }; @@ -165,7 +165,6 @@ namespace Gecode { /// Constructor for cloning \a p TraceRecorder(Space& home, TraceRecorder& p); - public: /// Constructor for creation TraceRecorder(Home home, const TraceFilter& tf, int te, Tracer& t); /// Copy propagator during cloning @@ -183,11 +182,11 @@ namespace Gecode { /// \name Trace information //@{ /// Return trace filter - const TraceFilter& filter(void) const; + const TraceFilter& filter() const; /// Which events to trace - int events(void) const; + int events() const; /// Return tracer - Tracer& tracer(void) const; + Tracer& tracer() const; //@} }; @@ -196,19 +195,19 @@ namespace Gecode { * */ template - forceinline const typename View::VarType + forceinline View::VarType ViewTraceRecorder::operator[](int i) const { const typename View::VarType x(n[i].varimp()); return x; } template forceinline int - ViewTraceRecorder::size(void) const { + ViewTraceRecorder::size() const { return n.size(); } template - forceinline const typename ViewTraceRecorder::Slack& - ViewTraceRecorder::slack(void) const { + forceinline const ViewTraceRecorder::Slack& + ViewTraceRecorder::slack() const { return s; } @@ -217,18 +216,18 @@ namespace Gecode { * */ template - forceinline typename ViewTraceRecorder::SlackValue - ViewTraceRecorder::Slack::initial(void) const { + forceinline ViewTraceRecorder::SlackValue + ViewTraceRecorder::Slack::initial() const { return i; } template - forceinline typename ViewTraceRecorder::SlackValue - ViewTraceRecorder::Slack::previous(void) const { + forceinline ViewTraceRecorder::SlackValue + ViewTraceRecorder::Slack::previous() const { return p; } template - forceinline typename ViewTraceRecorder::SlackValue - ViewTraceRecorder::Slack::current(void) const { + forceinline ViewTraceRecorder::SlackValue + ViewTraceRecorder::Slack::current() const { return c; } @@ -247,7 +246,7 @@ namespace Gecode { : Advisor(home, a), _idx(a._idx) {} template forceinline int - ViewTraceRecorder::Idx::idx(void) const { + ViewTraceRecorder::Idx::idx() const { return _idx; } @@ -370,15 +369,15 @@ namespace Gecode { * */ forceinline const TraceFilter& - TraceRecorder::filter(void) const { + TraceRecorder::filter() const { return tf; } forceinline int - TraceRecorder::events(void) const { + TraceRecorder::events() const { return te; } forceinline Tracer& - TraceRecorder::tracer(void) const { + TraceRecorder::tracer() const { return t; } diff --git a/gecode/kernel/trace/tracer.hpp b/gecode/kernel/trace/tracer.hpp index b67b1602c0..0a3320c1ed 100644 --- a/gecode/kernel/trace/tracer.hpp +++ b/gecode/kernel/trace/tracer.hpp @@ -67,7 +67,7 @@ namespace Gecode { * */ void _prune(const Space& home, const ViewTraceRecorder& t, const ViewTraceInfo& vti, int i, - typename TraceTraits::TraceDelta& d); + TraceTraits::TraceDelta& d); /** * \brief Fail function synchronization * @@ -90,7 +90,7 @@ namespace Gecode { public: /// Constructor - ViewTracer(void) = default; + ViewTracer() = default; /** * \brief Init function * @@ -108,7 +108,7 @@ namespace Gecode { * information \a ei. */ virtual void prune(const Space& home, const ViewTraceRecorder& t, const ViewTraceInfo& vti, int i, - typename TraceTraits::TraceDelta& d) = 0; + TraceTraits::TraceDelta& d) = 0; /** * \brief Fail function * @@ -132,7 +132,7 @@ namespace Gecode { */ virtual void done(const Space& home, const ViewTraceRecorder& t) = 0; /// Destructor - virtual ~ViewTracer(void); + virtual ~ViewTracer(); }; /** @@ -168,7 +168,7 @@ namespace Gecode { public: /// Constructor - Tracer(void) = default; + Tracer() = default; /** * \brief Propagate function * @@ -191,7 +191,7 @@ namespace Gecode { */ virtual void post(const Space& home, const PostTraceInfo& pti) = 0; /// Destructor - virtual ~Tracer(void); + virtual ~Tracer(); }; /** @@ -244,7 +244,7 @@ namespace Gecode { template forceinline void ViewTracer::_prune(const Space& home, const ViewTraceRecorder& t, const ViewTraceInfo& vti, int i, - typename TraceTraits::TraceDelta& d) { + TraceTraits::TraceDelta& d) { Support::Lock l(m); prune(home, t, vti, i, d); } @@ -268,7 +268,7 @@ namespace Gecode { } template - forceinline ViewTracer::~ViewTracer(void) = default; + forceinline ViewTracer::~ViewTracer() = default; /* * Tracer @@ -290,7 +290,7 @@ namespace Gecode { post(home, pti); } - forceinline Tracer::~Tracer(void) = default; + forceinline Tracer::~Tracer() = default; } // namespace Gecode diff --git a/gecode/kernel/var-imp.hpp b/gecode/kernel/var-imp.hpp index 120731b4bd..2028fd2162 100644 --- a/gecode/kernel/var-imp.hpp +++ b/gecode/kernel/var-imp.hpp @@ -50,7 +50,7 @@ */ #ifdef GECODE_HAS_INT_VARS -namespace Gecode { namespace Int { +namespace Gecode::Int { /// Base-class for Int-variable implementations class IntVarImpBase : public Gecode::VarImp { protected: @@ -59,7 +59,7 @@ namespace Gecode { namespace Int { public: /// Constructor for creating static instance of variable - IntVarImpBase(void) = default; + IntVarImpBase() = default; /// Constructor for creating variable IntVarImpBase(Gecode::Space& home); /// \name Dependencies @@ -94,10 +94,10 @@ namespace Gecode { namespace Int { void reschedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned); //@} }; -}} // namespace Gecode::Int +} // namespace Gecode::Int #endif #ifdef GECODE_HAS_INT_VARS -namespace Gecode { namespace Int { +namespace Gecode::Int { /// Base-class for Bool-variable implementations class BoolVarImpBase : public Gecode::VarImp { protected: @@ -106,7 +106,7 @@ namespace Gecode { namespace Int { public: /// Constructor for creating static instance of variable - BoolVarImpBase(void) = default; + BoolVarImpBase() = default; /// Constructor for creating variable BoolVarImpBase(Gecode::Space& home); /// \name Dependencies @@ -141,10 +141,10 @@ namespace Gecode { namespace Int { void reschedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned); //@} }; -}} // namespace Gecode::Int +} // namespace Gecode::Int #endif #ifdef GECODE_HAS_SET_VARS -namespace Gecode { namespace Set { +namespace Gecode::Set { /// Base-class for Set-variable implementations class SetVarImpBase : public Gecode::VarImp { protected: @@ -153,7 +153,7 @@ namespace Gecode { namespace Set { public: /// Constructor for creating static instance of variable - SetVarImpBase(void) = default; + SetVarImpBase() = default; /// Constructor for creating variable SetVarImpBase(Gecode::Space& home); /// \name Dependencies @@ -188,10 +188,10 @@ namespace Gecode { namespace Set { void reschedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned); //@} }; -}} // namespace Gecode::Set +} // namespace Gecode::Set #endif #ifdef GECODE_HAS_FLOAT_VARS -namespace Gecode { namespace Float { +namespace Gecode::Float { /// Base-class for Float-variable implementations class FloatVarImpBase : public Gecode::VarImp { protected: @@ -200,7 +200,7 @@ namespace Gecode { namespace Float { public: /// Constructor for creating static instance of variable - FloatVarImpBase(void) = default; + FloatVarImpBase() = default; /// Constructor for creating variable FloatVarImpBase(Gecode::Space& home); /// \name Dependencies @@ -235,10 +235,10 @@ namespace Gecode { namespace Float { void reschedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned); //@} }; -}} // namespace Gecode::Float +} // namespace Gecode::Float #endif #ifdef GECODE_HAS_INT_VARS -namespace Gecode { namespace Int { +namespace Gecode::Int { forceinline IntVarImpBase::IntVarImpBase(Gecode::Space& home) @@ -295,10 +295,10 @@ namespace Gecode { namespace Int { return me; } -}} // namespace Gecode::Int +} // namespace Gecode::Int #endif #ifdef GECODE_HAS_INT_VARS -namespace Gecode { namespace Int { +namespace Gecode::Int { forceinline BoolVarImpBase::BoolVarImpBase(Gecode::Space& home) @@ -336,10 +336,10 @@ namespace Gecode { namespace Int { return ME_BOOL_VAL; } -}} // namespace Gecode::Int +} // namespace Gecode::Int #endif #ifdef GECODE_HAS_SET_VARS -namespace Gecode { namespace Set { +namespace Gecode::Set { forceinline SetVarImpBase::SetVarImpBase(Gecode::Space& home) @@ -427,10 +427,10 @@ namespace Gecode { namespace Set { return me; } -}} // namespace Gecode::Set +} // namespace Gecode::Set #endif #ifdef GECODE_HAS_FLOAT_VARS -namespace Gecode { namespace Float { +namespace Gecode::Float { forceinline FloatVarImpBase::FloatVarImpBase(Gecode::Space& home) @@ -481,12 +481,12 @@ namespace Gecode { namespace Float { return me; } -}} // namespace Gecode::Float +} // namespace Gecode::Float #endif namespace Gecode { forceinline void - Space::recover_noidx(void) { + Space::recover_noidx() { VarImp* x = static_cast*>(pc.c.vars_noidx); while (x != nullptr) { VarImp* n = x->next(); @@ -517,8 +517,7 @@ namespace Gecode { forceinline void Space::recover(Space& source) { ActorLink* clone_lists[2] = {&pl, &bl}; - for (int i = 0; i < 2; i++) { - ActorLink* l = clone_lists[i]; + for (auto* l : clone_lists) { ActorLink* c = l->next(); while (c != l) { ActorLink* n = c->next(); diff --git a/gecode/kernel/var-type.hpp b/gecode/kernel/var-type.hpp index 4c36e399df..b2ead2a42f 100644 --- a/gecode/kernel/var-type.hpp +++ b/gecode/kernel/var-type.hpp @@ -50,7 +50,7 @@ */ #ifdef GECODE_HAS_INT_VARS -namespace Gecode { namespace Int { +namespace Gecode::Int { /** * \defgroup TaskActorIntMEPC Integer modification events and propagation conditions * \ingroup TaskActorInt @@ -107,10 +107,10 @@ namespace Gecode { namespace Int { */ const Gecode::PropCond PC_INT_DOM = Gecode::PC_GEN_ASSIGNED + 2; //@} -}} // namespace Gecode::Int +} // namespace Gecode::Int #endif #ifdef GECODE_HAS_INT_VARS -namespace Gecode { namespace Int { +namespace Gecode::Int { /** * \defgroup TaskActorIntMEPC Integer modification events and propagation conditions * \ingroup TaskActorInt @@ -133,10 +133,10 @@ namespace Gecode { namespace Int { */ const Gecode::PropCond PC_BOOL_VAL = Gecode::PC_GEN_ASSIGNED; //@} -}} // namespace Gecode::Int +} // namespace Gecode::Int #endif #ifdef GECODE_HAS_SET_VARS -namespace Gecode { namespace Set { +namespace Gecode::Set { /** * \defgroup TaskActorSetMEPC Set modification events and propagation conditions * \ingroup TaskActorSet @@ -255,10 +255,10 @@ namespace Gecode { namespace Set { */ const Gecode::PropCond PC_SET_ANY = Gecode::PC_GEN_ASSIGNED + 4; //@} -}} // namespace Gecode::Set +} // namespace Gecode::Set #endif #ifdef GECODE_HAS_FLOAT_VARS -namespace Gecode { namespace Float { +namespace Gecode::Float { /** * \defgroup TaskActorFloatMEPC Float modification events and propagation conditions * \ingroup TaskActorFloat @@ -299,10 +299,10 @@ namespace Gecode { namespace Float { */ const Gecode::PropCond PC_FLOAT_BND = Gecode::PC_GEN_ASSIGNED + 1; //@} -}} // namespace Gecode::Float +} // namespace Gecode::Float #endif #ifdef GECODE_HAS_INT_VARS -namespace Gecode { namespace Int { +namespace Gecode::Int { /// Configuration for Int-variable implementations class IntVarImpConf { public: @@ -325,9 +325,9 @@ namespace Gecode { namespace Int { /// Update modification even delta \a med by \a me, return true on change static bool med_update(Gecode::ModEventDelta& med, Gecode::ModEvent me); }; -}} // namespace Gecode::Int +} // namespace Gecode::Int #else -namespace Gecode { namespace Int { +namespace Gecode::Int { /// Dummy configuration for Int-variable implementations class IntVarImpConf { public: @@ -338,10 +338,10 @@ namespace Gecode { namespace Int { /// End of bits for modification event delta static const int med_lst = 0; }; -}} // namespace Gecode::Int +} // namespace Gecode::Int #endif #ifdef GECODE_HAS_INT_VARS -namespace Gecode { namespace Int { +namespace Gecode::Int { /// Configuration for Bool-variable implementations class BoolVarImpConf { public: @@ -364,9 +364,9 @@ namespace Gecode { namespace Int { /// Update modification even delta \a med by \a me, return true on change static bool med_update(Gecode::ModEventDelta& med, Gecode::ModEvent me); }; -}} // namespace Gecode::Int +} // namespace Gecode::Int #else -namespace Gecode { namespace Int { +namespace Gecode::Int { /// Dummy configuration for Bool-variable implementations class BoolVarImpConf { public: @@ -377,10 +377,10 @@ namespace Gecode { namespace Int { /// End of bits for modification event delta static const int med_lst = Gecode::Int::IntVarImpConf::med_lst; }; -}} // namespace Gecode::Int +} // namespace Gecode::Int #endif #ifdef GECODE_HAS_SET_VARS -namespace Gecode { namespace Set { +namespace Gecode::Set { /// Configuration for Set-variable implementations class SetVarImpConf { public: @@ -403,9 +403,9 @@ namespace Gecode { namespace Set { /// Update modification even delta \a med by \a me, return true on change static bool med_update(Gecode::ModEventDelta& med, Gecode::ModEvent me); }; -}} // namespace Gecode::Set +} // namespace Gecode::Set #else -namespace Gecode { namespace Set { +namespace Gecode::Set { /// Dummy configuration for Set-variable implementations class SetVarImpConf { public: @@ -416,10 +416,10 @@ namespace Gecode { namespace Set { /// End of bits for modification event delta static const int med_lst = Gecode::Int::BoolVarImpConf::med_lst; }; -}} // namespace Gecode::Set +} // namespace Gecode::Set #endif #ifdef GECODE_HAS_FLOAT_VARS -namespace Gecode { namespace Float { +namespace Gecode::Float { /// Configuration for Float-variable implementations class FloatVarImpConf { public: @@ -442,9 +442,9 @@ namespace Gecode { namespace Float { /// Update modification even delta \a med by \a me, return true on change static bool med_update(Gecode::ModEventDelta& med, Gecode::ModEvent me); }; -}} // namespace Gecode::Float +} // namespace Gecode::Float #else -namespace Gecode { namespace Float { +namespace Gecode::Float { /// Dummy configuration for Float-variable implementations class FloatVarImpConf { public: @@ -455,7 +455,7 @@ namespace Gecode { namespace Float { /// End of bits for modification event delta static const int med_lst = Gecode::Set::SetVarImpConf::med_lst; }; -}} // namespace Gecode::Float +} // namespace Gecode::Float #endif namespace Gecode { @@ -474,7 +474,7 @@ namespace Gecode { } // namespace Gecode #ifdef GECODE_HAS_INT_VARS -namespace Gecode { namespace Int { +namespace Gecode::Int { forceinline Gecode::ModEvent IntVarImpConf::me_combine(Gecode::ModEvent me1, Gecode::ModEvent me2) { static const Gecode::ModEvent me_c = (((ME_INT_NONE << 0) | // [ME_INT_NONE][ME_INT_NONE] @@ -513,8 +513,8 @@ namespace Gecode { namespace Int { break; } case ME_INT_BND: { - static const Gecode::ModEvent me_c = (((ME_INT_NONE ^ ME_INT_BND) << 0) | ((ME_INT_VAL ^ ME_INT_VAL) << 4) | - ((ME_INT_BND ^ ME_INT_BND) << 8) | ((ME_INT_DOM ^ ME_INT_BND) << 12)); + static const Gecode::ModEvent me_c = + (((ME_INT_NONE ^ ME_INT_BND) << 0) | ((ME_INT_DOM ^ ME_INT_BND) << 12)); Gecode::ModEvent me_o = (med & med_mask) >> med_fst; Gecode::ModEvent me_n = (me_c >> (me_o << 2)) & (med_mask >> med_fst); if (me_n == 0) @@ -535,10 +535,10 @@ namespace Gecode { namespace Int { return true; } -}} // namespace Gecode::Int +} // namespace Gecode::Int #endif #ifdef GECODE_HAS_INT_VARS -namespace Gecode { namespace Int { +namespace Gecode::Int { forceinline Gecode::ModEvent BoolVarImpConf::me_combine(Gecode::ModEvent me1, Gecode::ModEvent me2) { return me1 | me2; @@ -559,10 +559,10 @@ namespace Gecode { namespace Int { return true; } -}} // namespace Gecode::Int +} // namespace Gecode::Int #endif #ifdef GECODE_HAS_SET_VARS -namespace Gecode { namespace Set { +namespace Gecode::Set { forceinline Gecode::ModEvent SetVarImpConf::me_combine(Gecode::ModEvent me1, Gecode::ModEvent me2) { static const Gecode::ModEvent me_c[ME_SET_CBB + 1][ME_SET_CBB + 1] = { @@ -681,12 +681,15 @@ namespace Gecode { namespace Set { break; } case ME_SET_CARD: { - static const Gecode::ModEventDelta me_c[ME_SET_CBB + 1] = { - (ME_SET_NONE ^ ME_SET_CARD) << med_fst, (ME_SET_VAL ^ ME_SET_VAL) << med_fst, - (ME_SET_CARD ^ ME_SET_CARD) << med_fst, (ME_SET_LUB ^ ME_SET_CLUB) << med_fst, - (ME_SET_GLB ^ ME_SET_CGLB) << med_fst, (ME_SET_BB ^ ME_SET_CBB) << med_fst, - (ME_SET_CLUB ^ ME_SET_CLUB) << med_fst, (ME_SET_CGLB ^ ME_SET_CGLB) << med_fst, - (ME_SET_CBB ^ ME_SET_CBB) << med_fst}; + static const Gecode::ModEventDelta me_c[ME_SET_CBB + 1] = {(ME_SET_NONE ^ ME_SET_CARD) << med_fst, + 0, + 0, + (ME_SET_LUB ^ ME_SET_CLUB) << med_fst, + (ME_SET_GLB ^ ME_SET_CGLB) << med_fst, + (ME_SET_BB ^ ME_SET_CBB) << med_fst, + 0, + 0, + 0}; Gecode::ModEvent me_o = (med & med_mask) >> med_fst; Gecode::ModEventDelta med_n = me_c[me_o]; if (med_n == 0) @@ -695,12 +698,15 @@ namespace Gecode { namespace Set { break; } case ME_SET_LUB: { - static const Gecode::ModEventDelta me_c[ME_SET_CBB + 1] = { - (ME_SET_NONE ^ ME_SET_LUB) << med_fst, (ME_SET_VAL ^ ME_SET_VAL) << med_fst, - (ME_SET_CARD ^ ME_SET_CLUB) << med_fst, (ME_SET_LUB ^ ME_SET_LUB) << med_fst, - (ME_SET_GLB ^ ME_SET_BB) << med_fst, (ME_SET_BB ^ ME_SET_BB) << med_fst, - (ME_SET_CLUB ^ ME_SET_CLUB) << med_fst, (ME_SET_CGLB ^ ME_SET_CBB) << med_fst, - (ME_SET_CBB ^ ME_SET_CBB) << med_fst}; + static const Gecode::ModEventDelta me_c[ME_SET_CBB + 1] = {(ME_SET_NONE ^ ME_SET_LUB) << med_fst, + 0, + (ME_SET_CARD ^ ME_SET_CLUB) << med_fst, + 0, + (ME_SET_GLB ^ ME_SET_BB) << med_fst, + 0, + 0, + (ME_SET_CGLB ^ ME_SET_CBB) << med_fst, + 0}; Gecode::ModEvent me_o = (med & med_mask) >> med_fst; Gecode::ModEventDelta med_n = me_c[me_o]; if (med_n == 0) @@ -710,11 +716,9 @@ namespace Gecode { namespace Set { } case ME_SET_GLB: { static const Gecode::ModEventDelta me_c[ME_SET_CBB + 1] = { - (ME_SET_NONE ^ ME_SET_GLB) << med_fst, (ME_SET_VAL ^ ME_SET_VAL) << med_fst, - (ME_SET_CARD ^ ME_SET_CGLB) << med_fst, (ME_SET_LUB ^ ME_SET_BB) << med_fst, - (ME_SET_GLB ^ ME_SET_GLB) << med_fst, (ME_SET_BB ^ ME_SET_BB) << med_fst, - (ME_SET_CLUB ^ ME_SET_CBB) << med_fst, (ME_SET_CGLB ^ ME_SET_CGLB) << med_fst, - (ME_SET_CBB ^ ME_SET_CBB) << med_fst}; + (ME_SET_NONE ^ ME_SET_GLB) << med_fst, 0, (ME_SET_CARD ^ ME_SET_CGLB) << med_fst, + (ME_SET_LUB ^ ME_SET_BB) << med_fst, 0, 0, + (ME_SET_CLUB ^ ME_SET_CBB) << med_fst, 0, 0}; Gecode::ModEvent me_o = (med & med_mask) >> med_fst; Gecode::ModEventDelta med_n = me_c[me_o]; if (med_n == 0) @@ -723,12 +727,15 @@ namespace Gecode { namespace Set { break; } case ME_SET_BB: { - static const Gecode::ModEventDelta me_c[ME_SET_CBB + 1] = { - (ME_SET_NONE ^ ME_SET_BB) << med_fst, (ME_SET_VAL ^ ME_SET_VAL) << med_fst, - (ME_SET_CARD ^ ME_SET_CBB) << med_fst, (ME_SET_LUB ^ ME_SET_BB) << med_fst, - (ME_SET_GLB ^ ME_SET_BB) << med_fst, (ME_SET_BB ^ ME_SET_BB) << med_fst, - (ME_SET_CLUB ^ ME_SET_CBB) << med_fst, (ME_SET_CGLB ^ ME_SET_CBB) << med_fst, - (ME_SET_CBB ^ ME_SET_CBB) << med_fst}; + static const Gecode::ModEventDelta me_c[ME_SET_CBB + 1] = {(ME_SET_NONE ^ ME_SET_BB) << med_fst, + 0, + (ME_SET_CARD ^ ME_SET_CBB) << med_fst, + (ME_SET_LUB ^ ME_SET_BB) << med_fst, + (ME_SET_GLB ^ ME_SET_BB) << med_fst, + 0, + (ME_SET_CLUB ^ ME_SET_CBB) << med_fst, + (ME_SET_CGLB ^ ME_SET_CBB) << med_fst, + 0}; Gecode::ModEvent me_o = (med & med_mask) >> med_fst; Gecode::ModEventDelta med_n = me_c[me_o]; if (med_n == 0) @@ -737,12 +744,15 @@ namespace Gecode { namespace Set { break; } case ME_SET_CLUB: { - static const Gecode::ModEventDelta me_c[ME_SET_CBB + 1] = { - (ME_SET_NONE ^ ME_SET_CLUB) << med_fst, (ME_SET_VAL ^ ME_SET_VAL) << med_fst, - (ME_SET_CARD ^ ME_SET_CLUB) << med_fst, (ME_SET_LUB ^ ME_SET_CLUB) << med_fst, - (ME_SET_GLB ^ ME_SET_CBB) << med_fst, (ME_SET_BB ^ ME_SET_CBB) << med_fst, - (ME_SET_CLUB ^ ME_SET_CLUB) << med_fst, (ME_SET_CGLB ^ ME_SET_CBB) << med_fst, - (ME_SET_CBB ^ ME_SET_CBB) << med_fst}; + static const Gecode::ModEventDelta me_c[ME_SET_CBB + 1] = {(ME_SET_NONE ^ ME_SET_CLUB) << med_fst, + 0, + (ME_SET_CARD ^ ME_SET_CLUB) << med_fst, + (ME_SET_LUB ^ ME_SET_CLUB) << med_fst, + (ME_SET_GLB ^ ME_SET_CBB) << med_fst, + (ME_SET_BB ^ ME_SET_CBB) << med_fst, + 0, + (ME_SET_CGLB ^ ME_SET_CBB) << med_fst, + 0}; Gecode::ModEvent me_o = (med & med_mask) >> med_fst; Gecode::ModEventDelta med_n = me_c[me_o]; if (med_n == 0) @@ -751,12 +761,15 @@ namespace Gecode { namespace Set { break; } case ME_SET_CGLB: { - static const Gecode::ModEventDelta me_c[ME_SET_CBB + 1] = { - (ME_SET_NONE ^ ME_SET_CGLB) << med_fst, (ME_SET_VAL ^ ME_SET_VAL) << med_fst, - (ME_SET_CARD ^ ME_SET_CGLB) << med_fst, (ME_SET_LUB ^ ME_SET_CBB) << med_fst, - (ME_SET_GLB ^ ME_SET_CGLB) << med_fst, (ME_SET_BB ^ ME_SET_CBB) << med_fst, - (ME_SET_CLUB ^ ME_SET_CBB) << med_fst, (ME_SET_CGLB ^ ME_SET_CGLB) << med_fst, - (ME_SET_CBB ^ ME_SET_CBB) << med_fst}; + static const Gecode::ModEventDelta me_c[ME_SET_CBB + 1] = {(ME_SET_NONE ^ ME_SET_CGLB) << med_fst, + 0, + (ME_SET_CARD ^ ME_SET_CGLB) << med_fst, + (ME_SET_LUB ^ ME_SET_CBB) << med_fst, + (ME_SET_GLB ^ ME_SET_CGLB) << med_fst, + (ME_SET_BB ^ ME_SET_CBB) << med_fst, + (ME_SET_CLUB ^ ME_SET_CBB) << med_fst, + 0, + 0}; Gecode::ModEvent me_o = (med & med_mask) >> med_fst; Gecode::ModEventDelta med_n = me_c[me_o]; if (med_n == 0) @@ -765,12 +778,15 @@ namespace Gecode { namespace Set { break; } case ME_SET_CBB: { - static const Gecode::ModEventDelta me_c[ME_SET_CBB + 1] = { - (ME_SET_NONE ^ ME_SET_CBB) << med_fst, (ME_SET_VAL ^ ME_SET_VAL) << med_fst, - (ME_SET_CARD ^ ME_SET_CBB) << med_fst, (ME_SET_LUB ^ ME_SET_CBB) << med_fst, - (ME_SET_GLB ^ ME_SET_CBB) << med_fst, (ME_SET_BB ^ ME_SET_CBB) << med_fst, - (ME_SET_CLUB ^ ME_SET_CBB) << med_fst, (ME_SET_CGLB ^ ME_SET_CBB) << med_fst, - (ME_SET_CBB ^ ME_SET_CBB) << med_fst}; + static const Gecode::ModEventDelta me_c[ME_SET_CBB + 1] = {(ME_SET_NONE ^ ME_SET_CBB) << med_fst, + 0, + (ME_SET_CARD ^ ME_SET_CBB) << med_fst, + (ME_SET_LUB ^ ME_SET_CBB) << med_fst, + (ME_SET_GLB ^ ME_SET_CBB) << med_fst, + (ME_SET_BB ^ ME_SET_CBB) << med_fst, + (ME_SET_CLUB ^ ME_SET_CBB) << med_fst, + (ME_SET_CGLB ^ ME_SET_CBB) << med_fst, + 0}; Gecode::ModEvent me_o = (med & med_mask) >> med_fst; Gecode::ModEventDelta med_n = me_c[me_o]; if (med_n == 0) @@ -784,10 +800,10 @@ namespace Gecode { namespace Set { return true; } -}} // namespace Gecode::Set +} // namespace Gecode::Set #endif #ifdef GECODE_HAS_FLOAT_VARS -namespace Gecode { namespace Float { +namespace Gecode::Float { forceinline Gecode::ModEvent FloatVarImpConf::me_combine(Gecode::ModEvent me1, Gecode::ModEvent me2) { static const Gecode::ModEvent me_c = (((ME_FLOAT_NONE << 0) | // [ME_FLOAT_NONE][ME_FLOAT_NONE] @@ -830,7 +846,7 @@ namespace Gecode { namespace Float { return true; } -}} // namespace Gecode::Float +} // namespace Gecode::Float #endif namespace Gecode { forceinline ModEventDelta diff --git a/gecode/kernel/var.hpp b/gecode/kernel/var.hpp index 55c9865d94..fe9d791534 100644 --- a/gecode/kernel/var.hpp +++ b/gecode/kernel/var.hpp @@ -48,27 +48,27 @@ namespace Gecode { /// Pointer to variable implementation VarImp* x; /// Default constructor - VarImpVar(void); + VarImpVar(); /// Initialize with variable implementation \a y VarImpVar(VarImp* y); public: /// The variable implementation type corresponding to the variable - typedef VarImp VarImpType; + using VarImpType = VarImp; /// \name Generic variable information //@{ /// Return variable implementation of variable - VarImp* varimp(void) const; + VarImp* varimp() const; /// Return degree (number of subscribed propagators and advisors) - unsigned int degree(void) const; + unsigned int degree() const; /// Return accumulated failure count - double afc(void) const; + double afc() const; //@} /// \name Domain tests //@{ /// Test whether view is assigned - bool assigned(void) const; + bool assigned() const; //@} /// \name Cloning @@ -84,7 +84,7 @@ namespace Gecode { */ template forceinline - VarImpVar::VarImpVar(void) + VarImpVar::VarImpVar() : x(nullptr) {} template forceinline @@ -92,22 +92,22 @@ namespace Gecode { : x(y) {} template forceinline VarImp* - VarImpVar::varimp(void) const { + VarImpVar::varimp() const { return x; } template forceinline unsigned int - VarImpVar::degree(void) const { + VarImpVar::degree() const { return x->degree(); } template forceinline double - VarImpVar::afc(void) const { + VarImpVar::afc() const { return x->afc(); } template forceinline bool - VarImpVar::assigned(void) const { + VarImpVar::assigned() const { return x->assigned(); } template diff --git a/gecode/kernel/view.hpp b/gecode/kernel/view.hpp index e6c52aaf09..78278c9a16 100644 --- a/gecode/kernel/view.hpp +++ b/gecode/kernel/view.hpp @@ -44,29 +44,29 @@ namespace Gecode { class ConstView { public: /// The variable implementation type corresponding to the constant view - typedef typename View::VarImpType VarImpType; + using VarImpType = View::VarImpType; /// The variable type corresponding to the constant view - typedef typename View::VarType VarType; + using VarType = View::VarType; /// \name Generic view information //@{ /// Return degree (number of subscribed propagators and advisors) - unsigned int degree(void) const; + unsigned int degree() const; /// Return accumulated failure count - double afc(void) const; + double afc() const; /// Return whether this view is derived from a VarImpView - static bool is_variable_derived(void); + static bool is_variable_derived(); /// Return dummy variable implementation of view - VarImpType* varimp(void) const; + VarImpType* varimp() const; #ifdef GECODE_HAS_CBS /// Return dummy id - unsigned int id(void) const; + unsigned int id() const; #endif //@} /// \name Domain tests //@{ /// Test whether view is assigned - bool assigned(void) const; + bool assigned() const; //@} /// \name View-dependent propagator support @@ -130,15 +130,15 @@ namespace Gecode { class VarImpView { public: /// The variable type corresponding to the view - typedef Var VarType; + using VarType = Var; /// The variable implementation type corresponding to the view - typedef typename Var::VarImpType VarImpType; + using VarImpType = Var::VarImpType; protected: /// Pointer to variable implementation VarImpType* x; /// Default constructor - VarImpView(void); + VarImpView(); /// Initialize with variable implementation \a y VarImpView(VarImpType* y); /// Set variable implementation to \a y @@ -148,23 +148,23 @@ namespace Gecode { /// \name Generic view information //@{ /// Return whether this view is derived from a VarImpView - static bool is_variable_derived(void); + static bool is_variable_derived(); /// Return variable implementation of view - VarImpType* varimp(void) const; + VarImpType* varimp() const; /// Return degree (number of subscribed propagators and advisors) - unsigned int degree(void) const; + unsigned int degree() const; /// Return accumulated failure count - double afc(void) const; + double afc() const; #ifdef GECODE_HAS_CBS /// Return id of implementation of view - unsigned int id(void) const; + unsigned int id() const; #endif //@} /// \name Domain tests //@{ /// Test whether view is assigned - bool assigned(void) const; + bool assigned() const; //@} /// \name View-dependent propagator support @@ -228,15 +228,15 @@ namespace Gecode { class DerivedView { public: /// The variable implementation type belonging to the \a View - typedef typename View::VarImpType VarImpType; + using VarImpType = View::VarImpType; /// The variable type belonging to the \a View - typedef typename View::VarType VarType; + using VarType = View::VarType; protected: /// View from which this view is derived View x; /// Default constructor - DerivedView(void) = default; + DerivedView() = default; public: /// Initialize with view \a y @@ -244,25 +244,25 @@ namespace Gecode { /// \name Generic view information //@{ /// Return whether this view is derived from a VarImpView - static bool is_variable_derived(void); + static bool is_variable_derived(); /// Return variable implementation of view - VarImpType* varimp(void) const; + VarImpType* varimp() const; /// Return view from which this view is derived - View base(void) const; + View base() const; /// Return degree (number of subscribed propagators) - unsigned int degree(void) const; + unsigned int degree() const; /// Return accumulated failure count - double afc(void) const; + double afc() const; #ifdef GECODE_HAS_CBS /// Return id of implementation of view - unsigned int id(void) const; + unsigned int id() const; #endif //@} /// \name Domain tests //@{ /// Test whether view is assigned - bool assigned(void) const; + bool assigned() const; //@} /// \name View-dependent propagator support @@ -379,34 +379,34 @@ namespace Gecode { */ template forceinline unsigned int - ConstView::degree(void) const { + ConstView::degree() const { return 0; } template forceinline double - ConstView::afc(void) const { + ConstView::afc() const { return 0.0; } template forceinline bool - ConstView::is_variable_derived(void) { + ConstView::is_variable_derived() { return false; } template - forceinline typename View::VarImpType* - ConstView::varimp(void) const { + forceinline View::VarImpType* + ConstView::varimp() const { return nullptr; } #ifdef GECODE_HAS_CBS template forceinline unsigned int - ConstView::id(void) const { + ConstView::id() const { return 0; } #endif template forceinline bool - ConstView::assigned(void) const { + ConstView::assigned() const { return true; } template @@ -465,7 +465,7 @@ namespace Gecode { */ template forceinline - VarImpView::VarImpView(void) + VarImpView::VarImpView() : x(nullptr) {} template forceinline @@ -478,34 +478,34 @@ namespace Gecode { } template forceinline bool - VarImpView::is_variable_derived(void) { + VarImpView::is_variable_derived() { return true; } template - forceinline typename Var::VarImpType* - VarImpView::varimp(void) const { + forceinline Var::VarImpType* + VarImpView::varimp() const { return x; } template forceinline unsigned int - VarImpView::degree(void) const { + VarImpView::degree() const { return x->degree(); } template forceinline double - VarImpView::afc(void) const { + VarImpView::afc() const { return x->afc(); } #ifdef GECODE_HAS_CBS template forceinline unsigned int - VarImpView::id(void) const { + VarImpView::id() const { return x->id(); } #endif template forceinline bool - VarImpView::assigned(void) const { + VarImpView::assigned() const { return x->assigned(); } template @@ -576,42 +576,42 @@ namespace Gecode { template forceinline bool - DerivedView::is_variable_derived(void) { + DerivedView::is_variable_derived() { return View::is_variable_derived(); } template - forceinline typename View::VarImpType* - DerivedView::varimp(void) const { + forceinline View::VarImpType* + DerivedView::varimp() const { return x.varimp(); } template forceinline View - DerivedView::base(void) const { + DerivedView::base() const { return x; } template forceinline unsigned int - DerivedView::degree(void) const { + DerivedView::degree() const { return x.degree(); } template forceinline double - DerivedView::afc(void) const { + DerivedView::afc() const { return x.afc(); } #ifdef GECODE_HAS_CBS template forceinline unsigned int - DerivedView::id(void) const { + DerivedView::id() const { return x.id(); } #endif template forceinline bool - DerivedView::assigned(void) const { + DerivedView::assigned() const { return x.assigned(); } diff --git a/gecode/minimodel.hh b/gecode/minimodel.hh index 91dc495abe..46765fd1f3 100644 --- a/gecode/minimodel.hh +++ b/gecode/minimodel.hh @@ -60,7 +60,7 @@ #include #include -#include +#include #include /* @@ -89,13 +89,7 @@ #endif #endif -namespace Gecode { - - /// Minimalistic modeling support - namespace MiniModel { - } - -} // namespace Gecode +/// Minimalistic modeling support #include @@ -129,74 +123,74 @@ namespace Gecode { IntPropLevels(IntPropLevel ipl = IPL_DEF); /// Return integer propagation level for binary linear constraints - IntPropLevel linear2(void) const; + IntPropLevel linear2() const; /// Set integer propagation level for binary linear constraints IntPropLevels& linear2(IntPropLevel ipl); /// Return integer propagation level for non-binary linear constraints - IntPropLevel linear(void) const; + IntPropLevel linear() const; /// Set integer propagation level for non-binary linear constraints IntPropLevels& linear(IntPropLevel ipl); /// Return integer propagation level for absolute value constraints - IntPropLevel abs(void) const; + IntPropLevel abs() const; /// Set integer propagation level for absolute value constraints IntPropLevels& abs(IntPropLevel ipl); /// Return integer propagation level for binary maximum constraints - IntPropLevel max2(void) const; + IntPropLevel max2() const; /// Set integer propagation level for binary maximum constraints IntPropLevels& max2(IntPropLevel ipl); /// Return integer propagation level for non-binary maximum constraints - IntPropLevel max(void) const; + IntPropLevel max() const; /// Set integer propagation level for non-binary maximum constraints IntPropLevels& max(IntPropLevel ipl); /// Return integer propagation level for binary minimum constraints - IntPropLevel min2(void) const; + IntPropLevel min2() const; /// Set integer propagation level for binary minimum constraints IntPropLevels& min2(IntPropLevel ipl); /// Return integer propagation level for non-binary minimum constraints - IntPropLevel min(void) const; + IntPropLevel min() const; /// Set integer propagation level for non-binary minimum constraints IntPropLevels& min(IntPropLevel ipl); /// Return integer propagation level for multiplication constraints - IntPropLevel mult(void) const; + IntPropLevel mult() const; /// Set integer propagation level for multiplication constraints IntPropLevels& mult(IntPropLevel ipl); /// Return integer propagation level for division constraints - IntPropLevel div(void) const; + IntPropLevel div() const; /// Set integer propagation level for division constraints IntPropLevels& div(IntPropLevel ipl); /// Return integer propagation level for modulo constraints - IntPropLevel mod(void) const; + IntPropLevel mod() const; /// Set integer propagation level for modulo constraints IntPropLevels& mod(IntPropLevel ipl); /// Return integer propagation level for square constraints - IntPropLevel sqr(void) const; + IntPropLevel sqr() const; /// Set integer propagation level for square constraints IntPropLevels& sqr(IntPropLevel ipl); /// Return integer propagation level for square root constraints - IntPropLevel sqrt(void) const; + IntPropLevel sqrt() const; /// Set integer propagation level for square root constraints IntPropLevels& sqrt(IntPropLevel ipl); /// Return integer propagation level for power constraints - IntPropLevel pow(void) const; + IntPropLevel pow() const; /// Set integer propagation level for power constraints IntPropLevels& pow(IntPropLevel ipl); /// Return integer propagation level for root constraints - IntPropLevel nroot(void) const; + IntPropLevel nroot() const; /// Set integer propagation level for root constraints IntPropLevels& nroot(IntPropLevel ipl); /// Return integer propagation level for element constraints - IntPropLevel element(void) const; + IntPropLevel element() const; /// Set integer propagation level for element constraints IntPropLevels& element(IntPropLevel ipl); /// Return integer propagation level for if-then-else constraints - IntPropLevel ite(void) const; + IntPropLevel ite() const; /// Set integer propagation level for if-then-else constraints IntPropLevels& ite(IntPropLevel ipl); @@ -229,7 +223,7 @@ namespace Gecode { /// Post reified expression to be in relation \a irt with \a c virtual void post(Home home, IntRelType irt, int c, BoolVar b, const IntPropLevels& ipls) const = 0; /// Destructor - virtual ~NonLinIntExpr(void); + virtual ~NonLinIntExpr(); /// Return fresh variable if \a x is null, \a x otherwise static IntVar result(Home home, IntVar* x); /// Constrain \a x to be equal to \a y if \a x is not null @@ -288,12 +282,12 @@ namespace Gecode { public: /// Default constructor GECODE_MINIMODEL_EXPORT - LinIntExpr(void); + LinIntExpr(); #ifdef GECODE_HAS_FAULT_INJECTION /// Reset live node accounting for fault-injection tests - GECODE_MINIMODEL_EXPORT static void fault_reset_allocations(void); + GECODE_MINIMODEL_EXPORT static void fault_reset_allocations(); /// Return live node accounting for fault-injection tests - GECODE_MINIMODEL_EXPORT static int fault_live_allocations(void); + GECODE_MINIMODEL_EXPORT static int fault_live_allocations(); #endif /// Create expression for constant \a c GECODE_MINIMODEL_EXPORT @@ -333,7 +327,7 @@ namespace Gecode { explicit LinIntExpr(NonLinIntExpr* e); /// Assignment operator GECODE_MINIMODEL_EXPORT - const LinIntExpr& operator=(const LinIntExpr& e); + LinIntExpr& operator=(const LinIntExpr& e); /// Post propagator GECODE_MINIMODEL_EXPORT void post(Home home, IntRelType irt, const IntPropLevels& ipls) const; @@ -345,10 +339,10 @@ namespace Gecode { IntVar post(Home home, const IntPropLevels& ipls) const; /// Return non-linear expression inside, or null if not non-linear GECODE_MINIMODEL_EXPORT - NonLinIntExpr* nle(void) const; + NonLinIntExpr* nle() const; /// Destructor GECODE_MINIMODEL_EXPORT - ~LinIntExpr(void); + ~LinIntExpr(); }; class BoolExpr; @@ -365,7 +359,7 @@ namespace Gecode { /// Negate relation type static IntRelType neg(IntRelType irt); /// Default constructor - LinIntRel(void) = default; + LinIntRel() = default; public: /// Create linear relation for expressions \a l and \a r @@ -690,7 +684,7 @@ namespace Gecode { /// Post reified expression to be in relation \a frt with \a c virtual void post(Home home, FloatRelType frt, FloatVal c, BoolVar b) const = 0; /// Destructor - virtual ~NonLinFloatExpr(void); + virtual ~NonLinFloatExpr(); /// Return fresh variable if \a x is null, \a x otherwise static FloatVar result(Home home, FloatVar* x); /// Constrain \a x to be equal to \a y if \a x is not null @@ -731,7 +725,7 @@ namespace Gecode { public: /// Default constructor GECODE_MINIMODEL_EXPORT - LinFloatExpr(void); + LinFloatExpr(); /// Create expression for constant \a c GECODE_MINIMODEL_EXPORT LinFloatExpr(const FloatVal& c); @@ -764,7 +758,7 @@ namespace Gecode { explicit LinFloatExpr(NonLinFloatExpr* e); /// Assignment operator GECODE_MINIMODEL_EXPORT - const LinFloatExpr& operator=(const LinFloatExpr& e); + LinFloatExpr& operator=(const LinFloatExpr& e); /// Post propagator GECODE_MINIMODEL_EXPORT void post(Home home, FloatRelType frt) const; @@ -776,10 +770,10 @@ namespace Gecode { FloatVar post(Home home) const; /// Return non-linear expression inside, or null if not non-linear GECODE_MINIMODEL_EXPORT - NonLinFloatExpr* nlfe(void) const; + NonLinFloatExpr* nlfe() const; /// Destructor GECODE_MINIMODEL_EXPORT - ~LinFloatExpr(void); + ~LinFloatExpr(); }; class BoolExpr; @@ -796,7 +790,7 @@ namespace Gecode { /// Negate relation type static FloatRelType neg(FloatRelType frt); /// Default constructor - LinFloatRel(void) = default; + LinFloatRel() = default; public: /// Create linear float relation for expressions \a l and \a r @@ -1005,7 +999,7 @@ namespace Gecode { public: /// Default constructor - SetExpr(void); + SetExpr(); /// Copy constructor GECODE_MINIMODEL_EXPORT SetExpr(const SetExpr& e); @@ -1035,10 +1029,10 @@ namespace Gecode { void post(Home home, BoolVar b, bool t, SetRelType srt, const SetExpr& e) const; /// Assignment operator GECODE_MINIMODEL_EXPORT - const SetExpr& operator=(const SetExpr& e); + SetExpr& operator=(const SetExpr& e); /// Destructor GECODE_MINIMODEL_EXPORT - ~SetExpr(void); + ~SetExpr(); }; /// Comparison relation (for two-sided comparisons) @@ -1066,7 +1060,7 @@ namespace Gecode { public: /// Default constructor - SetRel(void) = default; + SetRel() = default; /// Constructor SetRel(const SetExpr& e0, SetRelType srt, const SetExpr& e1); /// Constructor @@ -1152,14 +1146,14 @@ namespace Gecode { class GECODE_VTABLE_EXPORT Misc : public HeapAllocated { public: /// Default constructor - Misc(void) = default; + Misc() = default; /** Constrain \a b to be equivalent to the expression * (negated if \a neg) with propagation level * \a ipl. */ virtual void post(Home home, BoolVar b, bool neg, const IntPropLevels& ipls) = 0; /// Destructor - virtual GECODE_MINIMODEL_EXPORT ~Misc(void); + virtual GECODE_MINIMODEL_EXPORT ~Misc(); }; /// %Node for Boolean expression class Node; @@ -1183,7 +1177,7 @@ namespace Gecode { * invalid; materialization throws MiniModel::TooFewArguments. */ GECODE_MINIMODEL_EXPORT - BoolExpr(void); + BoolExpr(); /// Copy constructor GECODE_MINIMODEL_EXPORT BoolExpr(const BoolExpr& e); @@ -1195,7 +1189,7 @@ namespace Gecode { * Only bool arguments are accepted, so integer expressions do not * become ambiguous through an implicit conversion to bool. */ - template ::value, int> = 0> + template Bool> BoolExpr(Bool value); /// Construct expression for variable GECODE_MINIMODEL_EXPORT @@ -1230,10 +1224,10 @@ namespace Gecode { void rel(Home home, const IntPropLevels& ipls) const; /// Assignment operator GECODE_MINIMODEL_EXPORT - const BoolExpr& operator=(const BoolExpr& e); + BoolExpr& operator=(const BoolExpr& e); /// Destructor GECODE_MINIMODEL_EXPORT - ~BoolExpr(void); + ~BoolExpr(); }; /** @@ -1392,7 +1386,7 @@ namespace Gecode { /// Post Boolean expression and return its value GECODE_MINIMODEL_EXPORT BoolVar expr(Home home, const BoolExpr& e, const IntPropLevels& ipls = IntPropLevels::def); /// Preserve integer-expression posting for C++ Boolean values - template ::value, int> = 0> + template Bool> IntVar expr(Home home, Bool value, const IntPropLevels& ipls = IntPropLevels::def); /// Post Boolean relation GECODE_MINIMODEL_EXPORT void rel(Home home, const BoolExpr& e, const IntPropLevels& ipls = IntPropLevels::def); @@ -1426,13 +1420,13 @@ namespace Gecode { /// The expression tree Exp* e; /// Initialize with given expression tree \a - REG(Exp* e); + REG(Exp* f); /// Return string representatinon of expression tree - std::string to_string(void) const; + std::string to_string() const; public: /// Initialize as empty sequence (epsilon) - REG(void); + REG(); /// Initialize as single integer \a s REG(int s); /** @@ -1446,7 +1440,7 @@ namespace Gecode { /// Initialize from regular expression \a r REG(const REG& r); /// Assign to regular expression \a r - const REG& operator=(const REG& r); + REG& operator=(const REG& r); /// Return expression for: this expression followed by \a r REG operator+(const REG& r); @@ -1457,9 +1451,9 @@ namespace Gecode { /// This expression or \a r REG& operator|=(const REG& r); /// Return expression for: this expression arbitrarily often (Kleene star) - REG operator*(void); + REG operator*(); /// Return expression for: this expression at least once - REG operator+(void); + REG operator+(); /// Return expression for: this expression at least \a n and at most \a m times REG operator()(unsigned int n, unsigned int m); /// Return expression for: this expression at least \a n times @@ -1468,9 +1462,9 @@ namespace Gecode { template std::basic_ostream& print(std::basic_ostream& os) const; /// Return DFA for regular expression - operator DFA(void); + operator DFA(); /// Destructor - ~REG(void); + ~REG(); }; /** \relates Gecode::REG @@ -1806,7 +1800,7 @@ namespace Gecode { class Slice { public: /// The type of the Args-array type for ValueType values - typedef typename ArrayTraits::ArgsType ArgsType; + using ArgsType = ArrayTraits::ArgsType; private: ArgsType _r; ///< The elements of the slice @@ -1820,37 +1814,32 @@ namespace Gecode { /** \brief Reverses the contents of the slice, and returns a * reference to it. */ - Slice& reverse(void); - /// Cast to array type - operator ArgsType(void); - /// Cast to matrix type - operator Matrix(void); - + Slice& reverse(); /// Cast to array type - operator const ArgsType(void) const; + operator ArgsType() const; /// Cast to matrix type - operator const Matrix(void) const; + operator Matrix() const; }; /// Concatenate \a x and \a y template - typename Slice::ArgsType operator+(const Slice& x, const Slice& y); + Slice::ArgsType operator+(const Slice& x, const Slice& y); /// Concatenate \a x and \a y template - typename Slice::ArgsType operator+(const Slice& x, const typename ArrayTraits::ArgsType& y); + Slice::ArgsType operator+(const Slice& x, const typename ArrayTraits::ArgsType& y); /// Concatenate \a x and \a y template - typename Slice::ArgsType operator+(const typename ArrayTraits::ArgsType& x, const Slice& y); + Slice::ArgsType operator+(const typename ArrayTraits::ArgsType& x, const Slice& y); /// Concatenate \a x and \a y template - typename Slice::ArgsType operator+(const Slice& x, const typename ArrayTraits::ValueType& y); + Slice::ArgsType operator+(const Slice& x, const typename ArrayTraits::ValueType& y); /// Concatenate \a x and \a y template - typename Slice::ArgsType operator+(const typename ArrayTraits::ValueType& x, const Slice& y); + Slice::ArgsType operator+(const typename ArrayTraits::ValueType& x, const Slice& y); /** \brief Matrix-interface for arrays * @@ -1866,13 +1855,13 @@ namespace Gecode { class Matrix { public: /// The type of elements of this array - typedef typename ArrayTraits::ValueType ValueType; + using ValueType = ArrayTraits::ValueType; /// The type of the Args-array type for ValueType values - typedef typename ArrayTraits::ArgsType ArgsType; + using ArgsType = ArrayTraits::ArgsType; private: /// The type of storage for this array - typedef typename ArrayTraits::StorageType StorageType; + using StorageType = ArrayTraits::StorageType; StorageType _a; ///< The array wrapped int _w; ///< The width of the matrix int _h; ///< The height of the matrix @@ -1907,11 +1896,11 @@ namespace Gecode { Matrix(const A& a, int n); /// Return the width of the matrix - int width(void) const; + int width() const; /// Return the height of the matrix - int height(void) const; + int height() const; /// Return an Args-array of the contents of the matrix - ArgsType const get_array(void) const; + ArgsType get_array() const; /** \brief Access element (\a c, \a r) of the matrix * @@ -2075,7 +2064,7 @@ namespace Gecode { class GECODE_VTABLE_EXPORT IntMinimizeSpace : public Space { public: /// Default constructor - IntMinimizeSpace(void) = default; + IntMinimizeSpace() = default; /// Constructor for cloning IntMinimizeSpace(IntMinimizeSpace& s); /// Member function constraining according to decreasing cost @@ -2085,7 +2074,7 @@ namespace Gecode { GECODE_MINIMODEL_EXPORT SpaceComparison compare(const Space& other) const override; /// Return variable with current cost - virtual IntVar cost(void) const = 0; + virtual IntVar cost() const = 0; }; /** @@ -2095,7 +2084,7 @@ namespace Gecode { class GECODE_VTABLE_EXPORT IntMaximizeSpace : public Space { public: /// Default constructor - IntMaximizeSpace(void) = default; + IntMaximizeSpace() = default; /// Constructor for cloning IntMaximizeSpace(IntMaximizeSpace& s); /// Member function constraining according to increasing cost @@ -2105,7 +2094,7 @@ namespace Gecode { GECODE_MINIMODEL_EXPORT SpaceComparison compare(const Space& other) const override; /// Return variable with current cost - virtual IntVar cost(void) const = 0; + virtual IntVar cost() const = 0; }; /** @@ -2115,7 +2104,7 @@ namespace Gecode { class GECODE_VTABLE_EXPORT IntLexMinimizeSpace : public Space { public: /// Default constructor - IntLexMinimizeSpace(void) = default; + IntLexMinimizeSpace() = default; /// Constructor for cloning IntLexMinimizeSpace(IntLexMinimizeSpace& s); /// Member function constraining according to decreasing costs @@ -2125,7 +2114,7 @@ namespace Gecode { GECODE_MINIMODEL_EXPORT SpaceComparison compare(const Space& other) const override; /// Return variables with current costs - virtual IntVarArgs cost(void) const = 0; + virtual IntVarArgs cost() const = 0; }; /** @@ -2135,7 +2124,7 @@ namespace Gecode { class GECODE_VTABLE_EXPORT IntLexMaximizeSpace : public Space { public: /// Default constructor - IntLexMaximizeSpace(void) = default; + IntLexMaximizeSpace() = default; /// Constructor for cloning IntLexMaximizeSpace(IntLexMaximizeSpace& s); /// Member function constraining according to increasing costs @@ -2145,7 +2134,7 @@ namespace Gecode { GECODE_MINIMODEL_EXPORT SpaceComparison compare(const Space& other) const override; /// Return variables with current costs - virtual IntVarArgs cost(void) const = 0; + virtual IntVarArgs cost() const = 0; }; #ifdef GECODE_HAS_FLOAT_VARS @@ -2180,7 +2169,7 @@ namespace Gecode { GECODE_MINIMODEL_EXPORT SpaceComparison compare(const Space& other) const override; /// Return variable with current cost - virtual FloatVar cost(void) const = 0; + virtual FloatVar cost() const = 0; }; /** @@ -2213,7 +2202,7 @@ namespace Gecode { GECODE_MINIMODEL_EXPORT SpaceComparison compare(const Space& other) const override; /// Return variable with current cost - virtual FloatVar cost(void) const = 0; + virtual FloatVar cost() const = 0; }; #endif diff --git a/gecode/minimodel/bool-expr.cpp b/gecode/minimodel/bool-expr.cpp index c31dfbbb01..ae0aa0dbdd 100644 --- a/gecode/minimodel/bool-expr.cpp +++ b/gecode/minimodel/bool-expr.cpp @@ -73,12 +73,12 @@ namespace Gecode { Misc* m; /// Default constructor - Node(void); + Node(); /// Destructor - ~Node(void); + ~Node(); /// Decrement reference count and possibly free memory GECODE_MINIMODEL_EXPORT - bool decrement(void); + bool decrement(); /// Memory management static void* operator new(size_t size); /// Memory management @@ -89,9 +89,9 @@ namespace Gecode { * Operations for nodes * */ - BoolExpr::Node::Node(void) : use(1), same(0), t(NT_AND), l(nullptr), r(nullptr), m(nullptr) {} + BoolExpr::Node::Node() : use(1), same(0), t(NT_AND), l(nullptr), r(nullptr), m(nullptr) {} - BoolExpr::Node::~Node(void) { + BoolExpr::Node::~Node() { delete m; } @@ -105,7 +105,7 @@ namespace Gecode { } bool - BoolExpr::Node::decrement(void) { + BoolExpr::Node::decrement() { if (--use == 0) { if ((l != nullptr) && l->decrement()) delete l; @@ -125,7 +125,7 @@ namespace Gecode { return n; } - BoolExpr::BoolExpr(void) : n(new Node) {} + BoolExpr::BoolExpr() : n(new Node) {} BoolExpr::BoolExpr(const BoolExpr& e) : n(e.n) { n->use++; @@ -229,7 +229,7 @@ namespace Gecode { n->m = m; } - const BoolExpr& + BoolExpr& BoolExpr::operator=(const BoolExpr& e) { if (this != &e) { if (n->decrement()) @@ -240,9 +240,9 @@ namespace Gecode { return *this; } - BoolExpr::Misc::~Misc(void) = default; + BoolExpr::Misc::~Misc() = default; - BoolExpr::~BoolExpr(void) { + BoolExpr::~BoolExpr() { if (n->decrement()) delete n; } @@ -251,8 +251,8 @@ namespace Gecode { /// %Node for negation normalform (%NNF) class NNF { public: - typedef BoolExpr::NodeType NodeType; - typedef BoolExpr::Node Node; + using NodeType = BoolExpr::NodeType; + using Node = BoolExpr::Node; /// Type of node NodeType t; /// Number of positive literals for node type @@ -584,7 +584,7 @@ namespace Gecode { void BoolExpr::rel(Home home, const IntPropLevels& ipls) const { Region r; - return NNF::nnf(r, n, false)->rel(home, ipls); + NNF::nnf(r, n, false)->rel(home, ipls); } BoolExpr @@ -660,7 +660,7 @@ namespace Gecode { /// Constructor BElementExpr(const BoolVarArgs& b, const LinIntExpr& idx); /// Destructor - ~BElementExpr(void) override; + ~BElementExpr() override; /// Constrain \a b to be equivalent to the expression (negated if \a neg) void post(Home home, BoolVar b, bool neg, const IntPropLevels& ipls) override; }; @@ -672,7 +672,7 @@ namespace Gecode { new (&a[i]) BoolExpr(b[i]); } - BElementExpr::~BElementExpr(void) { + BElementExpr::~BElementExpr() { if (a != nullptr) heap.free(a, n); } diff --git a/gecode/minimodel/bool-expr.hpp b/gecode/minimodel/bool-expr.hpp index 1a68e4e590..b6f0ea8322 100644 --- a/gecode/minimodel/bool-expr.hpp +++ b/gecode/minimodel/bool-expr.hpp @@ -37,12 +37,12 @@ namespace Gecode { * */ - template ::value, int>> + template Bool> forceinline BoolExpr::BoolExpr(Bool value) : n(constant(value)) {} - template ::value, int>> + template Bool> forceinline IntVar expr(Home home, Bool value, const IntPropLevels& ipls) { return expr(home, LinIntExpr(static_cast(value)), ipls); diff --git a/gecode/minimodel/dom.cpp b/gecode/minimodel/dom.cpp index 33771835c5..cb8f5a0fcb 100644 --- a/gecode/minimodel/dom.cpp +++ b/gecode/minimodel/dom.cpp @@ -56,7 +56,7 @@ namespace { namespace cxx14 { using index_sequence = detail::sequence; template - using index_sequence_for = typename detail::make_sequence::type; + using index_sequence_for = detail::make_sequence::type; }} // namespace ::cxx14 namespace Gecode { diff --git a/gecode/minimodel/exception.cpp b/gecode/minimodel/exception.cpp index 8e3faab7e7..8e52469f6f 100644 --- a/gecode/minimodel/exception.cpp +++ b/gecode/minimodel/exception.cpp @@ -34,7 +34,7 @@ #include -namespace Gecode { namespace MiniModel { +namespace Gecode::MiniModel { TooFewArguments::TooFewArguments(const char* l) : Exception(l, "Passed argument array has too few elements") {} @@ -42,6 +42,6 @@ namespace Gecode { namespace MiniModel { ArgumentOutOfRange::ArgumentOutOfRange(const char* l) : Exception(l, "Argument out of range") {} -}} // namespace Gecode::MiniModel +} // namespace Gecode::MiniModel // STATISTICS: minimodel-any diff --git a/gecode/minimodel/exception.hpp b/gecode/minimodel/exception.hpp index 83a0a35fe2..322e3928e0 100644 --- a/gecode/minimodel/exception.hpp +++ b/gecode/minimodel/exception.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace MiniModel { +namespace Gecode::MiniModel { /** * \defgroup FuncThrowMiniModel MiniModel exceptions @@ -62,6 +62,6 @@ namespace Gecode { namespace MiniModel { }; //@} -}} // namespace Gecode::MiniModel +} // namespace Gecode::MiniModel // STATISTICS: minimodel-any diff --git a/gecode/minimodel/float-arith.cpp b/gecode/minimodel/float-arith.cpp index f2d620c2da..2759abd98a 100644 --- a/gecode/minimodel/float-arith.cpp +++ b/gecode/minimodel/float-arith.cpp @@ -36,7 +36,7 @@ #ifdef GECODE_HAS_FLOAT_VARS -namespace Gecode { namespace MiniModel { +namespace Gecode::MiniModel { /// Non-linear float arithmetic expressions class GECODE_MINIMODEL_EXPORT ArithNonLinFloatExpr : public NonLinFloatExpr { @@ -78,7 +78,7 @@ namespace Gecode { namespace MiniModel { ArithNonLinFloatExpr(ArithNonLinFloatExprType t0, int n0) : t(t0), a(allocate(n0)), n(n0), a_int(-1) {} ArithNonLinFloatExpr(ArithNonLinFloatExprType t0, int n0, int a0) : t(t0), a(allocate(n0)), n(n0), a_int(a0) {} /// Destructor - ~ArithNonLinFloatExpr(void) override { + ~ArithNonLinFloatExpr() override { if (a != nullptr) heap.free(a, n); } @@ -89,9 +89,9 @@ namespace Gecode { namespace MiniModel { switch (t) { case ANLFE_ABS: { FloatVar x = a[0].post(home); - if (x.min() >= 0) + if (x.min() >= 0) { y = result(home, ret, x); - else { + } else { y = result(home, ret); abs(home, x, y); } @@ -102,11 +102,11 @@ namespace Gecode { namespace MiniModel { } else if (n == 2) { FloatVar x0 = a[0].post(home); FloatVar x1 = a[1].post(home); - if (x0.max() <= x1.min()) + if (x0.max() <= x1.min()) { y = result(home, ret, x0); - else if (x1.max() <= x0.min()) + } else if (x1.max() <= x0.min()) { y = result(home, ret, x1); - else { + } else { y = result(home, ret); min(home, x0, x1, y); } @@ -124,11 +124,11 @@ namespace Gecode { namespace MiniModel { } else if (n == 2) { FloatVar x0 = a[0].post(home); FloatVar x1 = a[1].post(home); - if (x0.max() <= x1.min()) + if (x0.max() <= x1.min()) { y = result(home, ret, x1); - else if (x1.max() <= x0.min()) + } else if (x1.max() <= x0.min()) { y = result(home, ret, x0); - else { + } else { y = result(home, ret); max(home, x0, x1, y); } @@ -144,15 +144,15 @@ namespace Gecode { namespace MiniModel { assert(n == 2); FloatVar x0 = a[0].post(home); FloatVar x1 = a[1].post(home); - if (x0.assigned() && (x0.val() == 0.0)) + if (x0.assigned() && (x0.val() == 0.0)) { y = result(home, ret, x0); - else if (x0.assigned() && (x0.val() == 1.0)) + } else if (x0.assigned() && (x0.val() == 1.0)) { y = result(home, ret, x1); - else if (x1.assigned() && (x1.val() == 0.0)) + } else if (x1.assigned() && (x1.val() == 0.0)) { y = result(home, ret, x1); - else if (x1.assigned() && (x1.val() == 1.0)) + } else if (x1.assigned() && (x1.val() == 1.0)) { y = result(home, ret, x0); - else { + } else { y = result(home, ret); mult(home, x0, x1, y); } @@ -161,11 +161,11 @@ namespace Gecode { namespace MiniModel { assert(n == 2); FloatVar x0 = a[0].post(home); FloatVar x1 = a[1].post(home); - if (x1.assigned() && (x1.val() == 1.0)) + if (x1.assigned() && (x1.val() == 1.0)) { y = result(home, ret, x0); - else if (x0.assigned() && (x0.val() == 0.0)) + } else if (x0.assigned() && (x0.val() == 0.0)) { y = result(home, ret, x0); - else { + } else { y = result(home, ret); div(home, x0, x1, y); } @@ -173,9 +173,9 @@ namespace Gecode { namespace MiniModel { case ANLFE_SQR: { assert(n == 1); FloatVar x = a[0].post(home); - if (x.assigned() && ((x.val() == 0.0) || (x.val() == 1.0))) + if (x.assigned() && ((x.val() == 0.0) || (x.val() == 1.0))) { y = x; - else { + } else { y = result(home, ret); sqr(home, x, y); } @@ -183,9 +183,9 @@ namespace Gecode { namespace MiniModel { case ANLFE_SQRT: { assert(n == 1); FloatVar x = a[0].post(home); - if (x.assigned() && ((x.val() == 0.0) || (x.val() == 1.0))) + if (x.assigned() && ((x.val() == 0.0) || (x.val() == 1.0))) { y = result(home, ret, x); - else { + } else { y = result(home, ret); sqrt(home, x, y); } @@ -193,9 +193,9 @@ namespace Gecode { namespace MiniModel { case ANLFE_POW: { assert(n == 1); FloatVar x = a[0].post(home); - if (x.assigned() && ((x.val() == 0.0) || (x.val() == 1.0)) && (a_int >= 0)) + if (x.assigned() && ((x.val() == 0.0) || (x.val() == 1.0)) && (a_int >= 0)) { y = result(home, ret, x); - else { + } else { y = result(home, ret); pow(home, x, a_int, y); } @@ -203,9 +203,9 @@ namespace Gecode { namespace MiniModel { case ANLFE_NROOT: { assert(n == 1); FloatVar x = a[0].post(home); - if (x.assigned() && ((x.val() == 0.0) || (x.val() == 1.0)) && (a_int >= 0)) + if (x.assigned() && ((x.val() == 0.0) || (x.val() == 1.0)) && (a_int >= 0)) { y = result(home, ret, x); - else { + } else { y = result(home, ret); nroot(home, x, a_int, y); } @@ -287,13 +287,13 @@ namespace Gecode { namespace MiniModel { } }; /// Check if \a e is of type \a t - bool + static bool has_type(const LinFloatExpr& e, ArithNonLinFloatExpr::ArithNonLinFloatExprType t) { return e.nlfe() && dynamic_cast(e.nlfe()) != nullptr && dynamic_cast(e.nlfe())->t == t; } -}} // namespace Gecode::MiniModel +} // namespace Gecode::MiniModel namespace Gecode { diff --git a/gecode/minimodel/float-expr.cpp b/gecode/minimodel/float-expr.cpp index dbb42e202a..7beecc082b 100644 --- a/gecode/minimodel/float-expr.cpp +++ b/gecode/minimodel/float-expr.cpp @@ -61,16 +61,16 @@ namespace Gecode { /// Float variable (potentially) FloatVar x_float; /// Default constructor - Node(void); + Node(); /// Generate linear terms from expression GECODE_MINIMODEL_EXPORT void fill(Home home, Float::Linear::Term*& tf, const FloatVal& m, FloatVal& d) const; /// Generate linear terms for expressions FloatVal fill(Home home, Float::Linear::Term* tf) const; /// Decrement reference count and possibly free memory - bool decrement(void); + bool decrement(); /// Destructor - ~Node(void); + ~Node(); /// Memory management static void* operator new(size_t size); /// Memory management @@ -82,10 +82,10 @@ namespace Gecode { * */ forceinline - LinFloatExpr::Node::Node(void) + LinFloatExpr::Node::Node() : use(1) {} - forceinline LinFloatExpr::Node::~Node(void) { + forceinline LinFloatExpr::Node::~Node() { switch (t) { case NT_SUM: if (n_float > 0) @@ -109,7 +109,7 @@ namespace Gecode { } bool - LinFloatExpr::Node::decrement(void) { + LinFloatExpr::Node::decrement() { if (--use == 0) { if ((l != nullptr) && l->decrement()) delete l; @@ -130,7 +130,7 @@ namespace Gecode { } NonLinFloatExpr* - LinFloatExpr::nlfe(void) const { + LinFloatExpr::nlfe() const { return n->t == NT_NONLIN ? n->sum.ne : nullptr; } @@ -230,7 +230,7 @@ namespace Gecode { return x; } - LinFloatExpr::LinFloatExpr(void) : n(new Node) { + LinFloatExpr::LinFloatExpr() : n(new Node) { n->n_float = 0; n->t = NT_VAR; n->l = n->r = nullptr; @@ -325,7 +325,7 @@ namespace Gecode { n->sum.ne = e; } - const LinFloatExpr& + LinFloatExpr& LinFloatExpr::operator=(const LinFloatExpr& e) { if (this != &e) { if (n->decrement()) @@ -336,7 +336,7 @@ namespace Gecode { return *this; } - LinFloatExpr::~LinFloatExpr(void) { + LinFloatExpr::~LinFloatExpr() { if (n->decrement()) delete n; } @@ -402,8 +402,7 @@ namespace Gecode { operator+(const FloatVal& c, const FloatVar& x) { if (x.assigned() && Float::Limits::valid(c + x.val())) return LinFloatExpr(c + x.val()); - else - return LinFloatExpr(x, LinFloatExpr::NT_ADD, c); + return LinFloatExpr(x, LinFloatExpr::NT_ADD, c); } LinFloatExpr operator+(const FloatVal& c, const LinFloatExpr& e) { @@ -413,8 +412,7 @@ namespace Gecode { operator+(const FloatVar& x, const FloatVal& c) { if (x.assigned() && Float::Limits::valid(c + x.val())) return LinFloatExpr(c + x.val()); - else - return LinFloatExpr(x, LinFloatExpr::NT_ADD, c); + return LinFloatExpr(x, LinFloatExpr::NT_ADD, c); } LinFloatExpr operator+(const LinFloatExpr& e, const FloatVal& c) { @@ -424,24 +422,21 @@ namespace Gecode { operator+(const FloatVar& x, const FloatVar& y) { if (x.assigned()) return x.val() + y; - else if (y.assigned()) + if (y.assigned()) return x + y.val(); - else - return LinFloatExpr(x, LinFloatExpr::NT_ADD, (const LinFloatExpr&)y); + return LinFloatExpr(x, LinFloatExpr::NT_ADD, static_cast(y)); } LinFloatExpr operator+(const FloatVar& x, const LinFloatExpr& e) { if (x.assigned()) return x.val() + e; - else - return LinFloatExpr(x, LinFloatExpr::NT_ADD, e); + return LinFloatExpr(x, LinFloatExpr::NT_ADD, e); } LinFloatExpr operator+(const LinFloatExpr& e, const FloatVar& x) { if (x.assigned()) return e + x.val(); - else - return LinFloatExpr(e, LinFloatExpr::NT_ADD, (const LinFloatExpr&)x); + return LinFloatExpr(e, LinFloatExpr::NT_ADD, static_cast(x)); } LinFloatExpr operator+(const LinFloatExpr& e1, const LinFloatExpr& e2) { @@ -452,8 +447,7 @@ namespace Gecode { operator-(const FloatVal& c, const FloatVar& x) { if (x.assigned() && Float::Limits::valid(c - x.val())) return LinFloatExpr(c - x.val()); - else - return LinFloatExpr(x, LinFloatExpr::NT_SUB, c); + return LinFloatExpr(x, LinFloatExpr::NT_SUB, c); } LinFloatExpr operator-(const FloatVal& c, const LinFloatExpr& e) { @@ -463,8 +457,7 @@ namespace Gecode { operator-(const FloatVar& x, const FloatVal& c) { if (x.assigned() && Float::Limits::valid(x.val() - c)) return LinFloatExpr(x.val() - c); - else - return LinFloatExpr(x, LinFloatExpr::NT_ADD, -c); + return LinFloatExpr(x, LinFloatExpr::NT_ADD, -c); } LinFloatExpr operator-(const LinFloatExpr& e, const FloatVal& c) { @@ -474,24 +467,21 @@ namespace Gecode { operator-(const FloatVar& x, const FloatVar& y) { if (x.assigned()) return x.val() - y; - else if (y.assigned()) + if (y.assigned()) return x - y.val(); - else - return LinFloatExpr(x, LinFloatExpr::NT_SUB, (const LinFloatExpr&)y); + return LinFloatExpr(x, LinFloatExpr::NT_SUB, static_cast(y)); } LinFloatExpr operator-(const FloatVar& x, const LinFloatExpr& e) { if (x.assigned()) return x.val() - e; - else - return LinFloatExpr(x, LinFloatExpr::NT_SUB, e); + return LinFloatExpr(x, LinFloatExpr::NT_SUB, e); } LinFloatExpr operator-(const LinFloatExpr& e, const FloatVar& x) { if (x.assigned()) return e - x.val(); - else - return LinFloatExpr(e, LinFloatExpr::NT_SUB, (const LinFloatExpr&)x); + return LinFloatExpr(e, LinFloatExpr::NT_SUB, static_cast(x)); } LinFloatExpr operator-(const LinFloatExpr& e1, const LinFloatExpr& e2) { @@ -502,8 +492,7 @@ namespace Gecode { operator-(const FloatVar& x) { if (x.assigned()) return LinFloatExpr(-x.val()); - else - return LinFloatExpr(x, LinFloatExpr::NT_SUB, 0); + return LinFloatExpr(x, LinFloatExpr::NT_SUB, 0); } LinFloatExpr operator-(const LinFloatExpr& e) { @@ -514,33 +503,29 @@ namespace Gecode { operator*(const FloatVal& a, const FloatVar& x) { if (a == 0) return LinFloatExpr(0.0); - else if (x.assigned() && Float::Limits::valid(a * x.val())) + if (x.assigned() && Float::Limits::valid(a * x.val())) return LinFloatExpr(a * x.val()); - else - return LinFloatExpr(x, a); + return LinFloatExpr(x, a); } LinFloatExpr operator*(const FloatVar& x, const FloatVal& a) { if (a == 0) return LinFloatExpr(0.0); - else if (x.assigned() && Float::Limits::valid(a * x.val())) + if (x.assigned() && Float::Limits::valid(a * x.val())) return LinFloatExpr(a * x.val()); - else - return LinFloatExpr(x, a); + return LinFloatExpr(x, a); } LinFloatExpr operator*(const LinFloatExpr& e, const FloatVal& a) { if (a == 0) return LinFloatExpr(0.0); - else - return LinFloatExpr(a, e); + return LinFloatExpr(a, e); } LinFloatExpr operator*(const FloatVal& a, const LinFloatExpr& e) { if (a == 0) return LinFloatExpr(0.0); - else - return LinFloatExpr(a, e); + return LinFloatExpr(a, e); } LinFloatExpr diff --git a/gecode/minimodel/float-expr.hpp b/gecode/minimodel/float-expr.hpp index 59c03e9071..980b5c684a 100644 --- a/gecode/minimodel/float-expr.hpp +++ b/gecode/minimodel/float-expr.hpp @@ -32,7 +32,7 @@ namespace Gecode { - forceinline NonLinFloatExpr::~NonLinFloatExpr(void) = default; + forceinline NonLinFloatExpr::~NonLinFloatExpr() = default; forceinline FloatVar NonLinFloatExpr::result(Home home, FloatVar* x) { diff --git a/gecode/minimodel/float-rel.cpp b/gecode/minimodel/float-rel.cpp index 4194722747..96a53ae4aa 100644 --- a/gecode/minimodel/float-rel.cpp +++ b/gecode/minimodel/float-rel.cpp @@ -42,7 +42,7 @@ namespace Gecode { */ LinFloatRel operator==(const FloatVal& l, const FloatVar& r) { - return LinFloatRel(l, FRT_EQ, (const LinFloatExpr&)r); + return LinFloatRel(l, FRT_EQ, static_cast(r)); } LinFloatRel operator==(const FloatVal& l, const LinFloatExpr& r) { @@ -50,7 +50,7 @@ namespace Gecode { } LinFloatRel operator==(const FloatVar& l, const FloatVal& r) { - return LinFloatRel((const LinFloatExpr&)l, FRT_EQ, r); + return LinFloatRel(static_cast(l), FRT_EQ, r); } LinFloatRel operator==(const LinFloatExpr& l, const FloatVal& r) { @@ -58,15 +58,15 @@ namespace Gecode { } LinFloatRel operator==(const FloatVar& l, const FloatVar& r) { - return LinFloatRel((const LinFloatExpr&)l, FRT_EQ, (const LinFloatExpr&)r); + return LinFloatRel(static_cast(l), FRT_EQ, static_cast(r)); } LinFloatRel operator==(const FloatVar& l, const LinFloatExpr& r) { - return LinFloatRel((const LinFloatExpr&)l, FRT_EQ, r); + return LinFloatRel(static_cast(l), FRT_EQ, r); } LinFloatRel operator==(const LinFloatExpr& l, const FloatVar& r) { - return LinFloatRel(l, FRT_EQ, (const LinFloatExpr&)r); + return LinFloatRel(l, FRT_EQ, static_cast(r)); } LinFloatRel operator==(const LinFloatExpr& l, const LinFloatExpr& r) { @@ -75,7 +75,7 @@ namespace Gecode { LinFloatRel operator!=(const FloatVal& l, const FloatVar& r) { - return LinFloatRel(l, FRT_NQ, (const LinFloatExpr&)r); + return LinFloatRel(l, FRT_NQ, static_cast(r)); } LinFloatRel operator!=(const FloatVal& l, const LinFloatExpr& r) { @@ -83,7 +83,7 @@ namespace Gecode { } LinFloatRel operator!=(const FloatVar& l, const FloatVal& r) { - return LinFloatRel((const LinFloatExpr&)l, FRT_NQ, r); + return LinFloatRel(static_cast(l), FRT_NQ, r); } LinFloatRel operator!=(const LinFloatExpr& l, const FloatVal& r) { @@ -91,15 +91,15 @@ namespace Gecode { } LinFloatRel operator!=(const FloatVar& l, const FloatVar& r) { - return LinFloatRel((const LinFloatExpr&)l, FRT_NQ, (const LinFloatExpr&)r); + return LinFloatRel(static_cast(l), FRT_NQ, static_cast(r)); } LinFloatRel operator!=(const FloatVar& l, const LinFloatExpr& r) { - return LinFloatRel((const LinFloatExpr&)l, FRT_NQ, r); + return LinFloatRel(static_cast(l), FRT_NQ, r); } LinFloatRel operator!=(const LinFloatExpr& l, const FloatVar& r) { - return LinFloatRel(l, FRT_NQ, (const LinFloatExpr&)r); + return LinFloatRel(l, FRT_NQ, static_cast(r)); } LinFloatRel operator!=(const LinFloatExpr& l, const LinFloatExpr& r) { @@ -108,7 +108,7 @@ namespace Gecode { LinFloatRel operator<=(const FloatVal& l, const FloatVar& r) { - return LinFloatRel(l, FRT_LQ, (const LinFloatExpr&)r); + return LinFloatRel(l, FRT_LQ, static_cast(r)); } LinFloatRel operator<=(const FloatVal& l, const LinFloatExpr& r) { @@ -124,15 +124,15 @@ namespace Gecode { } LinFloatRel operator<=(const FloatVar& l, const FloatVar& r) { - return LinFloatRel((const LinFloatExpr&)l, FRT_LQ, (const LinFloatExpr&)r); + return LinFloatRel(static_cast(l), FRT_LQ, static_cast(r)); } LinFloatRel operator<=(const FloatVar& l, const LinFloatExpr& r) { - return LinFloatRel((const LinFloatExpr&)l, FRT_LQ, r); + return LinFloatRel(static_cast(l), FRT_LQ, r); } LinFloatRel operator<=(const LinFloatExpr& l, const FloatVar& r) { - return LinFloatRel(l, FRT_LQ, (const LinFloatExpr&)r); + return LinFloatRel(l, FRT_LQ, static_cast(r)); } LinFloatRel operator<=(const LinFloatExpr& l, const LinFloatExpr& r) { @@ -141,7 +141,7 @@ namespace Gecode { LinFloatRel operator<(const FloatVal& l, const FloatVar& r) { - return LinFloatRel(l, FRT_LT, (const LinFloatExpr&)r); + return LinFloatRel(l, FRT_LT, static_cast(r)); } LinFloatRel operator<(const FloatVal& l, const LinFloatExpr& r) { @@ -157,15 +157,15 @@ namespace Gecode { } LinFloatRel operator<(const FloatVar& l, const FloatVar& r) { - return LinFloatRel((const LinFloatExpr&)l, FRT_LT, (const LinFloatExpr&)r); + return LinFloatRel(static_cast(l), FRT_LT, static_cast(r)); } LinFloatRel operator<(const FloatVar& l, const LinFloatExpr& r) { - return LinFloatRel((const LinFloatExpr&)l, FRT_LT, r); + return LinFloatRel(static_cast(l), FRT_LT, r); } LinFloatRel operator<(const LinFloatExpr& l, const FloatVar& r) { - return LinFloatRel(l, FRT_LT, (const LinFloatExpr&)r); + return LinFloatRel(l, FRT_LT, static_cast(r)); } LinFloatRel operator<(const LinFloatExpr& l, const LinFloatExpr& r) { @@ -174,7 +174,7 @@ namespace Gecode { LinFloatRel operator>=(const FloatVal& l, const FloatVar& r) { - return LinFloatRel(l, FRT_GQ, (const LinFloatExpr&)r); + return LinFloatRel(l, FRT_GQ, static_cast(r)); } LinFloatRel operator>=(const FloatVal& l, const LinFloatExpr& r) { @@ -182,7 +182,7 @@ namespace Gecode { } LinFloatRel operator>=(const FloatVar& l, const FloatVal& r) { - return LinFloatRel((const LinFloatExpr&)l, FRT_GQ, r); + return LinFloatRel(static_cast(l), FRT_GQ, r); } LinFloatRel operator>=(const LinFloatExpr& l, const FloatVal& r) { @@ -190,15 +190,15 @@ namespace Gecode { } LinFloatRel operator>=(const FloatVar& l, const FloatVar& r) { - return LinFloatRel((const LinFloatExpr&)l, FRT_GQ, (const LinFloatExpr&)r); + return LinFloatRel(static_cast(l), FRT_GQ, static_cast(r)); } LinFloatRel operator>=(const FloatVar& l, const LinFloatExpr& r) { - return LinFloatRel((const LinFloatExpr&)l, FRT_GQ, r); + return LinFloatRel(static_cast(l), FRT_GQ, r); } LinFloatRel operator>=(const LinFloatExpr& l, const FloatVar& r) { - return LinFloatRel(l, FRT_GQ, (const LinFloatExpr&)r); + return LinFloatRel(l, FRT_GQ, static_cast(r)); } LinFloatRel operator>=(const LinFloatExpr& l, const LinFloatExpr& r) { @@ -207,7 +207,7 @@ namespace Gecode { LinFloatRel operator>(const FloatVal& l, const FloatVar& r) { - return LinFloatRel(l, FRT_GR, (const LinFloatExpr&)r); + return LinFloatRel(l, FRT_GR, static_cast(r)); } LinFloatRel operator>(const FloatVal& l, const LinFloatExpr& r) { @@ -215,7 +215,7 @@ namespace Gecode { } LinFloatRel operator>(const FloatVar& l, const FloatVal& r) { - return LinFloatRel((const LinFloatExpr&)l, FRT_GR, r); + return LinFloatRel(static_cast(l), FRT_GR, r); } LinFloatRel operator>(const LinFloatExpr& l, const FloatVal& r) { @@ -223,15 +223,15 @@ namespace Gecode { } LinFloatRel operator>(const FloatVar& l, const FloatVar& r) { - return LinFloatRel((const LinFloatExpr&)l, FRT_GR, (const LinFloatExpr&)r); + return LinFloatRel(static_cast(l), FRT_GR, static_cast(r)); } LinFloatRel operator>(const FloatVar& l, const LinFloatExpr& r) { - return LinFloatRel((const LinFloatExpr&)l, FRT_GR, r); + return LinFloatRel(static_cast(l), FRT_GR, r); } LinFloatRel operator>(const LinFloatExpr& l, const FloatVar& r) { - return LinFloatRel(l, FRT_GR, (const LinFloatExpr&)r); + return LinFloatRel(l, FRT_GR, static_cast(r)); } LinFloatRel operator>(const LinFloatExpr& l, const LinFloatExpr& r) { diff --git a/gecode/minimodel/int-arith.cpp b/gecode/minimodel/int-arith.cpp index 5cdf185ce6..686a2ed221 100644 --- a/gecode/minimodel/int-arith.cpp +++ b/gecode/minimodel/int-arith.cpp @@ -38,7 +38,7 @@ #include -namespace Gecode { namespace MiniModel { +namespace Gecode::MiniModel { /// Non-linear arithmetic expressions over integer variables class GECODE_MINIMODEL_EXPORT ArithNonLinIntExpr : public NonLinIntExpr { @@ -84,7 +84,7 @@ namespace Gecode { namespace MiniModel { ArithNonLinIntExpr(ArithNonLinIntExprType t0, int n0, const BoolExpr& b0) : t(t0), b(b0), n(n0), a_int(0), a(allocate(n0)) {} /// Destructor - ~ArithNonLinIntExpr(void) override { + ~ArithNonLinIntExpr() override { if (a != nullptr) heap.free(a, n); } @@ -95,9 +95,9 @@ namespace Gecode { namespace MiniModel { switch (t) { case ANLE_ABS: { IntVar x = a[0].post(home, ipls); - if (x.min() >= 0) + if (x.min() >= 0) { y = result(home, ret, x); - else { + } else { y = result(home, ret); abs(home, x, y, ipls.abs()); } @@ -108,11 +108,11 @@ namespace Gecode { namespace MiniModel { } else if (n == 2) { IntVar x0 = a[0].post(home, ipls); IntVar x1 = a[1].post(home, ipls); - if (x0.max() <= x1.min()) + if (x0.max() <= x1.min()) { y = result(home, ret, x0); - else if (x1.max() <= x0.min()) + } else if (x1.max() <= x0.min()) { y = result(home, ret, x1); - else { + } else { y = result(home, ret); min(home, x0, x1, y, ipls.min2()); } @@ -130,11 +130,11 @@ namespace Gecode { namespace MiniModel { } else if (n == 2) { IntVar x0 = a[0].post(home, ipls); IntVar x1 = a[1].post(home, ipls); - if (x0.max() <= x1.min()) + if (x0.max() <= x1.min()) { y = result(home, ret, x1); - else if (x1.max() <= x0.min()) + } else if (x1.max() <= x0.min()) { y = result(home, ret, x0); - else { + } else { y = result(home, ret); max(home, x0, x1, y, ipls.max2()); } @@ -150,15 +150,15 @@ namespace Gecode { namespace MiniModel { assert(n == 2); IntVar x0 = a[0].post(home, ipls); IntVar x1 = a[1].post(home, ipls); - if (x0.assigned() && (x0.val() == 0)) + if (x0.assigned() && (x0.val() == 0)) { y = result(home, ret, x0); - else if (x0.assigned() && (x0.val() == 1)) + } else if (x0.assigned() && (x0.val() == 1)) { y = result(home, ret, x1); - else if (x1.assigned() && (x1.val() == 0)) + } else if (x1.assigned() && (x1.val() == 0)) { y = result(home, ret, x1); - else if (x1.assigned() && (x1.val() == 1)) + } else if (x1.assigned() && (x1.val() == 1)) { y = result(home, ret, x0); - else { + } else { y = result(home, ret); mult(home, x0, x1, y, ipls.mult()); } @@ -168,11 +168,11 @@ namespace Gecode { namespace MiniModel { IntVar x0 = a[0].post(home, ipls); IntVar x1 = a[1].post(home, ipls); rel(home, x1, IRT_NQ, 0); - if (x1.assigned() && (x1.val() == 1)) + if (x1.assigned() && (x1.val() == 1)) { y = result(home, ret, x0); - else if (x0.assigned() && (x0.val() == 0)) + } else if (x0.assigned() && (x0.val() == 0)) { y = result(home, ret, x0); - else { + } else { y = result(home, ret); div(home, x0, x1, y, ipls.div()); } @@ -187,9 +187,9 @@ namespace Gecode { namespace MiniModel { case ANLE_SQR: { assert(n == 1); IntVar x = a[0].post(home, ipls); - if (x.assigned() && ((x.val() == 0) || (x.val() == 1))) + if (x.assigned() && ((x.val() == 0) || (x.val() == 1))) { y = result(home, ret, x); - else { + } else { y = result(home, ret); sqr(home, x, y, ipls.sqr()); } @@ -197,9 +197,9 @@ namespace Gecode { namespace MiniModel { case ANLE_SQRT: { assert(n == 1); IntVar x = a[0].post(home, ipls); - if (x.assigned() && ((x.val() == 0) || (x.val() == 1))) + if (x.assigned() && ((x.val() == 0) || (x.val() == 1))) { y = result(home, ret, x); - else { + } else { y = result(home, ret); sqrt(home, x, y, ipls.sqrt()); } @@ -207,9 +207,9 @@ namespace Gecode { namespace MiniModel { case ANLE_POW: { assert(n == 1); IntVar x = a[0].post(home, ipls); - if (x.assigned() && (a_int > 0) && ((x.val() == 0) || (x.val() == 1))) + if (x.assigned() && (a_int > 0) && ((x.val() == 0) || (x.val() == 1))) { y = result(home, ret, x); - else { + } else { y = result(home, ret); pow(home, x, a_int, y, ipls.pow()); } @@ -217,9 +217,9 @@ namespace Gecode { namespace MiniModel { case ANLE_NROOT: { assert(n == 1); IntVar x = a[0].post(home, ipls); - if (x.assigned() && (a_int > 0) && ((x.val() == 0) || (x.val() == 1))) + if (x.assigned() && (a_int > 0) && ((x.val() == 0) || (x.val() == 1))) { y = result(home, ret, x); - else { + } else { y = result(home, ret); nroot(home, x, a_int, y, ipls.nroot()); } @@ -278,7 +278,7 @@ namespace Gecode { namespace MiniModel { } }; /// Check if \a e is of type \a t - bool + static bool has_type(const LinIntExpr& e, ArithNonLinIntExpr::ArithNonLinIntExprType t) { return e.nle() && dynamic_cast(e.nle()) != nullptr && dynamic_cast(e.nle())->t == t; @@ -290,16 +290,16 @@ namespace Gecode { namespace MiniModel { public: ArithNonLinIntExprGuard(ArithNonLinIntExpr* e0) : e(e0) {} - ~ArithNonLinIntExprGuard(void) { + ~ArithNonLinIntExprGuard() { delete e; } void - release(void) { + release() { e = nullptr; } }; -}} // namespace Gecode::MiniModel +} // namespace Gecode::MiniModel namespace Gecode { diff --git a/gecode/minimodel/int-expr.cpp b/gecode/minimodel/int-expr.cpp index 5027f97c54..74a18e7e47 100644 --- a/gecode/minimodel/int-expr.cpp +++ b/gecode/minimodel/int-expr.cpp @@ -70,7 +70,7 @@ namespace Gecode { /// Boolean variable (potentially) BoolVar x_bool; /// Default constructor - Node(void); + Node(); /// Generate linear terms from expression void fill(Home home, const IntPropLevels& ipls, Int::Linear::Term*& ti, Int::Linear::Term*& tb, long long int m, long long int& d) const; @@ -78,9 +78,9 @@ namespace Gecode { int fill(Home home, const IntPropLevels& ipls, Int::Linear::Term* ti, Int::Linear::Term* tb) const; /// Decrement reference count and possibly free memory - bool decrement(void); + bool decrement(); /// Destructor - ~Node(void); + ~Node(); /// Memory management static void* operator new(size_t size); /// Memory management @@ -96,24 +96,24 @@ namespace Gecode { * */ forceinline - LinIntExpr::Node::Node(void) + LinIntExpr::Node::Node() : use(1) {} #ifdef GECODE_HAS_FAULT_INJECTION std::atomic LinIntExpr::Node::fault_live_nodes{0}; void - LinIntExpr::fault_reset_allocations(void) { + LinIntExpr::fault_reset_allocations() { Node::fault_live_nodes.store(0, std::memory_order_relaxed); } int - LinIntExpr::fault_live_allocations(void) { + LinIntExpr::fault_live_allocations() { return Node::fault_live_nodes.load(std::memory_order_relaxed); } #endif - forceinline LinIntExpr::Node::~Node(void) { + forceinline LinIntExpr::Node::~Node() { switch (t) { case NT_SUM_INT: if (n_int > 0) @@ -150,7 +150,7 @@ namespace Gecode { heap.rfree(p); } bool - LinIntExpr::Node::decrement(void) { + LinIntExpr::Node::decrement() { if (--use == 0) { if ((l != nullptr) && l->decrement()) delete l; @@ -330,7 +330,8 @@ namespace Gecode { its[n->n_int].a = -1; Int::Linear::post(home, its, n->n_int + 1, IRT_EQ, -c, (n->n_int > 1) ? ipls.linear() : ipls.linear2()); return x; - } else if (n->n_int == 0) { + } + if (n->n_int == 0) { // Only Boolean variables Int::Linear::Term* bts = r.alloc>(n->n_bool); int c = n->fill(home, ipls, nullptr, bts); @@ -339,7 +340,8 @@ namespace Gecode { IntVar x(home, min, max); Int::Linear::post(home, bts, n->n_bool, IRT_EQ, x, -c, (n->n_bool > 2) ? ipls.linear() : ipls.linear2()); return x; - } else if (n->n_bool == 1) { + } + if (n->n_bool == 1) { // Integer variables and single Boolean variable Int::Linear::Term* its = r.alloc>(n->n_int + 2); Int::Linear::Term* bts = r.alloc>(1); @@ -355,35 +357,33 @@ namespace Gecode { its[n->n_int + 1].a = -1; Int::Linear::post(home, its, n->n_int + 2, IRT_EQ, -c, ipls.linear()); return y; - } else { - // Both integer and Boolean variables - Int::Linear::Term* its = r.alloc>(n->n_int + 2); - Int::Linear::Term* bts = r.alloc>(n->n_bool); - int c = n->fill(home, ipls, its, bts); - int x_min, x_max; - Int::Linear::estimate(&bts[0], n->n_bool, 0, x_min, x_max); - IntVar x(home, x_min, x_max); - Int::Linear::post(home, bts, n->n_bool, IRT_EQ, x, 0, (n->n_bool > 2) ? ipls.linear() : ipls.linear2()); - its[n->n_int].x = x; - its[n->n_int].a = 1; - int y_min, y_max; - Int::Linear::estimate(&its[0], n->n_int + 1, c, y_min, y_max); - IntVar y(home, y_min, y_max); - its[n->n_int + 1].x = y; - its[n->n_int + 1].a = -1; - Int::Linear::post(home, its, n->n_int + 2, IRT_EQ, -c, ipls.linear()); - return y; - } + } // Both integer and Boolean variables + Int::Linear::Term* its = r.alloc>(n->n_int + 2); + Int::Linear::Term* bts = r.alloc>(n->n_bool); + int c = n->fill(home, ipls, its, bts); + int x_min, x_max; + Int::Linear::estimate(&bts[0], n->n_bool, 0, x_min, x_max); + IntVar x(home, x_min, x_max); + Int::Linear::post(home, bts, n->n_bool, IRT_EQ, x, 0, (n->n_bool > 2) ? ipls.linear() : ipls.linear2()); + its[n->n_int].x = x; + its[n->n_int].a = 1; + int y_min, y_max; + Int::Linear::estimate(&its[0], n->n_int + 1, c, y_min, y_max); + IntVar y(home, y_min, y_max); + its[n->n_int + 1].x = y; + its[n->n_int + 1].a = -1; + Int::Linear::post(home, its, n->n_int + 2, IRT_EQ, -c, ipls.linear()); + return y; } NonLinIntExpr* - LinIntExpr::nle(void) const { + LinIntExpr::nle() const { return ((n != nullptr) && (n->t == NT_NONLIN)) ? n->sum.ne : nullptr; } LinIntExpr::LinIntExpr(NoNode) : n(nullptr) {} - LinIntExpr::LinIntExpr(void) : n(new Node) { + LinIntExpr::LinIntExpr() : n(new Node) { n->n_int = n->n_bool = 0; n->t = NT_CONST; n->l = n->r = nullptr; @@ -549,7 +549,7 @@ namespace Gecode { n->sum.ne = e; } - const LinIntExpr& + LinIntExpr& LinIntExpr::operator=(const LinIntExpr& e) { if (this != &e) { if ((n != nullptr) && n->decrement()) @@ -561,7 +561,7 @@ namespace Gecode { return *this; } - LinIntExpr::~LinIntExpr(void) { + LinIntExpr::~LinIntExpr() { if ((n != nullptr) && n->decrement()) delete n; } @@ -651,15 +651,13 @@ namespace Gecode { operator+(int c, const IntVar& x) { if (x.assigned() && Int::Limits::valid(static_cast(c) + x.val())) return LinIntExpr(c + x.val()); - else - return LinIntExpr(x, LinIntExpr::NT_ADD, c); + return LinIntExpr(x, LinIntExpr::NT_ADD, c); } LinIntExpr operator+(int c, const BoolVar& x) { if (x.assigned() && Int::Limits::valid(static_cast(c) + x.val())) return LinIntExpr(c + x.val()); - else - return LinIntExpr(x, LinIntExpr::NT_ADD, c); + return LinIntExpr(x, LinIntExpr::NT_ADD, c); } LinIntExpr operator+(int c, const LinIntExpr& e) { @@ -669,15 +667,13 @@ namespace Gecode { operator+(const IntVar& x, int c) { if (x.assigned() && Int::Limits::valid(static_cast(c) + x.val())) return LinIntExpr(c + x.val()); - else - return LinIntExpr(x, LinIntExpr::NT_ADD, c); + return LinIntExpr(x, LinIntExpr::NT_ADD, c); } LinIntExpr operator+(const BoolVar& x, int c) { if (x.assigned() && Int::Limits::valid(static_cast(c) + x.val())) return LinIntExpr(c + x.val()); - else - return LinIntExpr(x, LinIntExpr::NT_ADD, c); + return LinIntExpr(x, LinIntExpr::NT_ADD, c); } LinIntExpr operator+(const LinIntExpr& e, int c) { @@ -687,65 +683,57 @@ namespace Gecode { operator+(const IntVar& x, const IntVar& y) { if (x.assigned()) return x.val() + y; - else if (y.assigned()) + if (y.assigned()) return x + y.val(); - else - return LinIntExpr(x, LinIntExpr::NT_ADD, y); + return LinIntExpr(x, LinIntExpr::NT_ADD, y); } LinIntExpr operator+(const IntVar& x, const BoolVar& y) { if (x.assigned()) return x.val() + y; - else if (y.assigned()) + if (y.assigned()) return x + y.val(); - else - return LinIntExpr(x, LinIntExpr::NT_ADD, y); + return LinIntExpr(x, LinIntExpr::NT_ADD, y); } LinIntExpr operator+(const BoolVar& x, const IntVar& y) { if (x.assigned()) return x.val() + y; - else if (y.assigned()) + if (y.assigned()) return x + y.val(); - else - return LinIntExpr(x, LinIntExpr::NT_ADD, y); + return LinIntExpr(x, LinIntExpr::NT_ADD, y); } LinIntExpr operator+(const BoolVar& x, const BoolVar& y) { if (x.assigned()) return x.val() + y; - else if (y.assigned()) + if (y.assigned()) return x + y.val(); - else - return LinIntExpr(x, LinIntExpr::NT_ADD, y); + return LinIntExpr(x, LinIntExpr::NT_ADD, y); } LinIntExpr operator+(const IntVar& x, const LinIntExpr& e) { if (x.assigned()) return x.val() + e; - else - return LinIntExpr(x, LinIntExpr::NT_ADD, e); + return LinIntExpr(x, LinIntExpr::NT_ADD, e); } LinIntExpr operator+(const BoolVar& x, const LinIntExpr& e) { if (x.assigned()) return x.val() + e; - else - return LinIntExpr(x, LinIntExpr::NT_ADD, e); + return LinIntExpr(x, LinIntExpr::NT_ADD, e); } LinIntExpr operator+(const LinIntExpr& e, const IntVar& x) { if (x.assigned()) return e + x.val(); - else - return LinIntExpr(e, LinIntExpr::NT_ADD, x); + return LinIntExpr(e, LinIntExpr::NT_ADD, x); } LinIntExpr operator+(const LinIntExpr& e, const BoolVar& x) { if (x.assigned()) return e + x.val(); - else - return LinIntExpr(e, LinIntExpr::NT_ADD, x); + return LinIntExpr(e, LinIntExpr::NT_ADD, x); } LinIntExpr operator+(const LinIntExpr& e1, const LinIntExpr& e2) { @@ -756,15 +744,13 @@ namespace Gecode { operator-(int c, const IntVar& x) { if (x.assigned() && Int::Limits::valid(static_cast(c) - x.val())) return LinIntExpr(c - x.val()); - else - return LinIntExpr(x, LinIntExpr::NT_SUB, c); + return LinIntExpr(x, LinIntExpr::NT_SUB, c); } LinIntExpr operator-(int c, const BoolVar& x) { if (x.assigned() && Int::Limits::valid(static_cast(c) - x.val())) return LinIntExpr(c - x.val()); - else - return LinIntExpr(x, LinIntExpr::NT_SUB, c); + return LinIntExpr(x, LinIntExpr::NT_SUB, c); } LinIntExpr operator-(int c, const LinIntExpr& e) { @@ -774,15 +760,13 @@ namespace Gecode { operator-(const IntVar& x, int c) { if (x.assigned() && Int::Limits::valid(x.val() - static_cast(c))) return LinIntExpr(x.val() - c); - else - return LinIntExpr(x, LinIntExpr::NT_ADD, -c); + return LinIntExpr(x, LinIntExpr::NT_ADD, -c); } LinIntExpr operator-(const BoolVar& x, int c) { if (x.assigned() && Int::Limits::valid(x.val() - static_cast(c))) return LinIntExpr(x.val() - c); - else - return LinIntExpr(x, LinIntExpr::NT_ADD, -c); + return LinIntExpr(x, LinIntExpr::NT_ADD, -c); } LinIntExpr operator-(const LinIntExpr& e, int c) { @@ -792,65 +776,57 @@ namespace Gecode { operator-(const IntVar& x, const IntVar& y) { if (x.assigned()) return x.val() - y; - else if (y.assigned()) + if (y.assigned()) return x - y.val(); - else - return LinIntExpr(x, LinIntExpr::NT_SUB, y); + return LinIntExpr(x, LinIntExpr::NT_SUB, y); } LinIntExpr operator-(const IntVar& x, const BoolVar& y) { if (x.assigned()) return x.val() - y; - else if (y.assigned()) + if (y.assigned()) return x - y.val(); - else - return LinIntExpr(x, LinIntExpr::NT_SUB, y); + return LinIntExpr(x, LinIntExpr::NT_SUB, y); } LinIntExpr operator-(const BoolVar& x, const IntVar& y) { if (x.assigned()) return x.val() - y; - else if (y.assigned()) + if (y.assigned()) return x - y.val(); - else - return LinIntExpr(x, LinIntExpr::NT_SUB, y); + return LinIntExpr(x, LinIntExpr::NT_SUB, y); } LinIntExpr operator-(const BoolVar& x, const BoolVar& y) { if (x.assigned()) return x.val() - y; - else if (y.assigned()) + if (y.assigned()) return x - y.val(); - else - return LinIntExpr(x, LinIntExpr::NT_SUB, y); + return LinIntExpr(x, LinIntExpr::NT_SUB, y); } LinIntExpr operator-(const IntVar& x, const LinIntExpr& e) { if (x.assigned()) return x.val() - e; - else - return LinIntExpr(x, LinIntExpr::NT_SUB, e); + return LinIntExpr(x, LinIntExpr::NT_SUB, e); } LinIntExpr operator-(const BoolVar& x, const LinIntExpr& e) { if (x.assigned()) return x.val() - e; - else - return LinIntExpr(x, LinIntExpr::NT_SUB, e); + return LinIntExpr(x, LinIntExpr::NT_SUB, e); } LinIntExpr operator-(const LinIntExpr& e, const IntVar& x) { if (x.assigned()) return e - x.val(); - else - return LinIntExpr(e, LinIntExpr::NT_SUB, x); + return LinIntExpr(e, LinIntExpr::NT_SUB, x); } LinIntExpr operator-(const LinIntExpr& e, const BoolVar& x) { if (x.assigned()) return e - x.val(); - else - return LinIntExpr(e, LinIntExpr::NT_SUB, x); + return LinIntExpr(e, LinIntExpr::NT_SUB, x); } LinIntExpr operator-(const LinIntExpr& e1, const LinIntExpr& e2) { @@ -861,15 +837,13 @@ namespace Gecode { operator-(const IntVar& x) { if (x.assigned()) return LinIntExpr(-x.val()); - else - return LinIntExpr(x, LinIntExpr::NT_SUB, 0); + return LinIntExpr(x, LinIntExpr::NT_SUB, 0); } LinIntExpr operator-(const BoolVar& x) { if (x.assigned()) return LinIntExpr(-x.val()); - else - return LinIntExpr(x, LinIntExpr::NT_SUB, 0); + return LinIntExpr(x, LinIntExpr::NT_SUB, 0); } LinIntExpr operator-(const LinIntExpr& e) { @@ -880,51 +854,45 @@ namespace Gecode { operator*(int a, const IntVar& x) { if (a == 0) return LinIntExpr(0); - else if (x.assigned() && Int::Limits::valid(static_cast(a) * x.val())) + if (x.assigned() && Int::Limits::valid(static_cast(a) * x.val())) return LinIntExpr(a * x.val()); - else - return LinIntExpr(x, a); + return LinIntExpr(x, a); } LinIntExpr operator*(int a, const BoolVar& x) { if (a == 0) return LinIntExpr(0); - else if (x.assigned() && Int::Limits::valid(static_cast(a) * x.val())) + if (x.assigned() && Int::Limits::valid(static_cast(a) * x.val())) return LinIntExpr(a * x.val()); - else - return LinIntExpr(x, a); + return LinIntExpr(x, a); } LinIntExpr operator*(const IntVar& x, int a) { if (a == 0) return LinIntExpr(0); - else if (x.assigned() && Int::Limits::valid(static_cast(a) * x.val())) + if (x.assigned() && Int::Limits::valid(static_cast(a) * x.val())) return LinIntExpr(a * x.val()); - else - return LinIntExpr(x, a); + return LinIntExpr(x, a); } LinIntExpr operator*(const BoolVar& x, int a) { if (a == 0) return LinIntExpr(0); - else if (x.assigned() && Int::Limits::valid(static_cast(a) * x.val())) + if (x.assigned() && Int::Limits::valid(static_cast(a) * x.val())) return LinIntExpr(a * x.val()); - else - return LinIntExpr(x, a); + return LinIntExpr(x, a); } LinIntExpr operator*(const LinIntExpr& e, int a) { if (a == 0) return LinIntExpr(0); - else - return LinIntExpr(a, e); + return LinIntExpr(a, e); } LinIntExpr operator*(int a, const LinIntExpr& e) { if (a == 0) return LinIntExpr(0); - else - return LinIntExpr(a, e); + return LinIntExpr(a, e); } LinIntExpr @@ -956,8 +924,8 @@ namespace Gecode { LinIntExpr sum(const IntArgs& args) { int sum = 0; - for (int i = 0; i < args.size(); i++) - sum += args[i]; + for (int arg : args) + sum += arg; return LinIntExpr(sum); } diff --git a/gecode/minimodel/int-expr.hpp b/gecode/minimodel/int-expr.hpp index 11541a07e6..dd2b57c963 100644 --- a/gecode/minimodel/int-expr.hpp +++ b/gecode/minimodel/int-expr.hpp @@ -32,7 +32,7 @@ namespace Gecode { - forceinline NonLinIntExpr::~NonLinIntExpr(void) = default; + forceinline NonLinIntExpr::~NonLinIntExpr() = default; forceinline IntVar NonLinIntExpr::result(Home home, IntVar* x) { diff --git a/gecode/minimodel/ipl.hpp b/gecode/minimodel/ipl.hpp index ecece90128..743842818a 100644 --- a/gecode/minimodel/ipl.hpp +++ b/gecode/minimodel/ipl.hpp @@ -37,7 +37,7 @@ namespace Gecode { _mod(ipl), _sqr(ipl), _sqrt(ipl), _pow(ipl), _nroot(ipl), _element(ipl), _ite(ipl) {} inline IntPropLevel - IntPropLevels::linear2(void) const { + IntPropLevels::linear2() const { return _linear2; } inline IntPropLevels& @@ -46,7 +46,7 @@ namespace Gecode { return *this; } inline IntPropLevel - IntPropLevels::linear(void) const { + IntPropLevels::linear() const { return _linear; } inline IntPropLevels& @@ -56,7 +56,7 @@ namespace Gecode { } inline IntPropLevel - IntPropLevels::abs(void) const { + IntPropLevels::abs() const { return _abs; } inline IntPropLevels& @@ -66,7 +66,7 @@ namespace Gecode { } inline IntPropLevel - IntPropLevels::max2(void) const { + IntPropLevels::max2() const { return _max2; } inline IntPropLevels& @@ -75,7 +75,7 @@ namespace Gecode { return *this; } inline IntPropLevel - IntPropLevels::max(void) const { + IntPropLevels::max() const { return _max; } inline IntPropLevels& @@ -84,7 +84,7 @@ namespace Gecode { return *this; } inline IntPropLevel - IntPropLevels::min2(void) const { + IntPropLevels::min2() const { return _min2; } inline IntPropLevels& @@ -93,7 +93,7 @@ namespace Gecode { return *this; } inline IntPropLevel - IntPropLevels::min(void) const { + IntPropLevels::min() const { return _min; } inline IntPropLevels& @@ -103,7 +103,7 @@ namespace Gecode { } inline IntPropLevel - IntPropLevels::mult(void) const { + IntPropLevels::mult() const { return _mult; } inline IntPropLevels& @@ -112,7 +112,7 @@ namespace Gecode { return *this; } inline IntPropLevel - IntPropLevels::div(void) const { + IntPropLevels::div() const { return _div; } inline IntPropLevels& @@ -121,7 +121,7 @@ namespace Gecode { return *this; } inline IntPropLevel - IntPropLevels::mod(void) const { + IntPropLevels::mod() const { return _mod; } inline IntPropLevels& @@ -131,7 +131,7 @@ namespace Gecode { } inline IntPropLevel - IntPropLevels::sqr(void) const { + IntPropLevels::sqr() const { return _sqr; } inline IntPropLevels& @@ -140,7 +140,7 @@ namespace Gecode { return *this; } inline IntPropLevel - IntPropLevels::sqrt(void) const { + IntPropLevels::sqrt() const { return _sqrt; } inline IntPropLevels& @@ -149,7 +149,7 @@ namespace Gecode { return *this; } inline IntPropLevel - IntPropLevels::pow(void) const { + IntPropLevels::pow() const { return _pow; } inline IntPropLevels& @@ -158,7 +158,7 @@ namespace Gecode { return *this; } inline IntPropLevel - IntPropLevels::nroot(void) const { + IntPropLevels::nroot() const { return _nroot; } inline IntPropLevels& @@ -168,7 +168,7 @@ namespace Gecode { } inline IntPropLevel - IntPropLevels::element(void) const { + IntPropLevels::element() const { return _element; } inline IntPropLevels& @@ -178,7 +178,7 @@ namespace Gecode { } inline IntPropLevel - IntPropLevels::ite(void) const { + IntPropLevels::ite() const { return _ite; } inline IntPropLevels& diff --git a/gecode/minimodel/matrix.hpp b/gecode/minimodel/matrix.hpp index b63ceff96f..8282f036b9 100644 --- a/gecode/minimodel/matrix.hpp +++ b/gecode/minimodel/matrix.hpp @@ -60,7 +60,7 @@ namespace Gecode { template Slice& - Slice::reverse(void) { + Slice::reverse() { for (int i = 0; i < _r.size() / 2; i++) std::swap(_r[i], _r[_r.size() - i - 1]); return *this; @@ -68,27 +68,18 @@ namespace Gecode { template inline Slice:: - operator ArgsType(void) { + operator ArgsType() const { return _r; } + // MSVC needs the qualified name in this conversion function template inline Slice:: - operator Matrix(void) { - return Matrix::ArgsType>(_r, _tc - _fc, _tr - _fr); - } - template - inline Slice:: - operator const ArgsType(void) const { - return _r; - } - template - inline Slice:: - operator const Matrix(void) const { + operator Matrix::ArgsType>() const { return Matrix::ArgsType>(_r, _tc - _fc, _tr - _fr); } template - typename Slice::ArgsType + Slice::ArgsType operator+(const Slice& x, const Slice& y) { typename Slice::ArgsType xx = x; typename Slice::ArgsType yy = y; @@ -96,28 +87,28 @@ namespace Gecode { } template - typename Slice::ArgsType + Slice::ArgsType operator+(const Slice& x, const typename ArrayTraits::ArgsType& y) { typename Slice::ArgsType xx = x; return xx + y; } template - typename Slice::ArgsType + Slice::ArgsType operator+(const typename ArrayTraits::ArgsType& x, const Slice& y) { typename Slice::ArgsType yy = y; return x + yy; } template - typename Slice::ArgsType + Slice::ArgsType operator+(const Slice& x, const typename ArrayTraits::ValueType& y) { typename Slice::ArgsType xx = x; return xx + y; } template - typename Slice::ArgsType + Slice::ArgsType operator+(const typename ArrayTraits::ValueType& x, const Slice& y) { typename Slice::ArgsType yy = y; return x + yy; @@ -141,22 +132,22 @@ namespace Gecode { template forceinline int - Matrix::width(void) const { + Matrix::width() const { return _w; } template forceinline int - Matrix::height(void) const { + Matrix::height() const { return _h; } template - inline typename Matrix::ArgsType const - Matrix::get_array(void) const { + inline Matrix::ArgsType + Matrix::get_array() const { return ArgsType(_a); } template - forceinline typename Matrix::ValueType& + forceinline Matrix::ValueType& Matrix::operator()(int c, int r) { if ((c >= _w) || (r >= _h)) throw MiniModel::ArgumentOutOfRange("Matrix::operator ()"); @@ -164,7 +155,7 @@ namespace Gecode { } template - forceinline const typename Matrix::ValueType& + forceinline const Matrix::ValueType& Matrix::operator()(int c, int r) const { if ((c >= _w) || (r >= _h)) throw MiniModel::ArgumentOutOfRange("Matrix::operator ()"); @@ -207,7 +198,7 @@ namespace Gecode { template std::basic_ostream& operator<<(std::basic_ostream& os, const Slice& s) { - return os << static_cast::ArgsType>(s); + return os << static_cast::ArgsType>(s); } forceinline void diff --git a/gecode/minimodel/reg.cpp b/gecode/minimodel/reg.cpp index ef3bf8a288..531e1eeb7d 100644 --- a/gecode/minimodel/reg.cpp +++ b/gecode/minimodel/reg.cpp @@ -40,7 +40,7 @@ namespace Gecode { /** * \brief Allocator for position sets */ - typedef Support::BlockAllocator PosSetAllocator; + using PosSetAllocator = Support::BlockAllocator; class NodeInfo; class PosInfo; @@ -79,14 +79,14 @@ namespace Gecode { /// Print expression to \a os void to_string(std::ostringstream& os) const; /// Print expression - std::string to_string(void) const; + std::string to_string() const; static void* operator new(size_t); static void operator delete(void*); private: /// Deallocate memory - void dispose(void); + void dispose(); }; /* @@ -104,7 +104,7 @@ namespace Gecode { } void - REG::Exp::dispose(void) { + REG::Exp::dispose() { Region region; Support::DynamicStack todo(region); todo.push(this); @@ -195,11 +195,10 @@ namespace Gecode { GECODE_NEVER; } GECODE_NEVER; - return; } std::string - REG::Exp::to_string(void) const { + REG::Exp::to_string() const { std::ostringstream os; to_string(os); return os.str(); @@ -214,13 +213,13 @@ namespace Gecode { REG::REG(Exp* f) : e(f) {} - REG::REG(void) : e(nullptr) {} + REG::REG() : e(nullptr) {} REG::REG(const REG& r) : e(r.e) { REG::Exp::inc(e); } - const REG& + REG& REG::operator=(const REG& r) { if (&r != this) { REG::Exp::inc(r.e); @@ -230,7 +229,7 @@ namespace Gecode { return *this; } - REG::~REG(void) { + REG::~REG() { REG::Exp::dec(e); } @@ -354,7 +353,7 @@ namespace Gecode { } REG - REG::operator*(void) { + REG::operator*() { if ((e == nullptr) || (e->type == REG::Exp::ET_STAR)) return *this; Exp* f = new Exp(); @@ -421,12 +420,12 @@ namespace Gecode { } REG - REG::operator+(void) { + REG::operator+() { return this->operator()(1); } std::string - REG::to_string(void) const { + REG::to_string() const { if (e == nullptr) { return "[]"; } @@ -456,7 +455,7 @@ namespace Gecode { int pos; PosSet* next; - PosSet(void) = default; + PosSet() = default; PosSet(int); bool in(int) const; @@ -654,7 +653,7 @@ namespace Gecode { /** * \brief Allocator for state nodes */ - typedef Support::BlockAllocator StatePoolAllocator; + using StatePoolAllocator = Support::BlockAllocator; /** * \brief %Node together with state information @@ -680,8 +679,8 @@ namespace Gecode { StatePool(PosSet*); - StateNode* pop(void); - bool empty(void) const; + StateNode* pop(); + bool empty() const; int state(StatePoolAllocator&, PosSet*); }; @@ -699,7 +698,7 @@ namespace Gecode { } forceinline StateNode* - StatePool::pop(void) { + StatePool::pop() { StateNode* n = next; next = n->next; n->next = all; @@ -708,7 +707,7 @@ namespace Gecode { } forceinline bool - StatePool::empty(void) const { + StatePool::empty() const { return next == nullptr; } @@ -769,14 +768,14 @@ namespace Gecode { int n; public: - TransitionBag(void); + TransitionBag(); void add(int, int, int); - void finish(void); - DFA::Transition* transitions(void); + void finish(); + DFA::Transition* transitions(); }; forceinline - TransitionBag::TransitionBag(void) + TransitionBag::TransitionBag() : t(heap), n(0) {} forceinline void @@ -788,12 +787,12 @@ namespace Gecode { } forceinline void - TransitionBag::finish(void) { + TransitionBag::finish() { t[n].i_state = -1; } forceinline DFA::Transition* - TransitionBag::transitions(void) { + TransitionBag::transitions() { return &t[0]; } @@ -807,14 +806,14 @@ namespace Gecode { int n; public: - FinalBag(void); + FinalBag(); void add(int); - void finish(void); - int* finals(void); + void finish(); + int* finals(); }; forceinline - FinalBag::FinalBag(void) + FinalBag::FinalBag() : f(heap), n(0) {} forceinline void @@ -823,19 +822,19 @@ namespace Gecode { } forceinline void - FinalBag::finish(void) { + FinalBag::finish() { f[n] = -1; } forceinline int* - FinalBag::finals(void) { + FinalBag::finals() { return &f[0]; } } // namespace MiniModel REG:: - operator DFA(void) { + operator DFA() { using MiniModel::NodeInfo; using MiniModel::PosInfo; using MiniModel::PosSet; diff --git a/gecode/minimodel/set-expr.cpp b/gecode/minimodel/set-expr.cpp index 38c0ad547b..ff23d74c87 100644 --- a/gecode/minimodel/set-expr.cpp +++ b/gecode/minimodel/set-expr.cpp @@ -40,7 +40,7 @@ namespace Gecode { namespace { /// Check if types agree - static bool + bool same(SetExpr::NodeType t0, SetExpr::NodeType t1) { return (t0 == t1) || (t1 == SetExpr::NT_VAR) || (t1 == SetExpr::NT_CONST) || (t1 == SetExpr::NT_LEXP); } @@ -65,10 +65,10 @@ namespace Gecode { LinIntExpr e; /// Default constructor - Node(void); + Node(); /// Decrement reference count and possibly free memory GECODE_MINIMODEL_EXPORT - bool decrement(void); + bool decrement(); /// Memory management static void* operator new(size_t size); /// Memory management @@ -79,7 +79,7 @@ namespace Gecode { * Operations for nodes * */ - SetExpr::Node::Node(void) : use(1) {} + SetExpr::Node::Node() : use(1) {} void* SetExpr::Node::operator new(size_t size) { @@ -91,7 +91,7 @@ namespace Gecode { } bool - SetExpr::Node::decrement(void) { + SetExpr::Node::decrement() { if (--use == 0) { if ((l != nullptr) && l->decrement()) delete l; @@ -106,8 +106,8 @@ namespace Gecode { /// %Node for negation normalform (%NNF) class NNF { public: - typedef SetExpr::NodeType NodeType; - typedef SetExpr::Node Node; + using NodeType = SetExpr::NodeType; + using Node = SetExpr::Node; /// Type of node NodeType t; /// Number of positive literals for node type @@ -184,8 +184,9 @@ namespace Gecode { rel(home, u.a.x->x, srt, bc); break; } - } else + } else { rel(home, u.a.x->x, srt, s); + } break; case SetExpr::NT_CONST: { IntSet ss; @@ -225,9 +226,9 @@ namespace Gecode { if (i == 2) { rel(home, bs[0], SOT_INTERSECTION, bs[1], srt, s); } else { - if (srt == SRT_EQ) + if (srt == SRT_EQ) { rel(home, SOT_INTERSECTION, bs, s); - else { + } else { SetVar bc(home, IntSet::empty, IntSet(Set::Limits::min, Set::Limits::max)); rel(home, SOT_INTERSECTION, bs, bc); rel(home, bc, srt, s); @@ -241,9 +242,9 @@ namespace Gecode { if (i == 2) { rel(home, bs[0], SOT_UNION, bs[1], srt, s); } else { - if (srt == SRT_EQ) + if (srt == SRT_EQ) { rel(home, SOT_UNION, bs, s); - else { + } else { SetVar bc(home, IntSet::empty, IntSet(Set::Limits::min, Set::Limits::max)); rel(home, SOT_UNION, bs, bc); rel(home, bc, srt, s); @@ -274,18 +275,18 @@ namespace Gecode { } else { SetVar br(home, IntSet::empty, IntSet(Set::Limits::min, Set::Limits::max)); rel(home, SOT_DISJOINT_UNION, bs, br); - if (srt == SRT_EQ) + if (srt == SRT_EQ) { rel(home, br, SRT_COMPLEMENT, s); - else { + } else { SetVar bc(home, IntSet::empty, IntSet(Set::Limits::min, Set::Limits::max)); rel(home, br, srt, bc); rel(home, bc, SRT_COMPLEMENT, s); } } } else { - if (srt == SRT_EQ) + if (srt == SRT_EQ) { rel(home, SOT_DISJOINT_UNION, bs, s); - else { + } else { SetVar br(home, IntSet::empty, IntSet(Set::Limits::min, Set::Limits::max)); rel(home, SOT_DISJOINT_UNION, bs, br); rel(home, br, srt, s); @@ -316,8 +317,9 @@ namespace Gecode { rel(home, u.a.x->x, srt, bc, b); break; } - } else + } else { rel(home, u.a.x->x, srt, s, b); + } break; case SetExpr::NT_CONST: { IntSet ss; @@ -394,11 +396,11 @@ namespace Gecode { if (neg) { SetVar br(home, IntSet::empty, IntSet(Set::Limits::min, Set::Limits::max)); rel(home, SOT_DISJOINT_UNION, bs, br); - if (srt == SRT_COMPLEMENT) + if (srt == SRT_COMPLEMENT) { rel(home, br, SRT_EQ, s, b); - else if (srt == SRT_EQ) + } else if (srt == SRT_EQ) { rel(home, br, SRT_COMPLEMENT, s, b); - else { + } else { SetVar bc(home, IntSet::empty, IntSet(Set::Limits::min, Set::Limits::max)); rel(home, br, srt, bc); rel(home, bc, SRT_COMPLEMENT, s, b); @@ -615,7 +617,7 @@ namespace Gecode { } } - const SetExpr& + SetExpr& SetExpr::operator=(const SetExpr& e) { if (this != &e) { if (n != nullptr && n->decrement()) @@ -626,7 +628,7 @@ namespace Gecode { return *this; } - SetExpr::~SetExpr(void) { + SetExpr::~SetExpr() { if (n != nullptr && n->decrement()) delete n; } @@ -646,12 +648,12 @@ namespace Gecode { void SetExpr::post(Home home, SetRelType srt, const SetExpr& e) const { Region r; - return NNF::nnf(r, n, false)->post(home, srt, NNF::nnf(r, e.n, false)); + NNF::nnf(r, n, false)->post(home, srt, NNF::nnf(r, e.n, false)); } void SetExpr::post(Home home, BoolVar b, bool t, SetRelType srt, const SetExpr& e) const { Region r; - return NNF::nnf(r, n, false)->post(home, b, t, srt, NNF::nnf(r, e.n, false)); + NNF::nnf(r, n, false)->post(home, b, t, srt, NNF::nnf(r, e.n, false)); } SetExpr diff --git a/gecode/minimodel/set-expr.hpp b/gecode/minimodel/set-expr.hpp index 2d848dc430..1fc2bfc0ff 100644 --- a/gecode/minimodel/set-expr.hpp +++ b/gecode/minimodel/set-expr.hpp @@ -40,7 +40,7 @@ namespace Gecode { */ forceinline - SetExpr::SetExpr(void) + SetExpr::SetExpr() : n(nullptr) {} } // namespace Gecode diff --git a/gecode/minimodel/set-rel.hpp b/gecode/minimodel/set-rel.hpp index 4884a98f18..83702059ae 100644 --- a/gecode/minimodel/set-rel.hpp +++ b/gecode/minimodel/set-rel.hpp @@ -52,13 +52,13 @@ namespace Gecode { forceinline void SetRel::post(Home home, bool t) const { - if (t) + if (t) { _e0.post(home, _srt, _e1); - else if (_srt == SRT_EQ) + } else if (_srt == SRT_EQ) { _e0.post(home, SRT_NQ, _e1); - else if (_srt == SRT_NQ) + } else if (_srt == SRT_NQ) { _e0.post(home, SRT_EQ, _e1); - else { + } else { BoolVar b(home, 0, 0); _e0.post(home, b, true, _srt, _e1); } diff --git a/gecode/search.hh b/gecode/search.hh index 6fb6c57813..ca599afe19 100644 --- a/gecode/search.hh +++ b/gecode/search.hh @@ -75,7 +75,7 @@ #endif -namespace Gecode { namespace Search { +namespace Gecode::Search { /// %Sequential search engine implementations namespace Sequential { @@ -137,11 +137,11 @@ namespace Gecode { namespace Search { const unsigned int cpprofiler_port = 6565U; } // namespace Config -}} // namespace Gecode::Search +} // namespace Gecode::Search #include -namespace Gecode { namespace Search { +namespace Gecode::Search { /** * \brief %Search engine statistics @@ -160,26 +160,26 @@ namespace Gecode { namespace Search { /// Number of no-goods posted unsigned long int nogood; /// Initialize - Statistics(void); + Statistics(); /// Reset - void reset(void); + void reset(); /// Return sum with \a s Statistics operator+(const Statistics& s); /// Increment by statistics \a s Statistics& operator+=(const Statistics& s); }; -}} // namespace Gecode::Search +} // namespace Gecode::Search #include -namespace Gecode { namespace Search { +namespace Gecode::Search { class WrapTraceRecorder; class TraceRecorder; class EdgeTraceRecorder; -}} // namespace Gecode::Search +} // namespace Gecode::Search #include #include @@ -215,33 +215,33 @@ namespace Gecode { public: /// Do not initialize - EngineInfo(void); + EngineInfo(); /// Initialize EngineInfo(EngineType et, unsigned int fst, unsigned int lst); /// \name Engine type information //@{ /// Return engine type - EngineType type(void) const; + EngineType type() const; /// Return whether engine is a meta engine - bool meta(void) const; + bool meta() const; //@} /// \name Information for basic (non-meta) engines //@{ /// Return id of first worker - unsigned int wfst(void) const; + unsigned int wfst() const; /// Return id of last worker plus one - unsigned int wlst(void) const; + unsigned int wlst() const; /// Return number of workers - unsigned int workers(void) const; + unsigned int workers() const; //@} /// \name Information for meta engines //@{ /// Return id of first engine - unsigned int efst(void) const; + unsigned int efst() const; /// Return id of last engine - unsigned int elst(void) const; + unsigned int elst() const; /// Return number of engines - unsigned int engines(void) const; + unsigned int engines() const; //@} }; /// Edge information @@ -262,21 +262,21 @@ namespace Gecode { /// Initialize void init(unsigned int wid, unsigned int nid, unsigned int a, const Space& s, const Choice& c); /// Invalidate edge information (for stealing) - void invalidate(void); + void invalidate(); /// Initialize as non existing - EdgeInfo(void); + EdgeInfo(); /// Initialize EdgeInfo(unsigned int wid, unsigned int nid, unsigned int a); /// Test whether edge actually exists - operator bool(void) const; + operator bool() const; /// Return parent worker id - unsigned int wid(void) const; + unsigned int wid() const; /// Return parent node id - unsigned int nid(void) const; + unsigned int nid() const; /// Return number of alternative - unsigned int alternative(void) const; + unsigned int alternative() const; /// Return string for alternative - std::string string(void) const; + std::string string() const; }; /// Node type enum class NodeType { @@ -303,15 +303,15 @@ namespace Gecode { /// Initialize node info NodeInfo(NodeType nt, unsigned int wid, unsigned int nid, const Space& s, const Choice* c = nullptr); /// Return node type - NodeType type(void) const; + NodeType type() const; /// Return worker id - unsigned int wid(void) const; + unsigned int wid() const; /// Return node id - unsigned int nid(void) const; + unsigned int nid() const; /// Return corresponding space - const Space& space(void) const; + const Space& space() const; /// Return corresponding choice - const Choice& choice(void) const; + const Choice& choice() const; }; private: @@ -334,7 +334,7 @@ namespace Gecode { /// Register new worker void worker(unsigned int& wid, unsigned int& eid); /// Deregister a worker - void worker(void); + void worker(); /// \name Unsynchronized internal calls //{@ /// The engine with id \a eid goes to a next round (restart or next iteration in LDS) @@ -346,13 +346,13 @@ namespace Gecode { //@} public: /// Initialize - SearchTracer(void); + SearchTracer(); /// \name Engine information //@{ /// Return number of workers - unsigned int workers(void) const; + unsigned int workers() const; /// Return number of engines - unsigned int engines(void) const; + unsigned int engines() const; /// Provide access to engine with id \a eid const EngineInfo& engine(unsigned int eid) const; /// Return the engine id of a worker with id \a wid @@ -361,7 +361,7 @@ namespace Gecode { /// \name Trace event functions //@{ /// The search engine initializes - virtual void init(void) = 0; + virtual void init() = 0; /// The engine with id \a eid goes to a next round (restart or next iteration in LDS) virtual void round(unsigned int eid) = 0; /// The engine skips an edge @@ -369,10 +369,10 @@ namespace Gecode { /// The engine creates a new node with information \a ei and \a ni virtual void node(const EdgeInfo& ei, const NodeInfo& ni) = 0; /// All workers are done - virtual void done(void) = 0; + virtual void done() = 0; //@} /// Delete - virtual ~SearchTracer(void); + virtual ~SearchTracer(); }; class GECODE_SEARCH_EXPORT StdSearchTracer : public SearchTracer { @@ -386,7 +386,7 @@ namespace Gecode { /// Initialize with output stream \a os StdSearchTracer(std::ostream& os = std::cerr); /// The search engine initializes - void init(void) override; + void init() override; /// The engine with id \a eid goes to a next round (restart or next iteration in LDS) void round(unsigned int eid) override; /// The engine skips an edge @@ -394,9 +394,9 @@ namespace Gecode { /// The engine creates a new node with information \a ei and \a ni void node(const EdgeInfo& ei, const NodeInfo& ni) override; /// All workers are done - void done(void) override; + void done() override; /// Delete - ~StdSearchTracer(void) override; + ~StdSearchTracer() override; /// Default tracer (printing to std::cerr) static StdSearchTracer def; }; @@ -408,20 +408,14 @@ namespace Gecode { #ifdef GECODE_HAS_CPPROFILER -namespace Gecode { - - /// Code that is specific to the CPProfiler - namespace CPProfiler { - } +/// Code that is specific to the CPProfiler -} // namespace Gecode - -namespace Gecode { namespace CPProfiler { +namespace Gecode::CPProfiler { /// The actual connector to the CPProfiler class Connector; -}} // namespace Gecode::CPProfiler +} // namespace Gecode::CPProfiler namespace Gecode { @@ -432,11 +426,11 @@ namespace Gecode { class GECODE_SEARCH_EXPORT GetInfo : public HeapAllocated { public: /// Initialize - GetInfo(void) = default; + GetInfo() = default; /// Return info for a space virtual std::string get_info(const Space& home) const = 0; /// Delete - virtual ~GetInfo(void); + virtual ~GetInfo(); }; private: @@ -456,7 +450,7 @@ namespace Gecode { CPProfilerSearchTracer(int eid, std::string name, unsigned int port = Search::Config::cpprofiler_port, const GetInfo* pgi = nullptr); /// The search engine initializes - void init(void) override; + void init() override; /// The engine with id \a eid goes to a next round (restart or next iteration in LDS) void round(unsigned int eid) override; /// The engine skips an edge @@ -464,16 +458,16 @@ namespace Gecode { /// The engine creates a new node with information \a ei and \a ni void node(const EdgeInfo& ei, const NodeInfo& ni) override; /// All workers are done - void done(void) override; + void done() override; /// Delete - ~CPProfilerSearchTracer(void) override; + ~CPProfilerSearchTracer() override; }; } // namespace Gecode #endif -namespace Gecode { namespace Search { +namespace Gecode::Search { /** * \brief Base class for cutoff generators for restart-based meta engine @@ -484,11 +478,11 @@ namespace Gecode { namespace Search { /// \name Constructors and member functions //@{ /// Default constructor - Cutoff(void) = default; + Cutoff() = default; /// Return the current cutoff value - virtual unsigned long long int operator()(void) const = 0; + virtual unsigned long long int operator()() const = 0; /// Increment and return the next cutoff value - virtual unsigned long long int operator++(void) = 0; + virtual unsigned long long int operator++() = 0; /** * \brief Return a copy of this generator in its current state * @@ -497,9 +491,9 @@ namespace Gecode { namespace Search { * (see CutoffRandom::copy()). A portfolio of restart-based engines * gives each asset its own copy. */ - virtual Cutoff* copy(void) const = 0; + virtual Cutoff* copy() const = 0; /// Destructor - virtual ~Cutoff(void); + virtual ~Cutoff(); //@} /// \name Predefined cutoff generators //@{ @@ -541,11 +535,11 @@ namespace Gecode { namespace Search { /// Constructor CutoffConstant(unsigned long long int c); /// Return the current cutoff value - unsigned long long int operator()(void) const override; + unsigned long long int operator()() const override; /// Increment and return the next cutoff value - unsigned long long int operator++(void) override; + unsigned long long int operator++() override; /// Return a copy of this generator in its current state - Cutoff* copy(void) const override; + Cutoff* copy() const override; }; /** @@ -563,11 +557,11 @@ namespace Gecode { namespace Search { /// Constructor CutoffLinear(unsigned long long int scale); /// Return the current cutoff value - unsigned long long int operator()(void) const override; + unsigned long long int operator()() const override; /// Increment and return the next cutoff value - unsigned long long int operator++(void) override; + unsigned long long int operator++() override; /// Return a copy of this generator in its current state - Cutoff* copy(void) const override; + Cutoff* copy() const override; }; /** @@ -593,11 +587,11 @@ namespace Gecode { namespace Search { /// Constructor CutoffLuby(unsigned long long int scale); /// Return the current cutoff value - unsigned long long int operator()(void) const override; + unsigned long long int operator()() const override; /// Increment and return the next cutoff value - unsigned long long int operator++(void) override; + unsigned long long int operator++() override; /// Return a copy of this generator in its current state - Cutoff* copy(void) const override; + Cutoff* copy() const override; }; /** @@ -617,11 +611,11 @@ namespace Gecode { namespace Search { /// Constructor CutoffGeometric(unsigned long long int scale, double base); /// Return the current cutoff value - unsigned long long int operator()(void) const override; + unsigned long long int operator()() const override; /// Increment and return the next cutoff value - unsigned long long int operator++(void) override; + unsigned long long int operator++() override; /// Return a copy of this generator in its current state - Cutoff* copy(void) const override; + Cutoff* copy() const override; }; /** @@ -648,9 +642,9 @@ namespace Gecode { namespace Search { CutoffRandom(unsigned int seed, unsigned long long int min, unsigned long long int max, unsigned long long int n); /// Return the current cutoff value - unsigned long long int operator()(void) const override; + unsigned long long int operator()() const override; /// Increment and return the next cutoff value - unsigned long long int operator++(void) override; + unsigned long long int operator++() override; /** * \brief Return a copy of this generator with its own random sequence * @@ -661,7 +655,7 @@ namespace Gecode { namespace Search { * portfolio restart at different times, and the same program * creates the same sequences. */ - Cutoff* copy(void) const override; + Cutoff* copy() const override; }; /** @@ -679,15 +673,15 @@ namespace Gecode { namespace Search { public: /// Constructor - CutoffAppend(Cutoff* c1, unsigned long long int n, Cutoff* c2); + CutoffAppend(Cutoff* d1, unsigned long long int n, Cutoff* d2); /// Return the current cutoff value - unsigned long long int operator()(void) const override; + unsigned long long int operator()() const override; /// Increment and return the next cutoff value - unsigned long long int operator++(void) override; + unsigned long long int operator++() override; /// Return a copy of this generator in its current state - Cutoff* copy(void) const override; + Cutoff* copy() const override; /// Destructor - ~CutoffAppend(void) override; + ~CutoffAppend() override; }; /** @@ -703,15 +697,15 @@ namespace Gecode { namespace Search { public: /// Constructor - CutoffMerge(Cutoff* c1, Cutoff* c2); + CutoffMerge(Cutoff* d1, Cutoff* d2); /// Return the current cutoff value - unsigned long long int operator()(void) const override; + unsigned long long int operator()() const override; /// Increment and return the next cutoff value - unsigned long long int operator++(void) override; + unsigned long long int operator++() override; /// Return a copy of this generator in its current state - Cutoff* copy(void) const override; + Cutoff* copy() const override; /// Destructor - ~CutoffMerge(void) override; + ~CutoffMerge() override; }; /** @@ -733,20 +727,20 @@ namespace Gecode { namespace Search { /// Constructor CutoffRepeat(Cutoff* c, unsigned long long int n); /// Return the current cutoff value - unsigned long long int operator()(void) const override; + unsigned long long int operator()() const override; /// Increment and return the next cutoff value - unsigned long long int operator++(void) override; + unsigned long long int operator++() override; /// Return a copy of this generator in its current state - Cutoff* copy(void) const override; + Cutoff* copy() const override; /// Destructor - ~CutoffRepeat(void) override; + ~CutoffRepeat() override; }; -}} // namespace Gecode::Search +} // namespace Gecode::Search #include -namespace Gecode { namespace Search { +namespace Gecode::Search { class WorkerControlAccess; @@ -813,7 +807,7 @@ namespace Gecode { namespace Search { public: /// Construct an empty handle - WorkerControl(void) noexcept; + WorkerControl() noexcept; /// Construct an engaged handle with initial request \a requested (zero pauses) explicit WorkerControl(unsigned int requested); /// Copy constructor @@ -821,11 +815,11 @@ namespace Gecode { namespace Search { /// Assignment operator WorkerControl& operator=(const WorkerControl& control); /// Destructor - ~WorkerControl(void); + ~WorkerControl(); /// Whether this handle is engaged - bool engaged(void) const noexcept; + bool engaged() const noexcept; /// Return the requested number of workers (zero also denotes an empty handle) - unsigned int requested(void) const noexcept; + unsigned int requested() const noexcept; /** * \brief Request \a workers workers (zero pauses the engine) * @@ -836,7 +830,7 @@ namespace Gecode { namespace Search { */ void request(unsigned int workers); /// Return the fixed worker capacity, or zero before attachment - unsigned int capacity(void) const noexcept; + unsigned int capacity() const noexcept; }; class Stop; @@ -924,18 +918,18 @@ namespace Gecode { namespace Search { /// Default options GECODE_SEARCH_EXPORT static const Options def; /// Initialize with default values - Options(void); + Options(); /// Expand with real number of threads - GECODE_SEARCH_EXPORT Options expand(void) const; + GECODE_SEARCH_EXPORT Options expand() const; }; -}} // namespace Gecode::Search +} // namespace Gecode::Search #include #include -namespace Gecode { namespace Search { +namespace Gecode::Search { /** * \defgroup TaskModelSearchStop Stop-objects for stopping search @@ -956,11 +950,11 @@ namespace Gecode { namespace Search { /// \name Constructors and member functions //@{ /// Default constructor - Stop(void) = default; + Stop() = default; /// Stop search, if returns true virtual bool stop(const Statistics& s, const Options& o) = 0; /// Destructor - virtual ~Stop(void); + virtual ~Stop(); //@} /// \name Predefined stop objects //@{ @@ -996,7 +990,7 @@ namespace Gecode { namespace Search { /// Assignment operator NodeStop& operator=(const NodeStop& s); /// Return current limit - unsigned long long int limit(void) const; + unsigned long long int limit() const; /// Set current limit to \a l nodes void limit(unsigned long long int l); /// Return true if node limit is exceeded @@ -1024,7 +1018,7 @@ namespace Gecode { namespace Search { /// Assignment operator FailStop& operator=(const FailStop& s); /// Return current limit - unsigned long long int limit(void) const; + unsigned long long int limit() const; /// Set current limit to \a l failures void limit(unsigned long long int l); /// Return true if failure limit is exceeded @@ -1057,11 +1051,11 @@ namespace Gecode { namespace Search { /// Assignment operator TimeStop& operator=(const TimeStop& s); /// Return current limit in milliseconds - double limit(void) const; + double limit() const; /// Set current limit to \a l milliseconds void limit(double l); /// Reset time to zero - void reset(void); + void reset(); /// Return true if time limit is exceeded bool stop(const Statistics& s, const Options& o) override; }; @@ -1083,18 +1077,18 @@ namespace Gecode { namespace Search { /// Assignment operator RestartStop& operator=(const RestartStop& s); /// Return current limit - unsigned long long int limit(void) const; + unsigned long long int limit() const; /// Set current limit to \a l restarts void limit(unsigned long long int l); /// Return true if failure limit is exceeded bool stop(const Statistics& s, const Options& o) override; }; -}} // namespace Gecode::Search +} // namespace Gecode::Search #include -namespace Gecode { namespace Search { +namespace Gecode::Search { /** * \brief Why the last call to next() of a search engine returned no solution @@ -1136,32 +1130,32 @@ namespace Gecode { namespace Search { /// Control retained for the lifetime of a leaf engine WorkerControl worker_control; /// Construct a meta engine without worker control - Engine(void); + Engine(); /// Construct a leaf engine and bind worker control to \a capacity Engine(const Options& o, unsigned int capacity); public: /// Return next solution (nullptr, if none exists or search has been stopped) - virtual Space* next(void) = 0; + virtual Space* next() = 0; /// Return statistics - virtual Statistics statistics(void) const = 0; + virtual Statistics statistics() const = 0; /// Return why the last call to next() returned no solution - virtual EndReason end_reason(void) const = 0; + virtual EndReason end_reason() const = 0; /// Constrain future solutions to be better than \a b (raises exception) virtual void constrain(const Space& b); /// Reset engine to restart at space \a s (does nothing) virtual void reset(Space* s); /// Return no-goods (the no-goods are empty) - virtual NoGoods& nogoods(void); + virtual NoGoods& nogoods(); /// Destructor - virtual ~Engine(void); + virtual ~Engine(); }; -}} // namespace Gecode::Search +} // namespace Gecode::Search #include -namespace Gecode { namespace Search { +namespace Gecode::Search { /// Base-class for search engines template @@ -1179,26 +1173,25 @@ namespace Gecode { namespace Search { public: /// Return next solution (nullptr, if none exists or search has been stopped) - virtual T* next(void); + virtual T* next(); /// Return statistics - virtual Statistics statistics(void) const; + virtual Statistics statistics() const; /// Return why the last call to next() returned no solution - virtual EndReason end_reason(void) const; + virtual EndReason end_reason() const; /// Destructor - virtual ~Base(void); + virtual ~Base(); - public: /// Disallow copy constructor Base(const Base&) = delete; /// Disallow assignment operator Base& operator=(const Base&) = delete; }; -}} // namespace Gecode::Search +} // namespace Gecode::Search #include -namespace Gecode { namespace Search { +namespace Gecode::Search { /// Build an engine of type \a E for a script \a T template @@ -1216,28 +1209,28 @@ namespace Gecode { namespace Search { const bool b; public: - /// Initialize with options \a opt and \a best solution search support - Builder(const Options& opt, bool best); + /// Initialize with options \a opt and \a b0 solution search support + Builder(const Options& opt, bool b0); /// Provide access to options - Options& options(void); + Options& options(); /// Provide access to options - const Options& options(void) const; + const Options& options() const; /// Whether engine is a best solution search engine - bool best(void) const; + bool best() const; /// Build an engine according to stored options for \a s virtual Engine* operator()(Space* s) const = 0; /// Destructor - virtual ~Builder(void); + virtual ~Builder(); }; -}} // namespace Gecode::Search +} // namespace Gecode::Search #include namespace Gecode { /// Type for a search engine builder - typedef Search::Builder* SEB; + using SEB = Search::Builder*; } // namespace Gecode @@ -1251,7 +1244,7 @@ namespace Gecode { /// \name Constructors and initialization //@{ /// Allocate empty array - SEBs(void); + SEBs(); /// Allocate array with \a n elements explicit SEBs(int n); /// Allocate array and copy elements from \a x @@ -1301,7 +1294,7 @@ namespace Gecode { #include #ifdef GECODE_HAS_EXPERIMENTAL -namespace Gecode { namespace Search { +namespace Gecode::Search { /** * \brief Guidance for heuristic search engines (experimental) @@ -1333,7 +1326,7 @@ namespace Gecode { namespace Search { class HeuristicGuidance { public: /// Function evaluating a stable space - typedef std::function Evaluate; + using Evaluate = std::function; /// Objective direction Sense sense; /// Optimistic objective bound (required) @@ -1349,7 +1342,7 @@ namespace Gecode { namespace Search { : sense(s), bound(std::move(b)), rank(std::move(r)) {} }; -}} // namespace Gecode::Search +} // namespace Gecode::Search namespace Gecode { @@ -1583,7 +1576,7 @@ namespace Gecode { #include -namespace Gecode { namespace Search { namespace Meta { +namespace Gecode::Search::Meta { /// Build a sequential engine template class E> @@ -1605,7 +1598,7 @@ namespace Gecode { namespace Search { namespace Meta { #endif -}}} // namespace Gecode::Search::Meta +} // namespace Gecode::Search::Meta namespace Gecode { diff --git a/gecode/search/astar.cpp b/gecode/search/astar.cpp index bb51f39a84..6382aa09c6 100644 --- a/gecode/search/astar.cpp +++ b/gecode/search/astar.cpp @@ -38,7 +38,7 @@ #ifdef GECODE_HAS_EXPERIMENTAL #ifdef GECODE_HAS_THREADS -namespace Gecode { namespace Search { namespace Par { +namespace Gecode::Search::Par { /// Parallel A* search class AStar : public Frontier { @@ -46,11 +46,11 @@ namespace Gecode { namespace Search { namespace Par { /// Open nodes Queue queue; bool - open(void) const override { + open() const override { return !queue.empty(); } Entry - select(void) override { + select() override { return queue.pop(); } void @@ -65,11 +65,11 @@ namespace Gecode { namespace Search { namespace Par { queue.push(f); } bool - advance(void) override { + advance() override { return false; } void - clear(void) override { + clear() override { queue.clear(); } @@ -79,15 +79,15 @@ namespace Gecode { namespace Search { namespace Par { initialize(s, o.clone); } /// Destructor - ~AStar(void) override { + ~AStar() override { terminate(); } }; -}}} // namespace Gecode::Search::Par +} // namespace Gecode::Search::Par #endif -namespace Gecode { namespace Search { +namespace Gecode::Search { Engine* make_astar_engine(Space* s, const Options& o) { @@ -103,9 +103,9 @@ namespace Gecode { namespace Search { return new WorkerToEngine(s, e); } -}} // namespace Gecode::Search +} // namespace Gecode::Search -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { AStar::AStar(Space* s, const Options& o) : opt(o), guidance(*o.guidance), queue(Priority{guidance.sense, false}), order(0), status(SS_FAILED), depth(0), @@ -153,7 +153,7 @@ namespace Gecode { namespace Search { namespace Seq { } Space* - AStar::next(void) { + AStar::next() { start(); while (true) { if (stop_seq(opt)) @@ -209,7 +209,7 @@ namespace Gecode { namespace Search { namespace Seq { } Statistics - AStar::statistics(void) const { + AStar::statistics() const { return *this; } @@ -236,11 +236,11 @@ namespace Gecode { namespace Search { namespace Seq { } NoGoods& - AStar::nogoods(void) { + AStar::nogoods() { return NoGoods::eng; } -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq #endif diff --git a/gecode/search/astar.hpp b/gecode/search/astar.hpp index f2b1c9ce79..1993916346 100644 --- a/gecode/search/astar.hpp +++ b/gecode/search/astar.hpp @@ -31,7 +31,7 @@ */ #ifdef GECODE_HAS_EXPERIMENTAL -namespace Gecode { namespace Search { +namespace Gecode::Search { /// Create A* engine GECODE_SEARCH_EXPORT Engine* make_astar_engine(Space* s, const Options& o); @@ -57,7 +57,7 @@ namespace Gecode { namespace Search { return build(s, opt); } -}} // namespace Gecode::Search +} // namespace Gecode::Search namespace Gecode { diff --git a/gecode/search/bab.cpp b/gecode/search/bab.cpp index 85915b9a40..be43133053 100644 --- a/gecode/search/bab.cpp +++ b/gecode/search/bab.cpp @@ -38,7 +38,7 @@ #include #endif -namespace Gecode { namespace Search { +namespace Gecode::Search { Engine* make_bab_engine(Space* s, const Options& o) { @@ -47,14 +47,12 @@ namespace Gecode { namespace Search { if (to.threads == 1.0) { if (to.tracer) return new WorkerToEngine>(s, to); - else - return new WorkerToEngine>(s, to); - } else { - if (to.tracer) - return new Par::BAB(s, to); - else - return new Par::BAB(s, to); + return new WorkerToEngine>(s, to); } + if (to.tracer) + return new Par::BAB(s, to); + return new Par::BAB(s, to); + #else if (to.tracer) return new WorkerToEngine>(s, to); @@ -63,6 +61,6 @@ namespace Gecode { namespace Search { #endif } -}} // namespace Gecode::Search +} // namespace Gecode::Search // STATISTICS: search-other diff --git a/gecode/search/bab.hpp b/gecode/search/bab.hpp index dbd684ee93..6aa0366c36 100644 --- a/gecode/search/bab.hpp +++ b/gecode/search/bab.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Search { +namespace Gecode::Search { /// Create branch and bound engine GECODE_SEARCH_EXPORT Engine* make_bab_engine(Space* s, const Options& o); @@ -60,7 +60,7 @@ namespace Gecode { namespace Search { return build(s, opt); } -}} // namespace Gecode::Search +} // namespace Gecode::Search namespace Gecode { diff --git a/gecode/search/base.hpp b/gecode/search/base.hpp index 1b13450b64..f1046c7d7a 100644 --- a/gecode/search/base.hpp +++ b/gecode/search/base.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Search { +namespace Gecode::Search { template forceinline @@ -42,24 +42,24 @@ namespace Gecode { namespace Search { : e(e0) {} template forceinline T* - Base::next(void) { + Base::next() { return dynamic_cast(e->next()); } template forceinline Statistics - Base::statistics(void) const { + Base::statistics() const { return e->statistics(); } template forceinline EndReason - Base::end_reason(void) const { + Base::end_reason() const { return e->end_reason(); } template - forceinline Base::~Base(void) { + forceinline Base::~Base() { delete e; } -}} // namespace Gecode::Search +} // namespace Gecode::Search // STATISTICS: search-other diff --git a/gecode/search/build.hpp b/gecode/search/build.hpp index 552a3c4e92..1bc57276ee 100644 --- a/gecode/search/build.hpp +++ b/gecode/search/build.hpp @@ -30,21 +30,21 @@ * */ -namespace Gecode { namespace Search { +namespace Gecode::Search { forceinline Builder::Builder(const Options& opt0, bool b0) : opt(opt0.expand()), b(b0) {} forceinline Options& - Builder::options(void) { + Builder::options() { return opt; } forceinline const Options& - Builder::options(void) const { + Builder::options() const { return opt; } forceinline bool - Builder::best(void) const { + Builder::best() const { return b; } @@ -68,6 +68,6 @@ namespace Gecode { namespace Search { return e; } -}} // namespace Gecode::Search +} // namespace Gecode::Search // STATISTICS: search-other diff --git a/gecode/search/cabs.cpp b/gecode/search/cabs.cpp index fd7726215c..c8e029c1e6 100644 --- a/gecode/search/cabs.cpp +++ b/gecode/search/cabs.cpp @@ -34,11 +34,12 @@ #include #include #include +#include #ifdef GECODE_HAS_EXPERIMENTAL #ifdef GECODE_HAS_THREADS -namespace Gecode { namespace Search { namespace Par { +namespace Gecode::Search::Par { /// Parallel complete anytime beam search class CABS : public Frontier { @@ -52,11 +53,11 @@ namespace Gecode { namespace Search { namespace Par { /// Candidates for the next layer Beam candidates; bool - open(void) const override { + open() const override { return !layer.empty(); } Entry - select(void) override { + select() override { return layer.pop(); } void @@ -79,7 +80,7 @@ namespace Gecode { namespace Search { namespace Par { } } bool - advance(void) override { + advance() override { if (!candidates.empty()) { candidates.release(layer); layer.sort(priority); @@ -92,13 +93,13 @@ namespace Gecode { namespace Search { namespace Par { return false; } stat.restart++; - std::unique_ptr t(new Task); + std::unique_ptr t = std::make_unique(); t->expansion.select(std::unique_ptr(root->clone())); push(t.release()); return true; } void - clear(void) override { + clear() override { layer.clear(); candidates.clear(); root.reset(); @@ -118,19 +119,15 @@ namespace Gecode { namespace Search { namespace Par { initialize(s, o.clone); } /// Destructor - ~CABS(void) override { + ~CABS() override { terminate(); } }; -}}} // namespace Gecode::Search::Par +} // namespace Gecode::Search::Par #endif -namespace Gecode { namespace Search { namespace Seq { - -}}} // namespace Gecode::Search::Seq - -namespace Gecode { namespace Search { +namespace Gecode::Search { Engine* make_cabs_engine(Space* s, const Options& o) { @@ -146,9 +143,9 @@ namespace Gecode { namespace Search { return new WorkerToEngine(s, e); } -}} // namespace Gecode::Search +} // namespace Gecode::Search -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { CABS::CABS(Space* s, const Options& o) : opt(o), guidance(*o.guidance), priority{guidance.sense, static_cast(guidance.rank)}, @@ -209,7 +206,7 @@ namespace Gecode { namespace Search { namespace Seq { } bool - CABS::advance(void) { + CABS::advance() { if (!candidates.empty()) { candidates.release(layer); layer.sort(priority); @@ -231,7 +228,7 @@ namespace Gecode { namespace Search { namespace Seq { } Space* - CABS::next(void) { + CABS::next() { if (_limited) { _stopped = true; return nullptr; @@ -294,12 +291,12 @@ namespace Gecode { namespace Search { namespace Seq { } Statistics - CABS::statistics(void) const { + CABS::statistics() const { return *this; } EndReason - CABS::end_reason(void) const { + CABS::end_reason() const { return _limited ? EndReason::Incomplete : Worker::end_reason(); } @@ -328,11 +325,11 @@ namespace Gecode { namespace Search { namespace Seq { } NoGoods& - CABS::nogoods(void) { + CABS::nogoods() { return NoGoods::eng; } -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq #endif diff --git a/gecode/search/cabs.hpp b/gecode/search/cabs.hpp index aa52194a0e..4d1fd08ab9 100644 --- a/gecode/search/cabs.hpp +++ b/gecode/search/cabs.hpp @@ -31,7 +31,7 @@ */ #ifdef GECODE_HAS_EXPERIMENTAL -namespace Gecode { namespace Search { +namespace Gecode::Search { /// Create CABS engine GECODE_SEARCH_EXPORT Engine* make_cabs_engine(Space* s, const Options& o); @@ -57,7 +57,7 @@ namespace Gecode { namespace Search { return build(s, opt); } -}} // namespace Gecode::Search +} // namespace Gecode::Search namespace Gecode { diff --git a/gecode/search/cpprofiler/connector.hpp b/gecode/search/cpprofiler/connector.hpp index b4ddbabc75..17765032a7 100644 --- a/gecode/search/cpprofiler/connector.hpp +++ b/gecode/search/cpprofiler/connector.hpp @@ -41,7 +41,7 @@ #include #include -#if defined(_WIN32) +#ifdef _WIN32 #include #include @@ -52,7 +52,7 @@ #endif #include -typedef SSIZE_T ssize_t; +using ssize_t = SSIZE_T; #else @@ -62,7 +62,7 @@ typedef SSIZE_T ssize_t; #endif -namespace Gecode { namespace CPProfiler { +namespace Gecode::CPProfiler { class Node { NodeUID node_; @@ -106,12 +106,12 @@ namespace Gecode { namespace CPProfiler { int socket_fd; bool _connected; -#if defined(_WIN32) +#ifdef _WIN32 bool _winsock_started; #endif static int send_all(int s, const char* buf, int* len); - void send_over_socket(void); + void send_over_socket(); void send_raw_msg(const std::vector& buf); public: @@ -121,7 +121,7 @@ namespace Gecode { namespace CPProfiler { /// connect to a socket via port specified in the construction (6565 by /// default) - void connect(void); + void connect(); // sends START_SENDING message to the Profiler with a model name void start(const std::string& file_path = "", int execution_id = -1, bool has_restarts = false); @@ -129,7 +129,7 @@ namespace Gecode { namespace CPProfiler { void done(); /// disconnect from a socket - void disconnect(void); + void disconnect(); void send_node(const Node& node); Node create_node(NodeUID node, NodeUID parent, int alt, int kids, NodeStatus status); @@ -233,7 +233,7 @@ namespace Gecode { namespace CPProfiler { */ inline Connector::Connector(unsigned int port) : port(port), socket_fd(-1), _connected(false) -#if defined(_WIN32) +#ifdef _WIN32 , _winsock_started(false) #endif @@ -273,7 +273,7 @@ namespace Gecode { namespace CPProfiler { bytes_left -= static_cast(n); } - *len = static_cast(total); // return number actually sent here + *len = total; // return number actually sent here return (n == -1) ? -1 : 0; // return -1 on failure, 0 on success } @@ -288,7 +288,7 @@ namespace Gecode { namespace CPProfiler { } inline void - Connector::send_over_socket(void) { + Connector::send_over_socket() { if (!_connected) return; @@ -298,11 +298,11 @@ namespace Gecode { namespace CPProfiler { } inline void - Connector::connect(void) { + Connector::connect() { struct addrinfo hints, *server_info, *p; int rv; -#if defined(_WIN32) +#ifdef _WIN32 // Initialise Winsock. WSADATA winsock_data; int startup_result = WSAStartup(MAKEWORD(2, 2), &winsock_data); @@ -317,20 +317,22 @@ namespace Gecode { namespace CPProfiler { hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; - if ((rv = getaddrinfo("localhost", std::to_string(port).c_str(), &hints, &server_info)) != 0) { + rv = getaddrinfo("localhost", std::to_string(port).c_str(), &hints, &server_info); + if (rv != 0) { std::cerr << "getaddrinfo: " << gai_strerror(rv) << "\n"; goto give_up; } // loop through all the results and connect to the first we can for (p = server_info; p != nullptr; p = p->ai_next) { - if ((socket_fd = static_cast(socket(p->ai_family, p->ai_socktype, p->ai_protocol))) == -1) { + socket_fd = socket(p->ai_family, p->ai_socktype, p->ai_protocol); + if (socket_fd == -1) { // errno is set here, but we don't examine it. continue; } if (::connect(socket_fd, p->ai_addr, p->ai_addrlen) == -1) { -#if defined(_WIN32) +#ifdef _WIN32 closesocket(socket_fd); #else close(socket_fd); @@ -356,13 +358,12 @@ namespace Gecode { namespace CPProfiler { return; give_up: _connected = false; -#if defined(_WIN32) +#ifdef _WIN32 if (_winsock_started) { WSACleanup(); _winsock_started = false; } #endif - return; } inline void @@ -371,12 +372,12 @@ namespace Gecode { namespace CPProfiler { std::string base_name(file_path); { size_t pos = base_name.find_last_of('/'); - if (pos != static_cast(-1)) { + if (pos != std::string::npos) { base_name = base_name.substr(pos + 1, base_name.length() - pos - 1); } } - std::string info{""}; + std::string info; { std::stringstream ss; ss << "{"; @@ -396,7 +397,7 @@ namespace Gecode { namespace CPProfiler { inline void Connector::restart(int restart_id) { - std::string info{""}; + std::string info; { std::stringstream ss; ss << "{"; @@ -418,7 +419,7 @@ namespace Gecode { namespace CPProfiler { inline void Connector::disconnect() { if (socket_fd != -1) { -#if defined(_WIN32) +#ifdef _WIN32 closesocket(socket_fd); #else close(socket_fd); @@ -426,7 +427,7 @@ namespace Gecode { namespace CPProfiler { socket_fd = -1; } _connected = false; -#if defined(_WIN32) +#ifdef _WIN32 if (_winsock_started) { WSACleanup(); _winsock_started = false; @@ -456,6 +457,6 @@ namespace Gecode { namespace CPProfiler { return Node(node, parent, alt, kids, status); } -}} // namespace Gecode::CPProfiler +} // namespace Gecode::CPProfiler // STATISTICS: search-trace diff --git a/gecode/search/cpprofiler/message.hpp b/gecode/search/cpprofiler/message.hpp index ff360b3722..24bae1c858 100644 --- a/gecode/search/cpprofiler/message.hpp +++ b/gecode/search/cpprofiler/message.hpp @@ -41,7 +41,7 @@ #include #include -namespace Gecode { namespace CPProfiler { +namespace Gecode::CPProfiler { /// Version of CPProfiler protocol static const int32_t PROFILER_PROTOCOL_VERSION = 3; @@ -69,20 +69,20 @@ namespace Gecode { namespace CPProfiler { public: /// Check whether value is present - bool valid(void) const; + bool valid() const; /// Set value to \a t void set(const T& t); /// Disregard value - void unset(void); + void unset(); /// Access value - const T& value(void) const; + const T& value() const; /// Access value - T& value(void); + T& value(); }; template forceinline bool - Option::valid(void) const { + Option::valid() const { return present; } template @@ -93,18 +93,18 @@ namespace Gecode { namespace CPProfiler { } template forceinline void - Option::unset(void) { + Option::unset() { present = false; } template forceinline const T& - Option::value(void) const { + Option::value() const { assert(present); return value_; } template forceinline T& - Option::value(void) { + Option::value() { assert(present); return value_; } @@ -144,24 +144,24 @@ namespace Gecode { namespace CPProfiler { public: bool - is_node(void) const { + is_node() const { return _type == MsgType::NODE; } bool - is_done(void) const { + is_done() const { return _type == MsgType::DONE; } bool - is_start(void) const { + is_start() const { return _type == MsgType::START; } bool - is_restart(void) const { + is_restart() const { return _type == MsgType::RESTART; } NodeUID - node_uid(void) const { + node_uid() const { return _node; } void @@ -170,7 +170,7 @@ namespace Gecode { namespace CPProfiler { } NodeUID - parent_uid(void) const { + parent_uid() const { return _parent; } void @@ -179,7 +179,7 @@ namespace Gecode { namespace CPProfiler { } int32_t - alt(void) const { + alt() const { return _alt; } void @@ -188,7 +188,7 @@ namespace Gecode { namespace CPProfiler { } int32_t - kids(void) const { + kids() const { return _kids; } void @@ -197,7 +197,7 @@ namespace Gecode { namespace CPProfiler { } NodeStatus - status(void) const { + status() const { return _status; } void @@ -230,16 +230,16 @@ namespace Gecode { namespace CPProfiler { } bool - has_version(void) const { + has_version() const { return _have_version; } int32_t - version(void) const { + version() const { return _version; } bool - has_label(void) const { + has_label() const { return _have_label; } const std::string& @@ -248,21 +248,21 @@ namespace Gecode { namespace CPProfiler { } bool - has_nogood(void) const { + has_nogood() const { return _have_nogood; } const std::string& - nogood(void) const { + nogood() const { return _nogood; } // generic optional fields bool - has_info(void) const { + has_info() const { return _have_info; } const std::string& - info(void) const { + info() const { return _info; } @@ -271,12 +271,12 @@ namespace Gecode { namespace CPProfiler { _type = type; } MsgType - type(void) const { + type() const { return _type; } void - reset(void) { + reset() { _have_label = false; _have_nogood = false; _have_info = false; @@ -292,7 +292,7 @@ namespace Gecode { namespace CPProfiler { Message msg; - typedef char* iter; + using iter = char*; static void serialize_type(std::vector& data, MsgType f) { @@ -400,18 +400,18 @@ namespace Gecode { namespace CPProfiler { } void - make_done(void) { + make_done() { msg.reset(); msg.set_type(MsgType::DONE); } const Message& - get_msg(void) { + get_msg() { return msg; } std::vector - serialize(void) const { + serialize() const { std::vector data; size_t data_size = 1 + (msg.is_node() ? 4 * 8 + 1 : 0) + (msg.has_label() ? 1 + 4 + msg.label().size() : 0) + @@ -501,6 +501,6 @@ namespace Gecode { namespace CPProfiler { } }; -}} // namespace Gecode::CPProfiler +} // namespace Gecode::CPProfiler // STATISTICS: search-trace diff --git a/gecode/search/cpprofiler/tracer.cpp b/gecode/search/cpprofiler/tracer.cpp index a0c841132a..67ed89e268 100644 --- a/gecode/search/cpprofiler/tracer.cpp +++ b/gecode/search/cpprofiler/tracer.cpp @@ -47,15 +47,14 @@ namespace Gecode { - CPProfilerSearchTracer::GetInfo::~GetInfo(void) = default; + CPProfilerSearchTracer::GetInfo::~GetInfo() = default; - CPProfilerSearchTracer::CPProfilerSearchTracer(int eid, std::string name0, unsigned int port, - const GetInfo* pgetinfo) - : connector(new CPProfiler::Connector(port)), execution_id(eid), name(std::move(name0)), restart(0), - pgi(pgetinfo) {} + CPProfilerSearchTracer::CPProfilerSearchTracer(int eid, std::string name0, unsigned int port, const GetInfo* pgi0) + : connector(new CPProfiler::Connector(port)), execution_id(eid), name(std::move(name0)), restart(0), pgi(pgi0) { + } void - CPProfilerSearchTracer::init(void) { + CPProfilerSearchTracer::init() { // Try to find out whether engine is a restart engine bool restarts = ((engines() == 2U) && (engine(0U).type() == EngineType::RBS)); connector->connect(); @@ -133,12 +132,12 @@ namespace Gecode { } void - CPProfilerSearchTracer::done(void) { + CPProfilerSearchTracer::done() { connector->done(); connector->disconnect(); } - CPProfilerSearchTracer::~CPProfilerSearchTracer(void) { + CPProfilerSearchTracer::~CPProfilerSearchTracer() { delete connector; delete pgi; } diff --git a/gecode/search/cutoff.cpp b/gecode/search/cutoff.cpp index 848358e33b..0e750fff20 100644 --- a/gecode/search/cutoff.cpp +++ b/gecode/search/cutoff.cpp @@ -38,34 +38,34 @@ #include #include -namespace Gecode { namespace Search { +namespace Gecode::Search { unsigned long long int - CutoffConstant::operator()(void) const { + CutoffConstant::operator()() const { return c; } unsigned long long int - CutoffConstant::operator++(void) { + CutoffConstant::operator++() { return c; } Cutoff* - CutoffConstant::copy(void) const { + CutoffConstant::copy() const { return new CutoffConstant(*this); } unsigned long long int - CutoffLinear::operator()(void) const { + CutoffLinear::operator()() const { return n; } unsigned long long int - CutoffLinear::operator++(void) { + CutoffLinear::operator++() { n += scale; return n; } Cutoff* - CutoffLinear::copy(void) const { + CutoffLinear::copy() const { return new CutoffLinear(*this); } @@ -73,46 +73,46 @@ namespace Gecode { namespace Search { 1, 1, 2, 1, 1, 2, 4, 1, 1, 2, 1, 1, 2, 4, 8, 1, 1, 2, 1, 1, 2, 4, 1, 1, 2, 1, 1, 2, 4, 8, 16, 1, 1, 2, 1, 1, 2, 4, 1, 1, 2, 1, 1, 2, 4, 8, 1, 1, 2, 1, 1, 2, 4, 1, 1, 2, 1, 1, 2, 4, 8, 16, 32}; unsigned long long int - CutoffLuby::operator()(void) const { + CutoffLuby::operator()() const { return scale * luby(i); } unsigned long long int - CutoffLuby::operator++(void) { + CutoffLuby::operator++() { return scale * luby(i++); } Cutoff* - CutoffLuby::copy(void) const { + CutoffLuby::copy() const { return new CutoffLuby(*this); } unsigned long long int - CutoffGeometric::operator()(void) const { + CutoffGeometric::operator()() const { return static_cast(scale * n); } unsigned long long int - CutoffGeometric::operator++(void) { + CutoffGeometric::operator++() { n *= base; return static_cast(scale * n); } Cutoff* - CutoffGeometric::copy(void) const { + CutoffGeometric::copy() const { return new CutoffGeometric(*this); } unsigned long long int - CutoffRandom::operator++(void) { + CutoffRandom::operator++() { cur = min + step * rnd(n); return cur; } unsigned long long int - CutoffRandom::operator()(void) const { + CutoffRandom::operator()() const { return cur; } Cutoff* - CutoffRandom::copy(void) const { + CutoffRandom::copy() const { CutoffRandom* c = new CutoffRandom(*this); // Give each copy its own stream copies++; @@ -123,25 +123,23 @@ namespace Gecode { namespace Search { } unsigned long long int - CutoffAppend::operator()(void) const { + CutoffAppend::operator()() const { if (n > 0) { return (*c1)(); - } else { - return (*c2)(); } + return (*c2)(); } unsigned long long int - CutoffAppend::operator++(void) { + CutoffAppend::operator++() { if (n > 0) { n--; return ++(*c1); - } else { - return ++(*c2); } + return ++(*c2); } Cutoff* - CutoffAppend::copy(void) const { + CutoffAppend::copy() const { std::unique_ptr d1(c1->copy()); std::unique_ptr d2(c2->copy()); Cutoff* d = new CutoffAppend(d1.get(), n, d2.get()); @@ -151,18 +149,18 @@ namespace Gecode { namespace Search { } unsigned long long int - CutoffMerge::operator()(void) const { + CutoffMerge::operator()() const { return (*c1)(); } unsigned long long int - CutoffMerge::operator++(void) { + CutoffMerge::operator++() { (void)++(*c1); std::swap(c1, c2); return (*c1)(); } Cutoff* - CutoffMerge::copy(void) const { + CutoffMerge::copy() const { std::unique_ptr d1(c1->copy()); std::unique_ptr d2(c2->copy()); Cutoff* d = new CutoffMerge(d1.get(), d2.get()); @@ -172,11 +170,11 @@ namespace Gecode { namespace Search { } unsigned long long int - CutoffRepeat::operator()(void) const { + CutoffRepeat::operator()() const { return cutoff; } unsigned long long int - CutoffRepeat::operator++(void) { + CutoffRepeat::operator++() { i++; if (i == n) { cutoff = ++(*c); @@ -186,7 +184,7 @@ namespace Gecode { namespace Search { } Cutoff* - CutoffRepeat::copy(void) const { + CutoffRepeat::copy() const { std::unique_ptr d1(c->copy()); CutoffRepeat* d = new CutoffRepeat(d1.get(), n); (void)d1.release(); @@ -208,8 +206,8 @@ namespace Gecode { namespace Search { return new CutoffLuby(scale); } Cutoff* - Cutoff::geometric(unsigned long long int base, double scale) { - return new CutoffGeometric(base, scale); + Cutoff::geometric(unsigned long long int scale, double base) { + return new CutoffGeometric(scale, base); } Cutoff* Cutoff::rnd(unsigned int seed, unsigned long long int min, unsigned long long int max, unsigned long long int n) { @@ -228,6 +226,6 @@ namespace Gecode { namespace Search { return new CutoffRepeat(c, n); } -}} // namespace Gecode::Search +} // namespace Gecode::Search // STATISTICS: search-other diff --git a/gecode/search/cutoff.hpp b/gecode/search/cutoff.hpp index 964e20e5a7..431895096f 100644 --- a/gecode/search/cutoff.hpp +++ b/gecode/search/cutoff.hpp @@ -34,9 +34,9 @@ * */ -namespace Gecode { namespace Search { +namespace Gecode::Search { - forceinline Cutoff::~Cutoff(void) = default; + forceinline Cutoff::~Cutoff() = default; forceinline CutoffConstant::CutoffConstant(unsigned long long int c0) @@ -79,15 +79,14 @@ namespace Gecode { namespace Search { forceinline CutoffRandom::CutoffRandom(unsigned int seed, unsigned long long int min0, unsigned long long int max0, unsigned long long int n0) - : rnd(seed), min(min0), n(n0), - step(std::max(1ULL, static_cast((max0 - min0 + 1U) / n))), copies(0U) { + : rnd(seed), min(min0), n(n0), step(std::max(1ULL, (max0 - min0 + 1U) / n)), copies(0U) { cur = ++(*this); } forceinline CutoffAppend::CutoffAppend(Cutoff* d1, unsigned long long int n0, Cutoff* d2) : c1(d1), c2(d2), n(n0) {} - inline CutoffAppend::~CutoffAppend(void) { + inline CutoffAppend::~CutoffAppend() { delete c1; delete c2; } @@ -95,7 +94,7 @@ namespace Gecode { namespace Search { forceinline CutoffMerge::CutoffMerge(Cutoff* d1, Cutoff* d2) : c1(d1), c2(d2) {} - inline CutoffMerge::~CutoffMerge(void) { + inline CutoffMerge::~CutoffMerge() { delete c1; delete c2; } @@ -105,10 +104,10 @@ namespace Gecode { namespace Search { : c(c1), i(0), n(n0) { cutoff = (*c)(); } - inline CutoffRepeat::~CutoffRepeat(void) { + inline CutoffRepeat::~CutoffRepeat() { delete c; } -}} // namespace Gecode::Search +} // namespace Gecode::Search // STATISTICS: search-other diff --git a/gecode/search/dfs.cpp b/gecode/search/dfs.cpp index 23153a6c3f..8fa78cedff 100644 --- a/gecode/search/dfs.cpp +++ b/gecode/search/dfs.cpp @@ -38,7 +38,7 @@ #include #endif -namespace Gecode { namespace Search { +namespace Gecode::Search { Engine* make_dfs_engine(Space* s, const Options& o) { @@ -47,14 +47,12 @@ namespace Gecode { namespace Search { if (to.threads == 1.0) { if (to.tracer) return new WorkerToEngine>(s, to); - else - return new WorkerToEngine>(s, to); - } else { - if (to.tracer) - return new Par::DFS(s, to); - else - return new Par::DFS(s, to); + return new WorkerToEngine>(s, to); } + if (to.tracer) + return new Par::DFS(s, to); + return new Par::DFS(s, to); + #else if (to.tracer) return new WorkerToEngine>(s, to); @@ -63,6 +61,6 @@ namespace Gecode { namespace Search { #endif } -}} // namespace Gecode::Search +} // namespace Gecode::Search // STATISTICS: search-other diff --git a/gecode/search/dfs.hpp b/gecode/search/dfs.hpp index 1420e18907..676d52e2a5 100644 --- a/gecode/search/dfs.hpp +++ b/gecode/search/dfs.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Search { +namespace Gecode::Search { /// Create depth-first engine GECODE_SEARCH_EXPORT Engine* make_dfs_engine(Space* s, const Options& o); @@ -56,7 +56,7 @@ namespace Gecode { namespace Search { return build(s, opt); } -}} // namespace Gecode::Search +} // namespace Gecode::Search namespace Gecode { diff --git a/gecode/search/engine.cpp b/gecode/search/engine.cpp index 96af6e2510..c0bcec04dd 100644 --- a/gecode/search/engine.cpp +++ b/gecode/search/engine.cpp @@ -33,9 +33,9 @@ #include #include -namespace Gecode { namespace Search { +namespace Gecode::Search { - Engine::Engine(void) : worker_control() {} + Engine::Engine() = default; Engine::Engine(const Options& o, unsigned int capacity) : worker_control(o.worker_control) { WorkerControlAccess::attach(worker_control, capacity); @@ -51,11 +51,11 @@ namespace Gecode { namespace Search { (void)s; } NoGoods& - Engine::nogoods(void) { + Engine::nogoods() { return NoGoods::eng; } - Engine::~Engine(void) { + Engine::~Engine() { WorkerControlAccess::detach(worker_control); } @@ -63,8 +63,8 @@ namespace Gecode { namespace Search { * Defined out of line so that the vtable, and with it the destructor of * the options, is only emitted in the search library. */ - Builder::~Builder(void) = default; + Builder::~Builder() = default; -}} // namespace Gecode::Search +} // namespace Gecode::Search // STATISTICS: search-other diff --git a/gecode/search/exception.cpp b/gecode/search/exception.cpp index 40065e2a56..bcee08c115 100644 --- a/gecode/search/exception.cpp +++ b/gecode/search/exception.cpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Search { +namespace Gecode::Search { #ifdef GECODE_HAS_EXPERIMENTAL UninitializedGuidance::UninitializedGuidance(const char* l) : Exception(l, "Heuristic guidance is missing") {} @@ -64,6 +64,6 @@ namespace Gecode { namespace Search { Incomparable::Incomparable(const char* l) : Exception(l, "Incomparable objectives are not supported by best solution search") {} -}} // namespace Gecode::Search +} // namespace Gecode::Search // STATISTICS: search-other diff --git a/gecode/search/exception.hpp b/gecode/search/exception.hpp index 8cd8e6bc60..400808a00e 100644 --- a/gecode/search/exception.hpp +++ b/gecode/search/exception.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Search { +namespace Gecode::Search { /** * \defgroup FuncThrowSearch %Search exceptions @@ -107,6 +107,6 @@ namespace Gecode { namespace Search { #endif //@} -}} // namespace Gecode::Search +} // namespace Gecode::Search // STATISTICS: search-other diff --git a/gecode/search/heuristic.hh b/gecode/search/heuristic.hh index e737102400..6761971b58 100644 --- a/gecode/search/heuristic.hh +++ b/gecode/search/heuristic.hh @@ -39,9 +39,10 @@ #include #include #include +#include #ifdef GECODE_HAS_EXPERIMENTAL -namespace Gecode { namespace Search { +namespace Gecode::Search { /// Whether bound \a a is better than bound \a b for objective direction \a s forceinline bool @@ -121,7 +122,7 @@ namespace Gecode { namespace Search { } /// Remove incumbent void - reset(void) { + reset() { space.reset(); revision = 0; } @@ -131,15 +132,15 @@ namespace Gecode { namespace Search { class Entries : public Support::DynamicStack { public: /// Initialize - Entries(void) : Support::DynamicStack(heap) {} + Entries() : Support::DynamicStack(heap) {} /// Delete all entries void - clear(void) { + clear() { while (!empty()) delete pop().space; } /// Release memory - ~Entries(void) { + ~Entries() { clear(); } /// Sort such that the preferred entry is on top @@ -164,7 +165,7 @@ namespace Gecode { namespace Search { Queue(const Priority& p0) : p(p0) {} /// Whether the queue is empty bool - empty(void) const { + empty() const { return entries.empty(); } /// Add entry \a e @@ -176,14 +177,14 @@ namespace Gecode { namespace Search { } /// Remove and return the preferred entry Entry - pop(void) { + pop() { Entry* f = &entries[0]; std::pop_heap(f, f + entries.entries(), [this](const Entry& a, const Entry& b) { return p(b, a); }); return entries.pop(); } /// Delete all entries void - clear(void) { + clear() { entries.clear(); } }; @@ -357,17 +358,18 @@ namespace Gecode { namespace Search { bucket[b] = -1; } /// Delete all entries - ~Beam(void) { + // NOLINTNEXTLINE(bugprone-exception-escape): clear only reads cells that exist + ~Beam() { clear(); } /// Return the number of entries int - size(void) const { + size() const { return n; } /// Whether there are no entries bool - empty(void) const { + empty() const { return n == 0; } /// Whether discarded entries could improve an incumbent \a i @@ -414,7 +416,7 @@ namespace Gecode { namespace Search { return TAKEN; } } - if (static_cast(n) == _width) { + if (std::cmp_equal(n, _width)) { const Entry& worst = slot[pq[0]].e; bool replace = p(e, worst); std::int64_t b = replace ? worst.bound : e.bound; @@ -446,7 +448,7 @@ namespace Gecode { namespace Search { } /// Delete all entries and reset width void - clear(void) { + clear() { for (int i = 0; i < n; i++) delete slot[pq[i]].e.space; n = 0; @@ -459,7 +461,7 @@ namespace Gecode { namespace Search { } }; -}} // namespace Gecode::Search +} // namespace Gecode::Search #endif #endif diff --git a/gecode/search/lds.cpp b/gecode/search/lds.cpp index 6bf1397a9a..365f28821f 100644 --- a/gecode/search/lds.cpp +++ b/gecode/search/lds.cpp @@ -38,16 +38,15 @@ #include -namespace Gecode { namespace Search { +namespace Gecode::Search { Engine* make_lds_engine(Space* s, const Options& o) { if (o.tracer) return new Seq::LDS(s, o); - else - return new Seq::LDS(s, o); + return new Seq::LDS(s, o); } -}} // namespace Gecode::Search +} // namespace Gecode::Search // STATISTICS: search-other diff --git a/gecode/search/lds.hpp b/gecode/search/lds.hpp index f8f4f3d743..8f21e15cc5 100644 --- a/gecode/search/lds.hpp +++ b/gecode/search/lds.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Search { +namespace Gecode::Search { /// Create lds engine GECODE_SEARCH_EXPORT Engine* make_lds_engine(Space* s, const Options& o); @@ -56,7 +56,7 @@ namespace Gecode { namespace Search { return build(s, opt); } -}} // namespace Gecode::Search +} // namespace Gecode::Search namespace Gecode { diff --git a/gecode/search/nogoods.cpp b/gecode/search/nogoods.cpp index 0d9e9d72cc..cae500ead2 100644 --- a/gecode/search/nogoods.cpp +++ b/gecode/search/nogoods.cpp @@ -32,10 +32,10 @@ #include -namespace Gecode { namespace Search { +namespace Gecode::Search { /// Help function to cancel and dispose a no-good literal - forceinline NGL* + static forceinline NGL* dispose_and_next(NGL* ngl, Space& home, Propagator& p, bool c) { NGL* n = ngl->next(); if (c) @@ -226,6 +226,6 @@ namespace Gecode { namespace Search { return sizeof(*this); } -}} // namespace Gecode::Search +} // namespace Gecode::Search // STATISTICS: search-other diff --git a/gecode/search/nogoods.hh b/gecode/search/nogoods.hh index 5d05390901..04ea9a6626 100644 --- a/gecode/search/nogoods.hh +++ b/gecode/search/nogoods.hh @@ -35,13 +35,13 @@ #include -namespace Gecode { namespace Search { +namespace Gecode::Search { /// Class for a sentinel no-good literal class GECODE_SEARCH_EXPORT NoNGL : public NGL { public: /// Constructor for creation - NoNGL(void) = default; + NoNGL() = default; /// Constructor for creation NoNGL(Space& home); /// Constructor for cloning \a ngl @@ -88,7 +88,7 @@ namespace Gecode { namespace Search { size_t dispose(Space& home) override; }; -}} // namespace Gecode::Search +} // namespace Gecode::Search #include diff --git a/gecode/search/nogoods.hpp b/gecode/search/nogoods.hpp index 732c0cf3c1..396ca38d45 100644 --- a/gecode/search/nogoods.hpp +++ b/gecode/search/nogoods.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Search { +namespace Gecode::Search { forceinline NoNGL::NoNGL(Space& home) @@ -168,6 +168,6 @@ namespace Gecode { namespace Search { return ES_OK; } -}} // namespace Gecode::Search +} // namespace Gecode::Search // STATISTICS: search-other diff --git a/gecode/search/options.cpp b/gecode/search/options.cpp index eac52b570f..1ef5d24d8f 100644 --- a/gecode/search/options.cpp +++ b/gecode/search/options.cpp @@ -30,16 +30,17 @@ * */ +#include #include #include -namespace Gecode { namespace Search { +namespace Gecode::Search { const Options Options::def; Options - Options::expand(void) const { + Options::expand() const { #ifdef GECODE_HAS_THREADS double t = threads; if (t <= -1.0) { @@ -52,8 +53,7 @@ namespace Gecode { namespace Search { t = t * Support::Thread::npu(); } t = floor(t + 0.5); - if (t < 1.0) - t = 1.0; + t = std::max(t, 1.0); Options o(*this); o.threads = t; return o; @@ -62,6 +62,6 @@ namespace Gecode { namespace Search { #endif } -}} // namespace Gecode::Search +} // namespace Gecode::Search // STATISTICS: search-other diff --git a/gecode/search/options.hpp b/gecode/search/options.hpp index ea0f4d1a0a..7e9807a824 100644 --- a/gecode/search/options.hpp +++ b/gecode/search/options.hpp @@ -30,13 +30,12 @@ * */ -namespace Gecode { namespace Search { +namespace Gecode::Search { forceinline - Options::Options(void) - : clone(Config::clone), threads(Config::threads), worker_control(), c_d(Config::c_d), a_d(Config::a_d), - d_l(Config::d_l), assets(0), slice(Config::slice), nogoods_limit(0), stop(nullptr), cutoff(nullptr), - tracer(nullptr) + Options::Options() + : clone(Config::clone), threads(Config::threads), c_d(Config::c_d), a_d(Config::a_d), d_l(Config::d_l), + assets(0), slice(Config::slice), nogoods_limit(0), stop(nullptr), cutoff(nullptr), tracer(nullptr) #ifdef GECODE_HAS_EXPERIMENTAL , guidance(nullptr), max_width(0), frontier_limit(0) @@ -44,6 +43,6 @@ namespace Gecode { namespace Search { { } -}} // namespace Gecode::Search +} // namespace Gecode::Search // STATISTICS: search-other diff --git a/gecode/search/par/bab.hh b/gecode/search/par/bab.hh index 8b845791d4..cf52933daf 100644 --- a/gecode/search/par/bab.hh +++ b/gecode/search/par/bab.hh @@ -36,7 +36,7 @@ #include #include -namespace Gecode { namespace Search { namespace Par { +namespace Gecode::Search::Par { /// %Parallel branch-and-bound engine template @@ -88,19 +88,19 @@ namespace Gecode { namespace Search { namespace Par { /// Initialize for space \a s with engine \a e Worker(Space* s, BAB& e, unsigned int index); /// Provide access to engine - BAB& engine(void) const; + BAB& engine() const; /// Start execution of worker - void run(void) override; + void run() override; /// Accept better solution \a b void better(Space* b); /// Try to find some work - bool find(void); + bool find(); /// Reset engine to restart at space \a s void reset(Space* s, unsigned int ngdl); /// Whether this worker currently owns local search - bool owns_work(void) const; + bool owns_work() const; /// Destructor - ~Worker(void) override; + ~Worker() override; }; /// Array of worker references Worker** _worker; @@ -124,22 +124,22 @@ namespace Gecode { namespace Search { namespace Par { /// Initialize for space \a s with options \a o BAB(Space* s, const Options& o); /// Return next solution - Space* next(void) override; + Space* next() override; /// Return statistics - Statistics statistics(void) const override; + Statistics statistics() const override; /// Reset engine to restart at space \a s void reset(Space* s) override; /// Constrain future solutions to be better than \a b void constrain(const Space& b) override; /// Constrain /// Return no-goods - NoGoods& nogoods(void) override; + NoGoods& nogoods() override; /// Destructor - ~BAB(void) override; + ~BAB() override; //@} }; -}}} // namespace Gecode::Search::Par +} // namespace Gecode::Search::Par #include diff --git a/gecode/search/par/bab.hpp b/gecode/search/par/bab.hpp index b53adab7aa..67e16826fe 100644 --- a/gecode/search/par/bab.hpp +++ b/gecode/search/par/bab.hpp @@ -34,18 +34,18 @@ * */ -namespace Gecode { namespace Search { namespace Par { +namespace Gecode::Search::Par { /* * Engine: basic access routines */ template forceinline BAB& - BAB::Worker::engine(void) const { + BAB::Worker::engine() const { return static_cast(_engine); } template - forceinline typename BAB::Worker* + forceinline BAB::Worker* BAB::worker(unsigned int i) const { return _worker[i]; } @@ -76,7 +76,7 @@ namespace Gecode { namespace Search { namespace Par { template forceinline bool - BAB::Worker::owns_work(void) const { + BAB::Worker::owns_work() const { return (cur != nullptr) || !path.empty(); } @@ -168,10 +168,10 @@ namespace Gecode { namespace Search { namespace Par { */ template forceinline bool - BAB::Worker::find(void) { + BAB::Worker::find() { // Try to find new work (even if there is none) for (unsigned int i = 0U; i < engine().workers(); i++) { - unsigned long int r_d = 0ul; + unsigned long int r_d = 0UL; typename Engine::Worker* wi = engine().worker(i); if (Space* s = wi->steal(r_d, wi->tracer, tracer)) { // Reset this guy @@ -200,7 +200,7 @@ namespace Gecode { namespace Search { namespace Par { */ template Statistics - BAB::statistics(void) const { + BAB::statistics() const { Statistics s; for (unsigned int i = 0U; i < workers(); i++) s += worker(i)->statistics(); @@ -221,9 +221,7 @@ namespace Gecode { namespace Search { namespace Par { delete solutions.pop(); if ((best != nullptr) && !Search::better(b, *best, "BAB::constrain")) return; - if (best != nullptr) { - delete best; - } + delete best; best = b.clone(); // Announce better solutions for (unsigned int i = 0U; i < workers(); i++) @@ -232,7 +230,7 @@ namespace Gecode { namespace Search { namespace Par { template Space* - BAB::next(void) { + BAB::next() { std::exception_ptr f; { Support::Lock lock(m_search); @@ -262,7 +260,7 @@ namespace Gecode { namespace Search { namespace Par { */ template void - BAB::Worker::run(void) { + BAB::Worker::run() { /* * The engine maintains the following invariant: * - If the current space (cur) is not nullptr, the path always points @@ -454,7 +452,7 @@ namespace Gecode { namespace Search { namespace Par { */ template NoGoods& - BAB::nogoods(void) { + BAB::nogoods() { NoGoods* ng; // Grab wait lock for reset m_wait_reset.acquire(); @@ -481,17 +479,17 @@ namespace Gecode { namespace Search { namespace Par { * Termination and deletion */ template - BAB::Worker::~Worker(void) { + BAB::Worker::~Worker() { delete best; } template - BAB::~BAB(void) { + BAB::~BAB() { terminate(); delete best; heap.rfree(_worker); } -}}} // namespace Gecode::Search::Par +} // namespace Gecode::Search::Par // STATISTICS: search-par diff --git a/gecode/search/par/dfs.hh b/gecode/search/par/dfs.hh index dd5c754eca..4e34c9f22d 100644 --- a/gecode/search/par/dfs.hh +++ b/gecode/search/par/dfs.hh @@ -35,7 +35,7 @@ #include -namespace Gecode { namespace Search { namespace Par { +namespace Gecode::Search::Par { /// %Parallel depth-first search engine template @@ -80,15 +80,15 @@ namespace Gecode { namespace Search { namespace Par { /// Initialize for space \a s with engine \a e Worker(Space* s, DFS& e, unsigned int index); /// Provide access to engine - DFS& engine(void) const; + DFS& engine() const; /// Start execution of worker - void run(void) override; + void run() override; /// Try to find some work - bool find(void); + bool find(); /// Reset worker to restart at space \a s void reset(Space* s, unsigned int ngdl); /// Whether this worker currently owns local search - bool owns_work(void) const; + bool owns_work() const; }; /// Array of worker references Worker** _worker; @@ -108,17 +108,17 @@ namespace Gecode { namespace Search { namespace Par { /// Initialize for space \a s with options \a o DFS(Space* s, const Options& o); /// Return statistics - Statistics statistics(void) const override; + Statistics statistics() const override; /// Reset engine to restart at space \a s void reset(Space* s) override; /// Return no-goods - NoGoods& nogoods(void) override; + NoGoods& nogoods() override; /// Destructor - ~DFS(void) override; + ~DFS() override; //@} }; -}}} // namespace Gecode::Search::Par +} // namespace Gecode::Search::Par #include diff --git a/gecode/search/par/dfs.hpp b/gecode/search/par/dfs.hpp index 5eb60a8ed7..bf622de0a2 100644 --- a/gecode/search/par/dfs.hpp +++ b/gecode/search/par/dfs.hpp @@ -30,18 +30,18 @@ * */ -namespace Gecode { namespace Search { namespace Par { +namespace Gecode::Search::Par { /* * Basic access routines */ template forceinline DFS& - DFS::Worker::engine(void) const { + DFS::Worker::engine() const { return static_cast&>(_engine); } template - forceinline typename DFS::Worker* + forceinline DFS::Worker* DFS::worker(unsigned int i) const { return _worker[i]; } @@ -99,7 +99,7 @@ namespace Gecode { namespace Search { namespace Par { template forceinline bool - DFS::Worker::owns_work(void) const { + DFS::Worker::owns_work() const { return (cur != nullptr) || !path.empty(); } @@ -122,10 +122,10 @@ namespace Gecode { namespace Search { namespace Par { */ template forceinline bool - DFS::Worker::find(void) { + DFS::Worker::find() { // Try to find new work (even if there is none) for (unsigned int i = 0U; i < engine().workers(); i++) { - unsigned long int r_d = 0ul; + unsigned long int r_d = 0UL; typename Engine::Worker* wi = engine().worker(i); if (Space* s = wi->steal(r_d, wi->tracer, tracer)) { // Reset this guy @@ -151,7 +151,7 @@ namespace Gecode { namespace Search { namespace Par { */ template Statistics - DFS::statistics(void) const { + DFS::statistics() const { Statistics s; for (unsigned int i = 0U; i < workers(); i++) s += worker(i)->statistics(); @@ -163,7 +163,7 @@ namespace Gecode { namespace Search { namespace Par { */ template void - DFS::Worker::run(void) { + DFS::Worker::run() { /* * The engine maintains the following invariant: * - If the current space (cur) is not nullptr, the path always points @@ -342,7 +342,7 @@ namespace Gecode { namespace Search { namespace Par { */ template NoGoods& - DFS::nogoods(void) { + DFS::nogoods() { NoGoods* ng; // Grab wait lock for reset m_wait_reset.acquire(); @@ -364,11 +364,11 @@ namespace Gecode { namespace Search { namespace Par { * Termination and deletion */ template - DFS::~DFS(void) { + DFS::~DFS() { terminate(); heap.rfree(_worker); } -}}} // namespace Gecode::Search::Par +} // namespace Gecode::Search::Par // STATISTICS: search-par diff --git a/gecode/search/par/engine.hh b/gecode/search/par/engine.hh index b9213f966f..d17a4edeb7 100644 --- a/gecode/search/par/engine.hh +++ b/gecode/search/par/engine.hh @@ -44,7 +44,7 @@ #include #include -namespace Gecode { namespace Search { namespace Par { +namespace Gecode::Search::Par { /// %Parallel depth-first search engine template @@ -76,15 +76,15 @@ namespace Gecode { namespace Search { namespace Par { /// Hand over some work (nullptr if no work available) Space* steal(unsigned long int& d, Tracer& myt, Tracer& ot); /// Return statistics - Statistics statistics(void); + Statistics statistics(); /// Provide access to engine - Engine& engine(void) const; + Engine& engine() const; /// Return no-goods - NoGoods& nogoods(void); + NoGoods& nogoods(); /// Destructor - ~Worker(void) override; + ~Worker() override; /// Terminator (engine) - Support::Terminator* terminator(void) const override; + Support::Terminator* terminator() const override; }; /// Search options Options _opt; @@ -135,13 +135,13 @@ namespace Gecode { namespace Search { namespace Par { /// Select a no-lease worker by logical state (scheduler_mutex held) unsigned int scheduler_select(SchedulerLogical logical, unsigned int exclude) const; /// Grant leases up to the current request (scheduler_mutex held) - bool scheduler_grow(void); + bool scheduler_grow(); public: /// Provide access to search options - const Options& opt(void) const; + const Options& opt() const; /// Return number of workers - unsigned int workers(void) const; + unsigned int workers() const; /// Enable adjustable parallel admission void scheduler_enable(bool root_owner); /// Reset adjustable parallel state while all workers are blocked @@ -149,7 +149,7 @@ namespace Gecode { namespace Search { namespace Par { /// Admit worker \a worker for one exploration action bool scheduler_admit(unsigned int worker); /// Whether the external worker request currently pauses the engine - bool scheduler_paused(void) const; + bool scheduler_paused() const; /// Record that worker \a worker owns search void scheduler_owner(unsigned int worker); /// Record that worker \a worker is idle @@ -183,13 +183,13 @@ namespace Gecode { namespace Search { namespace Par { public: /// Return current command - Cmd cmd(void) const; + Cmd cmd() const; /// Block all workers - void block(void); + void block(); /// Release all workers void release(Cmd c); /// Ensure that worker waits - void wait(void); + void wait(); //@} /// \name Termination control @@ -210,13 +210,13 @@ namespace Gecode { namespace Search { namespace Par { public: /// For worker to acknowledge termination command - void ack_terminate(void); + void ack_terminate(); /// For worker to register termination - void terminated(void) override; + void terminated() override; /// For worker to wait until termination is legal - void wait_terminate(void); + void wait_terminate(); /// For engine to perform thread termination - void terminate(void); + void terminate(); //@} /// \name Reset control @@ -235,11 +235,11 @@ namespace Gecode { namespace Search { namespace Par { public: /// For worker to acknowledge start of reset cycle - void ack_reset_start(void); + void ack_reset_start(); /// For worker to acknowledge stop of reset cycle - void ack_reset_stop(void); + void ack_reset_stop(); /// For worker to wait for all workers to reset - void wait_reset(void); + void wait_reset(); //@} /// \name Search control @@ -260,19 +260,19 @@ namespace Gecode { namespace Search { namespace Par { /// Number of calls to next() that have started search std::atomic n_runs; /// Whether search state changed such that signal is needed - bool signal(void) const; + bool signal() const; public: /// Report that worker is idle - void idle(void); + void idle(); /// Report that worker is busy - void busy(void); + void busy(); /// Return the current call of next() - unsigned long long int run(void) const; + unsigned long long int run() const; /// Report that a worker was stopped during call \a r of next() void stop(unsigned long long int r); /// Whether logical search work remains - bool work_remains(void); + bool work_remains(); //@} /// \name Engine interface @@ -280,16 +280,16 @@ namespace Gecode { namespace Search { namespace Par { /// Initialize with options \a o Engine(const Options& o); /// Return next solution (nullptr, if none exists or search has been stopped) - Space* next(void) override; + Space* next() override; /// Return why the last call to next() returned no solution - EndReason end_reason(void) const override; + EndReason end_reason() const override; //@} /// Destructor - ~Engine(void) override; + ~Engine() override; }; -}}} // namespace Gecode::Search::Par +} // namespace Gecode::Search::Par #include diff --git a/gecode/search/par/engine.hpp b/gecode/search/par/engine.hpp index f2d783bf1b..a4915df8e5 100644 --- a/gecode/search/par/engine.hpp +++ b/gecode/search/par/engine.hpp @@ -34,29 +34,29 @@ * */ -namespace Gecode { namespace Search { namespace Par { +namespace Gecode::Search::Par { /* * Basic access routines */ template forceinline Engine& - Engine::Worker::engine(void) const { + Engine::Worker::engine() const { return _engine; } template forceinline const Options& - Engine::opt(void) const { + Engine::opt() const { return _opt; } template forceinline unsigned int - Engine::workers(void) const { + Engine::workers() const { return static_cast(opt().threads); } template forceinline EndReason - Engine::end_reason(void) const { + Engine::end_reason() const { return end; } @@ -64,13 +64,13 @@ namespace Gecode { namespace Search { namespace Par { * Engine: command and wait handling */ template - forceinline typename Engine::Cmd - Engine::cmd(void) const { + forceinline Engine::Cmd + Engine::cmd() const { return _cmd.load(std::memory_order_acquire); } template forceinline void - Engine::block(void) { + Engine::block() { _cmd.store(C_WAIT, std::memory_order_release); Support::Thread::acquire_global_mutex(&_m_wait); } @@ -84,7 +84,7 @@ namespace Gecode { namespace Search { namespace Par { } template forceinline void - Engine::wait(void) { + Engine::wait() { _m_wait.acquire(); _m_wait.release(); } @@ -143,7 +143,7 @@ namespace Gecode { namespace Search { namespace Par { template bool - Engine::scheduler_grow(void) { + Engine::scheduler_grow() { bool wake = false; while (scheduler_leases < scheduler_requested) { unsigned int i = scheduler_select(SchedulerLogical::OWNER, workers()); @@ -255,7 +255,7 @@ namespace Gecode { namespace Search { namespace Par { template forceinline bool - Engine::scheduler_paused(void) const { + Engine::scheduler_paused() const { return scheduler_enabled && (WorkerControlAccess::requested(worker_control) == 0U); } @@ -314,7 +314,7 @@ namespace Gecode { namespace Search { namespace Par { */ template forceinline Statistics - Engine::Worker::statistics(void) { + Engine::Worker::statistics() { m.acquire(); Statistics s = *this; m.release(); @@ -326,12 +326,12 @@ namespace Gecode { namespace Search { namespace Par { */ template forceinline bool - Engine::signal(void) const { + Engine::signal() const { return solutions.empty() && (n_busy > 0) && !has_stopped.load(std::memory_order_acquire); } template forceinline void - Engine::idle(void) { + Engine::idle() { m_search.acquire(); bool bs = signal(); n_busy--; @@ -342,7 +342,7 @@ namespace Gecode { namespace Search { namespace Par { template forceinline void - Engine::busy(void) { + Engine::busy() { m_search.acquire(); assert(n_busy > 0); n_busy++; @@ -351,7 +351,7 @@ namespace Gecode { namespace Search { namespace Par { template forceinline unsigned long long int - Engine::run(void) const { + Engine::run() const { return n_runs.load(std::memory_order_acquire); } @@ -374,7 +374,7 @@ namespace Gecode { namespace Search { namespace Par { template forceinline bool - Engine::work_remains(void) { + Engine::work_remains() { m_search.acquire(); bool remains = n_busy > 0; m_search.release(); @@ -386,7 +386,7 @@ namespace Gecode { namespace Search { namespace Par { */ template forceinline void - Engine::terminated(void) { + Engine::terminated() { unsigned int n; _m_term.acquire(); n = --_n_not_terminated; @@ -399,7 +399,7 @@ namespace Gecode { namespace Search { namespace Par { template forceinline void - Engine::ack_terminate(void) { + Engine::ack_terminate() { _m_term.acquire(); if (--_n_term_not_ack == 0) _e_term_ack.signal(); @@ -408,14 +408,14 @@ namespace Gecode { namespace Search { namespace Par { template forceinline void - Engine::wait_terminate(void) { + Engine::wait_terminate() { _m_wait_terminate.acquire(); _m_wait_terminate.release(); } template forceinline void - Engine::terminate(void) { + Engine::terminate() { // Grab the wait mutex for termination _m_wait_terminate.acquire(); // Release all threads @@ -434,7 +434,7 @@ namespace Gecode { namespace Search { namespace Par { */ template forceinline void - Engine::ack_reset_start(void) { + Engine::ack_reset_start() { _m_reset.acquire(); if (--_n_reset_not_ack == 0) e_reset_ack_start.signal(); @@ -443,7 +443,7 @@ namespace Gecode { namespace Search { namespace Par { template forceinline void - Engine::ack_reset_stop(void) { + Engine::ack_reset_stop() { _m_reset.acquire(); if (++_n_reset_not_ack == workers()) e_reset_ack_stop.signal(); @@ -452,7 +452,7 @@ namespace Gecode { namespace Search { namespace Par { template forceinline void - Engine::wait_reset(void) { + Engine::wait_reset() { m_wait_reset.acquire(); m_wait_reset.release(); } @@ -483,7 +483,7 @@ namespace Gecode { namespace Search { namespace Par { */ template forceinline NoGoods& - Engine::Worker::nogoods(void) { + Engine::Worker::nogoods() { return path; } @@ -492,7 +492,7 @@ namespace Gecode { namespace Search { namespace Par { */ template Space* - Engine::next(void) { + Engine::next() { // Invariant: the worker holds the wait mutex m_search.acquire(); if (!solutions.empty()) { @@ -550,7 +550,7 @@ namespace Gecode { namespace Search { namespace Par { template Support::Terminator* - Engine::Worker::terminator(void) const { + Engine::Worker::terminator() const { return &_engine; } @@ -558,7 +558,7 @@ namespace Gecode { namespace Search { namespace Par { * Termination and deletion */ template - Engine::Worker::~Worker(void) { + Engine::Worker::~Worker() { delete cur; path.reset(0); tracer.done(); @@ -568,13 +568,13 @@ namespace Gecode { namespace Search { namespace Par { * Destructor */ template - Engine::~Engine(void) { + Engine::~Engine() { while (!solutions.empty()) delete solutions.pop(); if (scheduler_worker != nullptr) heap.rfree(scheduler_worker); } -}}} // namespace Gecode::Search::Par +} // namespace Gecode::Search::Par // STATISTICS: search-par diff --git a/gecode/search/par/frontier.cpp b/gecode/search/par/frontier.cpp index e46c8dd964..d4ddc9f550 100644 --- a/gecode/search/par/frontier.cpp +++ b/gecode/search/par/frontier.cpp @@ -31,24 +31,25 @@ */ #include +#include #if defined(GECODE_HAS_EXPERIMENTAL) && defined(GECODE_HAS_THREADS) -namespace Gecode { namespace Search { namespace Par { +namespace Gecode::Search::Par { Frontier::Runner::Runner(Frontier& e, unsigned int i) : Support::Runnable(false), engine(e), id(i) {} void - Frontier::Runner::run(void) { + Frontier::Runner::run() { engine.work(id); } Support::Terminator* - Frontier::Runner::terminator(void) const { + Frontier::Runner::terminator() const { return const_cast(this); } void - Frontier::Runner::terminated(void) { + Frontier::Runner::terminated() { done.signal(); } @@ -79,13 +80,13 @@ namespace Gecode { namespace Search { namespace Par { return; } started(*s); - std::unique_ptr t(new Task); + std::unique_ptr t = std::make_unique(); t->expansion.select(std::unique_ptr(clone ? s->clone() : s)); push(t.release()); } void - Frontier::launch(void) { + Frontier::launch() { if (runners != nullptr) return; unsigned int n = static_cast(opt.threads); @@ -115,7 +116,7 @@ namespace Gecode { namespace Search { namespace Par { } void - Frontier::wake(void) { + Frontier::wake() { if (worker_control.engaged()) { WorkerControlAccess::signal_all(worker_control); } else if (runners != nullptr) { @@ -130,7 +131,7 @@ namespace Gecode { namespace Search { namespace Par { } void - Frontier::terminate(void) { + Frontier::terminate() { if (runners == nullptr) return; { @@ -148,7 +149,7 @@ namespace Gecode { namespace Search { namespace Par { runners = nullptr; } - Frontier::~Frontier(void) { + Frontier::~Frontier() { terminate(); while (n_pending > 0) { delete pending.pop(); @@ -331,7 +332,7 @@ namespace Gecode { namespace Search { namespace Par { } Space* - Frontier::next(void) { + Frontier::next() { launch(); { Support::Lock lock(mutex); @@ -365,13 +366,13 @@ namespace Gecode { namespace Search { namespace Par { } Search::Statistics - Frontier::statistics(void) const { + Frontier::statistics() const { Support::Lock lock(mutex); return stat; } EndReason - Frontier::end_reason(void) const { + Frontier::end_reason() const { Support::Lock lock(mutex); return end; } @@ -407,7 +408,7 @@ namespace Gecode { namespace Search { namespace Par { (void)replacement.release(); } -}}} // namespace Gecode::Search::Par +} // namespace Gecode::Search::Par #endif // STATISTICS: search-par diff --git a/gecode/search/par/frontier.hh b/gecode/search/par/frontier.hh index 9328af3b13..333a9db46b 100644 --- a/gecode/search/par/frontier.hh +++ b/gecode/search/par/frontier.hh @@ -39,7 +39,7 @@ #include #if defined(GECODE_HAS_EXPERIMENTAL) && defined(GECODE_HAS_THREADS) -namespace Gecode { namespace Search { namespace Par { +namespace Gecode::Search::Par { /** * \brief Parallel engine for heuristic search @@ -62,7 +62,7 @@ namespace Gecode { namespace Search { namespace Par { /// Whether the node has been counted bool counted; /// Initialize - Task(void) : depth(0), revision(0), counted(false) {} + Task() : depth(0), revision(0), counted(false) {} }; /// Thread running a worker class Runner : public Support::Runnable, public Support::Terminator { @@ -77,11 +77,11 @@ namespace Gecode { namespace Search { namespace Par { /// Initialize Runner(Frontier& e, unsigned int i); /// Run worker - void run(void) override; + void run() override; /// Return terminator - Support::Terminator* terminator(void) const override; + Support::Terminator* terminator() const override; /// Signal termination - void terminated(void) override; + void terminated() override; }; /// Search options Options opt; @@ -117,15 +117,15 @@ namespace Gecode { namespace Search { namespace Par { /// \name Open nodes (called with the mutex held) //@{ /// Whether there are open nodes - virtual bool open(void) const = 0; + virtual bool open() const = 0; /// Remove and return the next open node - virtual Entry select(void) = 0; + virtual Entry select() = 0; /// Add child \a e, or delete it; \a leased tells whether its parent is still leased virtual void submit(const Entry& e, bool leased) = 0; /// Called when all work is done, return whether there is new work - virtual bool advance(void) = 0; + virtual bool advance() = 0; /// Delete all open nodes - virtual void clear(void) = 0; + virtual void clear() = 0; /// Called with the root \a r when search starts virtual void started(const Space& r); //@} @@ -143,13 +143,13 @@ namespace Gecode { namespace Search { namespace Par { /// Add pending task \a t void push(Task* t); /// Stop all workers (must be called by subclass destructors) - void terminate(void); + void terminate(); /// Make \a s with bound \a b the incumbent, if it compares better void publish(Space* s, std::int64_t b); /// Start the threads - void launch(void); + void launch(); /// Wake up all workers - void wake(void); + void wake(); /// Whether worker \a id is currently enabled bool enabled(unsigned int id); /// Run worker \a id @@ -157,20 +157,20 @@ namespace Gecode { namespace Search { namespace Par { public: /// Destructor - ~Frontier(void) override; + ~Frontier() override; /// Return next better solution (nullptr if none or stopped) - Space* next(void) override; + Space* next() override; /// Return statistics - Search::Statistics statistics(void) const override; + Search::Statistics statistics() const override; /// Return why the last call to next() returned no solution - EndReason end_reason(void) const override; + EndReason end_reason() const override; /// Constrain future solutions to be better than \a s void constrain(const Space& s) override; /// Reset engine to restart at space \a s void reset(Space* s) override; }; -}}} // namespace Gecode::Search::Par +} // namespace Gecode::Search::Par #endif #endif diff --git a/gecode/search/par/path.hh b/gecode/search/par/path.hh index 0d4124ce6d..785c4f1da3 100644 --- a/gecode/search/par/path.hh +++ b/gecode/search/par/path.hh @@ -44,7 +44,7 @@ #include #include -namespace Gecode { namespace Search { namespace Par { +namespace Gecode::Search::Par { /** * \brief Depth-first path (stack of edges) supporting recomputation @@ -65,7 +65,7 @@ namespace Gecode { namespace Search { namespace Par { public: /// Identity type - typedef typename Tracer::ID ID; + using ID = Tracer::ID; /// %Search tree edge for recomputation class Edge { protected: @@ -82,38 +82,38 @@ namespace Gecode { namespace Search { namespace Par { public: /// Default constructor - Edge(void); + Edge(); /// Edge for space \a s with clone \a c (possibly nullptr) Edge(Space* s, Space* c, unsigned int nid); /// Return space for edge - Space* space(void) const; + Space* space() const; /// Set space to \a s void space(Space* s); /// Return choice - const Choice* choice(void) const; + const Choice* choice() const; /// Return number for alternatives - unsigned int alt(void) const; + unsigned int alt() const; /// Return true number for alternatives (excluding lao optimization) - unsigned int true_alternative(void) const; + unsigned int true_alternative() const; /// Test whether current alternative is rightmost - bool rightmost(void) const; + bool rightmost() const; /// Test whether current alternative was LAO - bool lao(void) const; + bool lao() const; /// Test whether there is an alternative that can be stolen - bool work(void) const; + bool work() const; /// Move to next alternative - void next(void); + void next(); /// Steal rightmost alternative and return its number - unsigned int steal(void); + unsigned int steal(); /// Return node identifier - unsigned int nid(void) const; + unsigned int nid() const; /// Free memory for edge - void dispose(void); + void dispose(); }; protected: @@ -128,19 +128,19 @@ namespace Gecode { namespace Search { namespace Par { /// Initialize with no-good depth limit \a l Path(unsigned int l); /// Return no-good depth limit - unsigned int ngdl(void) const; + unsigned int ngdl() const; /// Set no-good depth limit to \a l void ngdl(unsigned int l); /// Push space \a c (a clone of \a s or nullptr) const Choice* push(Worker& stat, Space* s, Space* c, unsigned int nid); /// Generate path for next node - void next(void); + void next(); /// Provide access to topmost edge - Edge& top(void) const; + Edge& top() const; /// Test whether path is empty - bool empty(void) const; + bool empty() const; /// Return position on stack of last copy - int lc(void) const; + int lc() const; /// Unwind the stack up to position \a l (after failure) void unwind(int l, Tracer& t); /// Commit space \a s as described by stack entry at position \a i @@ -150,18 +150,18 @@ namespace Gecode { namespace Search { namespace Par { /// Recompute space according to path Space* recompute(unsigned int& d, unsigned int a_d, Worker& s, const Space* best, int& mark, Tracer& t); /// Return number of entries on stack - int entries(void) const; + int entries() const; /// Reset stack and set no-good depth limit to \a l void reset(unsigned int l); /// Make a quick check whether stealing might be feasible - bool steal(void) const; + bool steal() const; /// Steal work at depth \a d Space* steal(Worker& stat, unsigned long int& d, Tracer& myt, Tracer& ot); /// Post no-goods void post(Space& home) const override; }; -}}} // namespace Gecode::Search::Par +} // namespace Gecode::Search::Par #include diff --git a/gecode/search/par/path.hpp b/gecode/search/par/path.hpp index 896cb50227..7094cbfc04 100644 --- a/gecode/search/par/path.hpp +++ b/gecode/search/par/path.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Search { namespace Par { +namespace Gecode::Search::Par { /* * Edge for recomputation @@ -43,7 +43,7 @@ namespace Gecode { namespace Search { namespace Par { template forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - Path::Edge::Edge(void) {} + Path::Edge::Edge() {} template forceinline @@ -54,7 +54,7 @@ namespace Gecode { namespace Search { namespace Par { template forceinline Space* - Path::Edge::space(void) const { + Path::Edge::space() const { return _space; } template @@ -65,57 +65,57 @@ namespace Gecode { namespace Search { namespace Par { template forceinline unsigned int - Path::Edge::alt(void) const { + Path::Edge::alt() const { return _alt; } template forceinline unsigned int - Path::Edge::nid(void) const { + Path::Edge::nid() const { return _nid; } template forceinline unsigned int - Path::Edge::true_alternative(void) const { + Path::Edge::true_alternative() const { return std::min(_alt, _choice->alternatives() - 1); } template forceinline bool - Path::Edge::rightmost(void) const { + Path::Edge::rightmost() const { return _alt >= _alt_max; } template forceinline bool - Path::Edge::lao(void) const { + Path::Edge::lao() const { return _alt > _alt_max; } template forceinline bool - Path::Edge::work(void) const { + Path::Edge::work() const { return _alt < _alt_max; } template forceinline void - Path::Edge::next(void) { + Path::Edge::next() { _alt++; } template forceinline unsigned int - Path::Edge::steal(void) { + Path::Edge::steal() { assert(work()); return _alt_max--; } template forceinline const Choice* - Path::Edge::choice(void) const { + Path::Edge::choice() const { return _choice; } template forceinline void - Path::Edge::dispose(void) { + Path::Edge::dispose() { delete _space; delete _choice; } @@ -132,7 +132,7 @@ namespace Gecode { namespace Search { namespace Par { template forceinline unsigned int - Path::ngdl(void) const { + Path::ngdl() const { return _ngdl; } @@ -159,7 +159,7 @@ namespace Gecode { namespace Search { namespace Par { template forceinline void - Path::next(void) { + Path::next() { while (!ds.empty()) if (ds.top().rightmost()) { ds.pop().dispose(); @@ -173,15 +173,15 @@ namespace Gecode { namespace Search { namespace Par { } template - forceinline typename Path::Edge& - Path::top(void) const { + forceinline Path::Edge& + Path::top() const { assert(!ds.empty()); return ds.top(); } template forceinline bool - Path::empty(void) const { + Path::empty() const { return ds.empty(); } @@ -194,7 +194,7 @@ namespace Gecode { namespace Search { namespace Par { template forceinline int - Path::lc(void) const { + Path::lc() const { int l = ds.entries() - 1; while (ds[l].space() == nullptr) l--; @@ -203,7 +203,7 @@ namespace Gecode { namespace Search { namespace Par { template forceinline int - Path::entries(void) const { + Path::entries() const { return ds.entries(); } @@ -245,7 +245,7 @@ namespace Gecode { namespace Search { namespace Par { template forceinline bool - Path::steal(void) const { + Path::steal() const { return n_work > Config::steal_limit; } @@ -448,6 +448,6 @@ namespace Gecode { namespace Search { namespace Par { GECODE_ES_FAIL(NoGoodsProp::post(home, *this)); } -}}} // namespace Gecode::Search::Par +} // namespace Gecode::Search::Par // STATISTICS: search-par diff --git a/gecode/search/par/pbs.cpp b/gecode/search/par/pbs.cpp index 9e5a62bc37..99c64ffcfe 100644 --- a/gecode/search/par/pbs.cpp +++ b/gecode/search/par/pbs.cpp @@ -37,7 +37,7 @@ #include #include -namespace Gecode { namespace Search { namespace Par { +namespace Gecode::Search::Par { Statistics PortfolioStatistics::update(unsigned int i, const Statistics& s) { @@ -67,10 +67,10 @@ namespace Gecode { namespace Search { namespace Par { } void - PortfolioStop::wake(void) { + PortfolioStop::wake() { WorkerControlAccess::signal_all(worker_control); } -}}} // namespace Gecode::Search::Par +} // namespace Gecode::Search::Par // STATISTICS: search-par diff --git a/gecode/search/par/pbs.hh b/gecode/search/par/pbs.hh index 7a4d3b5e3d..9c7e9d5eee 100644 --- a/gecode/search/par/pbs.hh +++ b/gecode/search/par/pbs.hh @@ -42,7 +42,7 @@ #include #include -namespace Gecode { namespace Search { namespace Par { +namespace Gecode::Search::Par { /** * \brief Statistics of the assets of a parallel portfolio @@ -66,7 +66,7 @@ namespace Gecode { namespace Search { namespace Par { /// Record statistics \a s of asset \a i and return those of the portfolio Statistics update(unsigned int i, const Statistics& s); /// Delete - ~PortfolioStatistics(void); + ~PortfolioStatistics(); }; /** @@ -101,15 +101,15 @@ namespace Gecode { namespace Search { namespace Par { /// Return true if portfolio engine must be stopped bool stop(const Statistics& s, const Options& o) override; /// Wake workers so that a paused asset can observe the portfolio stop - void wake(void); + void wake(); /// Forget which stop object stopped the asset - void reset(void); + void reset(); /// Return which stop object stopped the asset - PortfolioStopCause cause(void) const; + PortfolioStopCause cause() const; /// Signal whether search must be stopped void stop(bool s); /// Whether search must be stopped - bool stop(void) const; + bool stop() const; }; // Forward declaration @@ -128,11 +128,11 @@ namespace Gecode { namespace Search { namespace Par { public: /// Initialize as completed - Completion(void); + Completion(); /// Signal completion - void terminated(void) override; + void terminated() override; /// Wait for completion and consume the signal - void wait(void); + void wait(); } completion; /// The portfolio engine PBS* portfolio; @@ -149,29 +149,29 @@ namespace Gecode { namespace Search { namespace Par { /// Initialize with portfolio \a p, engine \a e, its stop object \a so, and the coverage \a c of its spoke Asset(PBS* p, Engine* e, Stop* so, SpokeCoverage c); /// Return the coverage of the spoke of the asset - SpokeCoverage coverage(void) const; + SpokeCoverage coverage() const; /// Return statistics of asset - Statistics statistics(void) const; + Statistics statistics() const; /// Return why the last call to next() of the asset returned no solution - EndReason end_reason(void) const; + EndReason end_reason() const; /// Return the completion terminator - Support::Terminator* terminator(void) const override; + Support::Terminator* terminator() const override; /// Wait for the asset to complete its current run - void wait(void); + void wait(); /// Wake a paused asset so that it can observe the portfolio stop - void wake(void); + void wake(); /// Constrain with better solution \a b void constrain(const Space& b); /// Return which stop object stopped the asset - PortfolioStopCause cause(void) const; + PortfolioStopCause cause() const; /// Set whether the asset is parked void parked(bool p); /// Whether the asset is parked - bool parked(void) const; + bool parked() const; /// Perform one run - void run(void) override; + void run() override; /// Delete asset - ~Asset(void) override; + ~Asset() override; }; /// Collect all solutions @@ -184,17 +184,17 @@ namespace Gecode { namespace Search { namespace Par { /// Whether it collects best solutions static const bool best = false; /// Initialize - CollectAll(void); + CollectAll(); /// Add a solution \a a reported by \a r and always return true bool add(Space* s, Asset* r); /// Dummy function bool constrain(const Space& b); /// Check whether there is any solution left - bool empty(void) const; + bool empty() const; /// Return solution reported by \a r Space* get(Asset*& r); /// Destructor - ~CollectAll(void); + ~CollectAll(); }; /// Collect best solutions @@ -209,17 +209,17 @@ namespace Gecode { namespace Search { namespace Par { /// Whether it collects best solutions static const bool best = true; /// Initialize - CollectBest(void); + CollectBest(); /// Add a solution \a s by \a r and return whether is was better bool add(Space* s, Asset* r); - /// Check whether \a b better and update accordingly - bool constrain(const Space& b); + /// Check whether \a s better and update accordingly + bool constrain(const Space& s); /// Check whether there is any solution left - bool empty(void) const; + bool empty() const; /// Return solution reported by \a r (only if a better one was found) Space* get(Asset*& r); /// Destructor - ~CollectBest(void); + ~CollectBest(); }; /// Parallel portfolio engine implementation @@ -259,7 +259,7 @@ namespace Gecode { namespace Search { namespace Par { /// Process report from asset, return false if solution was ignored bool report(Asset* asset, Space* s); /// Process failure from asset - void fail(void); + void fail(); /** * The key invariant of the engine is as follows: * - n_busy is always zero outside the next() function. @@ -271,20 +271,20 @@ namespace Gecode { namespace Search { namespace Par { */ public: /// Initialize with \a n assets, their stop objects, and the coverage of their spokes - PBS(Engine** s, Stop** so, const SpokeCoverage* c, unsigned int n, const Statistics& stat); + PBS(Engine** engines, Stop** stops, const SpokeCoverage* c, unsigned int n, const Statistics& stat0); /// Return next solution (nullptr, if none exists or search has been stopped) - Space* next(void) override; + Space* next() override; /// Return statistics - Statistics statistics(void) const override; + Statistics statistics() const override; /// Return why the last call to next() returned no solution - EndReason end_reason(void) const override; + EndReason end_reason() const override; /// Constrain future solutions to be better than \a b void constrain(const Space& b) override; /// Destructor - ~PBS(void) override; + ~PBS() override; }; -}}} // namespace Gecode::Search::Par +} // namespace Gecode::Search::Par #include diff --git a/gecode/search/par/pbs.hpp b/gecode/search/par/pbs.hpp index ef34aba34a..5db9851701 100644 --- a/gecode/search/par/pbs.hpp +++ b/gecode/search/par/pbs.hpp @@ -36,11 +36,11 @@ #include -namespace Gecode { namespace Search { namespace Par { +namespace Gecode::Search::Par { template forceinline - Asset::Completion::Completion(void) { + Asset::Completion::Completion() { // An asset has not been submitted yet. This initial signal lets the // first submission use the same consume-before-reuse handshake as all // subsequent submissions. @@ -49,18 +49,18 @@ namespace Gecode { namespace Search { namespace Par { template forceinline void - Asset::Completion::terminated(void) { + Asset::Completion::terminated() { done.signal(); } template forceinline void - Asset::Completion::wait(void) { + Asset::Completion::wait() { done.wait(); } forceinline - CollectAll::CollectAll(void) + CollectAll::CollectAll() : solutions(heap) {} forceinline bool CollectAll::add(Space* s, Asset*) { @@ -73,20 +73,20 @@ namespace Gecode { namespace Search { namespace Par { return false; } forceinline bool - CollectAll::empty(void) const { + CollectAll::empty() const { return solutions.empty(); } forceinline Space* CollectAll::get(Asset*&) { return solutions.pop(); } - forceinline CollectAll::~CollectAll(void) { + forceinline CollectAll::~CollectAll() { while (!solutions.empty()) delete solutions.pop(); } forceinline - CollectBest::CollectBest(void) + CollectBest::CollectBest() : b(nullptr), reporter(nullptr) {} forceinline bool CollectBest::add(Space* s, Asset* r) { @@ -109,7 +109,7 @@ namespace Gecode { namespace Search { namespace Par { return true; } forceinline bool - CollectBest::empty(void) const { + CollectBest::empty() const { return reporter == nullptr; } forceinline Space* @@ -119,7 +119,7 @@ namespace Gecode { namespace Search { namespace Par { reporter = nullptr; return b->clone(); } - forceinline CollectBest::~CollectBest(void) { + forceinline CollectBest::~CollectBest() { delete b; } @@ -129,7 +129,7 @@ namespace Gecode { namespace Search { namespace Par { stat[0] = s; } - forceinline PortfolioStatistics::~PortfolioStatistics(void) { + forceinline PortfolioStatistics::~PortfolioStatistics() { heap.free(stat, n); } @@ -139,12 +139,12 @@ namespace Gecode { namespace Search { namespace Par { _cause(PortfolioStopCause::None) {} forceinline void - PortfolioStop::reset(void) { + PortfolioStop::reset() { _cause.store(PortfolioStopCause::None, std::memory_order_relaxed); } forceinline PortfolioStopCause - PortfolioStop::cause(void) const { + PortfolioStop::cause() const { return _cause.load(std::memory_order_relaxed); } @@ -161,32 +161,32 @@ namespace Gecode { namespace Search { namespace Par { : Support::Runnable(false), portfolio(p), engine(e), stop(so), _coverage(c), _parked(false) {} template forceinline SpokeCoverage - Asset::coverage(void) const { + Asset::coverage() const { return _coverage; } template forceinline Statistics - Asset::statistics(void) const { + Asset::statistics() const { return engine->statistics(); } template forceinline EndReason - Asset::end_reason(void) const { + Asset::end_reason() const { return engine->end_reason(); } template forceinline Support::Terminator* - Asset::terminator(void) const { + Asset::terminator() const { return const_cast(&completion); } template forceinline void - Asset::wait(void) { + Asset::wait() { completion.wait(); } template forceinline void - Asset::wake(void) { + Asset::wake() { static_cast(stop)->wake(); } template @@ -196,7 +196,7 @@ namespace Gecode { namespace Search { namespace Par { } template forceinline PortfolioStopCause - Asset::cause(void) const { + Asset::cause() const { return static_cast(stop)->cause(); } template @@ -206,11 +206,11 @@ namespace Gecode { namespace Search { namespace Par { } template forceinline bool - Asset::parked(void) const { + Asset::parked() const { return _parked; } template - Asset::~Asset(void) { + Asset::~Asset() { delete engine; delete stop; } @@ -292,7 +292,7 @@ namespace Gecode { namespace Search { namespace Par { template forceinline void - PBS::fail(void) { + PBS::fail() { m.acquire(); if (failure == nullptr) failure = std::current_exception(); @@ -306,7 +306,7 @@ namespace Gecode { namespace Search { namespace Par { template void - Asset::run(void) { + Asset::run() { try { Space* s; do { @@ -320,7 +320,7 @@ namespace Gecode { namespace Search { namespace Par { template Space* - PBS::next(void) { + PBS::next() { m.acquire(); if (failure != nullptr) { std::exception_ptr f = failure; @@ -413,13 +413,13 @@ namespace Gecode { namespace Search { namespace Par { template EndReason - PBS::end_reason(void) const { + PBS::end_reason() const { return end; } template Statistics - PBS::statistics(void) const { + PBS::statistics() const { assert(n_busy == 0); Statistics s(stat); for (unsigned int i = 0U; i < n_assets; i++) @@ -446,7 +446,7 @@ namespace Gecode { namespace Search { namespace Par { } template - PBS::~PBS(void) { + PBS::~PBS() { // A report can make n_busy zero before Asset::run and Thread::Run::exec // have returned. Wait for the completion handshake before deleting the // PBS-owned assets. @@ -458,6 +458,6 @@ namespace Gecode { namespace Search { namespace Par { heap.free*>(assets, n_assets); } -}}} // namespace Gecode::Search::Par +} // namespace Gecode::Search::Par // STATISTICS: search-par diff --git a/gecode/search/pbs.cpp b/gecode/search/pbs.cpp index 6ff25794ac..10600a6057 100644 --- a/gecode/search/pbs.cpp +++ b/gecode/search/pbs.cpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { Stop* pbs_stop(Stop* so) { @@ -49,17 +49,16 @@ namespace Gecode { namespace Search { namespace Seq { const Statistics& stat, const Search::Options& opt, bool best) { if (best) return new PBS(assets, stops, coverage, n_assets, stat, opt); - else - return new PBS(assets, stops, coverage, n_assets, stat, opt); + return new PBS(assets, stops, coverage, n_assets, stat, opt); } -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq #ifdef GECODE_HAS_THREADS #include -namespace Gecode { namespace Search { namespace Par { +namespace Gecode::Search::Par { Stop* pbs_stop(Stop* so, const WorkerControl& control) { @@ -76,11 +75,10 @@ namespace Gecode { namespace Search { namespace Par { const Statistics& stat, bool best) { if (best) return new PBS(assets, stops, coverage, n_assets, stat); - else - return new PBS(assets, stops, coverage, n_assets, stat); + return new PBS(assets, stops, coverage, n_assets, stat); } -}}} // namespace Gecode::Search::Par +} // namespace Gecode::Search::Par #endif diff --git a/gecode/search/pbs.hpp b/gecode/search/pbs.hpp index 1011e2cf6c..28801aa472 100644 --- a/gecode/search/pbs.hpp +++ b/gecode/search/pbs.hpp @@ -35,7 +35,7 @@ #include #include -namespace Gecode { namespace Search { +namespace Gecode::Search { /// Dispose partially constructed portfolio assets forceinline void @@ -50,8 +50,8 @@ namespace Gecode { namespace Search { /// Dispose builders consumed by an explicit portfolio forceinline void pbs_cleanup(SEBs& sebs) { - for (int i = 0; i < sebs.size(); i++) - delete sebs[i]; + for (auto& seb : sebs) + delete seb; } /// Validate worker-control placement for a homogeneous portfolio @@ -210,11 +210,11 @@ namespace Gecode { namespace Search { return build>(s, opt); } -}} // namespace Gecode::Search +} // namespace Gecode::Search #include -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { /// Create stop object GECODE_SEARCH_EXPORT Stop* pbs_stop(Stop* so); @@ -227,9 +227,9 @@ namespace Gecode { namespace Search { namespace Seq { unsigned int n_assets, const Statistics& stat, const Search::Options& opt, bool best); -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq -namespace Gecode { namespace Search { namespace Par { +namespace Gecode::Search::Par { /// Create stop object GECODE_SEARCH_EXPORT Stop* pbs_stop(Stop* so, const WorkerControl& control); @@ -241,9 +241,9 @@ namespace Gecode { namespace Search { namespace Par { GECODE_SEARCH_EXPORT Engine* make_pbs_engine(Engine** assets, Stop** stops, const SpokeCoverage* coverage, unsigned int n_assets, const Statistics& stat, bool best); -}}} // namespace Gecode::Search::Par +} // namespace Gecode::Search::Par -namespace Gecode { namespace Search { +namespace Gecode::Search { template class E> Engine* @@ -430,7 +430,7 @@ namespace Gecode { namespace Search { #endif -}} // namespace Gecode::Search +} // namespace Gecode::Search namespace Gecode { @@ -518,8 +518,8 @@ namespace Gecode { bool best; { int b = 0; - for (int i = 0; i < sebs.size(); i++) - b += sebs[i]->best() ? 1 : 0; + for (auto& seb : sebs) + b += seb->best() ? 1 : 0; if ((b > 0) && (b < sebs.size())) throw Search::MixedBest("PBS::PBS"); best = (b == sebs.size()); diff --git a/gecode/search/rbs.cpp b/gecode/search/rbs.cpp index 6c6a35e219..932c352782 100644 --- a/gecode/search/rbs.cpp +++ b/gecode/search/rbs.cpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { Stop* rbs_stop(Stop* stop) { @@ -51,6 +51,6 @@ namespace Gecode { namespace Search { namespace Seq { return new RBS(hub, static_cast(stop), engine, stat, opt, best, coverage); } -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq // STATISTICS: search-seq diff --git a/gecode/search/rbs.hpp b/gecode/search/rbs.hpp index fcac1bd622..571a1b4539 100644 --- a/gecode/search/rbs.hpp +++ b/gecode/search/rbs.hpp @@ -36,7 +36,7 @@ #include #include -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { /// Create stop object GECODE_SEARCH_EXPORT Stop* rbs_stop(Stop* so); @@ -54,9 +54,9 @@ namespace Gecode { namespace Search { namespace Seq { GECODE_SEARCH_EXPORT Engine* make_rbs_engine(Space* hub, Stop* stop, Engine* engine, const Search::Statistics& stat, const Options& opt, bool best, SpokeCoverage coverage); -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq -namespace Gecode { namespace Search { +namespace Gecode::Search { /// A RBS engine builder template class E> @@ -79,30 +79,30 @@ namespace Gecode { namespace Search { return build>(s, opt); } -}} // namespace Gecode::Search +} // namespace Gecode::Search namespace Gecode { template class E> - inline RBS::RBS(T* s, const Search::Options& m_opt) { - if (m_opt.cutoff == nullptr) + inline RBS::RBS(T* s, const Search::Options& o) { + if (o.cutoff == nullptr) throw Search::UninitializedCutoff("RBS::RBS"); - Search::Options e_opt(m_opt.expand()); + Search::Options e_opt(o.expand()); Search::Statistics stat; - std::unique_ptr stop(Search::Seq::rbs_stop(m_opt.stop)); + std::unique_ptr stop(Search::Seq::rbs_stop(o.stop)); e_opt.stop = stop.get(); // Retain the seed while a potentially nested builder owns its clone. e_opt.clone = true; Search::WrapTraceRecorder::engine(e_opt.tracer, SearchTracer::EngineType::RBS, 1U); if (s->status(stat) == SS_FAILED) { stat.fail++; - if (!m_opt.clone) + if (!o.clone) delete s; e = Search::Seq::dead(e_opt, stat, Search::EndReason::Exhausted); // The engine owns the cutoff, but a dead engine does not take it - delete m_opt.cutoff; + delete o.cutoff; } else { - std::unique_ptr hub(m_opt.clone ? s->clone() : s); + std::unique_ptr hub(o.clone ? s->clone() : s); Search::Statistics start; HubContext hc = Search::MetaContextAccess::hub(MetaEngine::Restart, MetaEvent::Start, MetaDecision::Restart, 0UL, 0U, 1U, nullptr, start, NoGoods::eng); @@ -113,7 +113,7 @@ namespace Gecode { if (r == Search::EndReason::Exhausted) stat.fail++; e = Search::Seq::dead(e_opt, stat, r); - delete m_opt.cutoff; + delete o.cutoff; return; } std::unique_ptr spoke(hub->clone()); @@ -123,7 +123,7 @@ namespace Gecode { spoke->random_split(sc); hub->reserve_brancher_ids(*spoke); std::unique_ptr leaf(Search::build(spoke.get(), e_opt)); - e = Search::Seq::make_rbs_engine(hub.get(), stop.get(), leaf.get(), stat, m_opt, E::best, sc.coverage()); + e = Search::Seq::make_rbs_engine(hub.get(), stop.get(), leaf.get(), stat, o, E::best, sc.coverage()); (void)hub.release(); (void)stop.release(); (void)leaf.release(); diff --git a/gecode/search/relax.hh b/gecode/search/relax.hh index eb293fa183..13aae0536d 100644 --- a/gecode/search/relax.hh +++ b/gecode/search/relax.hh @@ -36,7 +36,7 @@ #include #include -namespace Gecode { namespace Search { +namespace Gecode::Search { /// Relax variables in \a x from solution \a sx with probability \a p template @@ -64,7 +64,7 @@ namespace Gecode { namespace Search { } } -}} // namespace Gecode::Search +} // namespace Gecode::Search #endif diff --git a/gecode/search/sebs.hpp b/gecode/search/sebs.hpp index 6e6c444186..142f80b9dc 100644 --- a/gecode/search/sebs.hpp +++ b/gecode/search/sebs.hpp @@ -33,7 +33,7 @@ namespace Gecode { forceinline - SEBs::SEBs(void) + SEBs::SEBs() : ArgArray(0) {} forceinline diff --git a/gecode/search/seq/astar.hh b/gecode/search/seq/astar.hh index db22a58b9b..644e62cc70 100644 --- a/gecode/search/seq/astar.hh +++ b/gecode/search/seq/astar.hh @@ -38,7 +38,7 @@ #include #ifdef GECODE_HAS_EXPERIMENTAL -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { /// Sequential A* search class AStar : public Worker { @@ -74,18 +74,18 @@ namespace Gecode { namespace Search { namespace Seq { /// Initialize for space \a s with options \a o AStar(Space* s, const Options& o); /// Return next better solution (nullptr if none or stopped) - Space* next(void); + Space* next(); /// Return statistics - Statistics statistics(void) const; - /// Constrain future solutions to be better than \a b - void constrain(const Space& b); + Statistics statistics() const; + /// Constrain future solutions to be better than \a s + void constrain(const Space& s); /// Reset engine to restart at space \a s void reset(Space* s); /// Return no-goods (none) - NoGoods& nogoods(void); + NoGoods& nogoods(); }; -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq #endif diff --git a/gecode/search/seq/bab.hh b/gecode/search/seq/bab.hh index 6d87803fe3..ed353cf052 100644 --- a/gecode/search/seq/bab.hh +++ b/gecode/search/seq/bab.hh @@ -42,7 +42,7 @@ #include #include -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { /// Implementation of depth-first branch-and-bound search engine template @@ -67,20 +67,20 @@ namespace Gecode { namespace Search { namespace Seq { /// Initialize with space \a s and search options \a o BAB(Space* s, const Options& o); /// %Search for next better solution - Space* next(void); + Space* next(); /// Return statistics - Statistics statistics(void) const; + Statistics statistics() const; /// Constrain future solutions to be better than \a b void constrain(const Space& b); /// Reset engine to restart at space \a s void reset(Space* s); /// Return no-goods - NoGoods& nogoods(void); + NoGoods& nogoods(); /// Destructor - ~BAB(void); + ~BAB(); }; -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq #include diff --git a/gecode/search/seq/bab.hpp b/gecode/search/seq/bab.hpp index 140a029e7a..1bbb9fd24f 100644 --- a/gecode/search/seq/bab.hpp +++ b/gecode/search/seq/bab.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { template forceinline @@ -58,7 +58,7 @@ namespace Gecode { namespace Search { namespace Seq { template forceinline Space* - BAB::next(void) { + BAB::next() { /* * The engine maintains the following invariant: * - If the current space (cur) is not nullptr, the path always points @@ -150,7 +150,7 @@ namespace Gecode { namespace Search { namespace Seq { template forceinline Statistics - BAB::statistics(void) const { + BAB::statistics() const { return *this; } @@ -191,18 +191,18 @@ namespace Gecode { namespace Search { namespace Seq { template forceinline NoGoods& - BAB::nogoods(void) { + BAB::nogoods() { return path; } template - forceinline BAB::~BAB(void) { + forceinline BAB::~BAB() { tracer.done(); path.reset(); delete best; delete cur; } -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq // STATISTICS: search-seq diff --git a/gecode/search/seq/cabs.hh b/gecode/search/seq/cabs.hh index 0f89a17799..341487ad3b 100644 --- a/gecode/search/seq/cabs.hh +++ b/gecode/search/seq/cabs.hh @@ -38,7 +38,7 @@ #include #ifdef GECODE_HAS_EXPERIMENTAL -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { /// Sequential complete anytime beam search class CABS : public Worker { @@ -76,7 +76,7 @@ namespace Gecode { namespace Search { namespace Seq { /// Make \a s the incumbent and return a copy, if it improves Space* publish(std::unique_ptr s); /// Move to the next layer or pass, false if done - bool advance(void); + bool advance(); /// Start search from root \a s void initialize(Space* s, bool clone); @@ -84,20 +84,20 @@ namespace Gecode { namespace Search { namespace Seq { /// Initialize for space \a s with options \a o CABS(Space* s, const Options& o); /// Return next better solution (nullptr if none or stopped) - Space* next(void); + Space* next(); /// Return statistics - Statistics statistics(void) const; + Statistics statistics() const; /// Return why next() returned no solution, Incomplete at the width or frontier limit - EndReason end_reason(void) const; - /// Constrain future solutions to be better than \a b - void constrain(const Space& b); + EndReason end_reason() const; + /// Constrain future solutions to be better than \a s + void constrain(const Space& s); /// Reset engine to restart at space \a s void reset(Space* s); /// Return no-goods (none) - NoGoods& nogoods(void); + NoGoods& nogoods(); }; -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq #endif diff --git a/gecode/search/seq/choice-expansion.hh b/gecode/search/seq/choice-expansion.hh index c6479924ed..44485f7322 100644 --- a/gecode/search/seq/choice-expansion.hh +++ b/gecode/search/seq/choice-expansion.hh @@ -38,7 +38,7 @@ #include #ifdef GECODE_HAS_EXPERIMENTAL -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { /// Result of expanding one alternative class ExpansionStep { @@ -70,15 +70,15 @@ namespace Gecode { namespace Search { namespace Seq { public: /// Initialize without node - ChoiceExpansion(void) : alternative(0) {} + ChoiceExpansion() : alternative(0) {} /// Whether there is a node explicit - operator bool(void) const { + operator bool() const { return static_cast(parent); } /// Return the node Space& - space(void) const { + space() const { return *parent; } /// Take stable node \a s @@ -90,13 +90,13 @@ namespace Gecode { namespace Search { namespace Seq { } /// Return the node before its choice has been computed std::unique_ptr - take(void) { + take() { assert(!choice); return std::move(parent); } /// Delete the node void - reset(void) { + reset() { choice.reset(); parent.reset(); alternative = 0; @@ -144,7 +144,7 @@ namespace Gecode { namespace Search { namespace Seq { } }; -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq #endif diff --git a/gecode/search/seq/dead.cpp b/gecode/search/seq/dead.cpp index 8647ad255c..fd87d4637e 100644 --- a/gecode/search/seq/dead.cpp +++ b/gecode/search/seq/dead.cpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { /// A dead engine (failed root, or a meta engine that has finished) template @@ -51,13 +51,13 @@ namespace Gecode { namespace Search { namespace Seq { /// Initialize, next() returns no solution for reason \a r Dead(const Options& o, const Statistics& stat0, EndReason r); /// Return next solution (nullptr, if none exists or search has been stopped) - Space* next(void) override; + Space* next() override; /// Return statistics - Statistics statistics(void) const override; + Statistics statistics() const override; /// Return why the last call to next() returned no solution - EndReason end_reason(void) const override; + EndReason end_reason() const override; /// Delete - ~Dead(void) override; + ~Dead() override; }; template @@ -69,25 +69,25 @@ namespace Gecode { namespace Search { namespace Seq { template Space* - Dead::next(void) { + Dead::next() { end = reason; return nullptr; } template EndReason - Dead::end_reason(void) const { + Dead::end_reason() const { return end; } template Statistics - Dead::statistics(void) const { + Dead::statistics() const { return stat; } template - Dead::~Dead(void) { + Dead::~Dead() { tracer.done(); } @@ -95,10 +95,9 @@ namespace Gecode { namespace Search { namespace Seq { dead(const Options& o, const Statistics& stat, EndReason r) { if (o.tracer) return new Dead(o, stat, r); - else - return new Dead(o, stat, r); + return new Dead(o, stat, r); } -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq // STATISTICS: search-seq diff --git a/gecode/search/seq/dead.hh b/gecode/search/seq/dead.hh index 8b91739fa1..3da8071038 100644 --- a/gecode/search/seq/dead.hh +++ b/gecode/search/seq/dead.hh @@ -35,13 +35,13 @@ #ifndef GECODE_SEARCH_SEQ_DEAD_HH #define GECODE_SEARCH_SEQ_DEAD_HH -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { /// Create an engine without solutions whose next() ends for reason \a r GECODE_SEARCH_EXPORT Engine* dead(const Options& o, const Statistics& stat, EndReason r); -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq #endif diff --git a/gecode/search/seq/dfs.hh b/gecode/search/seq/dfs.hh index 4583ad37c8..e2a0a980d6 100644 --- a/gecode/search/seq/dfs.hh +++ b/gecode/search/seq/dfs.hh @@ -38,7 +38,7 @@ #include #include -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { /// Depth-first search engine implementation template @@ -59,20 +59,20 @@ namespace Gecode { namespace Search { namespace Seq { /// Initialize for space \a s with options \a o DFS(Space* s, const Options& o); /// %Search for next solution - Space* next(void); + Space* next(); /// Return statistics - Statistics statistics(void) const; + Statistics statistics() const; /// Constrain future solutions to be better than \a b (should never be called) void constrain(const Space& b); /// Reset engine to restart at space \a s void reset(Space* s); /// Return no-goods - NoGoods& nogoods(void); + NoGoods& nogoods(); /// Destructor - ~DFS(void); + ~DFS(); }; -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq #include diff --git a/gecode/search/seq/dfs.hpp b/gecode/search/seq/dfs.hpp index 6a95ea67ef..3c4480ae08 100644 --- a/gecode/search/seq/dfs.hpp +++ b/gecode/search/seq/dfs.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { template forceinline @@ -72,13 +72,13 @@ namespace Gecode { namespace Search { namespace Seq { template forceinline NoGoods& - DFS::nogoods(void) { + DFS::nogoods() { return path; } template forceinline Space* - DFS::next(void) { + DFS::next() { /* * The engine maintains the following invariant: * - If the current space (cur) is not nullptr, the path always points @@ -162,7 +162,7 @@ namespace Gecode { namespace Search { namespace Seq { template forceinline Statistics - DFS::statistics(void) const { + DFS::statistics() const { return *this; } @@ -174,12 +174,12 @@ namespace Gecode { namespace Search { namespace Seq { } template - forceinline DFS::~DFS(void) { + forceinline DFS::~DFS() { delete cur; tracer.done(); path.reset(); } -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq // STATISTICS: search-seq diff --git a/gecode/search/seq/lds.hh b/gecode/search/seq/lds.hh index b2d766dfbc..704ea6f17f 100644 --- a/gecode/search/seq/lds.hh +++ b/gecode/search/seq/lds.hh @@ -37,14 +37,14 @@ #include #include -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { /// %Probe engine for %LDS template class Probe : public Worker { protected: /// Node identity type - typedef typename Tracer::ID ID; + using ID = Tracer::ID; /// %Node in the search tree for %LDS class Node { private: @@ -59,19 +59,19 @@ namespace Gecode { namespace Search { namespace Seq { public: /// Default constructor - Node(void); + Node(); /// Initialize with node \a s, choice \a c, and alternative \a a Node(Space* s, const Choice* c, unsigned int a, unsigned int nid); /// Return space - Space* space(void) const; + Space* space() const; /// Return choice - const Choice* choice(void) const; + const Choice* choice() const; /// Return next alternative - unsigned int alt(void) const; + unsigned int alt() const; /// Return node identifier - unsigned int nid(void) const; + unsigned int nid() const; /// %Set next alternative - void next(void); + void next(); }; /// Search tracer Tracer tracer; @@ -92,13 +92,13 @@ namespace Gecode { namespace Search { namespace Seq { /// Reset with space \a s and discrepancy \a d void reset(Space* s, unsigned int d); /// Return statistics - Statistics statistics(void) const; + Statistics statistics() const; /// Destructor - ~Probe(void); + ~Probe(); /// %Search for next solution Space* next(const Options& o); /// Test whether probing is done - bool done(void) const; + bool done() const; }; /// Limited discrepancy search engine implementation @@ -120,20 +120,20 @@ namespace Gecode { namespace Search { namespace Seq { /// Initialize for space \a s with options \a o LDS(Space* s, const Options& o); /// Return next solution (nullptr, if none exists or search has been stopped) - Space* next(void) override; + Space* next() override; /// Return statistics - Statistics statistics(void) const override; + Statistics statistics() const override; /// Constrain future solutions to be better than \a b (should never be called) void constrain(const Space& b) override; /// Reset engine to restart at space \a s void reset(Space* s) override; /// Return why the last call to next() returned no solution - EndReason end_reason(void) const override; + EndReason end_reason() const override; /// Destructor - ~LDS(void) override; + ~LDS() override; }; -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq #include diff --git a/gecode/search/seq/lds.hpp b/gecode/search/seq/lds.hpp index dc4fe246f4..e8bc977227 100644 --- a/gecode/search/seq/lds.hpp +++ b/gecode/search/seq/lds.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { /* * Nodes for the probing engine (just remember next alternative @@ -41,7 +41,7 @@ namespace Gecode { namespace Search { namespace Seq { template forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - Probe::Node::Node(void) {} + Probe::Node::Node() {} template forceinline @@ -50,31 +50,31 @@ namespace Gecode { namespace Search { namespace Seq { template forceinline Space* - Probe::Node::space(void) const { + Probe::Node::space() const { return _space; } template forceinline const Choice* - Probe::Node::choice(void) const { + Probe::Node::choice() const { return _choice; } template forceinline unsigned int - Probe::Node::alt(void) const { + Probe::Node::alt() const { return _alt; } template forceinline unsigned int - Probe::Node::nid(void) const { + Probe::Node::nid() const { return _nid; } template forceinline void - Probe::Node::next(void) { + Probe::Node::next() { _alt--; } @@ -123,18 +123,18 @@ namespace Gecode { namespace Search { namespace Seq { template forceinline Statistics - Probe::statistics(void) const { + Probe::statistics() const { return *this; } template forceinline bool - Probe::done(void) const { + Probe::done() const { return exhausted; } template - forceinline Probe::~Probe(void) { + forceinline Probe::~Probe() { tracer.done(); delete cur; while (!ds.empty()) { @@ -288,7 +288,7 @@ namespace Gecode { namespace Search { namespace Seq { template Space* - LDS::next(void) { + LDS::next() { while (true) { Space* s = e.next(opt); if (s != nullptr) { @@ -321,13 +321,13 @@ namespace Gecode { namespace Search { namespace Seq { template EndReason - LDS::end_reason(void) const { + LDS::end_reason() const { return end; } template Statistics - LDS::statistics(void) const { + LDS::statistics() const { return e.statistics(); } @@ -362,10 +362,10 @@ namespace Gecode { namespace Search { namespace Seq { } template - LDS::~LDS(void) { + LDS::~LDS() { delete root; } -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq // STATISTICS: search-seq diff --git a/gecode/search/seq/path.hh b/gecode/search/seq/path.hh index 4282bed528..043b3075d8 100644 --- a/gecode/search/seq/path.hh +++ b/gecode/search/seq/path.hh @@ -44,7 +44,7 @@ #include #include -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { /** * \brief Depth-first path (stack of edges) supporting recomputation @@ -65,7 +65,7 @@ namespace Gecode { namespace Search { namespace Seq { public: /// Node identity type - typedef typename Tracer::ID ID; + using ID = Tracer::ID; /// %Search tree edge for recomputation class Edge { protected: @@ -80,36 +80,36 @@ namespace Gecode { namespace Search { namespace Seq { public: /// Default constructor - Edge(void); + Edge(); /// Edge for space \a s with clone \a c (possibly nullptr) Edge(Space* s, Space* c, unsigned int nid); /// Return space for edge - Space* space(void) const; + Space* space() const; /// Set space to \a s void space(Space* s); /// Return choice - const Choice* choice(void) const; + const Choice* choice() const; /// Return number for alternatives - unsigned int alt(void) const; + unsigned int alt() const; /// Return true number for alternatives (excluding lao optimization) - unsigned int true_alternative(void) const; + unsigned int true_alternative() const; /// Test whether current alternative is leftmost - bool leftmost(void) const; + bool leftmost() const; /// Test whether current alternative is rightmost - bool rightmost(void) const; + bool rightmost() const; /// Move to next alternative - void next(void); + void next(); /// Test whether current alternative was LAO - bool lao(void) const; + bool lao() const; /// Return node identifier - unsigned int nid(void) const; + unsigned int nid() const; /// Free memory for edge - void dispose(void); + void dispose(); }; protected: @@ -122,19 +122,19 @@ namespace Gecode { namespace Search { namespace Seq { /// Initialize with no-good depth limit \a l Path(unsigned int l); /// Return no-good depth limit - unsigned int ngdl(void) const; + unsigned int ngdl() const; /// Set no-good depth limit to \a l void ngdl(unsigned int l); /// Push space \a c (a clone of \a s or nullptr) const Choice* push(Worker& stat, Space* s, Space* c, unsigned int nid); /// Generate path for next node - void next(void); + void next(); /// Provide access to topmost edge - Edge& top(void) const; + Edge& top() const; /// Test whether path is empty - bool empty(void) const; + bool empty() const; /// Return position on stack of last copy - int lc(void) const; + int lc() const; /// Unwind the stack up to position \a l (after failure) void unwind(int l, Tracer& t); /// Commit space \a s as described by stack entry at position \a i @@ -144,14 +144,14 @@ namespace Gecode { namespace Search { namespace Seq { /// Recompute space according to path Space* recompute(unsigned int& d, unsigned int a_d, Worker& s, const Space* best, int& mark, Tracer& t); /// Return number of entries on stack - int entries(void) const; + int entries() const; /// Reset stack - void reset(void); + void reset(); /// Post no-goods void post(Space& home) const override; }; -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq #include diff --git a/gecode/search/seq/path.hpp b/gecode/search/seq/path.hpp index 918d329372..59d68dbc22 100644 --- a/gecode/search/seq/path.hpp +++ b/gecode/search/seq/path.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { /* * Edge for recomputation @@ -43,7 +43,7 @@ namespace Gecode { namespace Search { namespace Seq { template forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - Path::Edge::Edge(void) {} + Path::Edge::Edge() {} template forceinline @@ -52,7 +52,7 @@ namespace Gecode { namespace Search { namespace Seq { template forceinline Space* - Path::Edge::space(void) const { + Path::Edge::space() const { return _space; } template @@ -63,50 +63,50 @@ namespace Gecode { namespace Search { namespace Seq { template forceinline unsigned int - Path::Edge::alt(void) const { + Path::Edge::alt() const { return _alt; } template forceinline unsigned int - Path::Edge::true_alternative(void) const { + Path::Edge::true_alternative() const { return std::min(_alt, _choice->alternatives() - 1); } template forceinline bool - Path::Edge::leftmost(void) const { + Path::Edge::leftmost() const { return _alt == 0; } template forceinline bool - Path::Edge::rightmost(void) const { + Path::Edge::rightmost() const { return _alt + 1 >= _choice->alternatives(); } template forceinline bool - Path::Edge::lao(void) const { + Path::Edge::lao() const { return _alt >= _choice->alternatives(); } template forceinline void - Path::Edge::next(void) { + Path::Edge::next() { _alt++; } template forceinline const Choice* - Path::Edge::choice(void) const { + Path::Edge::choice() const { return _choice; } template forceinline unsigned int - Path::Edge::nid(void) const { + Path::Edge::nid() const { return _nid; } template forceinline void - Path::Edge::dispose(void) { + Path::Edge::dispose() { delete _space; delete _choice; } @@ -123,7 +123,7 @@ namespace Gecode { namespace Search { namespace Seq { template forceinline unsigned int - Path::ngdl(void) const { + Path::ngdl() const { return _ngdl; } @@ -148,7 +148,7 @@ namespace Gecode { namespace Search { namespace Seq { template forceinline void - Path::next(void) { + Path::next() { while (!ds.empty()) if (ds.top().rightmost()) { ds.pop().dispose(); @@ -159,15 +159,15 @@ namespace Gecode { namespace Search { namespace Seq { } template - forceinline typename Path::Edge& - Path::top(void) const { + forceinline Path::Edge& + Path::top() const { assert(!ds.empty()); return ds.top(); } template forceinline bool - Path::empty(void) const { + Path::empty() const { return ds.empty(); } @@ -180,7 +180,7 @@ namespace Gecode { namespace Search { namespace Seq { template forceinline int - Path::lc(void) const { + Path::lc() const { int l = ds.entries() - 1; while (ds[l].space() == nullptr) l--; @@ -189,7 +189,7 @@ namespace Gecode { namespace Search { namespace Seq { template forceinline int - Path::entries(void) const { + Path::entries() const { return ds.entries(); } @@ -217,7 +217,7 @@ namespace Gecode { namespace Search { namespace Seq { template inline void - Path::reset(void) { + Path::reset() { while (!ds.empty()) ds.pop().dispose(); } @@ -385,6 +385,6 @@ namespace Gecode { namespace Search { namespace Seq { GECODE_ES_FAIL(NoGoodsProp::post(home, *this)); } -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq // STATISTICS: search-seq diff --git a/gecode/search/seq/pbs.cpp b/gecode/search/seq/pbs.cpp index 1907c98fd5..dc8a6891b4 100644 --- a/gecode/search/seq/pbs.cpp +++ b/gecode/search/seq/pbs.cpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { bool PortfolioStop::stop(const Statistics& s, const Options& o) { @@ -51,6 +51,6 @@ namespace Gecode { namespace Search { namespace Seq { return false; } -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq // STATISTICS: search-seq diff --git a/gecode/search/seq/pbs.hh b/gecode/search/seq/pbs.hh index f88a2aea49..7ff813f949 100644 --- a/gecode/search/seq/pbs.hh +++ b/gecode/search/seq/pbs.hh @@ -36,7 +36,7 @@ #include #include -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { /// Shared stop information class SharedStopInfo { @@ -88,7 +88,7 @@ namespace Gecode { namespace Search { namespace Seq { public: /// Default constructor - Asset(void); + Asset(); /// Copy constructor Asset(const Asset& s) = default; /// Assignment operator @@ -96,23 +96,23 @@ namespace Gecode { namespace Search { namespace Seq { /// Initialize with engine \a e, its stop object \a so, and the coverage \a c of its spoke void init(Engine* e, Stop* so, SpokeCoverage c); /// Return the coverage of the spoke of the asset - SpokeCoverage coverage(void) const; + SpokeCoverage coverage() const; /// Return next solution - Space* next(void); + Space* next(); /// Return statistics of asset - Statistics statistics(void) const; + Statistics statistics() const; /// Return why the last call to next() of the asset returned no solution - EndReason end_reason(void) const; + EndReason end_reason() const; /// Constrain with better solution \a b void constrain(const Space& b); /// Park the asset after its stop object stopped it - void park(void); + void park(); /// Resume a parked asset - void resume(void); + void resume(); /// Whether the asset is parked - bool parked(void) const; + bool parked() const; /// Delete asset - ~Asset(void); + ~Asset(); }; /// Sequential portfolio engine implementation @@ -136,21 +136,21 @@ namespace Gecode { namespace Search { namespace Seq { public: /// Initialize with \a n assets, their stop objects, and the coverage of their spokes - PBS(Engine** assets, Stop** stops, const SpokeCoverage* coverage, unsigned int n, const Statistics& stat, + PBS(Engine** e, Stop** s, const SpokeCoverage* c, unsigned int n, const Statistics& stat0, const Search::Options& opt); /// Return next solution (nullptr, if none exists or search has been stopped) - Space* next(void) override; + Space* next() override; /// Return statistics - Statistics statistics(void) const override; + Statistics statistics() const override; /// Return why the last call to next() returned no solution - EndReason end_reason(void) const override; + EndReason end_reason() const override; /// Constrain future solutions to be better than \a b void constrain(const Space& b) override; /// Destructor - ~PBS(void) override; + ~PBS() override; }; -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq #include diff --git a/gecode/search/seq/pbs.hpp b/gecode/search/seq/pbs.hpp index 1feb66c87f..c8f10171c4 100644 --- a/gecode/search/seq/pbs.hpp +++ b/gecode/search/seq/pbs.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { forceinline PortfolioStop::PortfolioStop(Stop* so0, Stop* po0) @@ -43,7 +43,7 @@ namespace Gecode { namespace Search { namespace Seq { } forceinline - Asset::Asset(void) + Asset::Asset() : engine(nullptr), stop(nullptr), _coverage(SpokeCoverage::Full), _parked(false) {} forceinline void Asset::init(Engine* e, Stop* so, SpokeCoverage c) { @@ -52,19 +52,19 @@ namespace Gecode { namespace Search { namespace Seq { _coverage = c; } forceinline SpokeCoverage - Asset::coverage(void) const { + Asset::coverage() const { return _coverage; } forceinline Space* - Asset::next(void) { + Asset::next() { return engine->next(); } forceinline Statistics - Asset::statistics(void) const { + Asset::statistics() const { return engine->statistics(); } forceinline EndReason - Asset::end_reason(void) const { + Asset::end_reason() const { return engine->end_reason(); } forceinline void @@ -72,18 +72,18 @@ namespace Gecode { namespace Search { namespace Seq { engine->constrain(b); } forceinline void - Asset::park(void) { + Asset::park() { _parked = true; } forceinline void - Asset::resume(void) { + Asset::resume() { _parked = false; } forceinline bool - Asset::parked(void) const { + Asset::parked() const { return _parked; } - forceinline Asset::~Asset(void) { + forceinline Asset::~Asset() { delete engine; delete stop; } @@ -104,7 +104,7 @@ namespace Gecode { namespace Search { namespace Seq { template Space* - PBS::next(void) { + PBS::next() { // An asset has proven that no further solution exists if (end == EndReason::Exhausted) return nullptr; @@ -186,13 +186,13 @@ namespace Gecode { namespace Search { namespace Seq { template EndReason - PBS::end_reason(void) const { + PBS::end_reason() const { return end; } template Statistics - PBS::statistics(void) const { + PBS::statistics() const { Statistics s(stat); for (unsigned int i = 0U; i < n_assets; i++) s += assets[i].statistics(); @@ -209,13 +209,13 @@ namespace Gecode { namespace Search { namespace Seq { } template - PBS::~PBS(void) { + PBS::~PBS() { for (unsigned int i = 0U; i < n_assets; i++) assets[i].~Asset(); // Note that n_assets might be different now! heap.rfree(assets); } -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq // STATISTICS: search-seq diff --git a/gecode/search/seq/rbs.cpp b/gecode/search/seq/rbs.cpp index 4b391d9813..0488c2c658 100644 --- a/gecode/search/seq/rbs.cpp +++ b/gecode/search/seq/rbs.cpp @@ -38,7 +38,7 @@ #include -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { namespace { @@ -76,7 +76,7 @@ namespace Gecode { namespace Search { namespace Seq { } NoGoods& - RBS::hub_nogoods(void) { + RBS::hub_nogoods() { // The no-goods hold in the hub only for a spoke of full coverage if (coverage != SpokeCoverage::Full) return NoGoods::eng; @@ -142,7 +142,7 @@ namespace Gecode { namespace Search { namespace Seq { } Space* - RBS::next(void) { + RBS::next() { // A proof or a decision to finish ends the search if ((end == EndReason::Exhausted) || (end == EndReason::Incomplete)) return nullptr; @@ -203,7 +203,7 @@ namespace Gecode { namespace Search { namespace Seq { } Search::Statistics - RBS::statistics(void) const { + RBS::statistics() const { return stop->metastatistics() + e->statistics(); } @@ -222,7 +222,7 @@ namespace Gecode { namespace Search { namespace Seq { } EndReason - RBS::end_reason(void) const { + RBS::end_reason() const { /* * What might happen during parallel search is that the engine has * been stopped by the cutoff but the meta engine reports a limit, @@ -233,7 +233,7 @@ namespace Gecode { namespace Search { namespace Seq { return end; } - RBS::~RBS(void) { + RBS::~RBS() { delete e; delete hub; delete last; @@ -241,6 +241,6 @@ namespace Gecode { namespace Search { namespace Seq { delete stop; } -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq // STATISTICS: search-seq diff --git a/gecode/search/seq/rbs.hh b/gecode/search/seq/rbs.hh index 37541ca5a1..5b6bb087d9 100644 --- a/gecode/search/seq/rbs.hh +++ b/gecode/search/seq/rbs.hh @@ -39,7 +39,7 @@ #include -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { class RBS; @@ -69,7 +69,7 @@ namespace Gecode { namespace Search { namespace Seq { /// Return true if the stop object for the meta engine says so bool meta_stop(const Statistics& s, const Options& o); /// Increment current restart count - void restart(void); + void restart(); /// Add no-goods to meta statistics void nogood(unsigned long int n); /// Test hub status with meta statistics @@ -81,9 +81,9 @@ namespace Gecode { namespace Search { namespace Seq { /// Update statistics void update(const Search::Statistics& s); /// Return whether the engine has been stopped - bool enginestopped(void) const; + bool enginestopped() const; /// Return statistics for the meta engine - Statistics metastatistics(void) const; + Statistics metastatistics() const; }; /// Engine for restart-based search @@ -112,7 +112,7 @@ namespace Gecode { namespace Search { namespace Seq { /// Why the last call to next() returned no solution EndReason end; /// Return the no-goods of the last spoke search, valid in the hub - NoGoods& hub_nogoods(void); + NoGoods& hub_nogoods(); /// Call hub() for event \a ev and act on its decision, return whether search continues bool hub_event(MetaEvent ev); @@ -126,18 +126,18 @@ namespace Gecode { namespace Search { namespace Seq { RBS(Space* s, RestartStop* stop0, Engine* e0, const Search::Statistics& stat, const Options& o, bool best, SpokeCoverage coverage); /// Return next solution (nullptr, if none exists or search has been stopped) - Space* next(void) override; + Space* next() override; /// Return statistics - Statistics statistics(void) const override; + Statistics statistics() const override; /// Return why the last call to next() returned no solution - EndReason end_reason(void) const override; + EndReason end_reason() const override; /// Constrain future solutions to be better than \a b void constrain(const Space& b) override; /// Destructor - ~RBS(void) override; + ~RBS() override; }; -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq #include diff --git a/gecode/search/seq/rbs.hpp b/gecode/search/seq/rbs.hpp index 3ea801ad9e..42487a5d37 100644 --- a/gecode/search/seq/rbs.hpp +++ b/gecode/search/seq/rbs.hpp @@ -34,14 +34,14 @@ * */ -namespace Gecode { namespace Search { namespace Seq { +namespace Gecode::Search::Seq { forceinline RestartStop::RestartStop(Stop* s) : l(0U), m_stop(s), e_stopped(false) {} forceinline void - RestartStop::restart(void) { + RestartStop::restart() { Support::Lock lock(m); m_stat.restart++; } @@ -80,13 +80,13 @@ namespace Gecode { namespace Search { namespace Seq { } forceinline bool - RestartStop::enginestopped(void) const { + RestartStop::enginestopped() const { Support::Lock lock(m); return e_stopped; } forceinline Statistics - RestartStop::metastatistics(void) const { + RestartStop::metastatistics() const { Support::Lock lock(m); return m_stat; } @@ -99,6 +99,6 @@ namespace Gecode { namespace Search { namespace Seq { stop->limit(stat, (*co)()); } -}}} // namespace Gecode::Search::Seq +} // namespace Gecode::Search::Seq // STATISTICS: search-seq diff --git a/gecode/search/statistics.hpp b/gecode/search/statistics.hpp index 9be3ce8855..11080ccd16 100644 --- a/gecode/search/statistics.hpp +++ b/gecode/search/statistics.hpp @@ -32,10 +32,10 @@ #include -namespace Gecode { namespace Search { +namespace Gecode::Search { forceinline void - Statistics::reset(void) { + Statistics::reset() { StatusStatistics::reset(); fail = 0ULL; node = 0ULL; @@ -45,7 +45,7 @@ namespace Gecode { namespace Search { } forceinline - Statistics::Statistics(void) + Statistics::Statistics() : fail(0ULL), node(0ULL), depth(0UL), restart(0UL), nogood(0UL) {} forceinline Statistics& @@ -65,6 +65,6 @@ namespace Gecode { namespace Search { return t += *this; } -}} // namespace Gecode::Search +} // namespace Gecode::Search // STATISTICS: search-other diff --git a/gecode/search/stop.cpp b/gecode/search/stop.cpp index 2abbe6588b..b1197ac5fa 100644 --- a/gecode/search/stop.cpp +++ b/gecode/search/stop.cpp @@ -36,7 +36,7 @@ #include -namespace Gecode { namespace Search { +namespace Gecode::Search { /* * Creation functions for stop objects @@ -97,6 +97,6 @@ namespace Gecode { namespace Search { return s.restart > l.load(std::memory_order_acquire); } -}} // namespace Gecode::Search +} // namespace Gecode::Search // STATISTICS: search-other diff --git a/gecode/search/stop.hpp b/gecode/search/stop.hpp index 93e9dc715e..35dd465b5d 100644 --- a/gecode/search/stop.hpp +++ b/gecode/search/stop.hpp @@ -34,13 +34,13 @@ * */ -namespace Gecode { namespace Search { +namespace Gecode::Search { /* * Base class * */ - forceinline Stop::~Stop(void) = default; + forceinline Stop::~Stop() = default; /* * Stopping for node limit @@ -61,7 +61,7 @@ namespace Gecode { namespace Search { } forceinline unsigned long long int - NodeStop::limit(void) const { + NodeStop::limit() const { return l.load(std::memory_order_acquire); } @@ -89,7 +89,7 @@ namespace Gecode { namespace Search { } forceinline unsigned long long int - FailStop::limit(void) const { + FailStop::limit() const { return l.load(std::memory_order_acquire); } @@ -120,7 +120,7 @@ namespace Gecode { namespace Search { } forceinline double - TimeStop::limit(void) const { + TimeStop::limit() const { return l.load(std::memory_order_acquire); } @@ -130,7 +130,7 @@ namespace Gecode { namespace Search { } forceinline void - TimeStop::reset(void) { + TimeStop::reset() { t0.store(clock::now().time_since_epoch().count(), std::memory_order_release); } @@ -153,7 +153,7 @@ namespace Gecode { namespace Search { } forceinline unsigned long long int - RestartStop::limit(void) const { + RestartStop::limit() const { return l.load(std::memory_order_acquire); } @@ -162,6 +162,6 @@ namespace Gecode { namespace Search { l.store(l0, std::memory_order_release); } -}} // namespace Gecode::Search +} // namespace Gecode::Search // STATISTICS: search-other diff --git a/gecode/search/support.hh b/gecode/search/support.hh index 641e0451fc..11e58b3b0b 100644 --- a/gecode/search/support.hh +++ b/gecode/search/support.hh @@ -35,7 +35,7 @@ #include -namespace Gecode { namespace Search { +namespace Gecode::Search { /// Whether incoming solution \a s should replace incumbent \a b forceinline bool @@ -93,17 +93,17 @@ namespace Gecode { namespace Search { /// Initialization WorkerToEngine(Space* s, const Options& o); /// Return next solution (nullptr, if none exists or search has been stopped) - Space* next(void) override; + Space* next() override; /// Return statistics - Search::Statistics statistics(void) const override; + Search::Statistics statistics() const override; /// Return why the last call to next() returned no solution - EndReason end_reason(void) const override; + EndReason end_reason() const override; /// Constrain future solutions to be better than \a b void constrain(const Space& b) override; /// Reset engine to restart at space \a s void reset(Space* s) override; /// Return no-goods - NoGoods& nogoods(void) override; + NoGoods& nogoods() override; }; forceinline Space* @@ -116,19 +116,19 @@ namespace Gecode { namespace Search { : Engine(o, 1U), w(s, o), end(EndReason::NotEnded) {} template Space* - WorkerToEngine::next(void) { + WorkerToEngine::next() { Space* s = w.next(); end = (s != nullptr) ? EndReason::NotEnded : w.end_reason(); return s; } template Search::Statistics - WorkerToEngine::statistics(void) const { + WorkerToEngine::statistics() const { return w.statistics(); } template EndReason - WorkerToEngine::end_reason(void) const { + WorkerToEngine::end_reason() const { return end; } template @@ -144,11 +144,11 @@ namespace Gecode { namespace Search { } template NoGoods& - WorkerToEngine::nogoods(void) { + WorkerToEngine::nogoods() { return w.nogoods(); } -}} // namespace Gecode::Search +} // namespace Gecode::Search #endif diff --git a/gecode/search/trace-recorder.hpp b/gecode/search/trace-recorder.hpp index 29287814da..41a6e60b57 100644 --- a/gecode/search/trace-recorder.hpp +++ b/gecode/search/trace-recorder.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Search { +namespace Gecode::Search { /// Recorder for engine events (for access control) class WrapTraceRecorder { @@ -60,32 +60,32 @@ namespace Gecode { namespace Search { public: /// Do not initialize - ID(void) = default; + ID() = default; /// Initialize ID(unsigned int id); /// Access - operator unsigned int(void) const; + operator unsigned int() const; }; /// Initialize TraceRecorder(SearchTracer* t); /// Register engine void engine(SearchTracer::EngineType t, unsigned int n); /// Register worker - void worker(void); + void worker(); /// Generate new node id - unsigned int nid(void); + unsigned int nid(); /// Return worker id - unsigned int wid(void) const; + unsigned int wid() const; /// The workers goes to a next round (restart or next iteration in LDS) - void round(void); + void round(); /// The engine skips an edge void skip(const SearchTracer::EdgeInfo& ei); /// The engine creates a new node with information \a ei and \a ni void node(const SearchTracer::EdgeInfo& ei, const SearchTracer::NodeInfo& ni); /// The worker is done - void done(void); + void done(); /// Whether this is a real tracer - operator bool(void) const; + operator bool() const; }; /// Recorder for a search tracer with edge information @@ -98,9 +98,9 @@ namespace Gecode { namespace Search { /// Initialize EdgeTraceRecorder(SearchTracer* t); /// Invalidate edge information - void invalidate(void); + void invalidate(); /// Provide access to edge information - SearchTracer::EdgeInfo* ei(void); + SearchTracer::EdgeInfo* ei(); }; /// Empty trace recorder @@ -110,36 +110,36 @@ namespace Gecode { namespace Search { class ID { public: /// Do not initialize - ID(void) = default; + ID() = default; /// Initialize ID(unsigned int id); /// Access - operator unsigned int(void) const; + operator unsigned int() const; }; /// Initialize NoTraceRecorder(SearchTracer* t); /// Register engine void engine(SearchTracer::EngineType t, unsigned int n); /// Register worker - void worker(void); + void worker(); /// Return worker id - unsigned int wid(void) const; + unsigned int wid() const; /// Generate new node id - unsigned int nid(void); + unsigned int nid(); /// Invalidate edge information - void invalidate(void); + void invalidate(); /// Provide access to edge information - SearchTracer::EdgeInfo* ei(void); + SearchTracer::EdgeInfo* ei(); /// The workers goes to a next round (restart or next iteration in LDS) - void round(void); + void round(); /// The engine skips an edge void skip(const SearchTracer::EdgeInfo& ei); /// The engine creates a new node with information \a ei and \a ni void node(const SearchTracer::EdgeInfo& ei, const SearchTracer::NodeInfo& ni); /// The worker is done - void done(void); + void done(); /// Whether this is a real tracer - operator bool(void) const; + operator bool() const; }; /* @@ -162,7 +162,7 @@ namespace Gecode { namespace Search { : _id(id) {} forceinline TraceRecorder::ID:: - operator unsigned int(void) const { + operator unsigned int() const { return _id; } @@ -176,22 +176,22 @@ namespace Gecode { namespace Search { } forceinline void - TraceRecorder::worker(void) { + TraceRecorder::worker() { tracer.worker(_wid, _eid); } forceinline unsigned int - TraceRecorder::nid(void) { + TraceRecorder::nid() { return _nid++; } forceinline unsigned int - TraceRecorder::wid(void) const { + TraceRecorder::wid() const { return _wid; } forceinline void - TraceRecorder::round(void) { + TraceRecorder::round() { tracer._round(_eid); } @@ -206,12 +206,12 @@ namespace Gecode { namespace Search { } forceinline void - TraceRecorder::done(void) { + TraceRecorder::done() { tracer.worker(); } forceinline TraceRecorder:: - operator bool(void) const { + operator bool() const { return true; } @@ -224,12 +224,12 @@ namespace Gecode { namespace Search { : TraceRecorder(t) {} forceinline void - EdgeTraceRecorder::invalidate(void) { + EdgeTraceRecorder::invalidate() { _ei.invalidate(); } forceinline SearchTracer::EdgeInfo* - EdgeTraceRecorder::ei(void) { + EdgeTraceRecorder::ei() { return &_ei; } @@ -242,7 +242,7 @@ namespace Gecode { namespace Search { NoTraceRecorder::ID::ID(unsigned int) {} forceinline NoTraceRecorder::ID:: - operator unsigned int(void) const { + operator unsigned int() const { return 0U; } @@ -253,28 +253,28 @@ namespace Gecode { namespace Search { NoTraceRecorder::engine(SearchTracer::EngineType, unsigned int) {} forceinline void - NoTraceRecorder::worker(void) {} + NoTraceRecorder::worker() {} forceinline unsigned int - NoTraceRecorder::wid(void) const { + NoTraceRecorder::wid() const { return 0U; } forceinline unsigned int - NoTraceRecorder::nid(void) { + NoTraceRecorder::nid() { return 0U; } forceinline void - NoTraceRecorder::invalidate(void) {} + NoTraceRecorder::invalidate() {} forceinline SearchTracer::EdgeInfo* - NoTraceRecorder::ei(void) { + NoTraceRecorder::ei() { return nullptr; } forceinline void - NoTraceRecorder::round(void) {} + NoTraceRecorder::round() {} forceinline void NoTraceRecorder::skip(const SearchTracer::EdgeInfo&) {} @@ -283,13 +283,13 @@ namespace Gecode { namespace Search { NoTraceRecorder::node(const SearchTracer::EdgeInfo&, const SearchTracer::NodeInfo&) {} forceinline void - NoTraceRecorder::done(void) {} + NoTraceRecorder::done() {} forceinline NoTraceRecorder:: - operator bool(void) const { + operator bool() const { return false; } -}} // namespace Gecode::Search +} // namespace Gecode::Search // STATISTICS: search-trace diff --git a/gecode/search/tracer.cpp b/gecode/search/tracer.cpp index 16a8194af0..d64aa74707 100644 --- a/gecode/search/tracer.cpp +++ b/gecode/search/tracer.cpp @@ -40,7 +40,7 @@ namespace Gecode { StdSearchTracer::StdSearchTracer(std::ostream& os0) : os(os0) {} void - StdSearchTracer::init(void) { + StdSearchTracer::init() { os << "trace::init()" << '\n' << std::flush; for (unsigned int e = 0U; e < engines(); e++) { os << "\t" << e << ": " << t2s[std::to_underlying(engine(e).type())]; @@ -105,11 +105,11 @@ namespace Gecode { } void - StdSearchTracer::done(void) { + StdSearchTracer::done() { os << "trace::done()" << '\n' << std::flush; } - StdSearchTracer::~StdSearchTracer(void) = default; + StdSearchTracer::~StdSearchTracer() = default; StdSearchTracer StdSearchTracer::def; diff --git a/gecode/search/tracer.hpp b/gecode/search/tracer.hpp index 9443de60fd..3e300d0bfc 100644 --- a/gecode/search/tracer.hpp +++ b/gecode/search/tracer.hpp @@ -40,55 +40,55 @@ namespace Gecode { */ forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - SearchTracer::EngineInfo::EngineInfo(void) {} + SearchTracer::EngineInfo::EngineInfo() {} forceinline SearchTracer::EngineInfo::EngineInfo(EngineType et, unsigned int fst, unsigned int lst) : _type(et), _fst(fst), _lst(lst) {} forceinline SearchTracer::EngineType - SearchTracer::EngineInfo::type(void) const { + SearchTracer::EngineInfo::type() const { return _type; } forceinline bool - SearchTracer::EngineInfo::meta(void) const { + SearchTracer::EngineInfo::meta() const { return (type() == EngineType::RBS) || (type() == EngineType::PBS); } forceinline unsigned int - SearchTracer::EngineInfo::wfst(void) const { + SearchTracer::EngineInfo::wfst() const { assert((type() == EngineType::DFS) || (type() == EngineType::BAB) || (type() == EngineType::LDS) || (type() == EngineType::OTHER)); return _fst; } forceinline unsigned int - SearchTracer::EngineInfo::wlst(void) const { + SearchTracer::EngineInfo::wlst() const { assert((type() == EngineType::DFS) || (type() == EngineType::BAB) || (type() == EngineType::LDS) || (type() == EngineType::OTHER)); return _lst; } forceinline unsigned int - SearchTracer::EngineInfo::workers(void) const { + SearchTracer::EngineInfo::workers() const { return wlst() - wfst(); } forceinline unsigned int - SearchTracer::EngineInfo::efst(void) const { + SearchTracer::EngineInfo::efst() const { assert((type() == EngineType::RBS) || (type() == EngineType::PBS)); return _fst; } forceinline unsigned int - SearchTracer::EngineInfo::elst(void) const { + SearchTracer::EngineInfo::elst() const { assert((type() == EngineType::RBS) || (type() == EngineType::PBS)); return _lst; } forceinline unsigned int - SearchTracer::EngineInfo::engines(void) const { + SearchTracer::EngineInfo::engines() const { return elst() - efst(); } @@ -97,7 +97,7 @@ namespace Gecode { * */ forceinline void - SearchTracer::EdgeInfo::invalidate(void) { + SearchTracer::EdgeInfo::invalidate() { _wid = UINT_MAX; _s.clear(); } @@ -125,34 +125,34 @@ namespace Gecode { : _wid(wid), _nid(nid), _a(a) {} forceinline - SearchTracer::EdgeInfo::EdgeInfo(void) + SearchTracer::EdgeInfo::EdgeInfo() : _wid(UINT_MAX) {} forceinline SearchTracer::EdgeInfo:: - operator bool(void) const { + operator bool() const { return _wid != UINT_MAX; } forceinline unsigned int - SearchTracer::EdgeInfo::wid(void) const { + SearchTracer::EdgeInfo::wid() const { assert(*this); return _wid; } forceinline unsigned int - SearchTracer::EdgeInfo::nid(void) const { + SearchTracer::EdgeInfo::nid() const { assert(*this); return _nid; } forceinline unsigned int - SearchTracer::EdgeInfo::alternative(void) const { + SearchTracer::EdgeInfo::alternative() const { assert(*this); return _a; } forceinline std::string - SearchTracer::EdgeInfo::string(void) const { + SearchTracer::EdgeInfo::string() const { assert(*this); return _s; } @@ -166,27 +166,27 @@ namespace Gecode { : _nt(nt), _wid(wid), _nid(nid), _s(s), _c(c) {} forceinline SearchTracer::NodeType - SearchTracer::NodeInfo::type(void) const { + SearchTracer::NodeInfo::type() const { return _nt; } forceinline unsigned int - SearchTracer::NodeInfo::wid(void) const { + SearchTracer::NodeInfo::wid() const { return _wid; } forceinline unsigned int - SearchTracer::NodeInfo::nid(void) const { + SearchTracer::NodeInfo::nid() const { return _nid; } forceinline const Space& - SearchTracer::NodeInfo::space(void) const { + SearchTracer::NodeInfo::space() const { return _s; } forceinline const Choice& - SearchTracer::NodeInfo::choice(void) const { + SearchTracer::NodeInfo::choice() const { assert(_nt == NodeType::BRANCH); return *_c; } @@ -214,7 +214,7 @@ namespace Gecode { } forceinline - SearchTracer::SearchTracer(void) + SearchTracer::SearchTracer() : pending(1U), n_e(0U), n_w(0U), es(heap), w2e(heap) {} forceinline void @@ -252,19 +252,19 @@ namespace Gecode { } forceinline void - SearchTracer::worker(void) { + SearchTracer::worker() { Support::Lock l(m); if (--n_active == 0U) done(); } forceinline unsigned int - SearchTracer::workers(void) const { + SearchTracer::workers() const { return n_w; } forceinline unsigned int - SearchTracer::engines(void) const { + SearchTracer::engines() const { return n_e; } @@ -280,7 +280,7 @@ namespace Gecode { return w2e[wid]; } - forceinline SearchTracer::~SearchTracer(void) = default; + forceinline SearchTracer::~SearchTracer() = default; } // namespace Gecode diff --git a/gecode/search/traits.hpp b/gecode/search/traits.hpp index b65a2514c7..a583fbc235 100644 --- a/gecode/search/traits.hpp +++ b/gecode/search/traits.hpp @@ -39,18 +39,18 @@ namespace Gecode { template <> class ArrayTraits> { public: - typedef SEBs StorageType; - typedef SEB ValueType; - typedef SEBs ArgsType; + using StorageType = SEBs; + using ValueType = SEB; + using ArgsType = SEBs; }; /// Traits of %SEBs template <> class ArrayTraits { public: - typedef SEBs StorageType; - typedef SEB ValueType; - typedef SEBs ArgsType; + using StorageType = SEBs; + using ValueType = SEB; + using ArgsType = SEBs; }; } // namespace Gecode diff --git a/gecode/search/worker-control.cpp b/gecode/search/worker-control.cpp index dc6016b52e..ecf56904f9 100644 --- a/gecode/search/worker-control.cpp +++ b/gecode/search/worker-control.cpp @@ -32,7 +32,7 @@ #include #include -namespace Gecode { namespace Search { +namespace Gecode::Search { class WorkerControl::State : public Support::RefCount { public: @@ -49,12 +49,12 @@ namespace Gecode { namespace Search { State(unsigned int workers) : RefCount(1U), requested(workers), capacity(0U), generation(0U), fast_admit(false), lifecycle(Lifecycle::READY_TO_BIND), events(nullptr) {} - ~State(void) { + ~State() { delete[] events; } }; - WorkerControl::WorkerControl(void) noexcept : state(nullptr) {} + WorkerControl::WorkerControl() noexcept : state(nullptr) {} WorkerControl::WorkerControl(unsigned int requested) : state(new State(requested)) {} @@ -65,6 +65,8 @@ namespace Gecode { namespace Search { WorkerControl& WorkerControl::operator=(const WorkerControl& control) { + if (this == &control) + return *this; if (control.state != nullptr) control.state->inc(); if ((state != nullptr) && state->dec()) @@ -73,18 +75,18 @@ namespace Gecode { namespace Search { return *this; } - WorkerControl::~WorkerControl(void) { + WorkerControl::~WorkerControl() { if ((state != nullptr) && state->dec()) delete state; } bool - WorkerControl::engaged(void) const noexcept { + WorkerControl::engaged() const noexcept { return state != nullptr; } unsigned int - WorkerControl::requested(void) const noexcept { + WorkerControl::requested() const noexcept { return (state == nullptr) ? 0U : state->requested.load(std::memory_order_acquire); } @@ -115,7 +117,7 @@ namespace Gecode { namespace Search { } unsigned int - WorkerControl::capacity(void) const noexcept { + WorkerControl::capacity() const noexcept { return (state == nullptr) ? 0U : state->capacity.load(std::memory_order_acquire); } @@ -263,6 +265,6 @@ namespace Gecode { namespace Search { events[i].signal(); } -}} // namespace Gecode::Search +} // namespace Gecode::Search // STATISTICS: search-other diff --git a/gecode/search/worker-control.hh b/gecode/search/worker-control.hh index a83f518c75..490418f1ec 100644 --- a/gecode/search/worker-control.hh +++ b/gecode/search/worker-control.hh @@ -32,7 +32,7 @@ #ifndef GECODE_SEARCH_WORKER_CONTROL_HH #define GECODE_SEARCH_WORKER_CONTROL_HH -namespace Gecode { namespace Search { +namespace Gecode::Search { /// Internal access to worker-control state class GECODE_SEARCH_EXPORT WorkerControlAccess { @@ -71,7 +71,7 @@ namespace Gecode { namespace Search { static void signal_all(WorkerControl& control); }; -}} // namespace Gecode::Search +} // namespace Gecode::Search #endif diff --git a/gecode/search/worker.hh b/gecode/search/worker.hh index 156b82782c..c07d806e8b 100644 --- a/gecode/search/worker.hh +++ b/gecode/search/worker.hh @@ -33,9 +33,10 @@ #ifndef GECODE_SEARCH_WORKER_HH #define GECODE_SEARCH_WORKER_HH +#include #include -namespace Gecode { namespace Search { +namespace Gecode::Search { /** * \brief %Search worker statistics @@ -49,17 +50,17 @@ namespace Gecode { namespace Search { public: /// Initialize - Worker(void); + Worker(); /// Reset stop information - void start(void); + void start(); /// Check whether engine must be stopped bool stop(const Options& o); /// Check stop and wait for admission of a sequential worker bool stop_seq(Options& o); /// Check whether engine has been stopped - bool stopped(void) const; + bool stopped() const; /// Return why next() returned no solution: Limit if stopped, otherwise Exhausted - EndReason end_reason(void) const; + EndReason end_reason() const; /// Reset statistics with root depth \a d void reset(unsigned long int d = 0); /// Record stack depth \a d @@ -69,11 +70,11 @@ namespace Gecode { namespace Search { }; forceinline - Worker::Worker(void) + Worker::Worker() : _stopped(false), root_depth(0) {} forceinline void - Worker::start(void) { + Worker::start() { _stopped = false; } @@ -97,12 +98,12 @@ namespace Gecode { namespace Search { } forceinline bool - Worker::stopped(void) const { + Worker::stopped() const { return _stopped; } forceinline EndReason - Worker::end_reason(void) const { + Worker::end_reason() const { return _stopped ? EndReason::Limit : EndReason::Exhausted; } @@ -110,14 +111,12 @@ namespace Gecode { namespace Search { Worker::reset(unsigned long int d) { Statistics::reset(); root_depth = d; - if (depth < d) - depth = d; + depth = std::max(depth, d); } forceinline void Worker::stack_depth(unsigned long int d) { - if (depth < root_depth + d) - depth = root_depth + d; + depth = std::max(depth, root_depth + d); } forceinline unsigned long int @@ -125,7 +124,7 @@ namespace Gecode { namespace Search { return root_depth + d; } -}} // namespace Gecode::Search +} // namespace Gecode::Search #endif diff --git a/gecode/set.hh b/gecode/set.hh index 3484ab23db..6201357be2 100644 --- a/gecode/set.hh +++ b/gecode/set.hh @@ -80,25 +80,21 @@ #include -namespace Gecode { namespace Set { - - /// Numerical limits for set variables - namespace Limits { - /// Largest allowed integer in integer set - const int max = (Gecode::Int::Limits::max / 2) - 1; - /// Smallest allowed integer in integer set - const int min = -max; - /// Maximum cardinality of an integer set - const unsigned int card = max - min + 1; - /// Check whether integer \a n is in range, otherwise throw overflow exception with information \a l - void check(int n, const char* l); - /// Check whether unsigned int \a n is in range for cardinality, otherwise throw overflow exception with information \a l - void check(unsigned int n, const char* l); - /// Check whether minimum and maximum of IntSet \a s is in range, otherwise throw overflow exception with information \a l - void check(const IntSet& s, const char* l); - } // namespace Limits - -}} // namespace Gecode::Set +/// Numerical limits for set variables +namespace Gecode::Set::Limits { + /// Largest allowed integer in integer set + const int max = (Gecode::Int::Limits::max / 2) - 1; + /// Smallest allowed integer in integer set + const int min = -max; + /// Maximum cardinality of an integer set + const unsigned int card = max - min + 1; + /// Check whether integer \a n is in range, otherwise throw overflow exception with information \a l + void check(int n, const char* l); + /// Check whether unsigned int \a n is in range for cardinality, otherwise throw overflow exception with information \a l + void check(unsigned int n, const char* l); + /// Check whether minimum and maximum of IntSet \a s is in range, otherwise throw overflow exception with information \a l + void check(const IntSet& s, const char* l); +} // namespace Gecode::Set::Limits #include @@ -124,7 +120,7 @@ namespace Gecode { /// \name Constructors and initialization //@{ /// Default constructor - SetVar(void) = default; + SetVar() = default; /// Initialize from set variable \a y SetVar(const SetVar& y) = default; /// Initialize from set view \a y @@ -220,23 +216,23 @@ namespace Gecode { /// \name Value access //@{ /// Return number of elements in the greatest lower bound - unsigned int glb_size(void) const; + unsigned int glb_size() const; /// Return number of elements in the least upper bound - unsigned int lub_size(void) const; + unsigned int lub_size() const; /// Return number of unknown elements (elements in lub but not in glb) - unsigned int unknown_size(void) const; + unsigned int unknown_size() const; /// Return cardinality minimum - unsigned int card_min(void) const; + unsigned int card_min() const; /// Return cardinality maximum - unsigned int card_max(void) const; + unsigned int card_max() const; /// Return minimum element of least upper bound - int lub_min(void) const; + int lub_min() const; /// Return maximum element of least upper bound - int lub_max(void) const; + int lub_max() const; /// Return minimum element of greatest lower bound - int glb_min(void) const; + int glb_min() const; /// Return maximum of greatest lower bound - int glb_max(void) const; + int glb_max() const; //@} /// \name Domain tests @@ -266,27 +262,27 @@ namespace Gecode { /// \name Constructors and initialization //@{ /// Default constructor - SetVarGlbRanges(void) = default; - /// Initialize to iterate ranges of variable \a x - SetVarGlbRanges(const SetVar& x); + SetVarGlbRanges() = default; + /// Initialize to iterate ranges of variable \a s + SetVarGlbRanges(const SetVar& s); //@} /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of range (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; @@ -299,27 +295,27 @@ namespace Gecode { /// \name Constructors and initialization //@{ /// Default constructor - SetVarLubRanges(void) = default; - /// Initialize to iterate ranges of variable \a x - SetVarLubRanges(const SetVar& x); + SetVarLubRanges() = default; + /// Initialize to iterate ranges of variable \a s + SetVarLubRanges(const SetVar& s); //@} /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of range (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; @@ -332,27 +328,27 @@ namespace Gecode { /// \name Constructors and initialization //@{ /// Default constructor - SetVarUnknownRanges(void) = default; - /// Initialize to iterate ranges of variable \a x - SetVarUnknownRanges(const SetVar& x); + SetVarUnknownRanges() = default; + /// Initialize to iterate ranges of variable \a s + SetVarUnknownRanges(const SetVar& s); //@} /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of range (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; @@ -365,7 +361,7 @@ namespace Gecode { /// \name Constructors and initialization //@{ /// Default constructor - SetVarGlbValues(void); + SetVarGlbValues(); /// Initialize to iterate values of variable \a x SetVarGlbValues(const SetVar& x); //@} @@ -373,15 +369,15 @@ namespace Gecode { /// \name Iteration control //@{ /// Test whether iterator is still at a value or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next value (if possible) - void operator++(void); + void operator++(); //@} /// \name Value access //@{ /// Return current value - int val(void) const; + int val() const; //@} }; @@ -394,7 +390,7 @@ namespace Gecode { /// \name Constructors and initialization //@{ /// Default constructor - SetVarLubValues(void); + SetVarLubValues(); /// Initialize to iterate values of variable \a x SetVarLubValues(const SetVar& x); //@} @@ -402,15 +398,15 @@ namespace Gecode { /// \name Iteration control //@{ /// Test whether iterator is still at a value or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next value (if possible) - void operator++(void); + void operator++(); //@} /// \name Value access //@{ /// Return current value - int val(void) const; + int val() const; //@} }; @@ -423,7 +419,7 @@ namespace Gecode { /// \name Constructors and initialization //@{ /// Default constructor - SetVarUnknownValues(void); + SetVarUnknownValues(); /// Initialize to iterate values of variable \a x SetVarUnknownValues(const SetVar& x); //@} @@ -431,15 +427,15 @@ namespace Gecode { /// \name Iteration control //@{ /// Test whether iterator is still at a value or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next value (if possible) - void operator++(void); + void operator++(); //@} /// \name Value access //@{ /// Return current value - int val(void) const; + int val() const; //@} }; @@ -486,7 +482,7 @@ namespace Gecode { /// \name Constructors and initialization //@{ /// Allocate empty array - SetVarArgs(void) = default; + SetVarArgs() = default; /// Allocate array with \a n elements explicit SetVarArgs(int n); /// Initialize from variable argument array \a a (copy elements) @@ -562,7 +558,7 @@ namespace Gecode { /// \name Creation and initialization //@{ /// Default constructor (array of size 0) - SetVarArray(void) = default; + SetVarArray() = default; /// Initialize from set variable array \a a (share elements) SetVarArray(const SetVarArray&) = default; /// Initialize from set variable argument array \a a (copy elements) @@ -1005,7 +1001,7 @@ namespace Gecode { * * \ingroup TaskModelSetBranch */ - typedef std::function SetBranchFilter; + using SetBranchFilter = std::function; /** * \brief Branch merit function type for set variables * @@ -1016,7 +1012,7 @@ namespace Gecode { * * \ingroup TaskModelSetBranch */ - typedef std::function SetBranchMerit; + using SetBranchMerit = std::function; /** * \brief Branch value function type for set variables @@ -1028,7 +1024,7 @@ namespace Gecode { * * \ingroup TaskModelSetBranch */ - typedef std::function SetBranchVal; + using SetBranchVal = std::function; /** * \brief Branch commit function type for set variables @@ -1041,7 +1037,7 @@ namespace Gecode { * * \ingroup TaskModelSetBranch */ - typedef std::function SetBranchCommit; + using SetBranchCommit = std::function; } // namespace Gecode @@ -1063,7 +1059,7 @@ namespace Gecode { * yet initialized AFC storage is init or the assignment operator. * */ - SetAFC(void) = default; + SetAFC() = default; /** * \brief Initialize for set variables \a x and decay factor \a d * @@ -1105,7 +1101,7 @@ namespace Gecode { * yet initialized action storage is init or the assignment operator. * */ - SetAction(void) = default; + SetAction() = default; /// Copy constructor SetAction(const SetAction& a) = default; /// Assignment operator @@ -1160,7 +1156,7 @@ namespace Gecode { * yet initialized CHB storage is init or the assignment operator. * */ - SetCHB(void) = default; + SetCHB() = default; /// Copy constructor SetCHB(const SetCHB& chb) = default; /// Assignment operator @@ -1196,9 +1192,8 @@ namespace Gecode { namespace Gecode { /// Function type for printing branching alternatives for set variables - typedef std::function - SetVarValPrint; + using SetVarValPrint = std::function; } // namespace Gecode @@ -1248,7 +1243,7 @@ namespace Gecode { public: /// Initialize with strategy SEL_NONE - SetVarBranch(void); + SetVarBranch(); /// Initialize with random number generator \a r SetVarBranch(const Rnd& r); /// Initialize with selection strategy \a s and tie-break limit function \a t @@ -1264,7 +1259,7 @@ namespace Gecode { /// Initialize with selection strategy \a s, branch merit function \a mf, and tie-break limit function \a t SetVarBranch(Select s, SetBranchMerit mf, BranchTbl t); /// Return selection strategy - Select select(void) const; + Select select() const; /// Expand AFC, action, and CHB void expand(Home home, const SetVarArgs& x); }; @@ -1275,7 +1270,7 @@ namespace Gecode { */ //@{ /// Select first unassigned variable - SetVarBranch SET_VAR_NONE(void); + SetVarBranch SET_VAR_NONE(); /// Select random variable (uniform distribution, for tie breaking) SetVarBranch SET_VAR_RND(const Rnd& r); /// Select variable with least merit according to branch merit function \a bm @@ -1391,7 +1386,7 @@ namespace Gecode { /// Initialize with value function \a f and commit function \a c SetValBranch(SetBranchVal v, SetBranchCommit c); /// Return selection strategy - Select select(void) const; + Select select() const; }; /** @@ -1400,17 +1395,17 @@ namespace Gecode { */ //@{ /// Include smallest element - SetValBranch SET_VAL_MIN_INC(void); + SetValBranch SET_VAL_MIN_INC(); /// Exclude smallest element - SetValBranch SET_VAL_MIN_EXC(void); + SetValBranch SET_VAL_MIN_EXC(); /// Include median element (rounding downwards) - SetValBranch SET_VAL_MED_INC(void); + SetValBranch SET_VAL_MED_INC(); /// Exclude median element (rounding downwards) - SetValBranch SET_VAL_MED_EXC(void); + SetValBranch SET_VAL_MED_EXC(); /// Include largest element - SetValBranch SET_VAL_MAX_INC(void); + SetValBranch SET_VAL_MAX_INC(); /// Exclude largest element - SetValBranch SET_VAL_MAX_EXC(void); + SetValBranch SET_VAL_MAX_EXC(); /// Include random element SetValBranch SET_VAL_RND_INC(const Rnd& r); /// Exclude random element @@ -1464,7 +1459,7 @@ namespace Gecode { /// Initialize with value function \a f and commit function \a c SetAssign(SetBranchVal v, SetBranchCommit c); /// Return selection strategy - Select select(void) const; + Select select() const; }; /** @@ -1473,17 +1468,17 @@ namespace Gecode { */ //@{ /// Include smallest element - SetAssign SET_ASSIGN_MIN_INC(void); + SetAssign SET_ASSIGN_MIN_INC(); /// Exclude smallest element - SetAssign SET_ASSIGN_MIN_EXC(void); + SetAssign SET_ASSIGN_MIN_EXC(); /// Include median element (rounding downwards) - SetAssign SET_ASSIGN_MED_INC(void); + SetAssign SET_ASSIGN_MED_INC(); /// Exclude median element (rounding downwards) - SetAssign SET_ASSIGN_MED_EXC(void); + SetAssign SET_ASSIGN_MED_EXC(); /// Include largest element - SetAssign SET_ASSIGN_MAX_INC(void); + SetAssign SET_ASSIGN_MAX_INC(); /// Exclude largest element - SetAssign SET_ASSIGN_MAX_EXC(void); + SetAssign SET_ASSIGN_MAX_EXC(); /// Include random element SetAssign SET_ASSIGN_RND_INC(const Rnd& r); /// Exclude random element @@ -1682,9 +1677,9 @@ namespace Gecode { /// \name Access to delta iterators //@{ /// Give access to iterator for delta in greatest lower bound (values that have been included) - Glb& glb(void); + Glb& glb(); /// Give access iterator for delta in least bound (values that have been removed) - Lub& lub(void); + Lub& lub(); //@} }; @@ -1700,12 +1695,12 @@ namespace Gecode { * \brief Tracer for set variables * \ingroup TaskSetTrace */ - typedef ViewTracer SetTracer; + using SetTracer = ViewTracer; /** * \brief Trace recorder for set variables * \ingroup TaskSetTrace */ - typedef ViewTraceRecorder SetTraceRecorder; + using SetTraceRecorder = ViewTraceRecorder; /** * \brief Standard set variable tracer diff --git a/gecode/set/array-traits.hpp b/gecode/set/array-traits.hpp index 90fbcd7bd3..07776cc0a1 100644 --- a/gecode/set/array-traits.hpp +++ b/gecode/set/array-traits.hpp @@ -45,35 +45,35 @@ namespace Gecode { template <> class ArrayTraits> { public: - typedef SetVarArgs StorageType; - typedef SetVar ValueType; - typedef SetVarArgs ArgsType; + using StorageType = SetVarArgs; + using ValueType = SetVar; + using ArgsType = SetVarArgs; }; /// Traits of %VarArray<%SetVar> template <> class ArrayTraits> { public: - typedef SetVarArray StorageType; - typedef SetVar ValueType; - typedef SetVarArgs ArgsType; + using StorageType = SetVarArray; + using ValueType = SetVar; + using ArgsType = SetVarArgs; }; /// Traits of %SetVarArray template <> class ArrayTraits { public: - typedef SetVarArray StorageType; - typedef SetVar ValueType; - typedef SetVarArgs ArgsType; + using StorageType = SetVarArray; + using ValueType = SetVar; + using ArgsType = SetVarArgs; }; /// Traits of %SetVarArgs template <> class ArrayTraits { public: - typedef SetVarArgs StorageType; - typedef SetVar ValueType; - typedef SetVarArgs ArgsType; + using StorageType = SetVarArgs; + using ValueType = SetVar; + using ArgsType = SetVarArgs; }; } // namespace Gecode diff --git a/gecode/set/branch.hh b/gecode/set/branch.hh index ca65d1801e..a209f33960 100644 --- a/gecode/set/branch.hh +++ b/gecode/set/branch.hh @@ -46,7 +46,7 @@ * \brief %Set branchings */ -namespace Gecode { namespace Set { namespace Branch { +namespace Gecode::Set::Branch { /** * \defgroup FuncSetViewSel Merit-based set view selection for branchers @@ -143,7 +143,7 @@ namespace Gecode { namespace Set { namespace Branch { /// Return AFC over size as merit for view \a x at position \a i double operator()(const Space& home, SetView x, int i); /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const; + bool notice() const; /// Dispose view selection void dispose(Space& home); }; @@ -167,7 +167,7 @@ namespace Gecode { namespace Set { namespace Branch { /// Return action over size as merit for view \a x at position \a i double operator()(const Space& home, SetView x, int i); /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const; + bool notice() const; /// Dispose view selection void dispose(Space& home); }; @@ -191,24 +191,24 @@ namespace Gecode { namespace Set { namespace Branch { /// Return CHB Q-score over size as merit for view \a x at position \a i double operator()(const Space& home, SetView x, int i); /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const; + bool notice() const; /// Dispose view selection void dispose(Space& home); }; -}}} // namespace Gecode::Set::Branch +} // namespace Gecode::Set::Branch #include -namespace Gecode { namespace Set { namespace Branch { +namespace Gecode::Set::Branch { /// Return view selectors for set views GECODE_SET_EXPORT ViewSel* view_selection(Space& home, const SetVarBranch& svb); -}}} // namespace Gecode::Set::Branch +} // namespace Gecode::Set::Branch -namespace Gecode { namespace Set { namespace Branch { +namespace Gecode::Set::Branch { /** * \defgroup FuncSetValSel Set value selection for brancher @@ -287,7 +287,7 @@ namespace Gecode { namespace Set { namespace Branch { r = r.split(a); } bool - random(void) const { + random() const { return true; } /// Constructor for initialization @@ -297,16 +297,16 @@ namespace Gecode { namespace Set { namespace Branch { /// Return value of view \a x at position \a i int val(const Space& home, SetView x, int i); /// Whether dispose must always be called (that is, notice is needed) - bool notice(void) const; + bool notice() const; /// Delete value selection void dispose(Space& home); }; -}}} // namespace Gecode::Set::Branch +} // namespace Gecode::Set::Branch #include -namespace Gecode { namespace Set { namespace Branch { +namespace Gecode::Set::Branch { /// No-good literal for inclusion class IncNGL : public ViewValNGL { @@ -344,11 +344,11 @@ namespace Gecode { namespace Set { namespace Branch { NGL* copy(Space& home) override; }; -}}} // namespace Gecode::Set::Branch +} // namespace Gecode::Set::Branch #include -namespace Gecode { namespace Set { namespace Branch { +namespace Gecode::Set::Branch { /** * \defgroup FuncSetValCommit Set value commit classes @@ -402,11 +402,11 @@ namespace Gecode { namespace Set { namespace Branch { void print(const Space& home, unsigned int a, SetView x, int i, int n, std::ostream& o) const; }; -}}} // namespace Gecode::Set::Branch +} // namespace Gecode::Set::Branch #include -namespace Gecode { namespace Set { namespace Branch { +namespace Gecode::Set::Branch { /// Return value and commit for set views GECODE_SET_EXPORT @@ -416,7 +416,7 @@ namespace Gecode { namespace Set { namespace Branch { GECODE_SET_EXPORT ValSelCommitBase* value_selection_commit(Space& home, const SetAssign& ia); -}}} // namespace Gecode::Set::Branch +} // namespace Gecode::Set::Branch #endif diff --git a/gecode/set/branch/action.hpp b/gecode/set/branch/action.hpp index 6335226e9c..9e982f1f90 100644 --- a/gecode/set/branch/action.hpp +++ b/gecode/set/branch/action.hpp @@ -32,10 +32,7 @@ namespace Gecode { - forceinline SetAction& - SetAction::operator=(const SetAction& a) { - return static_cast(Action::operator=(a)); - } + forceinline SetAction& SetAction::operator=(const SetAction& a) = default; } // namespace Gecode diff --git a/gecode/set/branch/assign.hpp b/gecode/set/branch/assign.hpp index ba9d300530..9d79a14782 100644 --- a/gecode/set/branch/assign.hpp +++ b/gecode/set/branch/assign.hpp @@ -45,37 +45,37 @@ namespace Gecode { : ValBranch(std::move(v), std::move(c)), s(SEL_VAL_COMMIT) {} forceinline SetAssign::Select - SetAssign::select(void) const { + SetAssign::select() const { return s; } inline SetAssign - SET_ASSIGN_MIN_INC(void) { + SET_ASSIGN_MIN_INC() { return SetAssign(SetAssign::SEL_MIN_INC); } inline SetAssign - SET_ASSIGN_MIN_EXC(void) { + SET_ASSIGN_MIN_EXC() { return SetAssign(SetAssign::SEL_MIN_EXC); } inline SetAssign - SET_ASSIGN_MED_INC(void) { + SET_ASSIGN_MED_INC() { return SetAssign(SetAssign::SEL_MED_INC); } inline SetAssign - SET_ASSIGN_MED_EXC(void) { + SET_ASSIGN_MED_EXC() { return SetAssign(SetAssign::SEL_MED_EXC); } inline SetAssign - SET_ASSIGN_MAX_INC(void) { + SET_ASSIGN_MAX_INC() { return SetAssign(SetAssign::SEL_MAX_INC); } inline SetAssign - SET_ASSIGN_MAX_EXC(void) { + SET_ASSIGN_MAX_EXC() { return SetAssign(SetAssign::SEL_MAX_EXC); } diff --git a/gecode/set/branch/chb.hpp b/gecode/set/branch/chb.hpp index bd977acc3b..a97d9e0748 100644 --- a/gecode/set/branch/chb.hpp +++ b/gecode/set/branch/chb.hpp @@ -32,10 +32,7 @@ namespace Gecode { - forceinline SetCHB& - SetCHB::operator=(const SetCHB& chb) { - return static_cast(CHB::operator=(chb)); - } + forceinline SetCHB& SetCHB::operator=(const SetCHB& chb) = default; } // namespace Gecode diff --git a/gecode/set/branch/merit.hpp b/gecode/set/branch/merit.hpp index 18fed9449d..5ad591d56f 100644 --- a/gecode/set/branch/merit.hpp +++ b/gecode/set/branch/merit.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Set { namespace Branch { +namespace Gecode::Set::Branch { // Minimum merit forceinline @@ -102,7 +102,7 @@ namespace Gecode { namespace Set { namespace Branch { return x.afc() / static_cast(x.unknown_size()); } forceinline bool - MeritAFCSize::notice(void) const { + MeritAFCSize::notice() const { return false; } forceinline void @@ -123,7 +123,7 @@ namespace Gecode { namespace Set { namespace Branch { return action[i] / static_cast(x.unknown_size()); } forceinline bool - MeritActionSize::notice(void) const { + MeritActionSize::notice() const { return true; } forceinline void @@ -143,7 +143,7 @@ namespace Gecode { namespace Set { namespace Branch { return chb[i] / static_cast(x.unknown_size()); } forceinline bool - MeritCHBSize::notice(void) const { + MeritCHBSize::notice() const { return true; } forceinline void @@ -151,6 +151,6 @@ namespace Gecode { namespace Set { namespace Branch { chb.~CHB(); } -}}} // namespace Gecode::Set::Branch +} // namespace Gecode::Set::Branch // STATISTICS: set-branch diff --git a/gecode/set/branch/ngl.cpp b/gecode/set/branch/ngl.cpp index fa7708fef9..4187df29f7 100644 --- a/gecode/set/branch/ngl.cpp +++ b/gecode/set/branch/ngl.cpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Set { namespace Branch { +namespace Gecode::Set::Branch { NGL* IncNGL::copy(Space& home) { @@ -43,9 +43,8 @@ namespace Gecode { namespace Set { namespace Branch { // Is n in the glb(x)? if (x.contains(n)) return NGL::SUBSUMED; - else - // Is n not in the lub(x)? - return x.not_contains(n) ? NGL::FAILED : NGL::NONE; + // Is n not in the lub(x)? + return x.not_contains(n) ? NGL::FAILED : NGL::NONE; } ExecStatus IncNGL::prune(Space& home) { @@ -61,15 +60,14 @@ namespace Gecode { namespace Set { namespace Branch { // Is n not in the lub(x)? if (x.not_contains(n)) return NGL::SUBSUMED; - else - // Is n in the lub(x)? - return x.contains(n) ? NGL::FAILED : NGL::NONE; + // Is n in the lub(x)? + return x.contains(n) ? NGL::FAILED : NGL::NONE; } ExecStatus ExcNGL::prune(Space& home) { return me_failed(x.include(home, n)) ? ES_FAILED : ES_OK; } -}}} // namespace Gecode::Set::Branch +} // namespace Gecode::Set::Branch // STATISTICS: set-branch diff --git a/gecode/set/branch/ngl.hpp b/gecode/set/branch/ngl.hpp index e99e33a922..88164b835b 100644 --- a/gecode/set/branch/ngl.hpp +++ b/gecode/set/branch/ngl.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Set { namespace Branch { +namespace Gecode::Set::Branch { forceinline IncNGL::IncNGL(Space& home, SetView x, int n) @@ -46,6 +46,6 @@ namespace Gecode { namespace Set { namespace Branch { ExcNGL::ExcNGL(Space& home, ExcNGL& ngl) : ViewValNGL(home, ngl) {} -}}} // namespace Gecode::Set::Branch +} // namespace Gecode::Set::Branch // STATISTICS: set-branch diff --git a/gecode/set/branch/traits.hpp b/gecode/set/branch/traits.hpp index c56a6137e6..21fbefd8cc 100644 --- a/gecode/set/branch/traits.hpp +++ b/gecode/set/branch/traits.hpp @@ -37,15 +37,15 @@ namespace Gecode { class BranchTraits { public: /// Type for the branching filter function - typedef SetBranchFilter Filter; + using Filter = SetBranchFilter; /// Type for the branching merit function - typedef SetBranchMerit Merit; + using Merit = SetBranchMerit; /// Type for the branching value function - typedef SetBranchVal Val; + using Val = SetBranchVal; /// Return type of the branching value function - typedef int ValType; + using ValType = int; /// Type for the branching commit function - typedef SetBranchCommit Commit; + using Commit = SetBranchCommit; }; } // namespace Gecode diff --git a/gecode/set/branch/val-commit.hpp b/gecode/set/branch/val-commit.hpp index c9b67ddb84..70b8b708ca 100644 --- a/gecode/set/branch/val-commit.hpp +++ b/gecode/set/branch/val-commit.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Set { namespace Branch { +namespace Gecode::Set::Branch { forceinline ValCommitInc::ValCommitInc(Space& home, const ValBranch& vb) @@ -52,8 +52,7 @@ namespace Gecode { namespace Set { namespace Branch { ValCommitInc::ngl(Space& home, unsigned int a, SetView x, int n) const { if (a == 0) return new (home) IncNGL(home, x, n); - else - return nullptr; + return nullptr; } forceinline void ValCommitInc::print(const Space&, unsigned int a, SetView, int i, int n, std::ostream& o) const { @@ -74,14 +73,13 @@ namespace Gecode { namespace Set { namespace Branch { ValCommitExc::ngl(Space& home, unsigned int a, SetView x, int n) const { if (a == 0) return new (home) ExcNGL(home, x, n); - else - return nullptr; + return nullptr; } forceinline void ValCommitExc::print(const Space&, unsigned int a, SetView, int i, int n, std::ostream& o) const { o << "var[" << i << "]." << ((a == 0) ? "exclude" : "include") << "(" << n << ")"; } -}}} // namespace Gecode::Set::Branch +} // namespace Gecode::Set::Branch // STATISTICS: set-branch diff --git a/gecode/set/branch/val-sel-commit.cpp b/gecode/set/branch/val-sel-commit.cpp index 26dbb0fe66..c225a6ae13 100644 --- a/gecode/set/branch/val-sel-commit.cpp +++ b/gecode/set/branch/val-sel-commit.cpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Set { namespace Branch { +namespace Gecode::Set::Branch { ValSelCommitBase* value_selection_commit(Space& home, const SetValBranch& svb) { @@ -94,6 +94,6 @@ namespace Gecode { namespace Set { namespace Branch { } } -}}} // namespace Gecode::Set::Branch +} // namespace Gecode::Set::Branch // STATISTICS: set-branch diff --git a/gecode/set/branch/val-sel.hpp b/gecode/set/branch/val-sel.hpp index faf6d94d11..105f8d2301 100644 --- a/gecode/set/branch/val-sel.hpp +++ b/gecode/set/branch/val-sel.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Set { namespace Branch { +namespace Gecode::Set::Branch { forceinline ValSelMin::ValSelMin(Space& home, const ValBranch& vb) @@ -108,7 +108,7 @@ namespace Gecode { namespace Set { namespace Branch { return 0; } forceinline bool - ValSelRnd::notice(void) const { + ValSelRnd::notice() const { return false; } forceinline void @@ -116,6 +116,6 @@ namespace Gecode { namespace Set { namespace Branch { r.~Rnd(); } -}}} // namespace Gecode::Set::Branch +} // namespace Gecode::Set::Branch // STATISTICS: set-branch diff --git a/gecode/set/branch/val.hpp b/gecode/set/branch/val.hpp index 0fe691ea36..553765a90a 100644 --- a/gecode/set/branch/val.hpp +++ b/gecode/set/branch/val.hpp @@ -45,37 +45,37 @@ namespace Gecode { : ValBranch(std::move(v), std::move(c)), s(SEL_VAL_COMMIT) {} forceinline SetValBranch::Select - SetValBranch::select(void) const { + SetValBranch::select() const { return s; } inline SetValBranch - SET_VAL_MIN_INC(void) { + SET_VAL_MIN_INC() { return SetValBranch(SetValBranch::SEL_MIN_INC); } inline SetValBranch - SET_VAL_MIN_EXC(void) { + SET_VAL_MIN_EXC() { return SetValBranch(SetValBranch::SEL_MIN_EXC); } inline SetValBranch - SET_VAL_MED_INC(void) { + SET_VAL_MED_INC() { return SetValBranch(SetValBranch::SEL_MED_INC); } inline SetValBranch - SET_VAL_MED_EXC(void) { + SET_VAL_MED_EXC() { return SetValBranch(SetValBranch::SEL_MED_EXC); } inline SetValBranch - SET_VAL_MAX_INC(void) { + SET_VAL_MAX_INC() { return SetValBranch(SetValBranch::SEL_MAX_INC); } inline SetValBranch - SET_VAL_MAX_EXC(void) { + SET_VAL_MAX_EXC() { return SetValBranch(SetValBranch::SEL_MAX_EXC); } diff --git a/gecode/set/branch/var.hpp b/gecode/set/branch/var.hpp index 4ba843caf4..8300b1cd3f 100644 --- a/gecode/set/branch/var.hpp +++ b/gecode/set/branch/var.hpp @@ -35,7 +35,7 @@ namespace Gecode { forceinline - SetVarBranch::SetVarBranch(void) + SetVarBranch::SetVarBranch() : s(SEL_NONE) {} forceinline @@ -67,7 +67,7 @@ namespace Gecode { : VarBranch(std::move(mf), std::move(t)), s(s0) {} forceinline SetVarBranch::Select - SetVarBranch::select(void) const { + SetVarBranch::select() const { return s; } @@ -100,7 +100,7 @@ namespace Gecode { } inline SetVarBranch - SET_VAR_NONE(void) { + SET_VAR_NONE() { return SetVarBranch(SetVarBranch::SEL_NONE, nullptr); } diff --git a/gecode/set/branch/view-sel.cpp b/gecode/set/branch/view-sel.cpp index 49e01b1103..51e21cbeca 100644 --- a/gecode/set/branch/view-sel.cpp +++ b/gecode/set/branch/view-sel.cpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Set { namespace Branch { +namespace Gecode::Set::Branch { ViewSel* view_selection(Space& home, const SetVarBranch& svb) { @@ -155,6 +155,6 @@ namespace Gecode { namespace Set { namespace Branch { return nullptr; } -}}} // namespace Gecode::Set::Branch +} // namespace Gecode::Set::Branch // STATISTICS: set-branch diff --git a/gecode/set/channel.hh b/gecode/set/channel.hh index cc72d1e19e..8cfd2cece3 100644 --- a/gecode/set/channel.hh +++ b/gecode/set/channel.hh @@ -39,7 +39,7 @@ #include -namespace Gecode { namespace Set { namespace Channel { +namespace Gecode::Set::Channel { /** * \namespace Gecode::Set::Channel @@ -76,8 +76,8 @@ namespace Gecode { namespace Set { namespace Channel { size_t dispose(Space& home) override; /// Perform propagation ExecStatus propagate(Space& home, const ModEventDelta& med) override; - /// Post propagator that propagates that \a s contains the \f$x_i\f$, which are sorted in non-descending order - static ExecStatus post(Home home, View s, ViewArray& x); + /// Post propagator that propagates that \a x0 contains the \f$x_i\f$, which are sorted in non-descending order + static ExecStatus post(Home home, View x0, ViewArray& x); }; /** @@ -141,7 +141,7 @@ namespace Gecode { namespace Set { namespace Channel { class ChannelBool : public MixNaryOnePropagator { protected: - typedef MixNaryOnePropagator Super; + using Super = MixNaryOnePropagator; using Super::x; using Super::y; @@ -163,7 +163,7 @@ namespace Gecode { namespace Set { namespace Channel { /// Constructor for cloning \a a IndexAdvisor(Space& home, IndexAdvisor& a); /// Access index - int index(void) const; + int index() const; /// Delete advisor template void dispose(Space& home, Council& c); @@ -238,7 +238,7 @@ namespace Gecode { namespace Set { namespace Channel { static ExecStatus post(Home home, ViewArray>& x, ViewArray>& y); }; -}}} // namespace Gecode::Set::Channel +} // namespace Gecode::Set::Channel #include #include diff --git a/gecode/set/channel/bool.hpp b/gecode/set/channel/bool.hpp index a62407d14a..c5a2b8b450 100644 --- a/gecode/set/channel/bool.hpp +++ b/gecode/set/channel/bool.hpp @@ -32,16 +32,16 @@ #include -namespace Gecode { namespace Set { namespace Channel { +namespace Gecode::Set::Channel { template template forceinline ChannelBool::IndexAdvisor::IndexAdvisor(Space& home, ChannelBool& p, Council& c, int index) : Advisor(home, p, c), idx(index) { - if (idx == -1) + if (idx == -1) { p.y.subscribe(home, *this); - else { + } else { p.x[idx].subscribe(home, *this); } } @@ -53,7 +53,7 @@ namespace Gecode { namespace Set { namespace Channel { template forceinline int - ChannelBool::IndexAdvisor::index(void) const { + ChannelBool::IndexAdvisor::index() const { return idx; } @@ -62,9 +62,9 @@ namespace Gecode { namespace Set { namespace Channel { forceinline void ChannelBool::IndexAdvisor::dispose(Space& home, Council& c) { ChannelBool& p = static_cast&>(propagator()); - if (idx == -1) + if (idx == -1) { p.y.cancel(home, *this); - else { + } else { p.x[idx].cancel(home, *this); } Advisor::dispose(home, c); @@ -151,12 +151,12 @@ namespace Gecode { namespace Set { namespace Channel { ExecStatus ChannelBool::propagate(Space& home, const ModEventDelta&) { running = true; - if (zeros.size() > 0) { + if (!zeros.empty()) { BndSetRanges zi(zeros); GECODE_ME_CHECK(y.exclude_i(home, zi)); zeros.init(home); } - if (ones.size() > 0) { + if (!ones.empty()) { BndSetRanges oi(ones); GECODE_ME_CHECK(y.include_i(home, oi)); ones.init(home); @@ -263,10 +263,9 @@ namespace Gecode { namespace Set { namespace Channel { } if (y.assigned()) return home.ES_NOFIX_DISPOSE(co, a); - else - return ES_NOFIX; + return ES_NOFIX; } -}}} // namespace Gecode::Set::Channel +} // namespace Gecode::Set::Channel // STATISTICS: set-prop diff --git a/gecode/set/channel/int.hpp b/gecode/set/channel/int.hpp index f8548f368e..826dc6a23d 100644 --- a/gecode/set/channel/int.hpp +++ b/gecode/set/channel/int.hpp @@ -36,7 +36,7 @@ #include -namespace Gecode { namespace Set { namespace Channel { +namespace Gecode::Set::Channel { template forceinline @@ -150,6 +150,6 @@ namespace Gecode { namespace Set { namespace Channel { return (assigned == xs.size()) ? home.ES_SUBSUMED(*this) : ES_NOFIX; } -}}} // namespace Gecode::Set::Channel +} // namespace Gecode::Set::Channel // STATISTICS: set-prop diff --git a/gecode/set/channel/set.hpp b/gecode/set/channel/set.hpp index af49dee76a..f37f04ab70 100644 --- a/gecode/set/channel/set.hpp +++ b/gecode/set/channel/set.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Set { namespace Channel { +namespace Gecode::Set::Channel { template forceinline @@ -150,6 +150,6 @@ namespace Gecode { namespace Set { namespace Channel { return (assigned == xs.size() + ys.size()) ? home.ES_SUBSUMED(*this) : ES_FIX; } -}}} // namespace Gecode::Set::Channel +} // namespace Gecode::Set::Channel // STATISTICS: set-prop diff --git a/gecode/set/channel/sorted.hpp b/gecode/set/channel/sorted.hpp index e87b0e487d..3621247497 100644 --- a/gecode/set/channel/sorted.hpp +++ b/gecode/set/channel/sorted.hpp @@ -38,7 +38,7 @@ #include #include -namespace Gecode { namespace Set { namespace Channel { +namespace Gecode::Set::Channel { template forceinline @@ -190,6 +190,6 @@ namespace Gecode { namespace Set { namespace Channel { return home.ES_SUBSUMED(*this); } -}}} // namespace Gecode::Set::Channel +} // namespace Gecode::Set::Channel // STATISTICS: set-prop diff --git a/gecode/set/convex.hh b/gecode/set/convex.hh index 3dd5f653ae..0873cc01c1 100644 --- a/gecode/set/convex.hh +++ b/gecode/set/convex.hh @@ -41,7 +41,7 @@ #include -namespace Gecode { namespace Set { namespace Convex { +namespace Gecode::Set::Convex { /** * \namespace Gecode::Set::Convex @@ -93,7 +93,7 @@ namespace Gecode { namespace Set { namespace Convex { static ExecStatus post(Home home, SetView x, SetView y); }; -}}} // namespace Gecode::Set::Convex +} // namespace Gecode::Set::Convex #include #include diff --git a/gecode/set/convex/conv.cpp b/gecode/set/convex/conv.cpp index 1da7e55b29..dfecb3db07 100644 --- a/gecode/set/convex/conv.cpp +++ b/gecode/set/convex/conv.cpp @@ -36,7 +36,7 @@ #include -namespace Gecode { namespace Set { namespace Convex { +namespace Gecode::Set::Convex { Actor* Convex::copy(Space& home) { @@ -74,7 +74,7 @@ namespace Gecode { namespace Set { namespace Convex { Iter::Ranges::Cache ub_range_it_c(r, ub_range_it); for (; ub_range_it_c(); ++ub_range_it_c) { - if (ub_range_it_c.width() < (unsigned int)x0.card_min() || + if (ub_range_it_c.width() < x0.card_min() || ub_range_it_c.min() > x0.glb_min() // No need to test for empty lb. || ub_range_it_c.max() < x0.glb_max()) { GECODE_ME_CHECK(x0.exclude(home, ub_range_it_c.min(), ub_range_it_c.max())); @@ -85,6 +85,6 @@ namespace Gecode { namespace Set { namespace Convex { return ES_FIX; } -}}} // namespace Gecode::Set::Convex +} // namespace Gecode::Set::Convex // STATISTICS: set-prop diff --git a/gecode/set/convex/conv.hpp b/gecode/set/convex/conv.hpp index 1b6ed68179..f8ee981a41 100644 --- a/gecode/set/convex/conv.hpp +++ b/gecode/set/convex/conv.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Set { namespace Convex { +namespace Gecode::Set::Convex { /* * "Convex" propagator @@ -57,6 +57,6 @@ namespace Gecode { namespace Set { namespace Convex { return ES_OK; } -}}} // namespace Gecode::Set::Convex +} // namespace Gecode::Set::Convex // STATISTICS: set-prop diff --git a/gecode/set/convex/hull.cpp b/gecode/set/convex/hull.cpp index 283d61e0c2..6acb1ce5e9 100644 --- a/gecode/set/convex/hull.cpp +++ b/gecode/set/convex/hull.cpp @@ -38,7 +38,7 @@ #include -namespace Gecode { namespace Set { namespace Convex { +namespace Gecode::Set::Convex { Actor* ConvexHull::copy(Space& home) { @@ -102,6 +102,6 @@ namespace Gecode { namespace Set { namespace Convex { return ES_NOFIX; } -}}} // namespace Gecode::Set::Convex +} // namespace Gecode::Set::Convex // STATISTICS: set-prop diff --git a/gecode/set/convex/hull.hpp b/gecode/set/convex/hull.hpp index 1d77c734de..e9e6568759 100644 --- a/gecode/set/convex/hull.hpp +++ b/gecode/set/convex/hull.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Set { namespace Convex { +namespace Gecode::Set::Convex { /* * "Convex hull" propagator @@ -57,6 +57,6 @@ namespace Gecode { namespace Set { namespace Convex { return ES_OK; } -}}} // namespace Gecode::Set::Convex +} // namespace Gecode::Set::Convex // STATISTICS: set-prop diff --git a/gecode/set/distinct.hh b/gecode/set/distinct.hh index 7cf59c77dc..a747bd9660 100644 --- a/gecode/set/distinct.hh +++ b/gecode/set/distinct.hh @@ -35,7 +35,7 @@ #include -namespace Gecode { namespace Set { namespace Distinct { +namespace Gecode::Set::Distinct { /** * \namespace Gecode::Set::Distinct @@ -66,7 +66,7 @@ namespace Gecode { namespace Set { namespace Distinct { static ExecStatus post(Home home, ViewArray x, unsigned int c); }; -}}} // namespace Gecode::Set::Distinct +} // namespace Gecode::Set::Distinct #include diff --git a/gecode/set/distinct/atmostOne.cpp b/gecode/set/distinct/atmostOne.cpp index d9bfbd9d38..f2418522f5 100644 --- a/gecode/set/distinct/atmostOne.cpp +++ b/gecode/set/distinct/atmostOne.cpp @@ -41,7 +41,7 @@ * Todo: make the propagators incremental. */ -namespace Gecode { namespace Set { namespace Distinct { +namespace Gecode::Set::Distinct { /* * "AtMostOneIntersection" propagator @@ -148,6 +148,6 @@ namespace Gecode { namespace Set { namespace Distinct { return ES_NOFIX; } -}}} // namespace Gecode::Set::Distinct +} // namespace Gecode::Set::Distinct // STATISTICS: set-prop diff --git a/gecode/set/distinct/atmostOne.hpp b/gecode/set/distinct/atmostOne.hpp index 380f4bbc2c..f26940a729 100644 --- a/gecode/set/distinct/atmostOne.hpp +++ b/gecode/set/distinct/atmostOne.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Set { namespace Distinct { +namespace Gecode::Set::Distinct { /* * "AtMostOneIntersection" propagator @@ -56,6 +56,6 @@ namespace Gecode { namespace Set { namespace Distinct { return ES_OK; } -}}} // namespace Gecode::Set::Distinct +} // namespace Gecode::Set::Distinct // STATISTICS: set-prop diff --git a/gecode/set/element.cpp b/gecode/set/element.cpp index 72df6a1997..5a1ebfa251 100644 --- a/gecode/set/element.cpp +++ b/gecode/set/element.cpp @@ -41,7 +41,7 @@ namespace Gecode { /// VarArg type for constant %Set views class ViewToVarArg { public: - typedef IntSetArgs argtype; + using argtype = IntSetArgs; }; } // namespace Int diff --git a/gecode/set/element.hh b/gecode/set/element.hh index a23451d705..6ac5581f4c 100644 --- a/gecode/set/element.hh +++ b/gecode/set/element.hh @@ -42,25 +42,25 @@ #include #include -namespace Gecode { namespace Int { +namespace Gecode::Int { /// VarArg type for %Set views template <> class ViewToVarArg { public: - typedef Gecode::SetVarArgs argtype; + using argtype = Gecode::SetVarArgs; }; /// VarArg type for singleton views template <> class ViewToVarArg { public: - typedef Gecode::IntVarArgs argtype; + using argtype = Gecode::IntVarArgs; }; -}} // namespace Gecode::Int +} // namespace Gecode::Int -namespace Gecode { namespace Set { namespace Element { +namespace Gecode::Set::Element { /** * \namespace Gecode::Set::Element @@ -76,7 +76,7 @@ namespace Gecode { namespace Set { namespace Element { template class ElementIntersection : public Propagator { public: - typedef Gecode::Int::IdxViewArray IdxViewArray; + using IdxViewArray = Gecode::Int::IdxViewArray; protected: IntSet universe; @@ -102,10 +102,10 @@ namespace Gecode { namespace Set { namespace Element { ExecStatus propagate(Space& home, const ModEventDelta& med) override; /** Post propagator for \f$ z=\bigcap\langle x_0,\dots,x_{n-1}\rangle[y] \f$ using \a u as universe * - * If \a y is empty, \a z will be constrained to be the given universe + * If \a x0 is empty, \a x1 will be constrained to be the given universe * \a u (as an empty intersection is the universe). */ - static ExecStatus post(Home home, IdxViewArray& x, View0 y, View1 z, const IntSet& u); + static ExecStatus post(Home home, IdxViewArray& x, View0 x0, View1 x1, const IntSet& u); }; /** @@ -117,7 +117,7 @@ namespace Gecode { namespace Set { namespace Element { template class ElementUnion : public Propagator { public: - typedef Gecode::Int::IdxViewArray IdxViewArray; + using IdxViewArray = Gecode::Int::IdxViewArray; protected: IdxViewArray iv; @@ -142,10 +142,10 @@ namespace Gecode { namespace Set { namespace Element { ExecStatus propagate(Space& home, const ModEventDelta& med) override; /** Post propagator for \f$ z=\bigcup\langle x_0,\dots,x_{n-1}\rangle[y] \f$ * - * If \a y is empty, \a z will be constrained to be empty + * If \a x0 is empty, \a x1 will be constrained to be empty * (as an empty union is the empty set). */ - static ExecStatus post(Home home, IdxViewArray& x, View0 y, View1 z); + static ExecStatus post(Home home, IdxViewArray& x, View0 x0, View1 x1); }; /** @@ -180,10 +180,10 @@ namespace Gecode { namespace Set { namespace Element { ExecStatus propagate(Space& home, const ModEventDelta& med) override; /** Post propagator for \f$ z=\bigcup\langle s_0,\dots,s_{n-1}\rangle[y] \f$ * - * If \a y is empty, \a z will be constrained to be empty + * If \a x1 is empty, \a x0 will be constrained to be empty * (as an empty union is the empty set). */ - static ExecStatus post(Home home, SView z, const IntSetArgs& x, RView y); + static ExecStatus post(Home home, SView x0, const IntSetArgs& x, RView x1); }; /** @@ -195,7 +195,7 @@ namespace Gecode { namespace Set { namespace Element { template class ElementDisjoint : public Propagator { public: - typedef Gecode::Int::IdxViewArray IdxViewArray; + using IdxViewArray = Gecode::Int::IdxViewArray; protected: IdxViewArray iv; @@ -218,10 +218,10 @@ namespace Gecode { namespace Set { namespace Element { /// Perform propagation ExecStatus propagate(Space& home, const ModEventDelta& med) override; /// Post propagator for \f$ \parallel\langle x_0,\dots,x_{n-1}\rangle[y] \f$ - static ExecStatus post(Home home, IdxViewArray& x, RView y); + static ExecStatus post(Home home, IdxViewArray& x, RView x1); }; -}}} // namespace Gecode::Set::Element +} // namespace Gecode::Set::Element #include #include diff --git a/gecode/set/element/disjoint.hpp b/gecode/set/element/disjoint.hpp index d479bd21d0..72ae7b3bc0 100644 --- a/gecode/set/element/disjoint.hpp +++ b/gecode/set/element/disjoint.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Set { namespace Element { +namespace Gecode::Set::Element { template forceinline @@ -319,6 +319,6 @@ namespace Gecode { namespace Set { namespace Element { return home.ES_SUBSUMED(*this); } -}}} // namespace Gecode::Set::Element +} // namespace Gecode::Set::Element // STATISTICS: set-prop diff --git a/gecode/set/element/inter.hpp b/gecode/set/element/inter.hpp index 1b508883aa..d9330455b1 100644 --- a/gecode/set/element/inter.hpp +++ b/gecode/set/element/inter.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Set { namespace Element { +namespace Gecode::Set::Element { template forceinline @@ -237,7 +237,7 @@ namespace Gecode { namespace Set { namespace Element { // In the second iteration, this time backwards, compute // sofarAfter as the intersection of all glb(x_j) with j>i for (int i = n; i--;) { - if (sofar_after.size() == 0) + if (sofar_after.empty()) break; // extra = inter(before[i], sofarAfter) - lub(x1) @@ -302,6 +302,6 @@ namespace Gecode { namespace Set { namespace Element { return ES_FIX; } -}}} // namespace Gecode::Set::Element +} // namespace Gecode::Set::Element // STATISTICS: set-prop diff --git a/gecode/set/element/union.hpp b/gecode/set/element/union.hpp index 0dda31ab79..acf8f4daac 100644 --- a/gecode/set/element/union.hpp +++ b/gecode/set/element/union.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Set { namespace Element { +namespace Gecode::Set::Element { template forceinline @@ -324,6 +324,6 @@ namespace Gecode { namespace Set { namespace Element { return home.ES_SUBSUMED(*this); } -}}} // namespace Gecode::Set::Element +} // namespace Gecode::Set::Element // STATISTICS: set-prop diff --git a/gecode/set/element/unionConst.hpp b/gecode/set/element/unionConst.hpp index da25e443cf..2cb925d9c0 100644 --- a/gecode/set/element/unionConst.hpp +++ b/gecode/set/element/unionConst.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Set { namespace Element { +namespace Gecode::Set::Element { template forceinline @@ -278,6 +278,6 @@ namespace Gecode { namespace Set { namespace Element { return ES_FIX; } -}}} // namespace Gecode::Set::Element +} // namespace Gecode::Set::Element // STATISTICS: set-prop diff --git a/gecode/set/exception.cpp b/gecode/set/exception.cpp index e2e861f7ef..488f36a929 100644 --- a/gecode/set/exception.cpp +++ b/gecode/set/exception.cpp @@ -34,7 +34,7 @@ #include -namespace Gecode { namespace Set { +namespace Gecode::Set { OutOfLimits::OutOfLimits(const char* l) : Exception(l, "Number out of limits") {} @@ -53,6 +53,6 @@ namespace Gecode { namespace Set { UnknownOperation::UnknownOperation(const char* l) : Exception(l, "Unknown operation type") {} -}} // namespace Gecode::Set +} // namespace Gecode::Set // STATISTICS: set-other diff --git a/gecode/set/exception.hpp b/gecode/set/exception.hpp index 1e10ddf30c..82d0287ce3 100644 --- a/gecode/set/exception.hpp +++ b/gecode/set/exception.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Set { +namespace Gecode::Set { /** * \defgroup FuncThrowSet Set exceptions @@ -98,6 +98,6 @@ namespace Gecode { namespace Set { //@} -}} // namespace Gecode::Set +} // namespace Gecode::Set // STATISTICS: set-other diff --git a/gecode/set/int.cpp b/gecode/set/int.cpp index d97015f3d9..2170c598b0 100644 --- a/gecode/set/int.cpp +++ b/gecode/set/int.cpp @@ -84,10 +84,10 @@ namespace Gecode { } // namespace Gecode -namespace Gecode { namespace Set { namespace Int { +namespace Gecode::Set::Int { /// Reify \a m to be the minimum of \a s - void + static void remin(Home home, SetVar s, IntVar m, Reify r) { IntVar c(home, 0, static_cast(Set::Limits::card)); cardinality(home, s, c); @@ -100,7 +100,7 @@ namespace Gecode { namespace Set { namespace Int { } /// Reify \a m to be the maximum of \a s - void + static void remax(Home home, SetVar s, IntVar m, Reify r) { IntVar c(home, 0, static_cast(Set::Limits::card)); cardinality(home, s, c); @@ -112,7 +112,7 @@ namespace Gecode { namespace Set { namespace Int { max(home, s, m, ne); } -}}} // namespace Gecode::Set::Int +} // namespace Gecode::Set::Int namespace Gecode { diff --git a/gecode/set/int.hh b/gecode/set/int.hh index c92b287903..2122629ad1 100644 --- a/gecode/set/int.hh +++ b/gecode/set/int.hh @@ -37,7 +37,7 @@ #include -namespace Gecode { namespace Set { namespace Int { +namespace Gecode::Set::Int { /** * \namespace Gecode::Set::Int @@ -65,8 +65,8 @@ namespace Gecode { namespace Set { namespace Int { Actor* copy(Space& home) override; /// Perform propagation ExecStatus propagate(Space& home, const ModEventDelta& med) override; - /// Post propagator for \a x is the minimal element of \a s - static ExecStatus post(Home home, View s, Gecode::Int::IntView x); + /// Post propagator for \a x is the minimal element of \a x0 + static ExecStatus post(Home home, View x0, Gecode::Int::IntView x); }; /** @@ -90,8 +90,8 @@ namespace Gecode { namespace Set { namespace Int { Actor* copy(Space& home) override; /// Perform propagation ExecStatus propagate(Space& home, const ModEventDelta& med) override; - /// Post propagator for \a x is not the minimal element of \a s - static ExecStatus post(Home home, View s, Gecode::Int::IntView x); + /// Post propagator for \a x is not the minimal element of \a x0 + static ExecStatus post(Home home, View x0, Gecode::Int::IntView x); }; /** @@ -120,8 +120,8 @@ namespace Gecode { namespace Set { namespace Int { Actor* copy(Space& home) override; /// Perform propagation ExecStatus propagate(Space& home, const ModEventDelta& med) override; - /// Post reified propagator for \a b iff \a x is the minimal element of \a s - static ExecStatus post(Home home, View s, Gecode::Int::IntView x, Gecode::Int::BoolView b); + /// Post reified propagator for \a b iff \a x is the minimal element of \a x0 + static ExecStatus post(Home home, View x0, Gecode::Int::IntView x, Gecode::Int::BoolView b); }; /** @@ -145,8 +145,8 @@ namespace Gecode { namespace Set { namespace Int { Actor* copy(Space& home) override; /// Perform propagation ExecStatus propagate(Space& home, const ModEventDelta& med) override; - /// Post propagator for \a x is the largest element of \a s - static ExecStatus post(Home home, View s, Gecode::Int::IntView x); + /// Post propagator for \a x is the largest element of \a x0 + static ExecStatus post(Home home, View x0, Gecode::Int::IntView x); }; /** @@ -170,8 +170,8 @@ namespace Gecode { namespace Set { namespace Int { Actor* copy(Space& home) override; /// Perform propagation ExecStatus propagate(Space& home, const ModEventDelta& med) override; - /// Post propagator for \a x is not the largest element of \a s - static ExecStatus post(Home home, View s, Gecode::Int::IntView x); + /// Post propagator for \a x is not the largest element of \a x0 + static ExecStatus post(Home home, View x0, Gecode::Int::IntView x); }; /** @@ -200,8 +200,8 @@ namespace Gecode { namespace Set { namespace Int { Actor* copy(Space& home) override; /// Perform propagation ExecStatus propagate(Space& home, const ModEventDelta& med) override; - /// Post reified propagator for \a b iff \a x is the largest element of \a s - static ExecStatus post(Home home, View s, Gecode::Int::IntView x, Gecode::Int::BoolView b); + /// Post reified propagator for \a b iff \a x is the largest element of \a x0 + static ExecStatus post(Home home, View x0, Gecode::Int::IntView x, Gecode::Int::BoolView b); }; /** @@ -226,7 +226,7 @@ namespace Gecode { namespace Set { namespace Int { /// Perform propagation ExecStatus propagate(Space& home, const ModEventDelta& med) override; /// Post propagator for \f$ |s|=x \f$ - static ExecStatus post(Home home, View s, Gecode::Int::IntView x); + static ExecStatus post(Home home, View x0, Gecode::Int::IntView x); }; /** @@ -269,7 +269,7 @@ namespace Gecode { namespace Set { namespace Int { Gecode::Int::IntView y); }; -}}} // namespace Gecode::Set::Int +} // namespace Gecode::Set::Int #include #include diff --git a/gecode/set/int/card.hpp b/gecode/set/int/card.hpp index 09acedf107..57eaac3920 100644 --- a/gecode/set/int/card.hpp +++ b/gecode/set/int/card.hpp @@ -37,7 +37,7 @@ #include #include -namespace Gecode { namespace Set { namespace Int { +namespace Gecode::Set::Int { template forceinline @@ -81,6 +81,6 @@ namespace Gecode { namespace Set { namespace Int { return ES_FIX; } -}}} // namespace Gecode::Set::Int +} // namespace Gecode::Set::Int // STATISTICS: set-prop diff --git a/gecode/set/int/minmax.hpp b/gecode/set/int/minmax.hpp index adf39a7e1c..488c9d6a1b 100644 --- a/gecode/set/int/minmax.hpp +++ b/gecode/set/int/minmax.hpp @@ -38,7 +38,7 @@ #include #include -namespace Gecode { namespace Set { namespace Int { +namespace Gecode::Set::Int { template forceinline @@ -310,7 +310,7 @@ namespace Gecode { namespace Set { namespace Int { return home.ES_SUBSUMED(*this); } // if min(x0) not in dom(x1): b=0, entailed - else if ((x0.glb_min() < x1.min()) || (x0.glb_min() > x1.max()) || !x1.in(x0.glb_min())) { + if ((x0.glb_min() < x1.min()) || (x0.glb_min() > x1.max()) || !x1.in(x0.glb_min())) { if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); return home.ES_SUBSUMED(*this); @@ -580,7 +580,7 @@ namespace Gecode { namespace Set { namespace Int { return home.ES_SUBSUMED(*this); } // if max(x0) not in dom(x1): b=0, entailed - else if ((x0.glb_max() < x1.min()) || (x0.glb_max() > x1.max()) || !x1.in(x0.glb_max())) { + if ((x0.glb_max() < x1.min()) || (x0.glb_max() > x1.max()) || !x1.in(x0.glb_max())) { if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); return home.ES_SUBSUMED(*this); @@ -622,6 +622,6 @@ namespace Gecode { namespace Set { namespace Int { return ES_FIX; } -}}} // namespace Gecode::Set::Int +} // namespace Gecode::Set::Int // STATISTICS: set-prop diff --git a/gecode/set/int/weights.hpp b/gecode/set/int/weights.hpp index d7414134dd..6f3e630656 100644 --- a/gecode/set/int/weights.hpp +++ b/gecode/set/int/weights.hpp @@ -37,7 +37,7 @@ #include #include -namespace Gecode { namespace Set { namespace Int { +namespace Gecode::Set::Int { /// Value Iterator for values above a certain weight template @@ -54,13 +54,13 @@ namespace Gecode { namespace Set { namespace Int { /// The current index into the elements and weights int index; /// Move to the next element - void next(void); + void next(); public: /// \name Constructors and initialization //@{ /// Default constructor - OverweightValues(void) = default; + OverweightValues() = default; /// Initialize with elements/weights pairs, threshold \a t and iterator \a i OverweightValues(int t, SharedArray& elements0, SharedArray& weights0, I& i); /// Initialize with elements/weights pairs, threshold \a t and iterator \a i @@ -70,20 +70,20 @@ namespace Gecode { namespace Set { namespace Int { /// \name Iteration control //@{ /// Test whether iterator is still at a value or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next value (if possible) - void operator++(void); + void operator++(); //@} /// \name Value access //@{ /// Return current value - int val(void) const; + int val() const; //@} }; template forceinline void - OverweightValues::next(void) { + OverweightValues::next() { while (iter()) { while (elements[index] < iter.val()) index++; @@ -115,20 +115,20 @@ namespace Gecode { namespace Set { namespace Int { template forceinline bool - OverweightValues::operator()(void) const { + OverweightValues::operator()() const { return iter(); } template forceinline void - OverweightValues::operator++(void) { + OverweightValues::operator++() { ++iter; next(); } template forceinline int - OverweightValues::val(void) const { + OverweightValues::val() const { return elements[index]; } @@ -341,6 +341,6 @@ namespace Gecode { namespace Set { namespace Int { return ES_NOFIX; } -}}} // namespace Gecode::Set::Int +} // namespace Gecode::Set::Int // STATISTICS: set-prop diff --git a/gecode/set/ldsb.cpp b/gecode/set/ldsb.cpp index 9e18baaa16..dfd4f750f2 100644 --- a/gecode/set/ldsb.cpp +++ b/gecode/set/ldsb.cpp @@ -56,15 +56,15 @@ namespace Gecode { } } // namespace Gecode -namespace Gecode { namespace Int { namespace LDSB { +namespace Gecode::Int::LDSB { template <> ModEvent prune(Space& home, Set::SetView x, int v) { return x.exclude(home, v); } -}}} // namespace Gecode::Int::LDSB +} // namespace Gecode::Int::LDSB -namespace Gecode { namespace Set { namespace LDSB { +namespace Gecode::Set::LDSB { /// Map from variable implementation to index class VariableMap : public std::map {}; @@ -73,7 +73,7 @@ namespace Gecode { namespace Set { namespace LDSB { * The create_set_sym function is an almost exact copy of * create_int_sym/create_bool_sym. */ - SymmetryImp* + static SymmetryImp* create_set_sym(Space& home, const SymmetryHandle& s, VariableMap variable_map) { VariableSymmetryObject* varref = dynamic_cast(s.ref); ValueSymmetryObject* valref = dynamic_cast(s.ref); @@ -127,22 +127,22 @@ namespace Gecode { namespace Set { namespace LDSB { * * Stores their number in \a nsyms and returns nullptr if there are none. */ - SymmetryImp** + static SymmetryImp** create_set_syms(Space& home, const Symmetries& syms, const VariableMap& variable_map, int& nsyms) { nsyms = 0; - for (int i = 0; i < syms.size(); i++) - if (!is_empty(syms[i])) + for (const auto& sym : syms) + if (!is_empty(sym)) nsyms++; if (nsyms == 0) return nullptr; SymmetryImp** array = home.alloc*>(nsyms); int created = 0; - for (int i = 0; i < syms.size(); i++) - if (!is_empty(syms[i])) - array[created++] = create_set_sym(home, syms[i], variable_map); + for (const auto& sym : syms) + if (!is_empty(sym)) + array[created++] = create_set_sym(home, sym, variable_map); return array; } -}}} // namespace Gecode::Set::LDSB +} // namespace Gecode::Set::LDSB namespace Gecode { diff --git a/gecode/set/ldsb.hh b/gecode/set/ldsb.hh index 63bc3f8f9a..22e7e5f1c7 100644 --- a/gecode/set/ldsb.hh +++ b/gecode/set/ldsb.hh @@ -40,7 +40,7 @@ * \namespace Gecode::Set::LDSB * \brief Symmetry breaking for set variables */ -namespace Gecode { namespace Set { namespace LDSB { +namespace Gecode::Set::LDSB { using namespace Int::LDSB; @@ -114,15 +114,15 @@ namespace Gecode { namespace Set { namespace LDSB { void update_part1(Space& home, int choice_pos); }; -}}} // namespace Gecode::Set::LDSB +} // namespace Gecode::Set::LDSB -namespace Gecode { namespace Int { namespace LDSB { +namespace Gecode::Int::LDSB { template <> ArgArray VariableSequenceSymmetryImp::symmetric(Literal l, const ViewArray& x) const; -}}} // namespace Gecode::Int::LDSB +} // namespace Gecode::Int::LDSB #include diff --git a/gecode/set/ldsb/brancher.hpp b/gecode/set/ldsb/brancher.hpp index ce7f5bd6af..c2a7550f1c 100644 --- a/gecode/set/ldsb/brancher.hpp +++ b/gecode/set/ldsb/brancher.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Set { namespace LDSB { +namespace Gecode::Set::LDSB { template LDSBSetBrancher::LDSBSetBrancher(Home home, ViewArray& x, @@ -156,6 +156,7 @@ namespace Gecode { namespace Set { namespace LDSB { const Choice* LDSBSetBrancher::choice(Space& home) { // Making the PVC here is not so nice, I think. + // NOLINTNEXTLINE(bugprone-parent-virtual-call): LDSBBrancher::choice needs the updated symmetries const Choice* c = ViewValBrancher::choice(home); const PosValChoice* pvc = static_cast*>(c); @@ -189,12 +190,14 @@ namespace Gecode { namespace Set { namespace LDSB { _left_branch_values = IntSet(ia); // Post the branching constraint. + // NOLINTNEXTLINE(bugprone-parent-virtual-call): the prunings below are the ones LDSB adds ExecStatus from_base = ViewValBrancher::commit(home, c, b); GECODE_ES_CHECK(from_base); for (int i = 0; i < this->_nsyms; i++) this->_syms[i]->update(Literal(choice_pos, choice_val)); } else if (b == 1) { // Post the branching constraint. + // NOLINTNEXTLINE(bugprone-parent-virtual-call): the prunings below are the ones LDSB adds ExecStatus from_base = ViewValBrancher::commit(home, c, b); GECODE_ES_CHECK(from_base); @@ -259,6 +262,6 @@ namespace Gecode { namespace Set { namespace LDSB { } } -}}} // namespace Gecode::Set::LDSB +} // namespace Gecode::Set::LDSB // STATISTICS: set-branch diff --git a/gecode/set/ldsb/sym-imp.cpp b/gecode/set/ldsb/sym-imp.cpp index 4243ad0009..7cdf64d8e5 100644 --- a/gecode/set/ldsb/sym-imp.cpp +++ b/gecode/set/ldsb/sym-imp.cpp @@ -31,12 +31,13 @@ */ #include +#include -namespace Gecode { namespace Set { namespace LDSB { +namespace Gecode::Set::LDSB { // XXX: implementation of equalValues could be improved? /// Do two set variables have equal least-upper-bounds? - bool + static bool equal_lub(const Set::SetView& x, const Set::SetView& y) { unsigned int n = x.lub_size(); if (n != y.lub_size()) @@ -46,11 +47,11 @@ namespace Gecode { namespace Set { namespace LDSB { return false; return true; } -}}} // namespace Gecode::Set::LDSB +} // namespace Gecode::Set::LDSB // Note carefully that this is in the Gecode::Int::LDSB namespace, not // Gecode::Set::LDSB. -namespace Gecode { namespace Int { namespace LDSB { +namespace Gecode::Int::LDSB { template <> ArgArray VariableSymmetryImp::symmetric(Literal l, const ViewArray& x) const { @@ -65,9 +66,8 @@ namespace Gecode { namespace Int { namespace LDSB { lits[j++] = Literal(i.val(), l._value); } return lits; - } else { - return ArgArray(0); } + return ArgArray(0); } template <> @@ -84,9 +84,8 @@ namespace Gecode { namespace Int { namespace LDSB { lits[j++] = Literal(l._variable, i.val()); } return lits; - } else { - return ArgArray(0); } + return ArgArray(0); } template <> @@ -94,7 +93,7 @@ namespace Gecode { namespace Int { namespace LDSB { VariableSequenceSymmetryImp::symmetric(Literal l, const ViewArray& x) const { Region region; Support::DynamicStack s(region); - if (l._variable < (int)lookup_size) { + if (std::cmp_less(l._variable, lookup_size)) { int pos_it = lookup[l._variable]; if (pos_it == -1) { return dynamic_stack_to_arg_array(s); @@ -117,10 +116,9 @@ namespace Gecode { namespace Int { namespace LDSB { if ((!xv.assigned() && !yv.assigned()) || (xv.assigned() && yv.assigned() && Set::LDSB::equal_lub(xv, yv))) { continue; - } else { - active = false; - break; } + active = false; + break; } if (active) { @@ -151,6 +149,6 @@ namespace Gecode { namespace Int { namespace LDSB { } return dynamic_stack_to_arg_array(s); } -}}} // namespace Gecode::Int::LDSB +} // namespace Gecode::Int::LDSB // STATISTICS: set-branch diff --git a/gecode/set/limits.hpp b/gecode/set/limits.hpp index 13c55743c0..5e7255ff7a 100644 --- a/gecode/set/limits.hpp +++ b/gecode/set/limits.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Set { +namespace Gecode::Set { inline void Limits::check(int n, const char* l) { @@ -50,6 +50,6 @@ namespace Gecode { namespace Set { throw OutOfLimits(l); } -}} // namespace Gecode::Set +} // namespace Gecode::Set // STATISTICS: set-var diff --git a/gecode/set/precede.hh b/gecode/set/precede.hh index 7a95dd4c42..a89827359d 100644 --- a/gecode/set/precede.hh +++ b/gecode/set/precede.hh @@ -46,7 +46,7 @@ * \brief Value precedence propagators */ -namespace Gecode { namespace Set { namespace Precede { +namespace Gecode::Set::Precede { /** * \brief Single value precedence propagator @@ -104,7 +104,7 @@ namespace Gecode { namespace Set { namespace Precede { static ExecStatus post(Home home, ViewArray& x, int s, int t); }; -}}} // namespace Gecode::Set::Precede +} // namespace Gecode::Set::Precede #include diff --git a/gecode/set/precede/single.hpp b/gecode/set/precede/single.hpp index 3d8bb5c453..4d6f0a3200 100644 --- a/gecode/set/precede/single.hpp +++ b/gecode/set/precede/single.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Set { namespace Precede { +namespace Gecode::Set::Precede { template forceinline @@ -240,6 +240,6 @@ namespace Gecode { namespace Set { namespace Precede { return (c.empty()) ? home.ES_SUBSUMED(*this) : ES_FIX; } -}}} // namespace Gecode::Set::Precede +} // namespace Gecode::Set::Precede // STATISTICS: set-prop diff --git a/gecode/set/rel-op.hh b/gecode/set/rel-op.hh index 2334a3c212..321d835b58 100644 --- a/gecode/set/rel-op.hh +++ b/gecode/set/rel-op.hh @@ -42,7 +42,7 @@ #include #include -namespace Gecode { namespace Set { namespace RelOp { +namespace Gecode::Set::RelOp { /** * \namespace Gecode::Set::RelOp @@ -73,7 +73,7 @@ namespace Gecode { namespace Set { namespace RelOp { /// Perform propagation ExecStatus propagate(Space& home, const ModEventDelta& med) override; /// Post propagator \f$ z \supseteq x \cap y\f$ - static ExecStatus post(Home home, View0 x, View1 y, View2 z); + static ExecStatus post(Home home, View0 x, View1 x1, View2 x2); }; /** @@ -99,7 +99,7 @@ namespace Gecode { namespace Set { namespace RelOp { /// Perform propagation ExecStatus propagate(Space& home, const ModEventDelta& med) override; /// Post propagator \f$ z \subseteq x \cap y\f$ - static ExecStatus post(Home home, View0 x, View1 y, View2 z); + static ExecStatus post(Home home, View0 x, View1 x1, View2 x2); }; /** @@ -125,7 +125,7 @@ namespace Gecode { namespace Set { namespace RelOp { /// Perform propagation ExecStatus propagate(Space& home, const ModEventDelta& med) override; /// Post propagator \f$ z=x\cap y\f$ - static ExecStatus post(Home home, View0 x, View1 y, View2 z); + static ExecStatus post(Home home, View0 x, View1 x1, View2 x2); }; /** @@ -151,7 +151,7 @@ namespace Gecode { namespace Set { namespace RelOp { /// Perform propagation ExecStatus propagate(Space& home, const ModEventDelta& med) override; /// Post propagator \f$ z=x\cup y\f$ - static ExecStatus post(Home home, View0 x, View1 y, View2 z); + static ExecStatus post(Home home, View0 x, View1 x1, View2 x2); }; /** @@ -184,9 +184,9 @@ namespace Gecode { namespace Set { namespace RelOp { /// Perform propagation ExecStatus propagate(Space& home, const ModEventDelta& med) override; /// Post propagator \f$ x = \bigcap_{i\in\{0,\dots,n-1\}} y_i \f$ - static ExecStatus post(Home home, ViewArray& y, View1 x); + static ExecStatus post(Home home, ViewArray& x, View1 y); /// Post propagator \f$ x = z\cap\bigcap_{i\in\{0,\dots,n-1\}} y_i \f$ - static ExecStatus post(Home home, ViewArray& y, const IntSet& z, View1 x); + static ExecStatus post(Home home, ViewArray& x, const IntSet& z, View1 y); }; /** @@ -219,9 +219,9 @@ namespace Gecode { namespace Set { namespace RelOp { /// Cost function PropCost cost(const Space& home, const ModEventDelta& med) const override; /// Post propagator \f$ x = \bigcup_{i\in\{0,\dots,n-1\}} y_i \f$ - static ExecStatus post(Home home, ViewArray& y, View1 x); + static ExecStatus post(Home home, ViewArray& x, View1 y); /// Post propagator \f$ x = z\cup\bigcup_{i\in\{0,\dots,n-1\}} y_i \f$ - static ExecStatus post(Home home, ViewArray& y, const IntSet& z, View1 x); + static ExecStatus post(Home home, ViewArray& x, const IntSet& z, View1 y); }; /** @@ -254,12 +254,12 @@ namespace Gecode { namespace Set { namespace RelOp { /// Cost function PropCost cost(const Space& home, const ModEventDelta& med) const override; /// Post propagator \f$ x = \biguplus_{i\in\{0,\dots,n-1\}} y_i \f$ - static ExecStatus post(Home home, ViewArray& y, View1 x); + static ExecStatus post(Home home, ViewArray& x, View1 y); /// Post propagator \f$ x = z\uplus\biguplus_{i\in\{0,\dots,n-1\}} y_i \f$ - static ExecStatus post(Home home, ViewArray& y, const IntSet& z, View1 x); + static ExecStatus post(Home home, ViewArray& x, const IntSet& z, View1 y); }; -}}} // namespace Gecode::Set::RelOp +} // namespace Gecode::Set::RelOp #include #include diff --git a/gecode/set/rel-op/common.hpp b/gecode/set/rel-op/common.hpp index e704c0bf59..6ebbcd22d6 100644 --- a/gecode/set/rel-op/common.hpp +++ b/gecode/set/rel-op/common.hpp @@ -69,7 +69,7 @@ namespace Gecode { } /// \endcond - namespace Set { namespace RelOp { + namespace Set::RelOp { /* * Detect sharing between 3 variables @@ -557,7 +557,7 @@ namespace Gecode { return ES_FIX; } - }} // namespace Set::RelOp + } // namespace Set::RelOp } // namespace Gecode #endif diff --git a/gecode/set/rel-op/inter.hpp b/gecode/set/rel-op/inter.hpp index 32a4800f2d..782a437eb7 100644 --- a/gecode/set/rel-op/inter.hpp +++ b/gecode/set/rel-op/inter.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Set { namespace RelOp { +namespace Gecode::Set::RelOp { /* * "Ternary intersection" propagator @@ -157,15 +157,13 @@ namespace Gecode { namespace Set { namespace RelOp { if (shared(x0, x1, x2)) { return (x0ass && x1ass && x2ass) ? home.ES_SUBSUMED(*this) : ES_NOFIX; - } else { - if (x0ass && x1ass && x2ass) - return home.ES_SUBSUMED(*this); - if (x0ass != x0.assigned() || x1ass != x1.assigned() || x2ass != x2.assigned()) { - return ES_NOFIX; - } else { - return ES_FIX; - } } + if (x0ass && x1ass && x2ass) + return home.ES_SUBSUMED(*this); + if (x0ass != x0.assigned() || x1ass != x1.assigned() || x2ass != x2.assigned()) { + return ES_NOFIX; + } + return ES_FIX; } template @@ -329,7 +327,7 @@ namespace Gecode { namespace Set { namespace RelOp { repeat = true; } x.move_lst(i); - if (int_of_dets.size() == 0) { + if (int_of_dets.empty()) { GECODE_ME_CHECK(y.card_max(home, 0)); int_of_dets.dispose(home); return home.ES_SUBSUMED(*this); @@ -351,6 +349,6 @@ namespace Gecode { namespace Set { namespace RelOp { return shared ? ES_NOFIX : ES_FIX; } -}}} // namespace Gecode::Set::RelOp +} // namespace Gecode::Set::RelOp // STATISTICS: set-prop diff --git a/gecode/set/rel-op/partition.hpp b/gecode/set/rel-op/partition.hpp index 69d98630bf..2e8124c68f 100644 --- a/gecode/set/rel-op/partition.hpp +++ b/gecode/set/rel-op/partition.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Set { namespace RelOp { +namespace Gecode::Set::RelOp { /* * "Nary partition" propagator @@ -161,6 +161,6 @@ namespace Gecode { namespace Set { namespace RelOp { return shared ? ES_NOFIX : ES_FIX; } -}}} // namespace Gecode::Set::RelOp +} // namespace Gecode::Set::RelOp // STATISTICS: set-prop diff --git a/gecode/set/rel-op/post-compl-cvc.cpp b/gecode/set/rel-op/post-compl-cvc.cpp index ffe3413311..2478cca4c2 100644 --- a/gecode/set/rel-op/post-compl-cvc.cpp +++ b/gecode/set/rel-op/post-compl-cvc.cpp @@ -36,7 +36,7 @@ #include #include -namespace Gecode { namespace Set { namespace RelOp { +namespace Gecode::Set::RelOp { void post_compl(Home home, ConstSetView x, SetOpType op, SetView y, ConstSetView z) { @@ -47,6 +47,6 @@ namespace Gecode { namespace Set { namespace RelOp { rel_eq(home, x, op, y, cz); } -}}} // namespace Gecode::Set::RelOp +} // namespace Gecode::Set::RelOp // STATISTICS: set-prop diff --git a/gecode/set/rel-op/post-compl-cvv.cpp b/gecode/set/rel-op/post-compl-cvv.cpp index 5b0bb4468e..1717a598ba 100644 --- a/gecode/set/rel-op/post-compl-cvv.cpp +++ b/gecode/set/rel-op/post-compl-cvv.cpp @@ -36,7 +36,7 @@ #include #include -namespace Gecode { namespace Set { namespace RelOp { +namespace Gecode::Set::RelOp { void post_compl(Home home, ConstSetView x, SetOpType op, SetView y, SetView z) { @@ -44,6 +44,6 @@ namespace Gecode { namespace Set { namespace RelOp { rel_eq>(home, x, op, y, cz); } -}}} // namespace Gecode::Set::RelOp +} // namespace Gecode::Set::RelOp // STATISTICS: set-prop diff --git a/gecode/set/rel-op/post-compl-vvc.cpp b/gecode/set/rel-op/post-compl-vvc.cpp index ee0b69b583..ded4181a8a 100644 --- a/gecode/set/rel-op/post-compl-vvc.cpp +++ b/gecode/set/rel-op/post-compl-vvc.cpp @@ -36,7 +36,7 @@ #include #include -namespace Gecode { namespace Set { namespace RelOp { +namespace Gecode::Set::RelOp { void post_compl(Home home, SetView x, SetOpType op, SetView y, ConstSetView z) { @@ -47,6 +47,6 @@ namespace Gecode { namespace Set { namespace RelOp { rel_eq(home, x, op, y, cz); } -}}} // namespace Gecode::Set::RelOp +} // namespace Gecode::Set::RelOp // STATISTICS: set-prop diff --git a/gecode/set/rel-op/post-compl.cpp b/gecode/set/rel-op/post-compl.cpp index 2d92e55df6..135de5b242 100644 --- a/gecode/set/rel-op/post-compl.cpp +++ b/gecode/set/rel-op/post-compl.cpp @@ -36,7 +36,7 @@ #include #include -namespace Gecode { namespace Set { namespace RelOp { +namespace Gecode::Set::RelOp { void post_compl(Home home, SetView x, SetOpType op, SetView y, SetView z) { @@ -44,6 +44,6 @@ namespace Gecode { namespace Set { namespace RelOp { rel_eq>(home, x, op, y, cz); } -}}} // namespace Gecode::Set::RelOp +} // namespace Gecode::Set::RelOp // STATISTICS: set-prop diff --git a/gecode/set/rel-op/post-nocompl-cvc.cpp b/gecode/set/rel-op/post-nocompl-cvc.cpp index 00fca70e1c..bd214dd78e 100644 --- a/gecode/set/rel-op/post-nocompl-cvc.cpp +++ b/gecode/set/rel-op/post-nocompl-cvc.cpp @@ -36,13 +36,13 @@ #include #include -namespace Gecode { namespace Set { namespace RelOp { +namespace Gecode::Set::RelOp { void post_nocompl(Home home, ConstSetView x, SetOpType op, SetView y, SetRelType r, ConstSetView z) { rel_op_post_nocompl(home, x, op, y, r, z); } -}}} // namespace Gecode::Set::RelOp +} // namespace Gecode::Set::RelOp // STATISTICS: set-prop diff --git a/gecode/set/rel-op/post-nocompl-cvv.cpp b/gecode/set/rel-op/post-nocompl-cvv.cpp index 65156ef129..e7ca42146e 100644 --- a/gecode/set/rel-op/post-nocompl-cvv.cpp +++ b/gecode/set/rel-op/post-nocompl-cvv.cpp @@ -36,13 +36,13 @@ #include #include -namespace Gecode { namespace Set { namespace RelOp { +namespace Gecode::Set::RelOp { void post_nocompl(Home home, ConstSetView x, SetOpType op, SetView y, SetRelType r, SetView z) { rel_op_post_nocompl(home, x, op, y, r, z); } -}}} // namespace Gecode::Set::RelOp +} // namespace Gecode::Set::RelOp // STATISTICS: set-prop diff --git a/gecode/set/rel-op/post-nocompl-vvc.cpp b/gecode/set/rel-op/post-nocompl-vvc.cpp index eb9fbbd85c..4d57271219 100644 --- a/gecode/set/rel-op/post-nocompl-vvc.cpp +++ b/gecode/set/rel-op/post-nocompl-vvc.cpp @@ -36,13 +36,13 @@ #include #include -namespace Gecode { namespace Set { namespace RelOp { +namespace Gecode::Set::RelOp { void post_nocompl(Home home, SetView x, SetOpType op, SetView y, SetRelType r, ConstSetView z) { rel_op_post_nocompl(home, x, op, y, r, z); } -}}} // namespace Gecode::Set::RelOp +} // namespace Gecode::Set::RelOp // STATISTICS: set-prop diff --git a/gecode/set/rel-op/post-nocompl.cpp b/gecode/set/rel-op/post-nocompl.cpp index b83180583a..2e213a3b7b 100644 --- a/gecode/set/rel-op/post-nocompl.cpp +++ b/gecode/set/rel-op/post-nocompl.cpp @@ -36,13 +36,13 @@ #include #include -namespace Gecode { namespace Set { namespace RelOp { +namespace Gecode::Set::RelOp { void post_nocompl(Home home, SetView x, SetOpType op, SetView y, SetRelType r, SetView z) { rel_op_post_nocompl(home, x, op, y, r, z); } -}}} // namespace Gecode::Set::RelOp +} // namespace Gecode::Set::RelOp // STATISTICS: set-prop diff --git a/gecode/set/rel-op/post.hpp b/gecode/set/rel-op/post.hpp index be68e7a8ae..36ad26e76a 100644 --- a/gecode/set/rel-op/post.hpp +++ b/gecode/set/rel-op/post.hpp @@ -37,7 +37,7 @@ #include #include -namespace Gecode { namespace Set { namespace RelOp { +namespace Gecode::Set::RelOp { template forceinline void @@ -190,6 +190,6 @@ namespace Gecode { namespace Set { namespace RelOp { GECODE_SET_EXPORT void post_compl(Home home, ConstSetView x, SetOpType op, SetView y, ConstSetView z); -}}} // namespace Gecode::Set::RelOp +} // namespace Gecode::Set::RelOp // STATISTICS: set-prop diff --git a/gecode/set/rel-op/subofunion.hpp b/gecode/set/rel-op/subofunion.hpp index 0466680165..37bf927c72 100644 --- a/gecode/set/rel-op/subofunion.hpp +++ b/gecode/set/rel-op/subofunion.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Set { namespace RelOp { +namespace Gecode::Set::RelOp { template Actor* @@ -109,16 +109,13 @@ namespace Gecode { namespace Set { namespace RelOp { if (shared(x0, x1, x2)) { if (allassigned) { return home.ES_SUBSUMED(*this); - } else { - return ES_NOFIX; - } - } else { - if (x0.assigned() + x1.assigned() + x2.assigned() >= 2) { - return home.ES_SUBSUMED(*this); - } else { - return ES_FIX; } + return ES_NOFIX; + } + if (x0.assigned() + x1.assigned() + x2.assigned() >= 2) { + return home.ES_SUBSUMED(*this); } + return ES_FIX; } template @@ -138,6 +135,6 @@ namespace Gecode { namespace Set { namespace RelOp { return ES_OK; } -}}} // namespace Gecode::Set::RelOp +} // namespace Gecode::Set::RelOp // STATISTICS: set-prop diff --git a/gecode/set/rel-op/superofinter.hpp b/gecode/set/rel-op/superofinter.hpp index c563f3ee56..0d95cdc2cf 100644 --- a/gecode/set/rel-op/superofinter.hpp +++ b/gecode/set/rel-op/superofinter.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Set { namespace RelOp { +namespace Gecode::Set::RelOp { template forceinline @@ -126,18 +126,15 @@ namespace Gecode { namespace Set { namespace RelOp { if (shared(x0, x1, x2)) { if (allassigned) { return home.ES_SUBSUMED(*this); - } else { - return ES_NOFIX; - } - } else { - if (x0.assigned() + x1.assigned() + x2.assigned() >= 2) { - return home.ES_SUBSUMED(*this); - } else { - return ES_FIX; } + return ES_NOFIX; + } + if (x0.assigned() + x1.assigned() + x2.assigned() >= 2) { + return home.ES_SUBSUMED(*this); } + return ES_FIX; } -}}} // namespace Gecode::Set::RelOp +} // namespace Gecode::Set::RelOp // STATISTICS: set-prop diff --git a/gecode/set/rel-op/union.hpp b/gecode/set/rel-op/union.hpp index f88c1bc5f3..5273a2d895 100644 --- a/gecode/set/rel-op/union.hpp +++ b/gecode/set/rel-op/union.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Set { namespace RelOp { +namespace Gecode::Set::RelOp { /* * "Ternary union" propagator @@ -167,15 +167,13 @@ namespace Gecode { namespace Set { namespace RelOp { if (shared(x0, x1, x2)) { return (x0ass && x1ass && x2ass) ? home.ES_SUBSUMED(*this) : ES_NOFIX; - } else { - if (x0ass && x1ass && x2ass) - return home.ES_SUBSUMED(*this); - if (x0ass != x0.assigned() || x1ass != x1.assigned() || x2ass != x2.assigned()) { - return ES_NOFIX; - } else { - return ES_FIX; - } } + if (x0ass && x1ass && x2ass) + return home.ES_SUBSUMED(*this); + if (x0ass != x0.assigned() || x1ass != x1.assigned() || x2ass != x2.assigned()) { + return ES_NOFIX; + } + return ES_FIX; } /* @@ -304,6 +302,6 @@ namespace Gecode { namespace Set { namespace RelOp { return shared ? ES_NOFIX : ES_FIX; } -}}} // namespace Gecode::Set::RelOp +} // namespace Gecode::Set::RelOp // STATISTICS: set-prop diff --git a/gecode/set/rel.cpp b/gecode/set/rel.cpp index ab88d804d4..5a4dfd9f59 100644 --- a/gecode/set/rel.cpp +++ b/gecode/set/rel.cpp @@ -37,10 +37,10 @@ #include #include -namespace Gecode { namespace Set { +namespace Gecode::Set { template - forceinline void + static forceinline void rel_post(Home home, View0 x0, SetRelType r, View1 x1) { using namespace Set::Rel; using namespace Set::RelOp; @@ -84,7 +84,7 @@ namespace Gecode { namespace Set { } template - forceinline void + static forceinline void rel_re(Home home, View0 x, SetRelType r, View1 y, BoolVar b) { using namespace Set::Rel; using namespace Set::RelOp; @@ -143,7 +143,7 @@ namespace Gecode { namespace Set { } } -}} // namespace Gecode::Set +} // namespace Gecode::Set namespace Gecode { diff --git a/gecode/set/rel.hh b/gecode/set/rel.hh index 01ec43fdf2..d0e48f8766 100644 --- a/gecode/set/rel.hh +++ b/gecode/set/rel.hh @@ -41,7 +41,7 @@ #include -namespace Gecode { namespace Set { namespace Rel { +namespace Gecode::Set::Rel { /** * \namespace Gecode::Set::Rel @@ -50,7 +50,7 @@ namespace Gecode { namespace Set { namespace Rel { /// Test whether two views are in fact the same template - bool same(VX c, VY y); + bool same(VX x, VY y); /** * \brief %Propagator for the subset constraint @@ -67,7 +67,7 @@ namespace Gecode { namespace Set { namespace Rel { /// Constructor for cloning \a p Subset(Space& home, Subset& p); /// Constructor for posting - Subset(Home home, View0 x0, View1 x1); + Subset(Home home, View0 y0, View1 y1); public: /// Copy propagator during cloning @@ -93,7 +93,7 @@ namespace Gecode { namespace Set { namespace Rel { /// Constructor for cloning \a p NoSubset(Space& home, NoSubset& p); /// Constructor for posting - NoSubset(Home home, View0 x0, View1 x1); + NoSubset(Home home, View0 y0, View1 y1); public: /// Copy propagator during cloning @@ -122,7 +122,7 @@ namespace Gecode { namespace Set { namespace Rel { /// Constructor for cloning \a p ReSubset(Space& home, ReSubset& p); /// Constructor for posting - ReSubset(Home home, View0 x0, View1 x1, CtrlView b); + ReSubset(Home home, View0 y0, View1 y1, CtrlView b); public: /// Copy propagator during cloning @@ -136,7 +136,7 @@ namespace Gecode { namespace Set { namespace Rel { /// Perform propagation ExecStatus propagate(Space& home, const ModEventDelta& med) override; /// Post propagator for \f$ (x\subseteq y) \Leftrightarrow b \f$ - static ExecStatus post(Home home, View0 x, View1 y, CtrlView b); + static ExecStatus post(Home home, View0 x, View1 x1, CtrlView b); }; /** @@ -153,7 +153,7 @@ namespace Gecode { namespace Set { namespace Rel { /// Constructor for cloning \a p Eq(Space& home, Eq& p); /// Constructor for posting - Eq(Home home, View0 x0, View1 x1); + Eq(Home home, View0 x0, View1 y); public: /// Copy propagator during cloning @@ -179,7 +179,7 @@ namespace Gecode { namespace Set { namespace Rel { /// Constructor for cloning \a p ReEq(Space& home, ReEq&); /// Constructor for posting - ReEq(Home home, View0 x0, View1 x1, CtrlView b); + ReEq(Home home, View0 y0, View1 y1, CtrlView y2); public: /// Copy propagator during cloning @@ -193,7 +193,7 @@ namespace Gecode { namespace Set { namespace Rel { /// Perform propagation ExecStatus propagate(Space& home, const ModEventDelta& med) override; /// Post propagator for \f$ (x=y) \Leftrightarrow b\f$ - static ExecStatus post(Home home, View0 x, View1 y, CtrlView b); + static ExecStatus post(Home home, View0 x, View1 x1, CtrlView b); }; /** @@ -212,7 +212,7 @@ namespace Gecode { namespace Set { namespace Rel { /// Constructor for cloning \a p Lq(Space& home, Lq& p); /// Constructor for posting - Lq(Home home, View0 x0, View1 x1); + Lq(Home home, View0 x0, View1 y); public: /// Copy propagator during cloning @@ -240,7 +240,7 @@ namespace Gecode { namespace Set { namespace Rel { /// Constructor for cloning \a p ReLq(Space& home, ReLq& p); /// Constructor for posting - ReLq(Home home, View0 x0, View1 x1, Gecode::Int::BoolView b); + ReLq(Home home, View0 y0, View1 y1, Gecode::Int::BoolView y2); public: /// Copy propagator during cloning @@ -254,7 +254,7 @@ namespace Gecode { namespace Set { namespace Rel { /// Perform propagation ExecStatus propagate(Space& home, const ModEventDelta& med) override; /// Post propagator for \f$ (x\leq y) \Leftrightarrow b\f$ - static ExecStatus post(Home home, View0 x, View1 y, Gecode::Int::BoolView b); + static ExecStatus post(Home home, View0 x, View1 x1, Gecode::Int::BoolView b); }; /** @@ -272,7 +272,7 @@ namespace Gecode { namespace Set { namespace Rel { /// Constructor for cloning \a p Distinct(Space& home, Distinct& p); /// Constructor for posting - Distinct(Home home, View0 x0, View1 x1); + Distinct(Home home, View0 x0, View1 y); public: /// Copy propagator during cloning @@ -302,7 +302,7 @@ namespace Gecode { namespace Set { namespace Rel { /// Constructor for cloning \a p DistinctDoit(Space& home, DistinctDoit&); /// Constructor for posting - DistinctDoit(Home home, View0 x0, ConstSetView y); + DistinctDoit(Home home, View0 _x, ConstSetView y); public: /// Copy propagator during cloning @@ -313,7 +313,7 @@ namespace Gecode { namespace Set { namespace Rel { static ExecStatus post(Home home, View0 x, ConstSetView y); }; -}}} // namespace Gecode::Set::Rel +} // namespace Gecode::Set::Rel #include #include diff --git a/gecode/set/rel/common.hpp b/gecode/set/rel/common.hpp index 04029e1563..3f5fb5eae7 100644 --- a/gecode/set/rel/common.hpp +++ b/gecode/set/rel/common.hpp @@ -54,7 +54,7 @@ GECODE_ME_CHECK(me); \ } -namespace Gecode { namespace Set { namespace Rel { +namespace Gecode::Set::Rel { template forceinline bool @@ -75,6 +75,7 @@ namespace Gecode { namespace Set { namespace Rel { } forceinline bool subsumes_me(ModEvent me0, ModEvent me1, ModEvent me) { + // NOLINTNEXTLINE(readability-suspicious-call-argument): combining is symmetric ModEvent cme = SetVarImp::me_combine(me0, me1); return SetVarImp::me_combine(cme, me) == cme; } @@ -132,6 +133,6 @@ namespace Gecode { namespace Set { namespace Rel { return subsumes_me(me0, ME_SET_CARD); } -}}} // namespace Gecode::Set::Rel +} // namespace Gecode::Set::Rel // STATISTICS: set-prop diff --git a/gecode/set/rel/eq.hpp b/gecode/set/rel/eq.hpp index 3a9e736314..ee825de049 100644 --- a/gecode/set/rel/eq.hpp +++ b/gecode/set/rel/eq.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Set { namespace Rel { +namespace Gecode::Set::Rel { template forceinline @@ -107,6 +107,6 @@ namespace Gecode { namespace Set { namespace Rel { return shared(x0, x1) ? ES_NOFIX : ES_FIX; } -}}} // namespace Gecode::Set::Rel +} // namespace Gecode::Set::Rel // STATISTICS: set-prop diff --git a/gecode/set/rel/lq.hpp b/gecode/set/rel/lq.hpp index 1bab4babd7..f9f0b2fc26 100644 --- a/gecode/set/rel/lq.hpp +++ b/gecode/set/rel/lq.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Set { namespace Rel { +namespace Gecode::Set::Rel { /** * \brief Representation of the characteristic functions of two sets @@ -68,15 +68,15 @@ namespace Gecode { namespace Set { namespace Rel { /// Offset for each element (0=lower bound, 1=upper bound) unsigned int yoff; /// Move iterator to next element - void operator++(void); + void operator++(); /// Default constructor - CSIter(void) = default; + CSIter() = default; /// Constructor CSIter(CharacteristicSets& cs0, unsigned int xoff0, unsigned int yoff0); /// Test if iterator is finished - bool operator()(void) const; + bool operator()() const; /// Value of current iterator position - int val(void) const; + int val() const; }; public: @@ -112,7 +112,7 @@ namespace Gecode { namespace Set { namespace Rel { ModEvent ygq(unsigned int i, bool j); /// Return size of combined upper bounds - unsigned int size(void) const; + unsigned int size() const; /// Prune \a x and \a y using computed bounds template @@ -131,7 +131,7 @@ namespace Gecode { namespace Set { namespace Rel { b.clear(i); } forceinline unsigned int - CharacteristicSets::size(void) const { + CharacteristicSets::size() const { return xsize; } @@ -142,17 +142,17 @@ namespace Gecode { namespace Set { namespace Rel { i++; } forceinline void - CharacteristicSets::CSIter::operator++(void) { + CharacteristicSets::CSIter::operator++() { i++; while ((i < cs->xsize) && !cs->get(xoff + 2 * i + yoff)) i++; } forceinline bool - CharacteristicSets::CSIter::operator()(void) const { + CharacteristicSets::CSIter::operator()() const { return i < cs->xsize; } forceinline int - CharacteristicSets::CSIter::val(void) const { + CharacteristicSets::CSIter::val() const { return cs->ub[i]; } @@ -372,10 +372,9 @@ namespace Gecode { namespace Set { namespace Rel { if (i == n) { // case: $ if (strict) { return ES_FAILED; - } else { - GECODE_ES_CHECK(cs.prune(home, x0, x1)); - return home.ES_SUBSUMED(*this); } + GECODE_ES_CHECK(cs.prune(home, x0, x1)); + return home.ES_SUBSUMED(*this); } // Possible cases left: <, <=, > (yields failure), ? @@ -430,9 +429,8 @@ namespace Gecode { namespace Set { namespace Rel { if (strict) { GECODE_ES_CHECK(cs.prune(home, x0, x1)); return assigned ? home.ES_SUBSUMED(*this) : ES_NOFIX; - } else { - goto rewrite_lq; } + goto rewrite_lq; } if (cs.xmax(i) < cs.ymin(i)) // case: < @@ -485,6 +483,6 @@ namespace Gecode { namespace Set { namespace Rel { return assigned ? home.ES_SUBSUMED(*this) : ES_NOFIX; } -}}} // namespace Gecode::Set::Rel +} // namespace Gecode::Set::Rel // STATISTICS: set-prop diff --git a/gecode/set/rel/nosubset.hpp b/gecode/set/rel/nosubset.hpp index a6bde636d0..6a94430e11 100644 --- a/gecode/set/rel/nosubset.hpp +++ b/gecode/set/rel/nosubset.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Set { namespace Rel { +namespace Gecode::Set::Rel { /* * "No Subset" propagator @@ -98,6 +98,6 @@ namespace Gecode { namespace Set { namespace Rel { return ES_FIX; } -}}} // namespace Gecode::Set::Rel +} // namespace Gecode::Set::Rel // STATISTICS: set-prop diff --git a/gecode/set/rel/nq.hpp b/gecode/set/rel/nq.hpp index f2e95e1239..cadc4bdccd 100644 --- a/gecode/set/rel/nq.hpp +++ b/gecode/set/rel/nq.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Set { namespace Rel { +namespace Gecode::Set::Rel { template forceinline @@ -113,9 +113,8 @@ namespace Gecode { namespace Set { namespace Rel { GlbRanges yi(y); if (Iter::Ranges::equal(xi, yi)) { return ES_FAILED; - } else { - return home.ES_SUBSUMED(*this); } + return home.ES_SUBSUMED(*this); } assert(x0.lub_size() - x0.glb_size() > 0); if (x0.card_min() > y.card_max()) { @@ -161,6 +160,6 @@ namespace Gecode { namespace Set { namespace Rel { y.update(home, p.y); } -}}} // namespace Gecode::Set::Rel +} // namespace Gecode::Set::Rel // STATISTICS: set-prop diff --git a/gecode/set/rel/re-eq.hpp b/gecode/set/rel/re-eq.hpp index 45cfaaa2c7..263cbb212a 100644 --- a/gecode/set/rel/re-eq.hpp +++ b/gecode/set/rel/re-eq.hpp @@ -35,7 +35,7 @@ * */ -namespace Gecode { namespace Set { namespace Rel { +namespace Gecode::Set::Rel { template forceinline @@ -125,11 +125,10 @@ namespace Gecode { namespace Set { namespace Rel { if (rm != RM_IMP) GECODE_ME_CHECK(b.one_none(home)); return home.ES_SUBSUMED(*this); - } else { - if (rm != RM_RIMP) - GECODE_ME_CHECK(b.zero_none(home)); - return home.ES_SUBSUMED(*this); } + if (rm != RM_RIMP) + GECODE_ME_CHECK(b.zero_none(home)); + return home.ES_SUBSUMED(*this); } // check whether cardinalities still allow equality @@ -162,6 +161,6 @@ namespace Gecode { namespace Set { namespace Rel { return ES_FIX; } -}}} // namespace Gecode::Set::Rel +} // namespace Gecode::Set::Rel // STATISTICS: set-prop diff --git a/gecode/set/rel/re-lq.hpp b/gecode/set/rel/re-lq.hpp index 08b94dd673..45a6b46d90 100644 --- a/gecode/set/rel/re-lq.hpp +++ b/gecode/set/rel/re-lq.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Set { namespace Rel { +namespace Gecode::Set::Rel { template forceinline @@ -205,6 +205,6 @@ namespace Gecode { namespace Set { namespace Rel { return ES_FIX; } -}}} // namespace Gecode::Set::Rel +} // namespace Gecode::Set::Rel // STATISTICS: set-prop diff --git a/gecode/set/rel/re-subset.hpp b/gecode/set/rel/re-subset.hpp index 9a399a1e2b..986740f642 100644 --- a/gecode/set/rel/re-subset.hpp +++ b/gecode/set/rel/re-subset.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Set { namespace Rel { +namespace Gecode::Set::Rel { template forceinline @@ -135,7 +135,8 @@ namespace Gecode { namespace Set { namespace Rel { if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); return home.ES_SUBSUMED(*this); - } else if (x0.assigned() && x1.assigned()) { + } + if (x0.assigned() && x1.assigned()) { if (rm != RM_IMP) GECODE_ME_CHECK(b.one_none(home)); return home.ES_SUBSUMED(*this); @@ -156,6 +157,6 @@ namespace Gecode { namespace Set { namespace Rel { return ES_FIX; } -}}} // namespace Gecode::Set::Rel +} // namespace Gecode::Set::Rel // STATISTICS: set-prop diff --git a/gecode/set/rel/subset.hpp b/gecode/set/rel/subset.hpp index 740c706482..1d7abcd4cf 100644 --- a/gecode/set/rel/subset.hpp +++ b/gecode/set/rel/subset.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Set { namespace Rel { +namespace Gecode::Set::Rel { template forceinline @@ -86,6 +86,6 @@ namespace Gecode { namespace Set { namespace Rel { return (x0.assigned() || x1.assigned()) ? home.ES_SUBSUMED(*this) : ES_FIX; } -}}} // namespace Gecode::Set::Rel +} // namespace Gecode::Set::Rel // STATISTICS: set-prop diff --git a/gecode/set/relax.cpp b/gecode/set/relax.cpp index 1ae23c8886..4ac4e50381 100644 --- a/gecode/set/relax.cpp +++ b/gecode/set/relax.cpp @@ -33,7 +33,7 @@ #include #include -namespace Gecode { namespace Set { +namespace Gecode::Set { /// Class for posting equalities for non-relaxed variables class Relax { @@ -53,7 +53,7 @@ namespace Gecode { namespace Set { return ES_OK; } -}} // namespace Gecode::Set +} // namespace Gecode::Set namespace Gecode { diff --git a/gecode/set/sequence.hh b/gecode/set/sequence.hh index 905dc8b05d..5b61f5cc4f 100644 --- a/gecode/set/sequence.hh +++ b/gecode/set/sequence.hh @@ -41,7 +41,7 @@ #include -namespace Gecode { namespace Set { namespace Sequence { +namespace Gecode::Set::Sequence { /** * \namespace Gecode::Set::Sequence @@ -96,7 +96,7 @@ namespace Gecode { namespace Set { namespace Sequence { static ExecStatus post(Home home, ViewArray, SetView); }; -}}} // namespace Gecode::Set::Sequence +} // namespace Gecode::Set::Sequence #include #include diff --git a/gecode/set/sequence/common.hpp b/gecode/set/sequence/common.hpp index c6aedb2cad..7760dbed49 100644 --- a/gecode/set/sequence/common.hpp +++ b/gecode/set/sequence/common.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Set { namespace Sequence { +namespace Gecode::Set::Sequence { inline ExecStatus propagate_seq(Space& home, bool& modified, bool& assigned, ViewArray& x) { @@ -84,6 +84,6 @@ namespace Gecode { namespace Set { namespace Sequence { return ES_NOFIX; } -}}} // namespace Gecode::Set::Sequence +} // namespace Gecode::Set::Sequence // STATISTICS: set-prop diff --git a/gecode/set/sequence/seq-u.cpp b/gecode/set/sequence/seq-u.cpp index fa23e5c0b6..727cf91ef5 100644 --- a/gecode/set/sequence/seq-u.cpp +++ b/gecode/set/sequence/seq-u.cpp @@ -38,7 +38,7 @@ #include -namespace Gecode { namespace Set { namespace Sequence { +namespace Gecode::Set::Sequence { /* * "Sequenced union" propagator @@ -62,14 +62,14 @@ namespace Gecode { namespace Set { namespace Sequence { GECODE_ME_CHECK_MODIFIED(modified, y.include_i(home, u)); GLBndSet before(home); - for (int i = 0; i < x.size(); i++) { - LubRanges xiub(x[i]); + for (auto& xi : x) { + LubRanges xiub(xi); before.include_i(home, xiub); BndSetRanges before_r(before); GlbRanges ylb(y); Iter::Ranges::Diff, BndSetRanges> diff(ylb, before_r); if (diff()) { - GECODE_ME_CHECK_MODIFIED(modified, x[i].exclude(home, diff.min(), Limits::max)); + GECODE_ME_CHECK_MODIFIED(modified, xi.exclude(home, diff.min(), Limits::max)); } } before.dispose(home); @@ -130,6 +130,6 @@ namespace Gecode { namespace Set { namespace Sequence { return home.ES_SUBSUMED(*this); } -}}} // namespace Gecode::Set::Sequence +} // namespace Gecode::Set::Sequence // STATISTICS: set-prop diff --git a/gecode/set/sequence/seq-u.hpp b/gecode/set/sequence/seq-u.hpp index cd8133685c..eaaa54526c 100644 --- a/gecode/set/sequence/seq-u.hpp +++ b/gecode/set/sequence/seq-u.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Set { namespace Sequence { +namespace Gecode::Set::Sequence { /* * "Sequenced union" propagator @@ -69,6 +69,6 @@ namespace Gecode { namespace Set { namespace Sequence { } } -}}} // namespace Gecode::Set::Sequence +} // namespace Gecode::Set::Sequence // STATISTICS: set-prop diff --git a/gecode/set/sequence/seq.cpp b/gecode/set/sequence/seq.cpp index 43df4cb094..aaefc3a1e8 100644 --- a/gecode/set/sequence/seq.cpp +++ b/gecode/set/sequence/seq.cpp @@ -38,7 +38,7 @@ #include -namespace Gecode { namespace Set { namespace Sequence { +namespace Gecode::Set::Sequence { /* * "Sequence" propagator @@ -67,6 +67,6 @@ namespace Gecode { namespace Set { namespace Sequence { return home.ES_SUBSUMED(*this); } -}}} // namespace Gecode::Set::Sequence +} // namespace Gecode::Set::Sequence // STATISTICS: set-prop diff --git a/gecode/set/sequence/seq.hpp b/gecode/set/sequence/seq.hpp index 5ab717b175..491bb99ecd 100644 --- a/gecode/set/sequence/seq.hpp +++ b/gecode/set/sequence/seq.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Set { namespace Sequence { +namespace Gecode::Set::Sequence { /* * "Sequence" propagator @@ -59,6 +59,6 @@ namespace Gecode { namespace Set { namespace Sequence { return ES_OK; } -}}} // namespace Gecode::Set::Sequence +} // namespace Gecode::Set::Sequence // STATISTICS: set-prop diff --git a/gecode/set/trace/delta.hpp b/gecode/set/trace/delta.hpp index 68e7a76379..e18ad5f8c6 100644 --- a/gecode/set/trace/delta.hpp +++ b/gecode/set/trace/delta.hpp @@ -47,11 +47,11 @@ namespace Gecode { SetTraceDelta::SetTraceDelta(Set::SetTraceView o, Set::SetView n, const Delta&) : _glb(o.glb(), n), _lub(o.lub(), n) {} forceinline SetTraceDelta::Glb& - SetTraceDelta::glb(void) { + SetTraceDelta::glb() { return _glb; } forceinline SetTraceDelta::Lub& - SetTraceDelta::lub(void) { + SetTraceDelta::lub() { return _lub; } diff --git a/gecode/set/trace/trace-view.hpp b/gecode/set/trace/trace-view.hpp index 93ea94c4f0..1a6558136e 100644 --- a/gecode/set/trace/trace-view.hpp +++ b/gecode/set/trace/trace-view.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Set { +namespace Gecode::Set { /// Duplicate of a set view class SetTraceView { @@ -42,15 +42,15 @@ namespace Gecode { namespace Set { public: /// Default constructor (initializes with no view) - SetTraceView(void); + SetTraceView(); /// Duplicate view \a x SetTraceView(Space& home, SetView x); /// Return range list for greatest lower bound - RangeList* glb(void) const; + RangeList* glb() const; /// Return range list for least upper bound - RangeList* lub(void) const; - /// Update duplicated view from view \a y and delta \a d - void prune(Space& home, SetView y, const Delta& d); + RangeList* lub() const; + /// Update duplicated view from view \a x and delta \a d + void prune(Space& home, SetView x, const Delta& d); /// Update during cloning void update(Space& home, SetTraceView x); /// Return slack for \a x @@ -59,7 +59,7 @@ namespace Gecode { namespace Set { forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - SetTraceView::SetTraceView(void) {} + SetTraceView::SetTraceView() {} forceinline SetTraceView::SetTraceView(Space& home, SetView x) { GlbRanges glbi(x); @@ -68,11 +68,11 @@ namespace Gecode { namespace Set { RangeList::copy(home, _lub, lubi); } forceinline RangeList* - SetTraceView::glb(void) const { + SetTraceView::glb() const { return _glb; } forceinline RangeList* - SetTraceView::lub(void) const { + SetTraceView::lub() const { return _lub; } forceinline void @@ -95,6 +95,6 @@ namespace Gecode { namespace Set { return x.unknown_size(); } -}} // namespace Gecode::Set +} // namespace Gecode::Set // STATISTICS: set-trace diff --git a/gecode/set/trace/traits.hpp b/gecode/set/trace/traits.hpp index 57c227e0a6..ea4fbb96df 100644 --- a/gecode/set/trace/traits.hpp +++ b/gecode/set/trace/traits.hpp @@ -36,9 +36,9 @@ namespace Gecode { template <> class TraceTraits { public: - typedef Set::SetTraceView TraceView; - typedef SetTraceDelta TraceDelta; - typedef unsigned long long int SlackValue; + using TraceView = Set::SetTraceView; + using TraceDelta = SetTraceDelta; + using SlackValue = unsigned long long int; }; } // namespace Gecode diff --git a/gecode/set/var-imp.hpp b/gecode/set/var-imp.hpp index 918c41bbe9..1c48f81c50 100644 --- a/gecode/set/var-imp.hpp +++ b/gecode/set/var-imp.hpp @@ -38,7 +38,7 @@ #include -namespace Gecode { namespace Set { +namespace Gecode::Set { class SetVarImp; class LUBndSet; @@ -60,28 +60,28 @@ namespace Gecode { namespace Set { int _lub_max; ///< Largest lub value just pruned public: /// Create set delta as providing no information (if \a any is true) - SetDelta(void); + SetDelta(); /// Create set delta with \a min and \a max SetDelta(int glb_min, int glb_max, int lub_min, int lub_max); /// Return glb minimum - int glb_min(void) const; + int glb_min() const; /// Return glb maximum - int glb_max(void) const; + int glb_max() const; /// Return lub minimum - int lub_min(void) const; + int lub_min() const; /// Return lub maximum - int lub_max(void) const; + int lub_max() const; /// Test whether delta represents any domain change in glb - bool glb_any(void) const; + bool glb_any() const; /// Test whether delta represents any domain change in lub - bool lub_any(void) const; + bool lub_any() const; }; -}} // namespace Gecode::Set +} // namespace Gecode::Set #include -namespace Gecode { namespace Set { +namespace Gecode::Set { /** * \brief Sets of integers @@ -96,15 +96,15 @@ namespace Gecode { namespace Set { unsigned int _size; /// The cardinality this set represents unsigned int _card; - /// Set first range to \a r - void fst(RangeList* r); - /// Set last range to \a r - void lst(RangeList* r); + /// Set first range to \a f + void fst(RangeList* f); + /// Set last range to \a l + void lst(RangeList* l); /// Return first range - RangeList* fst(void) const; + RangeList* fst() const; /// Return last range - RangeList* lst(void) const; + RangeList* lst() const; public: /// Returned by empty sets when asked for their maximum element @@ -115,9 +115,9 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor. Creates an empty set. - BndSet(void); + BndSet(); /// Initialize as the set \f$ \{i,\dots,j\}\f$ - BndSet(Space& home, int i, int j); + BndSet(Space& home, int mn, int mx); /// Initialize as the set represented by \a s GECODE_SET_EXPORT BndSet(Space& home, const IntSet& s); //@} @@ -131,15 +131,15 @@ namespace Gecode { namespace Set { /// \name Value access //@{ /// Return smallest element - int min(void) const; + int min() const; /// Return greatest element - int max(void) const; + int max() const; /// Return \a n -th smallest element int min_n(unsigned int n) const; /// Return size - unsigned int size(void) const; + unsigned int size() const; /// Return cardinality - unsigned int card(void) const; + unsigned int card() const; /// Set cardinality void card(unsigned int c); //@} @@ -147,21 +147,21 @@ namespace Gecode { namespace Set { /// \name Tests //@{ /// Test whether this set is empty - bool empty(void) const; + bool empty() const; /// Test whether \a i is an element of this set bool in(int i) const; //@} /// \name Update operations //@{ - /// Make this set equal to \a s - void become(Space& home, const BndSet& s); + /// Make this set equal to \a that + void become(Space& home, const BndSet& that); //@} /// \name Range list access for iteration //@{ /// Return range list for iteration - RangeList* ranges(void) const; + RangeList* ranges() const; //@} protected: @@ -172,12 +172,12 @@ namespace Gecode { namespace Set { public: /// \name Cloning //@{ - /// Update this set to be a clone of set \a x - void update(Space& home, BndSet& x); + /// Update this set to be a clone of set \a d + void update(Space& home, BndSet& d); //@} /// Check whether internal invariants hold - GECODE_SET_EXPORT bool is_consistent(void) const; + GECODE_SET_EXPORT bool is_consistent() const; }; /** @@ -189,7 +189,7 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - BndSetRanges(void) = default; + BndSetRanges() = default; /// Initialize with BndSet \a s BndSetRanges(const BndSet& s); /// Initialize with BndSet \a s @@ -213,11 +213,11 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor. Creates an empty set. - GLBndSet(void) = default; + GLBndSet() = default; /// Default constructor. Creates an empty set. GLBndSet(Space&); /// Initialize as the set \f$ \{i,\dots,j\}\f$ - GLBndSet(Space& home, int i, int j); + GLBndSet(Space& home, int i, int ma); /// Initialize as the set represented by \a s GLBndSet(Space& home, const IntSet& s); /// Initialize as the empty set @@ -227,12 +227,12 @@ namespace Gecode { namespace Set { /// \name Update operations //@{ /// Include the set \f$\{i,\dots,j\}\f$ in this set - bool include(Space& home, int i, int j, SetDelta& d); + bool include(Space& home, int i, int ma, SetDelta& d); /// Include the set represented by \a i in this set template bool include_i(Space& home, I& i); //@} - public: + GLBndSet(const GLBndSet&) = delete; const GLBndSet& operator=(const GLBndSet&) = delete; }; @@ -253,11 +253,11 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor. Creates an empty set. - LUBndSet(void) = default; + LUBndSet() = default; /// Initialize as the full set including everything between Limits::min and Limits::max LUBndSet(Space& home); /// Initialize as the set \f$ \{i,\dots,j\}\f$ - LUBndSet(Space& home, int i, int j); + LUBndSet(Space& home, int i, int ma); /// Initialize as the set represented by \a s LUBndSet(Space& home, const IntSet& s); /// Initialize as the full set including everything between Limits::min and Limits::max @@ -267,9 +267,9 @@ namespace Gecode { namespace Set { /// \name Update operations //@{ /// Exclude the set \f$\{i,\dots,j\}\f$ from this set - bool exclude(Space& home, int i, int j, SetDelta& d); + bool exclude(Space& home, int i, int ma, SetDelta& d); /// Intersect this set with the set \f$\{i,\dots,j\}\f$ - bool intersect(Space& home, int i, int j); + bool intersect(Space& home, int i, int ma); /// Exclude all elements not in the set represented by \a i from this set template bool intersect_i(Space& home, I& i); @@ -279,7 +279,7 @@ namespace Gecode { namespace Set { /// Exclude all elements from this set void exclude_all(Space& home); //@} - public: + LUBndSet(const LUBndSet&) = delete; const LUBndSet& operator=(const LUBndSet&) = delete; }; @@ -300,7 +300,7 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - RangesCompl(void) = default; + RangesCompl() = default; /// Initialize with iterator \a i RangesCompl(I& i); /// Initialize with iterator \a i @@ -325,7 +325,7 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - LubRanges(void); + LubRanges(); /// Initialize with least upper bound ranges for set variable \a x LubRanges(const T& x); /// Initialize with least upper bound ranges for set variable \a x @@ -335,19 +335,19 @@ namespace Gecode { namespace Set { /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of range (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; @@ -368,7 +368,7 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - GlbRanges(void); + GlbRanges(); /// Initialize with greatest lower bound ranges for set variable \a x GlbRanges(const T& x); /// Initialize with greatest lower bound ranges for set variable \a x @@ -378,19 +378,19 @@ namespace Gecode { namespace Set { /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of range (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; @@ -415,20 +415,20 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - UnknownRanges(void) = default; - /// Initialize with unknown set ranges for set variable \a x - UnknownRanges(const T& x); - /// Initialize with unknown set ranges for set variable \a x - void init(const T& x); + UnknownRanges() = default; + /// Initialize with unknown set ranges for set variable \a v + UnknownRanges(const T& v); + /// Initialize with unknown set ranges for set variable \a v + void init(const T& v); //@} }; -}} // namespace Gecode::Set +} // namespace Gecode::Set #include #include -namespace Gecode { namespace Set { +namespace Gecode::Set { /** * \brief Finite integer set variable implementation @@ -472,7 +472,7 @@ namespace Gecode { namespace Set { * \f$\mathit{lub}(s)=\{\mathit{lub_min},\dots,\mathit{lub_max}\}\f$, and * \f$\mathit{card_min}\leq |s|\leq\mathit{card_max}\f$ */ - SetVarImp(Space& home, const IntSet& glb_d, int lub_min, int lub_max, unsigned int card_min, + SetVarImp(Space& home, const IntSet& the_glb, int lub_min, int lub_max, unsigned int card_min, unsigned int card_max); /** * \brief Initialize with given bounds and cardinality @@ -482,7 +482,7 @@ namespace Gecode { namespace Set { * \f$\mathit{lub}(s)=\mathit{lubD}\f$, and * \f$\mathit{card_min}\leq |s|\leq\mathit{card_max}\f$ */ - SetVarImp(Space& home, int glb_min, int glb_max, const IntSet& lub_d, unsigned int card_min, + SetVarImp(Space& home, int glb_min, int glb_max, const IntSet& the_lub, unsigned int card_min, unsigned int card_max); /** * \brief Initialize with given bounds and cardinality @@ -492,37 +492,38 @@ namespace Gecode { namespace Set { * \f$\mathit{lub}(s)=\mathit{lubD}\f$, and * \f$\mathit{card_min}\leq |s|\leq\mathit{card_max}\f$ */ - SetVarImp(Space& home, const IntSet& glb_d, const IntSet& lub_d, unsigned int card_min, unsigned int card_max); + SetVarImp(Space& home, const IntSet& the_glb, const IntSet& the_lub, unsigned int card_min, + unsigned int card_max); //@} /// \name Value access //@{ /// Return current cardinality minimum - unsigned int card_min(void) const; + unsigned int card_min() const; /// Return current cardinality maximum - unsigned int card_max(void) const; + unsigned int card_max() const; /// Return minimum of the least upper bound - int lub_min(void) const; + int lub_min() const; /// Return maximum of the least upper bound - int lub_max(void) const; + int lub_max() const; /// Return \a n -th smallest element in the least upper bound int lub_min_n(unsigned int n) const; /// Return minimum of the greatest lower bound - int glb_min(void) const; + int glb_min() const; /// Return maximum of the greatest lower bound - int glb_max(void) const; + int glb_max() const; /// Return the size of the greatest lower bound - unsigned int glb_size(void) const; + unsigned int glb_size() const; /// Return the size of the least upper bound - unsigned int lub_size(void) const; + unsigned int lub_size() const; //@} /// \name Domain tests //@{ /// Test whether variable is assigned - bool assigned(void) const; - /// Test whether \a n is contained in greatest lower bound - bool known_in(int n) const; + bool assigned() const; + /// Test whether \a i is contained in greatest lower bound + bool known_in(int i) const; /// Test whether \a n is not contained in least upper bound bool known_out(int) const; //@} @@ -555,16 +556,16 @@ namespace Gecode { namespace Set { public: /// \name Domain update by value //@{ - /// Include \a n in the greatest lower bound - ModEvent include(Space& home, int n); + /// Include \a i in the greatest lower bound + ModEvent include(Space& home, int i); /// Include the range \f$\{i,\dots,j\}\f$ in the greatest lower bound ModEvent include(Space& home, int i, int j); - /// Exclude \a n from the least upper bound - ModEvent exclude(Space& home, int n); + /// Exclude \a i from the least upper bound + ModEvent exclude(Space& home, int i); /// Exclude the range \f$\{i,\dots,j\}\f$ from the least upper bound ModEvent exclude(Space& home, int i, int j); - /// Exclude everything but \a n from the least upper bound - ModEvent intersect(Space& home, int n); + /// Exclude everything but \a i from the least upper bound + ModEvent intersect(Space& home, int i); /// Exclude everything but the range \f$\{i,\dots,j\}\f$ from the least upper bound ModEvent intersect(Space& home, int i, int j); /// Restrict cardinality to be at least n @@ -586,7 +587,6 @@ namespace Gecode { namespace Set { ModEvent intersect_i(Space& home, I& i); //@} - public: /// \name Dependencies //@{ /** @@ -640,7 +640,7 @@ namespace Gecode { namespace Set { class SetView; -}} // namespace Gecode::Set +} // namespace Gecode::Set #include diff --git a/gecode/set/var-imp/delta.hpp b/gecode/set/var-imp/delta.hpp index a97c967c07..aca4de15bf 100644 --- a/gecode/set/var-imp/delta.hpp +++ b/gecode/set/var-imp/delta.hpp @@ -32,10 +32,10 @@ * */ -namespace Gecode { namespace Set { +namespace Gecode::Set { forceinline - SetDelta::SetDelta(void) + SetDelta::SetDelta() : _glb_min(1), _glb_max(0), _lub_min(1), _lub_max(0) {} forceinline @@ -43,30 +43,30 @@ namespace Gecode { namespace Set { : _glb_min(glb_min), _glb_max(glb_max), _lub_min(lub_min), _lub_max(lub_max) {} forceinline int - SetDelta::glb_min(void) const { + SetDelta::glb_min() const { return _glb_min; } forceinline int - SetDelta::glb_max(void) const { + SetDelta::glb_max() const { return _glb_max; } forceinline int - SetDelta::lub_min(void) const { + SetDelta::lub_min() const { return _lub_min; } forceinline int - SetDelta::lub_max(void) const { + SetDelta::lub_max() const { return _lub_max; } forceinline bool - SetDelta::glb_any(void) const { + SetDelta::glb_any() const { return _glb_min > _glb_max; } forceinline bool - SetDelta::lub_any(void) const { + SetDelta::lub_any() const { return _lub_min > _lub_max; } -}} // namespace Gecode::Set +} // namespace Gecode::Set // STATISTICS: set-var diff --git a/gecode/set/var-imp/integerset.cpp b/gecode/set/var-imp/integerset.cpp index 4abb2ead98..e0b3364526 100644 --- a/gecode/set/var-imp/integerset.cpp +++ b/gecode/set/var-imp/integerset.cpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Set { +namespace Gecode::Set { BndSet::BndSet(Space& home, const IntSet& is) { if (is.ranges() == 0) { @@ -193,7 +193,6 @@ namespace Gecode { namespace Set { newlst = c; RangeList* nc = c->next(); c->next(nullptr); - p = c; c = nc; } else if (p != nullptr) { p->next(nullptr); @@ -270,7 +269,6 @@ namespace Gecode { namespace Set { } RangeList* nc = cend->next(); // performs loop step! c->dispose(home, cend); - p = cend; c = nc; if (c != nullptr && c->min() <= ma) { // start of range clipped, end remains @@ -293,14 +291,14 @@ namespace Gecode { namespace Set { #endif bool - BndSet::is_consistent(void) const { + BndSet::is_consistent() const { #ifndef NDEBUG if (fst() == nullptr) { - if (lst() != nullptr || size() != 0) { + if (lst() != nullptr || !empty()) { std::cerr << "Strange empty set.\n"; return false; - } else - return true; + } + return true; } if (fst() != nullptr && lst() == nullptr) { @@ -344,6 +342,6 @@ namespace Gecode { namespace Set { return true; } -}} // namespace Gecode::Set +} // namespace Gecode::Set // STATISTICS: set-var diff --git a/gecode/set/var-imp/integerset.hpp b/gecode/set/var-imp/integerset.hpp index dc56ccc57a..ae2388a0ea 100644 --- a/gecode/set/var-imp/integerset.hpp +++ b/gecode/set/var-imp/integerset.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Set { +namespace Gecode::Set { /* * BndSet @@ -42,16 +42,16 @@ namespace Gecode { namespace Set { */ forceinline - BndSet::BndSet(void) + BndSet::BndSet() : first(nullptr), last(nullptr), _size(0), _card(0) {} forceinline RangeList* - BndSet::fst(void) const { + BndSet::fst() const { return first; } forceinline RangeList* - BndSet::lst(void) const { + BndSet::lst() const { return last; } @@ -86,34 +86,32 @@ namespace Gecode { namespace Set { } forceinline RangeList* - BndSet::ranges(void) const { + BndSet::ranges() const { return fst(); } forceinline unsigned int - BndSet::size(void) const { + BndSet::size() const { return _size; } forceinline bool - BndSet::empty(void) const { + BndSet::empty() const { return (_size == 0); } forceinline int - BndSet::min(void) const { + BndSet::min() const { if (fst() == nullptr) return MIN_OF_EMPTY; - else - return fst()->min(); + return fst()->min(); } forceinline int - BndSet::max(void) const { + BndSet::max() const { if (lst() == nullptr) return MAX_OF_EMPTY; - else - return lst()->max(); + return lst()->max(); } // nth smallest element @@ -128,7 +126,7 @@ namespace Gecode { namespace Set { } forceinline unsigned int - BndSet::card(void) const { + BndSet::card() const { return _card; } @@ -424,6 +422,6 @@ namespace Gecode { namespace Set { Iter::Ranges::Compl::init(i); } -}} // namespace Gecode::Set +} // namespace Gecode::Set // STATISTICS: set-var diff --git a/gecode/set/var-imp/iter.hpp b/gecode/set/var-imp/iter.hpp index ac9ebc2db0..9a6d8bf72f 100644 --- a/gecode/set/var-imp/iter.hpp +++ b/gecode/set/var-imp/iter.hpp @@ -32,7 +32,7 @@ * */ -namespace Gecode { namespace Set { +namespace Gecode::Set { template forceinline @@ -49,6 +49,6 @@ namespace Gecode { namespace Set { Iter::Ranges::Diff, GlbRanges>::init(i1, i2); } -}} // namespace Gecode::Set +} // namespace Gecode::Set // STATISTICS: set-var diff --git a/gecode/set/var-imp/set.cpp b/gecode/set/var-imp/set.cpp index 2ab06f2d68..1bf1e8fbf6 100644 --- a/gecode/set/var-imp/set.cpp +++ b/gecode/set/var-imp/set.cpp @@ -34,7 +34,7 @@ #include -namespace Gecode { namespace Set { +namespace Gecode::Set { /* * "Standard" tell operations @@ -146,6 +146,6 @@ namespace Gecode { namespace Set { SetVarImpBase::reschedule(home, p, pc, assigned()); } -}} // namespace Gecode::Set +} // namespace Gecode::Set // STATISTICS: set-var diff --git a/gecode/set/var-imp/set.hpp b/gecode/set/var-imp/set.hpp index aa3fd6c11d..1f84fe7b04 100644 --- a/gecode/set/var-imp/set.hpp +++ b/gecode/set/var-imp/set.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Set { +namespace Gecode::Set { /* * Creation of new variable implementations @@ -83,17 +83,17 @@ namespace Gecode { namespace Set { } forceinline bool - SetVarImp::assigned(void) const { + SetVarImp::assigned() const { return glb.size() == lub.size(); } forceinline unsigned int - SetVarImp::card_min(void) const { + SetVarImp::card_min() const { return glb.card(); } forceinline unsigned int - SetVarImp::card_max(void) const { + SetVarImp::card_max() const { return lub.card(); } @@ -108,12 +108,12 @@ namespace Gecode { namespace Set { } forceinline int - SetVarImp::lub_min(void) const { + SetVarImp::lub_min() const { return lub.min(); } forceinline int - SetVarImp::lub_max(void) const { + SetVarImp::lub_max() const { return lub.max(); } @@ -123,12 +123,12 @@ namespace Gecode { namespace Set { } forceinline int - SetVarImp::glb_min(void) const { + SetVarImp::glb_min() const { return glb.min(); } forceinline int - SetVarImp::glb_max(void) const { + SetVarImp::glb_max() const { return glb.max(); } @@ -244,8 +244,7 @@ namespace Gecode { namespace Set { ++iterator; if (iterator()) return intersect_i_full(home, mi, ma, iterator); - else - return intersect(home, mi, ma); + return intersect(home, mi, ma); } template @@ -318,8 +317,7 @@ namespace Gecode { namespace Set { ++iterator; if (iterator()) return include_i_full(home, mi, ma, iterator); - else - return include(home, mi, ma); + return include(home, mi, ma); } template @@ -391,8 +389,7 @@ namespace Gecode { namespace Set { ++iterator; if (iterator()) return exclude_i_full(home, mi, ma, iterator); - else - return exclude(home, mi, ma); + return exclude(home, mi, ma); } template @@ -458,7 +455,7 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - LubRanges(void) = default; + LubRanges() = default; /// Initialize with ranges for variable implementation \a x LubRanges(const SetVarImp*); /// Initialize with ranges for variable implementation \a x @@ -489,7 +486,7 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - GlbRanges(void) = default; + GlbRanges() = default; /// Initialize with ranges for variable implementation \a x GlbRanges(const SetVarImp* x); /// Initialize with ranges for variable implementation \a x @@ -506,6 +503,6 @@ namespace Gecode { namespace Set { BndSetRanges::init(x->glb); } -}} // namespace Gecode::Set +} // namespace Gecode::Set // STATISTICS: set-var diff --git a/gecode/set/var/set.hpp b/gecode/set/var/set.hpp index a1aaa31b20..e82ff77ed6 100644 --- a/gecode/set/var/set.hpp +++ b/gecode/set/var/set.hpp @@ -51,17 +51,17 @@ namespace Gecode { */ forceinline unsigned int - SetVar::glb_size(void) const { + SetVar::glb_size() const { return x->glb_size(); } forceinline unsigned int - SetVar::lub_size(void) const { + SetVar::lub_size() const { return x->lub_size(); } forceinline unsigned int - SetVar::unknown_size(void) const { + SetVar::unknown_size() const { return x->lub_size() - x->glb_size(); } @@ -76,32 +76,32 @@ namespace Gecode { } forceinline unsigned int - SetVar::card_min(void) const { + SetVar::card_min() const { return x->card_min(); } forceinline unsigned int - SetVar::card_max(void) const { + SetVar::card_max() const { return x->card_max(); } forceinline int - SetVar::lub_min(void) const { + SetVar::lub_min() const { return x->lub_min(); } forceinline int - SetVar::lub_max(void) const { + SetVar::lub_max() const { return x->lub_max(); } forceinline int - SetVar::glb_min(void) const { + SetVar::glb_min() const { return x->glb_min(); } forceinline int - SetVar::glb_max(void) const { + SetVar::glb_max() const { return x->glb_max(); } @@ -115,27 +115,27 @@ namespace Gecode { : iter(s.varimp()) {} forceinline bool - SetVarGlbRanges::operator()(void) const { + SetVarGlbRanges::operator()() const { return iter(); } forceinline void - SetVarGlbRanges::operator++(void) { + SetVarGlbRanges::operator++() { ++iter; } forceinline int - SetVarGlbRanges::min(void) const { + SetVarGlbRanges::min() const { return iter.min(); } forceinline int - SetVarGlbRanges::max(void) const { + SetVarGlbRanges::max() const { return iter.max(); } forceinline unsigned int - SetVarGlbRanges::width(void) const { + SetVarGlbRanges::width() const { return iter.width(); } @@ -144,27 +144,27 @@ namespace Gecode { : iter(s.varimp()) {} forceinline bool - SetVarLubRanges::operator()(void) const { + SetVarLubRanges::operator()() const { return iter(); } forceinline void - SetVarLubRanges::operator++(void) { + SetVarLubRanges::operator++() { ++iter; } forceinline int - SetVarLubRanges::min(void) const { + SetVarLubRanges::min() const { return iter.min(); } forceinline int - SetVarLubRanges::max(void) const { + SetVarLubRanges::max() const { return iter.max(); } forceinline unsigned int - SetVarLubRanges::width(void) const { + SetVarLubRanges::width() const { return iter.width(); } @@ -174,31 +174,31 @@ namespace Gecode { } forceinline bool - SetVarUnknownRanges::operator()(void) const { + SetVarUnknownRanges::operator()() const { return iter(); } forceinline void - SetVarUnknownRanges::operator++(void) { + SetVarUnknownRanges::operator++() { ++iter; } forceinline int - SetVarUnknownRanges::min(void) const { + SetVarUnknownRanges::min() const { return iter.min(); } forceinline int - SetVarUnknownRanges::max(void) const { + SetVarUnknownRanges::max() const { return iter.max(); } forceinline unsigned int - SetVarUnknownRanges::width(void) const { + SetVarUnknownRanges::width() const { return iter.width(); } - forceinline SetVarGlbValues::SetVarGlbValues(void) = default; + forceinline SetVarGlbValues::SetVarGlbValues() = default; forceinline SetVarGlbValues::SetVarGlbValues(const SetVar& x) { @@ -207,21 +207,21 @@ namespace Gecode { } forceinline bool - SetVarGlbValues::operator()(void) const { + SetVarGlbValues::operator()() const { return iter(); } forceinline void - SetVarGlbValues::operator++(void) { + SetVarGlbValues::operator++() { ++iter; } forceinline int - SetVarGlbValues::val(void) const { + SetVarGlbValues::val() const { return iter.val(); } - forceinline SetVarLubValues::SetVarLubValues(void) = default; + forceinline SetVarLubValues::SetVarLubValues() = default; forceinline SetVarLubValues::SetVarLubValues(const SetVar& x) { @@ -230,21 +230,21 @@ namespace Gecode { } forceinline bool - SetVarLubValues::operator()(void) const { + SetVarLubValues::operator()() const { return iter(); } forceinline void - SetVarLubValues::operator++(void) { + SetVarLubValues::operator++() { ++iter; } forceinline int - SetVarLubValues::val(void) const { + SetVarLubValues::val() const { return iter.val(); } - forceinline SetVarUnknownValues::SetVarUnknownValues(void) = default; + forceinline SetVarUnknownValues::SetVarUnknownValues() = default; forceinline SetVarUnknownValues::SetVarUnknownValues(const SetVar& x) { @@ -253,17 +253,17 @@ namespace Gecode { } forceinline bool - SetVarUnknownValues::operator()(void) const { + SetVarUnknownValues::operator()() const { return iter(); } forceinline void - SetVarUnknownValues::operator++(void) { + SetVarUnknownValues::operator++() { ++iter; } forceinline int - SetVarUnknownValues::val(void) const { + SetVarUnknownValues::val() const { return iter.val(); } diff --git a/gecode/set/view.hpp b/gecode/set/view.hpp index be05b833fa..63e81b8a4c 100644 --- a/gecode/set/view.hpp +++ b/gecode/set/view.hpp @@ -36,7 +36,7 @@ #include -namespace Gecode { namespace Set { +namespace Gecode::Set { /** * \defgroup TaskActorSetView Set views @@ -60,7 +60,7 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - SetView(void) = default; + SetView() = default; /// Initialize from set variable \a y SetView(const SetVar& y); /// Initialize from set variable implementation \a y @@ -71,26 +71,26 @@ namespace Gecode { namespace Set { //@{ /// Return minimum cardinality - unsigned int card_min(void) const; + unsigned int card_min() const; /// Return maximum cardinality - unsigned int card_max(void) const; + unsigned int card_max() const; /// Return minimum of the least upper bound - int lub_min(void) const; + int lub_min() const; /// Return maximum of the least upper bound - int lub_max(void) const; + int lub_max() const; /// Return n-th smallest element of the least upper bound int lub_min_n(unsigned int n) const; /// Return minimum of the greatest lower bound - int glb_min(void) const; + int glb_min() const; /// Return maximum of the greatest lower bound - int glb_max(void) const; + int glb_max() const; /// Return the number of elements in the greatest lower bound - unsigned int glb_size(void) const; + unsigned int glb_size() const; /// Return the number of elements in the least upper bound - unsigned int lub_size(void) const; + unsigned int lub_size() const; /// Return the number of unknown elements - unsigned int unknown_size(void) const; + unsigned int unknown_size() const; //@} /// \name Domain tests @@ -109,25 +109,25 @@ namespace Gecode { namespace Set { ModEvent card_max(Space& home, unsigned int m); /** * \brief Update greatest lower bound to include all elements - * between and including \a i and \a j + * between and including \a from and \a to */ - ModEvent include(Space& home, int i, int j); + ModEvent include(Space& home, int from, int to); /** * \brief Restrict least upper bound to not contain all elements - * between and including \a i and \a j + * between and including \a from and \a to */ - ModEvent exclude(Space& home, int i, int j); - /// Update greatest lower bound to contain \a i - ModEvent include(Space& home, int i); - /// Restrict least upper bound to not contain \a i - ModEvent exclude(Space& home, int i); + ModEvent exclude(Space& home, int from, int to); + /// Update greatest lower bound to contain \a n + ModEvent include(Space& home, int n); + /// Restrict least upper bound to not contain \a n + ModEvent exclude(Space& home, int n); /** * \brief Update least upper bound to contain at most all elements - * between and including \a i and \a j + * between and including \a from and \a to */ - ModEvent intersect(Space& home, int i, int j); - /// Update least upper bound to contain at most the element \a i - ModEvent intersect(Space& home, int i); + ModEvent intersect(Space& home, int from, int to); + /// Update least upper bound to contain at most the element \a n + ModEvent intersect(Space& home, int n); //@} /// \name Domain update by range iterator @@ -195,34 +195,34 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - ConstSetView(void); - /// Construct with \a s as the domain - ConstSetView(Space& home, const IntSet& s); + ConstSetView(); + /// Construct with \a dom as the domain + ConstSetView(Space& home, const IntSet& dom); //@} /// \name Value access //@{ /// Return minimum cardinality - unsigned int card_min(void) const; + unsigned int card_min() const; /// Return maximum cardinality - unsigned int card_max(void) const; + unsigned int card_max() const; /// Return minimum of the least upper bound - int lub_min(void) const; + int lub_min() const; /// Return maximum of the least upper bound - int lub_max(void) const; + int lub_max() const; /// Return n-th smallest element of the least upper bound int lub_min_n(unsigned int n) const; /// Return minimum of the greatest lower bound - int glb_min(void) const; + int glb_min() const; /// Return maximum of the greatest lower bound - int glb_max(void) const; + int glb_max() const; /// Return the number of elements in the greatest lower bound - unsigned int glb_size(void) const; + unsigned int glb_size() const; /// Return the number of elements in the least upper bound - unsigned int lub_size(void) const; + unsigned int lub_size() const; /// Return the number of unknown elements - unsigned int unknown_size(void) const; + unsigned int unknown_size() const; //@} /// \name Domain tests @@ -235,10 +235,10 @@ namespace Gecode { namespace Set { /// \name Domain update by value //@{ - /// Restrict cardinality to be greater than or equal to \a m - ModEvent card_min(Space& home, unsigned int m); - /// Restrict cardinality to be less than or equal to \a m - ModEvent card_max(Space& home, unsigned int m); + /// Restrict cardinality to be greater than or equal to \a c + ModEvent card_min(Space& home, unsigned int c); + /// Restrict cardinality to be less than or equal to \a c + ModEvent card_max(Space& home, unsigned int c); /** * \brief Update greatest lower bound to include all elements * between and including \a i and \a j @@ -249,17 +249,17 @@ namespace Gecode { namespace Set { * between and including \a i and \a j */ ModEvent exclude(Space& home, int i, int j); - /// Update greatest lower bound to contain \a i - ModEvent include(Space& home, int i); - /// Restrict least upper bound to not contain \a i - ModEvent exclude(Space& home, int i); + /// Update greatest lower bound to contain \a c + ModEvent include(Space& home, int c); + /// Restrict least upper bound to not contain \a c + ModEvent exclude(Space& home, int c); /** * \brief Update least upper bound to contain at most all elements * between and including \a i and \a j */ ModEvent intersect(Space& home, int i, int j); - /// Update least upper bound to contain at most the element \a i - ModEvent intersect(Space& home, int i); + /// Update least upper bound to contain at most the element \a c + ModEvent intersect(Space& home, int c); //@} /// \name Domain update by range iterator @@ -278,8 +278,8 @@ namespace Gecode { namespace Set { /// \name Cloning //@{ - /// Update this view to be a clone of view \a y - void update(Space& home, ConstSetView& y); + /// Update this view to be a clone of view \a p + void update(Space& home, ConstSetView& p); //@} /// \name Delta information for advisors @@ -332,32 +332,32 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - EmptyView(void) = default; + EmptyView() = default; //@} /// \name Value access //@{ /// Return minimum cardinality - unsigned int card_min(void) const; + unsigned int card_min() const; /// Return maximum cardinality - unsigned int card_max(void) const; + unsigned int card_max() const; /// Return minimum of the least upper bound - int lub_min(void) const; + int lub_min() const; /// Return maximum of the least upper bound - int lub_max(void) const; + int lub_max() const; /// Return n-th smallest element of the least upper bound int lub_min_n(unsigned int n) const; /// Return minimum of the greatest lower bound - int glb_min(void) const; + int glb_min() const; /// Return maximum of the greatest lower bound - int glb_max(void) const; + int glb_max() const; /// Return the number of elements in the greatest lower bound - unsigned int glb_size(void) const; + unsigned int glb_size() const; /// Return the number of elements in the least upper bound - unsigned int lub_size(void) const; + unsigned int lub_size() const; /// Return the number of unknown elements - unsigned int unknown_size(void) const; + unsigned int unknown_size() const; //@} /// \name Domain tests @@ -370,8 +370,8 @@ namespace Gecode { namespace Set { /// \name Domain update by value //@{ - /// Restrict cardinality to be greater than or equal to \a m - ModEvent card_min(Space& home, unsigned int m); + /// Restrict cardinality to be greater than or equal to \a c + ModEvent card_min(Space& home, unsigned int c); /// Restrict cardinality to be less than or equal to \a m ModEvent card_max(Space& home, unsigned int m); /** @@ -455,33 +455,33 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - UniverseView(void) = default; + UniverseView() = default; //@} /// \name Value access //@{ /// Return minimum cardinality - unsigned int card_min(void) const; + unsigned int card_min() const; /// Return maximum cardinality - unsigned int card_max(void) const; + unsigned int card_max() const; /// Return minimum of the least upper bound - int lub_min(void) const; + int lub_min() const; /// Return maximum of the least upper bound - int lub_max(void) const; + int lub_max() const; /// Return n-th smallest element of the least upper bound int lub_min_n(unsigned int n) const; /// Return minimum of the greatest lower bound - int glb_min(void) const; + int glb_min() const; /// Return maximum of the greatest lower bound - int glb_max(void) const; + int glb_max() const; /// Return the number of elements in the greatest lower bound - unsigned int glb_size(void) const; + unsigned int glb_size() const; /// Return the number of elements in the least upper bound - unsigned int lub_size(void) const; + unsigned int lub_size() const; /// Return the number of unknown elements - unsigned int unknown_size(void) const; + unsigned int unknown_size() const; //@} /// \name Domain tests @@ -494,10 +494,10 @@ namespace Gecode { namespace Set { /// \name Domain update by value //@{ - /// Restrict cardinality to be greater than or equal to \a m - ModEvent card_min(Space& home, unsigned int m); - /// Restrict cardinality to be less than or equal to \a m - ModEvent card_max(Space& home, unsigned int m); + /// Restrict cardinality to be greater than or equal to \a c + ModEvent card_min(Space& home, unsigned int c); + /// Restrict cardinality to be less than or equal to \a c + ModEvent card_max(Space& home, unsigned int c); /** * \brief Update greatest lower bound to include all elements * between and including \a i and \a j @@ -589,7 +589,7 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - SingletonView(void) = default; + SingletonView() = default; /// Initialize with integer view \a y SingletonView(Gecode::Int::IntView& y); /// Initialize with integer variable \a y @@ -600,63 +600,63 @@ namespace Gecode { namespace Set { //@{ /// Return minimum cardinality - unsigned int card_min(void) const; + unsigned int card_min() const; /// Return maximum cardinality - unsigned int card_max(void) const; + unsigned int card_max() const; /// Return minimum of the least upper bound - int lub_min(void) const; + int lub_min() const; /// Return maximum of the least upper bound - int lub_max(void) const; + int lub_max() const; /// Return n-th smallest element of the least upper bound int lub_min_n(unsigned int n) const; /// Return minimum of the greatest lower bound - int glb_min(void) const; + int glb_min() const; /// Return maximum of the greatest lower bound - int glb_max(void) const; + int glb_max() const; /// Return the number of elements in the greatest lower bound - unsigned int glb_size(void) const; + unsigned int glb_size() const; /// Return the number of elements in the least upper bound - unsigned int lub_size(void) const; + unsigned int lub_size() const; /// Return the number of unknown elements - unsigned int unknown_size(void) const; + unsigned int unknown_size() const; //@} /// \name Domain tests //@{ - /// Test whether \a i is in the greatest lower bound - bool contains(int i) const; - /// Test whether \a i is not in the least upper bound - bool not_contains(int i) const; + /// Test whether \a n is in the greatest lower bound + bool contains(int n) const; + /// Test whether \a n is not in the least upper bound + bool not_contains(int n) const; //@} /// \name Domain update by value //@{ - /// Restrict cardinality to be greater than or equal to \a m - ModEvent card_min(Space& home, unsigned int m); - /// Restrict cardinality to be less than or equal to \a m - ModEvent card_max(Space& home, unsigned int m); + /// Restrict cardinality to be greater than or equal to \a c + ModEvent card_min(Space& home, unsigned int c); + /// Restrict cardinality to be less than or equal to \a c + ModEvent card_max(Space& home, unsigned int c); /** * \brief Update greatest lower bound to include all elements - * between and including \a i and \a j + * between and including \a k and \a k */ - ModEvent include(Space& home, int i, int j); + ModEvent include(Space& home, int j, int k); /** * \brief Restrict least upper bound to not contain all elements - * between and including \a i and \a j + * between and including \a k and \a k */ - ModEvent exclude(Space& home, int i, int j); - /// Update greatest lower bound to contain \a i - ModEvent include(Space& home, int i); - /// Restrict least upper bound to not contain \a i - ModEvent exclude(Space& home, int i); + ModEvent exclude(Space& home, int j, int k); + /// Update greatest lower bound to contain \a c + ModEvent include(Space& home, int c); + /// Restrict least upper bound to not contain \a c + ModEvent exclude(Space& home, int c); /** * \brief Update least upper bound to contain at most all elements * between and including \a i and \a j */ ModEvent intersect(Space& home, int i, int j); - /// Update least upper bound to contain at most the element \a i - ModEvent intersect(Space& home, int i); + /// Update least upper bound to contain at most the element \a c + ModEvent intersect(Space& home, int c); //@} /// \name Domain update by range iterator @@ -759,7 +759,7 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - ComplementView(void) = default; + ComplementView() = default; /// Initialize with set view \a y explicit ComplementView(View& y); //@} @@ -768,63 +768,63 @@ namespace Gecode { namespace Set { //@{ /// Return minimum cardinality - unsigned int card_min(void) const; + unsigned int card_min() const; /// Return maximum cardinality - unsigned int card_max(void) const; + unsigned int card_max() const; /// Return minimum of the least upper bound - int lub_min(void) const; + int lub_min() const; /// Return maximum of the least upper bound - int lub_max(void) const; + int lub_max() const; /// Return \a n-th smallest element of the least upper bound int lub_min_n(unsigned int n) const; /// Return minimum of the greatest lower bound - int glb_min(void) const; + int glb_min() const; /// Return maximum of the greatest lower bound - int glb_max(void) const; + int glb_max() const; /// Return the number of elements in the greatest lower bound - unsigned int glb_size(void) const; + unsigned int glb_size() const; /// Return the number of elements in the least upper bound - unsigned int lub_size(void) const; + unsigned int lub_size() const; /// Return the number of unknown elements - unsigned int unknown_size(void) const; + unsigned int unknown_size() const; //@} /// \name Domain tests //@{ - /// Test whether \a i is in the greatest lower bound - bool contains(int i) const; - /// Test whether \a i is not in the least upper bound - bool not_contains(int i) const; + /// Test whether \a n is in the greatest lower bound + bool contains(int n) const; + /// Test whether \a n is not in the least upper bound + bool not_contains(int n) const; //@} /// \name Domain update by value //@{ - /// Restrict cardinality to be greater than or equal to \a m - ModEvent card_min(Space& home, unsigned int m); - /// Restrict cardinality to be less than or equal to \a m - ModEvent card_max(Space& home, unsigned int m); + /// Restrict cardinality to be greater than or equal to \a c + ModEvent card_min(Space& home, unsigned int c); + /// Restrict cardinality to be less than or equal to \a c + ModEvent card_max(Space& home, unsigned int c); /** * \brief Update greatest lower bound to include all elements - * between and including \a i and \a j + * between and including \a k and \a k */ - ModEvent include(Space& home, int i, int j); + ModEvent include(Space& home, int j, int k); /** * \brief Restrict least upper bound to not contain all elements - * between and including \a i and \a j + * between and including \a k and \a k */ - ModEvent exclude(Space& home, int i, int j); - /// Update greatest lower bound to contain \a i - ModEvent include(Space& home, int i); - /// Restrict least upper bound to not contain \a i - ModEvent exclude(Space& home, int i); + ModEvent exclude(Space& home, int j, int k); + /// Update greatest lower bound to contain \a c + ModEvent include(Space& home, int c); + /// Restrict least upper bound to not contain \a c + ModEvent exclude(Space& home, int c); /** * \brief Update least upper bound to contain at most all elements * between and including \a i and \a j */ ModEvent intersect(Space& home, int i, int j); - /// Update least upper bound to contain at most the element \a i - ModEvent intersect(Space& home, int i); + /// Update least upper bound to contain at most the element \a c + ModEvent intersect(Space& home, int c); //@} /// \name Domain update by range iterator @@ -936,7 +936,7 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - CachedView(void) = default; + CachedView() = default; /// Initialize with set view \a y explicit CachedView(const View& y); //@} @@ -945,34 +945,34 @@ namespace Gecode { namespace Set { //@{ /// Return minimum cardinality - unsigned int card_min(void) const; + unsigned int card_min() const; /// Return maximum cardinality - unsigned int card_max(void) const; + unsigned int card_max() const; /// Return minimum of the least upper bound - int lub_min(void) const; + int lub_min() const; /// Return maximum of the least upper bound - int lub_max(void) const; + int lub_max() const; /// Return \a n-th smallest element of the least upper bound int lub_min_n(unsigned int n) const; /// Return minimum of the greatest lower bound - int glb_min(void) const; + int glb_min() const; /// Return maximum of the greatest lower bound - int glb_max(void) const; + int glb_max() const; /// Return the number of elements in the greatest lower bound - unsigned int glb_size(void) const; + unsigned int glb_size() const; /// Return the number of elements in the least upper bound - unsigned int lub_size(void) const; + unsigned int lub_size() const; /// Return the number of unknown elements - unsigned int unknown_size(void) const; + unsigned int unknown_size() const; //@} /// \name Domain tests //@{ - /// Test whether \a i is in the greatest lower bound - bool contains(int i) const; - /// Test whether \a i is not in the least upper bound - bool not_contains(int i) const; + /// Test whether \a n is in the greatest lower bound + bool contains(int n) const; + /// Test whether \a n is not in the least upper bound + bool not_contains(int n) const; //@} /// \name Domain update by value @@ -1073,9 +1073,9 @@ namespace Gecode { namespace Set { /// Update least upper bound cache to current domain void cache_lub(Space& home); /// Check whether greatest lower bound cache differs from current domain - bool glb_modified(void) const; + bool glb_modified() const; /// Check whether least upper bound cache differs from current domain - bool lub_modified(void) const; + bool lub_modified() const; //@} /// \name Cloning @@ -1134,7 +1134,7 @@ namespace Gecode { namespace Set { LubDiffRanges(const CachedView& x); }; -}} // namespace Gecode::Set +} // namespace Gecode::Set #include diff --git a/gecode/set/view/cached.hpp b/gecode/set/view/cached.hpp index 77790c596c..de12fc07c3 100644 --- a/gecode/set/view/cached.hpp +++ b/gecode/set/view/cached.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Set { +namespace Gecode::Set { template forceinline @@ -41,19 +41,19 @@ namespace Gecode { namespace Set { template forceinline unsigned int - CachedView::glb_size(void) const { + CachedView::glb_size() const { return x.glb_size(); } template forceinline unsigned int - CachedView::lub_size(void) const { + CachedView::lub_size() const { return x.lub_size(); } template forceinline unsigned int - CachedView::unknown_size(void) const { + CachedView::unknown_size() const { return x.unknown_size(); } @@ -71,37 +71,37 @@ namespace Gecode { namespace Set { template forceinline unsigned int - CachedView::card_min(void) const { + CachedView::card_min() const { return x.card_min(); } template forceinline unsigned int - CachedView::card_max(void) const { + CachedView::card_max() const { return x.card_max(); } template forceinline int - CachedView::lub_min(void) const { + CachedView::lub_min() const { return x.lub_min(); } template forceinline int - CachedView::lub_max(void) const { + CachedView::lub_max() const { return x.lub_max(); } template forceinline int - CachedView::glb_min(void) const { + CachedView::glb_min() const { return x.glb_min(); } template forceinline int - CachedView::glb_max(void) const { + CachedView::glb_max() const { return x.glb_max(); } @@ -301,13 +301,13 @@ namespace Gecode { namespace Set { template forceinline bool - CachedView::glb_modified(void) const { + CachedView::glb_modified() const { return glb_cache.size() != glb_size(); } template forceinline bool - CachedView::lub_modified(void) const { + CachedView::lub_modified() const { return lub_cache.size() != lub_size(); } @@ -321,11 +321,11 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - LubRanges(void) = default; - /// Initialize with ranges for view \a x - LubRanges(const CachedView& x); - /// Initialize with ranges for view \a x - void init(const CachedView& x); + LubRanges() = default; + /// Initialize with ranges for view \a s + LubRanges(const CachedView& s); + /// Initialize with ranges for view \a s + void init(const CachedView& s); //@} }; @@ -350,11 +350,11 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - GlbRanges(void) = default; - /// Initialize with ranges for view \a x - GlbRanges(const CachedView& x); - /// Initialize with ranges for view \a x - void init(const CachedView& x); + GlbRanges() = default; + /// Initialize with ranges for view \a s + GlbRanges(const CachedView& s); + /// Initialize with ranges for view \a s + void init(const CachedView& s); //@} }; @@ -395,6 +395,6 @@ namespace Gecode { namespace Set { Iter::Ranges::Diff>::init(cr, lr); } -}} // namespace Gecode::Set +} // namespace Gecode::Set // STATISTICS: set-var diff --git a/gecode/set/view/complement.hpp b/gecode/set/view/complement.hpp index c29fce2a26..7484e32263 100644 --- a/gecode/set/view/complement.hpp +++ b/gecode/set/view/complement.hpp @@ -36,7 +36,7 @@ #include -namespace Gecode { namespace Set { +namespace Gecode::Set { template forceinline @@ -75,19 +75,19 @@ namespace Gecode { namespace Set { template forceinline unsigned int - ComplementView::glb_size(void) const { + ComplementView::glb_size() const { return Limits::card - x.lub_size(); } template forceinline unsigned int - ComplementView::lub_size(void) const { + ComplementView::lub_size() const { return Limits::card - x.glb_size(); } template forceinline unsigned int - ComplementView::unknown_size(void) const { + ComplementView::unknown_size() const { return lub_size() - glb_size(); } @@ -105,66 +105,62 @@ namespace Gecode { namespace Set { template forceinline unsigned int - ComplementView::card_min(void) const { + ComplementView::card_min() const { return Limits::card - x.card_max(); } template forceinline unsigned int - ComplementView::card_max(void) const { + ComplementView::card_max() const { return Limits::card - x.card_min(); } template forceinline int - ComplementView::lub_min(void) const { + ComplementView::lub_min() const { GlbRanges lb(x); RangesCompl> lbc(lb); if (lbc()) { return lbc.min(); - } else { - return BndSet::MIN_OF_EMPTY; } + return BndSet::MIN_OF_EMPTY; } template forceinline int - ComplementView::lub_max(void) const { + ComplementView::lub_max() const { GlbRanges lb(x); RangesCompl> lbc(lb); if (lbc()) { while (lbc()) ++lbc; return lbc.max(); - } else { - return BndSet::MAX_OF_EMPTY; } + return BndSet::MAX_OF_EMPTY; } template forceinline int - ComplementView::glb_min(void) const { + ComplementView::glb_min() const { LubRanges ub(x); RangesCompl> ubc(ub); if (ubc()) { return ubc.min(); - } else { - return BndSet::MIN_OF_EMPTY; } + return BndSet::MIN_OF_EMPTY; } template forceinline int - ComplementView::glb_max(void) const { + ComplementView::glb_max() const { LubRanges ub(x); RangesCompl> ubc(ub); if (ubc()) { while (ubc()) ++ubc; return ubc.max(); - } else { - return BndSet::MAX_OF_EMPTY; } + return BndSet::MAX_OF_EMPTY; } template @@ -347,29 +343,29 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - LubRanges(void) = default; - /// Initialize with ranges for view \a x - LubRanges(const ComplementView& x); - /// Initialize with ranges for view \a x - void init(const ComplementView& x); + LubRanges() = default; + /// Initialize with ranges for view \a s + LubRanges(const ComplementView& s); + /// Initialize with ranges for view \a s + void init(const ComplementView& s); //@} /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of ranges (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; @@ -387,31 +383,31 @@ namespace Gecode { namespace Set { template forceinline bool - LubRanges>::operator()(void) const { + LubRanges>::operator()() const { return lbc(); } template forceinline void - LubRanges>::operator++(void) { + LubRanges>::operator++() { return ++lbc; } template forceinline int - LubRanges>::min(void) const { + LubRanges>::min() const { return lbc.min(); } template forceinline int - LubRanges>::max(void) const { + LubRanges>::max() const { return lbc.max(); } template forceinline unsigned int - LubRanges>::width(void) const { + LubRanges>::width() const { return lbc.width(); } @@ -429,7 +425,7 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - LubRanges(void) = default; + LubRanges() = default; /// Initialize with ranges for view \a x LubRanges(const ComplementView>& x); /// Initialize with ranges for view \a x @@ -462,29 +458,29 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - GlbRanges(void) = default; - /// Initialize with ranges for view \a x - GlbRanges(const ComplementView& x); - /// Initialize with ranges for view \a x - void init(const ComplementView& x); + GlbRanges() = default; + /// Initialize with ranges for view \a s + GlbRanges(const ComplementView& s); + /// Initialize with ranges for view \a s + void init(const ComplementView& s); //@} /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of ranges (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; @@ -502,31 +498,31 @@ namespace Gecode { namespace Set { template forceinline bool - GlbRanges>::operator()(void) const { + GlbRanges>::operator()() const { return ubc(); } template forceinline void - GlbRanges>::operator++(void) { + GlbRanges>::operator++() { return ++ubc; } template forceinline int - GlbRanges>::min(void) const { + GlbRanges>::min() const { return ubc.min(); } template forceinline int - GlbRanges>::max(void) const { + GlbRanges>::max() const { return ubc.max(); } template forceinline unsigned int - GlbRanges>::width(void) const { + GlbRanges>::width() const { return ubc.width(); } @@ -544,7 +540,7 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - GlbRanges(void) = default; + GlbRanges() = default; /// Initialize with ranges for view \a x GlbRanges(const ComplementView>& x); /// Initialize with ranges for view \a x @@ -579,6 +575,6 @@ namespace Gecode { namespace Set { return x.base() == y.base(); } -}} // namespace Gecode::Set +} // namespace Gecode::Set // STATISTICS: set-var diff --git a/gecode/set/view/const.hpp b/gecode/set/view/const.hpp index 54c447e7b1..46bc891d85 100644 --- a/gecode/set/view/const.hpp +++ b/gecode/set/view/const.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Set { +namespace Gecode::Set { /** * \brief %Range iterator for a two-dimensional array @@ -46,7 +46,7 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - ArrayRanges(void) : _ranges(nullptr), _size(0), _pos(0) {} + ArrayRanges() : _ranges(nullptr), _size(0), _pos(0) {} /// Initialize with ranges for array \a ranges which is of size \a size ArrayRanges(int* ranges, int size) : _ranges(ranges), _size(size), _pos(0) {} /// Initialize with ranges for array \a ranges which is of size \a size @@ -62,12 +62,12 @@ namespace Gecode { namespace Set { //@{ /// Test whether iterator is still at a range or done bool - operator()(void) const { + operator()() const { return _pos < _size; } /// Move iterator to next range (if possible) void - operator++(void) { + operator++() { _pos++; } //@} @@ -76,24 +76,24 @@ namespace Gecode { namespace Set { //@{ /// Return smallest value of range int - min(void) const { + min() const { return _ranges[_pos * 2]; } /// Return largest value of range int - max(void) const { + max() const { return _ranges[_pos * 2 + 1]; } /// Return width of range (distance between minimum and maximum) unsigned int - width(void) const { + width() const { return static_cast(_ranges[_pos * 2 + 1] - _ranges[_pos * 2] + 1); } //@} }; forceinline - ConstSetView::ConstSetView(void) + ConstSetView::ConstSetView() : ranges(nullptr), size(0), dom_size(0) {} forceinline @@ -116,17 +116,17 @@ namespace Gecode { namespace Set { } forceinline unsigned int - ConstSetView::glb_size(void) const { + ConstSetView::glb_size() const { return dom_size; } forceinline unsigned int - ConstSetView::lub_size(void) const { + ConstSetView::lub_size() const { return dom_size; } forceinline unsigned int - ConstSetView::unknown_size(void) const { + ConstSetView::unknown_size() const { return 0; } @@ -147,32 +147,32 @@ namespace Gecode { namespace Set { } forceinline unsigned int - ConstSetView::card_min(void) const { + ConstSetView::card_min() const { return dom_size; } forceinline unsigned int - ConstSetView::card_max(void) const { + ConstSetView::card_max() const { return dom_size; } forceinline int - ConstSetView::lub_min(void) const { + ConstSetView::lub_min() const { return size == 0 ? BndSet::MIN_OF_EMPTY : ranges[0]; } forceinline int - ConstSetView::lub_max(void) const { + ConstSetView::lub_max() const { return size == 0 ? BndSet::MAX_OF_EMPTY : ranges[size * 2 - 1]; } forceinline int - ConstSetView::glb_min(void) const { + ConstSetView::glb_min() const { return lub_min(); } forceinline int - ConstSetView::glb_max(void) const { + ConstSetView::glb_max() const { return lub_max(); } @@ -298,17 +298,17 @@ namespace Gecode { namespace Set { } forceinline unsigned int - EmptyView::glb_size(void) const { + EmptyView::glb_size() const { return 0; } forceinline unsigned int - EmptyView::lub_size(void) const { + EmptyView::lub_size() const { return 0; } forceinline unsigned int - EmptyView::unknown_size(void) const { + EmptyView::unknown_size() const { return 0; } @@ -323,32 +323,32 @@ namespace Gecode { namespace Set { } forceinline unsigned int - EmptyView::card_min(void) const { + EmptyView::card_min() const { return 0; } forceinline unsigned int - EmptyView::card_max(void) const { + EmptyView::card_max() const { return 0; } forceinline int - EmptyView::lub_min(void) const { + EmptyView::lub_min() const { return 0; } forceinline int - EmptyView::lub_max(void) const { + EmptyView::lub_max() const { return 0; } forceinline int - EmptyView::glb_min(void) const { + EmptyView::glb_min() const { return 0; } forceinline int - EmptyView::glb_max(void) const { + EmptyView::glb_max() const { return 0; } @@ -453,17 +453,17 @@ namespace Gecode { namespace Set { // Constant universe variable forceinline unsigned int - UniverseView::glb_size(void) const { + UniverseView::glb_size() const { return Set::Limits::card; } forceinline unsigned int - UniverseView::lub_size(void) const { + UniverseView::lub_size() const { return Set::Limits::card; } forceinline unsigned int - UniverseView::unknown_size(void) const { + UniverseView::unknown_size() const { return 0; } @@ -478,32 +478,32 @@ namespace Gecode { namespace Set { } forceinline unsigned int - UniverseView::card_min(void) const { + UniverseView::card_min() const { return Set::Limits::card; } forceinline unsigned int - UniverseView::card_max(void) const { + UniverseView::card_max() const { return Limits::card; } forceinline int - UniverseView::lub_min(void) const { + UniverseView::lub_min() const { return Limits::card; } forceinline int - UniverseView::lub_max(void) const { + UniverseView::lub_max() const { return Limits::card; } forceinline int - UniverseView::glb_min(void) const { + UniverseView::glb_min() const { return Limits::card; } forceinline int - UniverseView::glb_max(void) const { + UniverseView::glb_max() const { return Limits::card; } @@ -620,7 +620,7 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - LubRanges(void) = default; + LubRanges() = default; /// Initialize with ranges for view \a x LubRanges(const EmptyView& x) { (void)x; @@ -643,7 +643,7 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - GlbRanges(void) = default; + GlbRanges() = default; /// Initialize with ranges for view \a x GlbRanges(const EmptyView& x) { (void)x; @@ -666,7 +666,7 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - LubRanges(void) : Iter::Ranges::Singleton(Limits::min, Limits::max) {} + LubRanges() : Iter::Ranges::Singleton(Limits::min, Limits::max) {} /// Initialize with ranges for view \a x LubRanges(const UniverseView& x) : Iter::Ranges::Singleton(Limits::min, Limits::max) { (void)x; @@ -689,7 +689,7 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - GlbRanges(void) : Iter::Ranges::Singleton(Limits::min, Limits::max) {} + GlbRanges() : Iter::Ranges::Singleton(Limits::min, Limits::max) {} /// Initialize with ranges for view \a x GlbRanges(const UniverseView& x) : Iter::Ranges::Singleton(Limits::min, Limits::max) { (void)x; @@ -716,7 +716,7 @@ namespace Gecode { namespace Set { //@{ /// Default constructor // NOLINTNEXTLINE(modernize-use-equals-default) - LubRanges(void) {} + LubRanges() {} /// Initialize with ranges for view \a x LubRanges(const ConstSetView& x) : ar(x.ranges, x.size) {} /// Initialize with ranges for view \a x @@ -730,12 +730,12 @@ namespace Gecode { namespace Set { //@{ /// Test whether iterator is still at a value or done bool - operator()(void) const { + operator()() const { return ar(); } /// Move iterator to next value (if possible) void - operator++(void) { + operator++() { ++ar; } //@} @@ -744,17 +744,17 @@ namespace Gecode { namespace Set { //@{ /// Return smallest value of range int - min(void) const { + min() const { return ar.min(); } /// Return largest value of range int - max(void) const { + max() const { return ar.max(); } /// Return width of range (distance between minimum and maximum) unsigned int - width(void) const { + width() const { return ar.width(); } //@} @@ -771,7 +771,7 @@ namespace Gecode { namespace Set { //@{ /// Default constructor // NOLINTNEXTLINE(modernize-use-equals-default) - GlbRanges(void) {} + GlbRanges() {} /// Initialize with ranges for view \a x GlbRanges(const ConstSetView& x) : LubRanges(x) {} /// Initialize with ranges for view \a x @@ -829,6 +829,6 @@ namespace Gecode { namespace Set { return true; } -}} // namespace Gecode::Set +} // namespace Gecode::Set // STATISTICS: set-var diff --git a/gecode/set/view/print.hpp b/gecode/set/view/print.hpp index a1b8d83727..00d40af570 100644 --- a/gecode/set/view/print.hpp +++ b/gecode/set/view/print.hpp @@ -34,7 +34,7 @@ #include -namespace Gecode { namespace Set { +namespace Gecode::Set { /// Print bound of a set view or variable template @@ -134,6 +134,6 @@ namespace Gecode { namespace Set { return os << s.str(); } -}} // namespace Gecode::Set +} // namespace Gecode::Set // STATISTICS: set-var diff --git a/gecode/set/view/set.hpp b/gecode/set/view/set.hpp index 7693016fd4..d7d719eedc 100644 --- a/gecode/set/view/set.hpp +++ b/gecode/set/view/set.hpp @@ -36,7 +36,7 @@ * */ -namespace Gecode { namespace Set { +namespace Gecode::Set { /* * Constructors and access @@ -56,15 +56,15 @@ namespace Gecode { namespace Set { */ forceinline unsigned int - SetView::glb_size(void) const { + SetView::glb_size() const { return x->glb_size(); } forceinline unsigned int - SetView::lub_size(void) const { + SetView::lub_size() const { return x->lub_size(); } forceinline unsigned int - SetView::unknown_size(void) const { + SetView::unknown_size() const { return x->lub_size() - x->glb_size(); } forceinline bool @@ -76,19 +76,19 @@ namespace Gecode { namespace Set { return x->known_out(i); } forceinline unsigned int - SetView::card_min(void) const { + SetView::card_min() const { return x->card_min(); } forceinline unsigned int - SetView::card_max(void) const { + SetView::card_max() const { return x->card_max(); } forceinline int - SetView::lub_min(void) const { + SetView::lub_min() const { return x->lub_min(); } forceinline int - SetView::lub_max(void) const { + SetView::lub_max() const { return x->lub_max(); } forceinline int @@ -96,11 +96,11 @@ namespace Gecode { namespace Set { return x->lub_min_n(n); } forceinline int - SetView::glb_min(void) const { + SetView::glb_min() const { return x->glb_min(); } forceinline int - SetView::glb_max(void) const { + SetView::glb_max() const { return x->glb_max(); } @@ -211,7 +211,7 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - LubRanges(void); + LubRanges(); /// Initialize with ranges for view \a x LubRanges(const SetView& x); /// Initialize with ranges for view \a x @@ -221,7 +221,7 @@ namespace Gecode { namespace Set { forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - LubRanges::LubRanges(void) {} + LubRanges::LubRanges() {} forceinline LubRanges::LubRanges(const SetView& x) @@ -242,7 +242,7 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - GlbRanges(void); + GlbRanges(); /// Initialize with ranges for view \a x GlbRanges(const SetView& x); /// Initialize with ranges for view \a x @@ -251,7 +251,7 @@ namespace Gecode { namespace Set { forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - GlbRanges::GlbRanges(void) {} + GlbRanges::GlbRanges() {} forceinline GlbRanges::GlbRanges(const SetView& x) @@ -262,6 +262,6 @@ namespace Gecode { namespace Set { GlbRanges::init(x.varimp()); } -}} // namespace Gecode::Set +} // namespace Gecode::Set // STATISTICS: set-var diff --git a/gecode/set/view/singleton.hpp b/gecode/set/view/singleton.hpp index e2d425d845..4669a8a683 100644 --- a/gecode/set/view/singleton.hpp +++ b/gecode/set/view/singleton.hpp @@ -34,7 +34,7 @@ * */ -namespace Gecode { namespace Set { +namespace Gecode::Set { forceinline SingletonView::SingletonView(Gecode::Int::IntView& y) @@ -87,17 +87,17 @@ namespace Gecode { namespace Set { } forceinline unsigned int - SingletonView::glb_size(void) const { + SingletonView::glb_size() const { return x.assigned() ? 1U : 0U; } forceinline unsigned int - SingletonView::lub_size(void) const { + SingletonView::lub_size() const { return x.size(); } forceinline unsigned int - SingletonView::unknown_size(void) const { + SingletonView::unknown_size() const { return lub_size() - glb_size(); } @@ -260,7 +260,7 @@ namespace Gecode { namespace Set { forceinline void SingletonView::schedule(Space& home, Propagator& p, ModEvent me) { - return Gecode::Int::IntView::schedule(home, p, me_settoint(me)); + Gecode::Int::IntView::schedule(home, p, me_settoint(me)); } forceinline ModEvent SingletonView::me(const ModEventDelta& med) { @@ -334,17 +334,17 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - LubRanges(void); - /// Initialize with ranges for view \a x - LubRanges(const SingletonView& x); - /// Initialize with ranges for view \a x - void init(const SingletonView& x); + LubRanges(); + /// Initialize with ranges for view \a s + LubRanges(const SingletonView& s); + /// Initialize with ranges for view \a s + void init(const SingletonView& s); //@} }; forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - LubRanges::LubRanges(void) {} + LubRanges::LubRanges() {} forceinline LubRanges::LubRanges(const SingletonView& s) @@ -369,34 +369,34 @@ namespace Gecode { namespace Set { /// \name Constructors and initialization //@{ /// Default constructor - GlbRanges(void); - /// Initialize with ranges for view \a x - GlbRanges(const SingletonView& x); - /// Initialize with ranges for view \a x - void init(const SingletonView& x); + GlbRanges(); + /// Initialize with ranges for view \a s + GlbRanges(const SingletonView& s); + /// Initialize with ranges for view \a s + void init(const SingletonView& s); /// \name Iteration control //@{ /// Test whether iterator is still at a range or done - bool operator()(void) const; + bool operator()() const; /// Move iterator to next range (if possible) - void operator++(void); + void operator++(); //@} /// \name Range access //@{ /// Return smallest value of range - int min(void) const; + int min() const; /// Return largest value of range - int max(void) const; + int max() const; /// Return width of ranges (distance between minimum and maximum) - unsigned int width(void) const; + unsigned int width() const; //@} }; forceinline // NOLINTNEXTLINE(modernize-use-equals-default) - GlbRanges::GlbRanges(void) {} + GlbRanges::GlbRanges() {} forceinline void GlbRanges::init(const SingletonView& s) { @@ -415,28 +415,28 @@ namespace Gecode { namespace Set { } forceinline bool - GlbRanges::operator()(void) const { + GlbRanges::operator()() const { return flag; } forceinline void - GlbRanges::operator++(void) { + GlbRanges::operator++() { flag = false; } forceinline int - GlbRanges::min(void) const { + GlbRanges::min() const { return val; } forceinline int - GlbRanges::max(void) const { + GlbRanges::max() const { return val; } forceinline unsigned int - GlbRanges::width(void) const { + GlbRanges::width() const { return 1; } -}} // namespace Gecode::Set +} // namespace Gecode::Set // STATISTICS: set-var diff --git a/gecode/support/allocator.cpp b/gecode/support/allocator.cpp index 181cfd5570..1d1397b032 100644 --- a/gecode/support/allocator.cpp +++ b/gecode/support/allocator.cpp @@ -37,7 +37,7 @@ #include #endif -namespace Gecode { namespace Support { +namespace Gecode::Support { Allocator allocator; @@ -56,6 +56,6 @@ namespace Gecode { namespace Support { } #endif -}} // namespace Gecode::Support +} // namespace Gecode::Support // STATISTICS: support-any diff --git a/gecode/support/allocator.hpp b/gecode/support/allocator.hpp index 3259f3b400..695c31883a 100644 --- a/gecode/support/allocator.hpp +++ b/gecode/support/allocator.hpp @@ -47,7 +47,7 @@ #ifdef GECODE_ALLOCATOR -namespace Gecode { namespace Support { +namespace Gecode::Support { /** * \brief Default memory allocator @@ -62,7 +62,7 @@ namespace Gecode { namespace Support { class Allocator { public: /// Default constructor - Allocator(void) = default; + Allocator() = default; /// Allocate memory block of size \a n #ifdef GECODE_MIMALLOC GECODE_SUPPORT_EXPORT @@ -85,14 +85,17 @@ namespace Gecode { namespace Support { #ifndef GECODE_MIMALLOC forceinline void* Allocator::alloc(size_t n) { + // NOLINTNEXTLINE(cppcoreguidelines-no-malloc): this is the heap allocator return ::malloc(n); } forceinline void* Allocator::realloc(void* p, size_t n) { + // NOLINTNEXTLINE(cppcoreguidelines-no-malloc): this is the heap allocator return ::realloc(p, n); } forceinline void Allocator::free(void* p) { + // NOLINTNEXTLINE(cppcoreguidelines-no-malloc): this is the heap allocator ::free(p); } #endif @@ -101,11 +104,11 @@ namespace Gecode { namespace Support { return ::memcpy(d, s, n); } -}} // namespace Gecode::Support +} // namespace Gecode::Support #endif -namespace Gecode { namespace Support { +namespace Gecode::Support { /** * \brief The single global default memory allocator @@ -113,6 +116,6 @@ namespace Gecode { namespace Support { */ extern GECODE_SUPPORT_EXPORT Allocator allocator; -}} // namespace Gecode::Support +} // namespace Gecode::Support // STATISTICS: support-any diff --git a/gecode/support/bitset-base.hpp b/gecode/support/bitset-base.hpp index a610c8a19a..6eba03793e 100644 --- a/gecode/support/bitset-base.hpp +++ b/gecode/support/bitset-base.hpp @@ -39,7 +39,7 @@ #include #include -namespace Gecode { namespace Support { +namespace Gecode::Support { class RawBitSetBase; @@ -50,10 +50,10 @@ namespace Gecode { namespace Support { protected: #if defined(_MSC_VER) && defined(_M_IX86) /// Basetype for bits - typedef unsigned long int Base; + using Base = unsigned long int; #else /// Basetype for bits - typedef unsigned long long int Base; + using Base = unsigned long long int; #endif /// The bits Base bits; @@ -76,19 +76,19 @@ namespace Gecode { namespace Support { /// Return next set bit with position greater or equal to \a i (there must be a bit) unsigned int next(unsigned int i = 0U) const; /// Whether all bits are set - bool all(void) const; + bool all() const; /// Whether all bits from bit 0 to bit \a i are set bool all(unsigned int i) const; /// Whether no bits are set - bool none(void) const; + bool none() const; /// Whether no bits from bit 0 to bit \a i are set bool none(unsigned int i) const; /// Return the number of bits set - unsigned int ones(void) const; + unsigned int ones() const; /// Return the number of bits not set - unsigned int zeroes(void) const; + unsigned int zeroes() const; /// Check whether exactly one bit is set - bool one(void) const; + bool one() const; /// Perform "and" with \a a void a(BitSetData a); /// Perform "and" with \a a for bits 0 to \a i @@ -104,7 +104,7 @@ namespace Gecode { namespace Support { /// Whether both hold the same bits bool operator==(const BitSetData&) const = default; /// Invert all bits in \a b - BitSetData operator~(void) const; + BitSetData operator~() const; }; /// Status of a bitset @@ -129,7 +129,7 @@ namespace Gecode { namespace Support { /// Assignment operator (disabled) RawBitSetBase& operator=(const RawBitSetBase&) = delete; /// Default constructor (yields empty set) - RawBitSetBase(void); + RawBitSetBase(); /// Initialize for \a sz bits and allocator \a a template RawBitSetBase(A& a, unsigned int sz, bool set_bits = false); @@ -180,7 +180,7 @@ namespace Gecode { namespace Support { /// Assignment operator (disabled) BitSetBase& operator=(const BitSetBase&) = delete; /// Default constructor (yields empty set) - BitSetBase(void); + BitSetBase(); /// Initialize for \a s bits and allocator \a a template BitSetBase(A& a, unsigned int s, bool set_bits = false); @@ -195,7 +195,7 @@ namespace Gecode { namespace Support { /// Copy \a sz bits from \a bs void copy(const BitSetBase& bs); /// Return size of bitset (number of bits) - unsigned int size(void) const; + unsigned int size() const; /// Access value at bit \a i bool get(unsigned int i) const; /// Set bit \a i @@ -205,11 +205,11 @@ namespace Gecode { namespace Support { /// Return position greater or equal \a i of next set bit (\a i is allowed to be equal to size) unsigned int next(unsigned int i) const; /// Return status of bitset - BitSetStatus status(void) const; + BitSetStatus status() const; /// Test whether all bits are set - bool all(void) const; + bool all() const; /// Test whether no bits are set - bool none(void) const; + bool none() const; /// Resize bitset to \a n elememts template void resize(A& a, unsigned int n, bool set_bits = false); @@ -253,7 +253,7 @@ namespace Gecode { namespace Support { return static_cast(std::countr_zero(bits >> i)) + i; } forceinline bool - BitSetData::all(void) const { + BitSetData::all() const { return bits == ~static_cast(0U); } forceinline bool @@ -262,7 +262,7 @@ namespace Gecode { namespace Support { return (bits & mask) == mask; } forceinline bool - BitSetData::none(void) const { + BitSetData::none() const { return bits == static_cast(0U); } forceinline bool @@ -272,15 +272,15 @@ namespace Gecode { namespace Support { } forceinline unsigned int - BitSetData::ones(void) const { + BitSetData::ones() const { return static_cast(std::popcount(bits)); } forceinline unsigned int - BitSetData::zeroes(void) const { + BitSetData::zeroes() const { return bpb - ones(); } forceinline bool - BitSetData::one(void) const { + BitSetData::one() const { return (bits & (bits - static_cast(1U))) == static_cast(0U); } @@ -317,7 +317,7 @@ namespace Gecode { namespace Support { } forceinline BitSetData - BitSetData::operator~(void) const { + BitSetData::operator~() const { BitSetData iv; iv.bits = ~bits; return iv; @@ -365,7 +365,7 @@ namespace Gecode { namespace Support { } forceinline - RawBitSetBase::RawBitSetBase(void) + RawBitSetBase::RawBitSetBase() : data(nullptr) {} template @@ -441,14 +441,14 @@ namespace Gecode { namespace Support { if (!data[i].all()) return BSS_SOME; return data[pos].all(bits) ? BSS_ALL : BSS_SOME; - } else if (data[0].none()) { + } + if (data[0].none()) { for (unsigned int i = 1; i < pos; i++) if (!data[i].none()) return BSS_SOME; return data[pos].none(bits) ? BSS_NONE : BSS_SOME; - } else { - return BSS_SOME; } + return BSS_SOME; } if (data[0].all(bits)) return BSS_ALL; @@ -481,7 +481,7 @@ namespace Gecode { namespace Support { } forceinline - BitSetBase::BitSetBase(void) + BitSetBase::BitSetBase() : sz(0U) {} template @@ -514,7 +514,7 @@ namespace Gecode { namespace Support { } forceinline unsigned int - BitSetBase::size(void) const { + BitSetBase::size() const { return sz; } @@ -541,20 +541,20 @@ namespace Gecode { namespace Support { } forceinline BitSetStatus - BitSetBase::status(void) const { + BitSetBase::status() const { return RawBitSetBase::status(sz); } forceinline bool - BitSetBase::all(void) const { + BitSetBase::all() const { return RawBitSetBase::all(sz); } forceinline bool - BitSetBase::none(void) const { + BitSetBase::none() const { return RawBitSetBase::none(sz); } -}} // namespace Gecode::Support +} // namespace Gecode::Support // STATISTICS: support-any diff --git a/gecode/support/bitset-offset.hpp b/gecode/support/bitset-offset.hpp index 49dad852d0..70e32fd20a 100644 --- a/gecode/support/bitset-offset.hpp +++ b/gecode/support/bitset-offset.hpp @@ -40,7 +40,7 @@ #include #include -namespace Gecode { namespace Support { +namespace Gecode::Support { /// Bitsets with index offset. /// @@ -60,7 +60,7 @@ namespace Gecode { namespace Support { /// Copy bit set \a bs BitSetOffset(A& a, const BitSetOffset& bs); /// Destructor - ~BitSetOffset(void); + ~BitSetOffset(); // As for the ordinary bitset, most operations can be inherited // directly from BitSetBase. We only modify the operations that @@ -78,9 +78,9 @@ namespace Gecode { namespace Support { void resize(A& a, unsigned int n, int offset, bool set = false); /// Retrieve the minimum valid index (the offset). - int offset(void) const; + int offset() const; /// Retrieve the maximum valid index. - int max_bit(void) const; + int max_bit() const; /// Is the bit index valid for this bitset? bool valid(int i) const; }; @@ -96,7 +96,7 @@ namespace Gecode { namespace Support { : BitSetBase(a0, bs), a(a0), _offset(bs._offset) {} template - forceinline BitSetOffset::~BitSetOffset(void) { + forceinline BitSetOffset::~BitSetOffset() { dispose(a); } @@ -133,13 +133,13 @@ namespace Gecode { namespace Support { template forceinline int - BitSetOffset::offset(void) const { + BitSetOffset::offset() const { return _offset; } template forceinline int - BitSetOffset::max_bit(void) const { + BitSetOffset::max_bit() const { return _offset + static_cast(size()) - 1; } @@ -158,6 +158,6 @@ namespace Gecode { namespace Support { return os; } -}} // namespace Gecode::Support +} // namespace Gecode::Support // STATISTICS: support-any diff --git a/gecode/support/bitset.hpp b/gecode/support/bitset.hpp index 3cda445ea2..a3babf58c3 100644 --- a/gecode/support/bitset.hpp +++ b/gecode/support/bitset.hpp @@ -37,7 +37,7 @@ #include #include -namespace Gecode { namespace Support { +namespace Gecode::Support { /// Simple bitsets template @@ -52,7 +52,7 @@ namespace Gecode { namespace Support { /// Copy bit set \a bs BitSet(A& a, const BitSet& bs); /// Destructor - ~BitSet(void); + ~BitSet(); }; template @@ -66,10 +66,10 @@ namespace Gecode { namespace Support { : BitSetBase(a0, bs), a(a0) {} template - forceinline BitSet::~BitSet(void) { + forceinline BitSet::~BitSet() { dispose(a); } -}} // namespace Gecode::Support +} // namespace Gecode::Support // STATISTICS: support-any diff --git a/gecode/support/block-allocator.hpp b/gecode/support/block-allocator.hpp index 9ab8cc4848..e0908f1c44 100644 --- a/gecode/support/block-allocator.hpp +++ b/gecode/support/block-allocator.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Support { +namespace Gecode::Support { /** * \brief Manage memory organized into block lists (allocator) @@ -58,19 +58,19 @@ namespace Gecode { namespace Support { /// Size of allocated blocks size_t _size; /// Allocate additional block - void allocate(void); + void allocate(); public: /// Initialize BlockAllocator(A& a); /// Free all allocated blocks - ~BlockAllocator(void); + ~BlockAllocator(); /// Return allocator used - A& allocator(void); + A& allocator(); /// Return memory of size required by \a T - T* operator()(void); + T* operator()(); /// Return size of memory required by allocator - size_t size(void) const; + size_t size() const; }; /** @@ -82,6 +82,10 @@ namespace Gecode { namespace Support { */ template class BlockClient { + friend T; + /// Default constructor, for the derived class \a T only + BlockClient() = default; + public: /// Allocate memory from block allocator \a ba static void* operator new(size_t s, BlockAllocator& ba); @@ -102,7 +106,7 @@ namespace Gecode { namespace Support { } template - forceinline BlockAllocator::~BlockAllocator(void) { + forceinline BlockAllocator::~BlockAllocator() { while (b != nullptr) { Block* f = b; b = b->next; @@ -112,13 +116,13 @@ namespace Gecode { namespace Support { template forceinline A& - BlockAllocator::allocator(void) { + BlockAllocator::allocator() { return a; } template forceinline T* - BlockAllocator::operator()(void) { + BlockAllocator::operator()() { T* t = --n; if (t == &b->b[0]) allocate(); @@ -127,7 +131,7 @@ namespace Gecode { namespace Support { template void - BlockAllocator::allocate(void) { + BlockAllocator::allocate() { // Allocate another block Block* nb = static_cast(a.ralloc(sizeof(Block))); nb->next = b; @@ -138,7 +142,7 @@ namespace Gecode { namespace Support { template forceinline size_t - BlockAllocator::size(void) const { + BlockAllocator::size() const { return _size; } @@ -154,6 +158,6 @@ namespace Gecode { namespace Support { return ba(); } -}} // namespace Gecode::Support +} // namespace Gecode::Support // STATISTICS: support-any diff --git a/gecode/support/dynamic-array.hpp b/gecode/support/dynamic-array.hpp index c630cfba82..8cbea38bca 100644 --- a/gecode/support/dynamic-array.hpp +++ b/gecode/support/dynamic-array.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Support { +namespace Gecode::Support { /** * \brief Array with arbitrary number of elements @@ -48,8 +48,8 @@ namespace Gecode { namespace Support { int n; /// Array elements T* x; - /// Resize to at least \a n + 1 elements - void resize(int n); + /// Resize to at least \a i + 1 elements + void resize(int i); public: /// Initialize with size \a n @@ -59,10 +59,10 @@ namespace Gecode { namespace Support { /// Copy elements from array \a da DynamicArray(const DynamicArray& da); /// Release memory - ~DynamicArray(void); + ~DynamicArray(); /// Assign array (copy elements from \a a) - const DynamicArray& operator=(const DynamicArray& da); + DynamicArray& operator=(const DynamicArray& da); /// Return element at position \a i (possibly resize) T& operator[](int i); @@ -74,7 +74,7 @@ namespace Gecode { namespace Support { const T& operator[](unsigned int i) const; /// Cast in to pointer of type \a T - operator T*(void); + operator T*(); }; template @@ -95,12 +95,12 @@ namespace Gecode { namespace Support { } template - forceinline DynamicArray::~DynamicArray(void) { + forceinline DynamicArray::~DynamicArray() { a.free(x, n); } template - forceinline const DynamicArray& + forceinline DynamicArray& DynamicArray::operator=(const DynamicArray& da) { if (this != &da) { if (n < da.n) { @@ -151,10 +151,10 @@ namespace Gecode { namespace Support { template forceinline DynamicArray:: - operator T*(void) { + operator T*() { return x; } -}} // namespace Gecode::Support +} // namespace Gecode::Support // STATISTICS: support-any diff --git a/gecode/support/dynamic-queue.hpp b/gecode/support/dynamic-queue.hpp index 56a01298ae..19c2c5a08e 100644 --- a/gecode/support/dynamic-queue.hpp +++ b/gecode/support/dynamic-queue.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Support { +namespace Gecode::Support { /** * \brief Queue with arbitrary number of elements @@ -51,7 +51,7 @@ namespace Gecode { namespace Support { /// Elements in queue T* q; /// Resize queue (double size) - void resize(void); + void resize(); /// Move index \a i to next element void move(int& i); @@ -59,18 +59,18 @@ namespace Gecode { namespace Support { /// Initialize queue DynamicQueue(A& a); /// Release memory - ~DynamicQueue(void); + ~DynamicQueue(); /// Test whether queue is empty - bool empty(void) const; + bool empty() const; /// Reset queue to be empty - void reset(void); + void reset(); /// Pop element added first from queue and return it - T pop(void); + T pop(); /// Return element added first (queue must be nonempty) - T front(void) const; + T front() const; /// Push element \a x to queue void push(const T& x); @@ -92,7 +92,7 @@ namespace Gecode { namespace Support { template void - DynamicQueue::resize(void) { + DynamicQueue::resize() { assert(fst == lst); T* nq = a.template alloc(limit << 1); int j = 0; @@ -113,25 +113,25 @@ namespace Gecode { namespace Support { : a(a0), limit(8), fst(0), lst(0), q(a.template alloc(limit)) {} template - forceinline DynamicQueue::~DynamicQueue(void) { + forceinline DynamicQueue::~DynamicQueue() { a.free(q, limit); } template forceinline bool - DynamicQueue::empty(void) const { + DynamicQueue::empty() const { return fst == lst; } template forceinline void - DynamicQueue::reset(void) { + DynamicQueue::reset() { fst = lst = 0; } template forceinline T - DynamicQueue::pop(void) { + DynamicQueue::pop() { assert(!empty()); T t = q[fst]; move(fst); @@ -140,7 +140,7 @@ namespace Gecode { namespace Support { template forceinline T - DynamicQueue::front(void) const { + DynamicQueue::front() const { assert(!empty()); return q[fst]; } @@ -154,6 +154,6 @@ namespace Gecode { namespace Support { resize(); } -}} // namespace Gecode::Support +} // namespace Gecode::Support // STATISTICS: support-any diff --git a/gecode/support/dynamic-stack.hpp b/gecode/support/dynamic-stack.hpp index cbff8488de..3ab141ec9a 100644 --- a/gecode/support/dynamic-stack.hpp +++ b/gecode/support/dynamic-stack.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Support { +namespace Gecode::Support { /** * \brief Stack with arbitrary number of elements @@ -49,25 +49,25 @@ namespace Gecode { namespace Support { /// Elements on stack T* stack; /// Resize stack (increase size) - void resize(void); + void resize(); public: /// Initialize stack with \a n elements DynamicStack(A& a, int n = 64); /// Release memory - ~DynamicStack(void); + ~DynamicStack(); /// Test whether stack is empty - bool empty(void) const; + bool empty() const; /// Return number of entries currently on stack - int entries(void) const; + int entries() const; /// Pop topmost element from stack and return it - T pop(void); + T pop(); /// Return element on top of stack - T& top(void) const; + T& top() const; /// Return element that has just been popped - T& last(void) const; + T& last() const; /// Push element \a x on top of stack void push(const T& x); @@ -98,7 +98,7 @@ namespace Gecode { namespace Support { template void - DynamicStack::resize(void) { + DynamicStack::resize() { int nl = (limit * 3) / 2; stack = a.template realloc(stack, limit, nl); limit = nl; @@ -110,25 +110,25 @@ namespace Gecode { namespace Support { : a(a0), limit(n), tos(0), stack(a.template alloc(n)) {} template - forceinline DynamicStack::~DynamicStack(void) { + forceinline DynamicStack::~DynamicStack() { a.free(stack, limit); } template forceinline T - DynamicStack::pop(void) { + DynamicStack::pop() { return stack[--tos]; } template forceinline T& - DynamicStack::top(void) const { + DynamicStack::top() const { return stack[tos - 1]; } template forceinline T& - DynamicStack::last(void) const { + DynamicStack::last() const { return stack[tos]; } @@ -142,13 +142,13 @@ namespace Gecode { namespace Support { template forceinline bool - DynamicStack::empty(void) const { + DynamicStack::empty() const { return tos == 0; } template forceinline int - DynamicStack::entries(void) const { + DynamicStack::entries() const { return tos; } @@ -164,6 +164,6 @@ namespace Gecode { namespace Support { return stack[i]; } -}} // namespace Gecode::Support +} // namespace Gecode::Support // STATISTICS: support-any diff --git a/gecode/support/exception.cpp b/gecode/support/exception.cpp index 7b68be1e79..775b134d6c 100644 --- a/gecode/support/exception.cpp +++ b/gecode/support/exception.cpp @@ -51,7 +51,7 @@ namespace Gecode { li[j] = 0; } const char* - Exception::what(void) const noexcept { + Exception::what() const noexcept { return &li[0]; } @@ -59,7 +59,7 @@ namespace Gecode { * Classes for exceptions * */ - MemoryExhausted::MemoryExhausted(void) : Exception("Memory", "Heap memory exhausted") {} + MemoryExhausted::MemoryExhausted() : Exception("Memory", "Heap memory exhausted") {} DynamicCastFailed::DynamicCastFailed(const char* l) : Exception(l, "Attempt to perform dynamic_cast failed") {} diff --git a/gecode/support/exception.hpp b/gecode/support/exception.hpp index 018937d5f2..8fb5976bb3 100644 --- a/gecode/support/exception.hpp +++ b/gecode/support/exception.hpp @@ -49,7 +49,7 @@ namespace Gecode { /// Initialize with location \a l and information \a i Exception(const char* l, const char* i) noexcept; /// Return information - const char* what(void) const noexcept override; + const char* what() const noexcept override; }; /** @@ -62,7 +62,7 @@ namespace Gecode { class GECODE_SUPPORT_EXPORT MemoryExhausted : public Exception { public: /// Initialize - MemoryExhausted(void); + MemoryExhausted(); }; /// %Exception: dynamic cast failed class GECODE_SUPPORT_EXPORT DynamicCastFailed : public Exception { diff --git a/gecode/support/failpoint.cpp b/gecode/support/failpoint.cpp index d160a9b0d9..0ed46a923d 100644 --- a/gecode/support/failpoint.cpp +++ b/gecode/support/failpoint.cpp @@ -34,7 +34,7 @@ #ifdef GECODE_HAS_FAULT_INJECTION -namespace Gecode { namespace Support { namespace FailPoint { +namespace Gecode::Support::FailPoint { namespace { std::atomic fail_after_count; @@ -43,7 +43,7 @@ namespace Gecode { namespace Support { namespace FailPoint { } // namespace void - reset(void) { + reset() { active_phase.store(static_cast(Phase::DISABLED), std::memory_order_release); fail_after_count.store(0, std::memory_order_release); seen_count.store(0, std::memory_order_release); @@ -66,11 +66,11 @@ namespace Gecode { namespace Support { namespace FailPoint { } unsigned long long - count(void) { + count() { return seen_count.load(std::memory_order_acquire); } -}}} // namespace Gecode::Support::FailPoint +} // namespace Gecode::Support::FailPoint #endif diff --git a/gecode/support/failpoint.hpp b/gecode/support/failpoint.hpp index d6ee4ea0a7..9209eb6273 100644 --- a/gecode/support/failpoint.hpp +++ b/gecode/support/failpoint.hpp @@ -42,7 +42,7 @@ * dedicated isolated single-threaded fault-test executable; it is not a * supported application API and must not be used for concurrent execution. */ -namespace Gecode { namespace Support { namespace FailPoint { +namespace Gecode::Support::FailPoint { /// Named phase for deterministic test failure injection enum class Phase { @@ -59,15 +59,15 @@ namespace Gecode { namespace Support { namespace FailPoint { }; /// Reset all failpoint state - GECODE_SUPPORT_EXPORT void reset(void); + GECODE_SUPPORT_EXPORT void reset(); /// Fail after \a n successful checks for phase \a p GECODE_SUPPORT_EXPORT void fail_after(Phase p, unsigned long long n); /// Check failpoint for phase \a p GECODE_SUPPORT_EXPORT void check(Phase p); /// Number of checks observed for the configured phase - GECODE_SUPPORT_EXPORT unsigned long long count(void); + GECODE_SUPPORT_EXPORT unsigned long long count(); -}}} // namespace Gecode::Support::FailPoint +} // namespace Gecode::Support::FailPoint #endif diff --git a/gecode/support/hash.hpp b/gecode/support/hash.hpp index 4826e118a3..aee1bac595 100644 --- a/gecode/support/hash.hpp +++ b/gecode/support/hash.hpp @@ -36,7 +36,7 @@ namespace Gecode { /// Combine hash value \a h into \a seed template - void cmb_hash(std::size_t& seed, const T h); + void cmb_hash(std::size_t& seed, T h); template forceinline void diff --git a/gecode/support/heap.hpp b/gecode/support/heap.hpp index 439e2668ba..f6140bae3e 100644 --- a/gecode/support/heap.hpp +++ b/gecode/support/heap.hpp @@ -64,7 +64,7 @@ namespace Gecode { class Heap { public: /// Default constructor (ensuring that only a single instance is created) - Heap(void) = default; + Heap() = default; /// \name Typed allocation routines //@{ /** @@ -375,7 +375,7 @@ namespace Gecode { size_t _cur = 0; public: - size_t peak(void); + size_t peak(); #endif /// Allocate memory from heap (disabled) static void* operator new(size_t s) = delete; @@ -713,7 +713,7 @@ namespace Gecode { #ifdef GECODE_PEAKHEAP forceinline size_t - Heap::peak(void) { + Heap::peak() { _m.acquire(); size_t ret = _peak; _m.release(); diff --git a/gecode/support/hw-rnd.cpp b/gecode/support/hw-rnd.cpp index aee3230b2b..96d8fef26a 100644 --- a/gecode/support/hw-rnd.cpp +++ b/gecode/support/hw-rnd.cpp @@ -38,17 +38,17 @@ #include -namespace Gecode { namespace Support { +namespace Gecode::Support { unsigned int - hwrnd(void) { + hwrnd() { unsigned int r; if (rand_s(&r) != 0) throw std::runtime_error("Hardware random initialization failed"); return r; } -}} // namespace Gecode::Support +} // namespace Gecode::Support #else @@ -57,10 +57,10 @@ namespace Gecode { namespace Support { #include #include -namespace Gecode { namespace Support { +namespace Gecode::Support { unsigned int - hwrnd(void) { + hwrnd() { std::fstream devrandom; devrandom.open("/dev/random", std::fstream::in | std::fstream::binary); unsigned int rnd; @@ -71,7 +71,7 @@ namespace Gecode { namespace Support { return rnd; } -}} // namespace Gecode::Support +} // namespace Gecode::Support #endif diff --git a/gecode/support/hw-rnd.hpp b/gecode/support/hw-rnd.hpp index 34de699d6b..6eee00acd0 100644 --- a/gecode/support/hw-rnd.hpp +++ b/gecode/support/hw-rnd.hpp @@ -30,11 +30,11 @@ * */ -namespace Gecode { namespace Support { +namespace Gecode::Support { /// Return hardware generated random number - GECODE_SUPPORT_EXPORT unsigned int hwrnd(void); + GECODE_SUPPORT_EXPORT unsigned int hwrnd(); -}} // namespace Gecode::Support +} // namespace Gecode::Support // STATISTICS: support-any diff --git a/gecode/support/int-type.hpp b/gecode/support/int-type.hpp index 0c728af96b..c07590f1d0 100644 --- a/gecode/support/int-type.hpp +++ b/gecode/support/int-type.hpp @@ -36,7 +36,7 @@ #include #include -namespace Gecode { namespace Support { +namespace Gecode::Support { /** * \brief Unsigned integer for pointer encodings @@ -76,9 +76,9 @@ namespace Gecode { namespace Support { class IntTypeTraits { public: /// Corresponding unsigned type - typedef unsigned char utype; + using utype = unsigned char; /// Corresponding signed type - typedef signed char stype; + using stype = signed char; /// Minimal value static const signed char min = SCHAR_MIN; /// Maximal value @@ -91,9 +91,9 @@ namespace Gecode { namespace Support { class IntTypeTraits { public: /// Corresponding unsigned type - typedef unsigned char utype; + using utype = unsigned char; /// Corresponding signed type - typedef signed char stype; + using stype = signed char; /// Minimal value static const unsigned char min = 0; /// Maximal value @@ -106,9 +106,9 @@ namespace Gecode { namespace Support { class IntTypeTraits { public: /// Corresponding unsigned type - typedef unsigned short int utype; + using utype = unsigned short int; /// Corresponding signed type - typedef signed short int stype; + using stype = signed short int; /// Minimal value static const signed short int min = SHRT_MIN; /// Maximal value @@ -121,9 +121,9 @@ namespace Gecode { namespace Support { class IntTypeTraits { public: /// Corresponding unsigned type - typedef unsigned short int utype; + using utype = unsigned short int; /// Corresponding signed type - typedef signed short int stype; + using stype = signed short int; /// Minimal value static const unsigned short int min = 0; /// Maximal value @@ -136,9 +136,9 @@ namespace Gecode { namespace Support { class IntTypeTraits { public: /// Corresponding unsigned type - typedef unsigned int utype; + using utype = unsigned int; /// Corresponding signed type - typedef signed int stype; + using stype = signed int; /// Minimal value static const signed int min = INT_MIN; /// Maximal value @@ -151,9 +151,9 @@ namespace Gecode { namespace Support { class IntTypeTraits { public: /// Corresponding unsigned type - typedef unsigned int utype; + using utype = unsigned int; /// Corresponding signed type - typedef signed int stype; + using stype = signed int; /// Minimal value static const unsigned int min = 0; /// Maximal value @@ -166,22 +166,20 @@ namespace Gecode { namespace Support { u_type(unsigned int n) { if (n < UCHAR_MAX) return IT_CHAR; - else if (n < USHRT_MAX) + if (n < USHRT_MAX) return IT_SHORT; - else - return IT_INT; + return IT_INT; } forceinline IntType s_type(int n) { if ((n > SCHAR_MIN) && (n < SCHAR_MAX)) return IT_CHAR; - else if ((n > SHRT_MIN) && (n < SHRT_MAX)) + if ((n > SHRT_MIN) && (n < SHRT_MAX)) return IT_SHORT; - else - return IT_INT; + return IT_INT; } -}} // namespace Gecode::Support +} // namespace Gecode::Support // STATISTICS: support-any diff --git a/gecode/support/marked-pointer.hpp b/gecode/support/marked-pointer.hpp index a403334bf7..de5da18f03 100644 --- a/gecode/support/marked-pointer.hpp +++ b/gecode/support/marked-pointer.hpp @@ -33,7 +33,7 @@ #include #include -namespace Gecode { namespace Support { +namespace Gecode::Support { /// Check whether \a p is marked bool marked(void* p); @@ -87,6 +87,6 @@ namespace Gecode { namespace Support { return reinterpret_cast(reinterpret_cast(p) | static_cast(m)); } -}} // namespace Gecode::Support +} // namespace Gecode::Support // STATISTICS: support-any diff --git a/gecode/support/random.hpp b/gecode/support/random.hpp index 73983dc120..c4e5b8a930 100644 --- a/gecode/support/random.hpp +++ b/gecode/support/random.hpp @@ -42,7 +42,7 @@ #include #include -namespace Gecode { namespace Support { +namespace Gecode::Support { /** \brief Template for linear congruential generators * @@ -69,9 +69,9 @@ namespace Gecode { namespace Support { /// Construct the generator instance with seed \a s LinearCongruentialGenerator(unsigned int s = 1); /// Return current seed - unsigned int seed(void) const; + unsigned int seed() const; /// Generate next number in series - unsigned int next(void); + unsigned int next(); /// Returns a random integer from the interval \f$[0\ldots n)\f$ template Type operator()(Type n); @@ -82,11 +82,11 @@ namespace Gecode { namespace Support { /// Returns a random integer from the interval \f$[0\ldots n)\f$ long long int operator()(long long int n); /// Report size occupied - size_t size(void) const; + size_t size() const; // Interface for conforming to C++ UniformRandomBitGenerator /// Type of the produced values - typedef unsigned int result_type; + using result_type = unsigned int; /// Minimum value that may be produced when no bound is specified static constexpr result_type min() { @@ -106,7 +106,7 @@ namespace Gecode { namespace Support { template forceinline unsigned int - LinearCongruentialGenerator::next(void) { + LinearCongruentialGenerator::next() { s = a * (s % q) - r * (s / q); unsigned int res = s; if (s == 0) @@ -127,7 +127,7 @@ namespace Gecode { namespace Support { } template forceinline unsigned int - LinearCongruentialGenerator::seed(void) const { + LinearCongruentialGenerator::seed() const { return s; } @@ -179,7 +179,7 @@ namespace Gecode { namespace Support { } template forceinline size_t - LinearCongruentialGenerator::size(void) const { + LinearCongruentialGenerator::size() const { return sizeof(LinearCongruentialGenerator); } @@ -193,7 +193,7 @@ namespace Gecode { namespace Support { * * \ingroup FuncSupport */ - typedef LinearCongruentialGenerator<2147483647, 48271, 44488, 3399> LegacyRandomGenerator; + using LegacyRandomGenerator = LinearCongruentialGenerator<2147483647, 48271, 44488, 3399>; /// Parse a decimal or hexadecimal 64-bit seed without truncation. inline uint64_t @@ -256,15 +256,15 @@ namespace Gecode { namespace Support { seed(value); } static const char* - name(void) { + name() { return "splitmix-v1"; } static constexpr uint64_t - min(void) { + min() { return 0; } static constexpr uint64_t - max(void) { + max() { return UINT64_MAX; } void @@ -272,7 +272,7 @@ namespace Gecode { namespace Support { s = {{value, UINT64_C(0x9e3779b97f4a7c15)}}; } State - state(void) const { + state() const { return s; } void @@ -282,12 +282,12 @@ namespace Gecode { namespace Support { s = value; } uint64_t - next(void) { + next() { return mix(s[0] += s[1]); } SplitMix split(uint32_t alternative) const { - uint64_t first = s[0] + (2 * uint64_t(alternative) + 1) * s[1]; + uint64_t first = s[0] + (2 * static_cast(alternative) + 1) * s[1]; SplitMix child; child.s = {{mix(first), gamma(first + s[1])}}; return child; @@ -330,15 +330,15 @@ namespace Gecode { namespace Support { seed(value); } static const char* - name(void) { + name() { return "xorshift64star-v1"; } static constexpr uint64_t - min(void) { + min() { return 1; } static constexpr uint64_t - max(void) { + max() { return UINT64_MAX; } void @@ -347,7 +347,7 @@ namespace Gecode { namespace Support { s = z ? z : random_mix(UINT64_C(0x9e3779b97f4a7c15)); } State - state(void) const { + state() const { return {{s}}; } void @@ -357,13 +357,13 @@ namespace Gecode { namespace Support { s = value[0]; } uint64_t - next(void) { + next() { s = transition(s); return s * UINT64_C(2685821657736338717); } Xorshift64Star split(uint32_t alternative) const { - const uint64_t c = (2 * uint64_t(alternative) + 1) * UINT64_C(0x9e3779b97f4a7c15); + const uint64_t c = (2 * static_cast(alternative) + 1) * UINT64_C(0x9e3779b97f4a7c15); uint64_t z = s + c; Xorshift64Star child; child.s = random_mix(z ? z : c); @@ -398,22 +398,22 @@ namespace Gecode { namespace Support { public: using EngineType = Engine; - using State = typename Engine::State; + using State = Engine::State; using result_type = uint64_t; static_assert(Engine::max() == UINT64_MAX && Engine::min() <= 1, "Random engine must generate full or nonzero 64-bit words"); explicit Random(uint64_t seed = 1) : e(seed) {} explicit Random(const Engine& engine) : e(engine) {} static constexpr result_type - min(void) { + min() { return Engine::min(); } static constexpr result_type - max(void) { + max() { return Engine::max(); } static const char* - name(void) { + name() { return Engine::name(); } void @@ -421,7 +421,7 @@ namespace Gecode { namespace Support { e.seed(value); } State - state(void) const { + state() const { return e.state(); } void @@ -429,15 +429,15 @@ namespace Gecode { namespace Support { e.state(value); } result_type - next(void) { + next() { return e.next(); } result_type - operator()(void) { + operator()() { return next(); } size_t - size(void) const { + size() const { return sizeof(*this); } Random @@ -454,7 +454,7 @@ namespace Gecode { namespace Support { template Type operator()(Type bound) { - static_assert(std::is_integral::value && sizeof(Type) <= 8, + static_assert(std::is_integral_v && sizeof(Type) <= 8, "Random bound must be an integer of at most 64 bits"); if (bound <= 1) return 0; @@ -462,7 +462,7 @@ namespace Gecode { namespace Support { // Bucket size: 2^64 raw values, or 2^64-1 for nonzero engines, over n. uint64_t bucket; if (Engine::min() == 0) - bucket = (uint64_t(0) - n) / n + 1; + bucket = (UINT64_C(0) - n) / n + 1; else bucket = UINT64_MAX / n; uint64_t value; @@ -473,7 +473,7 @@ namespace Gecode { namespace Support { } /// Canonical identifier followed by fixed-width hexadecimal state words. std::string - state_string(void) const { + state_string() const { std::string text(name()); constexpr char digits[] = "0123456789abcdef"; for (uint64_t word : state()) { @@ -488,7 +488,7 @@ namespace Gecode { namespace Support { state(const std::string& text) { const std::string prefix = std::string(name()) + ':'; State words{}; - if ((text.compare(0, prefix.size(), prefix) != 0) || (text.size() != prefix.size() + 17 * words.size() - 1)) + if (!text.starts_with(prefix) || (text.size() != prefix.size() + 17 * words.size() - 1)) throw std::invalid_argument("Invalid or incompatible random state"); size_t pos = prefix.size(); for (size_t i = 0; i < words.size(); ++i) { @@ -506,6 +506,6 @@ namespace Gecode { namespace Support { /// Default generator, also used by command-line clients and tests using RandomGenerator = Random; -}} // namespace Gecode::Support +} // namespace Gecode::Support // STATISTICS: support-any diff --git a/gecode/support/ref-count.hpp b/gecode/support/ref-count.hpp index 0b37137b25..35738fed00 100644 --- a/gecode/support/ref-count.hpp +++ b/gecode/support/ref-count.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Support { +namespace Gecode::Support { /// A class for thread-safe reference counting class RefCount { @@ -44,11 +44,11 @@ namespace Gecode { namespace Support { /// Initialize RefCount(unsigned long int n); /// Increment counter - void inc(void); + void inc(); /// Decrement counter and return true if it hits zero - bool dec(void); + bool dec(); /// Test whether reference count is non-zero - operator bool(void) const; + operator bool() const; }; forceinline @@ -56,18 +56,18 @@ namespace Gecode { namespace Support { n.store(n0, std::memory_order_release); } forceinline void - RefCount::inc(void) { + RefCount::inc() { (void)n.fetch_add(1U, std::memory_order_relaxed); } forceinline bool - RefCount::dec(void) { + RefCount::dec() { return n.fetch_sub(1U, std::memory_order_acq_rel) == 1U; } forceinline RefCount:: - operator bool(void) const { + operator bool() const { return n.load(std::memory_order_acquire) > 0U; } -}} // namespace Gecode::Support +} // namespace Gecode::Support // STATISTICS: support-any diff --git a/gecode/support/run-jobs.hpp b/gecode/support/run-jobs.hpp index ff25b5a5dd..9b8b2e3b60 100644 --- a/gecode/support/run-jobs.hpp +++ b/gecode/support/run-jobs.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Support { +namespace Gecode::Support { /// Baseclass for jobs with return type \a RetType template @@ -39,7 +39,7 @@ namespace Gecode { namespace Support { /// Run a job with iterator index \a i virtual RetType run(int i) = 0; /// Destructor - virtual ~Job(void) = default; + virtual ~Job() = default; }; /// Class to throw an exception to stop new jobs from being started @@ -53,7 +53,7 @@ namespace Gecode { namespace Support { /// Constructor JobStop(RetType r0); /// Return the passed result - RetType result(void) const; + RetType result() const; }; template @@ -89,9 +89,9 @@ namespace Gecode { namespace Support { /// Initialize worker Worker(Job* j, Master* m, int i); /// Run jobs - void run(void) override; + void run() override; /// Nothing to delete (done in run) - ~Worker(void) override; + ~Worker() override; }; class Master { protected: @@ -120,19 +120,19 @@ namespace Gecode { namespace Support { /// Report that a job with index \a i has been stopped void stop(RetType r, int i); /// Test whether all jobs are done - bool done(void) const; + bool done() const; /// Initialize with job iterator \a j and maximal number of threads \a m Master(Jobs& j, unsigned int m); /// Run next job and return true if successful and assign \a r to its result bool run(RetType& r); /// Whether a job has thrown a \a JobStop exception - bool stopped(void) const; + bool stopped() const; /// Return index of first job that has thrown a \a JobStop exception (-1 if none) with its result int stopped_job(RetType& r) const; /// Whether a new thread is needed for deletion - bool needs_cleanup_thread(void); + bool needs_cleanup_thread(); /// Destructor - ~Master(void); + ~Master(); }; /// A class to delete the master (running in parallel) class Deleter : public Runnable { @@ -144,7 +144,7 @@ namespace Gecode { namespace Support { /// Initialize with master \a m Deleter(Master* m); /// Perform deletion - void run(void) override; + void run() override; }; /// The actual master Master* master; @@ -157,7 +157,7 @@ namespace Gecode { namespace Support { /// Whether a job has thrown a \a JobStop exception with index \a i and result \a r bool stopped(int& i, RetType& r) const; /// Destructor - ~RunJobs(void); + ~RunJobs(); }; template @@ -167,7 +167,7 @@ namespace Gecode { namespace Support { template forceinline RetType - JobStop::result(void) const { + JobStop::result() const { return r; } @@ -177,7 +177,7 @@ namespace Gecode { namespace Support { : Runnable(true), job(j), master(m), idx(i) {} template - RunJobs::Worker::~Worker(void) = default; + RunJobs::Worker::~Worker() = default; template inline int @@ -188,7 +188,7 @@ namespace Gecode { namespace Support { template inline bool - RunJobs::Master::stopped(void) const { + RunJobs::Master::stopped() const { return sidx >= 0; } @@ -233,7 +233,7 @@ namespace Gecode { namespace Support { template void - RunJobs::Worker::run(void) { + RunJobs::Worker::run() { do { try { RetType r = job->run(idx); @@ -248,7 +248,7 @@ namespace Gecode { namespace Support { template forceinline bool - RunJobs::Master::done(void) const { + RunJobs::Master::done() const { return (n_threads == 0) && (!jobs() || stopped()) && rs.empty(); } @@ -299,7 +299,7 @@ namespace Gecode { namespace Support { template inline bool - RunJobs::Master::needs_cleanup_thread(void) { + RunJobs::Master::needs_cleanup_thread() { bool n; m.acquire(); while (!rs.empty()) @@ -311,7 +311,7 @@ namespace Gecode { namespace Support { } template - inline RunJobs::Master::~Master(void) { + inline RunJobs::Master::~Master() { sidx = 0; RetType r; while (run(r)) @@ -325,7 +325,7 @@ namespace Gecode { namespace Support { template void - RunJobs::Deleter::run(void) { + RunJobs::Deleter::run() { delete master; } @@ -346,13 +346,13 @@ namespace Gecode { namespace Support { } template - inline RunJobs::~RunJobs(void) { + inline RunJobs::~RunJobs() { if (!master->needs_cleanup_thread()) delete master; else Thread::run(new Deleter(master)); } -}} // namespace Gecode::Support +} // namespace Gecode::Support // STATISTICS: support-any diff --git a/gecode/support/sort.hpp b/gecode/support/sort.hpp index d7fa1b181a..9daab1318e 100644 --- a/gecode/support/sort.hpp +++ b/gecode/support/sort.hpp @@ -33,7 +33,7 @@ #include #include -namespace Gecode { namespace Support { +namespace Gecode::Support { /// Exchange elements according to order template @@ -59,9 +59,9 @@ namespace Gecode { namespace Support { public: /// Initialize stack as empty - QuickSortStack(void); + QuickSortStack(); /// Test whether stack is empty - bool empty(void) const; + bool empty() const; /// Push two positions \a l and \a r void push(Type* l, Type* r); /// Pop two positions \a l and \a r @@ -70,14 +70,14 @@ namespace Gecode { namespace Support { template forceinline - QuickSortStack::QuickSortStack(void) + QuickSortStack::QuickSortStack() : tos(&stack[0]) { *(tos++) = nullptr; } template forceinline bool - QuickSortStack::empty(void) const { + QuickSortStack::empty() const { return *(tos - 1) == nullptr; } @@ -275,6 +275,6 @@ namespace Gecode { namespace Support { insertion(x, x + n - 1, l); } -}} // namespace Gecode::Support +} // namespace Gecode::Support // STATISTICS: support-any diff --git a/gecode/support/static-stack.hpp b/gecode/support/static-stack.hpp index efeb8aa4e3..8a61ff4588 100644 --- a/gecode/support/static-stack.hpp +++ b/gecode/support/static-stack.hpp @@ -30,7 +30,9 @@ * */ -namespace Gecode { namespace Support { +#include + +namespace Gecode::Support { /** * \brief Stack with fixed number of elements @@ -53,21 +55,21 @@ namespace Gecode { namespace Support { /// Initialize for \a n elements StaticStack(A& a, int n); /// Release memory - ~StaticStack(void); + ~StaticStack(); /// Reset stack (pop all elements) - void reset(void); + void reset(); /// Test whether stack is empty - bool empty(void) const; + bool empty() const; /// Return number of entries currently on stack - int entries(void) const; + int entries() const; /// Pop topmost element from stack and return it - T pop(void); + T pop(); /// Return element on top of stack - T& top(void) const; + T& top() const; /// Return element that has just been popped - T& last(void) const; + T& last() const; /// Push element \a x on top of stack void push(const T& x); @@ -87,56 +89,56 @@ namespace Gecode { namespace Support { : a(a0), n(n0), tos(0), stack(a.template alloc(n)) {} template - forceinline StaticStack::~StaticStack(void) { + forceinline StaticStack::~StaticStack() { a.free(stack, n); } template forceinline bool - StaticStack::empty(void) const { + StaticStack::empty() const { return tos == 0; } template forceinline int - StaticStack::entries(void) const { + StaticStack::entries() const { return tos; } template forceinline void - StaticStack::reset(void) { + StaticStack::reset() { tos = 0; } template forceinline T - StaticStack::pop(void) { - assert((tos > 0) && (tos <= static_cast(n))); + StaticStack::pop() { + assert((tos > 0) && std::cmp_less_equal(tos, n)); return stack[--tos]; } template forceinline T& - StaticStack::top(void) const { - assert((tos > 0) && (tos <= static_cast(n))); + StaticStack::top() const { + assert((tos > 0) && std::cmp_less_equal(tos, n)); return stack[tos - 1]; } template forceinline T& - StaticStack::last(void) const { - assert((tos >= 0) && (tos < static_cast(n))); + StaticStack::last() const { + assert((tos >= 0) && std::cmp_less(tos, n)); return stack[tos]; } template forceinline void StaticStack::push(const T& x) { - assert(tos < static_cast(n)); + assert(std::cmp_less(tos, n)); stack[tos++] = x; } -}} // namespace Gecode::Support +} // namespace Gecode::Support // STATISTICS: support-any diff --git a/gecode/support/thread.hpp b/gecode/support/thread.hpp index b6b5cb495e..1bf8b020b5 100644 --- a/gecode/support/thread.hpp +++ b/gecode/support/thread.hpp @@ -63,7 +63,7 @@ * \ingroup FuncSupport */ -namespace Gecode { namespace Support { +namespace Gecode::Support { /** * \brief A mutex for mutual exclausion among several threads @@ -87,13 +87,13 @@ namespace Gecode { namespace Support { #endif public: /// Initialize mutex - Mutex(void); + Mutex(); /// Acquire the mutex and possibly block - void acquire(void); + void acquire(); /// Try to acquire the mutex, return true if successful - bool try_acquire(void); + bool try_acquire(); /// Release the mutex - void release(void); + void release(); /// Allocate memory from heap static void* operator new(size_t s); /// Free memory allocated from heap @@ -119,7 +119,7 @@ namespace Gecode { namespace Support { /// Enter lock Lock(Mutex& m0); /// Leave lock - ~Lock(void); + ~Lock(); /// A lock cannot be copied Lock(const Lock&) = delete; @@ -148,11 +148,11 @@ namespace Gecode { namespace Support { public: /// Initialize event - Event(void); + Event(); /// Signal the event - void signal(void); + void signal(); /// Wait until the event becomes signalled - void wait(void); + void wait(); /// An event cannot be copied Event(const Event&) = delete; @@ -171,7 +171,7 @@ namespace Gecode { namespace Support { /// Destructor virtual ~Terminator() = default; /// The function that is called when the thread has terminated - virtual void terminated(void) = 0; + virtual void terminated() = 0; }; /** @@ -190,16 +190,16 @@ namespace Gecode { namespace Support { /// Set whether to delete upon termination void delete_after_run(bool d); /// Return whether to be deleted upon termination - bool delete_after_run(void) const; + bool delete_after_run() const; /// Return terminator object virtual Terminator* - terminator(void) const { + terminator() const { return nullptr; } /// The function that is executed when the thread starts - virtual void run(void) = 0; + virtual void run() = 0; /// Destructor - virtual ~Runnable(void) = default; + virtual ~Runnable() = default; /// Allocate memory from heap static void* operator new(size_t s); /// Free memory allocated from heap @@ -229,7 +229,7 @@ namespace Gecode { namespace Support { /// Create a new thread GECODE_SUPPORT_EXPORT Run(Runnable* r); /// Infinite loop for execution - GECODE_SUPPORT_EXPORT void exec(void); + GECODE_SUPPORT_EXPORT void exec(); /// Run a runnable object void run(Runnable* r); /// Allocate memory from heap @@ -238,11 +238,10 @@ namespace Gecode { namespace Support { static void operator delete(void* p); }; /// Mutex for synchronization - GECODE_SUPPORT_EXPORT static Mutex* m(void); + GECODE_SUPPORT_EXPORT static Mutex* m(); /// Idle runners GECODE_SUPPORT_EXPORT static Run* idle; - public: /** * \brief Construct a new thread and run \a r * @@ -256,7 +255,7 @@ namespace Gecode { namespace Support { /// Put current thread to sleep for \a ms milliseconds static void sleep(unsigned int ms); /// Return number of processing units (1 if information not available) - static unsigned int npu(void); + static unsigned int npu(); /// acquire mutex \a m globally and possibly lock GECODE_SUPPORT_EXPORT static void acquire_global_mutex(Mutex* m); /// release globally acquired mutex \a m @@ -268,6 +267,6 @@ namespace Gecode { namespace Support { Thread& operator=(const Thread&) = delete; }; -}} // namespace Gecode::Support +} // namespace Gecode::Support // STATISTICS: support-any diff --git a/gecode/support/thread/thread.cpp b/gecode/support/thread/thread.cpp index 4ed88ba1ff..0af4cc2419 100644 --- a/gecode/support/thread/thread.cpp +++ b/gecode/support/thread/thread.cpp @@ -36,14 +36,14 @@ #include -namespace Gecode { namespace Support { +namespace Gecode::Support { /* * Threads */ Mutex* - Thread::m(void) { + Thread::m() { static Mutex* m = new Mutex; return m; } @@ -51,7 +51,7 @@ namespace Gecode { namespace Support { Thread::Run* Thread::idle = nullptr; void - Thread::Run::exec(void) { + Thread::Run::exec() { while (true) { // Execute runnable { @@ -99,9 +99,9 @@ namespace Gecode { namespace Support { Mutex* _to_release; public: - GlobalMutexRunnable(void) : _to_acquire(nullptr), _to_release(nullptr) {} + GlobalMutexRunnable() : _to_acquire(nullptr), _to_release(nullptr) {} void - run(void) override { + run() override { while (true) { _m.acquire(); if (_to_acquire) { @@ -142,13 +142,13 @@ namespace Gecode { namespace Support { class GlobalMutexRunnableInit { public: GlobalMutexRunnable* gmr; - GlobalMutexRunnableInit(void) : gmr(new GlobalMutexRunnable) { + GlobalMutexRunnableInit() : gmr(new GlobalMutexRunnable) { Thread::run(gmr); } }; GlobalMutexRunnable& - global_mutex_runnable(void) { + global_mutex_runnable() { static GlobalMutexRunnableInit gmri; return *gmri.gmr; } @@ -164,6 +164,6 @@ namespace Gecode { namespace Support { global_mutex_runnable().release(m); } -}} // namespace Gecode::Support +} // namespace Gecode::Support // STATISTICS: support-any diff --git a/gecode/support/thread/thread.hpp b/gecode/support/thread/thread.hpp index 628ad2658b..ac280acb7a 100644 --- a/gecode/support/thread/thread.hpp +++ b/gecode/support/thread/thread.hpp @@ -30,7 +30,7 @@ * */ -namespace Gecode { namespace Support { +namespace Gecode::Support { /* * Runnable objects @@ -43,7 +43,7 @@ namespace Gecode { namespace Support { d = d0; } forceinline bool - Runnable::delete_after_run(void) const { + Runnable::delete_after_run() const { return d; } forceinline void @@ -60,13 +60,13 @@ namespace Gecode { namespace Support { * */ forceinline - Mutex::Mutex(void) { + Mutex::Mutex() { #if defined(GECODE_HAS_THREADS) && defined(GECODE_USE_OSX_UNFAIR_MUTEX) l = OS_UNFAIR_LOCK_INIT; #endif } forceinline void - Mutex::acquire(void) { + Mutex::acquire() { #ifdef GECODE_HAS_THREADS #ifndef GECODE_USE_OSX_UNFAIR_MUTEX m.lock(); @@ -77,7 +77,7 @@ namespace Gecode { namespace Support { } forceinline bool - Mutex::try_acquire(void) { + Mutex::try_acquire() { #ifdef GECODE_HAS_THREADS #ifndef GECODE_USE_OSX_UNFAIR_MUTEX return m.try_lock(); @@ -90,7 +90,7 @@ namespace Gecode { namespace Support { } forceinline void - Mutex::release(void) { + Mutex::release() { #ifdef GECODE_HAS_THREADS #ifndef GECODE_USE_OSX_UNFAIR_MUTEX m.unlock(); @@ -118,7 +118,7 @@ namespace Gecode { namespace Support { : m(m0) { m.acquire(); } - forceinline Lock::~Lock(void) { + forceinline Lock::~Lock() { m.release(); } @@ -126,10 +126,10 @@ namespace Gecode { namespace Support { * Events */ forceinline - Event::Event(void) + Event::Event() : s(false) {} forceinline void - Event::signal(void) { + Event::signal() { #ifdef GECODE_HAS_THREADS std::unique_lock l(m); if (!s) { @@ -139,7 +139,7 @@ namespace Gecode { namespace Support { #endif } forceinline void - Event::wait(void) { + Event::wait() { #ifdef GECODE_HAS_THREADS std::unique_lock l(m); c.wait(l, [this] { return this->s; }); @@ -159,7 +159,7 @@ namespace Gecode { namespace Support { #endif } forceinline unsigned int - Thread::npu(void) { + Thread::npu() { #ifdef GECODE_HAS_THREADS return std::thread::hardware_concurrency(); #else @@ -193,6 +193,6 @@ namespace Gecode { namespace Support { return heap.ralloc(s); } -}} // namespace Gecode::Support +} // namespace Gecode::Support // STATISTICS: support-any diff --git a/gecode/support/timer.hpp b/gecode/support/timer.hpp index 58b6282444..d9f7611b85 100644 --- a/gecode/support/timer.hpp +++ b/gecode/support/timer.hpp @@ -32,7 +32,7 @@ #include -namespace Gecode { namespace Support { +namespace Gecode::Support { /** \brief %Timer * @@ -48,22 +48,22 @@ namespace Gecode { namespace Support { public: /// Start timer - void start(void); + void start(); /// Get time since start of timer - double stop(void); + double stop(); }; inline void - Timer::start(void) { + Timer::start() { t0 = std::chrono::steady_clock::now(); } inline double - Timer::stop(void) { + Timer::stop() { std::chrono::duration duration = std::chrono::steady_clock::now() - t0; return duration.count(); } -}} // namespace Gecode::Support +} // namespace Gecode::Support // STATISTICS: support-any diff --git a/misc/genvarimp.py b/misc/genvarimp.py index 48d061da0d..f07c4046a2 100644 --- a/misc/genvarimp.py +++ b/misc/genvarimp.py @@ -304,14 +304,8 @@ def parse_vis_file(path: str) -> Dict: data["conf"] = f"{data['name']}VarImpConf" data["base"] = f"Gecode::VarImp<{data['namespace']}::{data['conf']}>" - hdr = "" - ftr = "" - for ns in data["namespace"].split("::"): - hdr = f"{hdr}namespace {ns} {{ " - ftr = f"{ftr}}}" - hdr = re.sub(r" $", "", hdr) - data["hdr"] = hdr + "\n" - data["ftr"] = ftr + "\n" + data["hdr"] = f"namespace {data['namespace']} {{\n" + data["ftr"] = "}\n" me_n = len(data["men"]) if me_n == 3: @@ -593,13 +587,14 @@ def generate_typehpp(files: List[Dict], out: List[str]) -> None: out.append(" {\n") if d["me_max_n"] <= 8: out.append(" static const Gecode::ModEvent me_c = (\n") + terms = [] for j, n2 in enumerate(d["val2me"]): n3 = d["mec"][n1][n2] - shift = j << 2 - shift_s = f" {shift}" if shift < 10 else f"{shift}" - out.append(f" (({d['me_a'][n2]} ^ {d['me_a'][n3]}) << {shift_s})") - if j + 1 != d["me_max_n"]: - out.append(" |\n") + if d["me_a"][n2] != d["me_a"][n3]: + shift = j << 2 + shift_s = f" {shift}" if shift < 10 else f"{shift}" + terms.append(f" (({d['me_a'][n2]} ^ {d['me_a'][n3]}) << {shift_s})") + out.append(" |\n".join(terms) if terms else " 0") out.append("\n );\n") out.append(" Gecode::ModEvent me_o = (med & med_mask) >> med_fst;\n") out.append(" Gecode::ModEvent me_n = (me_c >> (me_o << 2)) & (med_mask >> med_fst);\n") @@ -611,7 +606,10 @@ def generate_typehpp(files: List[Dict], out: List[str]) -> None: out.append(f" static const Gecode::ModEventDelta me_c[{d['me_max']}] = {{\n") for j, n2 in enumerate(d["val2me"]): n3 = d["mec"][n1][n2] - out.append(f" ({d['me_a'][n2]} ^ {d['me_a'][n3]}) << med_fst") + if d["me_a"][n2] == d["me_a"][n3]: + out.append(" 0") + else: + out.append(f" ({d['me_a'][n2]} ^ {d['me_a'][n3]}) << med_fst") if j + 1 != d["me_max_n"]: out.append(",\n") out.append("\n };\n") @@ -664,7 +662,7 @@ def generate_header(files: List[Dict], out: List[str]) -> None: {d['class']}(Gecode::Space& home, {d['class']}& x); public: /// Constructor for creating static instance of variable - {d['class']}(void) = default; + {d['class']}() = default; /// Constructor for creating variable {d['class']}(Gecode::Space& home); /// \\name Dependencies @@ -704,7 +702,7 @@ def generate_header(files: List[Dict], out: List[str]) -> None: if d["dispose"]: out.append( f""" /// Return link to next variable to be disposed - {d['class']}* next_d(void) const; + {d['class']}* next_d() const; """ ) @@ -732,7 +730,7 @@ def generate_header(files: List[Dict], out: List[str]) -> None: }} forceinline {d['class']}* - {d['class']}::next_d(void) const {{ + {d['class']}::next_d() const {{ return _next_d; }} @@ -862,7 +860,7 @@ def generate_header(files: List[Dict], out: List[str]) -> None: """namespace Gecode { forceinline void - Space::recover_noidx(void) { + Space::recover_noidx() { VarImp* x = static_cast*>(pc.c.vars_noidx); while (x != nullptr) { @@ -890,8 +888,7 @@ def generate_header(files: List[Dict], out: List[str]) -> None: forceinline void Space::recover(Space& source) { ActorLink* clone_lists[2] = {&pl, &bl}; - for (int i=0; i<2; i++) { - ActorLink* l = clone_lists[i]; + for (auto* l : clone_lists) { ActorLink* c = l->next(); while (c != l) { ActorLink* n = c->next(); diff --git a/test/afc.cpp b/test/afc.cpp index 3640c046e2..e123e18e96 100644 --- a/test/afc.cpp +++ b/test/afc.cpp @@ -36,6 +36,7 @@ #include "test/test.hh" #include +#include namespace Test { @@ -50,7 +51,7 @@ namespace Test { public: /// Constructor for creation - TestSpace(void) : x(*this, 0, 10), y(*this, 0, 10) {} + TestSpace() : x(*this, 0, 10), y(*this, 0, 10) {} /// Constructor for cloning \a s TestSpace(TestSpace& s) : Space(s) { x.update(*this, s.x); @@ -58,12 +59,12 @@ namespace Test { } /// Post arbitrary propagator void - post(void) { + post() { Gecode::rel(*this, x, Gecode::IRT_LT, y); } /// Copy during cloning Space* - copy(void) override { + copy() override { return new TestSpace(*this); } }; @@ -81,16 +82,16 @@ namespace Test { } /// Return random index int - index(void) { + index() { return _rand(n); } public: /// Initialize test - AFC(void) : Test::Base("AFC") {} + AFC() : Test::Base("AFC") {} /// Perform actual tests bool - run(void) override { + run() override { // Array of spaces for tests TestSpace* s[n]; // How many spaces exist in s @@ -151,14 +152,14 @@ namespace Test { public: Gecode::IntVar x, y; Gecode::BoolVar b; - TestSpace(void) : x(*this, 0, 10), y(*this, 0, 10), b(*this, 0, 1) {} + TestSpace() : x(*this, 0, 10), y(*this, 0, 10), b(*this, 0, 1) {} TestSpace(TestSpace& s) : Space(s) { x.update(*this, s.x); y.update(*this, s.y); b.update(*this, s.b); } Space* - copy(void) override { + copy() override { return new TestSpace(*this); } /// Find a surviving propagator by its identifier @@ -184,7 +185,7 @@ namespace Test { /// Check nesting, unwinding, isolation, and posting in a clone bool - scopes(void) { + scopes() { using namespace Gecode; TestSpace s, other; if (s.post().afc() != 1.0) @@ -197,8 +198,9 @@ namespace Test { Space::NoGPI inner(s); if (s.post().afc() != 0.0) return false; - throw 1; - } catch (int) { + throw std::logic_error("Expected"); + } catch (const std::logic_error&) { + // Expected } if (s.post().afc() != 0.0) return false; @@ -220,8 +222,9 @@ namespace Test { Space::UseGPI use(s); if (s.post().afc() != 1.0) return false; - throw 1; - } catch (int) { + throw std::logic_error("Expected"); + } catch (const std::logic_error&) { + // Expected } if (s.post().afc() != 0.0) return false; @@ -232,17 +235,18 @@ namespace Test { } try { Space::NoGPI context(s); - throw 1; - } catch (int) { + throw std::logic_error("Expected"); + } catch (const std::logic_error&) { + // Expected } return s.post().afc() == 1.0; } /// Check local groups, disabled pointer tags, and lifetime after cloning bool - lifetime(void) { + lifetime() { using namespace Gecode; - std::unique_ptr s(new TestSpace); + std::unique_ptr s = std::make_unique(); PropagatorGroup a, b; unsigned int id; { @@ -330,9 +334,9 @@ namespace Test { } public: - NoGPI(void) : Test::Base("AFC::NoGPI") {} + NoGPI() : Test::Base("AFC::NoGPI") {} bool - run(void) override { + run() override { return scopes() && lifetime() && failure(false) && failure(true) && rewrite(false) && rewrite(true); } }; diff --git a/test/array.cpp b/test/array.cpp index 7c570c2700..31e036af59 100644 --- a/test/array.cpp +++ b/test/array.cpp @@ -147,9 +147,9 @@ namespace Test { START_TEST("Iteration"); { - typedef typename Array::reference reference; - typedef typename Array::pointer pointer; - typedef typename Array::iterator iterator; + using reference = Array::reference; + using pointer = Array::pointer; + using iterator = Array::iterator; const iterator begin = a.begin(), end = a.end(); CHECK_TEST(end - begin == a.size(), "Distance != size"); int index = 0; @@ -169,9 +169,9 @@ namespace Test { } START_TEST("Read-only iteration"); { - typedef typename Array::const_reference reference; - typedef typename Array::const_pointer pointer; - typedef typename Array::const_iterator iterator; + using reference = Array::const_reference; + using pointer = Array::const_pointer; + using iterator = Array::const_iterator; const iterator begin = const_a.begin(), end = const_a.end(); CHECK_TEST(end - begin == const_a.size(), "Distance != size"); int index = 0; @@ -194,9 +194,9 @@ namespace Test { START_TEST("Reverse iteration"); { - typedef typename Array::reference reference; - typedef typename Array::pointer pointer; - typedef typename Array::reverse_iterator iterator; + using reference = Array::reference; + using pointer = Array::pointer; + using iterator = Array::reverse_iterator; const iterator begin = a.rbegin(), end = a.rend(); CHECK_TEST(end - begin == a.size(), "Distance != size"); int index = a.size(); @@ -217,9 +217,9 @@ namespace Test { START_TEST("Reverse read-only iteration"); { - typedef typename Array::const_reference reference; - typedef typename Array::const_pointer pointer; - typedef typename Array::const_reverse_iterator iterator; + using reference = Array::const_reference; + using pointer = Array::const_pointer; + using iterator = Array::const_reverse_iterator; const iterator begin = const_a.rbegin(), end = const_a.rend(); CHECK_TEST(end - begin == const_a.size(), "Distance != size"); int index = a.size(); @@ -251,11 +251,11 @@ namespace Test { /// Test space class TestSpace : public Gecode::Space { public: - TestSpace(void) : Space() {} + TestSpace() = default; // NOLINTNEXTLINE(modernize-use-equals-default) TestSpace(TestSpace& s) : Space(s) {} Space* - copy(void) override { + copy() override { return new TestSpace(*this); } }; @@ -267,10 +267,10 @@ namespace Test { class EmptyVector : public Test::Base { public: /// Initialize test - EmptyVector(void) : Test::Base(vector_prefix + "Empty") {} + EmptyVector() : Test::Base(vector_prefix + "Empty") {} /// Perform actual tests bool - run(void) override { + run() override { std::vector ints; Gecode::IntArgs ia(ints); if (ia.size() != 0) @@ -293,14 +293,14 @@ namespace Test { /// Maximum array size static const int n = 16; /// Array type being tested - typedef Gecode::VarArray Array; + using Array = Gecode::VarArray; public: /// Initialize test - VarArrayIterator(void) : Iterator("VarArray") {} + VarArrayIterator() : Iterator("VarArray") {} /// Perform actual tests bool - run(void) override { + run() override { // Space for the test TestSpace s; // VarArray for the test @@ -316,14 +316,14 @@ namespace Test { /// Maximum array size static const int n = 16; /// Array type being tested - typedef Gecode::ArgArrayBase Array; + using Array = Gecode::ArgArrayBase; public: /// Initialize test - VarArgsIterator(void) : Iterator("VarArgs") {} + VarArgsIterator() : Iterator("VarArgs") {} /// Perform actual tests bool - run(void) override { + run() override { // Space for the test TestSpace s; // VarArray for the test @@ -339,14 +339,14 @@ namespace Test { /// Maximum array size static const int n = 16; /// Array type being tested - typedef Gecode::ViewArray Array; + using Array = Gecode::ViewArray; public: /// Initialize test - ViewArrayIterator(void) : Iterator("ViewArray") {} + ViewArrayIterator() : Iterator("ViewArray") {} /// Perform actual tests bool - run(void) override { + run() override { // Space for the test TestSpace s; // VarArray for the test @@ -362,14 +362,14 @@ namespace Test { /// Maximum array size static const int n = 16; /// Array type being tested - typedef Gecode::SharedArray Array; + using Array = Gecode::SharedArray; public: /// Initialize test - SharedArrayIterator(void) : Iterator("SharedArray") {} + SharedArrayIterator() : Iterator("SharedArray") {} /// Perform actual tests bool - run(void) override { + run() override { // SharedArray for the test Array a(_rand(n)); // Run the iterator test @@ -394,10 +394,10 @@ namespace Test { class SharedDataCopyOnly : public Test::Base { public: /// Initialize test - SharedDataCopyOnly(void) : Test::Base("Array::SharedData::CopyOnly") {} + SharedDataCopyOnly() : Test::Base("Array::SharedData::CopyOnly") {} /// Perform actual tests bool - run(void) override { + run() override { // A temporary must bind to the copying constructor Gecode::SharedData d(CopyOnlyData(3)); return d().value == 3; diff --git a/test/assign.cpp b/test/assign.cpp index c54837eeb9..0f59233ea3 100644 --- a/test/assign.cpp +++ b/test/assign.cpp @@ -38,7 +38,7 @@ #include -namespace Test { namespace Assign { +namespace Test::Assign { /// Space for executing integer tests class IntTestSpace : public Gecode::Space { @@ -53,7 +53,7 @@ namespace Test { namespace Assign { } /// Copy space during cloning Gecode::Space* - copy(void) override { + copy() override { return new IntTestSpace(*this); } }; @@ -71,7 +71,7 @@ namespace Test { namespace Assign { } /// Copy space during cloning Gecode::Space* - copy(void) override { + copy() override { return new BoolTestSpace(*this); } }; @@ -91,7 +91,7 @@ namespace Test { namespace Assign { } /// Copy space during cloning Gecode::Space* - copy(void) override { + copy() override { return new SetTestSpace(*this); } }; @@ -113,7 +113,7 @@ namespace Test { namespace Assign { } /// Copy space during cloning Gecode::Space* - copy(void) override { + copy() override { return new FloatTestSpace(*this); } }; @@ -131,7 +131,7 @@ namespace Test { namespace Assign { /// Number of integer value selections const int n_int_assign = sizeof(int_assign_name) / sizeof(const char*); /// Test function for branch value function - int + static int int_val(const Gecode::Space&, Gecode::IntVar x, int) { return x.min(); } @@ -147,7 +147,7 @@ namespace Test { namespace Assign { /// Number of integer value selections const int n_bool_assign = sizeof(bool_assign_name) / sizeof(const char*); /// Test function for branch value function - int + static int bool_val(const Gecode::Space&, Gecode::BoolVar x, int) { return x.min(); } @@ -157,7 +157,7 @@ namespace Test { namespace Assign { : Base("Int::Assign::" + s), arity(a), dom(d) {} bool - IntTest::run(void) { + IntTest::run() { using namespace Gecode; IntTestSpace* root = new IntTestSpace(arity, dom); post(*root, root->x); @@ -217,7 +217,7 @@ namespace Test { namespace Assign { BoolTest::BoolTest(const std::string& s, int a) : Base("Bool::Assign::" + s), arity(a) {} bool - BoolTest::run(void) { + BoolTest::run() { using namespace Gecode; BoolTestSpace* root = new BoolTestSpace(arity); post(*root, root->x); @@ -284,7 +284,7 @@ namespace Test { namespace Assign { /// Number of set value selections const int n_set_assign = sizeof(set_assign_name) / sizeof(const char*); /// Test function for branch value function - int + static int set_val(const Gecode::Space&, Gecode::SetVar x, int) { Gecode::SetVarUnknownRanges r(x); return r.min(); @@ -295,7 +295,7 @@ namespace Test { namespace Assign { : Base("Set::Assign::" + s), arity(a), dom(d) {} bool - SetTest::run(void) { + SetTest::run() { using namespace Gecode; SetTestSpace* root = new SetTestSpace(arity, dom); post(*root, root->x); @@ -379,7 +379,7 @@ namespace Test { namespace Assign { /// Number of float value selections const int n_float_assign = sizeof(float_assign_name) / sizeof(const char*); /// Test function for branch value function - Gecode::FloatNumBranch + static Gecode::FloatNumBranch float_val(const Gecode::Space&, Gecode::FloatVar x, int) { Gecode::FloatNumBranch nl; nl.n = x.med(); @@ -392,7 +392,7 @@ namespace Test { namespace Assign { : Base("Float::Assign::" + s), arity(a), dom(d) {} bool - FloatTest::run(void) { + FloatTest::run() { using namespace Gecode; FloatTestSpace* root = new FloatTestSpace(arity, dom); post(*root, root->x); @@ -449,6 +449,6 @@ namespace Test { namespace Assign { #endif -}} // namespace Test::Assign +} // namespace Test::Assign // STATISTICS: test-branch diff --git a/test/assign.hh b/test/assign.hh index 31ee6ccf60..b664ae940f 100644 --- a/test/assign.hh +++ b/test/assign.hh @@ -48,100 +48,96 @@ #include "test/test.hh" -namespace Test { - - /// Tests for assignments - namespace Assign { - - /** - * \brief %Base class for tests for assigning integer variables - * - */ - class IntTest : public Base { - protected: - /// Number of variables - int arity; - /// Domain of variables - Gecode::IntSet dom; - - public: - /// Construct and register test - IntTest(const std::string& s, int a, const Gecode::IntSet& d); - /// Perform test - bool run(void) override; - /// Post assignment on variables \a x - virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) = 0; - }; - - /** - * \brief %Base class for tests for branching on Boolean variables - * - */ - class BoolTest : public Base { - protected: - /// Number of variables - int arity; - - public: - /// Construct and register test - BoolTest(const std::string& s, int a); - /// Perform test - bool run(void) override; - /// Post assignment on variables \a x - virtual void post(Gecode::Space& home, Gecode::BoolVarArray& x) = 0; - }; +/// Tests for assignments +namespace Test::Assign { + + /** + * \brief %Base class for tests for assigning integer variables + * + */ + class IntTest : public Base { + protected: + /// Number of variables + int arity; + /// Domain of variables + Gecode::IntSet dom; + + public: + /// Construct and register test + IntTest(const std::string& s, int a, const Gecode::IntSet& d); + /// Perform test + bool run() override; + /// Post assignment on variables \a x + virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) = 0; + }; + + /** + * \brief %Base class for tests for branching on Boolean variables + * + */ + class BoolTest : public Base { + protected: + /// Number of variables + int arity; + + public: + /// Construct and register test + BoolTest(const std::string& s, int a); + /// Perform test + bool run() override; + /// Post assignment on variables \a x + virtual void post(Gecode::Space& home, Gecode::BoolVarArray& x) = 0; + }; #ifdef GECODE_HAS_SET_VARS - /** - * \brief %Base class for tests for branching on set variables - * - */ - class SetTest : public Base { - protected: - /// Number of variables - int arity; - /// Upper bound of variable domains - Gecode::IntSet dom; - - public: - /// Construct and register test - SetTest(const std::string& s, int a, const Gecode::IntSet& d); - /// Perform test - bool run(void) override; - /// Post assignment on variables \a x - virtual void post(Gecode::Space& home, Gecode::SetVarArray& x) = 0; - }; + /** + * \brief %Base class for tests for branching on set variables + * + */ + class SetTest : public Base { + protected: + /// Number of variables + int arity; + /// Upper bound of variable domains + Gecode::IntSet dom; + + public: + /// Construct and register test + SetTest(const std::string& s, int a, const Gecode::IntSet& d); + /// Perform test + bool run() override; + /// Post assignment on variables \a x + virtual void post(Gecode::Space& home, Gecode::SetVarArray& x) = 0; + }; #endif #ifdef GECODE_HAS_FLOAT_VARS - /** - * \brief %Base class for tests for branching on float variables - * - */ - class FloatTest : public Base { - protected: - /// Number of variables - int arity; - /// Domain of variables - Gecode::FloatVal dom; - - public: - /// Construct and register test - FloatTest(const std::string& s, int a, const Gecode::FloatVal& d); - /// Perform test - bool run(void) override; - /// Post assignment on variables \a x - virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) = 0; - }; + /** + * \brief %Base class for tests for branching on float variables + * + */ + class FloatTest : public Base { + protected: + /// Number of variables + int arity; + /// Domain of variables + Gecode::FloatVal dom; + + public: + /// Construct and register test + FloatTest(const std::string& s, int a, const Gecode::FloatVal& d); + /// Perform test + bool run() override; + /// Post assignment on variables \a x + virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) = 0; + }; #endif - } // namespace Assign - -} // namespace Test +} // namespace Test::Assign #endif diff --git a/test/assign/bool.cpp b/test/assign/bool.cpp index 2510b2e0c9..97ce5b8503 100644 --- a/test/assign/bool.cpp +++ b/test/assign/bool.cpp @@ -36,7 +36,7 @@ #include -namespace Test { namespace Assign { +namespace Test::Assign { /// %Test branching with distinct propagator class Bool : public BoolTest { @@ -56,19 +56,19 @@ namespace Test { namespace Assign { /// Merit that prefers the variable at position \a p template - double + static double bool_merit_at(const Gecode::Space&, Gecode::BoolVar, int i) { return (i == p) ? 1.0 : 0.0; } /// Filter that accepts every variable - bool + static bool bool_accept(const Gecode::Space&, Gecode::BoolVar, int) { return true; } /// Print function that prints nothing - void + static void bool_print_nothing(const Gecode::Space&, const Gecode::Brancher&, unsigned int, Gecode::BoolVar, int, const int&, std::ostream&) {} @@ -87,13 +87,13 @@ namespace Test { namespace Assign { } /// Copy space during cloning Gecode::Space* - copy(void) override { + copy() override { return new BoolOrderSpace(*this); } }; /// Whether assigning one first in \a s sets exactly the last \a n variables - bool + static bool assigned_last_first(BoolOrderSpace* s, int n) { Gecode::DFS e(s); delete s; @@ -116,7 +116,7 @@ namespace Test { namespace Assign { BoolTieBreak(int n0) : Base("Bool::Assign::TieBreak::" + std::to_string(n0)), n(n0) {} /// Perform test bool - run(void) override { + run() override { using namespace Gecode; TieBreak vars(BOOL_VAR_MERIT_MAX(&bool_merit_at<4>)); if (n > 1) @@ -142,10 +142,10 @@ namespace Test { namespace Assign { class BoolVarSelection : public Base { public: /// Create and register test - BoolVarSelection(void) : Base("Bool::Assign::VarSelection") {} + BoolVarSelection() : Base("Bool::Assign::VarSelection") {} /// Perform test bool - run(void) override { + run() override { using namespace Gecode; BoolOrderSpace* s = new BoolOrderSpace(1); assign(*s, s->x, BOOL_VAR_MERIT_MAX(&bool_merit_at<4>), BOOL_ASSIGN_MAX()); @@ -157,6 +157,6 @@ namespace Test { namespace Assign { BoolVarSelection var_selection; } // namespace -}} // namespace Test::Assign +} // namespace Test::Assign // STATISTICS: test-branch diff --git a/test/assign/float.cpp b/test/assign/float.cpp index 206968804f..3e4ff9bd52 100644 --- a/test/assign/float.cpp +++ b/test/assign/float.cpp @@ -38,7 +38,7 @@ #include -namespace Test { namespace Assign { +namespace Test::Assign { /// %Test assignment with distinct propagator class Float : public FloatTest { @@ -64,7 +64,7 @@ namespace Test { namespace Assign { } // namespace /// Merit that prefers the last of five variables - double + static double float_merit_last(const Gecode::Space&, Gecode::FloatVar, int i) { return (i == 4) ? 1.0 : 0.0; } @@ -75,7 +75,7 @@ namespace Test { namespace Assign { /// Variables to be assigned Gecode::FloatVarArray x; /// Initialize test space - FloatOrderSpace(void) : x(*this, 5, 0.0, 1.0) { + FloatOrderSpace() : x(*this, 5, 0.0, 1.0) { Gecode::linear(*this, x, Gecode::FRT_LQ, 1.0); } /// Constructor for cloning \a s @@ -84,7 +84,7 @@ namespace Test { namespace Assign { } /// Copy space during cloning Gecode::Space* - copy(void) override { + copy() override { return new FloatOrderSpace(*this); } }; @@ -93,10 +93,10 @@ namespace Test { namespace Assign { class FloatVarSelection : public Base { public: /// Create and register test - FloatVarSelection(void) : Base("Float::Assign::VarSelection") {} + FloatVarSelection() : Base("Float::Assign::VarSelection") {} /// Perform test bool - run(void) override { + run() override { using namespace Gecode; FloatOrderSpace* s = new FloatOrderSpace; assign(*s, s->x, FLOAT_VAR_MERIT_MAX(&float_merit_last), FLOAT_ASSIGN_MAX()); @@ -115,7 +115,7 @@ namespace Test { namespace Assign { FloatVarSelection var_selection; } // namespace -}} // namespace Test::Assign +} // namespace Test::Assign #endif diff --git a/test/assign/int.cpp b/test/assign/int.cpp index 675f0a4620..a558f374bf 100644 --- a/test/assign/int.cpp +++ b/test/assign/int.cpp @@ -36,7 +36,7 @@ #include -namespace Test { namespace Assign { +namespace Test::Assign { /// %Test assignment with distinct propagator class Int : public IntTest { @@ -65,7 +65,7 @@ namespace Test { namespace Assign { /// Merit that prefers the variable at position \a p template - double + static double int_merit_at(const Gecode::Space&, Gecode::IntVar, int i) { return (i == p) ? 1.0 : 0.0; } @@ -85,13 +85,13 @@ namespace Test { namespace Assign { } /// Copy space during cloning Gecode::Space* - copy(void) override { + copy() override { return new IntOrderSpace(*this); } }; /// Whether assigning one first in \a s sets exactly the last \a n variables - bool + static bool assigned_last_first(IntOrderSpace* s, int n) { Gecode::DFS e(s); delete s; @@ -114,7 +114,7 @@ namespace Test { namespace Assign { IntTieBreak(int n0) : Base("Int::Assign::TieBreak::" + std::to_string(n0)), n(n0) {} /// Perform test bool - run(void) override { + run() override { using namespace Gecode; TieBreak vars(INT_VAR_MERIT_MAX(&int_merit_at<4>)); if (n > 1) @@ -140,10 +140,10 @@ namespace Test { namespace Assign { class IntVarSelection : public Base { public: /// Create and register test - IntVarSelection(void) : Base("Int::Assign::VarSelection") {} + IntVarSelection() : Base("Int::Assign::VarSelection") {} /// Perform test bool - run(void) override { + run() override { using namespace Gecode; IntOrderSpace* s = new IntOrderSpace(1); assign(*s, s->x, INT_VAR_MERIT_MAX(&int_merit_at<4>), INT_ASSIGN_MAX()); @@ -155,6 +155,6 @@ namespace Test { namespace Assign { IntVarSelection var_selection; } // namespace -}} // namespace Test::Assign +} // namespace Test::Assign // STATISTICS: test-branch diff --git a/test/assign/set.cpp b/test/assign/set.cpp index 74481d39a8..578b905dcc 100644 --- a/test/assign/set.cpp +++ b/test/assign/set.cpp @@ -36,7 +36,7 @@ #include -namespace Test { namespace Assign { +namespace Test::Assign { /// %Test assignment with disjoint union propagator class Set : public SetTest { @@ -62,7 +62,7 @@ namespace Test { namespace Assign { } // namespace /// Merit that prefers the last of five variables - double + static double set_merit_last(const Gecode::Space&, Gecode::SetVar, int i) { return (i == 4) ? 1.0 : 0.0; } @@ -73,7 +73,7 @@ namespace Test { namespace Assign { /// Variables to be assigned Gecode::SetVarArray x; /// Initialize test space - SetOrderSpace(void) : x(*this, 5, Gecode::IntSet::empty, Gecode::IntSet(0, 0)) { + SetOrderSpace() : x(*this, 5, Gecode::IntSet::empty, Gecode::IntSet(0, 0)) { Gecode::SetVar zero(*this, Gecode::IntSet(0, 0), Gecode::IntSet(0, 0)); Gecode::rel(*this, Gecode::SOT_DISJOINT_UNION, x, zero); } @@ -83,7 +83,7 @@ namespace Test { namespace Assign { } /// Copy space during cloning Gecode::Space* - copy(void) override { + copy() override { return new SetOrderSpace(*this); } }; @@ -92,10 +92,10 @@ namespace Test { namespace Assign { class SetVarSelection : public Base { public: /// Create and register test - SetVarSelection(void) : Base("Set::Assign::VarSelection") {} + SetVarSelection() : Base("Set::Assign::VarSelection") {} /// Perform test bool - run(void) override { + run() override { using namespace Gecode; SetOrderSpace* s = new SetOrderSpace; assign(*s, s->x, SET_VAR_MERIT_MAX(&set_merit_last), SET_ASSIGN_MIN_INC()); @@ -114,7 +114,7 @@ namespace Test { namespace Assign { SetVarSelection var_selection; } // namespace -}} // namespace Test::Assign +} // namespace Test::Assign #endif diff --git a/test/branch.cpp b/test/branch.cpp index ca60c2bb41..d57f9184c9 100644 --- a/test/branch.cpp +++ b/test/branch.cpp @@ -54,10 +54,10 @@ #include -namespace Test { namespace Branch { +namespace Test::Branch { /// Test function for tie-break limit function - double + static double tbl(const Gecode::Space&, double w, double b) { return (w + (b - w) / 2.0); } @@ -80,7 +80,7 @@ namespace Test { namespace Branch { } /// Copy space during cloning Gecode::Space* - copy(void) override { + copy() override { return new IntTestSpace(*this); } }; @@ -98,7 +98,7 @@ namespace Test { namespace Branch { } /// Copy space during cloning Gecode::Space* - copy(void) override { + copy() override { return new BoolTestSpace(*this); } }; @@ -117,7 +117,7 @@ namespace Test { namespace Branch { } /// Copy space during cloning Gecode::Space* - copy(void) override { + copy() override { return new SetTestSpace(*this); } }; @@ -137,7 +137,7 @@ namespace Test { namespace Branch { } /// Copy space during cloning Gecode::Space* - copy(void) override { + copy() override { return new FloatTestSpace(*this); } }; @@ -168,12 +168,12 @@ namespace Test { namespace Branch { /// Number of integer variable selections const int n_bool_var_branch = sizeof(bool_var_branch_name) / sizeof(const char*); /// Test function for branch merit function - double + static double int_merit(const Gecode::Space&, Gecode::IntVar x, int) { return x.min(); } /// Test function for branch merit function - double + static double bool_merit(const Gecode::Space&, Gecode::BoolVar x, int) { return x.min(); } @@ -189,12 +189,12 @@ namespace Test { namespace Branch { /// Number of Boolean value selections const int n_bool_val_branch = sizeof(bool_val_branch_name) / sizeof(const char*); /// Test function for branch value function - int + static int int_val(const Gecode::Space&, Gecode::IntVar x, int) { return x.min(); } /// Test function for branch value function - int + static int bool_val(const Gecode::Space&, Gecode::BoolVar x, int) { return x.min(); } @@ -218,7 +218,7 @@ namespace Test { namespace Branch { /// Number of set variable selections const int n_set_var_branch = sizeof(set_var_branch_name) / sizeof(const char*); /// Test function for branch merit function - double + static double set_merit(const Gecode::Space&, Gecode::SetVar, int) { return 2.0; } @@ -229,7 +229,7 @@ namespace Test { namespace Branch { /// Number of set value selections const int n_set_val_branch = sizeof(set_val_branch_name) / sizeof(const char*); /// Test function for branch value function - int + static int set_val(const Gecode::Space&, Gecode::SetVar x, int) { Gecode::SetVarUnknownRanges r(x); return r.min(); @@ -255,7 +255,7 @@ namespace Test { namespace Branch { /// Number of float variable selections const int n_float_var_branch = sizeof(float_var_branch_name) / sizeof(const char*); /// Test function for branch merit function - double + static double float_merit(const Gecode::Space&, Gecode::FloatVar x, int) { return static_cast(x.degree()); } @@ -265,7 +265,7 @@ namespace Test { namespace Branch { /// Number of float value selections const int n_float_val_branch = sizeof(float_val_branch_name) / sizeof(const char*); /// Test function for branch value function - Gecode::FloatNumBranch + static Gecode::FloatNumBranch float_val(const Gecode::Space&, Gecode::FloatVar x, int) { Gecode::FloatNumBranch nl; nl.n = x.med(); @@ -289,19 +289,19 @@ namespace Test { namespace Branch { } }; -}} // namespace Test::Branch +} // namespace Test::Branch -std::ostream& +static std::ostream& operator<<(std::ostream& os, const Test::Branch::RunInfo& ri) { ri.print(os); return os; } -namespace Test { namespace Branch { +namespace Test::Branch { /// Find number of solutions template - int + static int solutions(TestSpace* c, Gecode::Search::Options& o, Gecode::Support::RandomGenerator& rand, int max_nb_sol = -1) { o.a_d = rand(10); o.c_d = rand(10); @@ -326,7 +326,7 @@ namespace Test { namespace Branch { : Base("Int::Branch::" + s), arity(a), dom(d) {} bool - IntTest::run(void) { + IntTest::run() { using std::map; using std::ostream; using std::string; @@ -623,8 +623,8 @@ namespace Test { namespace Branch { } } Gecode::Search::Options o; - results[solutions(c, o, _rand)].push_back( - RunInfo(int_var_branch_name[vara], int_var_branch_name[varb], int_val_branch_name[val], o)); + results[solutions(c, o, _rand)].emplace_back(int_var_branch_name[vara], int_var_branch_name[varb], + int_val_branch_name[val], o); } } } @@ -634,10 +634,10 @@ namespace Test { namespace Branch { return true; failed: std::cout << "FAILURE" << '\n'; - for (map>::iterator it = results.begin(); it != results.end(); ++it) { - std::cout << "Number of solutions: " << it->first << '\n'; - for (unsigned int i = 0; i < it->second.size(); ++i) - std::cout << it->second[i] << " "; + for (auto& result : results) { + std::cout << "Number of solutions: " << result.first << '\n'; + for (const auto& entry : result.second) + std::cout << entry << " "; std::cout << '\n'; } std::cout.flush(); @@ -649,7 +649,7 @@ namespace Test { namespace Branch { BoolTest::BoolTest(const std::string& s, int a) : Base("Bool::Branch::" + s), arity(a) {} bool - BoolTest::run(void) { + BoolTest::run() { using std::map; using std::ostream; using std::string; @@ -815,8 +815,8 @@ namespace Test { namespace Branch { } } Gecode::Search::Options o; - results[solutions(c, o, _rand)].push_back( - RunInfo(int_var_branch_name[vara], int_var_branch_name[varb], int_val_branch_name[val], o)); + results[solutions(c, o, _rand)].emplace_back(int_var_branch_name[vara], int_var_branch_name[varb], + int_val_branch_name[val], o); } } } @@ -826,10 +826,10 @@ namespace Test { namespace Branch { return true; failed: std::cout << "FAILURE" << '\n'; - for (map>::iterator it = results.begin(); it != results.end(); ++it) { - std::cout << "Number of solutions: " << it->first << '\n'; - for (unsigned int i = 0; i < it->second.size(); ++i) - std::cout << it->second[i] << " "; + for (auto& result : results) { + std::cout << "Number of solutions: " << result.first << '\n'; + for (const auto& entry : result.second) + std::cout << entry << " "; std::cout << '\n'; } std::cout.flush(); @@ -845,7 +845,7 @@ namespace Test { namespace Branch { SetTest::SetTest(const std::string& s, int a, const Gecode::IntSet& d) : SetTest(TestTags::standard(), s, a, d) {} bool - SetTest::run(void) { + SetTest::run() { using std::map; using std::ostream; using std::string; @@ -1107,8 +1107,8 @@ namespace Test { namespace Branch { } } Gecode::Search::Options o; - results[solutions(c, o, _rand)].push_back( - RunInfo(set_var_branch_name[vara], set_var_branch_name[varb], set_val_branch_name[val], o)); + results[solutions(c, o, _rand)].emplace_back(set_var_branch_name[vara], set_var_branch_name[varb], + set_val_branch_name[val], o); } } } @@ -1118,10 +1118,10 @@ namespace Test { namespace Branch { return true; failed: std::cout << "FAILURE" << '\n'; - for (map>::iterator it = results.begin(); it != results.end(); ++it) { - std::cout << "Number of solutions: " << it->first << '\n'; - for (unsigned int i = 0; i < it->second.size(); ++i) - std::cout << it->second[i] << " "; + for (auto& result : results) { + std::cout << "Number of solutions: " << result.first << '\n'; + for (const auto& entry : result.second) + std::cout << entry << " "; std::cout << '\n'; } std::cout.flush(); @@ -1136,7 +1136,7 @@ namespace Test { namespace Branch { : Base("Float::Branch::" + s), arity(a), dom(d), nb_sols(nbs) {} bool - FloatTest::run(void) { + FloatTest::run() { using std::map; using std::ostream; using std::string; @@ -1382,8 +1382,8 @@ namespace Test { namespace Branch { } } Gecode::Search::Options o; - results[solutions(c, o, _rand, nb_sols)].push_back(RunInfo( - float_var_branch_name[vara], float_var_branch_name[varb], float_val_branch_name[val], o)); + results[solutions(c, o, _rand, nb_sols)].emplace_back( + float_var_branch_name[vara], float_var_branch_name[varb], float_val_branch_name[val], o); } } } @@ -1393,10 +1393,10 @@ namespace Test { namespace Branch { return true; failed: std::cout << "FAILURE" << '\n'; - for (map>::iterator it = results.begin(); it != results.end(); ++it) { - std::cout << "Number of solutions: " << it->first << '\n'; - for (unsigned int i = 0; i < it->second.size(); ++i) - std::cout << it->second[i] << " "; + for (auto& result : results) { + std::cout << "Number of solutions: " << result.first << '\n'; + for (const auto& entry : result.second) + std::cout << entry << " "; std::cout << '\n'; } std::cout.flush(); @@ -1410,18 +1410,18 @@ namespace Test { namespace Branch { class EmptySpace : public Gecode::Space { public: /// Initialize space - EmptySpace(void) = default; + EmptySpace() = default; /// Constructor for cloning \a s // NOLINTNEXTLINE(modernize-use-equals-default) EmptySpace(EmptySpace& s) : Gecode::Space(s) {} /// Return the number of propagators unsigned int - propagators(void) { + propagators() { return Gecode::PropagatorGroup::all.size(*this); } /// Copy space during cloning Gecode::Space* - copy(void) override { + copy() override { return new EmptySpace(*this); } }; @@ -1523,9 +1523,9 @@ namespace Test { namespace Branch { template class EmptyStatistics : public Base { private: - using VarArgs = typename Traits::VarArgs; - using Action = typename Traits::Action; - using CHB = typename Traits::CHB; + using VarArgs = Traits::VarArgs; + using Action = Traits::Action; + using CHB = Traits::CHB; /// Test whether \a s is initialized and empty, also when copied template static bool @@ -1538,7 +1538,7 @@ namespace Test { namespace Branch { } /// Test an empty action, including a decay change static bool - empty_action(void) { + empty_action() { EmptySpace home; Action constructed(home, VarArgs(), 0.9); Action initialized; @@ -1550,7 +1550,7 @@ namespace Test { namespace Branch { } /// Test an empty CHB static bool - empty_chb(void) { + empty_chb() { EmptySpace home; CHB constructed(home, VarArgs()); CHB initialized; @@ -1603,7 +1603,7 @@ namespace Test { namespace Branch { EmptyStatistics(const std::string& prefix) : Base(prefix + "::Branch::EmptyStatistics") {} /// Run test bool - run(void) override { + run() override { return empty_action() && empty_chb() && empty_branching(&branch_fresh_action) && empty_branching(&branch_given_action) && empty_branching(&branch_fresh_chb) && empty_branching(&branch_given_chb); @@ -1619,6 +1619,6 @@ namespace Test { namespace Branch { EmptyStatistics float_empty_statistics("Float"); #endif -}} // namespace Test::Branch +} // namespace Test::Branch // STATISTICS: test-branch diff --git a/test/branch.hh b/test/branch.hh index be0fbafec7..da44928a88 100644 --- a/test/branch.hh +++ b/test/branch.hh @@ -53,100 +53,96 @@ #include "test/test.hh" -namespace Test { - - /// Tests for branchings - namespace Branch { - - /** - * \brief %Base class for tests for branching on integer variables - * - */ - class IntTest : public Base { - protected: - /// Number of variables - int arity; - /// Domain of variables - Gecode::IntSet dom; - - public: - /// Construct and register test - IntTest(const std::string& s, int a, const Gecode::IntSet& d); - /// Perform test - bool run(void) override; - /// Post propagators on variables \a x - virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) = 0; - }; - - /** - * \brief %Base class for tests for branching on Boolean variables - * - */ - class BoolTest : public Base { - protected: - /// Number of variables - int arity; - - public: - /// Construct and register test - BoolTest(const std::string& s, int a); - /// Perform test - bool run(void) override; - /// Post propagators on variables \a x - virtual void post(Gecode::Space& home, Gecode::BoolVarArray& x) = 0; - }; +/// Tests for branchings +namespace Test::Branch { + + /** + * \brief %Base class for tests for branching on integer variables + * + */ + class IntTest : public Base { + protected: + /// Number of variables + int arity; + /// Domain of variables + Gecode::IntSet dom; + + public: + /// Construct and register test + IntTest(const std::string& s, int a, const Gecode::IntSet& d); + /// Perform test + bool run() override; + /// Post propagators on variables \a x + virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) = 0; + }; + + /** + * \brief %Base class for tests for branching on Boolean variables + * + */ + class BoolTest : public Base { + protected: + /// Number of variables + int arity; + + public: + /// Construct and register test + BoolTest(const std::string& s, int a); + /// Perform test + bool run() override; + /// Post propagators on variables \a x + virtual void post(Gecode::Space& home, Gecode::BoolVarArray& x) = 0; + }; #ifdef GECODE_HAS_SET_VARS - /** - * \brief %Base class for tests for branching on set variables - * - */ - class SetTest : public Base { - protected: - /// Number of variables - int arity; - /// Domain of variables - Gecode::IntSet dom; - - public: - /// Construct and register test with explicitly assigned tags - SetTest(TestTags tags, const std::string& s, int a, const Gecode::IntSet& d); - /// Construct and register test - SetTest(const std::string& s, int a, const Gecode::IntSet& d); - /// Perform test - bool run(void) override; - /// Post propagators on variables \a x - virtual void post(Gecode::Space& home, Gecode::SetVarArray& x) = 0; - }; + /** + * \brief %Base class for tests for branching on set variables + * + */ + class SetTest : public Base { + protected: + /// Number of variables + int arity; + /// Domain of variables + Gecode::IntSet dom; + + public: + /// Construct and register test with explicitly assigned tags + SetTest(TestTags tags, const std::string& s, int a, const Gecode::IntSet& d); + /// Construct and register test + SetTest(const std::string& s, int a, const Gecode::IntSet& d); + /// Perform test + bool run() override; + /// Post propagators on variables \a x + virtual void post(Gecode::Space& home, Gecode::SetVarArray& x) = 0; + }; #endif #ifdef GECODE_HAS_FLOAT_VARS - /** - * \brief %Base class for tests for branching on float variables - * - */ - class FloatTest : public Base { - protected: - /// Number of variables - int arity; - /// Domain of variables - Gecode::FloatVal dom; - /// Maximum number of solutions searched during solving - int nb_sols; - - public: - /// Construct and register test - FloatTest(const std::string& s, int a, const Gecode::FloatVal& d, int nbs); - /// Perform test - bool run(void) override; - /// Post propagators on variables \a x - virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) = 0; - }; + /** + * \brief %Base class for tests for branching on float variables + * + */ + class FloatTest : public Base { + protected: + /// Number of variables + int arity; + /// Domain of variables + Gecode::FloatVal dom; + /// Maximum number of solutions searched during solving + int nb_sols; + + public: + /// Construct and register test + FloatTest(const std::string& s, int a, const Gecode::FloatVal& d, int nbs); + /// Perform test + bool run() override; + /// Post propagators on variables \a x + virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) = 0; + }; #endif - } // namespace Branch - -} // namespace Test +} // namespace Test::Branch #endif diff --git a/test/branch/bool.cpp b/test/branch/bool.cpp index 8f568f4905..8f3401d9fc 100644 --- a/test/branch/bool.cpp +++ b/test/branch/bool.cpp @@ -32,7 +32,7 @@ #include "test/branch.hh" -namespace Test { namespace Branch { +namespace Test::Branch { /// %Test brancher with distinct propagator class Bool : public BoolTest { @@ -50,6 +50,6 @@ namespace Test { namespace Branch { Bool b_5("5", 5); Bool b_7("7", 7); -}} // namespace Test::Branch +} // namespace Test::Branch // STATISTICS: test-branch diff --git a/test/branch/float.cpp b/test/branch/float.cpp index 46c5d0a8c9..c08d3f013e 100644 --- a/test/branch/float.cpp +++ b/test/branch/float.cpp @@ -36,7 +36,7 @@ #ifdef GECODE_HAS_FLOAT_VARS -namespace Test { namespace Branch { +namespace Test::Branch { /// %Test brancher with distinct propagator class Float : public FloatTest { @@ -61,7 +61,7 @@ namespace Test { namespace Branch { Float l_3("Large::3", d_large, 3, 10); } // namespace -}} // namespace Test::Branch +} // namespace Test::Branch #endif diff --git a/test/branch/int.cpp b/test/branch/int.cpp index 476494d647..9463771c60 100644 --- a/test/branch/int.cpp +++ b/test/branch/int.cpp @@ -37,7 +37,7 @@ #include -namespace Test { namespace Branch { +namespace Test::Branch { /// Space for testing filtered random tie selection class FilteredRndTiesSpace : public Gecode::Space { @@ -65,7 +65,7 @@ namespace Test { namespace Branch { /// Copy space during cloning Gecode::Space* - copy(void) override { + copy() override { return new FilteredRndTiesSpace(*this); } }; @@ -74,11 +74,11 @@ namespace Test { namespace Branch { class FilteredRndTies : public Base { public: /// Create and register test - FilteredRndTies(void) : Base("Int::Branch::FilteredRndTies") {} + FilteredRndTies() : Base("Int::Branch::FilteredRndTies") {} /// Run test bool - run(void) override { + run() override { bool selected[2] = {false, false}; for (unsigned int seed = 1; seed <= 16; seed++) { @@ -138,7 +138,7 @@ namespace Test { namespace Branch { Gecode::cbs_branch(*this, x); } void - post(void) { + post() { using namespace Gecode; distinct(*this, IntVarArgs() << x[0] << x[1] << x[2] << x[3], IPL_VAL); distinct(*this, IntVarArgs() << x[4] << x[5] << x[6] << x[7], IPL_VAL); @@ -147,7 +147,7 @@ namespace Test { namespace Branch { x.update(*this, s.x); } Space* - copy(void) override { + copy() override { return new CBSSpace(*this); } }; @@ -155,9 +155,9 @@ namespace Test { namespace Branch { /// Cache removal must preserve choices from surviving propagators class CBS : public Base { public: - CBS(void) : Base("Int::Branch::CBS", TestTags::check()) {} + CBS() : Base("Int::Branch::CBS", TestTags::check()) {} bool - run(void) override { + run() override { using namespace Gecode; for (bool local : {false, true}) { CBSSpace root(local); @@ -167,8 +167,8 @@ namespace Test { namespace Branch { DFS engine(&root, o); int n = 0; while (std::unique_ptr s{engine.next()}) { - for (int i = 0; i < s->x.size(); i++) - if (!s->x[i].assigned()) + for (auto& var : s->x) + if (!var.assigned()) return false; n++; } @@ -207,6 +207,6 @@ namespace Test { namespace Branch { Int l_2("Large::2", d_large, 2); Int l_3("Large::3", d_large, 3); -}} // namespace Test::Branch +} // namespace Test::Branch // STATISTICS: test-branch diff --git a/test/branch/set.cpp b/test/branch/set.cpp index 9bd1707767..cb2b7abe36 100644 --- a/test/branch/set.cpp +++ b/test/branch/set.cpp @@ -34,7 +34,7 @@ #ifdef GECODE_HAS_SET_VARS -namespace Test { namespace Branch { +namespace Test::Branch { /// %Test brancher class Set : public SetTest { @@ -60,7 +60,7 @@ namespace Test { namespace Branch { Set s_3(TestTags::sweep(), "Sparse::3", d_sparse, 3); } // namespace -}} // namespace Test::Branch +} // namespace Test::Branch #endif diff --git a/test/fault.cpp b/test/fault.cpp index 66b29ff268..823f826466 100644 --- a/test/fault.cpp +++ b/test/fault.cpp @@ -36,7 +36,7 @@ #include "test/test.hh" -namespace Test { namespace Fault { +namespace Test::Fault { using namespace Gecode; using Gecode::Support::FailPoint::Phase; @@ -48,10 +48,10 @@ namespace Test { namespace Fault { Support::Lock lock; public: - FaultScope(void) : lock(fault_mutex) { + FaultScope() : lock(fault_mutex) { Support::FailPoint::reset(); } - ~FaultScope(void) { + ~FaultScope() { Support::FailPoint::reset(); } }; @@ -102,7 +102,7 @@ namespace Test { namespace Fault { Support::FailPoint::check(Phase::ADVISOR_COPY); } Propagator* - owner(void) const { + owner() const { return &propagator(); } void @@ -128,7 +128,7 @@ namespace Test { namespace Fault { return new (home) AdvisorCopyPropagator(home); } bool - advisors_point_to_self(void) const { + advisors_point_to_self() const { Advisors as(c); int n = 0; while (as()) { @@ -214,7 +214,7 @@ namespace Test { namespace Fault { class CloneCopySpace : public Space { public: - CloneCopySpace(void) { + CloneCopySpace() { ThrowingPropagator::post(*this); ThrowingPropagator::post(*this); ThrowingBrancher::post(*this); @@ -223,7 +223,7 @@ namespace Test { namespace Fault { // NOLINTNEXTLINE(modernize-use-equals-default) CloneCopySpace(CloneCopySpace& s) : Space(s) {} Space* - copy(void) override { + copy() override { return new CloneCopySpace(*this); } }; @@ -231,14 +231,14 @@ namespace Test { namespace Fault { class DisposeSpace : public Space { public: IntVarArray x; - DisposeSpace(void) : x(*this, 3, 0, 2) { + DisposeSpace() : x(*this, 3, 0, 2) { branch(*this, x, INT_VAR_ACTION_SIZE_MAX(), INT_VAL_MIN()); } DisposeSpace(DisposeSpace& s) : Space(s) { x.update(*this, s.x); } Space* - copy(void) override { + copy() override { return new DisposeSpace(*this); } }; @@ -283,18 +283,18 @@ namespace Test { namespace Fault { // NOLINTNEXTLINE(modernize-use-equals-default) NoticeDisposeSpace(NoticeDisposeSpace& s) : Space(s) {} Space* - copy(void) override { + copy() override { return new NoticeDisposeSpace(*this); } }; class MiniModelSpace : public Space { public: - MiniModelSpace(void) = default; + MiniModelSpace() = default; // NOLINTNEXTLINE(modernize-use-equals-default) MiniModelSpace(MiniModelSpace& s) : Space(s) {} Space* - copy(void) override { + copy() override { return new MiniModelSpace(*this); } }; @@ -302,7 +302,7 @@ namespace Test { namespace Fault { class DerivedCopySpace : public Space { public: IntVarArray x; - DerivedCopySpace(void) : x(*this, 2, 0, 1) { + DerivedCopySpace() : x(*this, 2, 0, 1) { ThrowingPropagator::post(*this); ThrowingBrancher::post(*this); } @@ -311,7 +311,7 @@ namespace Test { namespace Fault { x.update(*this, s.x); } Space* - copy(void) override { + copy() override { return new DerivedCopySpace(*this); } }; @@ -319,7 +319,7 @@ namespace Test { namespace Fault { class DerivedUpdateSpace : public Space { public: IntVarArray x; - DerivedUpdateSpace(void) : x(*this, 2, 0, 1) { + DerivedUpdateSpace() : x(*this, 2, 0, 1) { rel(*this, x[0] != x[1]); branch(*this, x, INT_VAR_SIZE_MIN(), INT_VAL_MIN()); } @@ -328,7 +328,7 @@ namespace Test { namespace Fault { Support::FailPoint::check(Phase::DERIVED_SPACE_COPY); } Space* - copy(void) override { + copy() override { return new DerivedUpdateSpace(*this); } }; @@ -352,14 +352,14 @@ namespace Test { namespace Fault { class FaultLocalHandle : public LocalHandle { public: - FaultLocalHandle(void) = default; + FaultLocalHandle() = default; FaultLocalHandle(FaultLocalObject* o) : LocalHandle(o) {} void update(Space& home, FaultLocalHandle& h) { LocalHandle::update(home, h); } int - value(void) const { + value() const { return static_cast(object())->value; } }; @@ -367,12 +367,12 @@ namespace Test { namespace Fault { class LocalCopySpace : public Space { public: FaultLocalHandle h; - LocalCopySpace(void) : h(new (*this) FaultLocalObject(*this, 42)) {} + LocalCopySpace() : h(new (*this) FaultLocalObject(*this, 42)) {} LocalCopySpace(LocalCopySpace& s) : Space(s) { h.update(*this, s.h); } Space* - copy(void) override { + copy() override { return new LocalCopySpace(*this); } }; @@ -380,14 +380,14 @@ namespace Test { namespace Fault { class AdvisorCopySpace : public Space { public: AdvisorCopyPropagator* p; - AdvisorCopySpace(void) : p(AdvisorCopyPropagator::post(*this)) {} + AdvisorCopySpace() : p(AdvisorCopyPropagator::post(*this)) {} AdvisorCopySpace(AdvisorCopySpace& s) : Space(s), p(nullptr) {} Space* - copy(void) override { + copy() override { return new AdvisorCopySpace(*this); } bool - advisors_point_to_source(void) const { + advisors_point_to_source() const { return (p != nullptr) && p->advisors_point_to_self(); } }; @@ -395,31 +395,31 @@ namespace Test { namespace Fault { class BranchPostSpace : public Space { public: IntVarArray x; - BranchPostSpace(void) : x(*this, 4, 0, 3) { + BranchPostSpace() : x(*this, 4, 0, 3) { rel(*this, x[0] != x[1]); } BranchPostSpace(BranchPostSpace& s) : Space(s) { x.update(*this, s.x); } Space* - copy(void) override { + copy() override { return new BranchPostSpace(*this); } void - post_action_branch(void) { + post_action_branch() { branch(*this, x, INT_VAR_ACTION_SIZE_MAX(), INT_VAL_MIN()); } void - post_chb_branch(void) { + post_chb_branch() { branch(*this, x, INT_VAR_CHB_SIZE_MAX(), INT_VAL_MIN()); } void - post_plain_branch(void) { + post_plain_branch() { branch(*this, x, INT_VAR_SIZE_MIN(), INT_VAL_MIN()); } }; - bool + static bool clone_after_failed_copy(Phase p, unsigned long long n) { FaultScope scope; CloneCopySpace s; @@ -449,7 +449,7 @@ namespace Test { namespace Fault { return ok && (s.status() != SS_FAILED); } - bool + static bool expect_memory_exhausted(Phase p, unsigned long long n) { FaultScope scope; DerivedCopySpace s; @@ -479,8 +479,8 @@ namespace Test { namespace Fault { return false; } - bool - clone_after_failed_local_object_copy(void) { + static bool + clone_after_failed_local_object_copy() { FaultScope scope; LocalCopySpace s; Support::FailPoint::reset(); @@ -504,8 +504,8 @@ namespace Test { namespace Fault { return false; } - bool - clone_after_failed_advisor_copy(void) { + static bool + clone_after_failed_advisor_copy() { FaultScope scope; AdvisorCopySpace s; if (!s.advisors_point_to_source()) @@ -531,8 +531,8 @@ namespace Test { namespace Fault { } } - bool - clone_after_failed_disposal_array(void) { + static bool + clone_after_failed_disposal_array() { FaultScope scope; DisposeSpace s; if (s.status() == SS_FAILED) @@ -559,7 +559,7 @@ namespace Test { namespace Fault { return ok; } - bool + static bool derived_update_space_is_usable(DerivedUpdateSpace& s) { Space* c = s.clone(); delete c; @@ -570,8 +570,8 @@ namespace Test { namespace Fault { return ok; } - bool - clone_after_failed_derived_update(void) { + static bool + clone_after_failed_derived_update() { FaultScope scope; DerivedUpdateSpace s; if (s.status() == SS_FAILED) @@ -592,8 +592,8 @@ namespace Test { namespace Fault { return derived_update_space_is_usable(s); } - bool - heap_allocation_failpoint_throws(void) { + static bool + heap_allocation_failpoint_throws() { FaultScope scope; Support::FailPoint::reset(); Support::FailPoint::fail_after(Phase::HEAP, 0); @@ -611,8 +611,8 @@ namespace Test { namespace Fault { } } - bool - heap_reallocation_failpoint_throws(void) { + static bool + heap_reallocation_failpoint_throws() { FaultScope scope; int* x = heap.alloc(1); Support::FailPoint::reset(); @@ -633,8 +633,8 @@ namespace Test { namespace Fault { } } - bool - clone_heap_failures_recover_source(void) { + static bool + clone_heap_failures_recover_source() { FaultScope scope; DerivedUpdateSpace s; if (s.status() == SS_FAILED) @@ -662,7 +662,7 @@ namespace Test { namespace Fault { return false; } - bool + static bool branch_post_heap_failures_are_recoverable(bool chb) { FaultScope scope; bool saw_failure = false; @@ -702,8 +702,8 @@ namespace Test { namespace Fault { return false; } - bool - int_set_heap_failures_release_object(void) { + static bool + int_set_heap_failures_release_object() { FaultScope scope; int ranges[3][2] = {{0, 0}, {2, 2}, {4, 4}}; bool saw_failure = false; @@ -732,8 +732,8 @@ namespace Test { namespace Fault { return false; } - bool - minimodel_heap_failures_release_nodes(void) { + static bool + minimodel_heap_failures_release_nodes() { FaultScope scope; bool saw_failure = false; for (unsigned long long budget = 0; budget < 32; budget++) { @@ -763,7 +763,7 @@ namespace Test { namespace Fault { return false; } - bool + static bool linear_sum_constructor_heap_failures_release_nodes(int kind) { FaultScope scope; bool saw_failure = false; @@ -812,8 +812,8 @@ namespace Test { namespace Fault { return false; } - bool - minimodel_linear_sum_heap_failures_release_nodes(void) { + static bool + minimodel_linear_sum_heap_failures_release_nodes() { for (int kind = 0; kind < 4; kind++) if (!linear_sum_constructor_heap_failures_release_nodes(kind)) return false; @@ -821,8 +821,8 @@ namespace Test { namespace Fault { } #ifdef GECODE_HAS_FLOAT_VARS - bool - minimodel_float_heap_failures_are_recoverable(void) { + static bool + minimodel_float_heap_failures_are_recoverable() { FaultScope scope; bool saw_failure = false; for (unsigned long long budget = 0; budget < 32; budget++) { @@ -851,8 +851,8 @@ namespace Test { namespace Fault { #endif #ifdef GECODE_HAS_SET_VARS - bool - minimodel_set_heap_failures_are_recoverable(void) { + static bool + minimodel_set_heap_failures_are_recoverable() { FaultScope scope; bool saw_failure = false; for (unsigned long long budget = 0; budget < 32; budget++) { @@ -880,8 +880,8 @@ namespace Test { namespace Fault { } #endif - bool - dispose_notice_initial_failure_does_not_dispose_actor(void) { + static bool + dispose_notice_initial_failure_does_not_dispose_actor() { FaultScope scope; NoticeDisposeActor::disposed = 0; Support::FailPoint::reset(); @@ -899,8 +899,8 @@ namespace Test { namespace Fault { } } - bool - dispose_notice_resize_failure_does_not_dispose_unregistered_actor(void) { + static bool + dispose_notice_resize_failure_does_not_dispose_unregistered_actor() { FaultScope scope; NoticeDisposeActor::disposed = 0; Support::FailPoint::reset(); @@ -917,8 +917,8 @@ namespace Test { namespace Fault { } } - bool - minimodel_failure_releases_default_nodes(void) { + static bool + minimodel_failure_releases_default_nodes() { FaultScope scope; LinIntExpr::fault_reset_allocations(); Support::FailPoint::reset(); @@ -943,8 +943,8 @@ namespace Test { namespace Fault { public: static int disposed; - FaultBoolMisc(void) = default; - ~FaultBoolMisc(void) override { + FaultBoolMisc() = default; + ~FaultBoolMisc() override { disposed++; } void @@ -953,8 +953,8 @@ namespace Test { namespace Fault { int FaultBoolMisc::disposed = 0; - bool - minimodel_heap_failure_releases_bool_misc(void) { + static bool + minimodel_heap_failure_releases_bool_misc() { FaultScope scope; FaultBoolMisc::disposed = 0; FaultBoolMisc* m = new FaultBoolMisc; @@ -976,126 +976,126 @@ namespace Test { namespace Fault { class MiniModelDefaultNodes : public Base { public: - MiniModelDefaultNodes(void) : Base("Fault::MiniModel::DefaultNodes") {} + MiniModelDefaultNodes() : Base("Fault::MiniModel::DefaultNodes") {} bool - run(void) override { + run() override { return minimodel_failure_releases_default_nodes(); } }; class DisposeNoticeArray : public Base { public: - DisposeNoticeArray(void) : Base("Fault::Dispose::NoticeArray") {} + DisposeNoticeArray() : Base("Fault::Dispose::NoticeArray") {} bool - run(void) override { + run() override { return dispose_notice_initial_failure_does_not_dispose_actor(); } }; class DisposeNoticeArrayResize : public Base { public: - DisposeNoticeArrayResize(void) : Base("Fault::Dispose::NoticeArrayResize") {} + DisposeNoticeArrayResize() : Base("Fault::Dispose::NoticeArrayResize") {} bool - run(void) override { + run() override { return dispose_notice_resize_failure_does_not_dispose_unregistered_actor(); } }; class CloneDisposalArray : public Base { public: - CloneDisposalArray(void) : Base("Fault::Clone::DisposalArray") {} + CloneDisposalArray() : Base("Fault::Clone::DisposalArray") {} bool - run(void) override { + run() override { return clone_after_failed_disposal_array(); } }; class CloneDerivedSpaceUpdate : public Base { public: - CloneDerivedSpaceUpdate(void) : Base("Fault::Clone::DerivedSpaceUpdate") {} + CloneDerivedSpaceUpdate() : Base("Fault::Clone::DerivedSpaceUpdate") {} bool - run(void) override { + run() override { return clone_after_failed_derived_update(); } }; class HeapAllocation : public Base { public: - HeapAllocation(void) : Base("Fault::Heap::Allocation") {} + HeapAllocation() : Base("Fault::Heap::Allocation") {} bool - run(void) override { + run() override { return heap_allocation_failpoint_throws(); } }; class HeapReallocation : public Base { public: - HeapReallocation(void) : Base("Fault::Heap::Reallocation") {} + HeapReallocation() : Base("Fault::Heap::Reallocation") {} bool - run(void) override { + run() override { return heap_reallocation_failpoint_throws(); } }; class CloneHeapFailures : public Base { public: - CloneHeapFailures(void) : Base("Fault::Clone::HeapFailures") {} + CloneHeapFailures() : Base("Fault::Clone::HeapFailures") {} bool - run(void) override { + run() override { return clone_heap_failures_recover_source(); } }; class BranchActionHeapFailures : public Base { public: - BranchActionHeapFailures(void) : Base("Fault::Branch::ActionHeapFailures") {} + BranchActionHeapFailures() : Base("Fault::Branch::ActionHeapFailures") {} bool - run(void) override { + run() override { return branch_post_heap_failures_are_recoverable(false); } }; class BranchChbHeapFailures : public Base { public: - BranchChbHeapFailures(void) : Base("Fault::Branch::ChbHeapFailures") {} + BranchChbHeapFailures() : Base("Fault::Branch::ChbHeapFailures") {} bool - run(void) override { + run() override { return branch_post_heap_failures_are_recoverable(true); } }; class IntSetHeapFailures : public Base { public: - IntSetHeapFailures(void) : Base("Fault::IntSet::HeapFailures") {} + IntSetHeapFailures() : Base("Fault::IntSet::HeapFailures") {} bool - run(void) override { + run() override { return int_set_heap_failures_release_object(); } }; class MiniModelHeapFailures : public Base { public: - MiniModelHeapFailures(void) : Base("Fault::MiniModel::HeapFailures") {} + MiniModelHeapFailures() : Base("Fault::MiniModel::HeapFailures") {} bool - run(void) override { + run() override { return minimodel_heap_failures_release_nodes(); } }; class MiniModelLinearSumHeapFailures : public Base { public: - MiniModelLinearSumHeapFailures(void) : Base("Fault::MiniModel::LinearSumHeapFailures") {} + MiniModelLinearSumHeapFailures() : Base("Fault::MiniModel::LinearSumHeapFailures") {} bool - run(void) override { + run() override { return minimodel_linear_sum_heap_failures_release_nodes(); } }; class MiniModelBoolMiscHeapFailure : public Base { public: - MiniModelBoolMiscHeapFailure(void) : Base("Fault::MiniModel::BoolMiscHeapFailure") {} + MiniModelBoolMiscHeapFailure() : Base("Fault::MiniModel::BoolMiscHeapFailure") {} bool - run(void) override { + run() override { return minimodel_heap_failure_releases_bool_misc(); } }; @@ -1103,9 +1103,9 @@ namespace Test { namespace Fault { #ifdef GECODE_HAS_FLOAT_VARS class MiniModelFloatHeapFailures : public Base { public: - MiniModelFloatHeapFailures(void) : Base("Fault::MiniModel::FloatHeapFailures") {} + MiniModelFloatHeapFailures() : Base("Fault::MiniModel::FloatHeapFailures") {} bool - run(void) override { + run() override { return minimodel_float_heap_failures_are_recoverable(); } }; @@ -1114,9 +1114,9 @@ namespace Test { namespace Fault { #ifdef GECODE_HAS_SET_VARS class MiniModelSetHeapFailures : public Base { public: - MiniModelSetHeapFailures(void) : Base("Fault::MiniModel::SetHeapFailures") {} + MiniModelSetHeapFailures() : Base("Fault::MiniModel::SetHeapFailures") {} bool - run(void) override { + run() override { return minimodel_set_heap_failures_are_recoverable(); } }; @@ -1124,9 +1124,9 @@ namespace Test { namespace Fault { class ClonePropagatorCopy : public Base { public: - ClonePropagatorCopy(void) : Base("Fault::Clone::PropagatorCopy") {} + ClonePropagatorCopy() : Base("Fault::Clone::PropagatorCopy") {} bool - run(void) override { + run() override { return clone_after_failed_copy(Phase::PROPAGATOR_COPY, 0) && clone_after_failed_copy(Phase::PROPAGATOR_COPY, 1); } @@ -1134,36 +1134,36 @@ namespace Test { namespace Fault { class CloneBrancherCopy : public Base { public: - CloneBrancherCopy(void) : Base("Fault::Clone::BrancherCopy") {} + CloneBrancherCopy() : Base("Fault::Clone::BrancherCopy") {} bool - run(void) override { + run() override { return clone_after_failed_copy(Phase::BRANCHER_COPY, 0) && clone_after_failed_copy(Phase::BRANCHER_COPY, 1); } }; class CloneAdvisorCopy : public Base { public: - CloneAdvisorCopy(void) : Base("Fault::Clone::AdvisorCopy") {} + CloneAdvisorCopy() : Base("Fault::Clone::AdvisorCopy") {} bool - run(void) override { + run() override { return clone_after_failed_advisor_copy(); } }; class CloneDerivedSpaceCopy : public Base { public: - CloneDerivedSpaceCopy(void) : Base("Fault::Clone::DerivedSpaceCopy") {} + CloneDerivedSpaceCopy() : Base("Fault::Clone::DerivedSpaceCopy") {} bool - run(void) override { + run() override { return expect_memory_exhausted(Phase::DERIVED_SPACE_COPY, 0); } }; class CloneLocalObjectCopy : public Base { public: - CloneLocalObjectCopy(void) : Base("Fault::Clone::LocalObjectCopy") {} + CloneLocalObjectCopy() : Base("Fault::Clone::LocalObjectCopy") {} bool - run(void) override { + run() override { return clone_after_failed_local_object_copy(); } }; @@ -1305,6 +1305,6 @@ namespace Test { namespace Fault { CloneLocalObjectCopy clone_local_object_copy; MiniModelLinearSumHeapFailures minimodel_linear_sum_heap_failures; -}} // namespace Test::Fault +} // namespace Test::Fault // STATISTICS: test-fault diff --git a/test/flatzinc.cpp b/test/flatzinc.cpp index 8e70f88554..4f4e5a239b 100644 --- a/test/flatzinc.cpp +++ b/test/flatzinc.cpp @@ -32,22 +32,28 @@ #include "test/flatzinc.hh" +#include #include #include #include #include -namespace Test { namespace FlatZinc { +namespace Test::FlatZinc { + + static_assert(std::is_base_of_v, + "FlatZinc errors must be catchable as standard exceptions"); + static_assert(std::is_base_of_v, + "FlatZinc type errors must be catchable as standard exceptions"); namespace { /// Verify that FlatZinc table conversion uses automatic representation. class TupleSetAutoRepresentation : public Base { public: - TupleSetAutoRepresentation(void) : Base("FlatZinc::TupleSet::AutoRepresentation") {} + TupleSetAutoRepresentation() : Base("FlatZinc::TupleSet::AutoRepresentation") {} bool - run(void) override { + run() override { using namespace Gecode; const int n = 4096; @@ -88,15 +94,15 @@ namespace Test { namespace FlatZinc { s->constrain(*best); if ((s->status() == Gecode::SS_FAILED) || s->fv[0].assigned()) return false; - bound = (source.find("minimize") != std::string::npos) ? s->fv[0].max() : s->fv[0].min(); + bound = source.contains("minimize") ? s->fv[0].max() : s->fv[0].min(); return true; } public: - FloatCutExcludesIncumbent(void) : Base("FlatZinc::Float::CutExcludesIncumbent") {} + FloatCutExcludesIncumbent() : Base("FlatZinc::Float::CutExcludesIncumbent") {} bool - run(void) override { + run() override { Gecode::FloatNum min_bound, max_bound; return cut_bound("var 0.0..1.0: x :: output_var;\nsolve minimize x;\n", min_bound) && cut_bound("var 0.0..1.0: x :: output_var;\nsolve maximize x;\n", max_bound) && @@ -118,10 +124,10 @@ namespace Test { namespace FlatZinc { } public: - IntegerObjectiveComparison(void) : Base("FlatZinc::IntegerObjectiveComparison") {} + IntegerObjectiveComparison() : Base("FlatZinc::IntegerObjectiveComparison") {} bool - run(void) override { + run() override { using namespace Gecode; std::unique_ptr one = model("var 1..1: x; solve minimize x;\n"); std::unique_ptr two = model("var 2..2: x; solve minimize x;\n"); @@ -136,6 +142,7 @@ namespace Test { namespace FlatZinc { (void)one->compare(*high); return false; } catch (const SpaceIncompatibleObjectives&) { + // Expected } std::unique_ptr sat = model("var 1..1: x; solve satisfy;\n"); if (!sat) @@ -144,6 +151,7 @@ namespace Test { namespace FlatZinc { (void)sat->compare(*sat); return false; } catch (const SpaceNoComparison&) { + // Expected } return true; } @@ -178,10 +186,10 @@ namespace Test { namespace FlatZinc { } public: - FloatObjectiveComparison(void) : Base("FlatZinc::FloatObjectiveComparison") {} + FloatObjectiveComparison() : Base("FlatZinc::FloatObjectiveComparison") {} bool - run(void) override { + run() override { using namespace Gecode; using Gecode::FlatZinc::FlatZincSpace; const FloatNum next = std::nextafter(1.0, 2.0); @@ -206,17 +214,17 @@ namespace Test { namespace FlatZinc { return false; const FloatVal probes[] = {FloatVal(8.4), FloatVal(8.5), FloatVal(8.9), FloatVal(9.0)}; - for (unsigned int i = 0; i < sizeof(probes) / sizeof(probes[0]); i++) { - if (admitted(probes[i], *m10, true, 1.0) != admitted(probes[i], *m10b, true, 1.0)) + for (const FloatVal& probe : probes) { + if (admitted(probe, *m10, true, 1.0) != admitted(probe, *m10b, true, 1.0)) return false; - if (admitted(probes[i], *m9, true, 1.0) && !admitted(probes[i], *m10, true, 1.0)) + if (admitted(probe, *m9, true, 1.0) && !admitted(probe, *m10, true, 1.0)) return false; } const FloatVal max_probes[] = {FloatVal(11.0), FloatVal(11.1), FloatVal(11.5), FloatVal(11.6)}; - for (unsigned int i = 0; i < sizeof(max_probes) / sizeof(max_probes[0]); i++) { - if (admitted(max_probes[i], *x10, false, 1.0) != admitted(max_probes[i], *x10b, false, 1.0)) + for (const FloatVal& max_probe : max_probes) { + if (admitted(max_probe, *x10, false, 1.0) != admitted(max_probe, *x10b, false, 1.0)) return false; - if (admitted(max_probes[i], *x11, false, 1.0) && !admitted(max_probes[i], *x10, false, 1.0)) + if (admitted(max_probe, *x11, false, 1.0) && !admitted(max_probe, *x10, false, 1.0)) return false; } std::unique_ptr zero = model(10.0, true); @@ -237,11 +245,13 @@ namespace Test { namespace FlatZinc { (void)m10->compare(*different_step); return false; } catch (const SpaceIncompatibleObjectives&) { + // Expected } try { (void)m10->compare(*x10); return false; } catch (const SpaceIncompatibleObjectives&) { + // Expected } return true; } @@ -267,10 +277,10 @@ namespace Test { namespace FlatZinc { } public: - GistStatisticsMode(void) : Base("FlatZinc::Options::GistStatisticsMode", TestTags::check()) {} + GistStatisticsMode() : Base("FlatZinc::Options::GistStatisticsMode", TestTags::check()) {} bool - run(void) override { + run() override { return (mode({"-s"}) == Gecode::SM_STATISTICS) && (mode({"-mode", "gist", "-s"}) == Gecode::SM_GIST) && (mode({"-s", "-mode", "gist"}) == Gecode::SM_GIST); } @@ -310,7 +320,7 @@ namespace Test { namespace FlatZinc { _expected_message(std::move(expected_message)) {} bool - FlatZincTest::run(void) { + FlatZincTest::run() { using namespace Gecode; Support::Timer t_total; t_total.start(); @@ -349,11 +359,11 @@ namespace Test { namespace FlatZinc { if (opt.log) olog << "FlatZinc produced the following output:\n" << output << "\n"; return false; - } else { - if (opt.log) - olog << "Could not parse input\n"; - return false; } + if (opt.log) + olog << "Could not parse input\n"; + return false; + } catch (Gecode::FlatZinc::Error& e) { if (opt.log) olog << ind(2) << "FlatZinc error : " << e.to_string() << '\n'; @@ -363,7 +373,7 @@ namespace Test { namespace FlatZinc { } bool - FlatZincErrorTest::run(void) { + FlatZincErrorTest::run() { using namespace Gecode; Support::Timer t_total; t_total.start(); @@ -393,18 +403,18 @@ namespace Test { namespace FlatZinc { const std::string& message = e.to_string(); if (opt.log) olog << ind(2) << "Expected FlatZinc error : " << message << '\n'; - return (os.str().find("----------") == std::string::npos) && - (_expected_message.empty() || (message.find(_expected_message) != std::string::npos)); + return (!os.str().contains("----------")) && + (_expected_message.empty() || (message.contains(_expected_message))); } catch (Gecode::Exception& e) { const std::string message = e.what(); if (opt.log) olog << ind(2) << "Expected Gecode exception : " << message << '\n'; - return (os.str().find("----------") == std::string::npos) && - (_expected_message.empty() || (message.find(_expected_message) != std::string::npos)); + return (!os.str().contains("----------")) && + (_expected_message.empty() || (message.contains(_expected_message))); } return false; } -}} // namespace Test::FlatZinc +} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc.hh b/test/flatzinc.hh index f3091d381e..d0c9c6a7db 100644 --- a/test/flatzinc.hh +++ b/test/flatzinc.hh @@ -42,58 +42,54 @@ #include #include -namespace Test { +/// Tests for FlatZinc +namespace Test::FlatZinc { - /// Tests for FlatZinc - namespace FlatZinc { + /** + * \brief %Base class for tests for FlatZinc + * + */ + class FlatZincTest : public Base { + protected: + using OutputCheck = std::function; + using BeforeRun = std::function; + std::string _name; + std::string _source; + std::string _expected; + bool _all_solutions; + std::vector _cmdline_opt; + OutputCheck _check; + BeforeRun _before; - /** - * \brief %Base class for tests for FlatZinc - * - */ - class FlatZincTest : public Base { - protected: - typedef std::function OutputCheck; - typedef std::function BeforeRun; - std::string _name; - std::string _source; - std::string _expected; - bool _all_solutions; - std::vector _cmdline_opt; - OutputCheck _check; - BeforeRun _before; + public: + /// Construct and register test + FlatZincTest(const std::string& name, const std::string& source, const std::string& expected, + bool all_solutions = false, std::vector cmdline_opt = {}, + OutputCheck check = OutputCheck(), BeforeRun before = BeforeRun()); + /// Construct and register a test with explicitly assigned tags + FlatZincTest(TestTags tags, const std::string& name, const std::string& source, const std::string& expected, + bool all_solutions = false, std::vector cmdline_opt = {}, + OutputCheck check = OutputCheck(), BeforeRun before = BeforeRun()); + /// Perform test + bool run() override; + }; - public: - /// Construct and register test - FlatZincTest(const std::string& name, const std::string& source, const std::string& expected, - bool all_solutions = false, std::vector cmdline_opt = {}, - OutputCheck check = OutputCheck(), BeforeRun before = BeforeRun()); - /// Construct and register a test with explicitly assigned tags - FlatZincTest(TestTags tags, const std::string& name, const std::string& source, const std::string& expected, - bool all_solutions = false, std::vector cmdline_opt = {}, - OutputCheck check = OutputCheck(), BeforeRun before = BeforeRun()); - /// Perform test - bool run(void) override; - }; + class FlatZincErrorTest : public FlatZincTest { + private: + std::string _expected_message; - class FlatZincErrorTest : public FlatZincTest { - private: - std::string _expected_message; + public: + /// Construct and register test + FlatZincErrorTest(const std::string& name, const std::string& source, std::vector cmdline_opt = {}, + std::string expected_message = ""); + /// Construct and register an error test with explicitly assigned tags + FlatZincErrorTest(TestTags tags, const std::string& name, const std::string& source, + std::vector cmdline_opt = {}, std::string expected_message = ""); + /// Perform test + bool run() override; + }; - public: - /// Construct and register test - FlatZincErrorTest(const std::string& name, const std::string& source, - std::vector cmdline_opt = {}, std::string expected_message = ""); - /// Construct and register an error test with explicitly assigned tags - FlatZincErrorTest(TestTags tags, const std::string& name, const std::string& source, - std::vector cmdline_opt = {}, std::string expected_message = ""); - /// Perform test - bool run(void) override; - }; - - } // namespace FlatZinc - -} // namespace Test +} // namespace Test::FlatZinc #endif diff --git a/test/flatzinc/2dpacking.cpp b/test/flatzinc/2dpacking.cpp index d152457272..0ec5b39812 100644 --- a/test/flatzinc/2dpacking.cpp +++ b/test/flatzinc/2dpacking.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "2DPacking", "predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -97,6 +97,6 @@ obj = 1;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/alpha.cpp b/test/flatzinc/alpha.cpp index 6d0738b95a..53a6e56ed6 100644 --- a/test/flatzinc/alpha.cpp +++ b/test/flatzinc/alpha.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("alpha", "predicate all_different_int(array [int] of var int: x);\n\ predicate all_equal_int(array [int] of var int: x);\n\ predicate among(var int: n, array [int] of var int: x, set of int: v);\n\ @@ -168,6 +168,6 @@ z = 18;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/battleships1.cpp b/test/flatzinc/battleships1.cpp index cc3af3f2be..b0be99a2c9 100644 --- a/test/flatzinc/battleships1.cpp +++ b/test/flatzinc/battleships1.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "battleships::1", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -1491,6 +1491,6 @@ solve :: int_search(a_flat, first_fail, indomain_max, complete) satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/battleships10.cpp b/test/flatzinc/battleships10.cpp index c38178d4a4..1b13c66889 100644 --- a/test/flatzinc/battleships10.cpp +++ b/test/flatzinc/battleships10.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "battleships::10", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -1974,6 +1974,6 @@ solve :: int_search(a_flat, first_fail, indomain_max, complete) satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/battleships2.cpp b/test/flatzinc/battleships2.cpp index 39ab2473e5..b00b75d228 100644 --- a/test/flatzinc/battleships2.cpp +++ b/test/flatzinc/battleships2.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "battleships::2", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -780,6 +780,6 @@ solve :: int_search(a_flat, first_fail, indomain_max, complete) satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/battleships3.cpp b/test/flatzinc/battleships3.cpp index 8857fd75c8..7ba667786d 100644 --- a/test/flatzinc/battleships3.cpp +++ b/test/flatzinc/battleships3.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "battleships::3", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -2110,6 +2110,6 @@ solve :: int_search(a_flat, first_fail, indomain_max, complete) satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/battleships4.cpp b/test/flatzinc/battleships4.cpp index ad31c2fb09..b7eaa60c97 100644 --- a/test/flatzinc/battleships4.cpp +++ b/test/flatzinc/battleships4.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "battleships::4", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -2029,6 +2029,6 @@ solve :: int_search(a_flat, first_fail, indomain_max, complete) satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/battleships5.cpp b/test/flatzinc/battleships5.cpp index 358e1518f4..662ddf36be 100644 --- a/test/flatzinc/battleships5.cpp +++ b/test/flatzinc/battleships5.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "battleships::5", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -1974,6 +1974,6 @@ solve :: int_search(a_flat, first_fail, indomain_max, complete) satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/battleships7.cpp b/test/flatzinc/battleships7.cpp index 1ac79cdc07..8f3db32bd1 100644 --- a/test/flatzinc/battleships7.cpp +++ b/test/flatzinc/battleships7.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "battleships::7", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -1750,6 +1750,6 @@ solve :: int_search(a_flat, first_fail, indomain_max, complete) satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/battleships9.cpp b/test/flatzinc/battleships9.cpp index ab1bce833f..c0c189bf94 100644 --- a/test/flatzinc/battleships9.cpp +++ b/test/flatzinc/battleships9.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "battleships::9", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -2140,6 +2140,6 @@ solve :: int_search(a_flat, first_fail, indomain_max, complete) satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/blackbox-dll.cpp b/test/flatzinc/blackbox-dll.cpp index e434775175..c3c8d601ac 100644 --- a/test/flatzinc/blackbox-dll.cpp +++ b/test/flatzinc/blackbox-dll.cpp @@ -72,7 +72,7 @@ namespace { std::atomic next_id(0); unsigned int - instance_id(void) { + instance_id() { return next_id.fetch_add(1, std::memory_order_relaxed) + 1; } diff --git a/test/flatzinc/blackbox-exec.cpp b/test/flatzinc/blackbox-exec.cpp index 5da529bf95..cfd373a70f 100644 --- a/test/flatzinc/blackbox-exec.cpp +++ b/test/flatzinc/blackbox-exec.cpp @@ -40,6 +40,9 @@ #include #ifdef _WIN32 +#ifndef NOMINMAX +#define NOMINMAX 1 // Ensure the words min/max remain available +#endif #include #else #include @@ -50,7 +53,7 @@ namespace { std::string - process_id(void) { + process_id() { #ifdef _WIN32 return std::to_string(static_cast(GetCurrentProcessId())); #else @@ -129,7 +132,7 @@ namespace { errno = 0; const long long parsed = std::strtoll(integer.c_str(), &last, 10); if ((last == integer.c_str()) || (*last != '\0') || (errno == ERANGE) || - (parsed < (std::numeric_limits::min)()) || (parsed > (std::numeric_limits::max)())) { + (parsed < std::numeric_limits::min()) || (parsed > std::numeric_limits::max())) { return false; } value = static_cast(parsed); @@ -166,15 +169,20 @@ namespace { static const std::string malformed("x;"); if (mode == "value7") { return &value7; - } else if (mode == "bounds2") { + } + if (mode == "bounds2") { return &bounds2; - } else if (mode == "bounds4") { + } + if (mode == "bounds4") { return &bounds4; - } else if (mode == "mixed") { + } + if (mode == "mixed") { return &mixed; - } else if (mode == "nan") { + } + if (mode == "nan") { return &nan; - } else if (mode == "malformed") { + } + if (mode == "malformed") { return &malformed; } return nullptr; @@ -189,7 +197,7 @@ namespace { } else if (kind == 3) { write_response(std::string(";\0x", 3)); } else if (kind == 5) { - write_response(std::to_string((std::numeric_limits::max)()) + ";"); + write_response(std::to_string(std::numeric_limits::max()) + ";"); } else { write_response(std::string(1024U * 1024U + 1U, 'x')); } diff --git a/test/flatzinc/blackbox.cpp b/test/flatzinc/blackbox.cpp index ad5293da86..a40b6522ee 100644 --- a/test/flatzinc/blackbox.cpp +++ b/test/flatzinc/blackbox.cpp @@ -49,12 +49,12 @@ #include #endif -#if defined(GECODE_HAS_POSIX_BLACKBOX_EXEC) +#ifdef GECODE_HAS_POSIX_BLACKBOX_EXEC #include #include #endif -namespace Test { namespace FlatZinc { +namespace Test::FlatZinc { namespace { const char* blackbox_decl = "predicate gecode_blackbox(" @@ -106,7 +106,7 @@ namespace Test { namespace FlatZinc { void reset_log(const std::string& log) { - std::remove(log.c_str()); + (void)std::remove(log.c_str()); } std::vector> @@ -116,7 +116,7 @@ namespace Test { namespace FlatZinc { std::string event; std::string id; while (in >> event >> id) { - entries.push_back(std::make_pair(event, id)); + entries.emplace_back(event, id); } return entries; } @@ -178,9 +178,8 @@ namespace Test { namespace FlatZinc { instances.insert(prototype); return (entries.size() == 10) && (entries[0].first == "init") && (inits == 1) && (clone_count == 2) && (start_count == 2) && (ready_count == 2) && (free_count == 3) && (clones.size() == 2) && - (clones.find(prototype) == clones.end()) && (starts == clones) && (ready == clones) && - (freed == instances) && frees_after_calls && - (calls == std::vector{"start", "start", "ready", "ready"}); + (!clones.contains(prototype)) && (starts == clones) && (ready == clones) && (freed == instances) && + frees_after_calls && (calls == std::vector{"start", "start", "ready", "ready"}); } bool @@ -211,12 +210,12 @@ namespace Test { namespace FlatZinc { return true; } -#if defined(GECODE_HAS_POSIX_BLACKBOX_EXEC) +#ifdef GECODE_HAS_POSIX_BLACKBOX_EXEC bool descendant_gone(const std::string& output, const std::string& log) { const std::vector> entries = read_log(log); reset_log(log); - if (output.find("y = 1;") == std::string::npos) { + if (!output.contains("y = 1;")) { return false; } for (const auto& entry : entries) { @@ -242,9 +241,9 @@ namespace Test { namespace FlatZinc { namespace Blackbox { class NativeProtocol : public Base { public: - NativeProtocol(void) : Base("FlatZinc::blackbox::native_protocol", TestTags::check()) {} + NativeProtocol() : Base("FlatZinc::blackbox::native_protocol", TestTags::check()) {} bool - run(void) override { + run() override { std::vector int_input{-2}; std::vector float_input{1.25}; std::vector int_output(1); @@ -264,7 +263,7 @@ namespace Test { namespace FlatZinc { #ifdef GECODE_HAS_THREADS template - bool + static bool parallel_runs(T& black_box) { bool echoed[2] = {false, false}; std::exception_ptr exception[2]; @@ -281,7 +280,7 @@ namespace Test { namespace FlatZinc { }; std::thread first; std::thread second; - auto join = [&first, &second](void) { + auto join = [&first, &second]() { if (first.joinable()) { first.join(); } @@ -310,13 +309,14 @@ namespace Test { namespace FlatZinc { NativeExecParallelSessions(const std::string& executable0, const std::string& log0) : Base("FlatZinc::blackbox::native_exec_parallel_sessions"), executable(executable0), log(log0) {} bool - run(void) override { + run() override { reset_log(log); bool ok = false; try { Gecode::FlatZinc::BlackBoxExec black_box(executable, {"normal", log}); ok = parallel_runs(black_box) && concurrent_log(log); } catch (...) { + // Ignored: the check after this block reports the failure } reset_log(log); return ok; @@ -333,7 +333,7 @@ namespace Test { namespace FlatZinc { NativeDllParallelCalls(const std::string& library0, const std::string& log0) : Base("FlatZinc::blackbox::native_dll_parallel_calls"), library(library0), log(log0) {} bool - run(void) override { + run() override { reset_log(log); bool ok = false; try { @@ -343,6 +343,7 @@ namespace Test { namespace FlatZinc { } ok = ok && dll_parallel_lifecycle(log); } catch (...) { + // Ignored: the check after this block reports the failure } reset_log(log); return ok; @@ -353,7 +354,7 @@ namespace Test { namespace FlatZinc { class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new NativeProtocol; (void)new FlatZincErrorTest(TestTags::check(), "blackbox::malformed_annotation", std::string(blackbox_decl) + @@ -515,7 +516,7 @@ namespace Test { namespace FlatZinc { } #endif -#if defined(GECODE_HAS_POSIX_BLACKBOX_EXEC) +#ifdef GECODE_HAS_POSIX_BLACKBOX_EXEC const std::string descendant_log = fixture_log("exec_descendant"); if (!descendant_log.empty()) { (void)new FlatZincTest( @@ -530,7 +531,7 @@ namespace Test { namespace FlatZinc { [descendant_log](const std::string& output) { return descendant_gone(output, descendant_log); }, - [descendant_log](void) { reset_log(descendant_log); }); + [descendant_log]() { reset_log(descendant_log); }); } #endif } @@ -576,7 +577,7 @@ namespace Test { namespace FlatZinc { reset_log(dll_model_log); return ok; }, - [dll_model_log](void) { reset_log(dll_model_log); }); + [dll_model_log]() { reset_log(dll_model_log); }); } #ifdef GECODE_HAS_THREADS @@ -603,6 +604,6 @@ namespace Test { namespace FlatZinc { Create c; } // namespace Blackbox -}} // namespace Test::FlatZinc +} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/blocksworld_instance_1.cpp b/test/flatzinc/blocksworld_instance_1.cpp index a705d8053b..e34a0b415a 100644 --- a/test/flatzinc/blocksworld_instance_1.cpp +++ b/test/flatzinc/blocksworld_instance_1.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("blocksworld::1", std::string("predicate all_different_int(array [int] of var int: x);\n\ predicate all_equal_int(array [int] of var int: x);\n\ @@ -310,6 +310,6 @@ solve :: int_search([on[1], on[2], on[3], on[4], on[5], on[6], on[7], on[8], on }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/blocksworld_instance_2.cpp b/test/flatzinc/blocksworld_instance_2.cpp index c849cfe556..bfe6b40ae3 100644 --- a/test/flatzinc/blocksworld_instance_2.cpp +++ b/test/flatzinc/blocksworld_instance_2.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "blocksworld::2", std::string("predicate all_different_int(array [int] of var int: x);\n\ @@ -872,6 +872,6 @@ solve :: int_search([on[1], on[2], on[3], on[4], on[5], on[6], on[7], on[8], on }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/bool_clause.cpp b/test/flatzinc/bool_clause.cpp index e2702a0048..8246e34f82 100644 --- a/test/flatzinc/bool_clause.cpp +++ b/test/flatzinc/bool_clause.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("bool_clause", "var bool: w :: output_var;\ var bool: x :: output_var;\ array [1..3] of var bool: y :: output_array([1..3]);\ @@ -60,6 +60,6 @@ z = array1d(1..3, [false, false, false]);\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/branching.cpp b/test/flatzinc/branching.cpp index e348a05ea2..8f10e89909 100644 --- a/test/flatzinc/branching.cpp +++ b/test/flatzinc/branching.cpp @@ -38,8 +38,8 @@ #include #include -namespace Test { namespace FlatZinc { namespace { - typedef std::unique_ptr FlatZincSpacePtr; +namespace Test::FlatZinc { namespace { + using FlatZincSpacePtr = std::unique_ptr; /// Parse \a source and post its branchers with options \a args FlatZincSpacePtr @@ -84,10 +84,10 @@ namespace Test { namespace FlatZinc { namespace { } public: - DefaultSearchDecay(void) : Base("FlatZinc::Branching::DefaultSearchDecay") {} + DefaultSearchDecay() : Base("FlatZinc::Branching::DefaultSearchDecay") {} bool - run(void) override { + run() override { return uses_option("var 0..1: x :: output_var;\n" "var bool: b :: output_var;\n" "solve satisfy;\n") && @@ -111,10 +111,10 @@ namespace Test { namespace FlatZinc { namespace { } public: - IntBoolDecay(void) : Base("FlatZinc::Branching::IntBoolDecay") {} + IntBoolDecay() : Base("FlatZinc::Branching::IntBoolDecay") {} bool - run(void) override { + run() override { using namespace Gecode::FlatZinc; return keeps_decay(int_bool_var_afc_max(0.5)) && keeps_decay(int_bool_var_afc_size_max(0.5)) && keeps_decay(int_bool_var_action_max(0.5)) && keeps_decay(int_bool_var_action_size_max(0.5)); @@ -134,10 +134,10 @@ namespace Test { namespace FlatZinc { namespace { } public: - SetRelationNames(void) : Base("FlatZinc::Branching::SetRelationNames") {} + SetRelationNames() : Base("FlatZinc::Branching::SetRelationNames") {} bool - run(void) override { + run() override { return prints("set_search([s], input_order, indomain_min, complete)", "s in 1", "s not in 1") && prints("set_search([s], input_order, outdomain_min, complete)", "s not in 1", "s in 1") && prints("set_default_search(input_order, outdomain_min)", "s not in 1", "s in 1"); @@ -171,10 +171,10 @@ namespace Test { namespace FlatZinc { namespace { /// Verify that a cloned auxiliary brancher keeps the default search. class AuxVarClone : public Base { public: - AuxVarClone(void) : Base("FlatZinc::Branching::AuxVarClone") {} + AuxVarClone() : Base("FlatZinc::Branching::AuxVarClone") {} bool - run(void) override { + run() override { FlatZincSpacePtr fg = post_branchers("var 0..3: a :: var_is_introduced;\n" "solve :: int_default_search(input_order, indomain_max) satisfy;\n"); if (!fg) @@ -192,6 +192,6 @@ namespace Test { namespace FlatZinc { namespace { }; AuxVarClone aux_var_clone; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/bug232.cpp b/test/flatzinc/bug232.cpp index 6746048e23..7c7512bbf6 100644 --- a/test/flatzinc/bug232.cpp +++ b/test/flatzinc/bug232.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("bug232", "var 0..1: INT___1;\ var bool: BOOL___6;\ constraint int_lin_le_reif([0], [INT___1], 4, BOOL___6);\ @@ -48,6 +48,6 @@ solve satisfy;\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/bug319.cpp b/test/flatzinc/bug319.cpp index 0dcfd5d5fa..88e8472973 100644 --- a/test/flatzinc/bug319.cpp +++ b/test/flatzinc/bug319.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("bug319", "var 3..3: obj :: output_var = 3;\ solve minimize obj;", "obj = 3;\n\ @@ -48,6 +48,6 @@ solve minimize obj;", }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/bugfix_r6746.cpp b/test/flatzinc/bugfix_r6746.cpp index 4d9db2bcdb..de4e536fe2 100644 --- a/test/flatzinc/bugfix_r6746.cpp +++ b/test/flatzinc/bugfix_r6746.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("bugfix_r6746", "\ array[1 .. 3] of var 0 .. 9: differences; \ array[1 .. 3] of var 0 .. 9: mark :: output_array([1..3]); \ @@ -63,6 +63,6 @@ solve \ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/bugfix_r7854.cpp b/test/flatzinc/bugfix_r7854.cpp index 76ba69d404..4a537e76af 100644 --- a/test/flatzinc/bugfix_r7854.cpp +++ b/test/flatzinc/bugfix_r7854.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("bugfix_r7854", "\ array[1 .. 9] of var 0 .. 8: pos__253 :: output_array([1..9]);\ array[1 .. 17] of var 0 .. 1: y__967::var_is_introduced;\ @@ -238,6 +238,6 @@ sat = 8;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/cumulatives.cpp b/test/flatzinc/cumulatives.cpp index 1e7208adfe..b57a4bad0f 100644 --- a/test/flatzinc/cumulatives.cpp +++ b/test/flatzinc/cumulatives.cpp @@ -32,18 +32,18 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("cumulatives", "constraint cumulatives([0, 0], [1, 1], [0,1], 1); solve satisfy;", "----------\n"); } }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/cumulatives_full_1.cpp b/test/flatzinc/cumulatives_full_1.cpp index 02339a3a80..08bdf1ca44 100644 --- a/test/flatzinc/cumulatives_full_1.cpp +++ b/test/flatzinc/cumulatives_full_1.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("cumulatives_full::1", R"FZN( var 1..2: d1; @@ -60,6 +60,6 @@ r2 = 2; }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/cumulatives_full_2.cpp b/test/flatzinc/cumulatives_full_2.cpp index 966b8e8c1f..e6c4e11053 100644 --- a/test/flatzinc/cumulatives_full_2.cpp +++ b/test/flatzinc/cumulatives_full_2.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("cumulatives_full::2", R"FZN( var 1..2: d1; @@ -56,6 +56,6 @@ r2 = 2; }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/cumulatives_full_3.cpp b/test/flatzinc/cumulatives_full_3.cpp index e27ff93a65..f55f8ec184 100644 --- a/test/flatzinc/cumulatives_full_3.cpp +++ b/test/flatzinc/cumulatives_full_3.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("cumulatives_full::3", R"FZN( var 3..4: r1 :: output_var; @@ -58,6 +58,6 @@ r2 = 2; }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/cumulatives_full_4.cpp b/test/flatzinc/cumulatives_full_4.cpp index a746052bdb..c354bf14e1 100644 --- a/test/flatzinc/cumulatives_full_4.cpp +++ b/test/flatzinc/cumulatives_full_4.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("cumulatives_full::4", R"FZN( var 3..4: r1 :: output_var; @@ -54,6 +54,6 @@ r2 = 2; }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/cumulatives_full_5.cpp b/test/flatzinc/cumulatives_full_5.cpp index f37588433d..ff0f6c7a93 100644 --- a/test/flatzinc/cumulatives_full_5.cpp +++ b/test/flatzinc/cumulatives_full_5.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("cumulatives_full::5", R"FZN( var 1..2: d1; @@ -56,6 +56,6 @@ m2 = 1; }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/cumulatives_full_6.cpp b/test/flatzinc/cumulatives_full_6.cpp index 4633c188be..e2dd088baf 100644 --- a/test/flatzinc/cumulatives_full_6.cpp +++ b/test/flatzinc/cumulatives_full_6.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("cumulatives_full::6", R"FZN( var 1..2: d1 :: output_var; @@ -53,6 +53,6 @@ solve satisfy; }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/cumulatives_full_7.cpp b/test/flatzinc/cumulatives_full_7.cpp index 452e4668eb..780b5a5ac9 100644 --- a/test/flatzinc/cumulatives_full_7.cpp +++ b/test/flatzinc/cumulatives_full_7.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("cumulatives_full::7", R"FZN( var 0..1: m1 :: output_var; @@ -54,6 +54,6 @@ m2 = 1; }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/cumulatives_full_8.cpp b/test/flatzinc/cumulatives_full_8.cpp index 2bbd0f7418..b2ee44544f 100644 --- a/test/flatzinc/cumulatives_full_8.cpp +++ b/test/flatzinc/cumulatives_full_8.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("cumulatives_full::8", R"FZN( % The two overlapping tasks exceed machine 0's capacity. @@ -53,6 +53,6 @@ solve satisfy; }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/cutstock.cpp b/test/flatzinc/cutstock.cpp index bce45a264e..e3dad09412 100644 --- a/test/flatzinc/cutstock.cpp +++ b/test/flatzinc/cutstock.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "cutstock", "predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -97,6 +97,6 @@ pieces = array1d(1..8, [0, 0, 0, 0, 1, 1, 1, 1]);\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/empty_domain_1.cpp b/test/flatzinc/empty_domain_1.cpp index 39e8d6ffac..075440ca36 100644 --- a/test/flatzinc/empty_domain_1.cpp +++ b/test/flatzinc/empty_domain_1.cpp @@ -32,17 +32,17 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("empty_domain_1", "var 11..10: x;solve satisfy;", "=====UNSATISFIABLE=====\n"); } }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/empty_domain_2.cpp b/test/flatzinc/empty_domain_2.cpp index af5adbdc2a..c6b0dc2e83 100644 --- a/test/flatzinc/empty_domain_2.cpp +++ b/test/flatzinc/empty_domain_2.cpp @@ -32,18 +32,18 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("empty_domain_2", "array [1 .. 3] of var 11..10: x; solve satisfy;", "=====UNSATISFIABLE=====\n"); } }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/empty_set_literal.cpp b/test/flatzinc/empty_set_literal.cpp index ed7d478ce1..4e0d9cb500 100644 --- a/test/flatzinc/empty_set_literal.cpp +++ b/test/flatzinc/empty_set_literal.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("empty_set_literal_int_var", "var {}: x :: output_var; solve satisfy;", "=====UNSATISFIABLE=====\n"); #ifdef GECODE_HAS_SET_VARS @@ -50,6 +50,6 @@ namespace Test { namespace FlatZinc { namespace { }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/eq20.cpp b/test/flatzinc/eq20.cpp index feac0cfd91..9f2c1cc055 100644 --- a/test/flatzinc/eq20.cpp +++ b/test/flatzinc/eq20.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "eq20", "predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -73,6 +73,6 @@ solve satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/factory_planning_instance.cpp b/test/flatzinc/factory_planning_instance.cpp index a402f31ff6..2f90c14638 100644 --- a/test/flatzinc/factory_planning_instance.cpp +++ b/test/flatzinc/factory_planning_instance.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "factory_planning", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -320,6 +320,6 @@ step_prod_mach = array2d(1..5, 1..2, [1, 1, 1, 4, 2, 1, 3, 2, 5, 5]);\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/golomb.cpp b/test/flatzinc/golomb.cpp index f878d6df71..aca50dc1ac 100644 --- a/test/flatzinc/golomb.cpp +++ b/test/flatzinc/golomb.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("golomb", "predicate all_different_int(array [int] of var int: x);\n\ predicate all_equal_int(array [int] of var int: x);\n\ predicate among(var int: n, array [int] of var int: x, set of int: v);\n\ @@ -117,6 +117,6 @@ solve :: int_search(mark, input_order, indomain, complete) minimize mark[4];\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/int_set_as_type1.cpp b/test/flatzinc/int_set_as_type1.cpp index 5eb50791ec..d5c8043f2f 100644 --- a/test/flatzinc/int_set_as_type1.cpp +++ b/test/flatzinc/int_set_as_type1.cpp @@ -32,18 +32,18 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("int_set_as_type1", "var {1, 3, 5}: x :: output_var; solve maximize x;", "x = 5;\n----------\n==========\n"); } }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/int_set_as_type2.cpp b/test/flatzinc/int_set_as_type2.cpp index d258ad2b3e..1f14c511cd 100644 --- a/test/flatzinc/int_set_as_type2.cpp +++ b/test/flatzinc/int_set_as_type2.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("int_set_as_type2", "array[1..4] of var {1, 3, 4}: x :: output_array([1..4]);" "solve satisfy;", @@ -46,6 +46,6 @@ namespace Test { namespace FlatZinc { namespace { }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/issue166.cpp b/test/flatzinc/issue166.cpp index 95ec11840d..d5bd1b5f95 100644 --- a/test/flatzinc/issue166.cpp +++ b/test/flatzinc/issue166.cpp @@ -31,7 +31,7 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Check that recomputation does not lose solutions bool check(const std::string& output, int expected, const std::string& representative) { @@ -39,14 +39,14 @@ namespace Test { namespace FlatZinc { namespace { int solutions = 0; for (std::string::size_type p = 0; (p = output.find(separator, p)) != std::string::npos; p += separator.size()) solutions++; - return (solutions == expected) && (output.find(representative) != std::string::npos); + return (solutions == expected) && (output.contains(representative)); } /// Helper class to create and register test class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "Issue166::Original", "predicate gecode_global_cardinality(array [int] of var int: x, array [int] of int: cover, array [int] of var int: counts);\n\ @@ -83,6 +83,6 @@ solve :: int_search([D,A,E,B],input_order,indomain_random,complete) satisfy;\n", }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/issue168.cpp b/test/flatzinc/issue168.cpp index 0489908910..91d0870a37 100644 --- a/test/flatzinc/issue168.cpp +++ b/test/flatzinc/issue168.cpp @@ -31,7 +31,7 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Check that propagation terminates after finding all solutions bool check(const std::string& output) { @@ -39,14 +39,14 @@ namespace Test { namespace FlatZinc { namespace { int solutions = 0; for (std::string::size_type p = 0; (p = output.find(separator, p)) != std::string::npos; p += separator.size()) solutions++; - return (solutions == 3) && (output.find("==========\n") != std::string::npos); + return (solutions == 3) && (output.contains("==========\n")); } /// Helper class to create and register test class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("Issue168", "predicate fzn_sort(array [int] of var int: x, array [int] of var int: y);\n\ var 2..4: D :: output_var;\n\ @@ -63,6 +63,6 @@ solve :: int_search([1,D,F,K,F,E,G,H,J],input_order,indomain,complete) satisfy;\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/jobshop.cpp b/test/flatzinc/jobshop.cpp index abf7e94663..2413b4eb25 100644 --- a/test/flatzinc/jobshop.cpp +++ b/test/flatzinc/jobshop.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("jobshop", "array [1..4] of var 0..14: s :: output_array([1..4]);\ var 0..14: end :: output_var;\ var bool: b1 :: output_var;\ @@ -69,6 +69,6 @@ s = array1d(1..4, [0, 2, 2, 7]);\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/jobshop2x2.cpp b/test/flatzinc/jobshop2x2.cpp index cad5157f52..ffbd8cea7d 100644 --- a/test/flatzinc/jobshop2x2.cpp +++ b/test/flatzinc/jobshop2x2.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "jobshop2x2", "predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -70,6 +70,6 @@ solve minimize end;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/knights.cpp b/test/flatzinc/knights.cpp index e12cfb66e0..49b4e5ec7c 100644 --- a/test/flatzinc/knights.cpp +++ b/test/flatzinc/knights.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "knights", "predicate all_different_int(array [int] of var int: x);\n\ predicate all_equal_int(array [int] of var int: x);\n\ @@ -208,6 +208,6 @@ solve :: int_search(p, input_order, indomain_min, complete) satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/langford2.cpp b/test/flatzinc/langford2.cpp index b1616c395c..e3fdab6b2f 100644 --- a/test/flatzinc/langford2.cpp +++ b/test/flatzinc/langford2.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "langford2", "predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -146,6 +146,6 @@ solve :: int_search(Fst, first_fail, indomain_min, complete) satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/latin_squares_fd.cpp b/test/flatzinc/latin_squares_fd.cpp index 33a172e632..39d06407a1 100644 --- a/test/flatzinc/latin_squares_fd.cpp +++ b/test/flatzinc/latin_squares_fd.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "latin_squares_fd", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -297,6 +297,6 @@ solve satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/magicsq_3.cpp b/test/flatzinc/magicsq_3.cpp index 2e73ead53f..7de16c7282 100644 --- a/test/flatzinc/magicsq_3.cpp +++ b/test/flatzinc/magicsq_3.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest(TestTags::check(), "magic_square::3", "predicate all_different_int(array [int] of var int: x);\n\ predicate all_equal_int(array [int] of var int: x);\n\ @@ -107,6 +107,6 @@ solve satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/magicsq_4.cpp b/test/flatzinc/magicsq_4.cpp index 21aa81c9cc..7117a92e74 100644 --- a/test/flatzinc/magicsq_4.cpp +++ b/test/flatzinc/magicsq_4.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest(TestTags::check(), "magic_square::4", "predicate all_different_int(array [int] of var int: x);\n\ predicate all_equal_int(array [int] of var int: x);\n\ @@ -109,6 +109,6 @@ solve satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/magicsq_5.cpp b/test/flatzinc/magicsq_5.cpp index 7547a5bd30..4134bf8515 100644 --- a/test/flatzinc/magicsq_5.cpp +++ b/test/flatzinc/magicsq_5.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( TestTags::check(), "magic_square::5", "predicate all_different_int(array [int] of var int: x);\n\ predicate all_equal_int(array [int] of var int: x);\n\ @@ -111,6 +111,6 @@ solve satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/multidim_knapsack_simple.cpp b/test/flatzinc/multidim_knapsack_simple.cpp index 469c91e7ad..54a07e84f6 100644 --- a/test/flatzinc/multidim_knapsack_simple.cpp +++ b/test/flatzinc/multidim_knapsack_simple.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "multidim_knapsack_simple", "predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -63,6 +63,6 @@ solve maximize INT____00001;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/native-registry.cpp b/test/flatzinc/native-registry.cpp index 616bc210b0..e477642988 100644 --- a/test/flatzinc/native-registry.cpp +++ b/test/flatzinc/native-registry.cpp @@ -35,13 +35,13 @@ #include -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { // Annotations preserve both consistency and algorithm flags. class AlgorithmAnnotations : public Base { public: - AlgorithmAnnotations(void) : Base("FlatZinc::NativeRegistry::AlgorithmAnnotations") {} + AlgorithmAnnotations() : Base("FlatZinc::NativeRegistry::AlgorithmAnnotations") {} bool - run(void) override { + run() override { const char* names[] = {"gecode_basic_propagation", "gecode_advanced_propagation", "gecode_full_propagation"}; const Gecode::IntPropLevel levels[] = {Gecode::IPL_BASIC, Gecode::IPL_ADVANCED, Gecode::IPL_FULL}; @@ -60,10 +60,10 @@ namespace Test { namespace FlatZinc { namespace { /// Advanced cumulative propagation detects an overload before search class CumulativeAlgorithmAnnotations : public Base { public: - CumulativeAlgorithmAnnotations(void) + CumulativeAlgorithmAnnotations() : Base("FlatZinc::NativeRegistry::CumulativeAlgorithmAnnotations", TestTags::check()) {} bool - run(void) override { + run() override { const char* levels[] = {"gecode_basic_propagation", "gecode_advanced_propagation", "gecode_full_propagation"}; for (int i = 0; i < 3; i++) { @@ -88,7 +88,7 @@ namespace Test { namespace FlatZinc { namespace { class Create { public: - Create(void) { + Create() { const std::string sat = "----------\n"; const std::string unsat = "=====UNSATISFIABLE=====\n"; // Explicit ends retain native scheduling semantics, including shared @@ -201,6 +201,6 @@ namespace Test { namespace FlatZinc { namespace { } }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/no_warn_empty_domain.cpp b/test/flatzinc/no_warn_empty_domain.cpp index 509cc7a83f..33c769f529 100644 --- a/test/flatzinc/no_warn_empty_domain.cpp +++ b/test/flatzinc/no_warn_empty_domain.cpp @@ -32,17 +32,17 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("no_warn_empty_domain", "var 11..10: x;solve satisfy;", "=====UNSATISFIABLE=====\n"); } }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/on_restart_complete.cpp b/test/flatzinc/on_restart_complete.cpp index 9f792061aa..8e95d74425 100644 --- a/test/flatzinc/on_restart_complete.cpp +++ b/test/flatzinc/on_restart_complete.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("on_restart::complete", R"FZN( predicate int_le_imp(var int: a,var int: b,var bool: r); @@ -72,6 +72,6 @@ x = 3; }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/on_restart_last_val_bool.cpp b/test/flatzinc/on_restart_last_val_bool.cpp index 2cb8d138b9..85bae53a68 100644 --- a/test/flatzinc/on_restart_last_val_bool.cpp +++ b/test/flatzinc/on_restart_last_val_bool.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("on_restart::last_val_bool", R"FZN( predicate gecode_on_restart_status(var int: s); @@ -80,6 +80,6 @@ y = true; }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/on_restart_last_val_float.cpp b/test/flatzinc/on_restart_last_val_float.cpp index 374b6216f8..1d4205f2bd 100644 --- a/test/flatzinc/on_restart_last_val_float.cpp +++ b/test/flatzinc/on_restart_last_val_float.cpp @@ -35,7 +35,7 @@ #include #include -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Check the restart sequence without depending on final decimal digits. bool check(const std::string& output) { @@ -60,7 +60,7 @@ namespace Test { namespace FlatZinc { namespace { class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("on_restart::last_val_float", R"FZN( predicate gecode_on_restart_status(var int: s); @@ -90,6 +90,6 @@ solve :: int_search(X_INTRODUCED_2_,input_order,indomain_min,complete) maximize }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/on_restart_last_val_int.cpp b/test/flatzinc/on_restart_last_val_int.cpp index 80d6ead0fc..9c3e768a4d 100644 --- a/test/flatzinc/on_restart_last_val_int.cpp +++ b/test/flatzinc/on_restart_last_val_int.cpp @@ -36,15 +36,15 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Check that reversed uniform integer ranges fail during parsing class UniformIntInvalidRange : public Base { public: /// Create and register test - UniformIntInvalidRange(void) : Base("FlatZinc::on_restart::uniform_int_invalid_range") {} + UniformIntInvalidRange() : Base("FlatZinc::on_restart::uniform_int_invalid_range") {} /// Perform test bool - run(void) override { + run() override { std::stringstream source(R"FZN( predicate gecode_on_restart_uniform_int(int: low,int: high,var int: out); var 0..1: y; @@ -55,8 +55,8 @@ solve satisfy; std::ostringstream err; Gecode::FlatZinc::FlatZincSpace* fg = Gecode::FlatZinc::parse(source, p, err); const std::string message = err.str(); - return fg == nullptr && message.find("gecode_on_restart_uniform_int") != std::string::npos && - message.find("low (1) <= high (0)") != std::string::npos; + return fg == nullptr && message.contains("gecode_on_restart_uniform_int") && + message.contains("low (1) <= high (0)"); } }; @@ -64,7 +64,7 @@ solve satisfy; class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("on_restart::last_val_int", R"FZN( predicate gecode_on_restart_status(var int: s); @@ -122,6 +122,6 @@ solve satisfy; Create c; UniformIntInvalidRange invalid_range; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/on_restart_last_val_set.cpp b/test/flatzinc/on_restart_last_val_set.cpp index 14db62bf93..2905b7b245 100644 --- a/test/flatzinc/on_restart_last_val_set.cpp +++ b/test/flatzinc/on_restart_last_val_set.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("on_restart::last_val_set", R"FZN( predicate gecode_on_restart_status(var int: s); @@ -149,6 +149,6 @@ y = {1, 2, 4, 8}; }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/on_restart_sol_bool.cpp b/test/flatzinc/on_restart_sol_bool.cpp index 7689e1f6d2..2000c272a7 100644 --- a/test/flatzinc/on_restart_sol_bool.cpp +++ b/test/flatzinc/on_restart_sol_bool.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("on_restart::sol_bool", R"FZN( predicate gecode_on_restart_sol_bool(var bool: input,var bool: out); @@ -82,6 +82,6 @@ y = true; }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/on_restart_sol_float.cpp b/test/flatzinc/on_restart_sol_float.cpp index e4e909ed26..dec0a343ca 100644 --- a/test/flatzinc/on_restart_sol_float.cpp +++ b/test/flatzinc/on_restart_sol_float.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("on_restart::sol_float", R"FZN(predicate gecode_on_restart_sol_float(var float: input,var float: out); predicate gecode_on_restart_status(var int: s); @@ -74,6 +74,6 @@ y = 2.0; }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/on_restart_sol_int.cpp b/test/flatzinc/on_restart_sol_int.cpp index 716ceaaebd..5b29b9a39b 100644 --- a/test/flatzinc/on_restart_sol_int.cpp +++ b/test/flatzinc/on_restart_sol_int.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("on_restart::sol_int", R"FZN( predicate gecode_on_restart_status(var int: s); @@ -76,6 +76,6 @@ y = 2; }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/on_restart_sol_set.cpp b/test/flatzinc/on_restart_sol_set.cpp index b093b30459..1a518936ae 100644 --- a/test/flatzinc/on_restart_sol_set.cpp +++ b/test/flatzinc/on_restart_sol_set.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("on_restart::sol_set", R"FZN(predicate int_eq_imp(var int: a,var int: b,var bool: r); predicate gecode_on_restart_status(var int: s); @@ -101,6 +101,6 @@ y = 1..1; }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/oss.cpp b/test/flatzinc/oss.cpp index 17e2a8fc77..92bc29c7ac 100644 --- a/test/flatzinc/oss.cpp +++ b/test/flatzinc/oss.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( TestTags::sweep(), "oss", "predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -157,6 +157,6 @@ start = array2d(1..3, 1..3, [0, 1162, 829, 1000, 505, 0, 829, 0, 505]);\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/output_test.cpp b/test/flatzinc/output_test.cpp index a412ae8b31..21bb34ed2b 100644 --- a/test/flatzinc/output_test.cpp +++ b/test/flatzinc/output_test.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("output_test", "var int: x :: output_var;\n\ array [1..3] of var 1..9: a :: output_array([1..3]);\n\ \n\ @@ -56,6 +56,6 @@ x = 10;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/packing.cpp b/test/flatzinc/packing.cpp index 1ea249c518..3ac1d8d724 100644 --- a/test/flatzinc/packing.cpp +++ b/test/flatzinc/packing.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( TestTags::sweep(), "packing", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -21135,6 +21135,6 @@ y = array1d(1..21, [0, 70, 33, 50, 0, 0, 85, 29, 88, 93, 70, 65, 54, 50, 82, 54, }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/perfsq.cpp b/test/flatzinc/perfsq.cpp index bdf32fecc5..c3512964c2 100644 --- a/test/flatzinc/perfsq.cpp +++ b/test/flatzinc/perfsq.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "perfect_square::1", "predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -163,6 +163,6 @@ s = array1d(0..10, [7, 5, 4, 3, 1, 0, 0, 0, 0, 0, 0]);\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/perfsq2.cpp b/test/flatzinc/perfsq2.cpp index 09024b587e..30d1404b30 100644 --- a/test/flatzinc/perfsq2.cpp +++ b/test/flatzinc/perfsq2.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "perfect_square::2", "predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -59,6 +59,6 @@ solve maximize INT____00001;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/photo.cpp b/test/flatzinc/photo.cpp index 935e396d43..cb0856dd1d 100644 --- a/test/flatzinc/photo.cpp +++ b/test/flatzinc/photo.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("photo", "predicate all_different_int(array [int] of var int: x);\n\ predicate all_equal_int(array [int] of var int: x);\n\ predicate among(var int: n, array [int] of var int: x, set of int: v);\n\ @@ -217,6 +217,6 @@ satisfies = 8;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/product_fd.cpp b/test/flatzinc/product_fd.cpp index ffdbafa2f0..6fec232467 100644 --- a/test/flatzinc/product_fd.cpp +++ b/test/flatzinc/product_fd.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "product::fd", "predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -68,6 +68,6 @@ outside = array1d(1..3, [60, 200, 300]);\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/product_lp.cpp b/test/flatzinc/product_lp.cpp index f10e61e376..f9bdb29750 100644 --- a/test/flatzinc/product_lp.cpp +++ b/test/flatzinc/product_lp.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "product::lp", "predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -74,6 +74,6 @@ outside = array1d(1..3, [60, 200, 300]);\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/quasigroup_qg5.cpp b/test/flatzinc/quasigroup_qg5.cpp index 5383e7a837..94e87f24ad 100644 --- a/test/flatzinc/quasigroup_qg5.cpp +++ b/test/flatzinc/quasigroup_qg5.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "quasigroup", std::string("predicate all_different_int(array [int] of var int: x);\n\ @@ -293,6 +293,6 @@ solve :: int_search(q, input_order, indomain, complete) satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/queen_cp2.cpp b/test/flatzinc/queen_cp2.cpp index 7fa9994764..4eb0c5687b 100644 --- a/test/flatzinc/queen_cp2.cpp +++ b/test/flatzinc/queen_cp2.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("queens::cp2", "predicate all_different_int(array [int] of var int: x);\n\ predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -84,6 +84,6 @@ solve :: int_search(q, first_fail, indomain_min, complete) satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/queen_ip.cpp b/test/flatzinc/queen_ip.cpp index 2154d9b410..0c645698c4 100644 --- a/test/flatzinc/queen_ip.cpp +++ b/test/flatzinc/queen_ip.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "queens::ip", "predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -95,6 +95,6 @@ solve :: int_search(q, first_fail, indomain_min, complete) satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/queens4.cpp b/test/flatzinc/queens4.cpp index 03533d8308..c4e9d99cab 100644 --- a/test/flatzinc/queens4.cpp +++ b/test/flatzinc/queens4.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("queens4", "array [1..4] of var 1..4: q :: output_array([1..4]);\n\ var int: dq01 :: output_var;\n\ var int: dq02 :: output_var;\n\ @@ -84,6 +84,6 @@ q = array1d(1..4, [3, 1, 4, 2]);\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/radiation.cpp b/test/flatzinc/radiation.cpp index 9dab7b37c9..998ee65c20 100644 --- a/test/flatzinc/radiation.cpp +++ b/test/flatzinc/radiation.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( TestTags::sweep(), "radiation", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -1288,6 +1288,6 @@ K = 7;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/random_branching.cpp b/test/flatzinc/random_branching.cpp index d5a87bbde0..014e1fc6bc 100644 --- a/test/flatzinc/random_branching.cpp +++ b/test/flatzinc/random_branching.cpp @@ -40,13 +40,13 @@ #include #include -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Integer and Boolean variables share one randomized value brancher. class IntBoolSpace : public Gecode::Space { public: Gecode::IntVarArray x; Gecode::BoolVarArray b; - IntBoolSpace(void) : x(*this, 5, 0, 3), b(*this, 3, 0, 1) { + IntBoolSpace() : x(*this, 5, 0, 3), b(*this, 3, 0, 1) { using namespace Gecode; Gecode::FlatZinc::branch(*this, x, b, Gecode::FlatZinc::int_bool_var_afc_size_max(0.99), INT_VAL_RND(Rnd(3))); @@ -56,7 +56,7 @@ namespace Test { namespace FlatZinc { namespace { b.update(*this, s.b); } Space* - copy(void) override { + copy() override { return new IntBoolSpace(*this); } }; @@ -81,9 +81,9 @@ namespace Test { namespace FlatZinc { namespace { /// Check that random value selection does not depend on recomputation class RandomIntBoolBranch : public Base { public: - RandomIntBoolBranch(void) : Base("FlatZinc::random_intbool_branch") {} + RandomIntBoolBranch() : Base("FlatZinc::random_intbool_branch") {} bool - run(void) override { + run() override { const std::string cloned = solutions(1); return (cloned == solutions(4)) && (cloned == solutions(100)); } @@ -110,7 +110,7 @@ namespace Test { namespace FlatZinc { namespace { random_options(const std::string& seed) { const std::string state = parsed_state({seed, "18446744073709551615"}); const std::string arbitrary = "splitmix-v1:fedcba9876543210:0123456789abcdef"; - return (state.rfind("splitmix-v1:ffffffffffffffff:", 0) == 0) && + return state.starts_with("splitmix-v1:ffffffffffffffff:") && (parsed_state({seed, "0xffffffffffffffff"}) == state) && (parsed_state({"-state", state}) == state) && (parsed_state({"-state", arbitrary}) == arbitrary); @@ -119,12 +119,12 @@ namespace Test { namespace FlatZinc { namespace { /// Check the random options of the driver and of FlatZinc class RandomOptions : public Base { public: - RandomOptions(void) : Base("FlatZinc::random_options") {} + RandomOptions() : Base("FlatZinc::random_options") {} bool - run(void) override { + run() override { return random_options("-seed") && random_options("-r"); } } random_options_test; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/sat_arith1.cpp b/test/flatzinc/sat_arith1.cpp index 38c7ad5079..8a7b3cade2 100644 --- a/test/flatzinc/sat_arith1.cpp +++ b/test/flatzinc/sat_arith1.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("sat_arith1", "\n\ var bool: v_1;\n\ var bool: v_2;\n\ @@ -361,6 +361,6 @@ b = array1d(1..8, [false, false, false, false, false, false, false, true]);\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/sat_array_bool_and.cpp b/test/flatzinc/sat_array_bool_and.cpp index e1361732a0..5f689f015d 100644 --- a/test/flatzinc/sat_array_bool_and.cpp +++ b/test/flatzinc/sat_array_bool_and.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("sat_array_bool_and", "\n\ array[1..10] of var bool: x :: output_array([1..10]);\n\ array[1..10] of var bool: y :: output_array([1..10]);\n\ @@ -55,6 +55,6 @@ y = array1d(1..10, [false, false, false, false, false, false, false, false, fals }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/sat_array_bool_or.cpp b/test/flatzinc/sat_array_bool_or.cpp index 325247426d..dcc1991dfe 100644 --- a/test/flatzinc/sat_array_bool_or.cpp +++ b/test/flatzinc/sat_array_bool_or.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("sat_array_bool_or", "\n\ array[1..4] of var bool: x :: output_array([1..4]);\n\ \n\ @@ -55,6 +55,6 @@ solve satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/sat_cmp_reif.cpp b/test/flatzinc/sat_cmp_reif.cpp index 4c5814004c..da92f875ee 100644 --- a/test/flatzinc/sat_cmp_reif.cpp +++ b/test/flatzinc/sat_cmp_reif.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "sat_cmp_reif", "var bool: lt_a;\n\ var bool: lt_b;\n\ @@ -67,6 +67,6 @@ solve satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/sat_eq_reif.cpp b/test/flatzinc/sat_eq_reif.cpp index fda0089942..c5838c2726 100644 --- a/test/flatzinc/sat_eq_reif.cpp +++ b/test/flatzinc/sat_eq_reif.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("sat_eq_reif", "var bool: eq_a;\n\ var bool: eq_b;\n\ var bool: eq_c;\n\ @@ -65,6 +65,6 @@ solve satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/shared_array_element.cpp b/test/flatzinc/shared_array_element.cpp index c7f0fff33f..d5a0b9cb47 100644 --- a/test/flatzinc/shared_array_element.cpp +++ b/test/flatzinc/shared_array_element.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("SharedArrayElement", "predicate count(array [int] of var int: x,var int: y,var int: c);\n\ array [1..6] of int: X_INTRODUCED_25_ = [0,0,1,1,0,1];\n\ @@ -106,6 +106,6 @@ Y = array1d(1..15, [0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0]);\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/simple_sat.cpp b/test/flatzinc/simple_sat.cpp index 0ca0358a48..80c5bda151 100644 --- a/test/flatzinc/simple_sat.cpp +++ b/test/flatzinc/simple_sat.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "simple_sat", "predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -67,6 +67,6 @@ solve satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/singHoist2.cpp b/test/flatzinc/singHoist2.cpp index e721b35a32..b9ad8423ab 100644 --- a/test/flatzinc/singHoist2.cpp +++ b/test/flatzinc/singHoist2.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "singHoist2", "predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ predicate bool_lin_gt(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -134,6 +134,6 @@ Removal = array1d(0..3, [0, 14, 43, 57]);\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/steiner_triples.cpp b/test/flatzinc/steiner_triples.cpp index 1df9b1d02f..bbe1a089d9 100644 --- a/test/flatzinc/steiner_triples.cpp +++ b/test/flatzinc/steiner_triples.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( TestTags::sweep(), "steiner_triples", "predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -151,6 +151,6 @@ solve :: set_search(sets, input_order, indomain_min, complete) satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/subtyping.cpp b/test/flatzinc/subtyping.cpp index 1100871848..a2d8303274 100644 --- a/test/flatzinc/subtyping.cpp +++ b/test/flatzinc/subtyping.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("subtyping::1", R"FZN( bool: pb = true; @@ -66,6 +66,6 @@ vs = 1..1; }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/sudoku.cpp b/test/flatzinc/sudoku.cpp index 5edcb4824b..4238bc49aa 100644 --- a/test/flatzinc/sudoku.cpp +++ b/test/flatzinc/sudoku.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "sudoku", "predicate all_different_int(array [int] of var int: x);\n\ predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -134,6 +134,6 @@ solve satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/template_design.cpp b/test/flatzinc/template_design.cpp index ae206c66dd..0b98412caf 100644 --- a/test/flatzinc/template_design.cpp +++ b/test/flatzinc/template_design.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest(TestTags::sweep(), "template_design", "predicate all_different_int(array [int] of var int: x);\n\ predicate all_equal_int(array [int] of var int: x);\n\ @@ -167,6 +167,6 @@ p = array2d(1..7, 1..2, [0, 1, 2, 0, 1, 1, 3, 0, 3, 0, 0, 3, 0, 4]);\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/tenpenki_1.cpp b/test/flatzinc/tenpenki_1.cpp index e95d77051e..52de356aee 100644 --- a/test/flatzinc/tenpenki_1.cpp +++ b/test/flatzinc/tenpenki_1.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( TestTags::sweep(), "tenpenki::1", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -429,6 +429,6 @@ solve satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/tenpenki_2.cpp b/test/flatzinc/tenpenki_2.cpp index d931d3d73a..53a1bd0992 100644 --- a/test/flatzinc/tenpenki_2.cpp +++ b/test/flatzinc/tenpenki_2.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( TestTags::sweep(), "tenpenki::1", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -2656,6 +2656,6 @@ solve satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/tenpenki_3.cpp b/test/flatzinc/tenpenki_3.cpp index 405dcfeaa1..c7b1b13480 100644 --- a/test/flatzinc/tenpenki_3.cpp +++ b/test/flatzinc/tenpenki_3.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( TestTags::sweep(), "tenpenki::3", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -388,6 +388,6 @@ solve satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/tenpenki_4.cpp b/test/flatzinc/tenpenki_4.cpp index ede752a4a1..1f9a1a49ea 100644 --- a/test/flatzinc/tenpenki_4.cpp +++ b/test/flatzinc/tenpenki_4.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( TestTags::sweep(), "tenpenki::4", "predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -90,6 +90,6 @@ solve satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/tenpenki_5.cpp b/test/flatzinc/tenpenki_5.cpp index 2cf8cbecf0..ef2dd8a295 100644 --- a/test/flatzinc/tenpenki_5.cpp +++ b/test/flatzinc/tenpenki_5.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( TestTags::sweep(), "tenpenki::5", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -4108,6 +4108,6 @@ solve satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/tenpenki_6.cpp b/test/flatzinc/tenpenki_6.cpp index 220411ade6..db601582ea 100644 --- a/test/flatzinc/tenpenki_6.cpp +++ b/test/flatzinc/tenpenki_6.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( TestTags::sweep(), "tenpenki::6", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -1041,6 +1041,6 @@ solve satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/test_approx_bnb.cpp b/test/flatzinc/test_approx_bnb.cpp index 8d8913f8e3..00464482d6 100644 --- a/test/flatzinc/test_approx_bnb.cpp +++ b/test/flatzinc/test_approx_bnb.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("test_approx_bnb", "var 1..10: x :: output_var;\n\ \n\ solve\n\ @@ -71,6 +71,6 @@ x = 1;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/test_array_just_right.cpp b/test/flatzinc/test_array_just_right.cpp index c83ada6d52..9a481f8737 100644 --- a/test/flatzinc/test_array_just_right.cpp +++ b/test/flatzinc/test_array_just_right.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("test_array_just_right", "array [1..3] of var int: a :: output_array([1..3]) = [1, 2, 3];\n\ solve satisfy;\n\ @@ -49,6 +49,6 @@ solve satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/test_assigned_var_bounds_bad.cpp b/test/flatzinc/test_assigned_var_bounds_bad.cpp index 6d8093ebd3..1f55908fd7 100644 --- a/test/flatzinc/test_assigned_var_bounds_bad.cpp +++ b/test/flatzinc/test_assigned_var_bounds_bad.cpp @@ -32,18 +32,18 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("assign_var_bounds_bad", "var 1..10: x = 123;solve satisfy;", "=====UNSATISFIABLE=====\n"); } }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/test_flatzinc_output_anns.cpp b/test/flatzinc/test_flatzinc_output_anns.cpp index fbd88869c6..ec6d802e02 100644 --- a/test/flatzinc/test_flatzinc_output_anns.cpp +++ b/test/flatzinc/test_flatzinc_output_anns.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("flatzinc_output_anns", "var 0..1: x :: output_var;\n\ array [1..4] of var 0..3: ys :: output_array([2..3, 0..1]);\n\ var bool: z;\n\ @@ -55,6 +55,6 @@ ys = array2d(2..3, 0..1, [0, 1, 2, 3]);\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/test_fzn_arith.cpp b/test/flatzinc/test_fzn_arith.cpp index 692f4fe7d2..fd4a8178d5 100644 --- a/test/flatzinc/test_fzn_arith.cpp +++ b/test/flatzinc/test_fzn_arith.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("fzn_arith", "var 1.0..10.0: f1 :: output_var;\n\ var 1.0..10.0: f2 :: output_var;\n\ var 1.0..10.0: f3 :: output_var;\n\ @@ -118,6 +118,6 @@ i9 = 10;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/test_fzn_arrays.cpp b/test/flatzinc/test_fzn_arrays.cpp index 37b73ed659..dcc31f5676 100644 --- a/test/flatzinc/test_fzn_arrays.cpp +++ b/test/flatzinc/test_fzn_arrays.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("fzn_arrays", "var bool: b1;\n\ var 1.0..10.0: f1;\n\ var 1..10: i1;\n\ @@ -64,6 +64,6 @@ solve satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/test_fzn_coercions.cpp b/test/flatzinc/test_fzn_coercions.cpp index 7e50d5e488..3f43bbdf7f 100644 --- a/test/flatzinc/test_fzn_coercions.cpp +++ b/test/flatzinc/test_fzn_coercions.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("fzn_coercions", "var float: f1 :: output_var;\n\ var int: i1 :: output_var;\n\ \n\ @@ -54,6 +54,6 @@ i1 = 1;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/test_fzn_comparison.cpp b/test/flatzinc/test_fzn_comparison.cpp index 1682f15769..fdfa30df80 100644 --- a/test/flatzinc/test_fzn_comparison.cpp +++ b/test/flatzinc/test_fzn_comparison.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("fzn_comparison", "var bool: b1;\n\ var bool: b2;\n\ var bool: b3;\n\ @@ -268,6 +268,6 @@ solve satisfy;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/test_fzn_logic.cpp b/test/flatzinc/test_fzn_logic.cpp index 5a52516881..3e1af130dd 100644 --- a/test/flatzinc/test_fzn_logic.cpp +++ b/test/flatzinc/test_fzn_logic.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("fzn_logic", "var bool: b1 :: output_var;\n\ var bool: b2 :: output_var;\n\ var bool: b3 :: output_var;\n\ @@ -119,6 +119,6 @@ b6 = true;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/test_fzn_sets.cpp b/test/flatzinc/test_fzn_sets.cpp index 108994e9ca..a842b87dcd 100644 --- a/test/flatzinc/test_fzn_sets.cpp +++ b/test/flatzinc/test_fzn_sets.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("fzn_sets", "var set of 1..10: s1 :: output_var;\n\ var set of 1..10: s2 :: output_var;\n\ var set of 1..10: s3 :: output_var;\n\ @@ -97,6 +97,6 @@ s8 = 1..3;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/test_int_div.cpp b/test/flatzinc/test_int_div.cpp index 92790a3c7d..2496bbc729 100644 --- a/test/flatzinc/test_int_div.cpp +++ b/test/flatzinc/test_int_div.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("int_div", "var int: a :: output_var;\n\ var int: b :: output_var;\n\ var int: c :: output_var;\n\ @@ -60,6 +60,6 @@ d = 1;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/test_int_mod.cpp b/test/flatzinc/test_int_mod.cpp index 97f36ac6b7..b9f3c45d40 100644 --- a/test/flatzinc/test_int_mod.cpp +++ b/test/flatzinc/test_int_mod.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("int_mod", "var int: a :: output_var;\n\ var int: b :: output_var;\n\ var int: c :: output_var;\n\ @@ -67,6 +67,6 @@ y = 4;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/test_int_ranges_as_values.cpp b/test/flatzinc/test_int_ranges_as_values.cpp index 3677f802e2..8033069f3d 100644 --- a/test/flatzinc/test_int_ranges_as_values.cpp +++ b/test/flatzinc/test_int_ranges_as_values.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("int_ranges_as_values", "var 1 .. 10: a :: output_var;\n\ var bool: b :: output_var;\n\ constraint set_in_reif(a, 1..2, b);\n\ @@ -51,6 +51,6 @@ b = false;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/test_seq_search.cpp b/test/flatzinc/test_seq_search.cpp index 3192334c2a..9b9a04d1d8 100644 --- a/test/flatzinc/test_seq_search.cpp +++ b/test/flatzinc/test_seq_search.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("seq_search", "var 1..3: x :: output_var;\n\ var 1..3: y :: output_var;\n\ var 1..3: z :: output_var;\n\ @@ -61,6 +61,6 @@ z = 1;\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/timetabling.cpp b/test/flatzinc/timetabling.cpp index 9d2a48abaa..0149e562a4 100644 --- a/test/flatzinc/timetabling.cpp +++ b/test/flatzinc/timetabling.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( TestTags::sweep(), "timetabling", std::string("predicate all_different_int(array [int] of var int: x);\n\ @@ -423,6 +423,6 @@ z = array2d(1..6, 1..3, [6, 1, 1, 4, 1, 1, 3, 1, 1, 2, 1, 1, 5, 1, 1, 1, 1, 1]); }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/trucking.cpp b/test/flatzinc/trucking.cpp index 75713e88c1..93d1610b09 100644 --- a/test/flatzinc/trucking.cpp +++ b/test/flatzinc/trucking.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( TestTags::sweep(), "trucking", "predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -77,6 +77,6 @@ x = array2d(1..4, 1..6, [0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1 }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/warehouses.cpp b/test/flatzinc/warehouses.cpp index 083e1105e3..05d1399535 100644 --- a/test/flatzinc/warehouses.cpp +++ b/test/flatzinc/warehouses.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("warehouses::large", std::string("predicate all_different_int(array [int] of var int: x);\n\ predicate all_equal_int(array [int] of var int: x);\n\ @@ -268,6 +268,6 @@ supplier = array1d(1..10, [5, 2, 5, 1, 5, 2, 2, 3, 2, 3]);\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/warehouses_small.cpp b/test/flatzinc/warehouses_small.cpp index 21bdb7b23d..1980d37b66 100644 --- a/test/flatzinc/warehouses_small.cpp +++ b/test/flatzinc/warehouses_small.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "warehouses::small", std::string("predicate all_different_int(array [int] of var int: x);\n\ predicate all_equal_int(array [int] of var int: x);\n\ @@ -267,6 +267,6 @@ supplier = array1d(1..10, [5, 2, 5, 1, 5, 2, 2, 3, 2, 3]);\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/wolf_goat_cabbage.cpp b/test/flatzinc/wolf_goat_cabbage.cpp index bb46104916..9fea34ce07 100644 --- a/test/flatzinc/wolf_goat_cabbage.cpp +++ b/test/flatzinc/wolf_goat_cabbage.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest( "wolf_goat_cabbage", std::string("predicate bool_lin_ge(array [int] of int: a, array [int] of var bool: x, var int: c);\n\ @@ -1911,6 +1911,6 @@ wolf = array2d(1..20, -1..1, [false, false, true, false, false, true, false, fal }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/flatzinc/zebra.cpp b/test/flatzinc/zebra.cpp index fead3f3bad..ac2bd6dbff 100644 --- a/test/flatzinc/zebra.cpp +++ b/test/flatzinc/zebra.cpp @@ -32,12 +32,12 @@ #include "test/flatzinc.hh" -namespace Test { namespace FlatZinc { namespace { +namespace Test::FlatZinc { namespace { /// Helper class to create and register tests class Create { public: /// Perform creation and registration - Create(void) { + Create() { (void)new FlatZincTest("zebra", "predicate all_different_int(array [int] of var int: x);\n\ predicate all_equal_int(array [int] of var int: x);\n\ predicate among(var int: n, array [int] of var int: x, set of int: v);\n\ @@ -136,6 +136,6 @@ smoke = array1d(0..4, [3, 1, 2, 4, 5]);\n\ }; Create c; -}}} // namespace Test::FlatZinc +}} // namespace Test::FlatZinc // STATISTICS: test-flatzinc diff --git a/test/float.cpp b/test/float.cpp index 1d1e37bce8..790b58b9db 100644 --- a/test/float.cpp +++ b/test/float.cpp @@ -39,7 +39,7 @@ #include #include -namespace Test { namespace Float { +namespace Test::Float { /* * Complete assignments @@ -92,7 +92,7 @@ namespace Test { namespace Float { a--; } -}} // namespace Test::Float +} // namespace Test::Float std::ostream& operator<<(std::ostream& os, const Test::Float::Assignment& a) { @@ -103,9 +103,9 @@ operator<<(std::ostream& os, const Test::Float::Assignment& a) { return os; } -namespace Test { namespace Float { +namespace Test::Float { - Gecode::FloatNum + static Gecode::FloatNum rand_f_val_down(Gecode::FloatNum l, Gecode::FloatNum u, Gecode::Support::RandomGenerator& rand) { using namespace Gecode; using namespace Gecode::Float; @@ -115,7 +115,7 @@ namespace Test { namespace Float { r.sub_down(u, l))); } - Gecode::FloatNum + static Gecode::FloatNum rand_f_val_up(Gecode::FloatNum l, Gecode::FloatNum u, Gecode::Support::RandomGenerator& rand) { using namespace Gecode; using namespace Gecode::Float; @@ -156,17 +156,17 @@ namespace Test { namespace Float { } Gecode::Space* - TestSpace::copy(void) { + TestSpace::copy() { return new TestSpace(*this); } void - TestSpace::enable(void) { + TestSpace::enable() { Gecode::PropagatorGroup::all.enable(*this); } void - TestSpace::disable(void) { + TestSpace::disable() { Gecode::PropagatorGroup::all.disable(*this); (void)status(); } @@ -178,7 +178,7 @@ namespace Test { namespace Float { } bool - TestSpace::assigned(void) const { + TestSpace::assigned() const { for (int i = x.size(); i--;) if (!x[i].assigned()) return false; @@ -194,7 +194,7 @@ namespace Test { namespace Float { } void - TestSpace::post(void) { + TestSpace::post() { if (reified) { test->post(*this, x, r); if (opt.log) @@ -207,15 +207,14 @@ namespace Test { namespace Float { } bool - TestSpace::failed(void) { + TestSpace::failed() { if (opt.log) { olog << ind(3) << "Fixpoint: " << x; bool f = (status() == Gecode::SS_FAILED); olog << '\n' << ind(3) << " --> " << x << '\n'; return f; - } else { - return status() == Gecode::SS_FAILED; } + return status() == Gecode::SS_FAILED; } void @@ -259,7 +258,7 @@ namespace Test { namespace Float { void TestSpace::assign(const Assignment& a, MaybeType& sol, bool skip, Gecode::Support::RandomGenerator& rand) { using namespace Gecode; - int i = skip ? static_cast(rand(a.size())) : -1; + int i = skip ? rand(a.size()) : -1; for (int j = a.size(); j--;) if (i != j) { @@ -289,7 +288,7 @@ namespace Test { namespace Float { } Gecode::FloatNum - TestSpace::cut(int* cut_directions) { + TestSpace::cut(const int* cut_directions) { using namespace Gecode; using namespace Gecode::Float; // Select variable to be cut @@ -401,7 +400,7 @@ namespace Test { namespace Float { } unsigned int - TestSpace::propagators(void) { + TestSpace::propagators() { return Gecode::PropagatorGroup::all.size(*this); } @@ -409,7 +408,7 @@ namespace Test { namespace Float { Gecode::FRT_LT, Gecode::FRT_GQ, Gecode::FRT_GR}; Assignment* - Test::assignment(void) const { + Test::assignment() const { switch (assignment_type) { case COMPLETE_ASSIGNMENT: return new CpltAssignment(arity, dom, step); @@ -471,10 +470,10 @@ namespace Test { namespace Float { Test::post(Gecode::Space&, Gecode::FloatVarArray&, Gecode::Reify) {} bool - Test::run(void) { + Test::run() { using namespace Gecode; - const char* test = "NONE"; - const char* problem = "NONE"; + const char* test = nullptr; + const char* problem = nullptr; // Set up assignments Assignment* ap = assignment(); @@ -907,7 +906,7 @@ namespace Test { namespace Float { return false; } -}} // namespace Test::Float +} // namespace Test::Float #undef START_TEST #undef CHECK_TEST diff --git a/test/float.hh b/test/float.hh index a9bace8420..6532fe1126 100644 --- a/test/float.hh +++ b/test/float.hh @@ -48,327 +48,323 @@ #else #define GECODE_TESTFLOAT_EXPORT __declspec(dllimport) #endif -#elif defined(GECODE_GCC_HAS_CLASS_VISIBILITY) +#elifdef GECODE_GCC_HAS_CLASS_VISIBILITY #define GECODE_TESTFLOAT_EXPORT __attribute__((visibility("default"))) #else #define GECODE_TESTFLOAT_EXPORT #endif -namespace Test { +/// Testing domain floats +namespace Test::Float { - /// Testing domain floats - namespace Float { + /// Type for comparisons and solutions + enum class MaybeType { + MT_FALSE = 0, ///< Does not hold + MT_TRUE, ///< Does hold + MT_MAYBE ///< Might or might not hold + }; + using enum MaybeType; - /// Type for comparisons and solutions - enum class MaybeType { - MT_FALSE = 0, ///< Does not hold - MT_TRUE, ///< Does hold - MT_MAYBE ///< Might or might not hold - }; - using enum MaybeType; + /// Three-valued conjunction of MaybeType + MaybeType operator&(MaybeType a, MaybeType b); - /// Three-valued conjunction of MaybeType - MaybeType operator&(MaybeType a, MaybeType b); + /// Assignment possible types + enum class AssignmentType { COMPLETE_ASSIGNMENT = 0, RANDOM_ASSIGNMENT, EXTEND_ASSIGNMENT }; + using enum AssignmentType; - /// Assignment possible types - enum class AssignmentType { COMPLETE_ASSIGNMENT = 0, RANDOM_ASSIGNMENT, EXTEND_ASSIGNMENT }; - using enum AssignmentType; + class GECODE_TESTFLOAT_EXPORT Test; - class GECODE_TESTFLOAT_EXPORT Test; + /** + * \defgroup TaskTestFloat Testing domain floats + * \ingroup TaskTest + */ - /** - * \defgroup TaskTestFloat Testing domain floats - * \ingroup TaskTest - */ - - /** - * \defgroup TaskTestFloatFloat General test support - * \ingroup TaskTestFloat - */ - //@{ - /// %Base class for assignments - class GECODE_TESTFLOAT_EXPORT Assignment { - protected: - int n; ///< Number of variables - Gecode::FloatVal d; ///< Domain for each variable - public: - /// Initialize assignments for \a n0 variables and values \a d0 - Assignment(int n0, const Gecode::FloatVal& d0); - /// Test whether all assignments have been iterated - virtual bool has_more(void) const = 0; - /// Move to next assignment - virtual void next(Gecode::Support::RandomGenerator& rand) = 0; - /// Return value for variable \a i - virtual Gecode::FloatVal operator[](int i) const = 0; - /// Set assignment to value \a val for variable \a i - virtual void set(int i, const Gecode::FloatVal& val) = 0; - /// Return number of variables - int size(void) const; - /// Destructor - virtual ~Assignment(void); - }; + /** + * \defgroup TaskTestFloatFloat General test support + * \ingroup TaskTestFloat + */ + //@{ + /// %Base class for assignments + class GECODE_TESTFLOAT_EXPORT Assignment { + protected: + int n; ///< Number of variables + Gecode::FloatVal d; ///< Domain for each variable + public: + /// Initialize assignments for \a n0 variables and values \a d0 + Assignment(int n0, const Gecode::FloatVal& d0); + /// Test whether all assignments have been iterated + virtual bool has_more() const = 0; + /// Move to next assignment + virtual void next(Gecode::Support::RandomGenerator& rand) = 0; + /// Return value for variable \a i + virtual Gecode::FloatVal operator[](int i) const = 0; + /// Set assignment to value \a val for variable \a i + virtual void set(int i, const Gecode::FloatVal& val) = 0; + /// Return number of variables + int size() const; + /// Destructor + virtual ~Assignment(); + }; - /// Generate all assignments - class GECODE_TESTFLOAT_EXPORT CpltAssignment : public Assignment { - protected: - Gecode::FloatVal* dsv; ///< Iterator for each variable - Gecode::FloatNum step; ///< Step for next assignment - public: - /// Initialize assignments for \a n variables and values \a d with step \a s - CpltAssignment(int n, const Gecode::FloatVal& d, Gecode::FloatNum s); - /// Test whether all assignments have been iterated - bool has_more(void) const override; - /// Move to next assignment - void next(Gecode::Support::RandomGenerator& rand) override; - /// Return value for variable \a i - Gecode::FloatVal operator[](int i) const override; - /// Set assignment to value \a val for variable \a i - void set(int i, const Gecode::FloatVal& val) override; - /// Destructor - ~CpltAssignment(void) override; - }; + /// Generate all assignments + class GECODE_TESTFLOAT_EXPORT CpltAssignment : public Assignment { + protected: + Gecode::FloatVal* dsv; ///< Iterator for each variable + Gecode::FloatNum step; ///< Step for next assignment + public: + /// Initialize assignments for \a n variables and values \a d with step \a s + CpltAssignment(int n, const Gecode::FloatVal& d, Gecode::FloatNum s); + /// Test whether all assignments have been iterated + bool has_more() const override; + /// Move to next assignment + void next(Gecode::Support::RandomGenerator& rand) override; + /// Return value for variable \a i + Gecode::FloatVal operator[](int i) const override; + /// Set assignment to value \a val for variable \a i + void set(int i, const Gecode::FloatVal& val) override; + /// Destructor + ~CpltAssignment() override; + }; - /// Generate all assignments except the last variable and complete it to get a solution - class GECODE_TESTFLOAT_EXPORT ExtAssignment : public Assignment { - protected: - const Test* cur_pb; ///< Current problem used to complete assignment - Gecode::FloatVal* dsv; ///< Iterator for each variable - Gecode::FloatNum step; ///< Step for next assignment - public: - /// Initialize assignments for \a n variables and values \a d with step \a s - ExtAssignment(int n, const Gecode::FloatVal& d, Gecode::FloatNum s, const Test* pb, - Gecode::Support::RandomGenerator& rand); - /// Test whether all assignments have been iterated - bool has_more(void) const override; - /// Move to next assignment - void next(Gecode::Support::RandomGenerator& rand) override; - /// Return value for variable \a i - Gecode::FloatVal operator[](int i) const override; - /// Set assignment to value \a val for variable \a i - void set(int i, const Gecode::FloatVal& val) override; - /// Destructor - ~ExtAssignment(void) override; - }; + /// Generate all assignments except the last variable and complete it to get a solution + class GECODE_TESTFLOAT_EXPORT ExtAssignment : public Assignment { + protected: + const Test* cur_pb; ///< Current problem used to complete assignment + Gecode::FloatVal* dsv; ///< Iterator for each variable + Gecode::FloatNum step; ///< Step for next assignment + public: + /// Initialize assignments for \a n variables and values \a d with step \a s + ExtAssignment(int n, const Gecode::FloatVal& d, Gecode::FloatNum s, const Test* pb, + Gecode::Support::RandomGenerator& rand); + /// Test whether all assignments have been iterated + bool has_more() const override; + /// Move to next assignment + void next(Gecode::Support::RandomGenerator& rand) override; + /// Return value for variable \a i + Gecode::FloatVal operator[](int i) const override; + /// Set assignment to value \a val for variable \a i + void set(int i, const Gecode::FloatVal& val) override; + /// Destructor + ~ExtAssignment() override; + }; - /// Generate random selection of assignments - class GECODE_TESTFLOAT_EXPORT RandomAssignment : public Assignment { - protected: - Gecode::FloatVal* vals; ///< The current values for the variables - int a; ///< How many assignments still to be generated - /// Generate new value according to domain - Gecode::FloatNum random_value(Gecode::Support::RandomGenerator& rand); + /// Generate random selection of assignments + class GECODE_TESTFLOAT_EXPORT RandomAssignment : public Assignment { + protected: + Gecode::FloatVal* vals; ///< The current values for the variables + int a; ///< How many assignments still to be generated + /// Generate new value according to domain + Gecode::FloatNum random_value(Gecode::Support::RandomGenerator& rand); - public: - /// Initialize for \a a assignments for \a n variables and values \a d - RandomAssignment(int n, const Gecode::FloatVal& d, int a0, Gecode::Support::RandomGenerator& rand); - /// Test whether all assignments have been iterated - bool has_more(void) const override; - /// Move to next assignment - void next(Gecode::Support::RandomGenerator& rand) override; - /// Return value for variable \a i - Gecode::FloatVal operator[](int i) const override; - /// Set assignment to value \a val for variable \a i - void set(int i, const Gecode::FloatVal& val) override; - /// Destructor - ~RandomAssignment(void) override; - }; + public: + /// Initialize for \a a assignments for \a n variables and values \a d + RandomAssignment(int n, const Gecode::FloatVal& d, int a0, Gecode::Support::RandomGenerator& rand); + /// Test whether all assignments have been iterated + bool has_more() const override; + /// Move to next assignment + void next(Gecode::Support::RandomGenerator& rand) override; + /// Return value for variable \a i + Gecode::FloatVal operator[](int i) const override; + /// Set assignment to value \a val for variable \a i + void set(int i, const Gecode::FloatVal& val) override; + /// Destructor + ~RandomAssignment() override; + }; - /// Space for executing tests - class GECODE_TESTFLOAT_EXPORT TestSpace : public Gecode::Space { - public: - /// Initial domain - Gecode::FloatVal d; - /// Step for going to next solution - Gecode::FloatNum step; - /// Variables to be tested - Gecode::FloatVarArray x; - /// Reification information - Gecode::Reify r; - /// The test currently run - Test* test; - /// Whether the test is for a reified propagator - bool reified; + /// Space for executing tests + class GECODE_TESTFLOAT_EXPORT TestSpace : public Gecode::Space { + public: + /// Initial domain + Gecode::FloatVal d; + /// Step for going to next solution + Gecode::FloatNum step; + /// Variables to be tested + Gecode::FloatVarArray x; + /// Reification information + Gecode::Reify r; + /// The test currently run + Test* test; + /// Whether the test is for a reified propagator + bool reified; - /** - * \brief Create test space - * - * Creates \a n variables with domain \a d and step \a s for - * test \a t. - * - */ - TestSpace(int n, Gecode::FloatVal& d, Gecode::FloatNum s, Test* t); - /** - * \brief Create test space - * - * Creates \a n variables with domain \a d and step \a s for - * test \a t and reification mode \a rm. - * - */ - TestSpace(int n, Gecode::FloatVal& d, Gecode::FloatNum s, Test* t, Gecode::ReifyMode rm); - /// Constructor for cloning \a s - TestSpace(TestSpace& s); - /// Copy space during cloning - Gecode::Space* copy(void) override; - /// Add constraints to skip solutions to the \a a assignment - virtual void drop_until(const Assignment& a); - /// Test whether all variables are assigned - bool assigned(void) const; - /// Test whether all variables match assignment \a a - bool match_assignment(const Assignment& a) const; - /// Post propagator - void post(void); - /// Compute a fixpoint and check for failure - bool failed(void); - /// Perform integer tell operation on \a x[i] - void rel(int i, Gecode::FloatRelType frt, const Gecode::FloatVal& n); - /// Perform Boolean tell on \a b - void rel(bool sol); - /// Assign all (or all but one, if \a skip is true) variables to values in \a a - /// If assignment of a variable is MT_MAYBE (if the two intervals are contiguous), - /// \a sol is set to MT_MAYBE - void assign(const Assignment& a, MaybeType& sol, bool skip, Gecode::Support::RandomGenerator& rand); - /// Assign a random variable to a random bound - void bound(Gecode::Support::RandomGenerator& rand); - /// Cut the bigger variable to an half sized interval. It returns - /// the new size of the cut interval. \a cutDirections gives the direction - /// to follow (upper part or lower part of the interval). - Gecode::FloatNum cut(int* cut_directions); - /// Prune some random values from variable \a i - void prune(int i, Gecode::Support::RandomGenerator& rand); - /// Prune some random values for some random variable - void prune(Gecode::Support::RandomGenerator& rand); - /// Prune values but not those in assignment \a a - bool prune(const Assignment& a, bool test_fixpoint, Gecode::Support::RandomGenerator& rand); - /// Disable propagators in space and compute fixpoint (make all idle) - void disable(void); - /// Enable propagators in space - void enable(void); - /// Return the number of propagators - unsigned int propagators(void); - }; + /** + * \brief Create test space + * + * Creates \a n variables with domain \a d and step \a s for + * test \a t. + * + */ + TestSpace(int n, Gecode::FloatVal& d, Gecode::FloatNum s, Test* t); + /** + * \brief Create test space + * + * Creates \a n variables with domain \a d and step \a s for + * test \a t and reification mode \a rm. + * + */ + TestSpace(int n, Gecode::FloatVal& d, Gecode::FloatNum s, Test* t, Gecode::ReifyMode rm); + /// Constructor for cloning \a s + TestSpace(TestSpace& s); + /// Copy space during cloning + Gecode::Space* copy() override; + /// Add constraints to skip solutions to the \a a assignment + virtual void drop_until(const Assignment& a); + /// Test whether all variables are assigned + bool assigned() const; + /// Test whether all variables match assignment \a a + bool match_assignment(const Assignment& a) const; + /// Post propagator + void post(); + /// Compute a fixpoint and check for failure + bool failed(); + /// Perform integer tell operation on \a x[i] + void rel(int i, Gecode::FloatRelType frt, const Gecode::FloatVal& n); + /// Perform Boolean tell on \a b + void rel(bool sol); + /// Assign all (or all but one, if \a skip is true) variables to values in \a a + /// If assignment of a variable is MT_MAYBE (if the two intervals are contiguous), + /// \a sol is set to MT_MAYBE + void assign(const Assignment& a, MaybeType& sol, bool skip, Gecode::Support::RandomGenerator& rand); + /// Assign a random variable to a random bound + void bound(Gecode::Support::RandomGenerator& rand); + /// Cut the bigger variable to an half sized interval. It returns + /// the new size of the cut interval. \a cutDirections gives the direction + /// to follow (upper part or lower part of the interval). + Gecode::FloatNum cut(const int* cut_directions); + /// Prune some random values from variable \a i + void prune(int i, Gecode::Support::RandomGenerator& rand); + /// Prune some random values for some random variable + void prune(Gecode::Support::RandomGenerator& rand); + /// Prune values but not those in assignment \a a + bool prune(const Assignment& a, bool test_fixpoint, Gecode::Support::RandomGenerator& rand); + /// Disable propagators in space and compute fixpoint (make all idle) + void disable(); + /// Enable propagators in space + void enable(); + /// Return the number of propagators + unsigned int propagators(); + }; + /** + * \brief %Base class for tests with float constraints + * + */ + class GECODE_TESTFLOAT_EXPORT Test : public Base { + protected: + /// Number of variables + int arity; + /// Domain of variables + Gecode::FloatVal dom; + /// Step for going to next solution + Gecode::FloatNum step; + /// Gives the type of assignment to use + AssignmentType assignment_type; + /// Does the constraint also exist as reified constraint + bool reified; + /// Supported reification modes, encoded as a bit mask of 1 << Gecode::RM_* + int rms; + /// Whether to perform search test + bool test_search; + /// Whether to perform fixpoint test + bool test_fixpoint; + /// Whether to test for subsumption + bool test_subsumption; + /// \name Test for reification modes + //@{ + /// Test whether equivalence as reification mode is supported + bool eqv() const; + /// Test whether implication as reification mode is supported + bool imp() const; + /// Test whether reverse implication as reification mode is supported + bool pmi() const; + //@} + public: /** - * \brief %Base class for tests with float constraints + * \brief Constructor * + * Constructs a test with name \a s and arity \a a and variable + * domain \a d and step \a st and assignment type \a at. Also + * tests for a reified constraint, if \a r is true. */ - class GECODE_TESTFLOAT_EXPORT Test : public Base { - protected: - /// Number of variables - int arity; - /// Domain of variables - Gecode::FloatVal dom; - /// Step for going to next solution - Gecode::FloatNum step; - /// Gives the type of assignment to use - AssignmentType assignment_type; - /// Does the constraint also exist as reified constraint - bool reified; - /// Supported reification modes, encoded as a bit mask of 1 << Gecode::RM_* - int rms; - /// Whether to perform search test - bool test_search; - /// Whether to perform fixpoint test - bool test_fixpoint; - /// Whether to test for subsumption - bool test_subsumption; - /// \name Test for reification modes - //@{ - /// Test whether equivalence as reification mode is supported - bool eqv(void) const; - /// Test whether implication as reification mode is supported - bool imp(void) const; - /// Test whether reverse implication as reification mode is supported - bool pmi(void) const; - //@} - public: - /** - * \brief Constructor - * - * Constructs a test with name \a s and arity \a a and variable - * domain \a d and step \a st and assignment type \a at. Also - * tests for a reified constraint, if \a r is true. - */ - Test(const std::string& s, int a, const Gecode::FloatVal& d, Gecode::FloatNum st, AssignmentType at, - bool r); - /// Construct and register a test with explicitly assigned tags - Test(TestTags tags, const std::string& s, int a, const Gecode::FloatVal& d, Gecode::FloatNum st, - AssignmentType at, bool r); - /** - * \brief Constructor - * - * Constructs a test with name \a s and arity \a a and variable - * domain \a min ... \a max and step \a st and assignment type \a at. Also - * tests for a reified constraint, if \a r is true. - */ - Test(const std::string& s, int a, Gecode::FloatNum min, Gecode::FloatNum max, Gecode::FloatNum st, - AssignmentType at, bool r); - /// Construct and register a test with explicitly assigned tags - Test(TestTags tags, const std::string& s, int a, Gecode::FloatNum min, Gecode::FloatNum max, - Gecode::FloatNum st, AssignmentType at, bool r); - /// Create assignment - virtual Assignment* assignment(void) const; - /// Complete the current assignment to get a feasible one (which satisfies all constraint). - /// If such an assignment is computed, it returns true, false otherwise - virtual bool extend_assignment(Assignment& a) const; - /// Check an interval assignment using MT_TRUE, MT_FALSE, or MT_MAYBE; see cmp() - virtual MaybeType solution(const Assignment&) const = 0; - /// Test if \a ts is subsumed or not (i.e. if there is no more propagator unless - /// the assignment is an extended assignment. - bool subsumed(const TestSpace& ts) const; - /// Whether to ignore assignment for reification - virtual bool ignore(const Assignment& a) const; - /// Post constraint - virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) = 0; - /// Post reified constraint - virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x, Gecode::Reify r); - /// Perform test - bool run(void) override; - /// \name Mapping scalar values to strings - //@{ - /// Map float relation to string - static std::string str(Gecode::FloatRelType frt); - /// Map floatNum to string - static std::string str(Gecode::FloatNum f); - /// Map floatVal to string - static std::string str(const Gecode::FloatVal& f); - /// Map float array to string - static std::string str(const Gecode::FloatValArgs& f); - //@} - /// \name General support - //@{ - /// Compare \a x and \a y with respect to \a r - static MaybeType cmp(const Gecode::FloatVal& x, Gecode::FloatRelType r, const Gecode::FloatVal& y); - /// Whether \a x and \a y are equal - static MaybeType eq(const Gecode::FloatVal& x, const Gecode::FloatVal& y); - /// Flip a coin and return true or false randomly - bool flip(void); - //@} - }; + Test(const std::string& s, int a, const Gecode::FloatVal& d, Gecode::FloatNum st, AssignmentType at, bool r); + /// Construct and register a test with explicitly assigned tags + Test(TestTags tags, const std::string& s, int a, const Gecode::FloatVal& d, Gecode::FloatNum st, + AssignmentType at, bool r); + /** + * \brief Constructor + * + * Constructs a test with name \a s and arity \a a and variable + * domain \a min ... \a max and step \a st and assignment type \a at. Also + * tests for a reified constraint, if \a r is true. + */ + Test(const std::string& s, int a, Gecode::FloatNum min, Gecode::FloatNum max, Gecode::FloatNum st, + AssignmentType at, bool r); + /// Construct and register a test with explicitly assigned tags + Test(TestTags tags, const std::string& s, int a, Gecode::FloatNum min, Gecode::FloatNum max, + Gecode::FloatNum st, AssignmentType at, bool r); + /// Create assignment + virtual Assignment* assignment() const; + /// Complete the current assignment to get a feasible one (which satisfies all constraint). + /// If such an assignment is computed, it returns true, false otherwise + virtual bool extend_assignment(Assignment& a) const; + /// Check an interval assignment using MT_TRUE, MT_FALSE, or MT_MAYBE; see cmp() + virtual MaybeType solution(const Assignment&) const = 0; + /// Test if \a ts is subsumed or not (i.e. if there is no more propagator unless + /// the assignment is an extended assignment. + bool subsumed(const TestSpace& ts) const; + /// Whether to ignore assignment for reification + virtual bool ignore(const Assignment& a) const; + /// Post constraint + virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) = 0; + /// Post reified constraint + virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x, Gecode::Reify r); + /// Perform test + bool run() override; + /// \name Mapping scalar values to strings + //@{ + /// Map float relation to string + static std::string str(Gecode::FloatRelType frt); + /// Map floatNum to string + static std::string str(Gecode::FloatNum f); + /// Map floatVal to string + static std::string str(const Gecode::FloatVal& f); + /// Map float array to string + static std::string str(const Gecode::FloatValArgs& x); + //@} + /// \name General support + //@{ + /// Compare \a x and \a y with respect to \a r + static MaybeType cmp(const Gecode::FloatVal& x, Gecode::FloatRelType r, const Gecode::FloatVal& y); + /// Whether \a x and \a y are equal + static MaybeType eq(const Gecode::FloatVal& x, const Gecode::FloatVal& y); + /// Flip a coin and return true or false randomly + bool flip(); //@} + }; + //@} - /// Iterator for float relation types - class GECODE_TESTFLOAT_EXPORT FloatRelTypes { - private: - /// Array of relation types - static const Gecode::FloatRelType frts[6]; - /// Current position in relation type array - int i; + /// Iterator for float relation types + class GECODE_TESTFLOAT_EXPORT FloatRelTypes { + private: + /// Array of relation types + static const Gecode::FloatRelType frts[6]; + /// Current position in relation type array + int i; - public: - /// Initialize iterator - FloatRelTypes(void); - /// Reset iterator - void reset(void); - /// Test whether iterator is done - bool operator()(void) const; - /// Increment to next relation type - void operator++(void); - /// Return current relation type - Gecode::FloatRelType frt(void) const; - }; + public: + /// Initialize iterator + FloatRelTypes(); + /// Reset iterator + void reset(); + /// Test whether iterator is done + bool operator()() const; + /// Increment to next relation type + void operator++(); + /// Return current relation type + Gecode::FloatRelType frt() const; + }; - } // namespace Float -} // namespace Test +} // namespace Test::Float /** * \brief Print assignment \a diff --git a/test/float.hpp b/test/float.hpp index 816ab4c74b..818e1992b6 100644 --- a/test/float.hpp +++ b/test/float.hpp @@ -34,7 +34,7 @@ * */ -namespace Test { namespace Float { +namespace Test::Float { /* * Assignments @@ -42,10 +42,10 @@ namespace Test { namespace Float { */ inline Assignment::Assignment(int n0, const Gecode::FloatVal& d0) : n(n0), d(d0) {} inline int - Assignment::size(void) const { + Assignment::size() const { return n; } - inline Assignment::~Assignment(void) = default; + inline Assignment::~Assignment() = default; inline CpltAssignment::CpltAssignment(int n, const Gecode::FloatVal& d, Gecode::FloatNum s) : Assignment(n, d), dsv(new Gecode::FloatVal[static_cast(n)]), step(s) { @@ -67,7 +67,7 @@ namespace Test { namespace Float { assert((i >= 0) && (i < n)); dsv[i] = val; } - inline CpltAssignment::~CpltAssignment(void) { + inline CpltAssignment::~CpltAssignment() { delete[] dsv; } @@ -77,7 +77,7 @@ namespace Test { namespace Float { using namespace Gecode; for (int i = n - 1; i--;) dsv[i] = FloatVal(d.min(), nextafter(d.min(), d.max())); - (*this).next(rand); + ExtAssignment::next(rand); } inline bool ExtAssignment::has_more() const { @@ -93,7 +93,7 @@ namespace Test { namespace Float { assert((i >= 0) && (i < n)); dsv[i] = val; } - inline ExtAssignment::~ExtAssignment(void) { + inline ExtAssignment::~ExtAssignment() { delete[] dsv; } @@ -128,7 +128,7 @@ namespace Test { namespace Float { assert((i >= 0) && (i < n)); vals[i] = val; } - inline RandomAssignment::~RandomAssignment(void) { + inline RandomAssignment::~RandomAssignment() { delete[] vals; } @@ -137,15 +137,15 @@ namespace Test { namespace Float { * */ forceinline bool - Test::eqv(void) const { + Test::eqv() const { return reified && ((rms & (1 << std::to_underlying(Gecode::RM_EQV))) != 0); } forceinline bool - Test::imp(void) const { + Test::imp() const { return reified && ((rms & (1 << std::to_underlying(Gecode::RM_IMP))) != 0); } forceinline bool - Test::pmi(void) const { + Test::pmi() const { return reified && ((rms & (1 << std::to_underlying(Gecode::RM_RIMP))) != 0); } inline Test::Test(TestTags tags, const std::string& s, int a, const Gecode::FloatVal& d, Gecode::FloatNum st, @@ -208,7 +208,7 @@ namespace Test { namespace Float { inline std::string Test::str(const Gecode::FloatValArgs& x) { - std::string s = ""; + std::string s; for (int i = 0; i < x.size() - 1; i++) s += str(x[i]) + ","; return "[" + s + str(x[x.size() - 1]) + "]"; @@ -265,7 +265,7 @@ namespace Test { namespace Float { } inline bool - Test::flip(void) { + Test::flip() { return _rand(2U) == 0U; } @@ -281,24 +281,24 @@ namespace Test { namespace Float { return (b == MT_FALSE) ? MT_FALSE : MT_MAYBE; } - inline FloatRelTypes::FloatRelTypes(void) : i(sizeof(frts) / sizeof(Gecode::FloatRelType) - 1) {} + inline FloatRelTypes::FloatRelTypes() : i(sizeof(frts) / sizeof(Gecode::FloatRelType) - 1) {} inline void - FloatRelTypes::reset(void) { + FloatRelTypes::reset() { i = sizeof(frts) / sizeof(Gecode::FloatRelType) - 1; } inline bool - FloatRelTypes::operator()(void) const { + FloatRelTypes::operator()() const { return i >= 0; } inline void - FloatRelTypes::operator++(void) { + FloatRelTypes::operator++() { i--; } inline Gecode::FloatRelType - FloatRelTypes::frt(void) const { + FloatRelTypes::frt() const { return frts[i]; } -}} // namespace Test::Float +} // namespace Test::Float // STATISTICS: test-float diff --git a/test/float/arithmetic.cpp b/test/float/arithmetic.cpp index 90907df7fb..55bace078f 100644 --- a/test/float/arithmetic.cpp +++ b/test/float/arithmetic.cpp @@ -46,1891 +46,1870 @@ #include #include -namespace Test { namespace Float { - - /// %Tests for arithmetic constraints - namespace Arithmetic { - - /** - * \defgroup TaskTestFloatArithmetic Arithmetic constraints - * \ingroup TaskTestFloat - */ - //@{ - // A copied scope would restore the caller's mode a second time. - static_assert(!std::is_copy_constructible_v && - !std::is_copy_assignable_v); - - /// Rounding scopes and interval operations restore the enclosing mode - class RoundingScope : public Base { - private: - /// Test interval operations that open their own rounding scope - static bool - interval_operations(void) { - using Gecode::Float::Interval; - const int mode = std::fegetround(); - // fmod runs its nested arithmetic in its own scope. - const Interval remainder = Gecode::Float::fmod(Interval(5.0, 5.0), Interval(3.0, 3.0)); - bool result = (remainder.lower() == 2.0) && (remainder.upper() == 2.0) && (std::fegetround() == mode); +/// %Tests for arithmetic constraints +namespace Test::Float::Arithmetic { + + /** + * \defgroup TaskTestFloatArithmetic Arithmetic constraints + * \ingroup TaskTestFloat + */ + //@{ + // A copied scope would restore the caller's mode a second time. + static_assert(!std::is_copy_constructible_v && + !std::is_copy_assignable_v); + + /// Rounding scopes and interval operations restore the enclosing mode + class RoundingScope : public Base { + private: + /// Test interval operations that open their own rounding scope + static bool + interval_operations() { + using Gecode::Float::Interval; + const int mode = std::fegetround(); + // fmod runs its nested arithmetic in its own scope. + const Interval remainder = Gecode::Float::fmod(Interval(5.0, 5.0), Interval(3.0, 3.0)); + bool result = (remainder.lower() == 2.0) && (remainder.upper() == 2.0) && (std::fegetround() == mode); #ifdef GECODE_HAS_MPFR - // Nested operations must retain Gecode's MPFR operations. - const Interval sine = Gecode::Float::sin(Interval(0.5)); - result &= (sine.lower() <= 0.479425538604203) && (sine.upper() >= 0.479425538604203) && - (std::fegetround() == mode); + // Nested operations must retain Gecode's MPFR operations. + const Interval sine = Gecode::Float::sin(Interval(0.5)); + result &= (sine.lower() <= 0.479425538604203) && (sine.upper() >= 0.479425538604203) && + (std::fegetround() == mode); #endif - return result; - } - - public: - RoundingScope(void) : Base("Float::Arithmetic::RoundingScope", TestTags::check()) {} - bool - run(void) override { - const int previous = std::fegetround(); - const int modes[] = {FE_TONEAREST, FE_DOWNWARD, FE_UPWARD, FE_TOWARDZERO}; - bool result = true; - for (int mode : modes) { - if (std::fesetround(mode) != 0) - continue; - { - Gecode::Float::Rounding outer; - const volatile Gecode::FloatNum one = 1.0; - const volatile Gecode::FloatNum half_ulp = std::ldexp(1.0, -53); - const Gecode::FloatNum lower = outer.add_down(one, half_ulp); - const Gecode::FloatNum upper = outer.add_up(one, half_ulp); - result &= (lower == 1.0) && (upper == std::nextafter(1.0, 2.0)); - const int enclosing = std::fegetround(); - { - Gecode::Float::Rounding inner; - result &= inner.median(1.0, 3.0) == 2.0; - } - result &= std::fegetround() == enclosing; - result &= interval_operations(); - { - Gecode::Float::Rounding nested; - result &= interval_operations(); - } - result &= std::fegetround() == enclosing; - } - if (std::fegetround() != mode) { - olog << "Rounding scope changed caller mode " << mode << '\n'; - result = false; - } - } - if (previous != -1) - std::fesetround(previous); - return result; - } - } rounding_scope; - - /// Regression test for downward rounding of negating operations on AArch64 - class DirectedRoundingRegression : public Base { - protected: - /// Space posting an NthRoot constraint on a positive source - class RootSpace : public Gecode::Space { - public: - /// Source and root variables - Gecode::FloatVar source, root; - /// Post the square root of the source interval [lo,hi] - RootSpace(Gecode::FloatNum lo, Gecode::FloatNum hi) : source(*this, lo, hi), root(*this, 0.0, 1.0) { - Gecode::nroot(*this, source, 2, root); - } - /// Clone constructor - RootSpace(RootSpace& s) : Gecode::Space(s) { - source.update(*this, s.source); - root.update(*this, s.root); - } - /// Copy space during cloning - Gecode::Space* - copy(void) override { - return new RootSpace(*this); - } - }; - - public: - DirectedRoundingRegression(void) - : Base("Float::Arithmetic::DirectedRoundingRegression", TestTags::check()) {} - bool - run(void) override { - bool result = true; + return result; + } + + public: + RoundingScope() : Base("Float::Arithmetic::RoundingScope", TestTags::check()) {} + bool + run() override { + const int previous = std::fegetround(); + const int modes[] = {FE_TONEAREST, FE_DOWNWARD, FE_UPWARD, FE_TOWARDZERO}; + bool result = true; + for (int mode : modes) { + if (std::fesetround(mode) != 0) + continue; { - // Each exact result lies strictly between two adjacent doubles. - const volatile Gecode::FloatNum root_two = 0x1.6a09e667f3bccp+0; + Gecode::Float::Rounding outer; const volatile Gecode::FloatNum one = 1.0; - const volatile Gecode::FloatNum three = 3.0; - const volatile Gecode::FloatNum quarter_ulp = std::ldexp(1.0, -54); - Gecode::Float::Rounding r; - if ((r.mul_down(root_two, root_two) != 0x1.ffffffffffffep+0) || - (r.mul_up(root_two, root_two) != 0x1.fffffffffffffp+0) || - (r.div_down(one, three) != 0x1.5555555555555p-2) || - (r.div_up(one, three) != 0x1.5555555555556p-2) || - (r.add_down(one, -quarter_ulp) != 0x1.fffffffffffffp-1) || - (r.add_up(one, -quarter_ulp) != 1.0)) { - olog << "Rounding operation was not directed" << '\n'; - result = false; + const volatile Gecode::FloatNum half_ulp = std::ldexp(1.0, -53); + const Gecode::FloatNum lower = outer.add_down(one, half_ulp); + const Gecode::FloatNum upper = outer.add_up(one, half_ulp); + result &= (lower == 1.0) && (upper == std::nextafter(1.0, 2.0)); + const int enclosing = std::fegetround(); + { + Gecode::Float::Rounding inner; + result &= inner.median(1.0, 3.0) == 2.0; + } + result &= std::fegetround() == enclosing; + result &= interval_operations(); + { + Gecode::Float::Rounding nested; + result &= interval_operations(); } + result &= std::fegetround() == enclosing; } - // Parallel search on examples/cartesian-heart reached this domain. - // A wrong mul_down made the root iteration create an empty interval. - RootSpace s(0x1p-1016, 0x1p-1015); - if ((s.status() == Gecode::SS_FAILED) || (s.root.min() > 0x1p-508) || - (s.root.max() < 0x1.6a09e667f3bcdp-508)) { - olog << "NthRoot removed the root of " << s.source << '\n'; + if (std::fegetround() != mode) { + olog << "Rounding scope changed caller mode " << mode << '\n'; result = false; } - return result; - } - } directed_rounding_regression; - - /// Directed rounding gives exact bounds for literal and runtime operands - class DirectedRounding : public Base { - private: - /// Operation computed with directed rounding - enum class Op { ADD, SUB, MUL, DIV, SQRT, INTEGER }; - /// Operation and operands (\a y is unused by unary operations) - struct Case { - Op op; - Gecode::FloatNum x; - Gecode::FloatNum y; - }; - /// Lower and upper bound - struct Bounds { - Gecode::FloatNum down; - Gecode::FloatNum up; - }; - /// Round-to-nearest result and the sign-carrying rounding error - struct Nearest { - Gecode::FloatNum value; - Gecode::FloatNum error; - }; - /// Bounds observed through both interfaces in one caller mode - struct Observed { - Bounds rounding; - Bounds float_val; - bool mode_kept; - }; - /// Cases whose two directed bounds differ - static constexpr Case cases[] = { - {Op::ADD, 0.1, 0.2}, {Op::ADD, -0.1, -0.2}, {Op::SUB, 0.1, 0.7}, {Op::SUB, -0.1, 0.2}, - {Op::MUL, 0.1, 0.3}, {Op::MUL, -0.1, 0.3}, {Op::DIV, 1.0, 3.0}, {Op::DIV, -1.0, 3.0}, - {Op::SQRT, 2.0, 0.0}, {Op::SQRT, 0.1, 0.0}, {Op::INTEGER, 2.5, 0.0}, {Op::INTEGER, -2.5, 0.0}, - }; - - /// Return \a a + \a b and its exact error (TwoSum) - static Nearest - two_sum(Gecode::FloatNum a, Gecode::FloatNum b) { - const Gecode::FloatNum s = a + b; - const Gecode::FloatNum b_virtual = s - a; - return {s, (a - (s - b_virtual)) + (b - b_virtual)}; - } - /// Return the round-to-nearest result of \a c and its error - static Nearest - nearest(const Case& c) { - switch (c.op) { - case Op::ADD: - return two_sum(c.x, c.y); - case Op::SUB: - return two_sum(c.x, -c.y); - case Op::MUL: { - const Gecode::FloatNum p = c.x * c.y; - return {p, std::fma(c.x, c.y, -p)}; - } - case Op::DIV: { - const Gecode::FloatNum q = c.x / c.y; - return {q, std::fma(-q, c.y, c.x) * (c.y < 0.0 ? -1.0 : 1.0)}; - } - case Op::SQRT: { - const Gecode::FloatNum s = std::sqrt(c.x); - return {s, std::fma(-s, s, c.x)}; - } - case Op::INTEGER: - break; - } - return {c.x, 0.0}; } - /// Return the exact directed bounds of \a c (in round-to-nearest mode) - static Bounds - expected(const Case& c) { - if (c.op == Op::INTEGER) - return {std::floor(c.x), std::ceil(c.x)}; - const Gecode::FloatNum inf = std::numeric_limits::infinity(); - const Nearest n = nearest(c); - return {n.error < 0.0 ? std::nextafter(n.value, -inf) : n.value, - n.error > 0.0 ? std::nextafter(n.value, inf) : n.value}; + if (previous != -1) + std::fesetround(previous); + return result; + } + } rounding_scope; + + /// Regression test for downward rounding of negating operations on AArch64 + class DirectedRoundingRegression : public Base { + protected: + /// Space posting an NthRoot constraint on a positive source + class RootSpace : public Gecode::Space { + public: + /// Source and root variables + Gecode::FloatVar source, root; + /// Post the square root of the source interval [lo,hi] + RootSpace(Gecode::FloatNum lo, Gecode::FloatNum hi) : source(*this, lo, hi), root(*this, 0.0, 1.0) { + Gecode::nroot(*this, source, 2, root); + } + /// Clone constructor + RootSpace(RootSpace& s) : Gecode::Space(s) { + source.update(*this, s.source); + root.update(*this, s.root); + } + /// Copy space during cloning + Gecode::Space* + copy() override { + return new RootSpace(*this); } + }; - /// Return the bounds computed in one Float::Rounding scope - template - forceinline static Bounds - rounding_bounds(Gecode::FloatNum x, Gecode::FloatNum y) { + public: + DirectedRoundingRegression() : Base("Float::Arithmetic::DirectedRoundingRegression", TestTags::check()) {} + bool + run() override { + bool result = true; + { + // Each exact result lies strictly between two adjacent doubles. + const volatile Gecode::FloatNum root_two = 0x1.6a09e667f3bccp+0; + const volatile Gecode::FloatNum one = 1.0; + const volatile Gecode::FloatNum three = 3.0; + const volatile Gecode::FloatNum quarter_ulp = std::ldexp(1.0, -54); Gecode::Float::Rounding r; - if constexpr (op == Op::ADD) - return {r.add_down(x, y), r.add_up(x, y)}; - else if constexpr (op == Op::SUB) - return {r.sub_down(x, y), r.sub_up(x, y)}; - else if constexpr (op == Op::MUL) - return {r.mul_down(x, y), r.mul_up(x, y)}; - else if constexpr (op == Op::DIV) - return {r.div_down(x, y), r.div_up(x, y)}; - else if constexpr (op == Op::SQRT) - return {r.sqrt_down(x), r.sqrt_up(x)}; - else - return {r.int_down(x), r.int_up(x)}; - } - /// Return the bounds of the FloatVal result - template - forceinline static Bounds - float_val_bounds(Gecode::FloatNum x, Gecode::FloatNum y) { - Gecode::FloatVal v; - if constexpr (op == Op::ADD) - v = Gecode::FloatVal(x) + Gecode::FloatVal(y); - else if constexpr (op == Op::SUB) - v = Gecode::FloatVal(x) - Gecode::FloatVal(y); - else if constexpr (op == Op::MUL) - v = Gecode::FloatVal(x) * Gecode::FloatVal(y); - else if constexpr (op == Op::DIV) - v = Gecode::FloatVal(x) / Gecode::FloatVal(y); - else - v = sqrt(Gecode::FloatVal(x)); - return {v.min(), v.max()}; - } - /// Observe both interfaces and whether they keep the caller's mode - template - forceinline static Observed - observe(Gecode::FloatNum x, Gecode::FloatNum y) { - const int mode = std::fegetround(); - Observed o; - o.rounding = rounding_bounds(x, y); - o.mode_kept = std::fegetround() == mode; - // FloatVal has no integer rounding operation. - if constexpr (op == Op::INTEGER) - o.float_val = o.rounding; - else - o.float_val = float_val_bounds(x, y); - o.mode_kept &= std::fegetround() == mode; - return o; - } - /// Observe case \a i with operands the compiler can fold - template - [[gnu::noinline]] static Observed - observe_literal(void) { - // Anything else in this function can stop Clang from folding. - constexpr Case c = cases[i]; - return observe(c.x, c.y); - } - /// Observe case \a i with runtime operands - template - [[gnu::noinline]] static Observed - observe_volatile(void) { - const volatile Gecode::FloatNum x = cases[i].x; - const volatile Gecode::FloatNum y = cases[i].y; - return observe(x, y); - } - - /// Log \a b in hexadecimal floating-point notation - static void - log_bounds(const char* name, const Bounds& b) { - olog << ' ' << name << " [" << std::hexfloat << b.down << ", " << b.up << std::defaultfloat << ']'; - } - /// Test whether \a o matches \a e, and log a mismatch - static bool - matches(int i, const char* kind, int mode, const Bounds& e, const Observed& o) { - const bool rounding_exact = (o.rounding.down == e.down) && (o.rounding.up == e.up); - const bool float_val_exact = (o.float_val.down == e.down) && (o.float_val.up == e.up); - if (o.mode_kept && rounding_exact && float_val_exact) - return true; - olog << "Case " << i << ' ' << kind << " in mode " << mode << ':'; - log_bounds("Rounding", o.rounding); - log_bounds("FloatVal", o.float_val); - log_bounds("expected", e); - olog << (o.mode_kept ? "" : " mode changed") << '\n'; - return false; - } - /// Test case \a i under caller mode \a mode - template - static bool - check_case(int mode) { - std::fesetround(FE_TONEAREST); - const Bounds e = expected(cases[i]); - std::fesetround(mode); - bool result = e.down < e.up; - result &= matches(i, "literal", mode, e, observe_literal()); - result &= matches(i, "volatile", mode, e, observe_volatile()); - return result; - } - /// Test all cases under caller mode \a mode - template - static bool - check_cases(int mode, std::index_sequence) { - return (check_case(mode) & ...); - } - - public: - DirectedRounding(void) : Base("Float::Arithmetic::DirectedRounding", TestTags::check()) {} - bool - run(void) override { - const int previous = std::fegetround(); - const int modes[] = {FE_TONEAREST, FE_DOWNWARD, FE_UPWARD, FE_TOWARDZERO}; - bool result = true; - for (int mode : modes) { - if (std::fesetround(mode) != 0) - continue; - result &= check_cases(mode, std::make_index_sequence()); + if ((r.mul_down(root_two, root_two) != 0x1.ffffffffffffep+0) || + (r.mul_up(root_two, root_two) != 0x1.fffffffffffffp+0) || + (r.div_down(one, three) != 0x1.5555555555555p-2) || + (r.div_up(one, three) != 0x1.5555555555556p-2) || + (r.add_down(one, -quarter_ulp) != 0x1.fffffffffffffp-1) || (r.add_up(one, -quarter_ulp) != 1.0)) { + olog << "Rounding operation was not directed" << '\n'; + result = false; } - if (previous != -1) - std::fesetround(previous); - return result; } - } directed_rounding; + // Parallel search on examples/cartesian-heart reached this domain. + // A wrong mul_down made the root iteration create an empty interval. + RootSpace s(0x1p-1016, 0x1p-1015); + if ((s.status() == Gecode::SS_FAILED) || (s.root.min() > 0x1p-508) || + (s.root.max() < 0x1.6a09e667f3bcdp-508)) { + olog << "NthRoot removed the root of " << s.source << '\n'; + result = false; + } + return result; + } + } directed_rounding_regression; + + /// Directed rounding gives exact bounds for literal and runtime operands + class DirectedRounding : public Base { + private: + /// Operation computed with directed rounding + enum class Op { ADD, SUB, MUL, DIV, SQRT, INTEGER }; + /// Operation and operands (\a y is unused by unary operations) + struct Case { + Op op; + Gecode::FloatNum x; + Gecode::FloatNum y; + }; + /// Lower and upper bound + struct Bounds { + Gecode::FloatNum down; + Gecode::FloatNum up; + }; + /// Round-to-nearest result and the sign-carrying rounding error + struct Nearest { + Gecode::FloatNum value; + Gecode::FloatNum error; + }; + /// Bounds observed through both interfaces in one caller mode + struct Observed { + Bounds rounding; + Bounds float_val; + bool mode_kept; + }; + /// Cases whose two directed bounds differ + static constexpr Case cases[] = { + {Op::ADD, 0.1, 0.2}, {Op::ADD, -0.1, -0.2}, {Op::SUB, 0.1, 0.7}, {Op::SUB, -0.1, 0.2}, + {Op::MUL, 0.1, 0.3}, {Op::MUL, -0.1, 0.3}, {Op::DIV, 1.0, 3.0}, {Op::DIV, -1.0, 3.0}, + {Op::SQRT, 2.0, 0.0}, {Op::SQRT, 0.1, 0.0}, {Op::INTEGER, 2.5, 0.0}, {Op::INTEGER, -2.5, 0.0}, + }; - /// Median queries preserve the caller's floating-point rounding mode - class MedianRoundingMode : public Base { - public: - MedianRoundingMode(void) : Base("Float::Arithmetic::MedianRoundingMode", TestTags::check()) {} - bool - run(void) override { - const int previous = std::fegetround(); - const int modes[] = {FE_TONEAREST, FE_DOWNWARD, FE_UPWARD, FE_TOWARDZERO}; - const Gecode::FloatNum limit = std::numeric_limits::max(); + /// Return \a a + \a b and its exact error (TwoSum) + static Nearest + two_sum(Gecode::FloatNum a, Gecode::FloatNum b) { + const Gecode::FloatNum s = a + b; + const Gecode::FloatNum b_virtual = s - a; + return {s, (a - (s - b_virtual)) + (b - b_virtual)}; + } + /// Return the round-to-nearest result of \a c and its error + static Nearest + nearest(const Case& c) { + switch (c.op) { + case Op::ADD: + return two_sum(c.x, c.y); + case Op::SUB: + return two_sum(c.x, -c.y); + case Op::MUL: { + const Gecode::FloatNum p = c.x * c.y; + return {p, std::fma(c.x, c.y, -p)}; + } + case Op::DIV: { + const Gecode::FloatNum q = c.x / c.y; + return {q, std::fma(-q, c.y, c.x) * (c.y < 0.0 ? -1.0 : 1.0)}; + } + case Op::SQRT: { + const Gecode::FloatNum s = std::sqrt(c.x); + return {s, std::fma(-s, s, c.x)}; + } + case Op::INTEGER: + break; + } + return {c.x, 0.0}; + } + /// Return the exact directed bounds of \a c (in round-to-nearest mode) + static Bounds + expected(const Case& c) { + if (c.op == Op::INTEGER) + return {std::floor(c.x), std::ceil(c.x)}; + const Gecode::FloatNum inf = std::numeric_limits::infinity(); + const Nearest n = nearest(c); + return {n.error < 0.0 ? std::nextafter(n.value, -inf) : n.value, + n.error > 0.0 ? std::nextafter(n.value, inf) : n.value}; + } + + /// Return the bounds computed in one Float::Rounding scope + template + forceinline static Bounds + rounding_bounds(Gecode::FloatNum x, Gecode::FloatNum y) { + Gecode::Float::Rounding r; + if constexpr (op == Op::ADD) + return {r.add_down(x, y), r.add_up(x, y)}; + else if constexpr (op == Op::SUB) + return {r.sub_down(x, y), r.sub_up(x, y)}; + else if constexpr (op == Op::MUL) + return {r.mul_down(x, y), r.mul_up(x, y)}; + else if constexpr (op == Op::DIV) + return {r.div_down(x, y), r.div_up(x, y)}; + else if constexpr (op == Op::SQRT) + return {r.sqrt_down(x), r.sqrt_up(x)}; + else + return {r.int_down(x), r.int_up(x)}; + } + /// Return the bounds of the FloatVal result + template + forceinline static Bounds + float_val_bounds(Gecode::FloatNum x, Gecode::FloatNum y) { + Gecode::FloatVal v; + if constexpr (op == Op::ADD) + v = Gecode::FloatVal(x) + Gecode::FloatVal(y); + else if constexpr (op == Op::SUB) + v = Gecode::FloatVal(x) - Gecode::FloatVal(y); + else if constexpr (op == Op::MUL) + v = Gecode::FloatVal(x) * Gecode::FloatVal(y); + else if constexpr (op == Op::DIV) + v = Gecode::FloatVal(x) / Gecode::FloatVal(y); + else + v = sqrt(Gecode::FloatVal(x)); + return {v.min(), v.max()}; + } + /// Observe both interfaces and whether they keep the caller's mode + template + forceinline static Observed + observe(Gecode::FloatNum x, Gecode::FloatNum y) { + const int mode = std::fegetround(); + Observed o; + o.rounding = rounding_bounds(x, y); + o.mode_kept = std::fegetround() == mode; + // FloatVal has no integer rounding operation. + if constexpr (op == Op::INTEGER) + o.float_val = o.rounding; + else + o.float_val = float_val_bounds(x, y); + o.mode_kept &= std::fegetround() == mode; + return o; + } + /// Observe case \a i with operands the compiler can fold + template + [[gnu::noinline]] static Observed + observe_literal() { + // Anything else in this function can stop Clang from folding. + constexpr Case c = cases[i]; + return observe(c.x, c.y); + } + /// Observe case \a i with runtime operands + template + [[gnu::noinline]] static Observed + observe_volatile() { + const volatile Gecode::FloatNum x = cases[i].x; + const volatile Gecode::FloatNum y = cases[i].y; + return observe(x, y); + } + + /// Log \a b in hexadecimal floating-point notation + static void + log_bounds(const char* name, const Bounds& b) { + olog << ' ' << name << " [" << std::hexfloat << b.down << ", " << b.up << std::defaultfloat << ']'; + } + /// Test whether \a o matches \a e, and log a mismatch + static bool + matches(int i, const char* kind, int mode, const Bounds& e, const Observed& o) { + const bool rounding_exact = (o.rounding.down == e.down) && (o.rounding.up == e.up); + const bool float_val_exact = (o.float_val.down == e.down) && (o.float_val.up == e.up); + if (o.mode_kept && rounding_exact && float_val_exact) + return true; + olog << "Case " << i << ' ' << kind << " in mode " << mode << ':'; + log_bounds("Rounding", o.rounding); + log_bounds("FloatVal", o.float_val); + log_bounds("expected", e); + olog << (o.mode_kept ? "" : " mode changed") << '\n'; + return false; + } + /// Test case \a i under caller mode \a mode + template + static bool + check_case(int mode) { + std::fesetround(FE_TONEAREST); + const Bounds e = expected(cases[i]); + std::fesetround(mode); + bool result = e.down < e.up; + result &= matches(i, "literal", mode, e, observe_literal()); + result &= matches(i, "volatile", mode, e, observe_volatile()); + return result; + } + /// Test all cases under caller mode \a mode + template + static bool + check_cases(int mode, std::index_sequence) { + return (check_case(mode) & ...); + } + + public: + DirectedRounding() : Base("Float::Arithmetic::DirectedRounding", TestTags::check()) {} + bool + run() override { + const int previous = std::fegetround(); + const int modes[] = {FE_TONEAREST, FE_DOWNWARD, FE_UPWARD, FE_TOWARDZERO}; + bool result = true; + for (int mode : modes) { + if (std::fesetround(mode) != 0) + continue; + result &= check_cases(mode, std::make_index_sequence()); + } + if (previous != -1) + std::fesetround(previous); + return result; + } + } directed_rounding; + + /// Median queries preserve the caller's floating-point rounding mode + class MedianRoundingMode : public Base { + public: + MedianRoundingMode() : Base("Float::Arithmetic::MedianRoundingMode", TestTags::check()) {} + bool + run() override { + const int previous = std::fegetround(); + const int modes[] = {FE_TONEAREST, FE_DOWNWARD, FE_UPWARD, FE_TOWARDZERO}; + const Gecode::FloatNum limit = std::numeric_limits::max(); #if !defined(__FINITE_MATH_ONLY__) || !__FINITE_MATH_ONLY__ - const Gecode::FloatNum infinity = std::numeric_limits::infinity(); + const Gecode::FloatNum infinity = std::numeric_limits::infinity(); #endif - const Gecode::FloatNum cases[][3] = {{1.0, 3.0, 2.0}, {-3.0, -1.0, -2.0}, - {-limit, limit, 0.0}, {limit, limit, limit}, - {-limit, -limit, -limit}, - // Finite-math builds do not support infinite inputs. + const Gecode::FloatNum cases[][3] = {{1.0, 3.0, 2.0}, {-3.0, -1.0, -2.0}, + {-limit, limit, 0.0}, {limit, limit, limit}, + {-limit, -limit, -limit}, + // Finite-math builds do not support infinite inputs. #if !defined(__FINITE_MATH_ONLY__) || !__FINITE_MATH_ONLY__ - {-infinity, infinity, 0.0} + {-infinity, infinity, 0.0} #endif - }; - bool result = true; - for (int mode : modes) - for (const auto& c : cases) { - const Gecode::FloatVal value(c[0], c[1]); - if (std::fesetround(mode) != 0) - continue; - volatile Gecode::FloatNum direct; - { - Gecode::Float::Rounding r; - direct = r.median(c[0], c[1]); - } - if ((std::fegetround() != mode) || (direct != c[2])) { - olog << "Direct median changed its result or rounding mode " << mode << '\n'; - result = false; - } - const volatile Gecode::FloatNum median = value.med(); - if ((std::fegetround() != mode) || (median != c[2])) { - olog << "Median query changed its result or rounding mode " << mode << '\n'; - result = false; - } - } - if (previous != -1) - std::fesetround(previous); - return result; - } - } median_rounding_mode; - - /// Regression test for outward positive even-root bounds - class PositiveNRootBounds : public Base { - protected: - /// Space exercising the Pow and NthRoot propagators - class RootSpace : public Gecode::Space { - public: - /// Variables used by the propagator - Gecode::FloatVar x0, x1; - /// Post an extreme Pow or NthRoot instance - RootSpace(Gecode::FloatNum hi, Gecode::FloatNum witness, int n, bool use_pow) - : x0(*this, 0.0, use_pow ? witness : hi), - x1(*this, use_pow ? 0.0 : witness, use_pow ? hi : witness) { - if (use_pow) { - Gecode::pow(*this, x0, n, x1); - Gecode::rel(*this, x0, Gecode::FRT_EQ, witness); - } else { - Gecode::nroot(*this, x0, n, x1); - } - } - /// Clone constructor - RootSpace(RootSpace& s) : Gecode::Space(s) { - x0.update(*this, s.x0); - x1.update(*this, s.x1); - } - /// Copy space during cloning - Gecode::Space* - copy(void) override { - return new RootSpace(*this); - } }; - - /// Space exposing the propagated NthRoot upper bound - class NRootBoundSpace : public Gecode::Space { - public: - /// Source and root variables - Gecode::FloatVar source, root; - /// Post an NthRoot constraint with an unconstrained root - NRootBoundSpace(Gecode::FloatNum hi, int n) - : source(*this, 0.0, hi), root(*this, 0.0, Gecode::Float::Limits::max) { - Gecode::nroot(*this, source, n, root); - } - /// Clone constructor - NRootBoundSpace(NRootBoundSpace& s) : Gecode::Space(s) { - source.update(*this, s.source); - root.update(*this, s.root); - } - /// Copy space during cloning - Gecode::Space* - copy(void) override { - return new NRootBoundSpace(*this); - } - }; - - /// Check that a known feasible boundary value is not removed - bool - check(Gecode::FloatNum hi, Gecode::FloatNum witness, int n, int mode, bool use_pow) const { - if (std::fesetround(mode) != 0) - return true; - RootSpace s(hi, witness, n, use_pow); - if (s.status() != Gecode::SS_FAILED) - return true; - olog << "Root bound removed a solution for " << (use_pow ? "pow" : "nroot") << ", n=" << n - << ", mode=" << mode << '\n'; - return false; - } - /// Check that propagation returns a genuinely outward upper bound - bool - check_bound(Gecode::FloatNum hi, Gecode::FloatNum rejected, int n, int mode) const { - if (std::fesetround(mode) != 0) - return true; - NRootBoundSpace s(hi, n); - if ((s.status() != Gecode::SS_FAILED) && (s.root.max() > rejected)) - return true; - olog << "NRoot upper bound was not outward for n=" << n << ", mode=" << mode << '\n'; - return false; - } - - public: - /// Create and register test - PositiveNRootBounds(void) : Base("Float::Arithmetic::PositiveNRootBounds", TestTags::check()) {} - /// Run test under every supported IEEE-754 rounding mode - bool - run(void) override { - const int old_mode = std::fegetround(); - const int modes[] = {FE_TONEAREST, FE_DOWNWARD, FE_UPWARD, FE_TOWARDZERO}; - struct Case { - Gecode::FloatNum hi; - Gecode::FloatNum witness; - int n; - } cases[] = {{std::ldexp(static_cast(0x156e1fc2f8f359ULL), -1049), - std::ldexp(static_cast(0x14484bfeebc28cULL), -152), 10}, - {std::numeric_limits::denorm_min(), - std::ldexp(static_cast(0x18406003b2ae42ULL), -160), 10}, - {std::numeric_limits::max(), - std::ldexp(static_cast(0x1965fea53d6e0fULL), 118), 6}}; - bool result = true; - const Gecode::FloatNum rounding_hi = - std::ldexp(static_cast(0x1751def03d6f38ULL), 458); - const Gecode::FloatNum rejected_upper = - std::ldexp(static_cast(0x1350f4c43079ceULL), 203); - for (unsigned int m = 0; m < sizeof(modes) / sizeof(modes[0]); m++) { - for (unsigned int c = 0; c < sizeof(cases) / sizeof(cases[0]); c++) { - result = check(cases[c].hi, cases[c].witness, cases[c].n, modes[m], false) && result; - result = check(cases[c].hi, cases[c].witness, cases[c].n, modes[m], true) && result; + bool result = true; + for (int mode : modes) + for (const auto& c : cases) { + const Gecode::FloatVal value(c[0], c[1]); + if (std::fesetround(mode) != 0) + continue; + volatile Gecode::FloatNum direct; + { + Gecode::Float::Rounding r; + direct = r.median(c[0], c[1]); } - result = check_bound(rounding_hi, rejected_upper, 2, modes[m]) && result; - } - if (old_mode != -1) - std::fesetround(old_mode); - return result; - } - } positive_nroot_bounds; - - /// Regression tests for Pow zero semantics and propagation fixpoints - class PowConsistency : public Base { - protected: - /// Space for direct and delayed assignment of the base to zero - class ZeroSpace : public Gecode::Space { - public: - /// Base and result variables - Gecode::FloatVar x, y; - /// Post a power constraint with either a zero or a wide base - ZeroSpace(int n, bool direct) : x(*this, direct ? 0.0 : -1.0, direct ? 0.0 : 1.0), y(*this, -1.0, 2.0) { - Gecode::pow(*this, x, n, y); - } - /// Clone constructor - ZeroSpace(ZeroSpace& s) : Gecode::Space(s) { - x.update(*this, s.x); - y.update(*this, s.y); - } - /// Copy space during cloning - Gecode::Space* - copy(void) override { - return new ZeroSpace(*this); - } - }; - - /// Space for an adjacent interval containing zero at one endpoint - class AdjacentZeroSpace : public Gecode::Space { - public: - /// Base and result variables - Gecode::FloatVar x, y; - /// Post exponent zero on a positive or negative adjacent interval - AdjacentZeroSpace(bool positive) - : x(*this, positive ? 0.0 : -std::numeric_limits::denorm_min(), - positive ? std::numeric_limits::denorm_min() : -0.0), - y(*this, -1.0, 2.0) { - Gecode::pow(*this, x, 0, y); - } - /// Clone constructor - AdjacentZeroSpace(AdjacentZeroSpace& s) : Gecode::Space(s) { - x.update(*this, s.x); - y.update(*this, s.y); - } - /// Copy space during cloning - Gecode::Space* - copy(void) override { - return new AdjacentZeroSpace(*this); - } - }; - - /// Space reproducing a Pow inverse-to-forward fixpoint - class FixpointSpace : public Gecode::Space { - public: - /// Base and result variables - Gecode::FloatVar x, y; - /// Post the fixpoint regression instance - FixpointSpace(void) - : x(*this, -std::ldexp(static_cast(0x10000000000006ULL), -53), - -std::ldexp(static_cast(0x10000000000004ULL), -53)), - y(*this, std::ldexp(static_cast(0x1000000000000aULL), -54), - std::ldexp(static_cast(0x1000000000000cULL), -54)) { - Gecode::pow(*this, x, 2, y); - } - /// Clone constructor - FixpointSpace(FixpointSpace& s) : Gecode::Space(s) { - x.update(*this, s.x); - y.update(*this, s.y); - } - /// Copy space during cloning - Gecode::Space* - copy(void) override { - return new FixpointSpace(*this); - } - }; - - /// Space for direct and delayed assignment of the result to zero - class ZeroResultSpace : public Gecode::Space { - public: - /// Base and result variables - Gecode::FloatVar x, y; - /// Post a power constraint with either a zero or a wide result - ZeroResultSpace(int n, bool direct) - : x(*this, -1.0, 1.0), y(*this, direct ? 0.0 : -1.0, direct ? 0.0 : 1.0) { - Gecode::pow(*this, x, n, y); - } - /// Clone constructor - ZeroResultSpace(ZeroResultSpace& s) : Gecode::Space(s) { - x.update(*this, s.x); - y.update(*this, s.y); - } - /// Copy space during cloning - Gecode::Space* - copy(void) override { - return new ZeroResultSpace(*this); - } - }; - - /// Test one exponent with direct and delayed zero assignment - bool - check_zero(int n) const { - ZeroSpace direct(n, true); - ZeroSpace delayed(n, false); - if (delayed.status() == Gecode::SS_FAILED) { - olog << "Pow wide base failed for n=" << n << '\n'; - return false; - } - ZeroSpace* clone = static_cast(delayed.clone()); - Gecode::rel(*clone, clone->x, Gecode::FRT_EQ, 0.0); - if (n == 0) { - const bool zero_rejected = - (direct.status() == Gecode::SS_FAILED) && (clone->status() == Gecode::SS_FAILED); - delete clone; - ZeroSpace* non_zero = static_cast(delayed.clone()); - Gecode::rel(*non_zero, non_zero->x, Gecode::FRT_EQ, 0.5); - const bool non_zero_accepted = (non_zero->status() != Gecode::SS_FAILED) && - (non_zero->y.min() == 1.0) && (non_zero->y.max() == 1.0); - delete non_zero; - if (!zero_rejected || !non_zero_accepted) - olog << "Pow exponent-zero semantics failed" << '\n'; - return zero_rejected && non_zero_accepted; - } - const bool result = (direct.status() != Gecode::SS_FAILED) && (direct.y.min() == 0.0) && - (direct.y.max() == 0.0) && (clone->status() != Gecode::SS_FAILED) && - (clone->y.min() == 0.0) && (clone->y.max() == 0.0); - delete clone; - if (!result) - olog << "Pow delayed zero failed for n=" << n << '\n'; - return result; - } - /// Test that a zero result forces a zero base - bool - check_zero_result(int n, bool direct) const { - ZeroResultSpace initial(n, direct); - if (initial.status() == Gecode::SS_FAILED) { - olog << "Pow zero result failed for n=" << n << '\n'; - return false; - } - ZeroResultSpace* clone = static_cast(initial.clone()); - if (!direct) - Gecode::rel(*clone, clone->y, Gecode::FRT_EQ, 0.0); - const bool contracted = - (clone->status() != Gecode::SS_FAILED) && (clone->x.min() == 0.0) && (clone->x.max() == 0.0); - Gecode::rel(*clone, clone->x, Gecode::FRT_EQ, 1.0); - const bool inconsistent_rejected = clone->status() == Gecode::SS_FAILED; - delete clone; - if (!contracted || !inconsistent_rejected) - olog << "Pow zero result did not force zero base for n=" << n - << (direct ? " (direct)" : " (delayed)") << '\n'; - return contracted && inconsistent_rejected; - } - /// Test exponent zero on an adjacent interval containing zero - bool - check_adjacent_zero(bool positive) const { - AdjacentZeroSpace initial(positive); - // Adjacent intervals are assigned and cannot be narrowed further. - // Keep the unresolved nonzero constraint through propagation and cloning. - const bool actor_retained = (initial.status() != Gecode::SS_FAILED) && (initial.y.min() == 1.0) && - (initial.y.max() == 1.0) && - (Gecode::PropagatorGroup::all.size(initial) > 0); - - AdjacentZeroSpace* clone = static_cast(initial.clone()); - const bool clone_retained = (clone->status() != Gecode::SS_FAILED) && (clone->y.min() == 1.0) && - (clone->y.max() == 1.0) && (Gecode::PropagatorGroup::all.size(*clone) > 0); - delete clone; - - if (!actor_retained || !clone_retained) - olog << "Pow adjacent exponent-zero semantics failed" << (positive ? " (positive)" : " (negative)") - << '\n'; - return actor_retained && clone_retained; - } - - public: - /// Create and register test - PowConsistency(void) : Base("Float::Arithmetic::PowConsistency", TestTags::check()) {} - /// Run zero and fixpoint regressions - bool - run(void) override { - bool result = true; - for (int n = 0; n <= 3; n++) - result = check_zero(n) && result; - for (int n = 1; n <= 3; n++) { - result = check_zero_result(n, true) && result; - result = check_zero_result(n, false) && result; - } - result = check_adjacent_zero(true) && result; - result = check_adjacent_zero(false) && result; - - FixpointSpace once; - if (once.status() == Gecode::SS_FAILED) { - olog << "Pow fixpoint instance failed" << '\n'; - return false; - } - FixpointSpace* twice = static_cast(once.clone()); - Gecode::pow(*twice, twice->x, 2, twice->y); - const bool fixpoint = (twice->status() != Gecode::SS_FAILED) && (once.x.min() == twice->x.min()) && - (once.x.max() == twice->x.max()) && (once.y.min() == twice->y.min()) && - (once.y.max() == twice->y.max()); - delete twice; - if (!fixpoint) - olog << "Pow posting did not reach a fixpoint" << '\n'; - return fixpoint && result; - } - } pow_consistency; - - /// Regression tests for multiplication through a zero endpoint - class MultZeroEndpoint : public Base { - protected: - /// Space exposing multiplication propagation at the public API - class MultSpace : public Gecode::Space { - public: - /// Factors and product - Gecode::FloatVar x, y, z; - /// Post x * y = z for the supplied intervals - MultSpace(Gecode::FloatNum xl, Gecode::FloatNum xu, Gecode::FloatNum yl, Gecode::FloatNum yu, - Gecode::FloatNum zl, Gecode::FloatNum zu) - : x(*this, xl, xu), y(*this, yl, yu), z(*this, zl, zu) { - Gecode::mult(*this, x, y, z); - } - /// Clone constructor - MultSpace(MultSpace& s) : Gecode::Space(s) { - x.update(*this, s.x); - y.update(*this, s.y); - z.update(*this, s.z); - } - /// Copy space during cloning - Gecode::Space* - copy(void) override { - return new MultSpace(*this); - } - }; - - /// Check one endpoint-zero sign and magnitude contraction - bool - check(Gecode::FloatNum xl, Gecode::FloatNum xu, Gecode::FloatNum yl, Gecode::FloatNum yu, - Gecode::FloatNum zl, Gecode::FloatNum zu, Gecode::FloatNum expected_min, - Gecode::FloatNum expected_max) const { - MultSpace s(xl, xu, yl, yu, zl, zu); - if ((s.status() == Gecode::SS_FAILED) || (s.x.min() < expected_min) || (s.x.max() > expected_max)) { - olog << "Multiplication endpoint-zero contraction failed: x=" << s.x << ", y=" << s.y - << ", z=" << s.z << '\n'; - return false; - } - MultSpace* clone = static_cast(s.clone()); - Gecode::mult(*clone, clone->x, clone->y, clone->z); - const bool fixpoint = (clone->status() != Gecode::SS_FAILED) && (clone->x.min() == s.x.min()) && - (clone->x.max() == s.x.max()) && (clone->y.min() == s.y.min()) && - (clone->y.max() == s.y.max()) && (clone->z.min() == s.z.min()) && - (clone->z.max() == s.z.max()); - delete clone; - if (!fixpoint) - olog << "Multiplication endpoint-zero case was not at a fixpoint" << '\n'; - return fixpoint; - } - /// Exercise supported points across endpoint-zero sign combinations - bool - fuzz(void) const { - unsigned int state = 0x6d756c74U; - for (unsigned int i = 0; i < 5000; i++) { - state = state * 1664525U + 1013904223U; - const Gecode::FloatNum am = 0.125 + static_cast((state >> 8) % 8000) / 512.0; - state = state * 1664525U + 1013904223U; - const Gecode::FloatNum bm = 0.125 + static_cast((state >> 8) % 8000) / 512.0; - const Gecode::FloatNum a = (i & 1U) ? -am : am; - const Gecode::FloatNum b = (i & 2U) ? -bm : bm; - const Gecode::FloatNum p = a * b; - const Gecode::FloatNum slack = 1.0 + am / 4.0; - const Gecode::FloatNum xl = a - slack; - const Gecode::FloatNum xu = a + slack; - const Gecode::FloatNum yl = (b < 0.0) ? -(bm + 1.0) : 0.0; - const Gecode::FloatNum yu = (b < 0.0) ? -0.0 : bm + 1.0; - MultSpace s(xl, xu, yl, yu, p, p); - if ((s.status() == Gecode::SS_FAILED) || (s.x.min() > a) || (s.x.max() < a) || (s.y.min() > b) || - (s.y.max() < b) || (s.z.min() > p) || (s.z.max() < p)) { - olog << "Multiplication removed supported fuzz point " << i << ": (" << a << ", " << b << ", " - << p << ")" << '\n'; - return false; + if ((std::fegetround() != mode) || (direct != c[2])) { + olog << "Direct median changed its result or rounding mode " << mode << '\n'; + result = false; + } + const volatile Gecode::FloatNum median = value.med(); + if ((std::fegetround() != mode) || (median != c[2])) { + olog << "Median query changed its result or rounding mode " << mode << '\n'; + result = false; } } - return true; - } - + if (previous != -1) + std::fesetround(previous); + return result; + } + } median_rounding_mode; + + /// Regression test for outward positive even-root bounds + class PositiveNRootBounds : public Base { + protected: + /// Space exercising the Pow and NthRoot propagators + class RootSpace : public Gecode::Space { public: - /// Create and register test - MultZeroEndpoint(void) : Base("Float::Arithmetic::MultZeroEndpoint", TestTags::check()) {} - /// Run sign, symmetry, signed-zero, and zero-product cases - bool - run(void) override { - bool result = true; - result = check(-1.0, 1.0, 0.0, 1.0, 0.5, 1.0, 0.5, 1.0) && result; - result = check(-1.0, 1.0, -1.0, -0.0, 0.5, 1.0, -1.0, -0.5) && result; - result = check(-1.0, 1.0, 0.0, 1.0, -1.0, -0.5, -1.0, -0.5) && result; - result = check(-1.0, 1.0, -1.0, -0.0, -1.0, -0.5, 0.5, 1.0) && result; - - // Swapping the factors must recover the same contraction. - MultSpace swapped(0.0, 1.0, -1.0, 1.0, 0.5, 1.0); - result = (swapped.status() != Gecode::SS_FAILED) && (swapped.y.min() >= 0.5) && result; - - // A zero product gives no sign information about the other factor. - MultSpace zero_product(-1.0, 1.0, 0.0, 1.0, 0.0, 0.0); - result = (zero_product.status() != Gecode::SS_FAILED) && (zero_product.x.min() == -1.0) && - (zero_product.x.max() == 1.0) && result; - MultSpace zero_factor(0.0, 0.0, -1.0, 1.0, 0.0, 0.0); - result = (zero_factor.status() != Gecode::SS_FAILED) && (zero_factor.y.min() == -1.0) && - (zero_factor.y.max() == 1.0) && result; - if (!result) - olog << "Multiplication zero or swapped regression failed" << '\n'; - return fuzz() && result; - } - } mult_zero_endpoint; - - /// %Test for multiplication constraint - class MultXYZ : public Test { - public: - /// Create and register test - MultXYZ(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::Mult::XYZ::" + s, 3, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(x[0] * x[1], x[2]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - if (flip()) - Gecode::mult(home, x[0], x[1], x[2]); - else - Gecode::rel(home, x[0] * x[1] == x[2]); - } - }; - - /// %Test for multiplication constraint when solution is ensured - class MultXYZSol : public Test { - public: - /// Create and register test - MultXYZSol(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(tags, "Arithmetic::Mult::XYZ::Sol::" + s, 3, d, st, EXTEND_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(x[0] * x[1], x[2]); - } - /// Extend assignment \a x - bool - extend_assignment(Assignment& x) const override { - Gecode::FloatVal d = x[0] * x[1]; - if (Gecode::Float::subset(d, dom)) { - x.set(2, d); - return true; + /// Variables used by the propagator + Gecode::FloatVar x0, x1; + /// Post an extreme Pow or NthRoot instance + RootSpace(Gecode::FloatNum hi, Gecode::FloatNum witness, int n, bool use_pow) + : x0(*this, 0.0, use_pow ? witness : hi), x1(*this, use_pow ? 0.0 : witness, use_pow ? hi : witness) { + if (use_pow) { + Gecode::pow(*this, x0, n, x1); + Gecode::rel(*this, x0, Gecode::FRT_EQ, witness); } else { - return false; + Gecode::nroot(*this, x0, n, x1); } } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::mult(home, x[0], x[1], x[2]); - } - }; - - /// %Test for multiplication constraint with shared variables - class MultXXY : public Test { - public: - /// Create and register test - MultXXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::Mult::XXY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(x[0] * x[0], x[1]); + /// Clone constructor + RootSpace(RootSpace& s) : Gecode::Space(s) { + x0.update(*this, s.x0); + x1.update(*this, s.x1); } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::mult(home, x[0], x[0], x[1]); + /// Copy space during cloning + Gecode::Space* + copy() override { + return new RootSpace(*this); } }; - /// %Test for multiplication constraint with shared variables when solution is ensured - class MultXXYSol : public Test { + /// Space exposing the propagated NthRoot upper bound + class NRootBoundSpace : public Gecode::Space { public: - /// Create and register test - MultXXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::Mult::XXY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(x[0] * x[0], x[1]); - } - /// Extend assignment \a x - bool - extend_assignment(Assignment& x) const override { - Gecode::FloatVal d = x[0] * x[0]; - if (Gecode::Float::subset(d, dom)) { - x.set(1, d); - return true; - } else { - return false; - } - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::mult(home, x[0], x[0], x[1]); + /// Source and root variables + Gecode::FloatVar source, root; + /// Post an NthRoot constraint with an unconstrained root + NRootBoundSpace(Gecode::FloatNum hi, int n) + : source(*this, 0.0, hi), root(*this, 0.0, Gecode::Float::Limits::max) { + Gecode::nroot(*this, source, n, root); + } + /// Clone constructor + NRootBoundSpace(NRootBoundSpace& s) : Gecode::Space(s) { + source.update(*this, s.source); + root.update(*this, s.root); + } + /// Copy space during cloning + Gecode::Space* + copy() override { + return new NRootBoundSpace(*this); } }; - /// %Test for multiplication constraint with shared variables - class MultXYX : public Test { + /// Check that a known feasible boundary value is not removed + bool + check(Gecode::FloatNum hi, Gecode::FloatNum witness, int n, int mode, bool use_pow) const { + if (std::fesetround(mode) != 0) + return true; + RootSpace s(hi, witness, n, use_pow); + if (s.status() != Gecode::SS_FAILED) + return true; + olog << "Root bound removed a solution for " << (use_pow ? "pow" : "nroot") << ", n=" << n + << ", mode=" << mode << '\n'; + return false; + } + /// Check that propagation returns a genuinely outward upper bound + bool + check_bound(Gecode::FloatNum hi, Gecode::FloatNum rejected, int n, int mode) const { + if (std::fesetround(mode) != 0) + return true; + NRootBoundSpace s(hi, n); + if ((s.status() != Gecode::SS_FAILED) && (s.root.max() > rejected)) + return true; + olog << "NRoot upper bound was not outward for n=" << n << ", mode=" << mode << '\n'; + return false; + } + + public: + /// Create and register test + PositiveNRootBounds() : Base("Float::Arithmetic::PositiveNRootBounds", TestTags::check()) {} + /// Run test under every supported IEEE-754 rounding mode + bool + run() override { + const int old_mode = std::fegetround(); + const int modes[] = {FE_TONEAREST, FE_DOWNWARD, FE_UPWARD, FE_TOWARDZERO}; + struct Case { + Gecode::FloatNum hi; + Gecode::FloatNum witness; + int n; + } cases[] = {{std::ldexp(static_cast(0x156e1fc2f8f359ULL), -1049), + std::ldexp(static_cast(0x14484bfeebc28cULL), -152), 10}, + {std::numeric_limits::denorm_min(), + std::ldexp(static_cast(0x18406003b2ae42ULL), -160), 10}, + {std::numeric_limits::max(), + std::ldexp(static_cast(0x1965fea53d6e0fULL), 118), 6}}; + bool result = true; + const Gecode::FloatNum rounding_hi = std::ldexp(static_cast(0x1751def03d6f38ULL), 458); + const Gecode::FloatNum rejected_upper = std::ldexp(static_cast(0x1350f4c43079ceULL), 203); + for (int mode : modes) { + for (auto& c : cases) { + result = check(c.hi, c.witness, c.n, mode, false) && result; + result = check(c.hi, c.witness, c.n, mode, true) && result; + } + result = check_bound(rounding_hi, rejected_upper, 2, mode) && result; + } + if (old_mode != -1) + std::fesetround(old_mode); + return result; + } + } positive_nroot_bounds; + + /// Regression tests for Pow zero semantics and propagation fixpoints + class PowConsistency : public Base { + protected: + /// Space for direct and delayed assignment of the base to zero + class ZeroSpace : public Gecode::Space { public: - /// Create and register test - MultXYX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::Mult::XYX::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(x[0] * x[1], x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::mult(home, x[0], x[1], x[0]); + /// Base and result variables + Gecode::FloatVar x, y; + /// Post a power constraint with either a zero or a wide base + ZeroSpace(int n, bool direct) : x(*this, direct ? 0.0 : -1.0, direct ? 0.0 : 1.0), y(*this, -1.0, 2.0) { + Gecode::pow(*this, x, n, y); + } + /// Clone constructor + ZeroSpace(ZeroSpace& s) : Gecode::Space(s) { + x.update(*this, s.x); + y.update(*this, s.y); + } + /// Copy space during cloning + Gecode::Space* + copy() override { + return new ZeroSpace(*this); } }; - /// %Test for multiplication constraint with shared variables - class MultXYY : public Test { + /// Space for an adjacent interval containing zero at one endpoint + class AdjacentZeroSpace : public Gecode::Space { public: - /// Create and register test - MultXYY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::Mult::XYY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(x[0] * x[1], x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::mult(home, x[0], x[1], x[1]); + /// Base and result variables + Gecode::FloatVar x, y; + /// Post exponent zero on a positive or negative adjacent interval + AdjacentZeroSpace(bool positive) + : x(*this, positive ? 0.0 : -std::numeric_limits::denorm_min(), + positive ? std::numeric_limits::denorm_min() : -0.0), + y(*this, -1.0, 2.0) { + Gecode::pow(*this, x, 0, y); + } + /// Clone constructor + AdjacentZeroSpace(AdjacentZeroSpace& s) : Gecode::Space(s) { + x.update(*this, s.x); + y.update(*this, s.y); + } + /// Copy space during cloning + Gecode::Space* + copy() override { + return new AdjacentZeroSpace(*this); } }; - /// %Test for multiplication constraint with shared variables - class MultXXX : public Test { + /// Space reproducing a Pow inverse-to-forward fixpoint + class FixpointSpace : public Gecode::Space { public: - /// Create and register test - MultXXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::Mult::XXX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(x[0] * x[0], x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::mult(home, x[0], x[0], x[0]); + /// Base and result variables + Gecode::FloatVar x, y; + /// Post the fixpoint regression instance + FixpointSpace() + : x(*this, -std::ldexp(static_cast(0x10000000000006ULL), -53), + -std::ldexp(static_cast(0x10000000000004ULL), -53)), + y(*this, std::ldexp(static_cast(0x1000000000000aULL), -54), + std::ldexp(static_cast(0x1000000000000cULL), -54)) { + Gecode::pow(*this, x, 2, y); + } + /// Clone constructor + FixpointSpace(FixpointSpace& s) : Gecode::Space(s) { + x.update(*this, s.x); + y.update(*this, s.y); + } + /// Copy space during cloning + Gecode::Space* + copy() override { + return new FixpointSpace(*this); } }; - /// %Test for division constraint - class Div : public Test { + /// Space for direct and delayed assignment of the result to zero + class ZeroResultSpace : public Gecode::Space { public: - /// Create and register test - Div(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(tags, "Arithmetic::Div::" + s, 3, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(x[0] / x[1], x[2]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - if (flip()) - Gecode::div(home, x[0], x[1], x[2]); - else - Gecode::rel(home, x[0] / x[1] == x[2]); + /// Base and result variables + Gecode::FloatVar x, y; + /// Post a power constraint with either a zero or a wide result + ZeroResultSpace(int n, bool direct) + : x(*this, -1.0, 1.0), y(*this, direct ? 0.0 : -1.0, direct ? 0.0 : 1.0) { + Gecode::pow(*this, x, n, y); + } + /// Clone constructor + ZeroResultSpace(ZeroResultSpace& s) : Gecode::Space(s) { + x.update(*this, s.x); + y.update(*this, s.y); + } + /// Copy space during cloning + Gecode::Space* + copy() override { + return new ZeroResultSpace(*this); } }; - /// %Test for division constraint when solution is ensured - class DivSol : public Test { - public: - /// Create and register test - DivSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::Div::Sol::" + s, 3, d, st, EXTEND_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(x[0] / x[1], x[2]); + /// Test one exponent with direct and delayed zero assignment + bool + check_zero(int n) const { + ZeroSpace direct(n, true); + ZeroSpace delayed(n, false); + if (delayed.status() == Gecode::SS_FAILED) { + olog << "Pow wide base failed for n=" << n << '\n'; + return false; } - /// Extend assignment \a x - bool - extend_assignment(Assignment& x) const override { - Gecode::FloatVal d = x[0] / x[1]; - if (Gecode::Float::subset(d, dom)) { - x.set(2, d); - return true; - } else { - return false; - } + ZeroSpace* clone = static_cast(delayed.clone()); + Gecode::rel(*clone, clone->x, Gecode::FRT_EQ, 0.0); + if (n == 0) { + const bool zero_rejected = + (direct.status() == Gecode::SS_FAILED) && (clone->status() == Gecode::SS_FAILED); + delete clone; + ZeroSpace* non_zero = static_cast(delayed.clone()); + Gecode::rel(*non_zero, non_zero->x, Gecode::FRT_EQ, 0.5); + const bool non_zero_accepted = (non_zero->status() != Gecode::SS_FAILED) && + (non_zero->y.min() == 1.0) && (non_zero->y.max() == 1.0); + delete non_zero; + if (!zero_rejected || !non_zero_accepted) + olog << "Pow exponent-zero semantics failed" << '\n'; + return zero_rejected && non_zero_accepted; + } + const bool result = (direct.status() != Gecode::SS_FAILED) && (direct.y.min() == 0.0) && + (direct.y.max() == 0.0) && (clone->status() != Gecode::SS_FAILED) && + (clone->y.min() == 0.0) && (clone->y.max() == 0.0); + delete clone; + if (!result) + olog << "Pow delayed zero failed for n=" << n << '\n'; + return result; + } + /// Test that a zero result forces a zero base + bool + check_zero_result(int n, bool direct) const { + ZeroResultSpace initial(n, direct); + if (initial.status() == Gecode::SS_FAILED) { + olog << "Pow zero result failed for n=" << n << '\n'; + return false; } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::div(home, x[0], x[1], x[2]); + ZeroResultSpace* clone = static_cast(initial.clone()); + if (!direct) + Gecode::rel(*clone, clone->y, Gecode::FRT_EQ, 0.0); + const bool contracted = + (clone->status() != Gecode::SS_FAILED) && (clone->x.min() == 0.0) && (clone->x.max() == 0.0); + Gecode::rel(*clone, clone->x, Gecode::FRT_EQ, 1.0); + const bool inconsistent_rejected = clone->status() == Gecode::SS_FAILED; + delete clone; + if (!contracted || !inconsistent_rejected) + olog << "Pow zero result did not force zero base for n=" << n << (direct ? " (direct)" : " (delayed)") + << '\n'; + return contracted && inconsistent_rejected; + } + /// Test exponent zero on an adjacent interval containing zero + bool + check_adjacent_zero(bool positive) const { + AdjacentZeroSpace initial(positive); + // Adjacent intervals are assigned and cannot be narrowed further. + // Keep the unresolved nonzero constraint through propagation and cloning. + const bool actor_retained = (initial.status() != Gecode::SS_FAILED) && (initial.y.min() == 1.0) && + (initial.y.max() == 1.0) && (Gecode::PropagatorGroup::all.size(initial) > 0); + + AdjacentZeroSpace* clone = static_cast(initial.clone()); + const bool clone_retained = (clone->status() != Gecode::SS_FAILED) && (clone->y.min() == 1.0) && + (clone->y.max() == 1.0) && (Gecode::PropagatorGroup::all.size(*clone) > 0); + delete clone; + + if (!actor_retained || !clone_retained) + olog << "Pow adjacent exponent-zero semantics failed" << (positive ? " (positive)" : " (negative)") + << '\n'; + return actor_retained && clone_retained; + } + + public: + /// Create and register test + PowConsistency() : Base("Float::Arithmetic::PowConsistency", TestTags::check()) {} + /// Run zero and fixpoint regressions + bool + run() override { + bool result = true; + for (int n = 0; n <= 3; n++) + result = check_zero(n) && result; + for (int n = 1; n <= 3; n++) { + result = check_zero_result(n, true) && result; + result = check_zero_result(n, false) && result; + } + result = check_adjacent_zero(true) && result; + result = check_adjacent_zero(false) && result; + + FixpointSpace once; + if (once.status() == Gecode::SS_FAILED) { + olog << "Pow fixpoint instance failed" << '\n'; + return false; } - }; - - /// %Test for squaring constraint - class SqrXY : public Test { + FixpointSpace* twice = static_cast(once.clone()); + Gecode::pow(*twice, twice->x, 2, twice->y); + const bool fixpoint = (twice->status() != Gecode::SS_FAILED) && (once.x.min() == twice->x.min()) && + (once.x.max() == twice->x.max()) && (once.y.min() == twice->y.min()) && + (once.y.max() == twice->y.max()); + delete twice; + if (!fixpoint) + olog << "Pow posting did not reach a fixpoint" << '\n'; + return fixpoint && result; + } + } pow_consistency; + + /// Regression tests for multiplication through a zero endpoint + class MultZeroEndpoint : public Base { + protected: + /// Space exposing multiplication propagation at the public API + class MultSpace : public Gecode::Space { public: - /// Create and register test - SqrXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::Sqr::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(x[0] * x[0], x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - if (flip()) - Gecode::sqr(home, x[0], x[1]); - else - Gecode::rel(home, sqr(x[0]) == x[1]); + /// Factors and product + Gecode::FloatVar x, y, z; + /// Post x * y = z for the supplied intervals + MultSpace(Gecode::FloatNum xl, Gecode::FloatNum xu, Gecode::FloatNum yl, Gecode::FloatNum yu, + Gecode::FloatNum zl, Gecode::FloatNum zu) + : x(*this, xl, xu), y(*this, yl, yu), z(*this, zl, zu) { + Gecode::mult(*this, x, y, z); + } + /// Clone constructor + MultSpace(MultSpace& s) : Gecode::Space(s) { + x.update(*this, s.x); + y.update(*this, s.y); + z.update(*this, s.z); + } + /// Copy space during cloning + Gecode::Space* + copy() override { + return new MultSpace(*this); } }; - /// %Test for squaring constraint where solution is ensured - class SqrXYSol : public Test { - public: - /// Create and register test - SqrXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::Sqr::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(x[0] * x[0], x[1]); + /// Check one endpoint-zero sign and magnitude contraction + bool + check(Gecode::FloatNum xl, Gecode::FloatNum xu, Gecode::FloatNum yl, Gecode::FloatNum yu, Gecode::FloatNum zl, + Gecode::FloatNum zu, Gecode::FloatNum expected_min, Gecode::FloatNum expected_max) const { + MultSpace s(xl, xu, yl, yu, zl, zu); + if ((s.status() == Gecode::SS_FAILED) || (s.x.min() < expected_min) || (s.x.max() > expected_max)) { + olog << "Multiplication endpoint-zero contraction failed: x=" << s.x << ", y=" << s.y << ", z=" << s.z + << '\n'; + return false; } - /// Extend assignment \a x - bool - extend_assignment(Assignment& x) const override { - Gecode::FloatVal d = sqr(x[0]); - if (Gecode::Float::subset(d, dom)) { - x.set(1, d); - return true; - } else { + MultSpace* clone = static_cast(s.clone()); + Gecode::mult(*clone, clone->x, clone->y, clone->z); + const bool fixpoint = (clone->status() != Gecode::SS_FAILED) && (clone->x.min() == s.x.min()) && + (clone->x.max() == s.x.max()) && (clone->y.min() == s.y.min()) && + (clone->y.max() == s.y.max()) && (clone->z.min() == s.z.min()) && + (clone->z.max() == s.z.max()); + delete clone; + if (!fixpoint) + olog << "Multiplication endpoint-zero case was not at a fixpoint" << '\n'; + return fixpoint; + } + /// Exercise supported points across endpoint-zero sign combinations + bool + fuzz() const { + unsigned int state = 0x6d756c74U; + for (unsigned int i = 0; i < 5000; i++) { + state = state * 1664525U + 1013904223U; + const Gecode::FloatNum am = 0.125 + static_cast((state >> 8) % 8000) / 512.0; + state = state * 1664525U + 1013904223U; + const Gecode::FloatNum bm = 0.125 + static_cast((state >> 8) % 8000) / 512.0; + const Gecode::FloatNum a = (i & 1U) ? -am : am; + const Gecode::FloatNum b = (i & 2U) ? -bm : bm; + const Gecode::FloatNum p = a * b; + const Gecode::FloatNum slack = 1.0 + am / 4.0; + const Gecode::FloatNum xl = a - slack; + const Gecode::FloatNum xu = a + slack; + const Gecode::FloatNum yl = (b < 0.0) ? -(bm + 1.0) : 0.0; + const Gecode::FloatNum yu = (b < 0.0) ? -0.0 : bm + 1.0; + MultSpace s(xl, xu, yl, yu, p, p); + if ((s.status() == Gecode::SS_FAILED) || (s.x.min() > a) || (s.x.max() < a) || (s.y.min() > b) || + (s.y.max() < b) || (s.z.min() > p) || (s.z.max() < p)) { + olog << "Multiplication removed supported fuzz point " << i << ": (" << a << ", " << b << ", " << p + << ")" << '\n'; return false; } } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::sqr(home, x[0], x[1]); - } - }; - - /// %Test for squaring constraint with shared variables - class SqrXX : public Test { - public: - /// Create and register test - SqrXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(tags, "Arithmetic::Sqr::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(x[0] * x[0], x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::sqr(home, x[0], x[0]); - } - }; - - /// %Test for square root constraint - class SqrtXY : public Test { - public: - /// Create and register test - SqrtXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::Sqrt::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - switch (cmp(x[0], Gecode::FRT_GQ, 0.0)) { - case MT_FALSE: - return MT_FALSE; - case MT_MAYBE: - return MT_MAYBE; - default: - return eq(sqrt(x[0]), x[1]); - } + return true; + } + + public: + /// Create and register test + MultZeroEndpoint() : Base("Float::Arithmetic::MultZeroEndpoint", TestTags::check()) {} + /// Run sign, symmetry, signed-zero, and zero-product cases + bool + run() override { + bool result = true; + result = check(-1.0, 1.0, 0.0, 1.0, 0.5, 1.0, 0.5, 1.0) && result; + result = check(-1.0, 1.0, -1.0, -0.0, 0.5, 1.0, -1.0, -0.5) && result; + result = check(-1.0, 1.0, 0.0, 1.0, -1.0, -0.5, -1.0, -0.5) && result; + result = check(-1.0, 1.0, -1.0, -0.0, -1.0, -0.5, 0.5, 1.0) && result; + + // Swapping the factors must recover the same contraction. + MultSpace swapped(0.0, 1.0, -1.0, 1.0, 0.5, 1.0); + result = (swapped.status() != Gecode::SS_FAILED) && (swapped.y.min() >= 0.5) && result; + + // A zero product gives no sign information about the other factor. + MultSpace zero_product(-1.0, 1.0, 0.0, 1.0, 0.0, 0.0); + result = (zero_product.status() != Gecode::SS_FAILED) && (zero_product.x.min() == -1.0) && + (zero_product.x.max() == 1.0) && result; + MultSpace zero_factor(0.0, 0.0, -1.0, 1.0, 0.0, 0.0); + result = (zero_factor.status() != Gecode::SS_FAILED) && (zero_factor.y.min() == -1.0) && + (zero_factor.y.max() == 1.0) && result; + if (!result) + olog << "Multiplication zero or swapped regression failed" << '\n'; + return fuzz() && result; + } + } mult_zero_endpoint; + + /// %Test for multiplication constraint + class MultXYZ : public Test { + public: + /// Create and register test + MultXYZ(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::Mult::XYZ::" + s, 3, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(x[0] * x[1], x[2]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + if (flip()) + Gecode::mult(home, x[0], x[1], x[2]); + else + Gecode::rel(home, x[0] * x[1] == x[2]); + } + }; + + /// %Test for multiplication constraint when solution is ensured + class MultXYZSol : public Test { + public: + /// Create and register test + MultXYZSol(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags, "Arithmetic::Mult::XYZ::Sol::" + s, 3, d, st, EXTEND_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(x[0] * x[1], x[2]); + } + /// Extend assignment \a x + bool + extend_assignment(Assignment& x) const override { + Gecode::FloatVal d = x[0] * x[1]; + if (Gecode::Float::subset(d, dom)) { + x.set(2, d); + return true; } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - if (flip()) - Gecode::sqrt(home, x[0], x[1]); - else - Gecode::rel(home, sqrt(x[0]) == x[1]); + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::mult(home, x[0], x[1], x[2]); + } + }; + + /// %Test for multiplication constraint with shared variables + class MultXXY : public Test { + public: + /// Create and register test + MultXXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::Mult::XXY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(x[0] * x[0], x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::mult(home, x[0], x[0], x[1]); + } + }; + + /// %Test for multiplication constraint with shared variables when solution is ensured + class MultXXYSol : public Test { + public: + /// Create and register test + MultXXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::Mult::XXY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(x[0] * x[0], x[1]); + } + /// Extend assignment \a x + bool + extend_assignment(Assignment& x) const override { + Gecode::FloatVal d = x[0] * x[0]; + if (Gecode::Float::subset(d, dom)) { + x.set(1, d); + return true; } - }; - - /// %Test for square root constraint where solution is ensured - class SqrtXYSol : public Test { - public: - /// Create and register test - SqrtXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::Sqrt::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - switch (cmp(x[0], Gecode::FRT_GQ, 0.0)) { - case MT_FALSE: - return MT_FALSE; - case MT_MAYBE: - return MT_MAYBE; - default: - return eq(sqrt(x[0]), x[1]); - } + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::mult(home, x[0], x[0], x[1]); + } + }; + + /// %Test for multiplication constraint with shared variables + class MultXYX : public Test { + public: + /// Create and register test + MultXYX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::Mult::XYX::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(x[0] * x[1], x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::mult(home, x[0], x[1], x[0]); + } + }; + + /// %Test for multiplication constraint with shared variables + class MultXYY : public Test { + public: + /// Create and register test + MultXYY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::Mult::XYY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(x[0] * x[1], x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::mult(home, x[0], x[1], x[1]); + } + }; + + /// %Test for multiplication constraint with shared variables + class MultXXX : public Test { + public: + /// Create and register test + MultXXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::Mult::XXX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(x[0] * x[0], x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::mult(home, x[0], x[0], x[0]); + } + }; + + /// %Test for division constraint + class Div : public Test { + public: + /// Create and register test + Div(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags, "Arithmetic::Div::" + s, 3, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(x[0] / x[1], x[2]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + if (flip()) + Gecode::div(home, x[0], x[1], x[2]); + else + Gecode::rel(home, x[0] / x[1] == x[2]); + } + }; + + /// %Test for division constraint when solution is ensured + class DivSol : public Test { + public: + /// Create and register test + DivSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::Div::Sol::" + s, 3, d, st, EXTEND_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(x[0] / x[1], x[2]); + } + /// Extend assignment \a x + bool + extend_assignment(Assignment& x) const override { + Gecode::FloatVal d = x[0] / x[1]; + if (Gecode::Float::subset(d, dom)) { + x.set(2, d); + return true; } - /// Extend assignment \a x - bool - extend_assignment(Assignment& x) const override { - Gecode::FloatVal d = sqrt(abs(x[0])); - if (Gecode::Float::subset(d, dom)) { - x.set(1, d); - return true; - } else { - return false; - } + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::div(home, x[0], x[1], x[2]); + } + }; + + /// %Test for squaring constraint + class SqrXY : public Test { + public: + /// Create and register test + SqrXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::Sqr::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(x[0] * x[0], x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + if (flip()) + Gecode::sqr(home, x[0], x[1]); + else + Gecode::rel(home, sqr(x[0]) == x[1]); + } + }; + + /// %Test for squaring constraint where solution is ensured + class SqrXYSol : public Test { + public: + /// Create and register test + SqrXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::Sqr::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(x[0] * x[0], x[1]); + } + /// Extend assignment \a x + bool + extend_assignment(Assignment& x) const override { + Gecode::FloatVal d = sqr(x[0]); + if (Gecode::Float::subset(d, dom)) { + x.set(1, d); + return true; } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::sqr(home, x[0], x[1]); + } + }; + + /// %Test for squaring constraint with shared variables + class SqrXX : public Test { + public: + /// Create and register test + SqrXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags, "Arithmetic::Sqr::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(x[0] * x[0], x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::sqr(home, x[0], x[0]); + } + }; + + /// %Test for square root constraint + class SqrtXY : public Test { + public: + /// Create and register test + SqrtXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::Sqrt::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + switch (cmp(x[0], Gecode::FRT_GQ, 0.0)) { + case MT_FALSE: + return MT_FALSE; + case MT_MAYBE: + return MT_MAYBE; + default: + return eq(sqrt(x[0]), x[1]); + } + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + if (flip()) Gecode::sqrt(home, x[0], x[1]); + else + Gecode::rel(home, sqrt(x[0]) == x[1]); + } + }; + + /// %Test for square root constraint where solution is ensured + class SqrtXYSol : public Test { + public: + /// Create and register test + SqrtXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::Sqrt::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + switch (cmp(x[0], Gecode::FRT_GQ, 0.0)) { + case MT_FALSE: + return MT_FALSE; + case MT_MAYBE: + return MT_MAYBE; + default: + return eq(sqrt(x[0]), x[1]); + } + } + /// Extend assignment \a x + bool + extend_assignment(Assignment& x) const override { + Gecode::FloatVal d = sqrt(abs(x[0])); + if (Gecode::Float::subset(d, dom)) { + x.set(1, d); + return true; } - }; - - /// %Test for square root constraint with shared variables - class SqrtXX : public Test { - public: - /// Create and register test - SqrtXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(tags, "Arithmetic::Sqrt::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - switch (cmp(x[0], Gecode::FRT_GQ, 0.0)) { - case MT_FALSE: - return MT_FALSE; - case MT_MAYBE: - return MT_MAYBE; - default: - return eq(sqrt(x[0]), x[0]); - } - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::sqrt(home, x[0], x[0]); - } - }; - - /// %Test for pow constraint - class PowXY : public Test { - unsigned int n; - - public: - /// Create and register test - PowXY(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::Pow::N::" + str(_n) + "::XY::" + s, 2, d, st, - COMPLETE_ASSIGNMENT, false), - n(_n) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(pow(x[0], n), x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - if (flip()) - Gecode::pow(home, x[0], n, x[1]); - else - Gecode::rel(home, pow(x[0], n) == x[1]); - } - }; - - /// %Test for pow constraint where solution is ensured - class PowXYSol : public Test { - unsigned int n; - - public: - /// Create and register test - PowXYSol(TestTags tags, const std::string& s, const Gecode::FloatVal& d, unsigned int _n, - Gecode::FloatNum st) - : Test(tags, "Arithmetic::Pow::N::" + str(_n) + "::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false), - n(_n) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(pow(x[0], n), x[1]); - } - /// Extend assignment \a x - bool - extend_assignment(Assignment& x) const override { - Gecode::FloatVal d = pow(x[0], n); - if (Gecode::Float::subset(d, dom)) { - x.set(1, d); - return true; - } else { - return false; - } - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::sqrt(home, x[0], x[1]); + } + }; + + /// %Test for square root constraint with shared variables + class SqrtXX : public Test { + public: + /// Create and register test + SqrtXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags, "Arithmetic::Sqrt::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + switch (cmp(x[0], Gecode::FRT_GQ, 0.0)) { + case MT_FALSE: + return MT_FALSE; + case MT_MAYBE: + return MT_MAYBE; + default: + return eq(sqrt(x[0]), x[0]); + } + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::sqrt(home, x[0], x[0]); + } + }; + + /// %Test for pow constraint + class PowXY : public Test { + unsigned int n; + + public: + /// Create and register test + PowXY(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::Pow::N::" + str(_n) + "::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, + false), + n(_n) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(pow(x[0], n), x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + if (flip()) Gecode::pow(home, x[0], n, x[1]); + else + Gecode::rel(home, pow(x[0], n) == x[1]); + } + }; + + /// %Test for pow constraint where solution is ensured + class PowXYSol : public Test { + unsigned int n; + + public: + /// Create and register test + PowXYSol(TestTags tags, const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st) + : Test(tags, "Arithmetic::Pow::N::" + str(_n) + "::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false), + n(_n) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(pow(x[0], n), x[1]); + } + /// Extend assignment \a x + bool + extend_assignment(Assignment& x) const override { + Gecode::FloatVal d = pow(x[0], n); + if (Gecode::Float::subset(d, dom)) { + x.set(1, d); + return true; } - }; - - /// %Test for pow constraint with shared variables - class PowXX : public Test { - unsigned int n; - - public: - /// Create and register test - PowXX(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::Pow::N::" + str(_n) + "::XX::" + s, 1, d, st, - COMPLETE_ASSIGNMENT, false), - n(_n) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(pow(x[0], n), x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::pow(home, x[0], n, x[0]); - } - }; - - /// %Test for nroot constraint - class NRootXY : public Test { - unsigned int n; - - public: - /// Create and register test - NRootXY(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::NRoot::N::" + str(_n) + "::XY::" + s, 2, d, st, - COMPLETE_ASSIGNMENT, false), - n(_n) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - if ((n == 0) || (x[0].min() < 0.0)) - return MT_FALSE; - return eq(nroot(x[0], n), x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - if (flip()) - Gecode::nroot(home, x[0], n, x[1]); - else - Gecode::rel(home, nroot(x[0], n) == x[1]); - } - }; - - /// %Test for nroot constraint where solution is ensured - class NRootXYSol : public Test { - unsigned int n; - - public: - /// Create and register test - NRootXYSol(TestTags tags, const std::string& s, const Gecode::FloatVal& d, unsigned int _n, - Gecode::FloatNum st) - : Test(tags, "Arithmetic::NRoot::N::" + str(_n) + "::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, - false), - n(_n) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - if ((n == 0) || (x[0].min() < 0.0)) - return MT_FALSE; - return eq(nroot(x[0], n), x[1]); - } - /// Extend assignment \a x - bool - extend_assignment(Assignment& x) const override { - if ((n == 0) || (x[0].min() < 0)) - return false; - Gecode::FloatVal d = nroot(x[0], n); - if (Gecode::Float::subset(d, dom)) { - x.set(1, d); - return true; - } else { - return false; - } - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::pow(home, x[0], n, x[1]); + } + }; + + /// %Test for pow constraint with shared variables + class PowXX : public Test { + unsigned int n; + + public: + /// Create and register test + PowXX(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::Pow::N::" + str(_n) + "::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, + false), + n(_n) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(pow(x[0], n), x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::pow(home, x[0], n, x[0]); + } + }; + + /// %Test for nroot constraint + class NRootXY : public Test { + unsigned int n; + + public: + /// Create and register test + NRootXY(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::NRoot::N::" + str(_n) + "::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, + false), + n(_n) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + if ((n == 0) || (x[0].min() < 0.0)) + return MT_FALSE; + return eq(nroot(x[0], n), x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + if (flip()) Gecode::nroot(home, x[0], n, x[1]); - } - }; - - /// %Test for nroot constraint with shared variables - class NRootXX : public Test { - unsigned int n; - - public: - /// Create and register test - NRootXX(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::NRoot::N::" + str(_n) + "::XX::" + s, 1, d, st, - COMPLETE_ASSIGNMENT, false), - n(_n) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - if ((n == 0) || (x[0].min() < 0)) - return MT_FALSE; - return eq(nroot(x[0], n), x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::nroot(home, x[0], n, x[0]); - } - }; - - /// %Test for absolute value constraint - class AbsXY : public Test { - public: - /// Create and register test - AbsXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::Abs::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(abs(x[0]), x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - if (flip()) - Gecode::abs(home, x[0], x[1]); - else - Gecode::rel(home, abs(x[0]) == x[1]); - } - }; - - /// %Test for absolute value constraint with shared variables - class AbsXX : public Test { - public: - /// Create and register test - AbsXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(tags, "Arithmetic::Abs::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(abs(x[0]), x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::abs(home, x[0], x[0]); - } - }; - - /// %Test for binary minimum constraint - class MinXYZ : public Test { - public: - /// Create and register test - MinXYZ(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(tags, "Arithmetic::Min::Bin::XYZ::" + s, 3, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(min(x[0], x[1]), x[2]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - if (flip()) - Gecode::min(home, x[0], x[1], x[2]); - else - Gecode::rel(home, min(x[0], x[1]) == x[2]); - } - }; - - /// %Test for binary minimum constraint with shared variables - class MinXXY : public Test { - public: - /// Create and register test - MinXXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::Min::Bin::XXY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(min(x[0], x[0]), x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::min(home, x[0], x[0], x[1]); - } - }; - - /// %Test for binary minimum constraint with shared variables - class MinXYX : public Test { - public: - /// Create and register test - MinXYX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::Min::Bin::XYX::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(min(x[0], x[1]), x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::min(home, x[0], x[1], x[0]); - } - }; - - /// %Test for binary minimum constraint with shared variables - class MinXYY : public Test { - public: - /// Create and register test - MinXYY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::Min::Bin::XYY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(min(x[0], x[1]), x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::min(home, x[0], x[1], x[1]); - } - }; - - /// %Test for binary minimum constraint with shared variables - class MinXXX : public Test { - public: - /// Create and register test - MinXXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(tags, "Arithmetic::Min::Bin::XXX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(min(x[0], x[0]), x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::min(home, x[0], x[0], x[0]); - } - }; - - /// %Test for binary maximum constraint - class MaxXYZ : public Test { - public: - /// Create and register test - MaxXYZ(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(tags, "Arithmetic::Max::Bin::XYZ::" + s, 3, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(max(x[0], x[1]), x[2]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - if (flip()) - Gecode::max(home, x[0], x[1], x[2]); - else - Gecode::rel(home, max(x[0], x[1]) == x[2]); - } - }; - - /// %Test for binary maximum constraint with shared variables - class MaxXXY : public Test { - public: - /// Create and register test - MaxXXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::Max::Bin::XXY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(max(x[0], x[0]), x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::max(home, x[0], x[0], x[1]); - } - }; - - /// %Test for binary maximum constraint with shared variables - class MaxXYX : public Test { - public: - /// Create and register test - MaxXYX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::Max::Bin::XYX::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(max(x[0], x[1]), x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::max(home, x[0], x[1], x[0]); - } - }; - - /// %Test for binary maximum constraint with shared variables - class MaxXYY : public Test { - public: - /// Create and register test - MaxXYY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Arithmetic::Max::Bin::XYY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(max(x[0], x[1]), x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::max(home, x[0], x[1], x[1]); - } - }; - - /// %Test for binary maximum constraint with shared variables - class MaxXXX : public Test { - public: - /// Create and register test - MaxXXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(tags, "Arithmetic::Max::Bin::XXX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(max(x[0], x[0]), x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::max(home, x[0], x[0], x[0]); - } - }; - - /// %Test for n-ary minimmum constraint - class MinNary : public Test { - public: - /// Create and register test - MinNary(void) - : Test(TestTags::sweep(), "Arithmetic::Min::Nary", 4, -4, 4, 0.5, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(min(min(x[0], x[1]), x[2]), x[3]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::FloatVarArgs m(3); - m[0] = x[0]; - m[1] = x[1]; - m[2] = x[2]; - if (flip()) - Gecode::min(home, m, x[3]); - else - Gecode::rel(home, min(m) == x[3]); - } - }; - - /// %Test for n-ary minimmum constraint with shared variables - class MinNaryShared : public Test { - public: - /// Create and register test - MinNaryShared(void) - : Test(TestTags::sweep(), "Arithmetic::Min::Nary::Shared", 3, -4, 4, 0.5, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(min(min(x[0], x[1]), x[2]), x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::FloatVarArgs m(3); - m[0] = x[0]; - m[1] = x[1]; - m[2] = x[2]; - Gecode::min(home, m, x[1]); - } - }; - - /// %Test for n-ary maximum constraint - class MaxNary : public Test { - public: - /// Create and register test - MaxNary(void) - : Test(TestTags::sweep(), "Arithmetic::Max::Nary", 4, -4, 4, 0.5, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(max(max(x[0], x[1]), x[2]), x[3]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::FloatVarArgs m(3); - m[0] = x[0]; - m[1] = x[1]; - m[2] = x[2]; - if (flip()) - Gecode::max(home, m, x[3]); - else - Gecode::rel(home, max(m) == x[3]); - } - }; - - /// %Test for n-ary maximum constraint with shared variables - class MaxNaryShared : public Test { - public: - /// Create and register test - MaxNaryShared(void) - : Test(TestTags::sweep(), "Arithmetic::Max::Nary::Shared", 3, -4, 4, 0.5, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(max(max(x[0], x[1]), x[2]), x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::FloatVarArgs m(3); - m[0] = x[0]; - m[1] = x[1]; - m[2] = x[2]; - Gecode::max(home, m, x[1]); - } - }; - - const Gecode::FloatNum step = 0.15; - Gecode::FloatVal a(-8, 5); - Gecode::FloatVal b(9, 12); - Gecode::FloatVal c(-8, 8); - - MultXXY mult_xxy_a("A", a, step); - MultXXY mult_xxy_b("B", b, step); - MultXXY mult_xxy_c("C", c, step); - - MultXXYSol mult_xxy_sol_a("A", a, step); - MultXXYSol mult_xxy_sol_b("B", b, step); - MultXXYSol mult_xxy_sol_c("C", c, step); - - MultXYX mult_xyx_a("A", a, step); - MultXYX mult_xyx_b("B", b, step); - MultXYX mult_xyx_c("C", c, step); - - MultXYY mult_xyy_a("A", a, step); - MultXYY mult_xyy_b("B", b, step); - MultXYY mult_xyy_c("C", c, step); - - MultXXX mult_xxx_a("A", a, step); - MultXXX mult_xxx_b("B", b, step); - MultXXX mult_xxx_c("C", c, step); - - MultXYZ mult_xyz_a("A", a, step); - MultXYZ mult_xyz_b("B", b, step); - MultXYZ mult_xyz_c("C", c, step); - - MultXYZSol mult_xyz_sol_a(TestTags::sweep(), "A", a, step); - MultXYZSol mult_xyz_sol_b(TestTags::sweep(), "B", b, step); - MultXYZSol mult_xyz_sol_c(TestTags::check(), "C", c, step); - - Div div_a(TestTags::standard(), "A", a, step); - Div div_b(TestTags::sweep(), "B", b, step); - Div div_c(TestTags::sweep(), "C", c, step); - - DivSol div_sol_a("A", a, step); - DivSol div_sol_b("B", b, step); - DivSol div_sol_c("C", c, step); - - SqrXY sqr_xy_a("A", a, step); - SqrXY sqr_xy_b("B", b, step); - SqrXY sqr_xy_c("C", c, step); - - SqrXYSol sqr_xy_sol_a("A", a, step); - SqrXYSol sqr_xy_sol_b("B", b, step); - SqrXYSol sqr_xy_sol_c("C", c, step); - - SqrXX sqr_xx_a(TestTags::standard(), "A", a, step); - SqrXX sqr_xx_b(TestTags::sweep(), "B", b, step); - SqrXX sqr_xx_c(TestTags::sweep(), "C", c, step); - - SqrtXY sqrt_xy_a("A", a, step); - SqrtXY sqrt_xy_b("B", b, step); - SqrtXY sqrt_xy_c("C", c, step); - - SqrtXYSol sqrt_xy_sol_a("A", a, step); - SqrtXYSol sqrt_xy_sol_b("B", b, step); - SqrtXYSol sqrt_xy_sol_c("C", c, step); - - SqrtXX sqrt_xx_a(TestTags::standard(), "A", a, step); - SqrtXX sqrt_xx_b(TestTags::sweep(), "B", b, step); - SqrtXX sqrt_xx_c(TestTags::sweep(), "C", c, step); - - PowXY pow_xy_a_1("A", a, 2, step); - PowXY pow_xy_b_1("B", b, 2, step); - PowXY pow_xy_c_1("C", c, 2, step); - - PowXYSol pow_xy_sol_a_1(TestTags::sweep(), "A", a, 2, step); - PowXYSol pow_xy_sol_b_1(TestTags::sweep(), "B", b, 2, step); - PowXYSol pow_xy_sol_c_1(TestTags::check(), "C", c, 2, step); - - PowXX pow_xx_a_1("A", a, 2, step); - PowXX pow_xx_b_1("B", b, 2, step); - PowXX pow_xx_c_1("C", c, 2, step); - - PowXY pow_xy_a_2("A", a, 3, step); - PowXY pow_xy_b_2("B", b, 3, step); - PowXY pow_xy_c_2("C", c, 3, step); - - PowXYSol pow_xy_sol_a_2(TestTags::sweep(), "A", a, 3, step); - PowXYSol pow_xy_sol_b_2(TestTags::sweep(), "B", b, 3, step); - PowXYSol pow_xy_sol_c_2(TestTags::sweep(), "C", c, 3, step); - - PowXX pow_xx_a_2("A", a, 3, step); - PowXX pow_xx_b_2("B", b, 3, step); - PowXX pow_xx_c_2("C", c, 3, step); - - PowXY pow_xy_a_3("A", a, 0, step); - PowXY pow_xy_b_3("B", b, 0, step); - PowXY pow_xy_c_3("C", c, 0, step); - - PowXYSol pow_xy_sol_a_3(TestTags::sweep(), "A", a, 0, step); - PowXYSol pow_xy_sol_b_3(TestTags::sweep(), "B", b, 0, step); - PowXYSol pow_xy_sol_c_3(TestTags::sweep(), "C", c, 0, step); - - PowXX pow_xx_a_3("A", a, 0, step); - PowXX pow_xx_b_3("B", b, 0, step); - PowXX pow_xx_c_3("C", c, 0, step); - - NRootXY nroot_xy_a_1("A", a, 2, step); - NRootXY nroot_xy_b_1("B", b, 2, step); - NRootXY nroot_xy_c_1("C", c, 2, step); - - NRootXYSol nroot_xy_sol_a_1(TestTags::sweep(), "A", a, 2, step); - NRootXYSol nroot_xy_sol_b_1(TestTags::sweep(), "B", b, 2, step); - NRootXYSol nroot_xy_sol_c_1(TestTags::check(), "C", c, 2, step); - - NRootXX nroot_xx_a_1("A", a, 2, step); - NRootXX nroot_xx_b_1("B", b, 2, step); - NRootXX nroot_xx_c_1("C", c, 2, step); - - NRootXY nroot_xy_a_2("A", a, 3, step); - NRootXY nroot_xy_b_2("B", b, 3, step); - NRootXY nroot_xy_c_2("C", c, 3, step); - - NRootXYSol nroot_xy_sol_a_2(TestTags::sweep(), "A", a, 3, step); - NRootXYSol nroot_xy_sol_b_2(TestTags::sweep(), "B", b, 3, step); - NRootXYSol nroot_xy_sol_c_2(TestTags::sweep(), "C", c, 3, step); - - NRootXX nroot_xx_a_2("A", a, 3, step); - NRootXX nroot_xx_b_2("B", b, 3, step); - NRootXX nroot_xx_c_2("C", c, 3, step); - - NRootXY nroot_xy_a_3("A", a, 0, step); - NRootXY nroot_xy_b_3("B", b, 0, step); - NRootXY nroot_xy_c_3("C", c, 0, step); - - NRootXYSol nroot_xy_sol_a_3(TestTags::sweep(), "A", a, 0, step); - NRootXYSol nroot_xy_sol_b_3(TestTags::sweep(), "B", b, 0, step); - NRootXYSol nroot_xy_sol_c_3(TestTags::sweep(), "C", c, 0, step); - - NRootXX nroot_xx_a_3("A", a, 0, step); - NRootXX nroot_xx_b_3("B", b, 0, step); - NRootXX nroot_xx_c_3("C", c, 0, step); - - AbsXY abs_xy_a("A", a, step); - AbsXY abs_xy_b("B", b, step); - AbsXY abs_xy_c("C", c, step); - - AbsXX abs_xx_a(TestTags::standard(), "A", a, step); - AbsXX abs_xx_b(TestTags::sweep(), "B", b, step); - AbsXX abs_xx_c(TestTags::sweep(), "C", c, step); - - MinXYZ min_xyz_normal(TestTags::standard(), "Normal", Gecode::FloatVal(-1, 1), 1.0); - - MinXYZ min_xyz_a(TestTags::sweep(), "A", a, step); - MinXYZ min_xyz_b(TestTags::sweep(), "B", b, step); - MinXYZ min_xyz_c(TestTags::sweep(), "C", c, step); - - MinXXY min_xxy_a("A", a, step); - MinXXY min_xxy_b("B", b, step); - MinXXY min_xxy_c("C", c, step); - - MinXYX min_xyx_a("A", a, step); - MinXYX min_xyx_b("B", b, step); - MinXYX min_xyx_c("C", c, step); - - MinXYY min_xyy_a("A", a, step); - MinXYY min_xyy_b("B", b, step); - MinXYY min_xyy_c("C", c, step); - - MinXXX min_xxx_a(TestTags::standard(), "A", a, step); - MinXXX min_xxx_b(TestTags::sweep(), "B", b, step); - MinXXX min_xxx_c(TestTags::sweep(), "C", c, step); - - MaxXYZ max_xyz_normal(TestTags::standard(), "Normal", Gecode::FloatVal(-1, 1), 1.0); - - MaxXYZ max_xyz_a(TestTags::sweep(), "A", a, step); - MaxXYZ max_xyz_b(TestTags::sweep(), "B", b, step); - MaxXYZ max_xyz_c(TestTags::sweep(), "C", c, step); - - MaxXXY max_xxy_a("A", a, step); - MaxXXY max_xxy_b("B", b, step); - MaxXXY max_xxy_c("C", c, step); - - MaxXYX max_xyx_a("A", a, step); - MaxXYX max_xyx_b("B", b, step); - MaxXYX max_xyx_c("C", c, step); - - MaxXYY max_xyy_a("A", a, step); - MaxXYY max_xyy_b("B", b, step); - MaxXYY max_xyy_c("C", c, step); - - MaxXXX max_xxx_a(TestTags::standard(), "A", a, step); - MaxXXX max_xxx_b(TestTags::sweep(), "B", b, step); - MaxXXX max_xxx_c(TestTags::sweep(), "C", c, step); - - MinNary min_nary; - MinNaryShared min_s_nary; - MaxNary max_nary; - MaxNaryShared max_s_nary; - - /// Space without variables for minimum and maximum over no variables - class EmptyFixture : public Gecode::Space { - public: - /// Create fixture - EmptyFixture(void) = default; - /// Constructor for cloning \a fixture - // NOLINTNEXTLINE(modernize-use-equals-default) - EmptyFixture(EmptyFixture& fixture) : Gecode::Space(fixture) {} - /// Copy during cloning - Gecode::Space* - copy(void) override { - return new EmptyFixture(*this); - } - }; - - /// %Test that minimum and maximum expressions over no variables throw at posting - class MinMaxEmpty : public Base { - public: - /// Create and register test - MinMaxEmpty(void) : Base("Float::Arithmetic::MinMax::Empty") {} - /// Test whether posting \a e throws TooFewArguments - static bool - throws_too_few(const Gecode::LinFloatExpr& e) { - EmptyFixture home; - try { - (void)Gecode::expr(home, e); - } catch (Gecode::Float::TooFewArguments&) { - return true; - } + else + Gecode::rel(home, nroot(x[0], n) == x[1]); + } + }; + + /// %Test for nroot constraint where solution is ensured + class NRootXYSol : public Test { + unsigned int n; + + public: + /// Create and register test + NRootXYSol(TestTags tags, const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st) + : Test(tags, "Arithmetic::NRoot::N::" + str(_n) + "::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false), + n(_n) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + if ((n == 0) || (x[0].min() < 0.0)) + return MT_FALSE; + return eq(nroot(x[0], n), x[1]); + } + /// Extend assignment \a x + bool + extend_assignment(Assignment& x) const override { + if ((n == 0) || (x[0].min() < 0)) return false; + Gecode::FloatVal d = nroot(x[0], n); + if (Gecode::Float::subset(d, dom)) { + x.set(1, d); + return true; } - /// Perform test - bool - run(void) override { - Gecode::FloatVarArgs x; - return throws_too_few(Gecode::min(x)) && throws_too_few(Gecode::max(x)); - } - }; - MinMaxEmpty min_max_empty; - //@} + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::nroot(home, x[0], n, x[1]); + } + }; + + /// %Test for nroot constraint with shared variables + class NRootXX : public Test { + unsigned int n; + + public: + /// Create and register test + NRootXX(const std::string& s, const Gecode::FloatVal& d, unsigned int _n, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::NRoot::N::" + str(_n) + "::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, + false), + n(_n) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + if ((n == 0) || (x[0].min() < 0)) + return MT_FALSE; + return eq(nroot(x[0], n), x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::nroot(home, x[0], n, x[0]); + } + }; + + /// %Test for absolute value constraint + class AbsXY : public Test { + public: + /// Create and register test + AbsXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::Abs::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(abs(x[0]), x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + if (flip()) + Gecode::abs(home, x[0], x[1]); + else + Gecode::rel(home, abs(x[0]) == x[1]); + } + }; + + /// %Test for absolute value constraint with shared variables + class AbsXX : public Test { + public: + /// Create and register test + AbsXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags, "Arithmetic::Abs::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(abs(x[0]), x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::abs(home, x[0], x[0]); + } + }; + + /// %Test for binary minimum constraint + class MinXYZ : public Test { + public: + /// Create and register test + MinXYZ(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags, "Arithmetic::Min::Bin::XYZ::" + s, 3, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(min(x[0], x[1]), x[2]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + if (flip()) + Gecode::min(home, x[0], x[1], x[2]); + else + Gecode::rel(home, min(x[0], x[1]) == x[2]); + } + }; + + /// %Test for binary minimum constraint with shared variables + class MinXXY : public Test { + public: + /// Create and register test + MinXXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::Min::Bin::XXY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(min(x[0], x[0]), x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::min(home, x[0], x[0], x[1]); + } + }; + + /// %Test for binary minimum constraint with shared variables + class MinXYX : public Test { + public: + /// Create and register test + MinXYX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::Min::Bin::XYX::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(min(x[0], x[1]), x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::min(home, x[0], x[1], x[0]); + } + }; + + /// %Test for binary minimum constraint with shared variables + class MinXYY : public Test { + public: + /// Create and register test + MinXYY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::Min::Bin::XYY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(min(x[0], x[1]), x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::min(home, x[0], x[1], x[1]); + } + }; + + /// %Test for binary minimum constraint with shared variables + class MinXXX : public Test { + public: + /// Create and register test + MinXXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags, "Arithmetic::Min::Bin::XXX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(min(x[0], x[0]), x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::min(home, x[0], x[0], x[0]); + } + }; + + /// %Test for binary maximum constraint + class MaxXYZ : public Test { + public: + /// Create and register test + MaxXYZ(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags, "Arithmetic::Max::Bin::XYZ::" + s, 3, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(max(x[0], x[1]), x[2]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + if (flip()) + Gecode::max(home, x[0], x[1], x[2]); + else + Gecode::rel(home, max(x[0], x[1]) == x[2]); + } + }; + + /// %Test for binary maximum constraint with shared variables + class MaxXXY : public Test { + public: + /// Create and register test + MaxXXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::Max::Bin::XXY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(max(x[0], x[0]), x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::max(home, x[0], x[0], x[1]); + } + }; + + /// %Test for binary maximum constraint with shared variables + class MaxXYX : public Test { + public: + /// Create and register test + MaxXYX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::Max::Bin::XYX::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(max(x[0], x[1]), x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::max(home, x[0], x[1], x[0]); + } + }; + + /// %Test for binary maximum constraint with shared variables + class MaxXYY : public Test { + public: + /// Create and register test + MaxXYY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Arithmetic::Max::Bin::XYY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(max(x[0], x[1]), x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::max(home, x[0], x[1], x[1]); + } + }; + + /// %Test for binary maximum constraint with shared variables + class MaxXXX : public Test { + public: + /// Create and register test + MaxXXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags, "Arithmetic::Max::Bin::XXX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(max(x[0], x[0]), x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::max(home, x[0], x[0], x[0]); + } + }; + + /// %Test for n-ary minimmum constraint + class MinNary : public Test { + public: + /// Create and register test + MinNary() : Test(TestTags::sweep(), "Arithmetic::Min::Nary", 4, -4, 4, 0.5, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(min(min(x[0], x[1]), x[2]), x[3]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::FloatVarArgs m(3); + m[0] = x[0]; + m[1] = x[1]; + m[2] = x[2]; + if (flip()) + Gecode::min(home, m, x[3]); + else + Gecode::rel(home, min(m) == x[3]); + } + }; + + /// %Test for n-ary minimmum constraint with shared variables + class MinNaryShared : public Test { + public: + /// Create and register test + MinNaryShared() + : Test(TestTags::sweep(), "Arithmetic::Min::Nary::Shared", 3, -4, 4, 0.5, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(min(min(x[0], x[1]), x[2]), x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::FloatVarArgs m(3); + m[0] = x[0]; + m[1] = x[1]; + m[2] = x[2]; + Gecode::min(home, m, x[1]); + } + }; + + /// %Test for n-ary maximum constraint + class MaxNary : public Test { + public: + /// Create and register test + MaxNary() : Test(TestTags::sweep(), "Arithmetic::Max::Nary", 4, -4, 4, 0.5, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(max(max(x[0], x[1]), x[2]), x[3]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::FloatVarArgs m(3); + m[0] = x[0]; + m[1] = x[1]; + m[2] = x[2]; + if (flip()) + Gecode::max(home, m, x[3]); + else + Gecode::rel(home, max(m) == x[3]); + } + }; + + /// %Test for n-ary maximum constraint with shared variables + class MaxNaryShared : public Test { + public: + /// Create and register test + MaxNaryShared() + : Test(TestTags::sweep(), "Arithmetic::Max::Nary::Shared", 3, -4, 4, 0.5, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(max(max(x[0], x[1]), x[2]), x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::FloatVarArgs m(3); + m[0] = x[0]; + m[1] = x[1]; + m[2] = x[2]; + Gecode::max(home, m, x[1]); + } + }; + + const Gecode::FloatNum step = 0.15; + Gecode::FloatVal a(-8, 5); + Gecode::FloatVal b(9, 12); + Gecode::FloatVal c(-8, 8); + + MultXXY mult_xxy_a("A", a, step); + MultXXY mult_xxy_b("B", b, step); + MultXXY mult_xxy_c("C", c, step); + + MultXXYSol mult_xxy_sol_a("A", a, step); + MultXXYSol mult_xxy_sol_b("B", b, step); + MultXXYSol mult_xxy_sol_c("C", c, step); + + MultXYX mult_xyx_a("A", a, step); + MultXYX mult_xyx_b("B", b, step); + MultXYX mult_xyx_c("C", c, step); + + MultXYY mult_xyy_a("A", a, step); + MultXYY mult_xyy_b("B", b, step); + MultXYY mult_xyy_c("C", c, step); + + MultXXX mult_xxx_a("A", a, step); + MultXXX mult_xxx_b("B", b, step); + MultXXX mult_xxx_c("C", c, step); + + MultXYZ mult_xyz_a("A", a, step); + MultXYZ mult_xyz_b("B", b, step); + MultXYZ mult_xyz_c("C", c, step); + + MultXYZSol mult_xyz_sol_a(TestTags::sweep(), "A", a, step); + MultXYZSol mult_xyz_sol_b(TestTags::sweep(), "B", b, step); + MultXYZSol mult_xyz_sol_c(TestTags::check(), "C", c, step); + + Div div_a(TestTags::standard(), "A", a, step); + Div div_b(TestTags::sweep(), "B", b, step); + Div div_c(TestTags::sweep(), "C", c, step); + + DivSol div_sol_a("A", a, step); + DivSol div_sol_b("B", b, step); + DivSol div_sol_c("C", c, step); + + SqrXY sqr_xy_a("A", a, step); + SqrXY sqr_xy_b("B", b, step); + SqrXY sqr_xy_c("C", c, step); + + SqrXYSol sqr_xy_sol_a("A", a, step); + SqrXYSol sqr_xy_sol_b("B", b, step); + SqrXYSol sqr_xy_sol_c("C", c, step); + + SqrXX sqr_xx_a(TestTags::standard(), "A", a, step); + SqrXX sqr_xx_b(TestTags::sweep(), "B", b, step); + SqrXX sqr_xx_c(TestTags::sweep(), "C", c, step); + + SqrtXY sqrt_xy_a("A", a, step); + SqrtXY sqrt_xy_b("B", b, step); + SqrtXY sqrt_xy_c("C", c, step); + + SqrtXYSol sqrt_xy_sol_a("A", a, step); + SqrtXYSol sqrt_xy_sol_b("B", b, step); + SqrtXYSol sqrt_xy_sol_c("C", c, step); + + SqrtXX sqrt_xx_a(TestTags::standard(), "A", a, step); + SqrtXX sqrt_xx_b(TestTags::sweep(), "B", b, step); + SqrtXX sqrt_xx_c(TestTags::sweep(), "C", c, step); + + PowXY pow_xy_a_1("A", a, 2, step); + PowXY pow_xy_b_1("B", b, 2, step); + PowXY pow_xy_c_1("C", c, 2, step); + + PowXYSol pow_xy_sol_a_1(TestTags::sweep(), "A", a, 2, step); + PowXYSol pow_xy_sol_b_1(TestTags::sweep(), "B", b, 2, step); + PowXYSol pow_xy_sol_c_1(TestTags::check(), "C", c, 2, step); + + PowXX pow_xx_a_1("A", a, 2, step); + PowXX pow_xx_b_1("B", b, 2, step); + PowXX pow_xx_c_1("C", c, 2, step); + + PowXY pow_xy_a_2("A", a, 3, step); + PowXY pow_xy_b_2("B", b, 3, step); + PowXY pow_xy_c_2("C", c, 3, step); + + PowXYSol pow_xy_sol_a_2(TestTags::sweep(), "A", a, 3, step); + PowXYSol pow_xy_sol_b_2(TestTags::sweep(), "B", b, 3, step); + PowXYSol pow_xy_sol_c_2(TestTags::sweep(), "C", c, 3, step); + + PowXX pow_xx_a_2("A", a, 3, step); + PowXX pow_xx_b_2("B", b, 3, step); + PowXX pow_xx_c_2("C", c, 3, step); + + PowXY pow_xy_a_3("A", a, 0, step); + PowXY pow_xy_b_3("B", b, 0, step); + PowXY pow_xy_c_3("C", c, 0, step); + + PowXYSol pow_xy_sol_a_3(TestTags::sweep(), "A", a, 0, step); + PowXYSol pow_xy_sol_b_3(TestTags::sweep(), "B", b, 0, step); + PowXYSol pow_xy_sol_c_3(TestTags::sweep(), "C", c, 0, step); - } // namespace Arithmetic -}} // namespace Test::Float + PowXX pow_xx_a_3("A", a, 0, step); + PowXX pow_xx_b_3("B", b, 0, step); + PowXX pow_xx_c_3("C", c, 0, step); + + NRootXY nroot_xy_a_1("A", a, 2, step); + NRootXY nroot_xy_b_1("B", b, 2, step); + NRootXY nroot_xy_c_1("C", c, 2, step); + + NRootXYSol nroot_xy_sol_a_1(TestTags::sweep(), "A", a, 2, step); + NRootXYSol nroot_xy_sol_b_1(TestTags::sweep(), "B", b, 2, step); + NRootXYSol nroot_xy_sol_c_1(TestTags::check(), "C", c, 2, step); + + NRootXX nroot_xx_a_1("A", a, 2, step); + NRootXX nroot_xx_b_1("B", b, 2, step); + NRootXX nroot_xx_c_1("C", c, 2, step); + + NRootXY nroot_xy_a_2("A", a, 3, step); + NRootXY nroot_xy_b_2("B", b, 3, step); + NRootXY nroot_xy_c_2("C", c, 3, step); + + NRootXYSol nroot_xy_sol_a_2(TestTags::sweep(), "A", a, 3, step); + NRootXYSol nroot_xy_sol_b_2(TestTags::sweep(), "B", b, 3, step); + NRootXYSol nroot_xy_sol_c_2(TestTags::sweep(), "C", c, 3, step); + + NRootXX nroot_xx_a_2("A", a, 3, step); + NRootXX nroot_xx_b_2("B", b, 3, step); + NRootXX nroot_xx_c_2("C", c, 3, step); + + NRootXY nroot_xy_a_3("A", a, 0, step); + NRootXY nroot_xy_b_3("B", b, 0, step); + NRootXY nroot_xy_c_3("C", c, 0, step); + + NRootXYSol nroot_xy_sol_a_3(TestTags::sweep(), "A", a, 0, step); + NRootXYSol nroot_xy_sol_b_3(TestTags::sweep(), "B", b, 0, step); + NRootXYSol nroot_xy_sol_c_3(TestTags::sweep(), "C", c, 0, step); + + NRootXX nroot_xx_a_3("A", a, 0, step); + NRootXX nroot_xx_b_3("B", b, 0, step); + NRootXX nroot_xx_c_3("C", c, 0, step); + + AbsXY abs_xy_a("A", a, step); + AbsXY abs_xy_b("B", b, step); + AbsXY abs_xy_c("C", c, step); + + AbsXX abs_xx_a(TestTags::standard(), "A", a, step); + AbsXX abs_xx_b(TestTags::sweep(), "B", b, step); + AbsXX abs_xx_c(TestTags::sweep(), "C", c, step); + + MinXYZ min_xyz_normal(TestTags::standard(), "Normal", Gecode::FloatVal(-1, 1), 1.0); + + MinXYZ min_xyz_a(TestTags::sweep(), "A", a, step); + MinXYZ min_xyz_b(TestTags::sweep(), "B", b, step); + MinXYZ min_xyz_c(TestTags::sweep(), "C", c, step); + + MinXXY min_xxy_a("A", a, step); + MinXXY min_xxy_b("B", b, step); + MinXXY min_xxy_c("C", c, step); + + MinXYX min_xyx_a("A", a, step); + MinXYX min_xyx_b("B", b, step); + MinXYX min_xyx_c("C", c, step); + + MinXYY min_xyy_a("A", a, step); + MinXYY min_xyy_b("B", b, step); + MinXYY min_xyy_c("C", c, step); + + MinXXX min_xxx_a(TestTags::standard(), "A", a, step); + MinXXX min_xxx_b(TestTags::sweep(), "B", b, step); + MinXXX min_xxx_c(TestTags::sweep(), "C", c, step); + + MaxXYZ max_xyz_normal(TestTags::standard(), "Normal", Gecode::FloatVal(-1, 1), 1.0); + + MaxXYZ max_xyz_a(TestTags::sweep(), "A", a, step); + MaxXYZ max_xyz_b(TestTags::sweep(), "B", b, step); + MaxXYZ max_xyz_c(TestTags::sweep(), "C", c, step); + + MaxXXY max_xxy_a("A", a, step); + MaxXXY max_xxy_b("B", b, step); + MaxXXY max_xxy_c("C", c, step); + + MaxXYX max_xyx_a("A", a, step); + MaxXYX max_xyx_b("B", b, step); + MaxXYX max_xyx_c("C", c, step); + + MaxXYY max_xyy_a("A", a, step); + MaxXYY max_xyy_b("B", b, step); + MaxXYY max_xyy_c("C", c, step); + + MaxXXX max_xxx_a(TestTags::standard(), "A", a, step); + MaxXXX max_xxx_b(TestTags::sweep(), "B", b, step); + MaxXXX max_xxx_c(TestTags::sweep(), "C", c, step); + + MinNary min_nary; + MinNaryShared min_s_nary; + MaxNary max_nary; + MaxNaryShared max_s_nary; + + /// Space without variables for minimum and maximum over no variables + class EmptyFixture : public Gecode::Space { + public: + /// Create fixture + EmptyFixture() = default; + /// Constructor for cloning \a fixture + // NOLINTNEXTLINE(modernize-use-equals-default) + EmptyFixture(EmptyFixture& fixture) : Gecode::Space(fixture) {} + /// Copy during cloning + Gecode::Space* + copy() override { + return new EmptyFixture(*this); + } + }; + + /// %Test that minimum and maximum expressions over no variables throw at posting + class MinMaxEmpty : public Base { + public: + /// Create and register test + MinMaxEmpty() : Base("Float::Arithmetic::MinMax::Empty") {} + /// Test whether posting \a e throws TooFewArguments + static bool + throws_too_few(const Gecode::LinFloatExpr& e) { + EmptyFixture home; + try { + (void)Gecode::expr(home, e); + } catch (Gecode::Float::TooFewArguments&) { + return true; + } + return false; + } + /// Perform test + bool + run() override { + Gecode::FloatVarArgs x; + return throws_too_few(Gecode::min(x)) && throws_too_few(Gecode::max(x)); + } + }; + MinMaxEmpty min_max_empty; + //@} + +} // namespace Test::Float::Arithmetic +// namespace Test::Float // STATISTICS: test-float diff --git a/test/float/basic.cpp b/test/float/basic.cpp index 84aa06e3e4..72e90cbc8a 100644 --- a/test/float/basic.cpp +++ b/test/float/basic.cpp @@ -39,185 +39,183 @@ #include #include -namespace Test { namespace Float { - - /// %Tests for basic setup - namespace Basic { - - /** - * \defgroup TaskTestFloatBasic Basic setup - * \ingroup TaskTestFloat - */ - //@{ - - /// %Test whether testing infrastructure for float variables works - class Basic : public Test { - public: - /// Initialize test - Basic(Gecode::FloatNum n, Gecode::FloatNum s) : Test("Basic", 3, -n, n, s, COMPLETE_ASSIGNMENT, false) {} - /// Initialize test - Basic(const Gecode::FloatVal& v, Gecode::FloatNum s) : Test("Basic", 3, v, s, COMPLETE_ASSIGNMENT, false) {} - /// Check whether \a x is a solution - MaybeType - solution(const Assignment&) const override { - return MT_TRUE; - } - /// Post constraint on \a x - void - post(Gecode::Space&, Gecode::FloatVarArray&) override {} - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space&, Gecode::FloatVarArray&, Gecode::Reify) override { - // Reification for no constraint is not interesting - GECODE_NEVER; - } - }; - - namespace { - Basic b1(3, 1.5); - Basic b2(Gecode::FloatVal(-2, 10), 1.5); - } // namespace - - /// Test interval medians at the numerical limits and special values - class Median : public Base { - private: - /// Test median inclusion and splitting of non-tight intervals - static bool - valid(const Gecode::FloatVal& x) { - const Gecode::FloatNum m = x.med(); - return (m >= x.min()) && (m <= x.max()) && (x.tight() || ((m > x.min()) && (m < x.max()))); - } - - public: - /// Create and register test - Median(void) : Base("Float::Basic::Median") {} - /// Perform test - bool - run(void) override { - using namespace Gecode; - const FloatNum m = Gecode::Float::Limits::max; - const FloatNum i = std::numeric_limits::infinity(); - const FloatNum d = std::numeric_limits::denorm_min(); - const FloatVal negative(-m, -m / 2.0); - const FloatVal positive(m / 2.0, m); - const FloatVal mixed(-m, m); - // The subtraction-based formula rounds this median one ULP upward. - const FloatVal closest(3.07187504409887e-53, 7.805365587017815e-45); - return valid(negative) && valid(positive) && valid(mixed) && (closest.med() == 3.902682808868283e-45) && - (FloatVal(-i, -1.0).med() == -i) && (FloatVal(1.0, i).med() == i) && - (FloatVal(-i, i).med() == 0.0) && (FloatVal(-i, -i).med() == -i) && - (FloatVal(i, i).med() == i) && !std::signbit(FloatVal(-0.0, 0.0).med()) && - (FloatVal(0.0, 2.0 * d).med() == d) && (FloatVal(-2.0 * d, 0.0).med() == -d); - } - }; +/// %Tests for basic setup +namespace Test::Float::Basic { + + /** + * \defgroup TaskTestFloatBasic Basic setup + * \ingroup TaskTestFloat + */ + //@{ + + /// %Test whether testing infrastructure for float variables works + class Basic : public Test { + public: + /// Initialize test + Basic(Gecode::FloatNum n, Gecode::FloatNum s) : Test("Basic", 3, -n, n, s, COMPLETE_ASSIGNMENT, false) {} + /// Initialize test + Basic(const Gecode::FloatVal& v, Gecode::FloatNum s) : Test("Basic", 3, v, s, COMPLETE_ASSIGNMENT, false) {} + /// Check whether \a x is a solution + MaybeType + solution(const Assignment&) const override { + return MT_TRUE; + } + /// Post constraint on \a x + void + post(Gecode::Space&, Gecode::FloatVarArray&) override {} + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space&, Gecode::FloatVarArray&, Gecode::Reify) override { + // Reification for no constraint is not interesting + GECODE_NEVER; + } + }; + + namespace { + Basic b1(3, 1.5); + Basic b2(Gecode::FloatVal(-2, 10), 1.5); + } // namespace + + /// Test interval medians at the numerical limits and special values + class Median : public Base { + private: + /// Test median inclusion and splitting of non-tight intervals + static bool + valid(const Gecode::FloatVal& x) { + const Gecode::FloatNum m = x.med(); + return (m >= x.min()) && (m <= x.max()) && (x.tight() || ((m > x.min()) && (m < x.max()))); + } - namespace { - Median median; + public: + /// Create and register test + Median() : Base("Float::Basic::Median") {} + /// Perform test + bool + run() override { + using namespace Gecode; + const FloatNum m = Gecode::Float::Limits::max; + const FloatNum i = std::numeric_limits::infinity(); + const FloatNum d = std::numeric_limits::denorm_min(); + const FloatVal negative(-m, -m / 2.0); + const FloatVal positive(m / 2.0, m); + const FloatVal mixed(-m, m); + // The subtraction-based formula rounds this median one ULP upward. + const FloatVal closest(3.07187504409887e-53, 7.805365587017815e-45); + return valid(negative) && valid(positive) && valid(mixed) && (closest.med() == 3.902682808868283e-45) && + (FloatVal(-i, -1.0).med() == -i) && (FloatVal(1.0, i).med() == i) && + (FloatVal(-i, i).med() == 0.0) && (FloatVal(-i, -i).med() == -i) && (FloatVal(i, i).med() == i) && + !std::signbit(FloatVal(-0.0, 0.0).med()) && (FloatVal(0.0, 2.0 * d).med() == d) && + (FloatVal(-2.0 * d, 0.0).med() == -d); + } + }; + + namespace { + Median median; + } + + /// Space minimizing or maximizing a single float variable + template + class OptimizeSpace : public Optimize { + public: + /// The cost variable + Gecode::FloatVar x; + /// Create space with cost variable in [0,1] + OptimizeSpace() : x(*this, 0.0, 1.0) {} + /// Constructor for cloning \a s + OptimizeSpace(OptimizeSpace& s) : Optimize(s) { + x.update(*this, s.x); } + /// Copy during cloning + Gecode::Space* + copy() override { + return new OptimizeSpace(*this); + } + /// Return cost + Gecode::FloatVar + cost() const override { + return x; + } + }; - /// Space minimizing or maximizing a single float variable + /// Test that the MiniModel float cuts prune the incumbent value + class OptimizeCut : public Base { + private: + /// Return whether constraining by an incumbent with cost 0.5 leaves + /// an unassigned cost and store its remaining domain in \a d template - class OptimizeSpace : public Optimize { - public: - /// The cost variable - Gecode::FloatVar x; - /// Create space with cost variable in [0,1] - OptimizeSpace(void) : x(*this, 0.0, 1.0) {} - /// Constructor for cloning \a s - OptimizeSpace(OptimizeSpace& s) : Optimize(s) { - x.update(*this, s.x); - } - /// Copy during cloning - Gecode::Space* - copy(void) override { - return new OptimizeSpace(*this); - } - /// Return cost - Gecode::FloatVar - cost(void) const override { - return x; - } - }; + static bool + cut(Gecode::FloatVal& d) { + using namespace Gecode; + OptimizeSpace root; + std::unique_ptr> best(static_cast*>(root.clone())); + rel(*best, best->x, FRT_EQ, 0.5); + if (best->status() == SS_FAILED) + return false; + std::unique_ptr> s(static_cast*>(root.clone())); + s->constrain(*best); + if ((s->status() == SS_FAILED) || s->x.assigned()) + return false; + d = s->x.domain(); + return true; + } - /// Test that the MiniModel float cuts prune the incumbent value - class OptimizeCut : public Base { - private: - /// Return whether constraining by an incumbent with cost 0.5 leaves - /// an unassigned cost and store its remaining domain in \a d - template - static bool - cut(Gecode::FloatVal& d) { - using namespace Gecode; - OptimizeSpace root; - std::unique_ptr> best(static_cast*>(root.clone())); - rel(*best, best->x, FRT_EQ, 0.5); - if (best->status() == SS_FAILED) - return false; - std::unique_ptr> s(static_cast*>(root.clone())); - s->constrain(*best); - if ((s->status() == SS_FAILED) || s->x.assigned()) - return false; - d = s->x.domain(); - return true; - } + public: + /// Create and register test + OptimizeCut() : Base("Float::Basic::OptimizeCut") {} + /// Perform test + bool + run() override { + using namespace Gecode; + FloatVal min, max; + return cut(min) && cut(max) && (min.max() < 0.5) && + (max.min() > 0.5); + } + }; + /// Test comparing float views + class ViewCompare : public Base { + private: + /// Space for the variables behind the views + class Fixture : public Gecode::Space { public: - /// Create and register test - OptimizeCut(void) : Base("Float::Basic::OptimizeCut") {} - /// Perform test - bool - run(void) override { - using namespace Gecode; - FloatVal min, max; - return cut(min) && cut(max) && (min.max() < 0.5) && - (max.min() > 0.5); + Fixture() = default; + // NOLINTNEXTLINE(modernize-use-equals-default) + Fixture(Fixture& fixture) : Gecode::Space(fixture) {} + Gecode::Space* + copy() override { + return new Fixture(*this); } }; - /// Test comparing float views - class ViewCompare : public Base { - private: - /// Space for the variables behind the views - class Fixture : public Gecode::Space { - public: - Fixture(void) = default; - // NOLINTNEXTLINE(modernize-use-equals-default) - Fixture(Fixture& fixture) : Gecode::Space(fixture) {} - Gecode::Space* - copy(void) override { - return new Fixture(*this); - } - }; - - public: - /// Create and register test - ViewCompare(void) : Base("Float::Basic::View::Compare") {} - /// Perform test - bool - run(void) override { - using namespace Gecode; - using namespace Gecode::Float; - Fixture home; - FloatView x(FloatVar(home, 0.0, 1.0)); - FloatView y(FloatVar(home, 0.0, 1.0)); - MinusView mx(x); - return compares_equal(mx, MinusView(x)) && compares_unequal(mx, MinusView(y)) && - compares_equal(OffsetView(x, 1.0), OffsetView(x, 1.0)) && - compares_unequal(OffsetView(x, 1.0), OffsetView(x, 2.0)) && - compares_unequal(OffsetView(x, 1.0), OffsetView(y, 1.0)) && - compares_equal(ScaleView(2.0, x), ScaleView(2.0, x)) && - compares_unequal(ScaleView(2.0, x), ScaleView(3.0, x)) && - compares_unequal(ScaleView(2.0, x), ScaleView(2.0, y)) && compares_unequal(x, mx); - } - }; + public: + /// Create and register test + ViewCompare() : Base("Float::Basic::View::Compare") {} + /// Perform test + bool + run() override { + using namespace Gecode; + using namespace Gecode::Float; + Fixture home; + FloatView x(FloatVar(home, 0.0, 1.0)); + FloatView y(FloatVar(home, 0.0, 1.0)); + MinusView mx(x); + return compares_equal(mx, MinusView(x)) && compares_unequal(mx, MinusView(y)) && + compares_equal(OffsetView(x, 1.0), OffsetView(x, 1.0)) && + compares_unequal(OffsetView(x, 1.0), OffsetView(x, 2.0)) && + compares_unequal(OffsetView(x, 1.0), OffsetView(y, 1.0)) && + compares_equal(ScaleView(2.0, x), ScaleView(2.0, x)) && + compares_unequal(ScaleView(2.0, x), ScaleView(3.0, x)) && + compares_unequal(ScaleView(2.0, x), ScaleView(2.0, y)) && compares_unequal(x, mx); + } + }; - namespace { - OptimizeCut optimize_cut; - ViewCompare view_compare; - } // namespace - //@} + namespace { + OptimizeCut optimize_cut; + ViewCompare view_compare; + } // namespace + //@} - } // namespace Basic -}} // namespace Test::Float +} // namespace Test::Float::Basic +// namespace Test::Float // STATISTICS: test-float diff --git a/test/float/channel.cpp b/test/float/channel.cpp index dbec42b2b3..f376440ed5 100644 --- a/test/float/channel.cpp +++ b/test/float/channel.cpp @@ -36,63 +36,59 @@ #include -namespace Test { namespace Float { +/// %Tests for channel constraints +namespace Test::Float::Channel { - /// %Tests for channel constraints - namespace Channel { + /// %Test channel between float and integer + class Int : public Test { + public: + /// Construct and register test + Int(Gecode::FloatNum st) : Test("Channel::Int", 2, -1, 2, st, COMPLETE_ASSIGNMENT, false) {} + /// Check whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + Gecode::FloatNum tmp; + return (((modf(x[0].min(), &tmp) == 0) || (modf(x[0].max(), &tmp) == 0)) && (x[0] == x[1])) ? MT_TRUE + : MT_FALSE; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + using namespace Gecode; + IntVar iv(home, -1000, 1000); + channel(home, x[0], iv); + channel(home, iv, x[1]); + } + }; - /// %Test channel between float and integer - class Int : public Test { - public: - /// Construct and register test - Int(Gecode::FloatNum st) : Test("Channel::Int", 2, -1, 2, st, COMPLETE_ASSIGNMENT, false) {} - /// Check whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - Gecode::FloatNum tmp; - return (((modf(x[0].min(), &tmp) == 0) || (modf(x[0].max(), &tmp) == 0)) && (x[0] == x[1])) ? MT_TRUE - : MT_FALSE; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - using namespace Gecode; - IntVar iv(home, -1000, 1000); - channel(home, x[0], iv); - channel(home, iv, x[1]); - } - }; + /// %Test channel between float and Boolean + class Bool : public Test { + public: + /// Construct and register test + Bool(Gecode::FloatNum st) : Test("Channel::Bool", 2, 0, 1, st, COMPLETE_ASSIGNMENT, false) {} + /// Check whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + Gecode::FloatNum tmp; + return (((modf(x[0].min(), &tmp) == 0) || (modf(x[0].max(), &tmp) == 0)) && (x[0] == x[1])) ? MT_TRUE + : MT_FALSE; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + using namespace Gecode; + BoolVar bv(home, 0, 1); + channel(home, x[0], bv); + channel(home, bv, x[1]); + } + }; - /// %Test channel between float and Boolean - class Bool : public Test { - public: - /// Construct and register test - Bool(Gecode::FloatNum st) : Test("Channel::Bool", 2, 0, 1, st, COMPLETE_ASSIGNMENT, false) {} - /// Check whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - Gecode::FloatNum tmp; - return (((modf(x[0].min(), &tmp) == 0) || (modf(x[0].max(), &tmp) == 0)) && (x[0] == x[1])) ? MT_TRUE - : MT_FALSE; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - using namespace Gecode; - BoolVar bv(home, 0, 1); - channel(home, x[0], bv); - channel(home, bv, x[1]); - } - }; + Gecode::FloatNum step1 = 0.7; + Gecode::FloatNum step2 = 0.1; - Gecode::FloatNum step1 = 0.7; - Gecode::FloatNum step2 = 0.1; - - Int ci(step1); - Bool cb(step2); - //@} - - } // namespace Channel -}} // namespace Test::Float + Int ci(step1); + Bool cb(step2); + //@} +} // namespace Test::Float::Channel // STATISTICS: test-float diff --git a/test/float/dom.cpp b/test/float/dom.cpp index c4beb3cdca..38ba192243 100644 --- a/test/float/dom.cpp +++ b/test/float/dom.cpp @@ -36,117 +36,113 @@ #include -namespace Test { namespace Float { +/// %Tests for domain constraints +namespace Test::Float::Dom { - /// %Tests for domain constraints - namespace Dom { + /** + * \defgroup TaskTestFloatDom Domain constraints + * \ingroup TaskTestFloat + */ + //@{ + /// %Test for domain constraints with a float value + class Val : public Test { + protected: + /// Float constant + Gecode::FloatVal c; - /** - * \defgroup TaskTestFloatDom Domain constraints - * \ingroup TaskTestFloat - */ - //@{ - /// %Test for domain constraints with a float value - class Val : public Test { - protected: - /// Float constant - Gecode::FloatVal c; - - public: - /// Create and register test - Val(int n, const Gecode::FloatVal& c0, Gecode::FloatNum st) - : Test("Dom::Val::" + str(n) + "::" + str(c0), n, -3, 3, st, COMPLETE_ASSIGNMENT, n == 1), c(c0) { - test_subsumption = false; - } - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - for (int i = x.size(); i--;) - if ((x[i].max() > c.max()) || (x[i].min() < c.min())) - return MT_FALSE; - return MT_TRUE; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - if (x.size() == 1) - Gecode::dom(home, x[0], c); - else - Gecode::dom(home, x, c); - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::FloatVarArray& x, Gecode::Reify r) override { - assert(x.size() == 1); - Gecode::dom(home, x[0], c, r); - } - }; + public: + /// Create and register test + Val(int n, const Gecode::FloatVal& c0, Gecode::FloatNum st) + : Test("Dom::Val::" + str(n) + "::" + str(c0), n, -3, 3, st, COMPLETE_ASSIGNMENT, n == 1), c(c0) { + test_subsumption = false; + } + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + for (int i = x.size(); i--;) + if ((x[i].max() > c.max()) || (x[i].min() < c.min())) + return MT_FALSE; + return MT_TRUE; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + if (x.size() == 1) + Gecode::dom(home, x[0], c); + else + Gecode::dom(home, x, c); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::FloatVarArray& x, Gecode::Reify r) override { + assert(x.size() == 1); + Gecode::dom(home, x[0], c, r); + } + }; - /// %Test for domain constraints with float numbers - class Num : public Test { - protected: - /// Float number - Gecode::FloatNum min; - /// Float number - Gecode::FloatNum max; + /// %Test for domain constraints with float numbers + class Num : public Test { + protected: + /// Float number + Gecode::FloatNum min; + /// Float number + Gecode::FloatNum max; - public: - /// Create and register test - Num(int n, Gecode::FloatNum min0, Gecode::FloatNum max0, Gecode::FloatNum st) - : Test("Dom::Num::" + str(n) + "::" + str(min0) + "::" + str(max0), n, -3, 3, st, COMPLETE_ASSIGNMENT, - n == 1), - min(min0), max(max0) { - test_subsumption = false; - } - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - if (max < min) + public: + /// Create and register test + Num(int n, Gecode::FloatNum min0, Gecode::FloatNum max0, Gecode::FloatNum st) + : Test("Dom::Num::" + str(n) + "::" + str(min0) + "::" + str(max0), n, -3, 3, st, COMPLETE_ASSIGNMENT, + n == 1), + min(min0), max(max0) { + test_subsumption = false; + } + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + if (max < min) + return MT_FALSE; + for (int i = x.size(); i--;) + if ((x[i].max() > max) || (x[i].min() < min)) return MT_FALSE; - for (int i = x.size(); i--;) - if ((x[i].max() > max) || (x[i].min() < min)) - return MT_FALSE; - return MT_TRUE; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - if (x.size() == 1) - Gecode::dom(home, x[0], min, max); - else - Gecode::dom(home, x, min, max); - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::FloatVarArray& x, Gecode::Reify r) override { - assert(x.size() == 1); - Gecode::dom(home, x[0], min, max, r); - } - }; + return MT_TRUE; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + if (x.size() == 1) + Gecode::dom(home, x[0], min, max); + else + Gecode::dom(home, x, min, max); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::FloatVarArray& x, Gecode::Reify r) override { + assert(x.size() == 1); + Gecode::dom(home, x[0], min, max, r); + } + }; - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - using namespace Gecode; - FloatNum step = 0.7; - for (int c = -4; c <= 4; c++) { - (void)new Val(1, c, step); - (void)new Val(2, c, step); - for (int d = -3; d <= 3; d++) { - (void)new Num(1, c, d, step); - (void)new Num(2, c, d, step); - } + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + using namespace Gecode; + FloatNum step = 0.7; + for (int c = -4; c <= 4; c++) { + (void)new Val(1, c, step); + (void)new Val(2, c, step); + for (int d = -3; d <= 3; d++) { + (void)new Num(1, c, d, step); + (void)new Num(2, c, d, step); } } - }; - - Create c; - //@} + } + }; - } // namespace Dom + Create c; + //@} -}} // namespace Test::Float +} // namespace Test::Float::Dom // STATISTICS: test-float diff --git a/test/float/interval.cpp b/test/float/interval.cpp index eae06c1fb6..06aa143636 100644 --- a/test/float/interval.cpp +++ b/test/float/interval.cpp @@ -39,234 +39,228 @@ #include #include -namespace Test { namespace Float { +/// %Tests for the interval type behind float values +namespace Test::Float::IntervalCore { - /// %Tests for the interval type behind float values - namespace IntervalCore { + using Gecode::FloatNum; + using Gecode::Float::Interval; - using Gecode::FloatNum; - using Gecode::Float::Interval; + static_assert(std::is_trivially_copyable_v); - static_assert(std::is_trivially_copyable_v); + /** + * \defgroup TaskTestFloatInterval Interval arithmetic + * \ingroup TaskTestFloat + */ + //@{ - /** - * \defgroup TaskTestFloatInterval Interval arithmetic - * \ingroup TaskTestFloat - */ - //@{ + /// Caller modes under which the interval operations are tested + const int caller_modes[] = {FE_TONEAREST, FE_DOWNWARD, FE_UPWARD, FE_TOWARDZERO}; - /// Caller modes under which the interval operations are tested - const int caller_modes[] = {FE_TONEAREST, FE_DOWNWARD, FE_UPWARD, FE_TOWARDZERO}; + /// Test whether \a x has the bounds \a l and \a u, and log a mismatch + static bool + has_bounds(const char* name, const Interval& x, FloatNum l, FloatNum u) { + if ((x.lower() == l) && (x.upper() == u)) + return true; + olog << name << ": [" << std::hexfloat << x.lower() << ", " << x.upper() << "], expected [" << l << ", " << u + << ']' << std::defaultfloat << '\n'; + return false; + } - /// Test whether \a x has the bounds \a l and \a u, and log a mismatch - bool - has_bounds(const char* name, const Interval& x, FloatNum l, FloatNum u) { - if ((x.lower() == l) && (x.upper() == u)) - return true; - olog << name << ": [" << std::hexfloat << x.lower() << ", " << x.upper() << "], expected [" << l << ", " - << u << ']' << std::defaultfloat << '\n'; - return false; - } - - /// Arithmetic rounds each bound outward and keeps the caller's mode - class OutwardRounding : public Base { - private: - /// Test whether \a x has the bounds \a l and \a u in caller mode \a mode - static bool - check(int mode, const char* name, const Interval& x, FloatNum l, FloatNum u) { - bool result = has_bounds(name, x, l, u); - if (std::fegetround() != mode) { - olog << name << " changed caller mode " << mode << '\n'; - result = false; - } - return result; + /// Arithmetic rounds each bound outward and keeps the caller's mode + class OutwardRounding : public Base { + private: + /// Test whether \a x has the bounds \a l and \a u in caller mode \a mode + static bool + check(int mode, const char* name, const Interval& x, FloatNum l, FloatNum u) { + bool result = has_bounds(name, x, l, u); + if (std::fegetround() != mode) { + olog << name << " changed caller mode " << mode << '\n'; + result = false; } + return result; + } - public: - OutwardRounding(void) : Base("Float::Interval::OutwardRounding", TestTags::check()) {} - bool - run(void) override { - const int previous = std::fegetround(); - bool result = true; - // Each expected bound is a floating-point neighbour of the - // exact result, computed with rational arithmetic. - for (int mode : caller_modes) { - if (std::fesetround(mode) != 0) - continue; - result &= check(mode, "[0.1,0.1]+[0.2,0.2]", Interval(0.1) + Interval(0.2), 0x1.3333333333333p-2, - 0x1.3333333333334p-2); - result &= - check(mode, "0.1-[0.7,0.7]", 0.1 - Interval(0.7), -0x1.3333333333333p-1, -0x1.3333333333332p-1); - result &= check(mode, "[-0.1,0.3]*[0.3,0.7]", Interval(-0.1, 0.3) * Interval(0.3, 0.7), - -0x1.1eb851eb851ecp-4, 0x1.ae147ae147ae1p-3); - result &= check(mode, "[1,1]/[3,3]", Interval(1.0) / Interval(3.0), 0x1.5555555555555p-2, - 0x1.5555555555556p-2); - result &= check(mode, "[-1,2]/[3,7]", Interval(-1.0, 2.0) / Interval(3.0, 7.0), - -0x1.5555555555556p-2, 0x1.5555555555556p-1); - result &= - check(mode, "sqrt [2,2]", sqrt(Interval(2.0)), 0x1.6a09e667f3bccp+0, 0x1.6a09e667f3bcdp+0); - result &= - check(mode, "sqrt [0.1,0.1]", sqrt(Interval(0.1)), 0x1.43d136248490fp-2, 0x1.43d1362484910p-2); - } - if (previous != -1) - std::fesetround(previous); - return result; + public: + OutwardRounding() : Base("Float::Interval::OutwardRounding", TestTags::check()) {} + bool + run() override { + const int previous = std::fegetround(); + bool result = true; + // Each expected bound is a floating-point neighbour of the + // exact result, computed with rational arithmetic. + for (int mode : caller_modes) { + if (std::fesetround(mode) != 0) + continue; + result &= check(mode, "[0.1,0.1]+[0.2,0.2]", Interval(0.1) + Interval(0.2), 0x1.3333333333333p-2, + 0x1.3333333333334p-2); + result &= + check(mode, "0.1-[0.7,0.7]", 0.1 - Interval(0.7), -0x1.3333333333333p-1, -0x1.3333333333332p-1); + result &= check(mode, "[-0.1,0.3]*[0.3,0.7]", Interval(-0.1, 0.3) * Interval(0.3, 0.7), + -0x1.1eb851eb851ecp-4, 0x1.ae147ae147ae1p-3); + result &= check(mode, "[1,1]/[3,3]", Interval(1.0) / Interval(3.0), 0x1.5555555555555p-2, + 0x1.5555555555556p-2); + result &= check(mode, "[-1,2]/[3,7]", Interval(-1.0, 2.0) / Interval(3.0, 7.0), -0x1.5555555555556p-2, + 0x1.5555555555556p-1); + result &= check(mode, "sqrt [2,2]", sqrt(Interval(2.0)), 0x1.6a09e667f3bccp+0, 0x1.6a09e667f3bcdp+0); + result &= + check(mode, "sqrt [0.1,0.1]", sqrt(Interval(0.1)), 0x1.43d136248490fp-2, 0x1.43d1362484910p-2); } - } outward_rounding; + if (previous != -1) + std::fesetround(previous); + return result; + } + } outward_rounding; - /// Singletons stay exact, and empty intervals are never created - class SingletonAndEmpty : public Base { - private: - /// Test whether \a operation throws std::runtime_error, and log otherwise - template - static bool - throws_empty(const char* name, Operation operation) { - try { - (void)operation(); - } catch (const std::runtime_error&) { - return true; - } - olog << name << " did not throw\n"; - return false; + /// Singletons stay exact, and empty intervals are never created + class SingletonAndEmpty : public Base { + private: + /// Test whether \a operation throws std::runtime_error, and log otherwise + template + static bool + throws_empty(const char* name, Operation operation) { + try { + (void)operation(); + } catch (const std::runtime_error&) { + return true; } + olog << name << " did not throw\n"; + return false; + } - public: - SingletonAndEmpty(void) : Base("Float::Interval::SingletonAndEmpty", TestTags::standard()) {} - bool - run(void) override { - const FloatNum nan = std::numeric_limits::quiet_NaN(); - bool result = true; + public: + SingletonAndEmpty() : Base("Float::Interval::SingletonAndEmpty", TestTags::standard()) {} + bool + run() override { + const FloatNum nan = std::numeric_limits::quiet_NaN(); + bool result = true; - const Interval zero; - result &= - has_bounds("default", zero, 0.0, 0.0) && !std::signbit(zero.lower()) && !std::signbit(zero.upper()); - result &= has_bounds("[0.1,0.1]", Interval(0.1), 0.1, 0.1); - result &= singleton(Interval(0.1)) && (width(Interval(0.1)) == 0.0); - result &= has_bounds("[2,2]*[3,3]", Interval(2.0) * Interval(3.0), 6.0, 6.0); - result &= has_bounds("sqrt [4,4]", sqrt(Interval(4.0)), 2.0, 2.0); - const int min_exponent = std::numeric_limits::min(); - result &= has_bounds("pow([1,1],INT_MIN)", pow(Interval(1.0), min_exponent), 1.0, 1.0); - result &= has_bounds("pow([-1,-1],INT_MIN)", pow(Interval(-1.0), min_exponent), 1.0, 1.0); - const Interval not_a_number(nan); - result &= std::isnan(not_a_number.lower()) && std::isnan(not_a_number.upper()); + const Interval zero; + result &= + has_bounds("default", zero, 0.0, 0.0) && !std::signbit(zero.lower()) && !std::signbit(zero.upper()); + result &= has_bounds("[0.1,0.1]", Interval(0.1), 0.1, 0.1); + result &= singleton(Interval(0.1)) && (width(Interval(0.1)) == 0.0); + result &= has_bounds("[2,2]*[3,3]", Interval(2.0) * Interval(3.0), 6.0, 6.0); + result &= has_bounds("sqrt [4,4]", sqrt(Interval(4.0)), 2.0, 2.0); + const int min_exponent = std::numeric_limits::min(); + result &= has_bounds("pow([1,1],INT_MIN)", pow(Interval(1.0), min_exponent), 1.0, 1.0); + result &= has_bounds("pow([-1,-1],INT_MIN)", pow(Interval(-1.0), min_exponent), 1.0, 1.0); + const Interval not_a_number(nan); + result &= std::isnan(not_a_number.lower()) && std::isnan(not_a_number.upper()); - result &= throws_empty("Interval(2,1)", [] { return Interval(2.0, 1.0); }); - result &= throws_empty("Interval(NaN,1)", [&] { return Interval(nan, 1.0); }); - result &= throws_empty("Interval(1,NaN)", [&] { return Interval(1.0, nan); }); - Interval assigned(1.0, 2.0); - result &= throws_empty("assign(2,1)", [&] { - assigned.assign(2.0, 1.0); - return assigned; - }); - result &= has_bounds("after assign(2,1)", assigned, 1.0, 2.0); + result &= throws_empty("Interval(2,1)", [] { return Interval(2.0, 1.0); }); + result &= throws_empty("Interval(NaN,1)", [&] { return Interval(nan, 1.0); }); + result &= throws_empty("Interval(1,NaN)", [&] { return Interval(1.0, nan); }); + Interval assigned(1.0, 2.0); + result &= throws_empty("assign(2,1)", [&] { + assigned.assign(2.0, 1.0); + return assigned; + }); + result &= has_bounds("after assign(2,1)", assigned, 1.0, 2.0); - const Interval x(1.0, 2.0); - result &= throws_empty("[1,2]/[0,0]", [&] { return x / Interval(); }); - result &= throws_empty("[1,2]/0", [&] { return x / 0.0; }); - result &= throws_empty("sqrt [-2,-1]", [] { return sqrt(Interval(-2.0, -1.0)); }); - result &= throws_empty("pow([0,0],0)", [] { return pow(Interval(), 0); }); - result &= throws_empty("pow([0,0],-1)", [] { return pow(Interval(), -1); }); - result &= throws_empty("nth_root([-2,-1],2)", [] { return nth_root(Interval(-2.0, -1.0), 2); }); - result &= throws_empty("intersect([1,2],[3,4])", [&] { return intersect(x, Interval(3.0, 4.0)); }); + const Interval x(1.0, 2.0); + result &= throws_empty("[1,2]/[0,0]", [&] { return x / Interval(); }); + result &= throws_empty("[1,2]/0", [&] { return x / 0.0; }); + result &= throws_empty("sqrt [-2,-1]", [] { return sqrt(Interval(-2.0, -1.0)); }); + result &= throws_empty("pow([0,0],0)", [] { return pow(Interval(), 0); }); + result &= throws_empty("pow([0,0],-1)", [] { return pow(Interval(), -1); }); + result &= throws_empty("nth_root([-2,-1],2)", [] { return nth_root(Interval(-2.0, -1.0), 2); }); + result &= throws_empty("intersect([1,2],[3,4])", [&] { return intersect(x, Interval(3.0, 4.0)); }); #ifdef GECODE_HAS_MPFR - result &= throws_empty("log [-1,0]", [] { return log(Interval(-1.0, 0.0)); }); - result &= throws_empty("asin [2,3]", [] { return asin(Interval(2.0, 3.0)); }); - result &= throws_empty("acosh [0,0.5]", [] { return acosh(Interval(0.0, 0.5)); }); + result &= throws_empty("log [-1,0]", [] { return log(Interval(-1.0, 0.0)); }); + result &= throws_empty("asin [2,3]", [] { return asin(Interval(2.0, 3.0)); }); + result &= throws_empty("acosh [0,0.5]", [] { return acosh(Interval(0.0, 0.5)); }); #endif - return result; - } - } singleton_and_empty; + return result; + } + } singleton_and_empty; - /// Comparisons hold only when they hold for all members - class Comparison : public Base { - private: - /// Truth values of the relations between two intervals - struct IntervalRelations { - bool less; - bool less_equal; - bool greater; - bool greater_equal; - bool equal; - bool unequal; - bool operator==(const IntervalRelations&) const = default; - }; - /// Truth values of the relations between an interval and a number - struct NumberRelations { - bool less; - bool less_equal; - bool greater; - bool greater_equal; - bool unequal; - bool operator==(const NumberRelations&) const = default; - }; + /// Comparisons hold only when they hold for all members + class Comparison : public Base { + private: + /// Truth values of the relations between two intervals + struct IntervalRelations { + bool less; + bool less_equal; + bool greater; + bool greater_equal; + bool equal; + bool unequal; + bool operator==(const IntervalRelations&) const = default; + }; + /// Truth values of the relations between an interval and a number + struct NumberRelations { + bool less; + bool less_equal; + bool greater; + bool greater_equal; + bool unequal; + bool operator==(const NumberRelations&) const = default; + }; - /// Test the relations between \a x and \a y against \a expected - static bool - check(const Interval& x, const Interval& y, const IntervalRelations& expected) { - const IntervalRelations actual = {certainly_less(x, y), - certainly_less_equal(x, y), - certainly_greater(x, y), - certainly_greater_equal(x, y), - equal(x, y), - certainly_unequal(x, y)}; - if (actual == expected) - return true; - olog << "Relations of [" << x.lower() << ',' << x.upper() << "] and [" << y.lower() << ',' << y.upper() - << "] differ\n"; - return false; - } - /// Test the relations between \a x and \a n against \a expected - static bool - check(const Interval& x, FloatNum n, const NumberRelations& expected) { - const NumberRelations actual = {certainly_less(x, n), certainly_less_equal(x, n), - certainly_greater(x, n), certainly_greater_equal(x, n), - certainly_unequal(x, n)}; - if (actual == expected) - return true; - olog << "Relations of [" << x.lower() << ',' << x.upper() << "] and " << n << " differ\n"; - return false; - } - - public: - Comparison(void) : Base("Float::Interval::Comparison", TestTags::standard()) {} - bool - run(void) override { - const bool t = true; - const bool f = false; - const FloatNum one_up = std::nextafter(1.0, 2.0); - const Interval x(1.0, 2.0); - const Interval one(1.0); - const Interval tight(1.0, one_up); - bool result = true; - // Columns: < <= > >= == != - result &= check(x, Interval(3.0, 4.0), {t, t, f, f, f, t}); - result &= check(x, Interval(2.0, 3.0), {f, t, f, f, f, f}); - result &= check(x, Interval(1.5, 3.0), {f, f, f, f, f, f}); - result &= check(x, Interval(1.0, 2.0), {f, f, f, f, t, f}); - result &= check(x, Interval(1.2, 1.8), {f, f, f, f, f, f}); - result &= check(x, Interval(0.0, 1.0), {f, f, f, t, f, f}); - result &= check(x, Interval(-1.0, 0.0), {f, f, t, t, f, t}); - result &= check(one, one, {f, t, f, t, t, f}); - result &= check(one, Interval(2.0), {t, t, f, f, f, t}); - result &= check(one, x, {f, t, f, f, f, f}); - result &= check(tight, tight, {f, f, f, f, t, f}); - // Columns: < <= > >= != - result &= check(x, 0.5, {f, f, t, t, t}); - result &= check(x, 1.0, {f, f, f, t, f}); - result &= check(x, 1.5, {f, f, f, f, f}); - result &= check(x, 2.0, {f, t, f, f, f}); - result &= check(x, 3.0, {t, t, f, f, t}); - result &= check(one, 1.0, {f, t, f, t, f}); - result &= check(tight, 1.0, {f, f, f, t, f}); - result &= check(tight, one_up, {f, t, f, f, f}); - return result; - } - } comparison; + /// Test the relations between \a x and \a y against \a expected + static bool + check(const Interval& x, const Interval& y, const IntervalRelations& expected) { + const IntervalRelations actual = {certainly_less(x, y), + certainly_less_equal(x, y), + certainly_greater(x, y), + certainly_greater_equal(x, y), + equal(x, y), + certainly_unequal(x, y)}; + if (actual == expected) + return true; + olog << "Relations of [" << x.lower() << ',' << x.upper() << "] and [" << y.lower() << ',' << y.upper() + << "] differ\n"; + return false; + } + /// Test the relations between \a x and \a n against \a expected + static bool + check(const Interval& x, FloatNum n, const NumberRelations& expected) { + const NumberRelations actual = {certainly_less(x, n), certainly_less_equal(x, n), certainly_greater(x, n), + certainly_greater_equal(x, n), certainly_unequal(x, n)}; + if (actual == expected) + return true; + olog << "Relations of [" << x.lower() << ',' << x.upper() << "] and " << n << " differ\n"; + return false; + } - //@} + public: + Comparison() : Base("Float::Interval::Comparison", TestTags::standard()) {} + bool + run() override { + const bool t = true; + const bool f = false; + const FloatNum one_up = std::nextafter(1.0, 2.0); + const Interval x(1.0, 2.0); + const Interval one(1.0); + const Interval tight(1.0, one_up); + bool result = true; + // Columns: < <= > >= == != + result &= check(x, Interval(3.0, 4.0), {t, t, f, f, f, t}); + result &= check(x, Interval(2.0, 3.0), {f, t, f, f, f, f}); + result &= check(x, Interval(1.5, 3.0), {f, f, f, f, f, f}); + result &= check(x, Interval(1.0, 2.0), {f, f, f, f, t, f}); + result &= check(x, Interval(1.2, 1.8), {f, f, f, f, f, f}); + result &= check(x, Interval(0.0, 1.0), {f, f, f, t, f, f}); + result &= check(x, Interval(-1.0, 0.0), {f, f, t, t, f, t}); + result &= check(one, one, {f, t, f, t, t, f}); + result &= check(one, Interval(2.0), {t, t, f, f, f, t}); + result &= check(one, x, {f, t, f, f, f, f}); + result &= check(tight, tight, {f, f, f, f, t, f}); + // Columns: < <= > >= != + result &= check(x, 0.5, {f, f, t, t, t}); + result &= check(x, 1.0, {f, f, f, t, f}); + result &= check(x, 1.5, {f, f, f, f, f}); + result &= check(x, 2.0, {f, t, f, f, f}); + result &= check(x, 3.0, {t, t, f, f, t}); + result &= check(one, 1.0, {f, t, f, t, f}); + result &= check(tight, 1.0, {f, f, f, t, f}); + result &= check(tight, one_up, {f, t, f, f, f}); + return result; + } + } comparison; - } // namespace IntervalCore + //@} -}} // namespace Test::Float +} // namespace Test::Float::IntervalCore // STATISTICS: test-float diff --git a/test/float/linear.cpp b/test/float/linear.cpp index 865d6b2306..4cf690c604 100644 --- a/test/float/linear.cpp +++ b/test/float/linear.cpp @@ -36,287 +36,281 @@ #include -namespace Test { namespace Float { +/// %Tests for linear constraints +namespace Test::Float::Linear { - /// %Tests for linear constraints - namespace Linear { + /// Check whether \a has only one coefficients + static bool + one(const Gecode::FloatValArgs& a) { + for (int i = a.size(); i--;) + if (a[i] != 1) + return false; + return true; + } - /// Check whether \a has only one coefficients - bool - one(const Gecode::FloatValArgs& a) { - for (int i = a.size(); i--;) - if (a[i] != 1) - return false; - return true; - } + /** + * \defgroup TaskTestFloatLinear Linear constraints + * \ingroup TaskTestFloat + */ + //@{ + /// %Test linear relation over float variables + class FloatFloat : public Test { + protected: + /// Coefficients + Gecode::FloatValArgs a; + /// Float relation type to propagate + Gecode::FloatRelType frt; + /// Result + Gecode::FloatNum c; - /** - * \defgroup TaskTestFloatLinear Linear constraints - * \ingroup TaskTestFloat - */ - //@{ - /// %Test linear relation over float variables - class FloatFloat : public Test { - protected: - /// Coefficients - Gecode::FloatValArgs a; - /// Float relation type to propagate - Gecode::FloatRelType frt; - /// Result - Gecode::FloatNum c; - - public: - /// Create and register test - FloatFloat(TestTags tags, const std::string& s, const Gecode::FloatVal& d, const Gecode::FloatValArgs& a0, - Gecode::FloatRelType frt0, Gecode::FloatNum c0, Gecode::FloatNum st) - : Test(tags, "Linear::Float::" + str(frt0) + "::" + s + "::" + str(c0) + "::" + str(a0.size()), - a0.size(), d, st, COMPLETE_ASSIGNMENT, true), - a(a0), frt(frt0), c(c0) { - using namespace Gecode; - test_fixpoint = false; - if ((frt == FRT_NQ) || (frt == FRT_LT) || (frt == FRT_GR) || reified) - test_subsumption = false; - } - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - Gecode::FloatVal e = 0.0; + public: + /// Create and register test + FloatFloat(TestTags tags, const std::string& s, const Gecode::FloatVal& d, const Gecode::FloatValArgs& a0, + Gecode::FloatRelType frt0, Gecode::FloatNum c0, Gecode::FloatNum st) + : Test(tags, "Linear::Float::" + str(frt0) + "::" + s + "::" + str(c0) + "::" + str(a0.size()), a0.size(), + d, st, COMPLETE_ASSIGNMENT, true), + a(a0), frt(frt0), c(c0) { + using namespace Gecode; + test_fixpoint = false; + if ((frt == FRT_NQ) || (frt == FRT_LT) || (frt == FRT_GR) || reified) + test_subsumption = false; + } + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + Gecode::FloatVal e = 0.0; + for (int i = x.size(); i--;) + e += a[i] * x[i]; + switch (cmp(e, frt, Gecode::FloatVal(c))) { + case MT_FALSE: { + Gecode::FloatVal e_error = e; for (int i = x.size(); i--;) - e += a[i] * x[i]; - switch (cmp(e, frt, Gecode::FloatVal(c))) { - case MT_FALSE: { - Gecode::FloatVal e_error = e; - for (int i = x.size(); i--;) - e_error -= a[i] * x[i]; - if (cmp(e + e_error, frt, Gecode::FloatVal(c)) == MT_FALSE) - return MT_FALSE; - else - return MT_MAYBE; - } - case MT_TRUE: - return MT_TRUE; - case MT_MAYBE: - return MT_MAYBE; - } - GECODE_NEVER; - return MT_FALSE; + e_error -= a[i] * x[i]; + if (cmp(e + e_error, frt, Gecode::FloatVal(c)) == MT_FALSE) + return MT_FALSE; + return MT_MAYBE; } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - if (one(a)) - Gecode::linear(home, x, frt, c); - else - Gecode::linear(home, a, x, frt, c); + case MT_TRUE: + return MT_TRUE; + case MT_MAYBE: + return MT_MAYBE; } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::FloatVarArray& x, Gecode::Reify r) override { - if (one(a)) - Gecode::linear(home, x, frt, c, r); - else - Gecode::linear(home, a, x, frt, c, r); - } - }; + GECODE_NEVER; + return MT_FALSE; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + if (one(a)) + Gecode::linear(home, x, frt, c); + else + Gecode::linear(home, a, x, frt, c); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::FloatVarArray& x, Gecode::Reify r) override { + if (one(a)) + Gecode::linear(home, x, frt, c, r); + else + Gecode::linear(home, a, x, frt, c, r); + } + }; - /// %Test linear relation over float variables - class FloatVar : public Test { - protected: - /// Coefficients - Gecode::FloatValArgs a; - /// Float relation type to propagate - Gecode::FloatRelType frt; + /// %Test linear relation over float variables + class FloatVar : public Test { + protected: + /// Coefficients + Gecode::FloatValArgs a; + /// Float relation type to propagate + Gecode::FloatRelType frt; - public: - /// Create and register test - FloatVar(TestTags tags, const std::string& s, const Gecode::FloatVal& d, const Gecode::FloatValArgs& a0, - Gecode::FloatRelType frt0, Gecode::FloatNum st) - : Test(tags, "Linear::Var::" + str(frt0) + "::" + s + "::" + str(a0.size()), a0.size() + 1, d, st, - COMPLETE_ASSIGNMENT, true), - a(a0), frt(frt0) { - using namespace Gecode; - test_fixpoint = false; - if ((frt == FRT_NQ) || (frt == FRT_LT) || (frt == FRT_GR) || reified) - test_subsumption = false; - } - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - Gecode::FloatVal e = 0.0; + public: + /// Create and register test + FloatVar(TestTags tags, const std::string& s, const Gecode::FloatVal& d, const Gecode::FloatValArgs& a0, + Gecode::FloatRelType frt0, Gecode::FloatNum st) + : Test(tags, "Linear::Var::" + str(frt0) + "::" + s + "::" + str(a0.size()), a0.size() + 1, d, st, + COMPLETE_ASSIGNMENT, true), + a(a0), frt(frt0) { + using namespace Gecode; + test_fixpoint = false; + if ((frt == FRT_NQ) || (frt == FRT_LT) || (frt == FRT_GR) || reified) + test_subsumption = false; + } + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + Gecode::FloatVal e = 0.0; + for (int i = a.size(); i--;) + e += a[i] * x[i]; + switch (cmp(e, frt, x[a.size()])) { + case MT_FALSE: { + Gecode::FloatVal e_error = e; for (int i = a.size(); i--;) - e += a[i] * x[i]; - switch (cmp(e, frt, x[a.size()])) { - case MT_FALSE: { - Gecode::FloatVal e_error = e; - for (int i = a.size(); i--;) - e_error -= a[i] * x[i]; - if (cmp(e + e_error, frt, x[a.size()]) == MT_FALSE) - return MT_FALSE; - else - return MT_MAYBE; - } - case MT_TRUE: - return MT_TRUE; - case MT_MAYBE: - return MT_MAYBE; - } - GECODE_NEVER; - return MT_FALSE; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - int n = a.size(); - Gecode::FloatVarArgs y(n); - for (int i = n; i--;) - y[i] = x[i]; - if (one(a)) - Gecode::linear(home, y, frt, x[n]); - else - Gecode::linear(home, a, y, frt, x[n]); + e_error -= a[i] * x[i]; + if (cmp(e + e_error, frt, x[a.size()]) == MT_FALSE) + return MT_FALSE; + return MT_MAYBE; } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::FloatVarArray& x, Gecode::Reify r) override { - int n = a.size(); - Gecode::FloatVarArgs y(n); - for (int i = n; i--;) - y[i] = x[i]; - if (one(a)) - Gecode::linear(home, y, frt, x[n], r); - else - Gecode::linear(home, a, y, frt, x[n], r); + case MT_TRUE: + return MT_TRUE; + case MT_MAYBE: + return MT_MAYBE; } - }; + GECODE_NEVER; + return MT_FALSE; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + int n = a.size(); + Gecode::FloatVarArgs y(n); + for (int i = n; i--;) + y[i] = x[i]; + if (one(a)) + Gecode::linear(home, y, frt, x[n]); + else + Gecode::linear(home, a, y, frt, x[n]); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::FloatVarArray& x, Gecode::Reify r) override { + int n = a.size(); + Gecode::FloatVarArgs y(n); + for (int i = n; i--;) + y[i] = x[i]; + if (one(a)) + Gecode::linear(home, y, frt, x[n], r); + else + Gecode::linear(home, a, y, frt, x[n], r); + } + }; - /// Space with a float and a Boolean variable for sums without terms - class EmptyFixture : public Gecode::Space { - public: - /// Right-hand side variable - Gecode::FloatVar y; - /// Reification variable - Gecode::BoolVar b; - /// Create fixture - EmptyFixture(void) : y(*this, -2, 2), b(*this, 0, 1) {} - /// Constructor for cloning \a fixture - EmptyFixture(EmptyFixture& fixture) : Gecode::Space(fixture) { - y.update(*this, fixture.y); - b.update(*this, fixture.b); - } - /// Copy during cloning - Gecode::Space* - copy(void) override { - return new EmptyFixture(*this); - } - /// Test whether the space is solved with \a b equal to \a val - bool - is_solved_with_b(int val) { - return (status() == Gecode::SS_SOLVED) && b.assigned() && (b.val() == val); - } - }; + /// Space with a float and a Boolean variable for sums without terms + class EmptyFixture : public Gecode::Space { + public: + /// Right-hand side variable + Gecode::FloatVar y; + /// Reification variable + Gecode::BoolVar b; + /// Create fixture + EmptyFixture() : y(*this, -2, 2), b(*this, 0, 1) {} + /// Constructor for cloning \a fixture + EmptyFixture(EmptyFixture& fixture) : Gecode::Space(fixture) { + y.update(*this, fixture.y); + b.update(*this, fixture.b); + } + /// Copy during cloning + Gecode::Space* + copy() override { + return new EmptyFixture(*this); + } + /// Test whether the space is solved with \a b equal to \a val + bool + is_solved_with_b(int val) { + return (status() == Gecode::SS_SOLVED) && b.assigned() && (b.val() == val); + } + }; - /// %Test linear constraints over no variables - class Empty : public Base { - public: - /// Create and register test - Empty(void) : Base("Float::Linear::Empty") {} - /// Perform test - bool - run(void) override { - using namespace Gecode; - FloatVarArgs x; - FloatValArgs a; - EmptyFixture eq, lq, rhs, reified, pmi; - linear(eq, x, FRT_EQ, 0); - linear(lq, a, x, FRT_LQ, -1); - linear(rhs, x, FRT_EQ, rhs.y); - linear(reified, x, FRT_EQ, 1, Reify(reified.b)); - linear(pmi, a, x, FRT_GQ, 0, Reify(pmi.b, RM_RIMP)); - return (eq.status() == SS_SOLVED) && (lq.status() == SS_FAILED) && (rhs.status() == SS_SOLVED) && - rhs.y.assigned() && (rhs.y.val() == 0) && reified.is_solved_with_b(0) && pmi.is_solved_with_b(1); - } - }; - Empty empty; + /// %Test linear constraints over no variables + class Empty : public Base { + public: + /// Create and register test + Empty() : Base("Float::Linear::Empty") {} + /// Perform test + bool + run() override { + using namespace Gecode; + FloatVarArgs x; + FloatValArgs a; + EmptyFixture eq, lq, rhs, reified, pmi; + linear(eq, x, FRT_EQ, 0); + linear(lq, a, x, FRT_LQ, -1); + linear(rhs, x, FRT_EQ, rhs.y); + linear(reified, x, FRT_EQ, 1, Reify(reified.b)); + linear(pmi, a, x, FRT_GQ, 0, Reify(pmi.b, RM_RIMP)); + return (eq.status() == SS_SOLVED) && (lq.status() == SS_FAILED) && (rhs.status() == SS_SOLVED) && + rhs.y.assigned() && (rhs.y.val() == 0) && reified.is_solved_with_b(0) && pmi.is_solved_with_b(1); + } + }; + Empty empty; - /// %Test coefficients given by an initializer list - class InitializerList : public Base { - public: - /// Create and register test - InitializerList(void) : Base("Float::Linear::InitializerList") {} - /// Perform test - bool - run(void) override { - using namespace Gecode; - FloatValArgs a({2.0, -3.0}); - return (a.size() == 2) && (a[0].min() == 2.0) && (a[1].max() == -3.0); - } - }; - InitializerList initializer_list; + /// %Test coefficients given by an initializer list + class InitializerList : public Base { + public: + /// Create and register test + InitializerList() : Base("Float::Linear::InitializerList") {} + /// Perform test + bool + run() override { + using namespace Gecode; + FloatValArgs a({2.0, -3.0}); + return (a.size() == 2) && (a[0].min() == 2.0) && (a[1].max() == -3.0); + } + }; + InitializerList initializer_list; - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - using namespace Gecode; - { - FloatNum step = 0.7; - FloatVal f1(-2, 2); - FloatVal f2(-3, -1); - FloatVal f3(3, 8); + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + using namespace Gecode; + { + FloatNum step = 0.7; + FloatVal f1(-2, 2); + FloatVal f2(-3, -1); + FloatVal f3(3, 8); - FloatValArgs a1(1); - a1[0] = 0.0; + FloatValArgs a1(1); + a1[0] = 0.0; - for (FloatRelTypes frts; frts(); ++frts) { - TestTags tags = frts.frt() == Gecode::FRT_EQ ? TestTags::standard() : TestTags::sweep(); - (void)new FloatFloat(tags, "11", f1, a1, frts.frt(), 0.0, step); - (void)new FloatVar(tags, "11", f1, a1, frts.frt(), step); - (void)new FloatFloat(TestTags::sweep(), "21", f2, a1, frts.frt(), 0.0, step); - (void)new FloatVar(TestTags::sweep(), "21", f2, a1, frts.frt(), step); - (void)new FloatFloat(TestTags::sweep(), "31", f3, a1, frts.frt(), 1.0, step); - } + for (FloatRelTypes frts; frts(); ++frts) { + TestTags tags = frts.frt() == Gecode::FRT_EQ ? TestTags::standard() : TestTags::sweep(); + (void)new FloatFloat(tags, "11", f1, a1, frts.frt(), 0.0, step); + (void)new FloatVar(tags, "11", f1, a1, frts.frt(), step); + (void)new FloatFloat(TestTags::sweep(), "21", f2, a1, frts.frt(), 0.0, step); + (void)new FloatVar(TestTags::sweep(), "21", f2, a1, frts.frt(), step); + (void)new FloatFloat(TestTags::sweep(), "31", f3, a1, frts.frt(), 1.0, step); + } - const FloatVal av2[4] = {1.0, 1.0, 1.0, 1.0}; - const FloatVal av3[4] = {1.0, -1.0, -1.0, 1.0}; - const FloatVal av4[4] = {2.0, 3.0, 5.0, 7.0}; - const FloatVal av5[4] = {-2.0, 3.0, -5.0, 7.0}; + const FloatVal av2[4] = {1.0, 1.0, 1.0, 1.0}; + const FloatVal av3[4] = {1.0, -1.0, -1.0, 1.0}; + const FloatVal av4[4] = {2.0, 3.0, 5.0, 7.0}; + const FloatVal av5[4] = {-2.0, 3.0, -5.0, 7.0}; - for (int i = 1; i <= 4; i++) { - FloatValArgs a2(i, av2); - FloatValArgs a3(i, av3); - FloatValArgs a4(i, av4); - FloatValArgs a5(i, av5); - for (FloatRelTypes frts; frts(); ++frts) { - (void)new FloatFloat(TestTags::sweep(), "12", f1, a2, frts.frt(), 0.0, step); - (void)new FloatFloat(TestTags::sweep(), "13", f1, a3, frts.frt(), 0.0, step); - (void)new FloatFloat(TestTags::sweep(), "14", f1, a4, frts.frt(), 0.0, step); - (void)new FloatFloat(TestTags::sweep(), "15", f1, a5, frts.frt(), 0.0, step); - (void)new FloatFloat(TestTags::sweep(), "22", f2, a2, frts.frt(), 0.0, step); - (void)new FloatFloat(TestTags::sweep(), "23", f2, a3, frts.frt(), 0.0, step); - (void)new FloatFloat(TestTags::sweep(), "24", f2, a4, frts.frt(), 0.0, step); - (void)new FloatFloat(TestTags::sweep(), "25", f2, a5, frts.frt(), 0.0, step); - (void)new FloatFloat(TestTags::sweep(), "32", f3, a2, frts.frt(), 1.0, step); - if (i < 4) { - (void)new FloatVar(TestTags::sweep(), "12", f1, a2, frts.frt(), step); - (void)new FloatVar(TestTags::sweep(), "13", f1, a3, frts.frt(), step); - (void)new FloatVar(TestTags::sweep(), "14", f1, a4, frts.frt(), step); - (void)new FloatVar(TestTags::sweep(), "15", f1, a5, frts.frt(), step); - (void)new FloatVar(TestTags::sweep(), "22", f2, a2, frts.frt(), step); - (void)new FloatVar(TestTags::sweep(), "23", f2, a3, frts.frt(), step); - (void)new FloatVar(TestTags::sweep(), "24", f2, a4, frts.frt(), step); - (void)new FloatVar(TestTags::sweep(), "25", f2, a5, frts.frt(), step); - } + for (int i = 1; i <= 4; i++) { + FloatValArgs a2(i, av2); + FloatValArgs a3(i, av3); + FloatValArgs a4(i, av4); + FloatValArgs a5(i, av5); + for (FloatRelTypes frts; frts(); ++frts) { + (void)new FloatFloat(TestTags::sweep(), "12", f1, a2, frts.frt(), 0.0, step); + (void)new FloatFloat(TestTags::sweep(), "13", f1, a3, frts.frt(), 0.0, step); + (void)new FloatFloat(TestTags::sweep(), "14", f1, a4, frts.frt(), 0.0, step); + (void)new FloatFloat(TestTags::sweep(), "15", f1, a5, frts.frt(), 0.0, step); + (void)new FloatFloat(TestTags::sweep(), "22", f2, a2, frts.frt(), 0.0, step); + (void)new FloatFloat(TestTags::sweep(), "23", f2, a3, frts.frt(), 0.0, step); + (void)new FloatFloat(TestTags::sweep(), "24", f2, a4, frts.frt(), 0.0, step); + (void)new FloatFloat(TestTags::sweep(), "25", f2, a5, frts.frt(), 0.0, step); + (void)new FloatFloat(TestTags::sweep(), "32", f3, a2, frts.frt(), 1.0, step); + if (i < 4) { + (void)new FloatVar(TestTags::sweep(), "12", f1, a2, frts.frt(), step); + (void)new FloatVar(TestTags::sweep(), "13", f1, a3, frts.frt(), step); + (void)new FloatVar(TestTags::sweep(), "14", f1, a4, frts.frt(), step); + (void)new FloatVar(TestTags::sweep(), "15", f1, a5, frts.frt(), step); + (void)new FloatVar(TestTags::sweep(), "22", f2, a2, frts.frt(), step); + (void)new FloatVar(TestTags::sweep(), "23", f2, a3, frts.frt(), step); + (void)new FloatVar(TestTags::sweep(), "24", f2, a4, frts.frt(), step); + (void)new FloatVar(TestTags::sweep(), "25", f2, a5, frts.frt(), step); } } } } - }; - - Create c; - //@} + } + }; - } // namespace Linear -}} // namespace Test::Float + Create c; + //@} +} // namespace Test::Float::Linear // STATISTICS: test-float diff --git a/test/float/mm-lin.cpp b/test/float/mm-lin.cpp index e02ef0a49b..46894b0c28 100644 --- a/test/float/mm-lin.cpp +++ b/test/float/mm-lin.cpp @@ -35,2314 +35,1105 @@ #include -namespace Test { namespace Float { +/// %Tests for minimal modeling constraints (linear) +namespace Test::Float::MiniModelLin { - /// %Tests for minimal modeling constraints (linear) - namespace MiniModelLin { + /// Linear opcode + enum LinOpcode { + LO_ACE, ///< Add float and expression + LO_AEC, ///< Add expression and float + LO_AEE, ///< Add expressions + LO_SCE, ///< Subtract float and expression + LO_SEC, ///< Subtract expression and float + LO_SEE, ///< Subtract expressions + LO_SE, ///< Unary subtraction + LO_MCE, ///< Multiply constant and expression + LO_MEC, ///< Multiply constant and expression + LO_HLT ///< Stop execution + }; - /// Linear opcode - enum LinOpcode { - LO_ACE, ///< Add float and expression - LO_AEC, ///< Add expression and float - LO_AEE, ///< Add expressions - LO_SCE, ///< Subtract float and expression - LO_SEC, ///< Subtract expression and float - LO_SEE, ///< Subtract expressions - LO_SE, ///< Unary subtraction - LO_MCE, ///< Multiply constant and expression - LO_MEC, ///< Multiply constant and expression - LO_HLT ///< Stop execution - }; + /// Type for representing a linear instruction + class LinInstr { + public: + LinOpcode o; ///< Which instruction to execute + unsigned char x, y, z; ///< Instruction arguments, \a y is destination (or \a z) + int c; ///< Numerical constant + }; - /// Type for representing a linear instruction - class LinInstr { - public: - LinOpcode o; ///< Which instruction to execute - unsigned char x, y, z; ///< Instruction arguments, \a y is destination (or \a z) - int c; ///< Numerical constant - }; - - /// Evaluate linear instructions - template - Expr - eval(const LinInstr* pc, Expr reg[]) { - while (true) { - switch (pc->o) { - case LO_ACE: - reg[pc->y] = pc->c + reg[pc->x]; - break; - case LO_AEC: - reg[pc->y] = reg[pc->x] + pc->c; - break; - case LO_AEE: - reg[pc->z] = reg[pc->x] + reg[pc->y]; - break; - case LO_SCE: - reg[pc->y] = pc->c - reg[pc->x]; - break; - case LO_SEC: - reg[pc->y] = reg[pc->x] - pc->c; - break; - case LO_SEE: - reg[pc->z] = reg[pc->x] - reg[pc->y]; - break; - case LO_SE: - reg[pc->y] = -reg[pc->x]; - break; - case LO_MCE: - reg[pc->y] = pc->c * reg[pc->x]; - break; - case LO_MEC: - reg[pc->y] = reg[pc->x] * pc->c; - break; - case LO_HLT: - return reg[pc->x]; - default: - GECODE_NEVER; - } - pc++; + /// Evaluate linear instructions + template + static Expr + eval(const LinInstr* pc, Expr reg[]) { + while (true) { + switch (pc->o) { + case LO_ACE: + reg[pc->y] = pc->c + reg[pc->x]; + break; + case LO_AEC: + reg[pc->y] = reg[pc->x] + pc->c; + break; + case LO_AEE: + reg[pc->z] = reg[pc->x] + reg[pc->y]; + break; + case LO_SCE: + reg[pc->y] = pc->c - reg[pc->x]; + break; + case LO_SEC: + reg[pc->y] = reg[pc->x] - pc->c; + break; + case LO_SEE: + reg[pc->z] = reg[pc->x] - reg[pc->y]; + break; + case LO_SE: + reg[pc->y] = -reg[pc->x]; + break; + case LO_MCE: + reg[pc->y] = pc->c * reg[pc->x]; + break; + case LO_MEC: + reg[pc->y] = reg[pc->x] * pc->c; + break; + case LO_HLT: + return reg[pc->x]; + default: + GECODE_NEVER; } - GECODE_NEVER; + pc++; } + GECODE_NEVER; + } - /** - * \defgroup TaskTestFloatMiniModelLin Minimal modeling constraints (linear constraints) - * \ingroup TaskTestFloat - */ - //@{ - /// %Test linear expressions over float variables - class LinExpr : public Int::Test { - protected: - /// Linear instruction sequence - const LinInstr* lis; + /** + * \defgroup TaskTestFloatMiniModelLin Minimal modeling constraints (linear constraints) + * \ingroup TaskTestFloat + */ + //@{ + /// %Test linear expressions over float variables + class LinExpr : public Int::Test { + protected: + /// Linear instruction sequence + const LinInstr* lis; - public: - /// Create and register test - LinExpr(TestTags tags, const LinInstr* lis0, const std::string& s) - : Test(tags, "Float::", "MiniModel::LinExpr::" + s, 4, -3, 3), lis(lis0) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Int::Assignment& x) const override { - int reg[3] = {x[0], x[1], x[2]}; - return eval(lis, reg) == x[3]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - FloatVarArray y(home, 4, dom.min(), dom.max()); - channel(home, x[0], y[0]); - channel(home, x[1], y[1]); - channel(home, x[2], y[2]); - channel(home, x[3], y[3]); - LinFloatExpr reg[3] = {y[0], y[1], y[2]}; - rel(home, y[3], FRT_EQ, expr(home, eval(lis, reg))); - } - }; + public: + /// Create and register test + LinExpr(TestTags tags, const LinInstr* lis0, const std::string& s) + : Test(tags, "Float::", "MiniModel::LinExpr::" + s, 4, -3, 3), lis(lis0) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Int::Assignment& x) const override { + int reg[3] = {x[0], x[1], x[2]}; + return eval(lis, reg) == x[3]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + FloatVarArray y(home, 4, dom.min(), dom.max()); + channel(home, x[0], y[0]); + channel(home, x[1], y[1]); + channel(home, x[2], y[2]); + channel(home, x[3], y[3]); + LinFloatExpr reg[3] = {y[0], y[1], y[2]}; + rel(home, y[3], FRT_EQ, expr(home, eval(lis, reg))); + } + }; - /// %Test linear relations over float variables - class LinRel : public Int::Test { - protected: - /// Linear instruction sequence for left hand side - const LinInstr* l_lis; - /// Linear instruction sequence for right hand side - const LinInstr* r_lis; - /// Float relation type to propagate - Gecode::FloatRelType frt; + /// %Test linear relations over float variables + class LinRel : public Int::Test { + protected: + /// Linear instruction sequence for left hand side + const LinInstr* l_lis; + /// Linear instruction sequence for right hand side + const LinInstr* r_lis; + /// Float relation type to propagate + Gecode::FloatRelType frt; - public: - /// Create and register test - LinRel(const LinInstr* l_lis0, const LinInstr* r_lis0, Gecode::FloatRelType frt0, const std::string& s) - : Test("Float::", "MiniModel::LinRel::" + s + "::" + Float::Test::str(frt0), 3, -3, 3), l_lis(l_lis0), - r_lis(r_lis0), frt(frt0) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Int::Assignment& x) const override { - using namespace Gecode; - int l_reg[3] = {x[0], x[1], x[2]}; - int l = eval(l_lis, l_reg); - int r_reg[3] = {x[0], x[1], x[2]}; - int r = eval(r_lis, r_reg); - switch (frt) { - case FRT_EQ: - return l == r; - case FRT_NQ: - return l != r; - case FRT_LT: - return l < r; - case FRT_GR: - return l > r; - case FRT_LQ: - return l <= r; - case FRT_GQ: - return l >= r; - default: - GECODE_NEVER; - } - return false; + public: + /// Create and register test + LinRel(const LinInstr* l_lis0, const LinInstr* r_lis0, Gecode::FloatRelType frt0, const std::string& s) + : Test("Float::", "MiniModel::LinRel::" + s + "::" + Float::Test::str(frt0), 3, -3, 3), l_lis(l_lis0), + r_lis(r_lis0), frt(frt0) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Int::Assignment& x) const override { + using namespace Gecode; + int l_reg[3] = {x[0], x[1], x[2]}; + int l = eval(l_lis, l_reg); + int r_reg[3] = {x[0], x[1], x[2]}; + int r = eval(r_lis, r_reg); + switch (frt) { + case FRT_EQ: + return l == r; + case FRT_NQ: + return l != r; + case FRT_LT: + return l < r; + case FRT_GR: + return l > r; + case FRT_LQ: + return l <= r; + case FRT_GQ: + return l >= r; + default: + GECODE_NEVER; } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - FloatVarArray y(home, 3, dom.min(), dom.max()); - channel(home, x[0], y[0]); - channel(home, x[1], y[1]); - channel(home, x[2], y[2]); - LinFloatExpr l_reg[3] = {y[0], y[1], y[2]}; - LinFloatExpr r_reg[3] = {y[0], y[1], y[2]}; - switch (frt) { - case FRT_EQ: - Gecode::rel(home, eval(l_lis, l_reg) == eval(r_lis, r_reg)); - break; - case FRT_NQ: - Gecode::rel(home, eval(l_lis, l_reg) != eval(r_lis, r_reg)); - break; - case FRT_LQ: - Gecode::rel(home, eval(l_lis, l_reg) <= eval(r_lis, r_reg)); - break; - case FRT_LT: - Gecode::rel(home, eval(l_lis, l_reg) < eval(r_lis, r_reg)); - break; - case FRT_GQ: - Gecode::rel(home, eval(l_lis, l_reg) >= eval(r_lis, r_reg)); - break; - case FRT_GR: - Gecode::rel(home, eval(l_lis, l_reg) > eval(r_lis, r_reg)); - break; - default: - GECODE_NEVER; - } + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + FloatVarArray y(home, 3, dom.min(), dom.max()); + channel(home, x[0], y[0]); + channel(home, x[1], y[1]); + channel(home, x[2], y[2]); + LinFloatExpr l_reg[3] = {y[0], y[1], y[2]}; + LinFloatExpr r_reg[3] = {y[0], y[1], y[2]}; + switch (frt) { + case FRT_EQ: + Gecode::rel(home, eval(l_lis, l_reg) == eval(r_lis, r_reg)); + break; + case FRT_NQ: + Gecode::rel(home, eval(l_lis, l_reg) != eval(r_lis, r_reg)); + break; + case FRT_LQ: + Gecode::rel(home, eval(l_lis, l_reg) <= eval(r_lis, r_reg)); + break; + case FRT_LT: + Gecode::rel(home, eval(l_lis, l_reg) < eval(r_lis, r_reg)); + break; + case FRT_GQ: + Gecode::rel(home, eval(l_lis, l_reg) >= eval(r_lis, r_reg)); + break; + case FRT_GR: + Gecode::rel(home, eval(l_lis, l_reg) > eval(r_lis, r_reg)); + break; + default: + GECODE_NEVER; } - }; + } + }; - const LinInstr li000[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li001[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li002[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li003[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li004[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li005[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li006[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li007[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li008[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li009[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li010[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li011[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li012[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li013[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li014[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li015[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li016[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li017[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li018[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li019[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li020[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li021[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li022[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li023[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li024[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li025[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li026[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li027[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li028[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li029[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li030[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li031[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li032[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li033[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li034[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li035[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li036[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li037[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li038[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li039[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li040[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li041[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li042[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li043[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li044[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li045[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li046[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li047[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li048[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li049[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li050[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li051[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li052[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li053[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li054[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li055[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li056[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li057[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li058[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li059[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li060[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li061[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li062[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li063[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li064[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li065[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li066[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li067[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li068[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li069[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li070[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li071[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li072[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li073[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li074[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li075[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li076[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li077[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li078[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li079[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li080[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li081[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li082[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li083[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li084[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li085[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li086[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li087[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li088[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li089[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li090[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li091[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li092[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li093[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li094[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li095[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li096[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li097[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li098[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li099[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li100[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li101[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li102[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li103[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li104[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li105[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li106[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li107[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li108[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li109[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li110[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li111[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li112[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li113[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li114[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li115[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li116[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li117[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li118[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li119[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li120[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li121[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li122[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li123[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li124[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li125[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li126[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li127[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li128[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li129[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li130[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li131[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li132[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li133[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li134[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li135[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li136[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li137[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li138[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li139[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li140[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li141[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li142[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li143[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li144[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li145[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li146[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li147[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li148[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li149[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li150[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li151[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li152[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li153[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li154[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li155[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li156[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li157[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li158[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li159[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li160[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li161[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li162[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li163[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li164[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li165[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li166[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li167[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li168[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li169[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li170[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li171[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li172[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li173[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li174[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li175[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li176[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li177[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li178[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li179[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li180[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li181[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li182[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li183[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li184[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li185[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li186[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li187[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li188[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li189[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li190[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li191[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li192[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li193[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li194[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li195[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li196[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li197[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li198[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li199[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li200[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li201[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li202[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li203[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li204[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li205[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li206[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li207[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li208[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li209[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li210[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li211[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li212[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li213[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li214[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li215[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li216[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li217[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li218[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li219[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li220[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li221[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li222[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li223[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li224[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li225[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li226[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li227[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li228[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li229[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li230[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li231[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li232[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li233[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li234[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li235[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li236[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li237[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li238[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li239[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li240[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li241[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li242[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li243[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li244[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li245[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li246[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li247[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li248[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li249[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li250[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li251[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li252[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li253[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li254[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li255[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li256[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li257[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li258[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li259[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li260[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li261[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li262[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li263[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li264[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li265[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li266[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li267[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li268[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li269[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li270[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li271[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li272[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li273[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li274[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li275[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li276[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li277[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li278[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li279[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li280[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li281[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li282[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li283[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li284[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li285[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li286[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li287[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li288[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li289[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li290[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li291[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li292[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li293[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li294[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li295[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li296[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li297[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li298[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li299[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li300[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li301[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li302[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li303[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li304[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li305[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li306[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li307[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li308[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li309[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li310[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li311[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li312[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li313[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li314[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li315[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li316[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li317[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li318[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li319[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li320[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li321[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li322[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li323[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li324[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li325[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li326[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li327[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li328[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li329[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li330[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li331[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li332[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li333[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li334[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li335[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li336[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li337[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li338[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li339[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li340[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li341[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li342[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li343[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li344[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li345[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li346[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li347[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li348[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li349[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li350[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li351[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li352[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li353[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li354[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li355[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li356[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li357[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li358[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li359[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li360[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li361[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li362[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li363[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li364[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li365[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li366[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li367[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li368[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li369[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li370[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li371[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li372[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li373[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li374[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li375[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li376[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li377[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li378[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li379[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li380[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li381[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li382[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li383[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li384[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li385[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li386[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li387[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li388[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li389[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li390[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li391[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li392[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li393[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li394[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li395[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li396[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li397[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li398[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li399[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li000[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li001[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li002[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li003[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li004[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li005[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li006[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li007[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li008[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li009[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li010[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li011[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li012[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li013[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li014[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li015[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li016[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li017[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li018[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li019[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li020[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li021[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li022[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li023[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li024[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li025[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li026[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li027[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li028[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li029[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li030[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li031[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li032[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li033[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li034[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li035[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li036[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li037[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li038[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li039[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li040[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li041[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li042[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li043[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li044[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li045[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li046[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li047[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li048[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li049[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li050[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li051[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li052[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li053[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li054[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li055[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li056[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li057[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li058[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li059[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li060[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li061[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li062[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li063[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li064[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li065[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li066[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li067[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li068[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li069[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li070[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li071[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li072[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li073[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li074[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li075[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li076[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li077[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li078[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li079[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li080[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li081[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li082[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li083[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li084[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li085[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li086[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li087[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li088[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li089[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li090[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li091[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li092[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li093[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li094[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li095[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li096[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li097[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li098[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li099[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li100[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li101[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li102[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li103[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li104[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li105[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li106[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li107[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li108[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li109[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li110[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li111[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li112[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li113[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li114[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li115[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li116[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li117[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li118[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li119[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li120[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li121[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li122[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li123[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li124[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li125[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li126[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li127[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li128[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li129[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li130[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li131[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li132[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li133[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li134[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li135[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li136[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li137[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li138[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li139[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li140[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li141[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li142[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li143[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li144[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li145[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li146[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li147[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li148[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li149[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li150[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li151[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li152[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li153[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li154[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li155[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li156[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li157[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li158[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li159[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li160[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li161[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li162[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li163[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li164[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li165[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li166[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li167[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li168[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li169[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li170[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li171[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li172[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li173[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li174[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li175[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li176[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li177[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li178[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li179[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li180[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li181[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li182[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li183[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li184[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li185[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li186[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li187[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li188[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li189[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li190[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li191[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li192[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li193[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li194[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li195[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li196[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li197[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li198[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li199[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li200[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li201[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li202[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li203[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li204[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li205[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li206[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li207[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li208[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li209[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li210[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li211[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li212[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li213[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li214[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li215[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li216[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li217[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li218[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li219[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li220[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li221[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li222[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li223[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li224[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li225[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li226[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li227[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li228[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li229[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li230[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li231[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li232[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li233[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li234[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li235[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li236[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li237[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li238[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li239[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li240[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li241[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li242[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li243[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li244[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li245[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li246[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li247[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li248[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li249[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li250[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li251[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li252[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li253[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li254[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li255[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li256[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li257[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li258[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li259[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li260[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li261[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li262[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li263[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li264[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li265[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li266[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li267[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li268[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li269[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li270[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li271[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li272[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li273[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li274[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li275[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li276[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li277[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li278[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li279[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li280[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li281[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li282[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li283[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li284[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li285[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li286[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li287[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li288[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li289[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li290[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li291[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li292[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li293[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li294[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li295[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li296[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li297[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li298[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li299[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li300[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li301[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li302[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li303[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li304[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li305[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li306[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li307[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li308[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li309[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li310[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li311[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li312[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li313[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li314[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li315[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li316[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li317[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li318[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li319[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li320[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li321[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li322[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li323[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li324[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li325[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li326[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li327[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li328[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li329[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li330[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li331[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li332[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li333[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li334[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li335[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li336[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li337[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li338[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li339[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li340[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li341[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li342[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li343[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li344[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li345[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li346[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li347[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li348[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li349[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li350[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li351[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li352[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li353[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li354[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li355[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li356[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li357[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li358[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li359[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li360[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li361[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li362[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li363[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li364[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li365[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li366[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li367[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li368[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li369[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li370[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li371[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li372[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li373[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li374[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li375[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li376[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li377[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li378[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li379[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li380[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li381[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li382[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li383[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li384[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li385[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li386[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li387[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li388[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li389[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li390[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li391[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li392[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li393[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li394[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li395[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li396[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li397[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li398[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li399[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; - const LinInstr* li[] = { - &li000[0], &li001[0], &li002[0], &li003[0], &li004[0], &li005[0], &li006[0], &li007[0], &li008[0], - &li009[0], &li010[0], &li011[0], &li012[0], &li013[0], &li014[0], &li015[0], &li016[0], &li017[0], - &li018[0], &li019[0], &li020[0], &li021[0], &li022[0], &li023[0], &li024[0], &li025[0], &li026[0], - &li027[0], &li028[0], &li029[0], &li030[0], &li031[0], &li032[0], &li033[0], &li034[0], &li035[0], - &li036[0], &li037[0], &li038[0], &li039[0], &li040[0], &li041[0], &li042[0], &li043[0], &li044[0], - &li045[0], &li046[0], &li047[0], &li048[0], &li049[0], &li050[0], &li051[0], &li052[0], &li053[0], - &li054[0], &li055[0], &li056[0], &li057[0], &li058[0], &li059[0], &li060[0], &li061[0], &li062[0], - &li063[0], &li064[0], &li065[0], &li066[0], &li067[0], &li068[0], &li069[0], &li070[0], &li071[0], - &li072[0], &li073[0], &li074[0], &li075[0], &li076[0], &li077[0], &li078[0], &li079[0], &li080[0], - &li081[0], &li082[0], &li083[0], &li084[0], &li085[0], &li086[0], &li087[0], &li088[0], &li089[0], - &li090[0], &li091[0], &li092[0], &li093[0], &li094[0], &li095[0], &li096[0], &li097[0], &li098[0], - &li099[0], &li100[0], &li101[0], &li102[0], &li103[0], &li104[0], &li105[0], &li106[0], &li107[0], - &li108[0], &li109[0], &li110[0], &li111[0], &li112[0], &li113[0], &li114[0], &li115[0], &li116[0], - &li117[0], &li118[0], &li119[0], &li120[0], &li121[0], &li122[0], &li123[0], &li124[0], &li125[0], - &li126[0], &li127[0], &li128[0], &li129[0], &li130[0], &li131[0], &li132[0], &li133[0], &li134[0], - &li135[0], &li136[0], &li137[0], &li138[0], &li139[0], &li140[0], &li141[0], &li142[0], &li143[0], - &li144[0], &li145[0], &li146[0], &li147[0], &li148[0], &li149[0], &li150[0], &li151[0], &li152[0], - &li153[0], &li154[0], &li155[0], &li156[0], &li157[0], &li158[0], &li159[0], &li160[0], &li161[0], - &li162[0], &li163[0], &li164[0], &li165[0], &li166[0], &li167[0], &li168[0], &li169[0], &li170[0], - &li171[0], &li172[0], &li173[0], &li174[0], &li175[0], &li176[0], &li177[0], &li178[0], &li179[0], - &li180[0], &li181[0], &li182[0], &li183[0], &li184[0], &li185[0], &li186[0], &li187[0], &li188[0], - &li189[0], &li190[0], &li191[0], &li192[0], &li193[0], &li194[0], &li195[0], &li196[0], &li197[0], - &li198[0], &li199[0], &li200[0], &li201[0], &li202[0], &li203[0], &li204[0], &li205[0], &li206[0], - &li207[0], &li208[0], &li209[0], &li210[0], &li211[0], &li212[0], &li213[0], &li214[0], &li215[0], - &li216[0], &li217[0], &li218[0], &li219[0], &li220[0], &li221[0], &li222[0], &li223[0], &li224[0], - &li225[0], &li226[0], &li227[0], &li228[0], &li229[0], &li230[0], &li231[0], &li232[0], &li233[0], - &li234[0], &li235[0], &li236[0], &li237[0], &li238[0], &li239[0], &li240[0], &li241[0], &li242[0], - &li243[0], &li244[0], &li245[0], &li246[0], &li247[0], &li248[0], &li249[0], &li250[0], &li251[0], - &li252[0], &li253[0], &li254[0], &li255[0], &li256[0], &li257[0], &li258[0], &li259[0], &li260[0], - &li261[0], &li262[0], &li263[0], &li264[0], &li265[0], &li266[0], &li267[0], &li268[0], &li269[0], - &li270[0], &li271[0], &li272[0], &li273[0], &li274[0], &li275[0], &li276[0], &li277[0], &li278[0], - &li279[0], &li280[0], &li281[0], &li282[0], &li283[0], &li284[0], &li285[0], &li286[0], &li287[0], - &li288[0], &li289[0], &li290[0], &li291[0], &li292[0], &li293[0], &li294[0], &li295[0], &li296[0], - &li297[0], &li298[0], &li299[0], &li300[0], &li301[0], &li302[0], &li303[0], &li304[0], &li305[0], - &li306[0], &li307[0], &li308[0], &li309[0], &li310[0], &li311[0], &li312[0], &li313[0], &li314[0], - &li315[0], &li316[0], &li317[0], &li318[0], &li319[0], &li320[0], &li321[0], &li322[0], &li323[0], - &li324[0], &li325[0], &li326[0], &li327[0], &li328[0], &li329[0], &li330[0], &li331[0], &li332[0], - &li333[0], &li334[0], &li335[0], &li336[0], &li337[0], &li338[0], &li339[0], &li340[0], &li341[0], - &li342[0], &li343[0], &li344[0], &li345[0], &li346[0], &li347[0], &li348[0], &li349[0], &li350[0], - &li351[0], &li352[0], &li353[0], &li354[0], &li355[0], &li356[0], &li357[0], &li358[0], &li359[0], - &li360[0], &li361[0], &li362[0], &li363[0], &li364[0], &li365[0], &li366[0], &li367[0], &li368[0], - &li369[0], &li370[0], &li371[0], &li372[0], &li373[0], &li374[0], &li375[0], &li376[0], &li377[0], - &li378[0], &li379[0], &li380[0], &li381[0], &li382[0], &li383[0], &li384[0], &li385[0], &li386[0], - &li387[0], &li388[0], &li389[0], &li390[0], &li391[0], &li392[0], &li393[0], &li394[0], &li395[0], - &li396[0], &li397[0], &li398[0], &li399[0], - }; + const LinInstr* li[] = { + &li000[0], &li001[0], &li002[0], &li003[0], &li004[0], &li005[0], &li006[0], &li007[0], &li008[0], &li009[0], + &li010[0], &li011[0], &li012[0], &li013[0], &li014[0], &li015[0], &li016[0], &li017[0], &li018[0], &li019[0], + &li020[0], &li021[0], &li022[0], &li023[0], &li024[0], &li025[0], &li026[0], &li027[0], &li028[0], &li029[0], + &li030[0], &li031[0], &li032[0], &li033[0], &li034[0], &li035[0], &li036[0], &li037[0], &li038[0], &li039[0], + &li040[0], &li041[0], &li042[0], &li043[0], &li044[0], &li045[0], &li046[0], &li047[0], &li048[0], &li049[0], + &li050[0], &li051[0], &li052[0], &li053[0], &li054[0], &li055[0], &li056[0], &li057[0], &li058[0], &li059[0], + &li060[0], &li061[0], &li062[0], &li063[0], &li064[0], &li065[0], &li066[0], &li067[0], &li068[0], &li069[0], + &li070[0], &li071[0], &li072[0], &li073[0], &li074[0], &li075[0], &li076[0], &li077[0], &li078[0], &li079[0], + &li080[0], &li081[0], &li082[0], &li083[0], &li084[0], &li085[0], &li086[0], &li087[0], &li088[0], &li089[0], + &li090[0], &li091[0], &li092[0], &li093[0], &li094[0], &li095[0], &li096[0], &li097[0], &li098[0], &li099[0], + &li100[0], &li101[0], &li102[0], &li103[0], &li104[0], &li105[0], &li106[0], &li107[0], &li108[0], &li109[0], + &li110[0], &li111[0], &li112[0], &li113[0], &li114[0], &li115[0], &li116[0], &li117[0], &li118[0], &li119[0], + &li120[0], &li121[0], &li122[0], &li123[0], &li124[0], &li125[0], &li126[0], &li127[0], &li128[0], &li129[0], + &li130[0], &li131[0], &li132[0], &li133[0], &li134[0], &li135[0], &li136[0], &li137[0], &li138[0], &li139[0], + &li140[0], &li141[0], &li142[0], &li143[0], &li144[0], &li145[0], &li146[0], &li147[0], &li148[0], &li149[0], + &li150[0], &li151[0], &li152[0], &li153[0], &li154[0], &li155[0], &li156[0], &li157[0], &li158[0], &li159[0], + &li160[0], &li161[0], &li162[0], &li163[0], &li164[0], &li165[0], &li166[0], &li167[0], &li168[0], &li169[0], + &li170[0], &li171[0], &li172[0], &li173[0], &li174[0], &li175[0], &li176[0], &li177[0], &li178[0], &li179[0], + &li180[0], &li181[0], &li182[0], &li183[0], &li184[0], &li185[0], &li186[0], &li187[0], &li188[0], &li189[0], + &li190[0], &li191[0], &li192[0], &li193[0], &li194[0], &li195[0], &li196[0], &li197[0], &li198[0], &li199[0], + &li200[0], &li201[0], &li202[0], &li203[0], &li204[0], &li205[0], &li206[0], &li207[0], &li208[0], &li209[0], + &li210[0], &li211[0], &li212[0], &li213[0], &li214[0], &li215[0], &li216[0], &li217[0], &li218[0], &li219[0], + &li220[0], &li221[0], &li222[0], &li223[0], &li224[0], &li225[0], &li226[0], &li227[0], &li228[0], &li229[0], + &li230[0], &li231[0], &li232[0], &li233[0], &li234[0], &li235[0], &li236[0], &li237[0], &li238[0], &li239[0], + &li240[0], &li241[0], &li242[0], &li243[0], &li244[0], &li245[0], &li246[0], &li247[0], &li248[0], &li249[0], + &li250[0], &li251[0], &li252[0], &li253[0], &li254[0], &li255[0], &li256[0], &li257[0], &li258[0], &li259[0], + &li260[0], &li261[0], &li262[0], &li263[0], &li264[0], &li265[0], &li266[0], &li267[0], &li268[0], &li269[0], + &li270[0], &li271[0], &li272[0], &li273[0], &li274[0], &li275[0], &li276[0], &li277[0], &li278[0], &li279[0], + &li280[0], &li281[0], &li282[0], &li283[0], &li284[0], &li285[0], &li286[0], &li287[0], &li288[0], &li289[0], + &li290[0], &li291[0], &li292[0], &li293[0], &li294[0], &li295[0], &li296[0], &li297[0], &li298[0], &li299[0], + &li300[0], &li301[0], &li302[0], &li303[0], &li304[0], &li305[0], &li306[0], &li307[0], &li308[0], &li309[0], + &li310[0], &li311[0], &li312[0], &li313[0], &li314[0], &li315[0], &li316[0], &li317[0], &li318[0], &li319[0], + &li320[0], &li321[0], &li322[0], &li323[0], &li324[0], &li325[0], &li326[0], &li327[0], &li328[0], &li329[0], + &li330[0], &li331[0], &li332[0], &li333[0], &li334[0], &li335[0], &li336[0], &li337[0], &li338[0], &li339[0], + &li340[0], &li341[0], &li342[0], &li343[0], &li344[0], &li345[0], &li346[0], &li347[0], &li348[0], &li349[0], + &li350[0], &li351[0], &li352[0], &li353[0], &li354[0], &li355[0], &li356[0], &li357[0], &li358[0], &li359[0], + &li360[0], &li361[0], &li362[0], &li363[0], &li364[0], &li365[0], &li366[0], &li367[0], &li368[0], &li369[0], + &li370[0], &li371[0], &li372[0], &li373[0], &li374[0], &li375[0], &li376[0], &li377[0], &li378[0], &li379[0], + &li380[0], &li381[0], &li382[0], &li383[0], &li384[0], &li385[0], &li386[0], &li387[0], &li388[0], &li389[0], + &li390[0], &li391[0], &li392[0], &li393[0], &li394[0], &li395[0], &li396[0], &li397[0], &li398[0], &li399[0], + }; - /// Space with a Boolean variable for sums without terms - class EmptyFixture : public Gecode::Space { - public: - /// Reification variable - Gecode::BoolVar b; - /// Create fixture - EmptyFixture(void) : b(*this, 0, 1) {} - /// Constructor for cloning \a fixture - EmptyFixture(EmptyFixture& fixture) : Gecode::Space(fixture) { - b.update(*this, fixture.b); - } - /// Copy during cloning - Gecode::Space* - copy(void) override { - return new EmptyFixture(*this); - } - }; + /// Space with a Boolean variable for sums without terms + class EmptyFixture : public Gecode::Space { + public: + /// Reification variable + Gecode::BoolVar b; + /// Create fixture + EmptyFixture() : b(*this, 0, 1) {} + /// Constructor for cloning \a fixture + EmptyFixture(EmptyFixture& fixture) : Gecode::Space(fixture) { + b.update(*this, fixture.b); + } + /// Copy during cloning + Gecode::Space* + copy() override { + return new EmptyFixture(*this); + } + }; - /// %Test linear relations over sums without variables - class LinRelEmpty : public Base { - public: - /// Create and register test - LinRelEmpty(void) : Base("Float::MiniModel::LinRel::Empty") {} - /// Perform test - bool - run(void) override { - using namespace Gecode; - FloatVarArgs x; - FloatValArgs a; - EmptyFixture eq, gq, reified; - rel(eq, sum(x) == 0); - rel(gq, sum(a, x) >= 1); - rel(reified, (sum(x) == 1) == reified.b); - return (eq.status() == SS_SOLVED) && (gq.status() == SS_FAILED) && (reified.status() == SS_SOLVED) && - reified.b.assigned() && (reified.b.val() == 0); - } - }; - LinRelEmpty lin_rel_empty; + /// %Test linear relations over sums without variables + class LinRelEmpty : public Base { + public: + /// Create and register test + LinRelEmpty() : Base("Float::MiniModel::LinRel::Empty") {} + /// Perform test + bool + run() override { + using namespace Gecode; + FloatVarArgs x; + FloatValArgs a; + EmptyFixture eq, gq, reified; + rel(eq, sum(x) == 0); + rel(gq, sum(a, x) >= 1); + rel(reified, (sum(x) == 1) == reified.b); + return (eq.status() == SS_SOLVED) && (gq.status() == SS_FAILED) && (reified.status() == SS_SOLVED) && + reified.b.assigned() && (reified.b.val() == 0); + } + }; + LinRelEmpty lin_rel_empty; - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - int n = sizeof(li) / sizeof(LinInstr*); - for (int i = 0; i < n; i++) { - std::string s = Test::str(i); - if (i < 10) { - s.insert(0, "00"); - } else if (i < 100) { - s.insert(0, "0"); - } - (void)new LinExpr(i == 0 ? TestTags::standard() : TestTags::sweep(), li[i], s); + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + int n = sizeof(li) / sizeof(LinInstr*); + for (int i = 0; i < n; i++) { + std::string s = Test::str(i); + if (i < 10) { + s.insert(0, "00"); + } else if (i < 100) { + s.insert(0, "0"); } - FloatRelTypes frts; - for (int i = 0; i < n / 2; i++) { - std::string s = Test::str(i); - if (i < 10) { - s.insert(0, "00"); - } else if (i < 100) { - s.insert(0, "0"); - } - (void)new LinRel(li[2 * i], li[2 * i + 1], frts.frt(), s); - ++frts; - if (!frts()) - frts.reset(); + (void)new LinExpr(i == 0 ? TestTags::standard() : TestTags::sweep(), li[i], s); + } + FloatRelTypes frts; + for (int i = 0; i < n / 2; i++) { + std::string s = Test::str(i); + if (i < 10) { + s.insert(0, "00"); + } else if (i < 100) { + s.insert(0, "0"); } + (void)new LinRel(li[2 * i], li[2 * i + 1], frts.frt(), s); + ++frts; + if (!frts()) + frts.reset(); } - }; - - Create c; - //@} - } // namespace MiniModelLin + } + }; -}} // namespace Test::Float + Create c; + //@} +} // namespace Test::Float::MiniModelLin // STATISTICS: test-minimodel diff --git a/test/float/rel.cpp b/test/float/rel.cpp index bb194701d9..d99e98628f 100644 --- a/test/float/rel.cpp +++ b/test/float/rel.cpp @@ -36,162 +36,154 @@ #include -namespace Test { namespace Float { +/// %Tests for relation constraints +namespace Test::Float::Rel { - /// %Tests for relation constraints - namespace Rel { + /** + * \defgroup TaskTestFloatRel Relation constraints + * \ingroup TaskTestFloat + */ + //@{ + /// %Test for simple relation involving float variables + class FloatVarXY : public Test { + protected: + /// Float relation type to propagate + Gecode::FloatRelType frt; - /** - * \defgroup TaskTestFloatRel Relation constraints - * \ingroup TaskTestFloat - */ - //@{ - /// %Test for simple relation involving float variables - class FloatVarXY : public Test { - protected: - /// Float relation type to propagate - Gecode::FloatRelType frt; - - public: - /// Create and register test - FloatVarXY(Gecode::FloatRelType frt0, int n, Gecode::FloatNum st) - : Test("Rel::Float::Var::XY::" + str(frt0) + "::" + str(n), n + 1, -3, 3, st, COMPLETE_ASSIGNMENT, - n == 1), - frt(frt0) { - test_subsumption = false; - } - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - if (x.size() == 2) { - return cmp(x[0], frt, x[1]); - } else { - MaybeType r1 = cmp(x[0], frt, x[2]); - MaybeType r2 = cmp(x[1], frt, x[2]); - if ((r1 == MT_TRUE) && (r2 == MT_TRUE)) - return MT_TRUE; - else if ((r1 == MT_FALSE) || (r2 == MT_FALSE)) - return MT_FALSE; - else - return MT_MAYBE; - } + public: + /// Create and register test + FloatVarXY(Gecode::FloatRelType frt0, int n, Gecode::FloatNum st) + : Test("Rel::Float::Var::XY::" + str(frt0) + "::" + str(n), n + 1, -3, 3, st, COMPLETE_ASSIGNMENT, n == 1), + frt(frt0) { + test_subsumption = false; + } + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + if (x.size() == 2) { + return cmp(x[0], frt, x[1]); } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - using namespace Gecode; - if (x.size() == 2) { - rel(home, x[0], frt, x[1]); - } else { - FloatVarArgs y(2); - y[0] = x[0]; - y[1] = x[1]; - rel(home, y, frt, x[2]); - } + MaybeType r1 = cmp(x[0], frt, x[2]); + MaybeType r2 = cmp(x[1], frt, x[2]); + if ((r1 == MT_TRUE) && (r2 == MT_TRUE)) + return MT_TRUE; + if ((r1 == MT_FALSE) || (r2 == MT_FALSE)) + return MT_FALSE; + return MT_MAYBE; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + using namespace Gecode; + if (x.size() == 2) { + rel(home, x[0], frt, x[1]); + } else { + FloatVarArgs y(2); + y[0] = x[0]; + y[1] = x[1]; + rel(home, y, frt, x[2]); } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::FloatVarArray& x, Gecode::Reify r) override { - assert(x.size() == 2); - Gecode::rel(home, x[0], frt, x[1], r); - } - }; + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::FloatVarArray& x, Gecode::Reify r) override { + assert(x.size() == 2); + Gecode::rel(home, x[0], frt, x[1], r); + } + }; - /// %Test for simple relation involving shared float variables - class FloatVarXX : public Test { - protected: - /// Float relation type to propagate - Gecode::FloatRelType frt; + /// %Test for simple relation involving shared float variables + class FloatVarXX : public Test { + protected: + /// Float relation type to propagate + Gecode::FloatRelType frt; - public: - /// Create and register test - FloatVarXX(Gecode::FloatRelType frt0, Gecode::FloatNum st) - : Test("Rel::Float::Var::XX::" + str(frt0), 1, -3, 3, st, COMPLETE_ASSIGNMENT, true), frt(frt0) { - test_subsumption = false; - } - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return cmp(x[0], frt, x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::rel(home, x[0], frt, x[0]); - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::FloatVarArray& x, Gecode::Reify r) override { - Gecode::rel(home, x[0], frt, x[0], r); - } - }; + public: + /// Create and register test + FloatVarXX(Gecode::FloatRelType frt0, Gecode::FloatNum st) + : Test("Rel::Float::Var::XX::" + str(frt0), 1, -3, 3, st, COMPLETE_ASSIGNMENT, true), frt(frt0) { + test_subsumption = false; + } + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return cmp(x[0], frt, x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::rel(home, x[0], frt, x[0]); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::FloatVarArray& x, Gecode::Reify r) override { + Gecode::rel(home, x[0], frt, x[0], r); + } + }; - /// %Test for simple relation involving float variable and float constant - class FloatFloat : public Test { - protected: - /// Float relation type to propagate - Gecode::FloatRelType frt; - /// Float constant - Gecode::FloatVal c; + /// %Test for simple relation involving float variable and float constant + class FloatFloat : public Test { + protected: + /// Float relation type to propagate + Gecode::FloatRelType frt; + /// Float constant + Gecode::FloatVal c; - public: - /// Create and register test - FloatFloat(Gecode::FloatRelType frt0, int n, Gecode::FloatNum c0, Gecode::FloatNum st) - : Test("Rel::Float::Float::" + str(frt0) + "::" + str(n) + "::" + str(c0), n, -3, 3, st, - COMPLETE_ASSIGNMENT, n == 1), - frt(frt0), c(c0) { - test_subsumption = false; - } - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - if (x.size() == 1) { - return cmp(x[0], frt, c); - } else { - return cmp(x[0], frt, c) & cmp(x[1], frt, c); - } + public: + /// Create and register test + FloatFloat(Gecode::FloatRelType frt0, int n, Gecode::FloatNum c0, Gecode::FloatNum st) + : Test("Rel::Float::Float::" + str(frt0) + "::" + str(n) + "::" + str(c0), n, -3, 3, st, + COMPLETE_ASSIGNMENT, n == 1), + frt(frt0), c(c0) { + test_subsumption = false; + } + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + if (x.size() == 1) { + return cmp(x[0], frt, c); } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - using namespace Gecode; - if (x.size() == 1) - rel(home, x[0], frt, c); - else - rel(home, x, frt, c); - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::FloatVarArray& x, Gecode::Reify r) override { - assert(x.size() == 1); - Gecode::rel(home, x[0], frt, c, r); - } - }; + return cmp(x[0], frt, c) & cmp(x[1], frt, c); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + using namespace Gecode; + if (x.size() == 1) + rel(home, x[0], frt, c); + else + rel(home, x, frt, c); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::FloatVarArray& x, Gecode::Reify r) override { + assert(x.size() == 1); + Gecode::rel(home, x[0], frt, c, r); + } + }; - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - using namespace Gecode; - Gecode::FloatNum step = 0.7; - for (FloatRelTypes frts; frts(); ++frts) { - (void)new FloatVarXY(frts.frt(), 1, step); - (void)new FloatVarXY(frts.frt(), 2, step); - (void)new FloatVarXX(frts.frt(), step); - for (int c = -4; c <= 4; c++) { - (void)new FloatFloat(frts.frt(), 1, c, step); - (void)new FloatFloat(frts.frt(), 2, c, step); - } + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + using namespace Gecode; + Gecode::FloatNum step = 0.7; + for (FloatRelTypes frts; frts(); ++frts) { + (void)new FloatVarXY(frts.frt(), 1, step); + (void)new FloatVarXY(frts.frt(), 2, step); + (void)new FloatVarXX(frts.frt(), step); + for (int c = -4; c <= 4; c++) { + (void)new FloatFloat(frts.frt(), 1, c, step); + (void)new FloatFloat(frts.frt(), 2, c, step); } } - }; - - Create c; - //@} + } + }; - } // namespace Rel + Create c; + //@} -}} // namespace Test::Float +} // namespace Test::Float::Rel // STATISTICS: test-float diff --git a/test/float/transcendental.cpp b/test/float/transcendental.cpp index ef93349704..8b4c22f939 100644 --- a/test/float/transcendental.cpp +++ b/test/float/transcendental.cpp @@ -40,492 +40,482 @@ #include #include -namespace Test { namespace Float { - - /// %Tests for transcendental constraints - namespace Transcendental { - - /// Exact fixed-base powers, inverse logarithms, and shared variables - class PowBaseConsistency : public Test { - protected: - Gecode::FloatNum base; - Gecode::FloatNum input; - Gecode::FloatNum output; - bool logarithm; - bool shared; - bool expected; - - public: - PowBaseConsistency(Gecode::FloatNum b, Gecode::FloatNum x, Gecode::FloatNum y, bool log, bool share, - bool valid) - : Test("Transcendental::PowBaseConsistency::" + str(b) + "::" + str(x) + "::" + str(y) + - (log ? "::Log" : "::Pow") + (share ? "::Shared" : "::Separate"), - share ? 1 : 2, -4.0, 8.0, 1.0, COMPLETE_ASSIGNMENT, false), - base(b), input(x), output(y), logarithm(log), shared(share), expected(valid) { - test_search = false; - } - /// Check one exact example through the standard posting/assignment tests - Assignment* - assignment(void) const override { - Assignment* a = new RandomAssignment(arity, dom, 1, _rand); - a->set(0, input); - if (!shared) - a->set(1, output); - return a; - } - /// Use exact expected results instead of computing them with exp/log - MaybeType - solution(const Assignment&) const override { - return expected ? MT_TRUE : MT_FALSE; - } - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::FloatVar y = shared ? x[0] : x[1]; - if (!shared) - Gecode::rel(home, y, Gecode::FRT_GQ, 0.0); - if (logarithm) - Gecode::log(home, base, y, x[0]); - else - Gecode::pow(home, base, x[0], y); - } - }; - - /// Register the exact powers and their logarithmic forms - class PowBaseExamples { - public: - PowBaseExamples(void) { - for (int logarithm = 0; logarithm < 2; logarithm++) { - (void)new PowBaseConsistency(2.0, 3.0, 8.0, logarithm, false, true); - (void)new PowBaseConsistency(2.0, 3.0, 7.0, logarithm, false, false); - (void)new PowBaseConsistency(0.5, 3.0, 0.125, logarithm, false, true); - (void)new PowBaseConsistency(1.0, 3.0, 1.0, logarithm, false, true); - (void)new PowBaseConsistency(2.0, 0.0, 0.0, logarithm, true, false); - (void)new PowBaseConsistency(0.25, 0.5, 0.5, logarithm, true, true); - } - } - } pow_base_examples; - - /// %Test for exponent constraint - class ExpXY : public Test { - public: - /// Create and register test - ExpXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Transcendental::Exp::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(exp(x[0]), x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - if (flip()) - Gecode::exp(home, x[0], x[1]); - else - Gecode::rel(home, exp(x[0]) == x[1]); - } - }; - - /// %Test for exponent constraint where solution is ensured - class ExpXYSol : public Test { - public: - /// Create and register test - ExpXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Transcendental::Exp::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(exp(x[0]), x[1]); - } - /// Extend assignment \a x - bool - extend_assignment(Assignment& x) const override { - Gecode::FloatVal d = exp(x[0]); - if (Gecode::Float::subset(d, dom)) { - x.set(1, d); - return true; - } else { - return false; - } - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { +/// %Tests for transcendental constraints +namespace Test::Float::Transcendental { + + /// Exact fixed-base powers, inverse logarithms, and shared variables + class PowBaseConsistency : public Test { + protected: + Gecode::FloatNum base; + Gecode::FloatNum input; + Gecode::FloatNum output; + bool logarithm; + bool shared; + bool expected; + + public: + PowBaseConsistency(Gecode::FloatNum b, Gecode::FloatNum x, Gecode::FloatNum y, bool log, bool share, bool valid) + : Test("Transcendental::PowBaseConsistency::" + str(b) + "::" + str(x) + "::" + str(y) + + (log ? "::Log" : "::Pow") + (share ? "::Shared" : "::Separate"), + share ? 1 : 2, -4.0, 8.0, 1.0, COMPLETE_ASSIGNMENT, false), + base(b), input(x), output(y), logarithm(log), shared(share), expected(valid) { + test_search = false; + } + /// Check one exact example through the standard posting/assignment tests + Assignment* + assignment() const override { + Assignment* a = new RandomAssignment(arity, dom, 1, _rand); + a->set(0, input); + if (!shared) + a->set(1, output); + return a; + } + /// Use exact expected results instead of computing them with exp/log + MaybeType + solution(const Assignment&) const override { + return expected ? MT_TRUE : MT_FALSE; + } + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::FloatVar y = shared ? x[0] : x[1]; + if (!shared) + Gecode::rel(home, y, Gecode::FRT_GQ, 0.0); + if (logarithm) + Gecode::log(home, base, y, x[0]); + else + Gecode::pow(home, base, x[0], y); + } + }; + + /// Register the exact powers and their logarithmic forms + class PowBaseExamples { + public: + PowBaseExamples() { + for (int logarithm = 0; logarithm < 2; logarithm++) { + (void)new PowBaseConsistency(2.0, 3.0, 8.0, logarithm, false, true); + (void)new PowBaseConsistency(2.0, 3.0, 7.0, logarithm, false, false); + (void)new PowBaseConsistency(0.5, 3.0, 0.125, logarithm, false, true); + (void)new PowBaseConsistency(1.0, 3.0, 1.0, logarithm, false, true); + (void)new PowBaseConsistency(2.0, 0.0, 0.0, logarithm, true, false); + (void)new PowBaseConsistency(0.25, 0.5, 0.5, logarithm, true, true); + } + } + } pow_base_examples; + + /// %Test for exponent constraint + class ExpXY : public Test { + public: + /// Create and register test + ExpXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Transcendental::Exp::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(exp(x[0]), x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + if (flip()) Gecode::exp(home, x[0], x[1]); - } - }; - - /// %Test for exponent constraint with shared variables - class ExpXX : public Test { - public: - /// Create and register test - ExpXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(tags, "Transcendental::Exp::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(exp(x[0]), x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::exp(home, x[0], x[0]); - } - }; - - /// %Test for logarithm constraint - class LogXY : public Test { - public: - /// Create and register test - LogXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Transcendental::Log::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - if (x[0].max() < 0.0) - return MT_FALSE; - return eq(log(x[0]), x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - if (flip()) - Gecode::log(home, x[0], x[1]); - else - Gecode::rel(home, log(x[0]) == x[1]); - } - }; - - /// %Test for logarithm constraint where solution is ensured - class LogXYSol : public Test { - public: - /// Create and register test - LogXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Transcendental::Log::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - if (x[0].max() < 0.0) - return MT_FALSE; - return eq(log(x[0]), x[1]); - } - /// Extend assignment \a x - bool - extend_assignment(Assignment& x) const override { - if (x[0].max() < 0.0) - return false; - Gecode::FloatVal d = log(x[0]); - if (Gecode::Float::subset(d, dom)) { - x.set(1, d); - return true; - } else { - return false; - } - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + else + Gecode::rel(home, exp(x[0]) == x[1]); + } + }; + + /// %Test for exponent constraint where solution is ensured + class ExpXYSol : public Test { + public: + /// Create and register test + ExpXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Transcendental::Exp::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(exp(x[0]), x[1]); + } + /// Extend assignment \a x + bool + extend_assignment(Assignment& x) const override { + Gecode::FloatVal d = exp(x[0]); + if (Gecode::Float::subset(d, dom)) { + x.set(1, d); + return true; + } + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::exp(home, x[0], x[1]); + } + }; + + /// %Test for exponent constraint with shared variables + class ExpXX : public Test { + public: + /// Create and register test + ExpXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags, "Transcendental::Exp::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(exp(x[0]), x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::exp(home, x[0], x[0]); + } + }; + + /// %Test for logarithm constraint + class LogXY : public Test { + public: + /// Create and register test + LogXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Transcendental::Log::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + if (x[0].max() < 0.0) + return MT_FALSE; + return eq(log(x[0]), x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + if (flip()) Gecode::log(home, x[0], x[1]); - } - }; - - /// %Test for logarithm constraint with shared variables - class LogXX : public Test { - public: - /// Create and register test - LogXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(tags, "Transcendental::Log::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - if (x[0].max() < 0.0) - return MT_FALSE; - return eq(log(x[0]), x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::log(home, x[0], x[0]); - } - }; - - /// %Test for logarithm base n constraint - class LogNXY : public Test { - Gecode::FloatNum base; - - public: - /// Create and register test - LogNXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Transcendental::Log::N::" + str(_base) + "::XY::" + s, 2, d, st, - COMPLETE_ASSIGNMENT, false), - base(_base) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - if ((x[0].max() <= 0.0) || (base <= 0.0)) - return MT_FALSE; - return eq(log(x[0]) / log(Gecode::FloatVal(base)), x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::log(home, base, x[0], x[1]); - } - }; - - /// %Test for logarithm base n constraint where solution is ensured - class LogNXYSol : public Test { - Gecode::FloatNum base; - - public: - /// Create and register test - LogNXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Transcendental::Log::N::" + str(_base) + "::XY::Sol::" + s, 2, d, st, - EXTEND_ASSIGNMENT, false), - base(_base) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - if ((x[0].max() <= 0.0) || (base <= 0.0)) - return MT_FALSE; - return eq(log(x[0]) / log(Gecode::FloatVal(base)), x[1]); - } - /// Extend assignment \a x - bool - extend_assignment(Assignment& x) const override { - if ((x[0].max() <= 0.0) || (base <= 0.0)) - return false; - Gecode::FloatVal d = log(x[0]) / log(Gecode::FloatVal(base)); - if (Gecode::Float::subset(d, dom)) { - x.set(1, d); - return true; - } else { - return false; - } - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::log(home, base, x[0], x[1]); - } - }; - - /// %Test for logarithm base n constraint with shared variables - class LogNXX : public Test { - Gecode::FloatNum base; - - public: - /// Create and register test - LogNXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Transcendental::Log::N::" + str(_base) + "::XX::" + s, 1, d, st, - COMPLETE_ASSIGNMENT, false), - base(_base) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - if ((x[0].max() <= 0.0) || (base <= 0.0)) - return MT_FALSE; - return eq(log(x[0]) / log(Gecode::FloatVal(base)), x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::log(home, base, x[0], x[0]); - } - }; - - /// %Test for pow exponent n constraint - class PowXY : public Test { - Gecode::FloatNum base; - - public: - /// Create and register test - PowXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Transcendental::Pow::N::" + str(_base) + "::XY::" + s, 2, d, st, - COMPLETE_ASSIGNMENT, false), - base(_base) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - if (base <= 0.0) - return MT_FALSE; - return eq(exp(x[0] * log(Gecode::FloatVal(base))), x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::pow(home, base, x[0], x[1]); - } - }; - - /// %Test for pow exponent n constraint where solution is ensured - class PowXYSol : public Test { - Gecode::FloatNum base; - - public: - /// Create and register test - PowXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Transcendental::Pow::N::" + str(_base) + "::XY::Sol::" + s, 2, d, st, - EXTEND_ASSIGNMENT, false), - base(_base) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - if (base <= 0.0) - return MT_FALSE; - return eq(exp(x[0] * log(Gecode::FloatVal(base))), x[1]); - } - /// Extend assignment \a x - bool - extend_assignment(Assignment& x) const override { - if (base <= 0.0) - return false; - Gecode::FloatVal d = exp(x[0] * log(Gecode::FloatVal(base))); - if (Gecode::Float::subset(d, dom)) { - x.set(1, d); - return true; - } else { - return false; - } - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::pow(home, base, x[0], x[1]); - } - }; - - /// %Test for pow exponent n constraint with shared variables - class PowXX : public Test { - Gecode::FloatNum base; - - public: - /// Create and register test - PowXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, - Gecode::FloatNum st) - : Test(tags, "Transcendental::Pow::N::" + str(_base) + "::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, - false), - base(_base) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - if ((x[0].max() <= 0.0) || (base <= 0.0)) - return MT_FALSE; - return eq(exp(x[0] * log(Gecode::FloatVal(base))), x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::pow(home, base, x[0], x[0]); - } - }; - - const Gecode::FloatNum step = 0.15; - - Gecode::FloatVal a(-8, 5); - Gecode::FloatVal b(9, 12); - Gecode::FloatVal c(-8, 8); - - ExpXY exp_xy_a("A", a, step); - ExpXY exp_xy_b("B", b, step); - ExpXY exp_xy_c("C", c, step); - - ExpXYSol exp_xy_sol_a("A", a, step); - ExpXYSol exp_xy_sol_b("B", b, step); - ExpXYSol exp_xy_sol_c("C", c, step); - - ExpXX exp_xx_a(TestTags::standard(), "A", a, step); - ExpXX exp_xx_b(TestTags::sweep(), "B", b, step); - ExpXX exp_xx_c(TestTags::sweep(), "C", c, step); - - LogXY log_xy_a("A", a, step); - LogXY log_xy_b("B", b, step); - LogXY log_xy_c("C", c, step); - - LogXYSol log_xy_sol_a("A", a, step); - LogXYSol log_xy_sol_b("B", b, step); - LogXYSol log_xy_sol_c("C", c, step); - - LogXX log_xx_a(TestTags::standard(), "A", a, step); - LogXX log_xx_b(TestTags::sweep(), "B", b, step); - LogXX log_xx_c(TestTags::sweep(), "C", c, step); - - LogNXY logn_xy_a_1("A", a, -1.5, step); - LogNXY logn_xy_b_1("B", b, -1.5, step); - LogNXY logn_xy_c_1("C", c, -1.5, step); - - LogNXYSol logn_xy_sol_a_1("A", a, -1.5, step); - LogNXYSol logn_xy_sol_b_1("B", b, -1.5, step); - LogNXYSol logn_xy_sol_c_1("C", c, -1.5, step); - - LogNXX logn_xx_a_1("A", a, -1.5, step); - LogNXX logn_xx_b_1("B", b, -1.5, step); - LogNXX logn_xx_c_1("C", c, -1.5, step); - - LogNXY logn_xy_a_2("A", a, 1.5, step); - LogNXY logn_xy_b_2("B", b, 1.5, step); - LogNXY logn_xy_c_2("C", c, 1.5, step); - - LogNXYSol logn_xy_sol_a_2("A", a, 1.5, step); - LogNXYSol logn_xy_sol_b_2("B", b, 1.5, step); - LogNXYSol logn_xy_sol_c_2("C", c, 1.5, step); - - LogNXX logn_xx_a_2("A", a, 1.5, step); - LogNXX logn_xx_b_2("B", b, 1.5, step); - LogNXX logn_xx_c_2("C", c, 1.5, step); - - LogNXY logn_xy_a_3("A", a, 0, step); - LogNXY logn_xy_b_3("B", b, 0, step); - LogNXY logn_xy_c_3("C", c, 0, step); - - LogNXYSol logn_xy_sol_a_3("A", a, 0, step); - LogNXYSol logn_xy_sol_b_3("B", b, 0, step); - LogNXYSol logn_xy_sol_c_3("C", c, 0, step); - - LogNXX logn_xx_a_3("A", a, 0, step); - LogNXX logn_xx_b_3("B", b, 0, step); - LogNXX logn_xx_c_3("C", c, 0, step); - - PowXY pow_xy_a_1("A", a, -1.5, step); - PowXY pow_xy_b_1("B", b, -1.5, step); - PowXY pow_xy_c_1("C", c, -1.5, step); - - PowXYSol pow_xy_sol_a_1("A", a, -1.5, step); - PowXYSol pow_xy_sol_b_1("B", b, -1.5, step); - PowXYSol pow_xy_sol_c_1("C", c, -1.5, step); - - PowXX pow_xx_a_1(TestTags::sweep(), "A", a, -1.5, step); - PowXX pow_xx_b_1(TestTags::sweep(), "B", b, -1.5, step); - PowXX pow_xx_c_1(TestTags::sweep(), "C", c, -1.5, step); - - PowXY pow_xy_a_2("A", a, 1.5, step); - PowXY pow_xy_b_2("B", b, 1.5, step); - PowXY pow_xy_c_2("C", c, 1.5, step); - - PowXYSol pow_xy_sol_a_2("A", a, 1.5, step); - PowXYSol pow_xy_sol_b_2("B", b, 1.5, step); - PowXYSol pow_xy_sol_c_2("C", c, 1.5, step); - - PowXX pow_xx_a_2(TestTags::standard(), "A", a, 1.5, step); - PowXX pow_xx_b_2(TestTags::sweep(), "B", b, 1.5, step); - PowXX pow_xx_c_2(TestTags::sweep(), "C", c, 1.5, step); - - PowXY pow_xy_a_3("A", a, 0, step); - PowXY pow_xy_b_3("B", b, 0, step); - PowXY pow_xy_c_3("C", c, 0, step); - - PowXYSol pow_xy_sol_a_3("A", a, 0, step); - PowXYSol pow_xy_sol_b_3("B", b, 0, step); - PowXYSol pow_xy_sol_c_3("C", c, 0, step); + else + Gecode::rel(home, log(x[0]) == x[1]); + } + }; + + /// %Test for logarithm constraint where solution is ensured + class LogXYSol : public Test { + public: + /// Create and register test + LogXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Transcendental::Log::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + if (x[0].max() < 0.0) + return MT_FALSE; + return eq(log(x[0]), x[1]); + } + /// Extend assignment \a x + bool + extend_assignment(Assignment& x) const override { + if (x[0].max() < 0.0) + return false; + Gecode::FloatVal d = log(x[0]); + if (Gecode::Float::subset(d, dom)) { + x.set(1, d); + return true; + } + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::log(home, x[0], x[1]); + } + }; + + /// %Test for logarithm constraint with shared variables + class LogXX : public Test { + public: + /// Create and register test + LogXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags, "Transcendental::Log::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + if (x[0].max() < 0.0) + return MT_FALSE; + return eq(log(x[0]), x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::log(home, x[0], x[0]); + } + }; + + /// %Test for logarithm base n constraint + class LogNXY : public Test { + Gecode::FloatNum base; + + public: + /// Create and register test + LogNXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Transcendental::Log::N::" + str(_base) + "::XY::" + s, 2, d, st, + COMPLETE_ASSIGNMENT, false), + base(_base) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + if ((x[0].max() <= 0.0) || (base <= 0.0)) + return MT_FALSE; + return eq(log(x[0]) / log(Gecode::FloatVal(base)), x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::log(home, base, x[0], x[1]); + } + }; + + /// %Test for logarithm base n constraint where solution is ensured + class LogNXYSol : public Test { + Gecode::FloatNum base; + + public: + /// Create and register test + LogNXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Transcendental::Log::N::" + str(_base) + "::XY::Sol::" + s, 2, d, st, + EXTEND_ASSIGNMENT, false), + base(_base) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + if ((x[0].max() <= 0.0) || (base <= 0.0)) + return MT_FALSE; + return eq(log(x[0]) / log(Gecode::FloatVal(base)), x[1]); + } + /// Extend assignment \a x + bool + extend_assignment(Assignment& x) const override { + if ((x[0].max() <= 0.0) || (base <= 0.0)) + return false; + Gecode::FloatVal d = log(x[0]) / log(Gecode::FloatVal(base)); + if (Gecode::Float::subset(d, dom)) { + x.set(1, d); + return true; + } + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::log(home, base, x[0], x[1]); + } + }; + + /// %Test for logarithm base n constraint with shared variables + class LogNXX : public Test { + Gecode::FloatNum base; + + public: + /// Create and register test + LogNXX(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Transcendental::Log::N::" + str(_base) + "::XX::" + s, 1, d, st, + COMPLETE_ASSIGNMENT, false), + base(_base) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + if ((x[0].max() <= 0.0) || (base <= 0.0)) + return MT_FALSE; + return eq(log(x[0]) / log(Gecode::FloatVal(base)), x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::log(home, base, x[0], x[0]); + } + }; + + /// %Test for pow exponent n constraint + class PowXY : public Test { + Gecode::FloatNum base; + + public: + /// Create and register test + PowXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Transcendental::Pow::N::" + str(_base) + "::XY::" + s, 2, d, st, + COMPLETE_ASSIGNMENT, false), + base(_base) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + if (base <= 0.0) + return MT_FALSE; + return eq(exp(x[0] * log(Gecode::FloatVal(base))), x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::pow(home, base, x[0], x[1]); + } + }; + + /// %Test for pow exponent n constraint where solution is ensured + class PowXYSol : public Test { + Gecode::FloatNum base; + + public: + /// Create and register test + PowXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Transcendental::Pow::N::" + str(_base) + "::XY::Sol::" + s, 2, d, st, + EXTEND_ASSIGNMENT, false), + base(_base) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + if (base <= 0.0) + return MT_FALSE; + return eq(exp(x[0] * log(Gecode::FloatVal(base))), x[1]); + } + /// Extend assignment \a x + bool + extend_assignment(Assignment& x) const override { + if (base <= 0.0) + return false; + Gecode::FloatVal d = exp(x[0] * log(Gecode::FloatVal(base))); + if (Gecode::Float::subset(d, dom)) { + x.set(1, d); + return true; + } + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::pow(home, base, x[0], x[1]); + } + }; + + /// %Test for pow exponent n constraint with shared variables + class PowXX : public Test { + Gecode::FloatNum base; + + public: + /// Create and register test + PowXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum _base, + Gecode::FloatNum st) + : Test(tags, "Transcendental::Pow::N::" + str(_base) + "::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false), + base(_base) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + if ((x[0].max() <= 0.0) || (base <= 0.0)) + return MT_FALSE; + return eq(exp(x[0] * log(Gecode::FloatVal(base))), x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::pow(home, base, x[0], x[0]); + } + }; + + const Gecode::FloatNum step = 0.15; + + Gecode::FloatVal a(-8, 5); + Gecode::FloatVal b(9, 12); + Gecode::FloatVal c(-8, 8); + + ExpXY exp_xy_a("A", a, step); + ExpXY exp_xy_b("B", b, step); + ExpXY exp_xy_c("C", c, step); + + ExpXYSol exp_xy_sol_a("A", a, step); + ExpXYSol exp_xy_sol_b("B", b, step); + ExpXYSol exp_xy_sol_c("C", c, step); + + ExpXX exp_xx_a(TestTags::standard(), "A", a, step); + ExpXX exp_xx_b(TestTags::sweep(), "B", b, step); + ExpXX exp_xx_c(TestTags::sweep(), "C", c, step); + + LogXY log_xy_a("A", a, step); + LogXY log_xy_b("B", b, step); + LogXY log_xy_c("C", c, step); + + LogXYSol log_xy_sol_a("A", a, step); + LogXYSol log_xy_sol_b("B", b, step); + LogXYSol log_xy_sol_c("C", c, step); + + LogXX log_xx_a(TestTags::standard(), "A", a, step); + LogXX log_xx_b(TestTags::sweep(), "B", b, step); + LogXX log_xx_c(TestTags::sweep(), "C", c, step); + + LogNXY logn_xy_a_1("A", a, -1.5, step); + LogNXY logn_xy_b_1("B", b, -1.5, step); + LogNXY logn_xy_c_1("C", c, -1.5, step); + + LogNXYSol logn_xy_sol_a_1("A", a, -1.5, step); + LogNXYSol logn_xy_sol_b_1("B", b, -1.5, step); + LogNXYSol logn_xy_sol_c_1("C", c, -1.5, step); + + LogNXX logn_xx_a_1("A", a, -1.5, step); + LogNXX logn_xx_b_1("B", b, -1.5, step); + LogNXX logn_xx_c_1("C", c, -1.5, step); + + LogNXY logn_xy_a_2("A", a, 1.5, step); + LogNXY logn_xy_b_2("B", b, 1.5, step); + LogNXY logn_xy_c_2("C", c, 1.5, step); + + LogNXYSol logn_xy_sol_a_2("A", a, 1.5, step); + LogNXYSol logn_xy_sol_b_2("B", b, 1.5, step); + LogNXYSol logn_xy_sol_c_2("C", c, 1.5, step); + + LogNXX logn_xx_a_2("A", a, 1.5, step); + LogNXX logn_xx_b_2("B", b, 1.5, step); + LogNXX logn_xx_c_2("C", c, 1.5, step); + + LogNXY logn_xy_a_3("A", a, 0, step); + LogNXY logn_xy_b_3("B", b, 0, step); + LogNXY logn_xy_c_3("C", c, 0, step); + + LogNXYSol logn_xy_sol_a_3("A", a, 0, step); + LogNXYSol logn_xy_sol_b_3("B", b, 0, step); + LogNXYSol logn_xy_sol_c_3("C", c, 0, step); + + LogNXX logn_xx_a_3("A", a, 0, step); + LogNXX logn_xx_b_3("B", b, 0, step); + LogNXX logn_xx_c_3("C", c, 0, step); + + PowXY pow_xy_a_1("A", a, -1.5, step); + PowXY pow_xy_b_1("B", b, -1.5, step); + PowXY pow_xy_c_1("C", c, -1.5, step); + + PowXYSol pow_xy_sol_a_1("A", a, -1.5, step); + PowXYSol pow_xy_sol_b_1("B", b, -1.5, step); + PowXYSol pow_xy_sol_c_1("C", c, -1.5, step); + + PowXX pow_xx_a_1(TestTags::sweep(), "A", a, -1.5, step); + PowXX pow_xx_b_1(TestTags::sweep(), "B", b, -1.5, step); + PowXX pow_xx_c_1(TestTags::sweep(), "C", c, -1.5, step); + + PowXY pow_xy_a_2("A", a, 1.5, step); + PowXY pow_xy_b_2("B", b, 1.5, step); + PowXY pow_xy_c_2("C", c, 1.5, step); + + PowXYSol pow_xy_sol_a_2("A", a, 1.5, step); + PowXYSol pow_xy_sol_b_2("B", b, 1.5, step); + PowXYSol pow_xy_sol_c_2("C", c, 1.5, step); + + PowXX pow_xx_a_2(TestTags::standard(), "A", a, 1.5, step); + PowXX pow_xx_b_2(TestTags::sweep(), "B", b, 1.5, step); + PowXX pow_xx_c_2(TestTags::sweep(), "C", c, 1.5, step); + + PowXY pow_xy_a_3("A", a, 0, step); + PowXY pow_xy_b_3("B", b, 0, step); + PowXY pow_xy_c_3("C", c, 0, step); - PowXX pow_xx_a_3(TestTags::sweep(), "A", a, 0, step); - PowXX pow_xx_b_3(TestTags::sweep(), "B", b, 0, step); - PowXX pow_xx_c_3(TestTags::sweep(), "C", c, 0, step); + PowXYSol pow_xy_sol_a_3("A", a, 0, step); + PowXYSol pow_xy_sol_b_3("B", b, 0, step); + PowXYSol pow_xy_sol_c_3("C", c, 0, step); - //@} + PowXX pow_xx_a_3(TestTags::sweep(), "A", a, 0, step); + PowXX pow_xx_b_3(TestTags::sweep(), "B", b, 0, step); + PowXX pow_xx_c_3(TestTags::sweep(), "C", c, 0, step); - } // namespace Transcendental -}} // namespace Test::Float + //@} +} // namespace Test::Float::Transcendental #endif // STATISTICS: test-float diff --git a/test/float/trigonometric.cpp b/test/float/trigonometric.cpp index 27b00900b9..9fe657e238 100644 --- a/test/float/trigonometric.cpp +++ b/test/float/trigonometric.cpp @@ -40,517 +40,507 @@ #include #include -namespace Test { namespace Float { - - /// %Tests for trigonometric constraints - namespace Trigonometric { - - /// %Test for sinus constraint - class SinXY : public Test { - public: - /// Create and register test - SinXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Trigonometric::Sin::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(sin(x[0]), x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - if (flip()) - Gecode::sin(home, x[0], x[1]); - else - Gecode::rel(home, sin(x[0]) == x[1]); - } - }; - - /// %Test for sinus constraint where solution is ensured - class SinXYSol : public Test { - public: - /// Create and register test - SinXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Trigonometric::Sin::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(sin(x[0]), x[1]); - } - /// Extend assignment \a x - bool - extend_assignment(Assignment& x) const override { - Gecode::FloatVal d = sin(x[0]); - if (Gecode::Float::subset(d, dom)) { - x.set(1, d); - return true; - } else { - return false; - } - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { +/// %Tests for trigonometric constraints +namespace Test::Float::Trigonometric { + + /// %Test for sinus constraint + class SinXY : public Test { + public: + /// Create and register test + SinXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Trigonometric::Sin::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(sin(x[0]), x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + if (flip()) Gecode::sin(home, x[0], x[1]); - } - }; - - /// %Test for sinus constraint with shared variables - class SinXX : public Test { - public: - /// Create and register test - SinXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(tags, "Trigonometric::Sin::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(sin(x[0]), x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::sin(home, x[0], x[0]); - } - }; - - /// %Test for cosinus constraint - class CosXY : public Test { - public: - /// Create and register test - CosXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Trigonometric::Cos::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(cos(x[0]), x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - if (flip()) - Gecode::cos(home, x[0], x[1]); - else - Gecode::rel(home, cos(x[0]) == x[1]); - } - }; - - /// %Test for cosinus constraint where solution is ensured - class CosXYSol : public Test { - public: - /// Create and register test - CosXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Trigonometric::Cos::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(cos(x[0]), x[1]); - } - /// Extend assignment \a x - bool - extend_assignment(Assignment& x) const override { - Gecode::FloatVal d = cos(x[0]); - if (Gecode::Float::subset(d, dom)) { - x.set(1, d); - return true; - } else { - return false; - } - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + else + Gecode::rel(home, sin(x[0]) == x[1]); + } + }; + + /// %Test for sinus constraint where solution is ensured + class SinXYSol : public Test { + public: + /// Create and register test + SinXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Trigonometric::Sin::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(sin(x[0]), x[1]); + } + /// Extend assignment \a x + bool + extend_assignment(Assignment& x) const override { + Gecode::FloatVal d = sin(x[0]); + if (Gecode::Float::subset(d, dom)) { + x.set(1, d); + return true; + } + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::sin(home, x[0], x[1]); + } + }; + + /// %Test for sinus constraint with shared variables + class SinXX : public Test { + public: + /// Create and register test + SinXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags, "Trigonometric::Sin::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(sin(x[0]), x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::sin(home, x[0], x[0]); + } + }; + + /// %Test for cosinus constraint + class CosXY : public Test { + public: + /// Create and register test + CosXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Trigonometric::Cos::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(cos(x[0]), x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + if (flip()) Gecode::cos(home, x[0], x[1]); - } - }; - - /// %Test for cosinus constraint with shared variables - class CosXX : public Test { - public: - /// Create and register test - CosXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(tags, "Trigonometric::Cos::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(cos(x[0]), x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::cos(home, x[0], x[0]); - } - }; - - /// %Test for tangent constraint - class TanXY : public Test { - public: - /// Create and register test - TanXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Trigonometric::Tan::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(tan(x[0]), x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - if (flip()) - Gecode::tan(home, x[0], x[1]); - else - Gecode::rel(home, tan(x[0]) == x[1]); - } - }; - - /// %Test for tangent constraint where solution is ensured - class TanXYSol : public Test { - public: - /// Create and register test - TanXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Trigonometric::Tan::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(tan(x[0]), x[1]); - } - /// Extend assignment \a x - bool - extend_assignment(Assignment& x) const override { - Gecode::FloatVal d = tan(x[0]); - if (Gecode::Float::subset(d, dom)) { - x.set(1, d); - return true; - } else { - return false; - } - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + else + Gecode::rel(home, cos(x[0]) == x[1]); + } + }; + + /// %Test for cosinus constraint where solution is ensured + class CosXYSol : public Test { + public: + /// Create and register test + CosXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Trigonometric::Cos::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(cos(x[0]), x[1]); + } + /// Extend assignment \a x + bool + extend_assignment(Assignment& x) const override { + Gecode::FloatVal d = cos(x[0]); + if (Gecode::Float::subset(d, dom)) { + x.set(1, d); + return true; + } + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::cos(home, x[0], x[1]); + } + }; + + /// %Test for cosinus constraint with shared variables + class CosXX : public Test { + public: + /// Create and register test + CosXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags, "Trigonometric::Cos::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(cos(x[0]), x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::cos(home, x[0], x[0]); + } + }; + + /// %Test for tangent constraint + class TanXY : public Test { + public: + /// Create and register test + TanXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Trigonometric::Tan::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(tan(x[0]), x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + if (flip()) Gecode::tan(home, x[0], x[1]); - } - }; - - /// %Test for tangent constraint with shared variables - class TanXX : public Test { - public: - /// Create and register test - TanXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(tags, "Trigonometric::Tan::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(tan(x[0]), x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::tan(home, x[0], x[0]); - } - }; - - /// %Test for asinus constraint - class ASinXY : public Test { - public: - /// Create and register test - ASinXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Trigonometric::ASin::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) - return MT_FALSE; - return eq(asin(x[0]), x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - if (flip()) - Gecode::asin(home, x[0], x[1]); - else - Gecode::rel(home, asin(x[0]) == x[1]); - } - }; - - /// %Test for asinus constraint where solution is ensured - class ASinXYSol : public Test { - public: - /// Create and register test - ASinXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Trigonometric::ASin::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) - return MT_FALSE; - return eq(asin(x[0]), x[1]); - } - /// Extend assignment \a x - bool - extend_assignment(Assignment& x) const override { - if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) - return false; - Gecode::FloatVal d = asin(x[0]); - if (Gecode::Float::subset(d, dom)) { - x.set(1, d); - return true; - } else { - return false; - } - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + else + Gecode::rel(home, tan(x[0]) == x[1]); + } + }; + + /// %Test for tangent constraint where solution is ensured + class TanXYSol : public Test { + public: + /// Create and register test + TanXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Trigonometric::Tan::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(tan(x[0]), x[1]); + } + /// Extend assignment \a x + bool + extend_assignment(Assignment& x) const override { + Gecode::FloatVal d = tan(x[0]); + if (Gecode::Float::subset(d, dom)) { + x.set(1, d); + return true; + } + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::tan(home, x[0], x[1]); + } + }; + + /// %Test for tangent constraint with shared variables + class TanXX : public Test { + public: + /// Create and register test + TanXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags, "Trigonometric::Tan::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(tan(x[0]), x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::tan(home, x[0], x[0]); + } + }; + + /// %Test for asinus constraint + class ASinXY : public Test { + public: + /// Create and register test + ASinXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Trigonometric::ASin::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) + return MT_FALSE; + return eq(asin(x[0]), x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + if (flip()) Gecode::asin(home, x[0], x[1]); - } - }; - - /// %Test for asinus constraint with shared variables - class ASinXX : public Test { - public: - /// Create and register test - ASinXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(tags, "Trigonometric::ASin::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) - return MT_FALSE; - return eq(asin(x[0]), x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::asin(home, x[0], x[0]); - } - }; - - /// %Test for acosinus constraint - class ACosXY : public Test { - public: - /// Create and register test - ACosXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Trigonometric::ACos::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) - return MT_FALSE; - return eq(acos(x[0]), x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - if (flip()) - Gecode::acos(home, x[0], x[1]); - else - Gecode::rel(home, acos(x[0]) == x[1]); - } - }; - - /// %Test for acosinus constraint where solution is ensured - class ACosXYSol : public Test { - public: - /// Create and register test - ACosXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Trigonometric::ACos::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) - return MT_FALSE; - return eq(acos(x[0]), x[1]); - } - /// Extend assignment \a x - bool - extend_assignment(Assignment& x) const override { - if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) - return false; - Gecode::FloatVal d = acos(x[0]); - if (Gecode::Float::subset(d, dom)) { - x.set(1, d); - return true; - } else { - return false; - } - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + else + Gecode::rel(home, asin(x[0]) == x[1]); + } + }; + + /// %Test for asinus constraint where solution is ensured + class ASinXYSol : public Test { + public: + /// Create and register test + ASinXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Trigonometric::ASin::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) + return MT_FALSE; + return eq(asin(x[0]), x[1]); + } + /// Extend assignment \a x + bool + extend_assignment(Assignment& x) const override { + if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) + return false; + Gecode::FloatVal d = asin(x[0]); + if (Gecode::Float::subset(d, dom)) { + x.set(1, d); + return true; + } + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::asin(home, x[0], x[1]); + } + }; + + /// %Test for asinus constraint with shared variables + class ASinXX : public Test { + public: + /// Create and register test + ASinXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags, "Trigonometric::ASin::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) + return MT_FALSE; + return eq(asin(x[0]), x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::asin(home, x[0], x[0]); + } + }; + + /// %Test for acosinus constraint + class ACosXY : public Test { + public: + /// Create and register test + ACosXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Trigonometric::ACos::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) + return MT_FALSE; + return eq(acos(x[0]), x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + if (flip()) Gecode::acos(home, x[0], x[1]); - } - }; - - /// %Test for acosinus constraint with shared variables - class ACosXX : public Test { - public: - /// Create and register test - ACosXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(tags, "Trigonometric::ACos::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) - return MT_FALSE; - return eq(acos(x[0]), x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::acos(home, x[0], x[0]); - } - }; - - /// %Test for atangent constraint - class ATanXY : public Test { - public: - /// Create and register test - ATanXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Trigonometric::ATan::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(atan(x[0]), x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - if (flip()) - Gecode::atan(home, x[0], x[1]); - else - Gecode::rel(home, atan(x[0]) == x[1]); - } - }; - - /// %Test for atangent constraint where solution is ensured - class ATanXYSol : public Test { - public: - /// Create and register test - ATanXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(TestTags::sweep(), "Trigonometric::ATan::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(atan(x[0]), x[1]); - } - /// Extend assignment \a x - bool - extend_assignment(Assignment& x) const override { - Gecode::FloatVal d = atan(x[0]); - if (Gecode::Float::subset(d, dom)) { - x.set(1, d); - return true; - } else { - return false; - } - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + else + Gecode::rel(home, acos(x[0]) == x[1]); + } + }; + + /// %Test for acosinus constraint where solution is ensured + class ACosXYSol : public Test { + public: + /// Create and register test + ACosXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Trigonometric::ACos::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) + return MT_FALSE; + return eq(acos(x[0]), x[1]); + } + /// Extend assignment \a x + bool + extend_assignment(Assignment& x) const override { + if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) + return false; + Gecode::FloatVal d = acos(x[0]); + if (Gecode::Float::subset(d, dom)) { + x.set(1, d); + return true; + } + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::acos(home, x[0], x[1]); + } + }; + + /// %Test for acosinus constraint with shared variables + class ACosXX : public Test { + public: + /// Create and register test + ACosXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags, "Trigonometric::ACos::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + if ((x[0].min() > 1.0) || (x[0].max() < -1.0)) + return MT_FALSE; + return eq(acos(x[0]), x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::acos(home, x[0], x[0]); + } + }; + + /// %Test for atangent constraint + class ATanXY : public Test { + public: + /// Create and register test + ATanXY(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Trigonometric::ATan::XY::" + s, 2, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(atan(x[0]), x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + if (flip()) Gecode::atan(home, x[0], x[1]); - } - }; - - /// %Test for atangent constraint with shared variables - class ATanXX : public Test { - public: - /// Create and register test - ATanXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) - : Test(tags, "Trigonometric::ATan::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} - /// %Test whether \a x is solution - MaybeType - solution(const Assignment& x) const override { - return eq(atan(x[0]), x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::FloatVarArray& x) override { - Gecode::atan(home, x[0], x[0]); - } - }; - - const Gecode::FloatNum step = 0.15; - - Gecode::FloatVal a(-8, 5); - Gecode::FloatVal b(9, 12); - Gecode::FloatVal c(-8, 8); - - SinXY sin_xy_a("A", a, step); - SinXY sin_xy_b("B", b, step); - SinXY sin_xy_c("C", c, step); - - SinXYSol sin_xy_sol_a("A", a, step); - SinXYSol sin_xy_sol_b("B", b, step); - SinXYSol sin_xy_sol_c("C", c, step); - - SinXX sin_xx_a(TestTags::standard(), "A", a, step); - SinXX sin_xx_b(TestTags::sweep(), "B", b, step); - SinXX sin_xx_c(TestTags::sweep(), "C", c, step); - - CosXY cos_xy_a("A", a, step); - CosXY cos_xy_b("B", b, step); - CosXY cos_xy_c("C", c, step); - - CosXYSol cos_xy_sol_a("A", a, step); - CosXYSol cos_xy_sol_b("B", b, step); - CosXYSol cos_xy_sol_c("C", c, step); - - CosXX cos_xx_a(TestTags::standard(), "A", a, step); - CosXX cos_xx_b(TestTags::sweep(), "B", b, step); - CosXX cos_xx_c(TestTags::sweep(), "C", c, step); - - TanXY tan_xy_a("A", a, step); - TanXY tan_xy_b("B", b, step); - TanXY tan_xy_c("C", c, step); - - TanXYSol tan_xy_sol_a("A", a, step); - TanXYSol tan_xy_sol_b("B", b, step); - TanXYSol tan_xy_sol_c("C", c, step); - - TanXX tan_xx_a(TestTags::standard(), "A", a, step); - TanXX tan_xx_b(TestTags::sweep(), "B", b, step); - TanXX tan_xx_c(TestTags::sweep(), "C", c, step); - - ASinXY asin_xy_a("A", a, step); - ASinXY asin_xy_b("B", b, step); - ASinXY asin_xy_c("C", c, step); - - ASinXYSol asin_xy_sol_a("A", a, step); - ASinXYSol asin_xy_sol_b("B", b, step); - ASinXYSol asin_xy_sol_c("C", c, step); - - ASinXX asin_xx_a(TestTags::standard(), "A", a, step); - ASinXX asin_xx_b(TestTags::sweep(), "B", b, step); - ASinXX asin_xx_c(TestTags::sweep(), "C", c, step); - - ACosXY acos_xy_a("A", a, step); - ACosXY acos_xy_b("B", b, step); - ACosXY acos_xy_c("C", c, step); - - ACosXYSol acos_xy_sol_a("A", a, step); - ACosXYSol acos_xy_sol_b("B", b, step); - ACosXYSol acos_xy_sol_c("C", c, step); - - ACosXX acos_xx_a(TestTags::standard(), "A", a, step); - ACosXX acos_xx_b(TestTags::sweep(), "B", b, step); - ACosXX acos_xx_c(TestTags::sweep(), "C", c, step); - - ATanXY atan_xy_a("A", a, step); - ATanXY atan_xy_b("B", b, step); - ATanXY atan_xy_c("C", c, step); - - ATanXYSol atan_xy_sol_a("A", a, step); - ATanXYSol atan_xy_sol_b("B", b, step); - ATanXYSol atan_xy_sol_c("C", c, step); - - ATanXX atan_xx_a(TestTags::standard(), "A", a, step); - ATanXX atan_xx_b(TestTags::sweep(), "B", b, step); - ATanXX atan_xx_c(TestTags::sweep(), "C", c, step); - - //@} - - } // namespace Trigonometric -}} // namespace Test::Float - + else + Gecode::rel(home, atan(x[0]) == x[1]); + } + }; + + /// %Test for atangent constraint where solution is ensured + class ATanXYSol : public Test { + public: + /// Create and register test + ATanXYSol(const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(TestTags::sweep(), "Trigonometric::ATan::XY::Sol::" + s, 2, d, st, EXTEND_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(atan(x[0]), x[1]); + } + /// Extend assignment \a x + bool + extend_assignment(Assignment& x) const override { + Gecode::FloatVal d = atan(x[0]); + if (Gecode::Float::subset(d, dom)) { + x.set(1, d); + return true; + } + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::atan(home, x[0], x[1]); + } + }; + + /// %Test for atangent constraint with shared variables + class ATanXX : public Test { + public: + /// Create and register test + ATanXX(TestTags tags, const std::string& s, const Gecode::FloatVal& d, Gecode::FloatNum st) + : Test(tags, "Trigonometric::ATan::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, false) {} + /// %Test whether \a x is solution + MaybeType + solution(const Assignment& x) const override { + return eq(atan(x[0]), x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::FloatVarArray& x) override { + Gecode::atan(home, x[0], x[0]); + } + }; + + const Gecode::FloatNum step = 0.15; + + Gecode::FloatVal a(-8, 5); + Gecode::FloatVal b(9, 12); + Gecode::FloatVal c(-8, 8); + + SinXY sin_xy_a("A", a, step); + SinXY sin_xy_b("B", b, step); + SinXY sin_xy_c("C", c, step); + + SinXYSol sin_xy_sol_a("A", a, step); + SinXYSol sin_xy_sol_b("B", b, step); + SinXYSol sin_xy_sol_c("C", c, step); + + SinXX sin_xx_a(TestTags::standard(), "A", a, step); + SinXX sin_xx_b(TestTags::sweep(), "B", b, step); + SinXX sin_xx_c(TestTags::sweep(), "C", c, step); + + CosXY cos_xy_a("A", a, step); + CosXY cos_xy_b("B", b, step); + CosXY cos_xy_c("C", c, step); + + CosXYSol cos_xy_sol_a("A", a, step); + CosXYSol cos_xy_sol_b("B", b, step); + CosXYSol cos_xy_sol_c("C", c, step); + + CosXX cos_xx_a(TestTags::standard(), "A", a, step); + CosXX cos_xx_b(TestTags::sweep(), "B", b, step); + CosXX cos_xx_c(TestTags::sweep(), "C", c, step); + + TanXY tan_xy_a("A", a, step); + TanXY tan_xy_b("B", b, step); + TanXY tan_xy_c("C", c, step); + + TanXYSol tan_xy_sol_a("A", a, step); + TanXYSol tan_xy_sol_b("B", b, step); + TanXYSol tan_xy_sol_c("C", c, step); + + TanXX tan_xx_a(TestTags::standard(), "A", a, step); + TanXX tan_xx_b(TestTags::sweep(), "B", b, step); + TanXX tan_xx_c(TestTags::sweep(), "C", c, step); + + ASinXY asin_xy_a("A", a, step); + ASinXY asin_xy_b("B", b, step); + ASinXY asin_xy_c("C", c, step); + + ASinXYSol asin_xy_sol_a("A", a, step); + ASinXYSol asin_xy_sol_b("B", b, step); + ASinXYSol asin_xy_sol_c("C", c, step); + + ASinXX asin_xx_a(TestTags::standard(), "A", a, step); + ASinXX asin_xx_b(TestTags::sweep(), "B", b, step); + ASinXX asin_xx_c(TestTags::sweep(), "C", c, step); + + ACosXY acos_xy_a("A", a, step); + ACosXY acos_xy_b("B", b, step); + ACosXY acos_xy_c("C", c, step); + + ACosXYSol acos_xy_sol_a("A", a, step); + ACosXYSol acos_xy_sol_b("B", b, step); + ACosXYSol acos_xy_sol_c("C", c, step); + + ACosXX acos_xx_a(TestTags::standard(), "A", a, step); + ACosXX acos_xx_b(TestTags::sweep(), "B", b, step); + ACosXX acos_xx_c(TestTags::sweep(), "C", c, step); + + ATanXY atan_xy_a("A", a, step); + ATanXY atan_xy_b("B", b, step); + ATanXY atan_xy_c("C", c, step); + + ATanXYSol atan_xy_sol_a("A", a, step); + ATanXYSol atan_xy_sol_b("B", b, step); + ATanXYSol atan_xy_sol_c("C", c, step); + + ATanXX atan_xx_a(TestTags::standard(), "A", a, step); + ATanXX atan_xx_b(TestTags::sweep(), "B", b, step); + ATanXX atan_xx_c(TestTags::sweep(), "C", c, step); + + //@} + +} // namespace Test::Float::Trigonometric #endif // STATISTICS: test-float diff --git a/test/groups.cpp b/test/groups.cpp index 509dbbf7a8..f23dbfd563 100644 --- a/test/groups.cpp +++ b/test/groups.cpp @@ -35,7 +35,7 @@ #include "test/test.hh" -namespace Test { namespace Groups { +namespace Test::Groups { /// Test space class GroupSpace : public Gecode::Space { @@ -66,7 +66,7 @@ namespace Test { namespace Groups { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new GroupSpace(*this); } }; @@ -88,7 +88,7 @@ namespace Test { namespace Groups { all(all0) {} /// Perform actual tests bool - run(void) override { + run() override { using namespace Gecode; GroupSpace* s = new GroupSpace(n); if (fix) @@ -110,10 +110,10 @@ namespace Test { namespace Groups { class Compare : public Test::Base { public: /// Initialize test - Compare(void) : Test::Base("Group::Compare") {} + Compare() : Test::Base("Group::Compare") {} /// Perform actual tests bool - run(void) override { + run() override { using namespace Gecode; PropagatorGroup p, q; PropagatorGroup p_copy(p); @@ -131,7 +131,7 @@ namespace Test { namespace Groups { class Create { public: /// Perform creation and registration - Create(void) { + Create() { for (int n = 0; n <= 2; n++) { (void)new Kill(n, true, false); (void)new Kill(n, false, false); @@ -143,6 +143,6 @@ namespace Test { namespace Groups { Create c; -}} // namespace Test::Groups +} // namespace Test::Groups // STATISTICS: test-core diff --git a/test/instance.cpp b/test/instance.cpp index 2ed8be1c5a..a6ad9c22a9 100644 --- a/test/instance.cpp +++ b/test/instance.cpp @@ -40,12 +40,13 @@ #include #include #include +#include #include #include #include #include -namespace Test { namespace Instance { +namespace Test::Instance { using Gecode::IntArgs; using Gecode::Instance::Data; @@ -59,18 +60,18 @@ namespace Test { namespace Instance { */ /// Read \a text with the spec \a spec - Data + static Data read(const char* spec, const char* text, const Params& p = Params()) { return Spec::parse(spec, "test.reader").read_text(text, "test.txt", p); } /// Check that \a f throws an Error whose message contains \a what - bool - fails(const std::function& f, const char* what) { + static bool + fails(const std::function& f, const char* what) { try { f(); } catch (const Error& e) { - if (std::string(e.what()).find(what) != std::string::npos) + if (std::string(e.what()).contains(what)) return true; olog << "unexpected error message:\n" << e.what() << "\n"; return false; @@ -80,19 +81,19 @@ namespace Test { namespace Instance { } /// Check that reading \a text with \a spec fails with \a what - bool + static bool fails(const char* spec, const char* text, const char* what) { - return fails([&](void) { (void)read(spec, text); }, what); + return fails([&]() { (void)read(spec, text); }, what); } /// Check that parsing \a spec fails with \a what - bool + static bool rejects(const char* spec, const char* what) { - return fails([&](void) { (void)Spec::parse(spec, "s"); }, what); + return fails([&]() { (void)Spec::parse(spec, "s"); }, what); } /// Compare integer array \a a with the values \a v - bool + static bool equal(const IntArgs& a, std::initializer_list v) { if (a.size() != static_cast(v.size())) return false; @@ -113,14 +114,14 @@ namespace Test { namespace Instance { class Case : public Base { protected: /// The test - std::function f; + std::function f; public: /// Create test \a n running \a f0 - Case(const std::string& n, std::function f0) : Base("Instance::" + n), f(std::move(f0)) {} + Case(const std::string& n, std::function f0) : Base("Instance::" + n), f(std::move(f0)) {} /// Run the test bool - run(void) override { + run() override { try { return f(); } catch (const Error& e) { @@ -130,7 +131,7 @@ namespace Test { namespace Instance { } }; - Case scalars("Read::Scalars", [](void) { + Case scalars("Read::Scalars", []() { Data d = read("a: int b: float c: num e: num w: word r: rest", " -7 2.5\n 3 4.5e1 hello the rest \n"); CHECK(d.integer("a") == -7); CHECK(d.number("b") == 2.5); @@ -144,7 +145,7 @@ namespace Test { namespace Instance { return true; }); - Case arrays("Read::Arrays", [](void) { + Case arrays("Read::Arrays", []() { Data d = read("n: int m: int a[n][m]: int _: int f[2]: float offset 1", "2 3\n1 2\n3 4 5 6\n99 1.5 2"); CHECK(d.depth("a") == 2); CHECK(d.size("a") == 2); @@ -158,7 +159,7 @@ namespace Test { namespace Instance { return true; }); - Case layouts("Read::Layouts", [](void) { + Case layouts("Read::Layouts", []() { // The symmetric matrix 0 1 2 / 1 0 3 / 2 3 0 in all layouts const char* spec = "f: word w[3][3]: int layout f"; const char* inputs[] = { @@ -185,7 +186,7 @@ namespace Test { namespace Instance { return fails(spec, "DIAGONAL 1 2 3", "unknown matrix layout"); }); - Case lists("Read::Lists", [](void) { + Case lists("Read::Lists", []() { Data d = read("list a: int until 0 list b: int until eol list c: int until eol list w: word until \"END\"", "1 2\n 3 0 4 5\n6 7\nx y END"); CHECK(equal(d.ints("a"), {1, 2, 3})); @@ -196,7 +197,7 @@ namespace Test { namespace Instance { return true; }); - Case patterns("Read::Patterns", [](void) { + Case patterns("Read::Patterns", []() { Data d = read("line \"# size={n:int} box={w:int}x{h:int}\"\n" "find \"NAME : {name:rest}\"\n" "line \"p {_} {v:int} {c:num} ...\"", @@ -213,7 +214,7 @@ namespace Test { namespace Instance { return true; }); - Case params("Read::Params", [](void) { + Case params("Read::Params", []() { const char* spec = "param which param k = 2\n" "find \"instance {$which}\" x[k]: int ignore trailing"; const char* text = "instance a\n1 2\ninstance b\n3 4\n"; @@ -230,13 +231,13 @@ namespace Test { namespace Instance { r.set("which=a,,k=1,"); CHECK(equal(read(spec, text, r).ints("x"), {1})); CHECK(fails( - [](void) { + []() { Params e; e.set("which=a,k"); }, "parameter 'k' must have the form name=value")); CHECK(fails( - [](void) { + []() { Params e; e.set("=a"); }, @@ -244,7 +245,7 @@ namespace Test { namespace Instance { return fails(spec, text, "parameter 'which' must be given"); }); - Case repeats("Read::Repeat", [](void) { + Case repeats("Read::Repeat", []() { Data d = read("n: int\n" "repeat n { index 1 k: int s[k]: int offset -1 }\n" "repeat until \"999\" { a: int }\n" @@ -272,7 +273,7 @@ namespace Test { namespace Instance { return true; }); - Case sections("Read::Sections", [](void) { + Case sections("Read::Sections", []() { const char* spec = "sections until \"EOF\" {\n" " \"N : {n:int}\"\n" " \"DATA\" { x[n]: int }\n" @@ -293,22 +294,22 @@ namespace Test { namespace Instance { "test.txt:4:1: a second line matching \"N : {n:int}\" (the first is on line 1)")); CHECK(fails(spec, "NAME : a\nN : 1\nDATA\n4\nNAME : b\n", "a second line matching \"NAME : {name:word}\"")); // A last arm ends the statement, and may be optional - const char* last = "sections { \"a {a:int}\" \"end\" last } y: int"; + const char* last = R"(sections { "a {a:int}" "end" last } y: int)"; CHECK(read(last, "a 1\nend\n5").integer("y") == 5); CHECK(fails(last, "a 1\n5", "expected one of")); CHECK(fails(last, "a 1", "expected a line matching \"end\" before the end of the input")); CHECK(fails(last, "end\n5", "test.txt:1:1: expected a line matching \"a {a:int}\" before the line matching \"end\"")); - const char* optional_last = "sections { \"a {a:int}\" \"end\" optional last }"; + const char* optional_last = R"(sections { "a {a:int}" "end" optional last })"; CHECK(read(optional_last, "a 1").integer("a") == 1); CHECK(read(optional_last, "a 1\nend").integer("a") == 1); return true; }); - Case alphabets("Read::Alphabets", [](void) { - Data d = read("g[2][3]: alphabet \"123ABC\" blank \".\"", "1.A\nC 2 ."); + Case alphabets("Read::Alphabets", []() { + Data d = read(R"(g[2][3]: alphabet "123ABC" blank ".")", "1.A\nC 2 ."); CHECK(equal(d.ints("g"), {1, 0, 4, 6, 2, 0})); - Data e = read("g[2][2]: alphabet \"ab\" base 0 strip \"|-\"", "a|b\n---\nb|a"); + Data e = read(R"(g[2][2]: alphabet "ab" base 0 strip "|-")", "a|b\n---\nb|a"); CHECK(equal(e.ints("g"), {0, 1, 1, 0})); // Alphabet options do not take the statements that follow CHECK(read("g[1][2]: alphabet \"ab\" ignore trailing", "ab x").size("g") == 1); @@ -322,7 +323,7 @@ namespace Test { namespace Instance { return true; }); - Case ranges("Read::Ranges", [](void) { + Case ranges("Read::Ranges", []() { Data d = read("n: 1.. a[n]: 0.. 1 { w: word } else { let w = \"none\" }\n" "let m = n * 3 + 1\n" @@ -401,7 +402,7 @@ namespace Test { namespace Instance { return true; }); - Case lexical("Read::Lexical", [](void) { + Case lexical("Read::Lexical", []() { Data d = read("comment \"c\" \"#\"\n" "stop \"%\"\n" "tokens \";\"\n" @@ -415,9 +416,9 @@ namespace Test { namespace Instance { return true; }); - Case robustness("Read::Robustness", [](void) { + Case robustness("Read::Robustness", []() { // Separators, and a string terminator for a list of numbers - Data d = read("separators \",\" list a: int until eol list b: int until \"EOF\"", "1,2, 3\n4 5 EOF"); + Data d = read(R"(separators "," list a: int until eol list b: int until "EOF")", "1,2, 3\n4 5 EOF"); CHECK(equal(d.ints("a"), {1, 2, 3})); CHECK(equal(d.ints("b"), {4, 5})); // Names with dashes only for formats; '-' is otherwise subtraction @@ -447,7 +448,7 @@ namespace Test { namespace Instance { CHECK(fails("list a: int until 0", "5x 0", "expected int, found '5x'")); CHECK(fails("list a: int until 0", "1 - 0", "expected int, found '-'")); CHECK(fails("a[2]: int", "1", "expected int, found end of input")); - CHECK(fails([](void) { (void)Spec::parse("line \"a ... b\"", "s"); }, "'...' must end the pattern")); + CHECK(fails([]() { (void)Spec::parse("line \"a ... b\"", "s"); }, "'...' must end the pattern")); CHECK(fails("repeat 2 { k: int if k > 0 { x: int } }", "1 5 0", "'x' is defined in only some repetitions")); // A wrong count fails at the end of the input, without allocating CHECK(fails("n: int a[n][1]: int", "1000000000 1 2", "found end of input")); @@ -458,7 +459,7 @@ namespace Test { namespace Instance { return true; }); - Case instances("Read::Instances", [](void) { + Case instances("Read::Instances", []() { const char* spec = "comment \"+++\"\n" "instances {\n" " sections skip other {\n" @@ -475,7 +476,7 @@ namespace Test { namespace Instance { CHECK(equal(read(spec, text, by_name).ints("x"), {7})); CHECK(equal(read(spec, text, by_number).ints("x"), {1, 2})); CHECK(read(spec, text, by_number).text("name") == "a"); - CHECK(fails([&](void) { (void)read(spec, text, bad); }, "there is no instance '3' (the file has 2 instances)")); + CHECK(fails([&]() { (void)read(spec, text, bad); }, "there is no instance '3' (the file has 2 instances)")); CHECK(fails(spec, text, "the file has 2 instances; select one")); // A single instance needs no selection, and needs no name CHECK(equal(read(spec, "3\n4 5 6\n").ints("x"), {4, 5, 6})); @@ -490,15 +491,15 @@ namespace Test { namespace Instance { // Trailing input that holds no instance is an error CHECK(fails(spec, "1\n2\njunk\n", "expected a line matching \"{n:int}\"")); CHECK(fails("instances { a: int }", "", "the file contains no instance")); - CHECK(fails([](void) { (void)Spec::parse("instances { a: int } b: int", "s"); }, + CHECK(fails([]() { (void)Spec::parse("instances { a: int } b: int", "s"); }, "'instances' must be the last statement")); - CHECK(fails([](void) { (void)Spec::parse("repeat 2 { instances { a: int } }", "s"); }, + CHECK(fails([]() { (void)Spec::parse("repeat 2 { instances { a: int } }", "s"); }, "'instances' must be at the top level")); CHECK(fails("instances { if 0 > 1 { a: int } }", "5", "an instance must read some input")); return true; }); - Case arithmetic("Read::Arithmetic", [](void) { + Case arithmetic("Read::Arithmetic", []() { Data d = read("a[3]: int g: float h: float\n" "let s = sum(a) let lo = min(a) let hi = max(a, 7)\n" "check g < 0 && -h < -3.5 \"floats compare\"", @@ -518,7 +519,7 @@ namespace Test { namespace Instance { return true; }); - Case progress("Read::Progress", [](void) { + Case progress("Read::Progress", []() { // Repeats whose body reads no input CHECK(fails("repeat until eof { let x = 1 }", "1", "the body of a repeat until read no input")); CHECK(read("repeat until \"END\" { if 1 > 2 { w: word } }", "END").size("w") == 0); @@ -532,7 +533,7 @@ namespace Test { namespace Instance { return true; }); - Case shapes("Read::Shapes", [](void) { + Case shapes("Read::Shapes", []() { // Empty values keep their declared depth and type Data d = read("repeat 2 { x[0][3]: float }", ""); CHECK(d.depth("x") == 3); @@ -550,76 +551,74 @@ namespace Test { namespace Instance { CHECK(e.integer("v", {1, 0, 0}) == 3); CHECK(e.size("v", {1, 0}) == 2); CHECK(equal(e.ints("v", {1, 0}), {3, 4})); - CHECK(fails([&](void) { (void)e.text("s", {0, 2, 0}); }, "index out of range")); + CHECK(fails([&]() { (void)e.text("s", {0, 2, 0}); }, "index out of range")); // Word lists end at an integer terminator CHECK(read("list w: word until 0", "a b 0").size("w") == 2); return true; }); - Case parameters("Read::Parameters", [](void) { + Case parameters("Read::Parameters", []() { Params p; p.set("k", "1.5"); CHECK(read("param k check k > 1 && k < 2", "", p).number("k") == 1.5); Params q; q.set("kk", "7"); - CHECK(fails([&](void) { (void)read("param k = 1", "", q); }, "the spec has no parameter 'kk'")); + CHECK(fails([&]() { (void)read("param k = 1", "", q); }, "the spec has no parameter 'kk'")); // A given value has the type of the default Params r; r.set("s", "3"); r.set("i", "4"); - Data d = read("param s = \"x\" param i = 1 check s == \"3\" && i == 4", "", r); + Data d = read(R"(param s = "x" param i = 1 check s == "3" && i == 4)", "", r); CHECK(d.text("s") == "3"); Params t; t.set("i", "4.5"); - CHECK(fails([&](void) { (void)read("param i = 1", "", t); }, "parameter 'i' must be an integer")); + CHECK(fails([&]() { (void)read("param i = 1", "", t); }, "parameter 'i' must be an integer")); return true; }); - Case checks("Spec::Checks", [](void) { + Case checks("Spec::Checks", []() { // Errors in specs are found when they are parsed - CHECK(fails([](void) { (void)Spec::parse("n: int if n > 5 { let y = sqrt(n) }", "s"); }, - "unknown function 'sqrt'")); CHECK( - fails([](void) { (void)Spec::parse("let y = count(1, 2)", "s"); }, "wrong arguments for function 'count'")); - CHECK(fails([](void) { (void)Spec::parse("line \"{bad-name:int}\"", "s"); }, "is not a name")); - CHECK(fails( - [](void) { (void)Spec::parse("let y = " + std::string(300, '(') + "1" + std::string(300, ')'), "s"); }, - "nested too deeply")); + fails([]() { (void)Spec::parse("n: int if n > 5 { let y = sqrt(n) }", "s"); }, "unknown function 'sqrt'")); + CHECK(fails([]() { (void)Spec::parse("let y = count(1, 2)", "s"); }, "wrong arguments for function 'count'")); + CHECK(fails([]() { (void)Spec::parse("line \"{bad-name:int}\"", "s"); }, "is not a name")); + CHECK(fails([]() { (void)Spec::parse("let y = " + std::string(300, '(') + "1" + std::string(300, ')'), "s"); }, + "nested too deeply")); // Long operator chains and else-if chains are deep trees as well std::string sum = "let y = 1", chain = "n: int if n == 0 { }"; for (int i = 0; i < 300; i++) { sum += " + 1"; chain += " else if n == " + std::to_string(i + 1) + " { }"; } - CHECK(fails([&](void) { (void)Spec::parse(sum, "s"); }, "nested too deeply")); - CHECK(fails([&](void) { (void)Spec::parse(chain, "s"); }, "nested too deeply")); - CHECK(fails([](void) { (void)Spec::parse("let _ = 1", "s"); }, "'_' cannot be defined here")); - CHECK(fails([](void) { (void)Spec::parse("w: word offset 1", "s"); }, "'offset' needs numbers")); + CHECK(fails([&]() { (void)Spec::parse(sum, "s"); }, "nested too deeply")); + CHECK(fails([&]() { (void)Spec::parse(chain, "s"); }, "nested too deeply")); + CHECK(fails([]() { (void)Spec::parse("let _ = 1", "s"); }, "'_' cannot be defined here")); + CHECK(fails([]() { (void)Spec::parse("w: word offset 1", "s"); }, "'offset' needs numbers")); return true; }); - Case strings("Spec::Strings", [](void) { + Case strings("Spec::Strings", []() { // The escapes \n, \t, \\, and \" - Data d = read("let s = \"a\\nb\\tc\\\\d\\\"e\"", ""); + Data d = read(R"(let s = "a\nb\tc\\d\"e")", ""); CHECK(d.text("s") == "a\nb\tc\\d\"e"); // Other escapes and a backslash before a newline are errors on their line - CHECK(fails([](void) { (void)Spec::parse("a: int\nlet s = \"a\\db\"", "s"); }, "s:2: unknown escape '\\d'")); - CHECK(fails([](void) { (void)Spec::parse("a: int\nlet s = \"a\\\nb\"\nb: int", "s"); }, - "s:2: unterminated string")); + CHECK(fails([]() { (void)Spec::parse("a: int\nlet s = \"a\\db\"", "s"); }, "s:2: unknown escape '\\d'")); + CHECK( + fails([]() { (void)Spec::parse("a: int\nlet s = \"a\\\nb\"\nb: int", "s"); }, "s:2: unterminated string")); // Escapes do not disturb the line numbers of later errors - CHECK(fails([](void) { (void)Spec::parse("let s = \"a\\\\\"\nlet t = \"\\\"\"\nx: int untl", "s"); }, + CHECK(fails([]() { (void)Spec::parse("let s = \"a\\\\\"\nlet t = \"\\\"\"\nx: int untl", "s"); }, "s:3: unknown statement 'untl'")); return true; }); - Case settings("Spec::Settings", [](void) { + Case settings("Spec::Settings", []() { // Settings apply to the rest of the input, so they are not in blocks const char* nested[] = {"repeat 2 { comment \"c\" a: int }", "if 1 > 0 { stop \"%\" }", "n: int if n > 0 { } else if n < 0 { tokens \";\" }", "instances { separators \",\" a: int }", "sections { \"x\" { ignore trailing } }"}; for (const char* s : nested) - CHECK(fails([&](void) { (void)Spec::parse(s, "s"); }, "must be at the top level of the spec")); - CHECK(fails([](void) { (void)Spec::parse("a: int\nrepeat a {\n comment \"c\"\n}", "s"); }, + CHECK(fails([&]() { (void)Spec::parse(s, "s"); }, "must be at the top level of the spec")); + CHECK(fails([]() { (void)Spec::parse("a: int\nrepeat a {\n comment \"c\"\n}", "s"); }, "s:3: the setting 'comment' must be at the top level")); // Literal tokens are not a setting CHECK(read("repeat 2 { expect \"x\" a: int }", "x 1 x 2").size("a") == 2); @@ -627,15 +626,15 @@ namespace Test { namespace Instance { }); /// Signals that help was shown - struct HelpShown {}; + struct HelpShown : std::exception {}; /// Observe help requests of options \a Opt without terminating the test runner template class HelpOptions : public Opt { public: - HelpOptions(void) : Opt("Strict parsing test") {} + HelpOptions() : Opt("Strict parsing test") {} void - help(void) override { + help() override { Opt::help(); throw HelpShown(); } @@ -643,7 +642,7 @@ namespace Test { namespace Instance { /// Test whether strict parsing of \a argv rejects argument \a arg template - bool + static bool rejects(HelpOptions& options, int argc, char* argv[], const char* arg) { bool help_shown = false; std::ostringstream output; @@ -658,11 +657,11 @@ namespace Test { namespace Instance { } 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); + return help_shown && output.str().contains(expected) && + output.str().contains("Options for Strict parsing test:"); } - Case strict_options("Driver::Options::Strict", [](void) { + Case strict_options("Driver::Options::Strict", []() { Gecode::Options options("Test"); char name[] = "test", iterations[] = "-iterations", value[] = "200"; char unknown[] = "--typo", help[] = "--help", positional[] = "instance.txt"; @@ -688,7 +687,7 @@ namespace Test { namespace Instance { return true; }); - Case strict_size_options("Driver::SizeOptions::Strict", [](void) { + Case strict_size_options("Driver::SizeOptions::Strict", []() { char name[] = "test", iterations[] = "-iterations", value[] = "200"; char size[] = "7", other[] = "8", unknown[] = "--typo", word[] = "seven"; @@ -718,7 +717,7 @@ namespace Test { namespace Instance { return true; }); - Case strict_instance_options("Driver::InstanceOptions::Strict", [](void) { + Case strict_instance_options("Driver::InstanceOptions::Strict", []() { char name[] = "test", iterations[] = "-iterations", value[] = "200"; char inst[] = "instance.txt", other[] = "other.txt", unknown[] = "--typo"; @@ -742,7 +741,7 @@ namespace Test { namespace Instance { return true; }); - Case options("Driver::InstanceOptions", [](void) { + Case options("Driver::InstanceOptions", []() { // Unique names in the temporary directory const char* tmp = std::getenv("TMPDIR"); if (tmp == nullptr) @@ -765,7 +764,7 @@ namespace Test { namespace Instance { Gecode::InstanceOptions o("Test", with_params); char a0[] = "test", a1[] = "-param", a2[] = "k=2", a3[] = "", a4[] = "m=2"; std::string inst(file); - char* argv[] = {a0, a1, a2, a1, a4, &inst[0], a3}; + char* argv[] = {a0, a1, a2, a1, a4, inst.data(), a3}; int argc = 6; o.parse(argc, argv); ok = ok && o.is_file(); @@ -773,7 +772,7 @@ namespace Test { namespace Instance { // The same parameters separated by commas Gecode::InstanceOptions c("Test", with_params); char c2[] = "k=2,m=2"; - char* argu[] = {a0, a1, c2, &inst[0], a3}; + char* argu[] = {a0, a1, c2, inst.data(), a3}; int argcu = 4; c.parse(argcu, argu); ok = ok && equal(c.data().ints("x"), {3, 4}); @@ -781,7 +780,7 @@ namespace Test { namespace Instance { Gecode::InstanceOptions s("Test", "n: int"); char b1[] = "-spec"; std::string spec(other); - char* argw[] = {a0, b1, &spec[0], &inst[0], a3}; + char* argw[] = {a0, b1, spec.data(), inst.data(), a3}; int argcw = 4; s.parse(argcw, argw); ok = ok && (s.data().integer("c") == 4); @@ -792,65 +791,65 @@ namespace Test { namespace Instance { olog << e.what() << "\n"; ok = false; } - std::remove(file); - std::remove(other); + (void)std::remove(file); + (void)std::remove(other); return ok; }); - Case errors("Read::Errors", [](void) { + Case errors("Read::Errors", []() { CHECK(fails("n: int repeat n { x: int }", "3\n1\n2 z\n", "test.txt:3:3: expected int, found 'z'")); CHECK(fails("n: int repeat n { x: int }", "3\n1\n2\n", "while reading: repeat [3 of 3] > x")); CHECK(fails("n: int repeat n { x: int }", "3\n1\n2\n", "spec: test.reader:1")); - CHECK(fails([](void) { (void)Spec::parse("x: int untl", "s"); }, "s:1: unknown statement 'untl'")); - CHECK(fails([](void) { (void)Spec::parse("repeat 2 { x: int", "s"); }, "missing '}'")); - CHECK(fails([](void) { (void)Spec::parse("line \"{x:bad}\"", "s"); }, "unknown type 'bad'")); - CHECK(fails([](void) { (void)Spec::load("/nonexistent/x.reader"); }, "cannot open file")); - CHECK(fails([](void) { (void)Spec::load("."); }, "is a directory")); + CHECK(fails([]() { (void)Spec::parse("x: int untl", "s"); }, "s:1: unknown statement 'untl'")); + CHECK(fails([]() { (void)Spec::parse("repeat 2 { x: int", "s"); }, "missing '}'")); + CHECK(fails([]() { (void)Spec::parse("line \"{x:bad}\"", "s"); }, "unknown type 'bad'")); + CHECK(fails([]() { (void)Spec::load("/nonexistent/x.reader"); }, "cannot open file")); + CHECK(fails([]() { (void)Spec::load("."); }, "is a directory")); return true; }); - Case access("Data::Access", [](void) { + Case access("Data::Access", []() { Data d = read("big: int w: word n: int repeat n { k: int x[k]: int }", "9999999999 hi 2 1 5 2 6 7"); CHECK(d.integer("big") == 9999999999LL); - CHECK(fails([&](void) { (void)d.ints("big"); }, "is not an array")); - CHECK(fails([&](void) { (void)d.integer("w"); }, "is not an integer")); - CHECK(fails([&](void) { (void)d.integer("nope"); }, "no value named")); - CHECK(fails([&](void) { (void)d.size("x", {2}); }, "index out of range")); - CHECK(fails([&](void) { (void)d.integer("x", {0}); }, "is not a single value")); + CHECK(fails([&]() { (void)d.ints("big"); }, "is not an array")); + CHECK(fails([&]() { (void)d.integer("w"); }, "is not an integer")); + CHECK(fails([&]() { (void)d.integer("nope"); }, "no value named")); + CHECK(fails([&]() { (void)d.size("x", {2}); }, "index out of range")); + CHECK(fails([&]() { (void)d.integer("x", {0}); }, "is not a single value")); Data e = read("n: int repeat n { v: int }", "1 9999999999"); - CHECK(fails([&](void) { (void)e.ints("v"); }, "does not fit into an int")); + CHECK(fails([&]() { (void)e.ints("v"); }, "does not fit into an int")); return true; }); - Case output("Data::Output", [](void) { + Case output("Data::Output", []() { Data d = read("n: int f: float w: word m[2][2]: int repeat n { k: int x[k]: int }", "2 20 a 1 2 3 4 1 5 2 6 7"); std::ostringstream z; d.dzn(z); - CHECK(z.str().find("f = 20.0;") != std::string::npos); - CHECK(z.str().find("m = [| 1, 2\n | 3, 4 |];") != std::string::npos); - CHECK(z.str().find("% x: array[int] of tuple(array[int] of int)\n" - "x = [([5],), ([6, 7],)];") != std::string::npos); - CHECK(z.str().find("w = \"a\";") != std::string::npos); + CHECK(z.str().contains("f = 20.0;")); + CHECK(z.str().contains("m = [| 1, 2\n | 3, 4 |];")); + CHECK(z.str().contains("% x: array[int] of tuple(array[int] of int)\n" + "x = [([5],), ([6, 7],)];")); + CHECK(z.str().contains("w = \"a\";")); // MiniZinc keywords are quoted, control characters escaped std::ostringstream zq; read("var: int w: word", "3 a\033b").dzn(zq); - CHECK(zq.str().find("'var' = 3;") != std::string::npos); - CHECK(zq.str().find("w = \"a\\x1bb\";") != std::string::npos); + CHECK(zq.str().contains("'var' = 3;")); + CHECK(zq.str().contains("w = \"a\\x1bb\";")); // Empty dimensions and deeply ragged arrays Data e = read("e[2][0]: int repeat 2 { k: int repeat k { list y: int until 0 } }", "1 7 0 2 8 9 0 0"); std::ostringstream ze; e.dzn(ze); - CHECK(ze.str().find("e = array2d(1..2, 1..0, []);") != std::string::npos); - CHECK(ze.str().find("y = [([([7],)],), ([([8, 9],), ([],)],)];") != std::string::npos); + CHECK(ze.str().contains("e = array2d(1..2, 1..0, []);")); + CHECK(ze.str().contains("y = [([([7],)],), ([([8, 9],), ([],)],)];")); // MiniZinc has no constructor beyond array6d std::ostringstream z7; read("a[1][1][1][1][1][1][1]: int", "5").dzn(z7); - CHECK(z7.str().find("a = [([([([([([([5],)],)],)],)],)],)];") != std::string::npos); + CHECK(z7.str().contains("a = [([([([([([([5],)],)],)],)],)],)];")); return true; }); - Case labels("Read::Labels", [](void) { + Case labels("Read::Labels", []() { // The layout of PSPLIB single-mode RCPSP files const char* spec = "comment \"***\" \"---\"\n" "find \"jobs (incl. supersource/sink ): {jobs:int}\"\n" @@ -895,7 +894,7 @@ namespace Test { namespace Instance { return true; }); - Case expressions("Read::Expressions", [](void) { + Case expressions("Read::Expressions", []() { // Indices start at 0, for numbers and for rows of ragged arrays const char* rows = "n: int repeat n { list r: int until eol } f[2]: float w[2]: word\n"; const char* text = "3\n1 2\n3 3 4\n5\n0.5 2.5 a b"; @@ -940,21 +939,20 @@ namespace Test { namespace Instance { return true; }); - Case comprehensions("Spec::Comprehensions", [](void) { + Case comprehensions("Spec::Comprehensions", []() { // The bound name is defined only in the body, and must be new - CHECK(fails([](void) { (void)Spec::parse("n: int a[n]: int check all(n in a: n > 0)", "s"); }, + CHECK(fails([]() { (void)Spec::parse("n: int a[n]: int check all(n in a: n > 0)", "s"); }, "s:1: 'n' is bound by a comprehension but is also a name in the spec")); - CHECK(fails([](void) { (void)Spec::parse("a[2]: int\ncheck all(x in a: 1)\nrepeat 2 { x: int }", "s"); }, + CHECK(fails([]() { (void)Spec::parse("a[2]: int\ncheck all(x in a: 1)\nrepeat 2 { x: int }", "s"); }, "s:2: 'x' is bound by a comprehension but is also a name in the spec")); - CHECK(fails([](void) { (void)Spec::parse("a[2][2]: int check all(x in a: all(x in x: 1))", "s"); }, + CHECK(fails([]() { (void)Spec::parse("a[2][2]: int check all(x in a: all(x in x: 1))", "s"); }, "'x' is already bound by an enclosing comprehension")); - CHECK(fails([](void) { (void)Spec::parse("a[2]: int check all(_ in a: 1)", "s"); }, "'_' cannot be bound")); - CHECK(fails([](void) { (void)Spec::parse("a[2]: int check all(a)", "s"); }, - "'all' needs the form all(x in a: e)")); - CHECK(fails([](void) { (void)Spec::parse("a[2]: int check any(x in a)", "s"); }, "expected ':'")); - CHECK(fails([](void) { (void)Spec::parse("a[2]: int check a[0", "s"); }, "expected ']'")); - CHECK(fails([](void) { (void)Spec::parse("let y = distinct()", "s"); }, - "wrong arguments for function 'distinct'")); + CHECK(fails([]() { (void)Spec::parse("a[2]: int check all(_ in a: 1)", "s"); }, "'_' cannot be bound")); + CHECK( + fails([]() { (void)Spec::parse("a[2]: int check all(a)", "s"); }, "'all' needs the form all(x in a: e)")); + CHECK(fails([]() { (void)Spec::parse("a[2]: int check any(x in a)", "s"); }, "expected ':'")); + CHECK(fails([]() { (void)Spec::parse("a[2]: int check a[0", "s"); }, "expected ']'")); + CHECK(fails([]() { (void)Spec::parse("let y = distinct()", "s"); }, "wrong arguments for function 'distinct'")); // Comprehensions over the bound name of an enclosing one, and the same // name in comprehensions that do not nest Data d = read("a[2][2]: int let s = sum(x in a: sum(y in x: y)) + sum(y in a: count(y))", "1 2 3 4"); @@ -963,11 +961,11 @@ namespace Test { namespace Instance { std::string chain = "a[1]: int let y = a"; for (int i = 0; i < 300; i++) chain += "[0]"; - CHECK(fails([&](void) { (void)Spec::parse(chain, "s"); }, "nested too deeply")); + CHECK(fails([&]() { (void)Spec::parse(chain, "s"); }, "nested too deeply")); return true; }); - Case effort("Read::Effort", [](void) { + Case effort("Read::Effort", []() { // Expressions visit values in proportion to the input std::string text = "2000\n"; for (int i = 0; i < 2000; i++) @@ -990,7 +988,7 @@ namespace Test { namespace Instance { return true; }); - Case skipped("Read::SkippedInstances", [](void) { + Case skipped("Read::SkippedInstances", []() { const char* spec = "instances {\n" " sections skip other {\n" " \"instance {name:word}\" optional\n" @@ -1007,8 +1005,8 @@ namespace Test { namespace Instance { CHECK(equal(read(spec, text, second).ints("x"), {7})); CHECK(equal(read(spec, text, b).ints("x"), {7})); // An invalid selected instance is an error - CHECK(fails([&](void) { (void)read(spec, text, first); }, "check failed: n is at most 3")); - CHECK(fails([&](void) { (void)read(spec, text, a); }, "check failed: n is at most 3")); + CHECK(fails([&]() { (void)read(spec, text, first); }, "check failed: n is at most 3")); + CHECK(fails([&]() { (void)read(spec, text, a); }, "check failed: n is at most 3")); CHECK(fails(spec, "4\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16\n", "check failed: n is at most 3")); // Without a selection, a later invalid instance gives the usual error CHECK(fails(spec, "1\n7\n4\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16\n", "the file has 2 instances; select one")); @@ -1016,7 +1014,7 @@ namespace Test { namespace Instance { Spec s = Spec::parse(spec, "s"); Data c = s.catalog_text(text); CHECK(c.integer("instances") == 2); - CHECK((c.text("failed", {0}) == "n is at most 3") && (c.text("failed", {1}) == "")); + CHECK((c.text("failed", {0}) == "n is at most 3") && (c.text("failed", {1}).empty())); CHECK(!s.catalog_text("instance a\n1\n7\n").has("failed")); CHECK(Spec::parse("instances { n: int check n > 5 }", "s").catalog_text("7 1").text("failed", {1}) == "check on line 1 of the spec"); @@ -1025,24 +1023,24 @@ namespace Test { namespace Instance { Params y; y.set("instance", "y"); CHECK(read(late, "0 x 5 y", y).integer("n") == 5); - CHECK(fails([&](void) { (void)read(late, "5 x 0 y", y); }, "check failed: positive")); + CHECK(fails([&]() { (void)read(late, "5 x 0 y", y); }, "check failed: positive")); // Other errors in a skipped instance stop reading, also when large sizes // follow a failed check - CHECK(fails([&](void) { (void)read(spec, "instance a\n2\n1 2 3 x\ninstance b\n1\n7\n", b); }, "expected int")); + CHECK(fails([&]() { (void)read(spec, "instance a\n2\n1 2 3 x\ninstance b\n1\n7\n", b); }, "expected int")); auto start = std::chrono::steady_clock::now(); - CHECK(fails([&](void) { (void)read(spec, "instance a\n1000000000\n1 2\ninstance b\n1\n7\n", b); }, + CHECK(fails([&]() { (void)read(spec, "instance a\n1000000000\n1 2\ninstance b\n1\n7\n", b); }, "array is too large")); - CHECK(fails([&](void) { (void)read(spec, "instance a\n40000\n1 2\ninstance b\n1\n7\n", b); }, + CHECK(fails([&]() { (void)read(spec, "instance a\n40000\n1 2\ninstance b\n1\n7\n", b); }, "after an earlier error in the instance: n is at most 3")); CHECK(std::chrono::steady_clock::now() - start < std::chrono::seconds(10)); // A missing or repeated sections line in a skipped instance is deferred // as a failed check is const char* repeated = "instance a\ninstance x\n1\n7\ninstance b\n1\n8\n"; CHECK(equal(read(spec, repeated, b).ints("x"), {8})); - CHECK(fails([&](void) { (void)read(spec, repeated, a); }, + CHECK(fails([&]() { (void)read(spec, repeated, a); }, "test.txt:2:1: a second line matching \"instance {name:word}\"")); CHECK(s.catalog_text(repeated).text("failed", {0}) == "a second line matching \"instance {name:word}\""); - const char* stop = "instances { sections { \"n {n:int}\" \"m {m:int}\" \"end\" last } }"; + const char* stop = R"(instances { sections { "n {n:int}" "m {m:int}" "end" last } })"; Params two; two.set("instance", "2"); CHECK(read(stop, "n 1\nend\nn 2\nm 3\nend\n", two).integer("m") == 3); @@ -1055,7 +1053,7 @@ namespace Test { namespace Instance { return true; }); - Case power("Read::Power", [](void) { + Case power("Read::Power", []() { // ^ binds tighter than * and unary -, and groups to the right Data d = read("let a = 2 * 3 ^ 2 let b = 2 ^ 3 ^ 2 let c = (2 ^ 3) ^ 2 let e = -2 ^ 2 let f = 1 + 2 ^ 2 * 3\n" @@ -1082,14 +1080,14 @@ namespace Test { namespace Instance { return true; }); - Case constants("Spec::GecodeConstants", [](void) { + Case constants("Spec::GecodeConstants", []() { Data d = read("let a = gecode.int_max let b = gecode.int_min let c = gecode.int_max / 2\n" "gecode: int check gecode == 3", "3"); CHECK(d.integer("a") == Gecode::Int::Limits::max); CHECK(d.integer("b") == Gecode::Int::Limits::min); CHECK(d.integer("c") == 1073741823); - CHECK(fails([](void) { (void)Spec::parse("let x = 1\nlet y = gecode.foo", "s"); }, + CHECK(fails([]() { (void)Spec::parse("let x = 1\nlet y = gecode.foo", "s"); }, "s:2: unknown Gecode constant 'gecode.foo' (known: gecode.int_max, gecode.int_min)")); // Specs cannot define such names const char* defining[] = {"gecode.x: int", @@ -1100,13 +1098,12 @@ namespace Test { namespace Instance { "repeat until \"x\" store gecode.t { a: int }", "a[2]: int check all(gecode.v in a: 1)"}; for (const char* spec : defining) - if (!fails([&](void) { (void)Spec::parse(spec, "s"); }, - "names starting with 'gecode.' are Gecode constants")) + if (!fails([&]() { (void)Spec::parse(spec, "s"); }, "names starting with 'gecode.' are Gecode constants")) return false; return true; }); - Case records("Read::Records", [](void) { + Case records("Read::Records", []() { // A check after a repeat holds for every record, and a failure names // the record and points at its input const char* rows = "n: int repeat n { list row: int until eol } width: int\n" @@ -1160,17 +1157,17 @@ namespace Test { namespace Instance { return true; }); - Case record_names("Spec::Records", [](void) { + Case record_names("Spec::Records", []() { CHECK(fails( - [](void) { (void)Spec::parse("n: int repeat n { a: int }\nrepeat n { b: int }\ncheck a < b", "s"); }, + []() { (void)Spec::parse("n: int repeat n { a: int }\nrepeat n { b: int }\ncheck a < b", "s"); }, "s:3: a check can only range over the records of one repeat, but 'a' and 'b' are defined in different " "repeats")); CHECK(fails( - [](void) { (void)Spec::parse("repeat 2 { repeat 2 { a: int } repeat 2 { b: int } } check a < b", "s"); }, + []() { (void)Spec::parse("repeat 2 { repeat 2 { a: int } repeat 2 { b: int } } check a < b", "s"); }, "can only range over the records of one repeat")); - CHECK(fails([](void) { (void)Spec::parse("n: int repeat n { a: int } let a = 3\ncheck a < 1", "s"); }, + CHECK(fails([]() { (void)Spec::parse("n: int repeat n { a: int } let a = 3\ncheck a < 1", "s"); }, "s:2: 'a' is defined in several repeats, or inside and outside a repeat")); - CHECK(fails([](void) { (void)Spec::parse("repeat 2 { a: int } repeat 2 { a: int } check a < 1", "s"); }, + CHECK(fails([]() { (void)Spec::parse("repeat 2 { a: int } repeat 2 { a: int } check a < 1", "s"); }, "'a' is defined in several repeats")); // Definitions that all enclose the check, or in one repeat (void)Spec::parse("n: int repeat n { a: int check a > 0 } let a = 3", "s"); @@ -1178,7 +1175,7 @@ namespace Test { namespace Instance { return true; }); - Case record_effort("Read::RecordEffort", [](void) { + Case record_effort("Read::RecordEffort", []() { // Each record that a check visits counts std::string text = "2000\n"; for (int i = 0; i < 4000; i++) @@ -1190,7 +1187,7 @@ namespace Test { namespace Instance { return true; }); - Case skipped_records("Read::SkippedInstanceRecords", [](void) { + Case skipped_records("Read::SkippedInstanceRecords", []() { // A check over records in an instance before the selected one does not // stop reading const char* spec = "instances { n: int repeat n { x: int } check x > 0 \"positive\" name: word }"; @@ -1199,14 +1196,13 @@ namespace Test { namespace Instance { a.set("instance", "a"); b.set("instance", "b"); CHECK(equal(read(spec, text, b).ints("x"), {5})); - CHECK(fails([&](void) { (void)read(spec, text, a); }, - "test.txt:1:5: check failed for record 2 of 'x': positive")); + CHECK(fails([&]() { (void)read(spec, text, a); }, "test.txt:1:5: check failed for record 2 of 'x': positive")); Data c = Spec::parse(spec, "s").catalog_text(text); - CHECK((c.text("failed", {0}) == "positive") && (c.text("failed", {1}) == "")); + CHECK((c.text("failed", {0}) == "positive") && (c.text("failed", {1}).empty())); return true; }); - Case record_lists("Read::RecordLists", [](void) { + Case record_lists("Read::RecordLists", []() { // The list of records of a repeat, and each of its records const char* nodes = "n: int repeat n as nodes { each node ready: int due: int }\n" "check node.ready <= node.due \"window\"\n" @@ -1242,12 +1238,12 @@ namespace Test { namespace Instance { "'jobs': exists")); CHECK(fails(jobs, "2 2\n0 5 1 6\n1 2 1 3\n", "test.txt:3:1: check failed for record 2 of 'jobs': twice")); // The terminating token of a repeat is kept with store - Data t = read("repeat until \"end\" \"stop\" store t as xs { a: int } let k = size(xs)", "1 2 stop"); + Data t = read(R"(repeat until "end" "stop" store t as xs { a: int } let k = size(xs))", "1 2 stop"); CHECK((t.text("t") == "stop") && (t.integer("k") == 2)); return true; }); - Case record_list_errors("Spec::RecordLists", [](void) { + Case record_list_errors("Spec::RecordLists", []() { CHECK(rejects("repeat 2 { a: int each x }", "s:1: 'each' must be the first statement of a repeat")); CHECK(rejects("repeat 2 { each x each y }", "'each' must be the first statement of a repeat, and comes at most once")); @@ -1291,7 +1287,7 @@ namespace Test { namespace Instance { return true; }); - Case failure_locations("Read::FailureLocations", [](void) { + Case failure_locations("Read::FailureLocations", []() { // A failed all names the element that fails it CHECK(fails("a[4]: int check all(x in a: x > 0) \"positive\"", "1 2 0 3", "check failed for element 3 of 'a': positive")); @@ -1330,6 +1326,6 @@ namespace Test { namespace Instance { #undef CHECK -}} // namespace Test::Instance +} // namespace Test::Instance // STATISTICS: test-any diff --git a/test/int.cpp b/test/int.cpp index 4c9a6306db..cc95d87d1d 100644 --- a/test/int.cpp +++ b/test/int.cpp @@ -37,7 +37,7 @@ #include #include -namespace Test { namespace Int { +namespace Test::Int { /* * Complete assignments @@ -74,7 +74,7 @@ namespace Test { namespace Int { a--; } -}} // namespace Test::Int +} // namespace Test::Int std::ostream& operator<<(std::ostream& os, const Test::Int::Assignment& a) { @@ -85,7 +85,7 @@ operator<<(std::ostream& os, const Test::Int::Assignment& a) { return os; } -namespace Test { namespace Int { +namespace Test::Int { TestSpace::TestSpace(int n, Gecode::IntSet& d0, Test* t) : d(d0), x(*this, n, Gecode::Int::Limits::min, Gecode::Int::Limits::max), test(t), reified(false) { @@ -123,12 +123,12 @@ namespace Test { namespace Int { } Gecode::Space* - TestSpace::copy(void) { + TestSpace::copy() { return new TestSpace(*this); } bool - TestSpace::assigned(void) const { + TestSpace::assigned() const { for (int i = x.size(); i--;) if (!x[i].assigned()) return false; @@ -136,7 +136,7 @@ namespace Test { namespace Int { } void - TestSpace::post(void) { + TestSpace::post() { if (reified) { test->post(*this, x, r); if (opt.log) @@ -149,15 +149,14 @@ namespace Test { namespace Int { } bool - TestSpace::failed(void) { + TestSpace::failed() { if (opt.log) { olog << ind(3) << "Fixpoint: " << x; bool f = (status() == Gecode::SS_FAILED); olog << '\n' << ind(3) << " --> " << x << '\n'; return f; - } else { - return status() == Gecode::SS_FAILED; } + return status() == Gecode::SS_FAILED; } int @@ -368,12 +367,12 @@ namespace Test { namespace Int { } void - TestSpace::enable(void) { + TestSpace::enable() { Gecode::PropagatorGroup::all.enable(*this); } void - TestSpace::disable(void) { + TestSpace::disable() { Gecode::PropagatorGroup::all.disable(*this); (void)status(); } @@ -426,7 +425,7 @@ namespace Test { namespace Int { } unsigned int - TestSpace::propagators(void) { + TestSpace::propagators() { return Gecode::PropagatorGroup::all.size(*this); } @@ -442,7 +441,7 @@ namespace Test { namespace Int { Gecode::BOT_XOR}; Assignment* - Test::assignment(void) const { + Test::assignment() const { return new CpltAssignment(arity, dom); } @@ -477,10 +476,10 @@ namespace Test { namespace Int { Test::post(Gecode::Space&, Gecode::IntVarArray&, Gecode::Reify) {} bool - Test::run(void) { + Test::run() { using namespace Gecode; - const char* test = "NONE"; - const char* problem = "NONE"; + const char* test = nullptr; + const char* problem = nullptr; // Set up assignments Assignment* ap = assignment(); @@ -1159,8 +1158,8 @@ namespace Test { namespace Int { } OpenTest::OpenTest(const std::string& name, int items0, int extra, const Gecode::IntSet& domain, - Gecode::IntPropLevel level) - : Test(name, items0 + extra, domain, false, level), items(items0) {} + Gecode::IntPropLevel ipl) + : Test(name, items0 + extra, domain, false, ipl), items(items0) {} void OpenTest::post(Gecode::Space& home, Gecode::IntVarArray& x) { @@ -1192,12 +1191,12 @@ namespace Test { namespace Int { } Gecode::Space* - copy(void) override { + copy() override { return new OpenTestSpace(*this); } void - post_open(void) { + post_open() { if (opt.log) olog << ind(3) << "Posting with " << list.known_length() << " open-list items" << '\n'; static_cast(test)->post(*this, list, x); @@ -1216,7 +1215,7 @@ namespace Test { namespace Int { }; bool - OpenTest::run(void) { + OpenTest::run() { using namespace Gecode; if (!Test::run()) return false; @@ -1301,7 +1300,7 @@ namespace Test { namespace Int { } if ((n < items) && (s.list.known_length() <= n)) { - const int end = std::min(items, n + 1 + static_cast(_rand(2))); + const int end = std::min(items, n + 1 + _rand(2)); if (_rand(2) == 0) { if (opt.log) olog << ind(3) << "Appending through item " << end - 1 << '\n'; @@ -1326,7 +1325,7 @@ namespace Test { namespace Int { return true; } -}} // namespace Test::Int +} // namespace Test::Int #undef START_TEST #undef CHECK_TEST diff --git a/test/int.hh b/test/int.hh index 19fd31ca6b..54c52a16cb 100644 --- a/test/int.hh +++ b/test/int.hh @@ -46,460 +46,455 @@ #else #define GECODE_TESTINT_EXPORT __declspec(dllimport) #endif -#elif defined(GECODE_GCC_HAS_CLASS_VISIBILITY) +#elifdef GECODE_GCC_HAS_CLASS_VISIBILITY #define GECODE_TESTINT_EXPORT __attribute__((visibility("default"))) #else #define GECODE_TESTINT_EXPORT #endif -namespace Test { - - /// Testing finite domain integers - namespace Int { +/// Testing finite domain integers +namespace Test::Int { + + /** + * \defgroup TaskTestInt Testing finite domain integers + * \ingroup TaskTest + */ + + /** + * \defgroup TaskTestIntInt General test support + * \ingroup TaskTestInt + */ + //@{ + /// %Base class for assignments + class GECODE_TESTINT_EXPORT Assignment { + protected: + int n; ///< Number of variables + Gecode::IntSet d; ///< Domain for each variable + public: + /// Initialize assignments for \a n0 variables and values \a d0 + Assignment(int n0, const Gecode::IntSet& d0); + /// Test whether all assignments have been iterated + virtual bool has_more() const = 0; + /// Move to next assignment + virtual void next(Gecode::Support::RandomGenerator& rand) = 0; + /// Return value for variable \a i + virtual int operator[](int i) const = 0; + /// Return number of variables + int size() const; + /// Destructor + virtual ~Assignment(); + }; + + /// Generate all assignments + class GECODE_TESTINT_EXPORT CpltAssignment : public Assignment { + protected: + Gecode::IntSetValues* dsv; ///< Iterator for each variable + public: + /// Initialize assignments for \a n0 variables and values \a d0 + CpltAssignment(int n, const Gecode::IntSet& d); + /// Test whether all assignments have been iterated + bool has_more() const override; + /// Move to next assignment + void next(Gecode::Support::RandomGenerator& rand) override; + /// Return value for variable \a i + int operator[](int i) const override; + /// Destructor + ~CpltAssignment() override; + }; + + /// Generate random selection of assignments + class GECODE_TESTINT_EXPORT RandomAssignment : public Assignment { + protected: + int* vals; ///< The current values for the variables + int a; ///< How many assignments still to be generated + /// Generate new value according to domain + int random_value(Gecode::Support::RandomGenerator& rand); + + public: + /// Initialize for \a a assignments for \a n0 variables and values \a d0 + RandomAssignment(int n, const Gecode::IntSet& d, int a0, Gecode::Support::RandomGenerator& rand); + /// Test whether all assignments have been iterated + bool has_more() const override; + /// Move to next assignment + void next(Gecode::Support::RandomGenerator& rand) override; + /// Return value for variable \a i + int operator[](int i) const override; + /// Destructor + ~RandomAssignment() override; + }; + + /// Generate random selection of assignments + class GECODE_TESTINT_EXPORT RandomMixAssignment : public Assignment { + protected: + int* vals; ///< The current values for the variables + int a; ///< How many assignments still to be generated + int _n1; ///< How many variables in the second set + Gecode::IntSet _d1; ///< Domain for second set of variables + /// Generate new value according to domain \a d + int random_value(const Gecode::IntSet& d, Gecode::Support::RandomGenerator& rand); + + public: + /// Initialize for \a a assignments for \a n0 variables and values \a d0 + RandomMixAssignment(int n0, const Gecode::IntSet& d0, int n1, const Gecode::IntSet& d1, int a0, + Gecode::Support::RandomGenerator& rand); + /// Test whether all assignments have been iterated + bool has_more() const override; + /// Move to next assignment + void next(Gecode::Support::RandomGenerator& rand) override; + /// Return value for variable \a i + int operator[](int i) const override; + /// Destructor + ~RandomMixAssignment() override; + }; + + /// Level of consistency to test for + enum class ConTestLevel { + CTL_NONE, ///< No consistency-test + CTL_DOMAIN, ///< Test for domain-consistency + CTL_BOUNDS_D, ///< Test for bounds(d)-consistency + CTL_BOUNDS_Z, ///< Test for bounds(z)-consistency + }; + using enum ConTestLevel; + + class GECODE_TESTINT_EXPORT Test; + + /// Space for executing tests + class GECODE_TESTINT_EXPORT TestSpace : public Gecode::Space { + public: + /// Initial domain + Gecode::IntSet d; + /// Variables to be tested + Gecode::IntVarArray x; + /// Reification information + Gecode::Reify r; + /// The test currently run + Test* test; + /// Whether the test is for a reified propagator + bool reified; /** - * \defgroup TaskTestInt Testing finite domain integers - * \ingroup TaskTest + * \brief Create test space without reification + * + * Creates \a n variables with domain \a d for test \a t. + * */ - + TestSpace(int n, Gecode::IntSet& d, Test* t); /** - * \defgroup TaskTestIntInt General test support - * \ingroup TaskTestInt + * \brief Create test space with reification + * + * Creates \a n variables with domain \a d for test \a t and stores + * the reification mode \a rm. + * */ + TestSpace(int n, Gecode::IntSet& d, Test* t, Gecode::ReifyMode rm); + /// Constructor for cloning \a s + TestSpace(TestSpace& s); + /// Copy space during cloning + Gecode::Space* copy() override; + /// Test whether all variables are assigned + bool assigned() const; + /// Post propagator + void post(); + /// Compute a fixpoint and check for failure + bool failed(); + /// Randomly select an unassigned variable + int rndvar(Gecode::Support::RandomGenerator& rand); + /// Randomly select a pruning rel for variable \a i + void rndrel(const Assignment& a, int i, Gecode::IntRelType& irt, int& v, + Gecode::Support::RandomGenerator& rand); + /// Perform integer tell operation on \a x[i] + void rel(int i, Gecode::IntRelType irt, int n); + /// Perform Boolean tell on \a b + void rel(bool sol); + /// Assign all (or all but one, if \a skip is true) variables to values in \a a + void assign(const Assignment& a, bool skip, Gecode::Support::RandomGenerator& rand); + /// Assign a random variable to a random bound + void bound(Gecode::Support::RandomGenerator& rand); + /** \brief Prune some random values from variable \a i + * + * If \a bounds_only is true, then the pruning is only done on the + * bounds of the variable. + */ + void prune(int i, bool bounds_only, Gecode::Support::RandomGenerator& rand); + /// Prune some random values for some random variable + void prune(Gecode::Support::RandomGenerator& rand); + /// Prune values but not those in assignment \a a + bool prune(const Assignment& a, bool test_fixpoint, Gecode::Support::RandomGenerator& rand); + /// Disable propagators in space and compute fixpoint (make all idle) + void disable(); + /// Enable propagators in space + void enable(); + /// Prune values also in a space \a c with disabled propagators, but not those in assignment \a a + bool disabled(const Assignment& a, TestSpace& c, bool test_fixpoint, Gecode::Support::RandomGenerator& rand); + /// Return the number of propagators + unsigned int propagators(); + }; + + /** + * \brief %Base class for tests with integer constraints + * + * Override solution() with an independent predicate over complete + * assignments and post() with the propagator's public posting function. + * The harness compares them while exercising propagation, cloning, + * pruning, and search. Register a test with static lifetime: + * \code + * #include + * + * class EqualityTest : public ::Test::Int::Test { + * public: + * EqualityTest() : ::Test::Int::Test("Package::Equality", 2, 0, 1) {} + * bool solution(const ::Test::Int::Assignment& a) const override { + * return a[0] == a[1]; + * } + * void post(Gecode::Space& home, Gecode::IntVarArray& x) override { + * Gecode::rel(home, x[0], Gecode::IRT_EQ, x[1]); + * } + * } equality_test; + * + * int main(int argc, char* argv[]) { + * return Test::run_registered_tests(argc, argv); + * } + * \endcode + * + * All test variables start with the constructor's common domain. + * For per-variable restrictions, post them with the constraint and + * include them in solution(). Use the complete assignment generator + * when checking the full relation. + * + * IPL_DOM initializes consistency_test_level to CTL_DOMAIN; other levels initialize + * it to CTL_NONE. Set consistency_test_level to CTL_BOUNDS_D or CTL_BOUNDS_Z only when + * the propagator promises that consistency. For reified constraints, + * enable reification in the constructor and override the reified post(). + * \see Test::run_registered_tests + */ + class GECODE_TESTINT_EXPORT Test : public Base { + protected: + /// Number of variables + int arity; + /// Domain of variables + Gecode::IntSet dom; + /// Does the constraint also exist as reified constraint + bool reified; + /// Supported reification modes, encoded as a bit mask of 1 << Gecode::RM_* + int rms; + /// Propagation level + Gecode::IntPropLevel ipl; + /// Whether to test for certain consistency + ConTestLevel consistency_test_level; + /// Whether to perform search test + bool test_search; + /// Whether to perform fixpoint test + bool test_fixpoint; + /// \name Test for reification modes //@{ - /// %Base class for assignments - class GECODE_TESTINT_EXPORT Assignment { - protected: - int n; ///< Number of variables - Gecode::IntSet d; ///< Domain for each variable - public: - /// Initialize assignments for \a n0 variables and values \a d0 - Assignment(int n0, const Gecode::IntSet& d0); - /// Test whether all assignments have been iterated - virtual bool has_more(void) const = 0; - /// Move to next assignment - virtual void next(Gecode::Support::RandomGenerator& rand) = 0; - /// Return value for variable \a i - virtual int operator[](int i) const = 0; - /// Return number of variables - int size(void) const; - /// Destructor - virtual ~Assignment(void); - }; - - /// Generate all assignments - class GECODE_TESTINT_EXPORT CpltAssignment : public Assignment { - protected: - Gecode::IntSetValues* dsv; ///< Iterator for each variable - public: - /// Initialize assignments for \a n0 variables and values \a d0 - CpltAssignment(int n, const Gecode::IntSet& d); - /// Test whether all assignments have been iterated - bool has_more(void) const override; - /// Move to next assignment - void next(Gecode::Support::RandomGenerator& rand) override; - /// Return value for variable \a i - int operator[](int i) const override; - /// Destructor - ~CpltAssignment(void) override; - }; - - /// Generate random selection of assignments - class GECODE_TESTINT_EXPORT RandomAssignment : public Assignment { - protected: - int* vals; ///< The current values for the variables - int a; ///< How many assignments still to be generated - /// Generate new value according to domain - int random_value(Gecode::Support::RandomGenerator& rand); - - public: - /// Initialize for \a a assignments for \a n0 variables and values \a d0 - RandomAssignment(int n, const Gecode::IntSet& d, int a0, Gecode::Support::RandomGenerator& rand); - /// Test whether all assignments have been iterated - bool has_more(void) const override; - /// Move to next assignment - void next(Gecode::Support::RandomGenerator& rand) override; - /// Return value for variable \a i - int operator[](int i) const override; - /// Destructor - ~RandomAssignment(void) override; - }; - - /// Generate random selection of assignments - class GECODE_TESTINT_EXPORT RandomMixAssignment : public Assignment { - protected: - int* vals; ///< The current values for the variables - int a; ///< How many assignments still to be generated - int _n1; ///< How many variables in the second set - Gecode::IntSet _d1; ///< Domain for second set of variables - /// Generate new value according to domain \a d - int random_value(const Gecode::IntSet& d, Gecode::Support::RandomGenerator& rand); - - public: - /// Initialize for \a a assignments for \a n0 variables and values \a d0 - RandomMixAssignment(int n0, const Gecode::IntSet& d0, int n1, const Gecode::IntSet& d1, int a0, - Gecode::Support::RandomGenerator& rand); - /// Test whether all assignments have been iterated - bool has_more(void) const override; - /// Move to next assignment - void next(Gecode::Support::RandomGenerator& rand) override; - /// Return value for variable \a i - int operator[](int i) const override; - /// Destructor - ~RandomMixAssignment(void) override; - }; - - /// Level of consistency to test for - enum class ConTestLevel { - CTL_NONE, ///< No consistency-test - CTL_DOMAIN, ///< Test for domain-consistency - CTL_BOUNDS_D, ///< Test for bounds(d)-consistency - CTL_BOUNDS_Z, ///< Test for bounds(z)-consistency - }; - using enum ConTestLevel; - - class GECODE_TESTINT_EXPORT Test; - - /// Space for executing tests - class GECODE_TESTINT_EXPORT TestSpace : public Gecode::Space { - public: - /// Initial domain - Gecode::IntSet d; - /// Variables to be tested - Gecode::IntVarArray x; - /// Reification information - Gecode::Reify r; - /// The test currently run - Test* test; - /// Whether the test is for a reified propagator - bool reified; - - /** - * \brief Create test space without reification - * - * Creates \a n variables with domain \a d for test \a t. - * - */ - TestSpace(int n, Gecode::IntSet& d, Test* t); - /** - * \brief Create test space with reification - * - * Creates \a n variables with domain \a d for test \a t and stores - * the reification mode \a rm. - * - */ - TestSpace(int n, Gecode::IntSet& d, Test* t, Gecode::ReifyMode rm); - /// Constructor for cloning \a s - TestSpace(TestSpace& s); - /// Copy space during cloning - Gecode::Space* copy(void) override; - /// Test whether all variables are assigned - bool assigned(void) const; - /// Post propagator - void post(void); - /// Compute a fixpoint and check for failure - bool failed(void); - /// Randomly select an unassigned variable - int rndvar(Gecode::Support::RandomGenerator& rand); - /// Randomly select a pruning rel for variable \a i - void rndrel(const Assignment& a, int i, Gecode::IntRelType& irt, int& v, - Gecode::Support::RandomGenerator& rand); - /// Perform integer tell operation on \a x[i] - void rel(int i, Gecode::IntRelType irt, int n); - /// Perform Boolean tell on \a b - void rel(bool sol); - /// Assign all (or all but one, if \a skip is true) variables to values in \a a - void assign(const Assignment& a, bool skip, Gecode::Support::RandomGenerator& rand); - /// Assign a random variable to a random bound - void bound(Gecode::Support::RandomGenerator& rand); - /** \brief Prune some random values from variable \a i - * - * If \a bounds_only is true, then the pruning is only done on the - * bounds of the variable. - */ - void prune(int i, bool bounds_only, Gecode::Support::RandomGenerator& rand); - /// Prune some random values for some random variable - void prune(Gecode::Support::RandomGenerator& rand); - /// Prune values but not those in assignment \a a - bool prune(const Assignment& a, bool test_fixpoint, Gecode::Support::RandomGenerator& rand); - /// Disable propagators in space and compute fixpoint (make all idle) - void disable(void); - /// Enable propagators in space - void enable(void); - /// Prune values also in a space \a c with disabled propagators, but not those in assignment \a a - bool disabled(const Assignment& a, TestSpace& c, bool test_fixpoint, - Gecode::Support::RandomGenerator& rand); - /// Return the number of propagators - unsigned int propagators(void); - }; - + /// Test whether equivalence as reification mode is supported + bool eqv() const; + /// Test whether implication as reification mode is supported + bool imp() const; + /// Test whether reverse implication as reification mode is supported + bool pmi() const; + //@} + public: /** - * \brief %Base class for tests with integer constraints - * - * Override solution() with an independent predicate over complete - * assignments and post() with the propagator's public posting function. - * The harness compares them while exercising propagation, cloning, - * pruning, and search. Register a test with static lifetime: - * \code - * #include + * \brief Constructor * - * class EqualityTest : public ::Test::Int::Test { - * public: - * EqualityTest() : ::Test::Int::Test("Package::Equality", 2, 0, 1) {} - * bool solution(const ::Test::Int::Assignment& a) const override { - * return a[0] == a[1]; - * } - * void post(Gecode::Space& home, Gecode::IntVarArray& x) override { - * Gecode::rel(home, x[0], Gecode::IRT_EQ, x[1]); - * } - * } equality_test; - * - * int main(int argc, char* argv[]) { - * return Test::run_registered_tests(argc, argv); - * } - * \endcode + * Constructs a test with prefix \a p, name \a s, arity \a a, + * and variable domain \a d. Also tests for a reified + * constraint, if \a r is true. The propagation level + * also selects the initial consistency check (see class documentation). + */ + Test(const std::string& p, const std::string& s, int a, const Gecode::IntSet& d, bool r = false, + Gecode::IntPropLevel i = Gecode::IPL_DEF); + /// Construct and register a test with explicitly assigned tags + Test(TestTags tags, const std::string& p, const std::string& s, int a, const Gecode::IntSet& d, bool r = false, + Gecode::IntPropLevel i = Gecode::IPL_DEF); + /** + * \brief Constructor * - * All test variables start with the constructor's common domain. - * For per-variable restrictions, post them with the constraint and - * include them in solution(). Use the complete assignment generator - * when checking the full relation. + * Constructs a test with name \a s, arity \a a, and variable + * domain \a d. Also tests for a reified constraint, + * if \a r is true. The propagation level + * also selects the initial consistency check (see class documentation). + */ + Test(const std::string& s, int a, const Gecode::IntSet& d, bool r = false, + Gecode::IntPropLevel i = Gecode::IPL_DEF); + /// Construct and register a test with explicitly assigned tags + Test(TestTags tags, const std::string& s, int a, const Gecode::IntSet& d, bool r = false, + Gecode::IntPropLevel i = Gecode::IPL_DEF); + /** + * \brief Constructor * - * IPL_DOM initializes consistency_test_level to CTL_DOMAIN; other levels initialize - * it to CTL_NONE. Set consistency_test_level to CTL_BOUNDS_D or CTL_BOUNDS_Z only when - * the propagator promises that consistency. For reified constraints, - * enable reification in the constructor and override the reified post(). - * \see Test::run_registered_tests + * Constructs a test with prefix \a p, name \a s, arity \a a, + * and variable domain \a min ... \a max. Also tests for + * a reified constraint, if \a r is true. The propagation + * level also selects the initial consistency check (see class documentation). */ - class GECODE_TESTINT_EXPORT Test : public Base { - protected: - /// Number of variables - int arity; - /// Domain of variables - Gecode::IntSet dom; - /// Does the constraint also exist as reified constraint - bool reified; - /// Supported reification modes, encoded as a bit mask of 1 << Gecode::RM_* - int rms; - /// Propagation level - Gecode::IntPropLevel ipl; - /// Whether to test for certain consistency - ConTestLevel consistency_test_level; - /// Whether to perform search test - bool test_search; - /// Whether to perform fixpoint test - bool test_fixpoint; - /// \name Test for reification modes - //@{ - /// Test whether equivalence as reification mode is supported - bool eqv(void) const; - /// Test whether implication as reification mode is supported - bool imp(void) const; - /// Test whether reverse implication as reification mode is supported - bool pmi(void) const; - //@} - public: - /** - * \brief Constructor - * - * Constructs a test with prefix \a p, name \a s, arity \a a, - * and variable domain \a d. Also tests for a reified - * constraint, if \a r is true. The propagation level - * also selects the initial consistency check (see class documentation). - */ - Test(const std::string& p, const std::string& s, int a, const Gecode::IntSet& d, bool r = false, - Gecode::IntPropLevel i = Gecode::IPL_DEF); - /// Construct and register a test with explicitly assigned tags - Test(TestTags tags, const std::string& p, const std::string& s, int a, const Gecode::IntSet& d, - bool r = false, Gecode::IntPropLevel i = Gecode::IPL_DEF); - /** - * \brief Constructor - * - * Constructs a test with name \a s, arity \a a, and variable - * domain \a d. Also tests for a reified constraint, - * if \a r is true. The propagation level - * also selects the initial consistency check (see class documentation). - */ - Test(const std::string& s, int a, const Gecode::IntSet& d, bool r = false, - Gecode::IntPropLevel i = Gecode::IPL_DEF); - /// Construct and register a test with explicitly assigned tags - Test(TestTags tags, const std::string& s, int a, const Gecode::IntSet& d, bool r = false, - Gecode::IntPropLevel i = Gecode::IPL_DEF); - /** - * \brief Constructor - * - * Constructs a test with prefix \a p, name \a s, arity \a a, - * and variable domain \a min ... \a max. Also tests for - * a reified constraint, if \a r is true. The propagation - * level also selects the initial consistency check (see class documentation). - */ - Test(const std::string& p, const std::string& s, int a, int min, int max, bool r = false, - Gecode::IntPropLevel i = Gecode::IPL_DEF); - /// Construct and register a test with explicitly assigned tags - Test(TestTags tags, const std::string& p, const std::string& s, int a, int min, int max, bool r = false, - Gecode::IntPropLevel i = Gecode::IPL_DEF); - /** - * \brief Constructor - * - * Constructs a test with name \a s, arity \a a, variable - * domain \a min ... \a max. Also tests for a reified constraint, - * if \a r is true. The propagation level - * also selects the initial consistency check (see class documentation). - */ - Test(const std::string& s, int a, int min, int max, bool r = false, - Gecode::IntPropLevel i = Gecode::IPL_DEF); - /// Construct and register a test with explicitly assigned tags - Test(TestTags tags, const std::string& s, int a, int min, int max, bool r = false, - Gecode::IntPropLevel i = Gecode::IPL_DEF); - /** \brief Create the assignment generator (complete by default) - * - * An override changes the assignments checked, not the variable - * domains in the test space. - */ - virtual Assignment* assignment(void) const; - /// Check for solution - virtual bool solution(const Assignment&) const = 0; - /// Whether to ignore assignment for reification - virtual bool ignore(const Assignment&) const; - /// Post constraint - virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) = 0; - /// Post reified constraint - virtual void post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r); - /// Perform test - bool run(void) override; - /// \name Mapping scalar values to strings - //@{ - /// Map bool to string - static std::string str(bool b); - /// Map integer to string - static std::string str(int i); - /// Map integer array to string - static std::string str(const Gecode::IntArgs& i); - /// Map integer propagation level to string - static std::string str(Gecode::IntPropLevel ipl); - /// Map integer relation to string - static std::string str(Gecode::IntRelType irl); - /// Map Boolean operation to string - static std::string str(Gecode::BoolOpType bot); - //@} - /// \name General support - //@{ - /// Compare \a x and \a y with respect to \a r - template - static bool cmp(T x, Gecode::IntRelType r, T y); - //@} - }; - + Test(const std::string& p, const std::string& s, int a, int min, int max, bool r = false, + Gecode::IntPropLevel i = Gecode::IPL_DEF); + /// Construct and register a test with explicitly assigned tags + Test(TestTags tags, const std::string& p, const std::string& s, int a, int min, int max, bool r = false, + Gecode::IntPropLevel i = Gecode::IPL_DEF); /** - * \brief Integer constraint tests with incremental open-list histories + * \brief Constructor * - * The first items assignment entries belong to the list; the extra entries - * are auxiliary variables. Override solution() for the complete relation - * and the open-list post() overload. All variables use - * the supplied domain, including auxiliary variables; restrictions posted - * by the test must also be represented in solution(). + * Constructs a test with name \a s, arity \a a, variable + * domain \a min ... \a max. Also tests for a reified constraint, + * if \a r is true. The propagation level + * also selects the initial consistency check (see class documentation). + */ + Test(const std::string& s, int a, int min, int max, bool r = false, Gecode::IntPropLevel i = Gecode::IPL_DEF); + /// Construct and register a test with explicitly assigned tags + Test(TestTags tags, const std::string& s, int a, int min, int max, bool r = false, + Gecode::IntPropLevel i = Gecode::IPL_DEF); + /** \brief Create the assignment generator (complete by default) * - * Runs the ordinary closed-list tests and bounded randomized histories - * that post, grow, prune, clone, and close the list. During these histories - * the list can grow one position beyond the target until it is closed. + * An override changes the assignments checked, not the variable + * domains in the test space. */ - class GECODE_TESTINT_EXPORT OpenTest : public Test { - protected: - /// Number of items in the completed list - int items; - - public: - /// Initialize item and auxiliary variables with the common domain - OpenTest(const std::string& name, int items, int extra, const Gecode::IntSet& domain, - Gecode::IntPropLevel ipl = Gecode::IPL_DEF); - /// Post the tested relation on an open list and its variable array - virtual void post(Gecode::Space& home, Gecode::OpenIntVarList list, Gecode::IntVarArray& x) = 0; - /// Adapt the relation to the ordinary closed-list tests - void post(Gecode::Space& home, Gecode::IntVarArray& x) override; - /// Run closed-list tests and incremental histories - bool run(void) override; - }; + virtual Assignment* assignment() const; + /// Check for solution + virtual bool solution(const Assignment&) const = 0; + /// Whether to ignore assignment for reification + virtual bool ignore(const Assignment&) const; + /// Post constraint + virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) = 0; + /// Post reified constraint + virtual void post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r); + /// Perform test + bool run() override; + /// \name Mapping scalar values to strings + //@{ + /// Map bool to string + static std::string str(bool b); + /// Map integer to string + static std::string str(int i); + /// Map integer array to string + static std::string str(const Gecode::IntArgs& x); + /// Map integer propagation level to string + static std::string str(Gecode::IntPropLevel ipl); + /// Map integer relation to string + static std::string str(Gecode::IntRelType irt); + /// Map Boolean operation to string + static std::string str(Gecode::BoolOpType bot); //@} - - /// Iterator for simple integer propagation levels - class GECODE_TESTINT_EXPORT IntPropLevels { - private: - /// Array of propagation levels - static const Gecode::IntPropLevel ipls[3]; - /// Current position in level array - int i; - - public: - /// Initialize iterator - IntPropLevels(void); - /// Test whether iterator is done - bool operator()(void) const; - /// Increment to next level - void operator++(void); - /// Return current level - Gecode::IntPropLevel ipl(void) const; - }; - - /// Iterator for basic and advanced integer propagation levels - class GECODE_TESTINT_EXPORT IntPropBasicAdvanced { - private: - /// Array of propagation levels - static const Gecode::IntPropLevel ipls[3]; - /// Current position in level array - int i; - - public: - /// Initialize iterator - IntPropBasicAdvanced(void); - /// Test whether iterator is done - bool operator()(void) const; - /// Increment to next level - void operator++(void); - /// Return current level - Gecode::IntPropLevel ipl(void) const; - }; - - /// Iterator for integer relation types - class GECODE_TESTINT_EXPORT IntRelTypes { - private: - /// Array of relation types - static const Gecode::IntRelType irts[6]; - /// Current position in relation type array - int i; - - public: - /// Initialize iterator - IntRelTypes(void); - /// Reset iterator - void reset(void); - /// Test whether iterator is done - bool operator()(void) const; - /// Increment to next relation type - void operator++(void); - /// Return current relation type - Gecode::IntRelType irt(void) const; - }; - - /// Iterator for Boolean operation types - class GECODE_TESTINT_EXPORT BoolOpTypes { - private: - /// Array of operation types - static const Gecode::BoolOpType bots[5]; - /// Current position in operation type array - int i; - - public: - /// Initialize iterator - BoolOpTypes(void); - /// Test whether iterator is done - bool operator()(void) const; - /// Increment to next operation type - void operator++(void); - /// Return current operation type - Gecode::BoolOpType bot(void) const; - }; - - } // namespace Int -} // namespace Test + /// \name General support + //@{ + /// Compare \a x and \a y with respect to \a r + template + static bool cmp(T x, Gecode::IntRelType r, T y); + //@} + }; + + /** + * \brief Integer constraint tests with incremental open-list histories + * + * The first items assignment entries belong to the list; the extra entries + * are auxiliary variables. Override solution() for the complete relation + * and the open-list post() overload. All variables use + * the supplied domain, including auxiliary variables; restrictions posted + * by the test must also be represented in solution(). + * + * Runs the ordinary closed-list tests and bounded randomized histories + * that post, grow, prune, clone, and close the list. During these histories + * the list can grow one position beyond the target until it is closed. + */ + class GECODE_TESTINT_EXPORT OpenTest : public Test { + protected: + /// Number of items in the completed list + int items; + + public: + /// Initialize item and auxiliary variables with the common domain + OpenTest(const std::string& name, int items, int extra, const Gecode::IntSet& domain, + Gecode::IntPropLevel ipl = Gecode::IPL_DEF); + /// Post the tested relation on an open list and its variable array + virtual void post(Gecode::Space& home, Gecode::OpenIntVarList list, Gecode::IntVarArray& x) = 0; + /// Adapt the relation to the ordinary closed-list tests + void post(Gecode::Space& home, Gecode::IntVarArray& x) override; + /// Run closed-list tests and incremental histories + bool run() override; + }; + //@} + + /// Iterator for simple integer propagation levels + class GECODE_TESTINT_EXPORT IntPropLevels { + private: + /// Array of propagation levels + static const Gecode::IntPropLevel ipls[3]; + /// Current position in level array + int i; + + public: + /// Initialize iterator + IntPropLevels(); + /// Test whether iterator is done + bool operator()() const; + /// Increment to next level + void operator++(); + /// Return current level + Gecode::IntPropLevel ipl() const; + }; + + /// Iterator for basic and advanced integer propagation levels + class GECODE_TESTINT_EXPORT IntPropBasicAdvanced { + private: + /// Array of propagation levels + static const Gecode::IntPropLevel ipls[3]; + /// Current position in level array + int i; + + public: + /// Initialize iterator + IntPropBasicAdvanced(); + /// Test whether iterator is done + bool operator()() const; + /// Increment to next level + void operator++(); + /// Return current level + Gecode::IntPropLevel ipl() const; + }; + + /// Iterator for integer relation types + class GECODE_TESTINT_EXPORT IntRelTypes { + private: + /// Array of relation types + static const Gecode::IntRelType irts[6]; + /// Current position in relation type array + int i; + + public: + /// Initialize iterator + IntRelTypes(); + /// Reset iterator + void reset(); + /// Test whether iterator is done + bool operator()() const; + /// Increment to next relation type + void operator++(); + /// Return current relation type + Gecode::IntRelType irt() const; + }; + + /// Iterator for Boolean operation types + class GECODE_TESTINT_EXPORT BoolOpTypes { + private: + /// Array of operation types + static const Gecode::BoolOpType bots[5]; + /// Current position in operation type array + int i; + + public: + /// Initialize iterator + BoolOpTypes(); + /// Test whether iterator is done + bool operator()() const; + /// Increment to next operation type + void operator++(); + /// Return current operation type + Gecode::BoolOpType bot() const; + }; + +} // namespace Test::Int /** * \brief Print assignment \a diff --git a/test/int.hpp b/test/int.hpp index cb057b3d54..5f867285f4 100644 --- a/test/int.hpp +++ b/test/int.hpp @@ -32,7 +32,7 @@ * */ -namespace Test { namespace Int { +namespace Test::Int { /* * Assignments @@ -40,10 +40,10 @@ namespace Test { namespace Int { */ inline Assignment::Assignment(int n0, const Gecode::IntSet& d0) : n(n0), d(d0) {} inline int - Assignment::size(void) const { + Assignment::size() const { return n; } - inline Assignment::~Assignment(void) = default; + inline Assignment::~Assignment() = default; inline CpltAssignment::CpltAssignment(int n, const Gecode::IntSet& d) : Assignment(n, d), dsv(new Gecode::IntSetValues[static_cast(n)]) { @@ -51,7 +51,7 @@ namespace Test { namespace Int { dsv[i].init(d); } inline bool - CpltAssignment::has_more(void) const { + CpltAssignment::has_more() const { return dsv[0](); } inline int @@ -59,7 +59,7 @@ namespace Test { namespace Int { assert((i >= 0) && (i < n)); return dsv[i].val(); } - inline CpltAssignment::~CpltAssignment(void) { + inline CpltAssignment::~CpltAssignment() { delete[] dsv; } @@ -84,7 +84,7 @@ namespace Test { namespace Int { } inline bool - RandomAssignment::has_more(void) const { + RandomAssignment::has_more() const { return a > 0; } inline int @@ -92,7 +92,7 @@ namespace Test { namespace Int { assert((i >= 0) && (i < n)); return vals[i]; } - inline RandomAssignment::~RandomAssignment(void) { + inline RandomAssignment::~RandomAssignment() { delete[] vals; } @@ -119,7 +119,7 @@ namespace Test { namespace Int { } inline bool - RandomMixAssignment::has_more(void) const { + RandomMixAssignment::has_more() const { return a > 0; } @@ -129,7 +129,7 @@ namespace Test { namespace Int { return vals[i]; } - inline RandomMixAssignment::~RandomMixAssignment(void) { + inline RandomMixAssignment::~RandomMixAssignment() { delete[] vals; } @@ -138,15 +138,15 @@ namespace Test { namespace Int { * */ forceinline bool - Test::eqv(void) const { + Test::eqv() const { return reified && ((rms & (1 << std::to_underlying(Gecode::RM_EQV))) != 0); } forceinline bool - Test::imp(void) const { + Test::imp() const { return reified && ((rms & (1 << std::to_underlying(Gecode::RM_IMP))) != 0); } forceinline bool - Test::pmi(void) const { + Test::pmi() const { return reified && ((rms & (1 << std::to_underlying(Gecode::RM_RIMP))) != 0); } inline Test::Test(TestTags tags, const std::string& p, const std::string& s, int a, const Gecode::IntSet& d, bool r, @@ -299,66 +299,66 @@ namespace Test { namespace Int { return false; } - inline IntPropLevels::IntPropLevels(void) : i(sizeof(ipls) / sizeof(Gecode::IntPropLevel) - 1) {} + inline IntPropLevels::IntPropLevels() : i(sizeof(ipls) / sizeof(Gecode::IntPropLevel) - 1) {} inline bool - IntPropLevels::operator()(void) const { + IntPropLevels::operator()() const { return i >= 0; } inline void - IntPropLevels::operator++(void) { + IntPropLevels::operator++() { i--; } inline Gecode::IntPropLevel - IntPropLevels::ipl(void) const { + IntPropLevels::ipl() const { return ipls[i]; } - inline IntPropBasicAdvanced::IntPropBasicAdvanced(void) : i(sizeof(ipls) / sizeof(Gecode::IntPropLevel) - 1) {} + inline IntPropBasicAdvanced::IntPropBasicAdvanced() : i(sizeof(ipls) / sizeof(Gecode::IntPropLevel) - 1) {} inline bool - IntPropBasicAdvanced::operator()(void) const { + IntPropBasicAdvanced::operator()() const { return i >= 0; } inline void - IntPropBasicAdvanced::operator++(void) { + IntPropBasicAdvanced::operator++() { i--; } inline Gecode::IntPropLevel - IntPropBasicAdvanced::ipl(void) const { + IntPropBasicAdvanced::ipl() const { return ipls[i]; } - inline IntRelTypes::IntRelTypes(void) : i(sizeof(irts) / sizeof(Gecode::IntRelType) - 1) {} + inline IntRelTypes::IntRelTypes() : i(sizeof(irts) / sizeof(Gecode::IntRelType) - 1) {} inline void - IntRelTypes::reset(void) { + IntRelTypes::reset() { i = sizeof(irts) / sizeof(Gecode::IntRelType) - 1; } inline bool - IntRelTypes::operator()(void) const { + IntRelTypes::operator()() const { return i >= 0; } inline void - IntRelTypes::operator++(void) { + IntRelTypes::operator++() { i--; } inline Gecode::IntRelType - IntRelTypes::irt(void) const { + IntRelTypes::irt() const { return irts[i]; } - inline BoolOpTypes::BoolOpTypes(void) : i(sizeof(bots) / sizeof(Gecode::BoolOpType) - 1) {} + inline BoolOpTypes::BoolOpTypes() : i(sizeof(bots) / sizeof(Gecode::BoolOpType) - 1) {} inline bool - BoolOpTypes::operator()(void) const { + BoolOpTypes::operator()() const { return i >= 0; } inline void - BoolOpTypes::operator++(void) { + BoolOpTypes::operator++() { i--; } inline Gecode::BoolOpType - BoolOpTypes::bot(void) const { + BoolOpTypes::bot() const { return bots[i]; } -}} // namespace Test::Int +} // namespace Test::Int // STATISTICS: test-int diff --git a/test/int/arithmetic.cpp b/test/int/arithmetic.cpp index 771372100d..893c357690 100644 --- a/test/int/arithmetic.cpp +++ b/test/int/arithmetic.cpp @@ -38,3317 +38,3294 @@ #include -namespace Test { namespace Int { - - /// %Tests for arithmetic constraints - namespace Arithmetic { - - /** - * \defgroup TaskTestIntArithmetic Arithmetic constraints - * \ingroup TaskTestInt - */ - //@{ - /// Compute the mathematical greatest common divisor for testing. - int - gcd_value(int a, int b) { - a = (a < 0) ? -a : a; - b = (b < 0) ? -b : b; - while (b != 0) { - int t = a % b; - a = b; - b = t; - } - return a; - } - - /// %Test for the ternary greatest-common-divisor constraint - // Reposting comparisons below are disabled where bounds subscriptions - // deliberately miss interior removals used by algebraic status tests. - // NumberTheoryLifecycle checks activation, cloning, and rescheduling - // separately; NumberTheorySparseBounds checks own-update fixpoints. - class GcdXYZ : public Test { - public: - /// Create and register test - GcdXYZ(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl, bool r = true) - : Test("Arithmetic::Gcd::XYZ::" + str(ipl) + "::" + s + (r ? "" : "::Plain"), 3, d, r, ipl) { - consistency_test_level = CTL_NONE; - test_fixpoint = !r; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return gcd_value(x[0], x[1]) == x[2]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::gcd(home, x[0], x[1], x[2], ipl); - } - /// Post reified constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::gcd(home, x[0], x[1], x[2], r, ipl); - } - }; - - /// %Test for gcd with identical operands - class GcdXXY : public Test { - public: - /// Create and register test - GcdXXY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl, bool r = true) - : Test("Arithmetic::Gcd::XXY::" + str(ipl) + "::" + s + (r ? "" : "::Plain"), 2, d, r, ipl) { - consistency_test_level = CTL_NONE; - test_fixpoint = !r; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return gcd_value(x[0], x[0]) == x[1]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::gcd(home, x[0], x[0], x[1], ipl); - } - /// Post reified constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::gcd(home, x[0], x[0], x[1], r, ipl); - } - }; +/// %Tests for arithmetic constraints +namespace Test::Int::Arithmetic { + + /** + * \defgroup TaskTestIntArithmetic Arithmetic constraints + * \ingroup TaskTestInt + */ + //@{ + /// Compute the mathematical greatest common divisor for testing. + static int + gcd_value(int a, int b) { + a = (a < 0) ? -a : a; + b = (b < 0) ? -b : b; + while (b != 0) { + int t = a % b; + a = b; + b = t; + } + return a; + } + + /// %Test for the ternary greatest-common-divisor constraint + // Reposting comparisons below are disabled where bounds subscriptions + // deliberately miss interior removals used by algebraic status tests. + // NumberTheoryLifecycle checks activation, cloning, and rescheduling + // separately; NumberTheorySparseBounds checks own-update fixpoints. + class GcdXYZ : public Test { + public: + /// Create and register test + GcdXYZ(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl, bool r = true) + : Test("Arithmetic::Gcd::XYZ::" + str(ipl) + "::" + s + (r ? "" : "::Plain"), 3, d, r, ipl) { + consistency_test_level = CTL_NONE; + test_fixpoint = !r; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return gcd_value(x[0], x[1]) == x[2]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::gcd(home, x[0], x[1], x[2], ipl); + } + /// Post reified constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::gcd(home, x[0], x[1], x[2], r, ipl); + } + }; + + /// %Test for gcd with identical operands + class GcdXXY : public Test { + public: + /// Create and register test + GcdXXY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl, bool r = true) + : Test("Arithmetic::Gcd::XXY::" + str(ipl) + "::" + s + (r ? "" : "::Plain"), 2, d, r, ipl) { + consistency_test_level = CTL_NONE; + test_fixpoint = !r; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return gcd_value(x[0], x[0]) == x[1]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::gcd(home, x[0], x[0], x[1], ipl); + } + /// Post reified constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::gcd(home, x[0], x[0], x[1], r, ipl); + } + }; + + /// %Test for gcd with result aliased to the first operand + class GcdXYX : public Test { + /// Whether to exchange the two operands + bool swap; + + public: + /// Create and register test + GcdXYX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl, bool r = true, bool sw = false) + : Test("Arithmetic::Gcd::XYX::" + str(ipl) + "::" + s + (r ? "" : "::Plain") + (sw ? "::Swap" : ""), 2, d, + r, ipl), + swap(sw) { + consistency_test_level = CTL_NONE; + test_fixpoint = !r; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return gcd_value(x[0], x[1]) == x[0]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + if (swap) + Gecode::gcd(home, x[1], x[0], x[0], ipl); + else + Gecode::gcd(home, x[0], x[1], x[0], ipl); + } + /// Post reified constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + if (swap) + Gecode::gcd(home, x[1], x[0], x[0], r, ipl); + else + Gecode::gcd(home, x[0], x[1], x[0], r, ipl); + } + }; + + /// %Test for gcd with all variables aliased + class GcdXXX : public Test { + public: + /// Create and register test + GcdXXX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Gcd::XXX::" + str(ipl) + "::" + s, 1, d, true, ipl) { + consistency_test_level = CTL_NONE; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return gcd_value(x[0], x[0]) == x[0]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::gcd(home, x[0], x[0], x[0], ipl); + } + /// Post reified constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::gcd(home, x[0], x[0], x[0], r, ipl); + } + }; + + /// %Test for the reified divisibility constraint + // With divisor zero, removing interior zero from the dividend can + // strengthen a reposted status test without a bounds wakeup. + class DividesXY : public Test { + public: + /// Create and register test + DividesXY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Divides::XY::" + str(ipl) + "::" + s, 2, d, true, ipl) { + consistency_test_level = CTL_NONE; + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return (x[0] == 0) ? (x[1] == 0) : (x[1] % x[0] == 0); + } + /// The constraint is deliberately exposed only as reified + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::BoolVar b(home, 1, 1); + Gecode::divides(home, x[0], x[1], Gecode::Reify(b), ipl); + } + /// Post reified constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::divides(home, x[0], x[1], r, ipl); + } + }; + + /// %Test divisibility with aliased operands + class DividesXX : public Test { + public: + /// Create and register test + DividesXX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Divides::XX::" + str(ipl) + "::" + s, 1, d, true, ipl) { + consistency_test_level = CTL_NONE; + } + /// Every integer divides itself, including zero + bool + solution(const Assignment&) const override { + return true; + } + /// The constraint is deliberately exposed only as reified + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::BoolVar b(home, 1, 1); + Gecode::divides(home, x[0], x[0], Gecode::Reify(b), ipl); + } + /// Post reified constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::divides(home, x[0], x[0], r, ipl); + } + }; - /// %Test for gcd with result aliased to the first operand - class GcdXYX : public Test { - /// Whether to exchange the two operands - bool swap; + /// Report a targeted arithmetic failure through the standard test log. + static bool + arithmetic_failed(const std::string& what, const Gecode::VarArgArray& x) { + if (opt.log) + olog << what << ": " << x << '\n'; + return false; + } + /// Algebraic deductions must not wait for unrelated variables to be fixed. + class NumberTheoryAlgebraic : public ::Test::Base { + class TestSpace : public Gecode::Space { public: - /// Create and register test - GcdXYX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl, bool r = true, - bool sw = false) - : Test("Arithmetic::Gcd::XYX::" + str(ipl) + "::" + s + (r ? "" : "::Plain") + (sw ? "::Swap" : ""), 2, - d, r, ipl), - swap(sw) { - consistency_test_level = CTL_NONE; - test_fixpoint = !r; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return gcd_value(x[0], x[1]) == x[0]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - if (swap) - Gecode::gcd(home, x[1], x[0], x[0], ipl); - else - Gecode::gcd(home, x[0], x[1], x[0], ipl); - } - /// Post reified constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - if (swap) - Gecode::gcd(home, x[1], x[0], x[0], r, ipl); - else - Gecode::gcd(home, x[0], x[1], x[0], r, ipl); + Gecode::Space* + copy() override { + return nullptr; } }; + int kind; - /// %Test for gcd with all variables aliased - class GcdXXX : public Test { - public: - /// Create and register test - GcdXXX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Gcd::XXX::" + str(ipl) + "::" + s, 1, d, true, ipl) { - consistency_test_level = CTL_NONE; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return gcd_value(x[0], x[0]) == x[0]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::gcd(home, x[0], x[0], x[0], ipl); - } - /// Post reified constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::gcd(home, x[0], x[0], x[0], r, ipl); + public: + NumberTheoryAlgebraic(int k) : ::Test::Base("Int::Arithmetic::NumberTheoryAlgebraic::" + str(k)), kind(k) {} + bool + run() override { + using namespace Gecode; + TestSpace home; + if (kind <= 2) { + IntVar a(home, 6, 6); + IntVar g(home, 3, 3); + IntVar x(home, kind == 1 ? -12 : 6, kind == 1 ? -6 : 12); + if (kind == 2) + dom(home, x, IntSet({6, 9, 12})); + gcd(home, a, x, g); + if ((home.status() == SS_FAILED) || !x.assigned() || (x.val() != (kind == 1 ? -9 : 9))) + return arithmetic_failed("coprime quotient: a, x, g", IntVarArgs() << a << x << g); + } else if (kind == 3) { + IntVar a(home, 12, 12); + IntVar x(home, 1, 24); + IntVar g(home, 7, 12); + gcd(home, a, x, g); + if ((home.status() == SS_FAILED) || !g.assigned() || (g.val() != 12)) + return arithmetic_failed("divisor quotient band: a, x, g", IntVarArgs() << a << x << g); + } else if (kind <= 5) { + IntVar d(home, kind == 4 ? 6 : -10, kind == 4 ? 10 : -6); + IntVar x(home, 1, 5); + BoolVar b(home, 1, 1); + divides(home, d, x, Reify(b)); + if (home.status() != SS_FAILED) + return arithmetic_failed("divisor magnitude: d, x", IntVarArgs() << d << x); + } else if (kind == 6) { + IntVar d(home, 0, 0); + IntVar x(home, -5, 5); + BoolVar b(home, 0, 0); + divides(home, d, x, Reify(b)); + if ((home.status() == SS_FAILED) || x.in(0)) + return arithmetic_failed("negated zero divisor: d, x", IntVarArgs() << d << x); + } else if (kind == 7) { + IntVar c(home, 6, 6); + IntVar x(home, 1, 100); + IntVar z(home, 1, 100); + IntVar y(home, 1, 1); + product_mod(home, IntVarArgs({c, x, z}), 12, y); + if (home.status() != SS_FAILED) + return arithmetic_failed("coefficient gcd failure: c, x, z, y", IntVarArgs() << c << x << z << y); + } else if (kind == 8) { + IntVar c(home, -6, -6); + IntVar x(home, -100, 100); + IntVar z(home, -100, 100); + IntVar y(home, 4, 9); + product_mod(home, IntVarArgs({c, x, z}), 12, y); + if ((home.status() == SS_FAILED) || !y.assigned() || (y.val() != 6)) + return arithmetic_failed("coefficient result bounds: y", IntVarArgs() << y); + } else if (kind == 9) { + IntVar a(home, 2, 2); + IntVar b(home, 3, 3); + IntVar x(home, -100, 100); + IntVar y(home, 0, 5); + product_mod(home, IntVarArgs({a, x, b}), 6, y); + if ((home.status() == SS_FAILED) || !y.assigned() || (y.val() != 0)) + return arithmetic_failed("collective zero coefficient: y", IntVarArgs() << y); + } else if (kind == 10) { + IntVar c(home, 6, 6); + IntVar x(home, 1, 100); + IntVar z(home, 1, 100); + IntVar y(home, IntSet({1, 5, 7, 11})); + product_mod(home, IntVarArgs({c, x, z}), 12, y); + if (home.status() != SS_FAILED) + return arithmetic_failed("sparse result multiples: y", IntVarArgs() << y); + } else if (kind == 11) { + const int hi = Gecode::Int::Limits::max; + IntVar c(home, 6, 6); + IntVar x(home, 1, hi); + IntVar z(home, 1, hi); + IntVar y(home, 1, 1); + product_mod(home, IntVarArgs({c, x, z}), hi, y); + if (home.status() != SS_FAILED) + return arithmetic_failed("large coefficient gcd failure: y", IntVarArgs() << y); + } else { + const int hi = Gecode::Int::Limits::max; + IntVar a(home, -hi, -hi); + IntVar x(home, hi - 1, hi); + IntVar g(home, 1, 1); + gcd(home, a, x, g); + if ((home.status() == SS_FAILED) || !x.assigned() || (x.val() != hi - 1)) + return arithmetic_failed("limit coprimality: a, x, g", IntVarArgs() << a << x << g); } - }; + return true; + } + }; - /// %Test for the reified divisibility constraint - // With divisor zero, removing interior zero from the dividend can - // strengthen a reposted status test without a bounds wakeup. - class DividesXY : public Test { + /// Sparse endpoints must reach a fixpoint after a divisor is assigned. + class NumberTheorySparseBounds : public ::Test::Base { + class TestSpace : public Gecode::Space { public: - /// Create and register test - DividesXY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Divides::XY::" + str(ipl) + "::" + s, 2, d, true, ipl) { - consistency_test_level = CTL_NONE; - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return (x[0] == 0) ? (x[1] == 0) : (x[1] % x[0] == 0); - } - /// The constraint is deliberately exposed only as reified - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::BoolVar b(home, 1, 1); - Gecode::divides(home, x[0], x[1], Gecode::Reify(b), ipl); - } - /// Post reified constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::divides(home, x[0], x[1], r, ipl); + Gecode::Space* + copy() override { + return nullptr; } }; - /// %Test divisibility with aliased operands - class DividesXX : public Test { - public: - /// Create and register test - DividesXX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Divides::XX::" + str(ipl) + "::" + s, 1, d, true, ipl) { - consistency_test_level = CTL_NONE; - } - /// Every integer divides itself, including zero - bool - solution(const Assignment&) const override { - return true; - } - /// The constraint is deliberately exposed only as reified - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::BoolVar b(home, 1, 1); - Gecode::divides(home, x[0], x[0], Gecode::Reify(b), ipl); - } - /// Post reified constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::divides(home, x[0], x[0], r, ipl); + public: + NumberTheorySparseBounds() : ::Test::Base("Int::Arithmetic::NumberTheorySparseBounds") {} + bool + run() override { + using namespace Gecode; + for (int division = 0; division < 2; division++) { + TestSpace home; + IntVar x(home, IntSet({1, 3, 5, 6})); + IntVar y(home, 10, 10); + IntVar g(home, 1, 2); + BoolVar b(home, 1, 1); + if (division) + divides(home, g, x, Reify(b)); + else + gcd(home, x, y, g); + if (home.status() == SS_FAILED) + return arithmetic_failed("initial propagation: x, y, g", Gecode::IntVarArgs() << x << y << g); + rel(home, g, IRT_EQ, 2); + if ((home.status() == SS_FAILED) || !x.assigned() || (x.val() != 6)) + return arithmetic_failed("assigned divisor: x, y, g", Gecode::IntVarArgs() << x << y << g); } - }; - - /// Report a targeted arithmetic failure through the standard test log. + return true; + } + }; + + /// Activation and rescheduling survive cloning and arithmetic rewrites. + class NumberTheoryLifecycle : public ::Test::Base { + class TestSpace : public Gecode::Space { + public: + Gecode::IntVar x; + Gecode::IntVar c; + Gecode::IntVar y; + Gecode::IntVar m; + Gecode::BoolVar b; + TestSpace(int kind) + : x(*this, Gecode::IntSet({1, 3, 5, 6})), c(*this, kind == 0 ? 10 : 2, kind == 0 ? 10 : 2), + y(*this, kind == 0 ? 2 : (kind == 4 ? 1 : 12), kind == 0 ? 2 : (kind == 4 ? 1 : 12)), + m(*this, kind == 4 ? 5 : 13, kind == 4 ? 7 : 17), b(*this, 0, 1) { + using namespace Gecode; + switch (kind) { + case 0: + gcd(*this, x, c, y, Reify(b)); + break; + case 1: + divides(*this, c, x, Reify(b)); + break; + case 2: + product(*this, IntVarArgs({x, c}), y, Reify(b)); + break; + case 3: + product_mod(*this, IntVarArgs({x, c}), 13, y, Reify(b)); + break; + case 4: + product_mod(*this, IntVarArgs({x, c}), m, y, Reify(b)); + break; + default: + GECODE_NEVER; + } + } + TestSpace(TestSpace& s) : Gecode::Space(s) { + x.update(*this, s.x); + c.update(*this, s.c); + y.update(*this, s.y); + m.update(*this, s.m); + b.update(*this, s.b); + } + Gecode::Space* + copy() override { + return new TestSpace(*this); + } + }; + + public: + NumberTheoryLifecycle() : ::Test::Base("Int::Arithmetic::NumberTheoryLifecycle") {} bool - arithmetic_failed(const std::string& what, const Gecode::VarArgArray& x) { - if (opt.log) - olog << what << ": " << x << '\n'; - return false; + run() override { + using namespace Gecode; + for (int kind = 0; kind < 5; kind++) { + TestSpace home(kind); + if (home.status() == SS_FAILED) + return arithmetic_failed("initial propagation: home.x, home.c, home.y, home.m", + Gecode::IntVarArgs() << home.x << home.c << home.y << home.m); + std::unique_ptr clone(static_cast(home.clone())); + PropagatorGroup::all.disable(*clone); + rel(*clone, clone->b, IRT_EQ, 1); + PropagatorGroup::all.enable(*clone); + if ((clone->status() == SS_FAILED) || ((kind != 4) && (!clone->x.assigned() || (clone->x.val() != 6)))) + return arithmetic_failed("activation after cloning, kind " + str(kind) + ": x, c, y, m", + Gecode::IntVarArgs() << clone->x << clone->c << clone->y << clone->m); + // Clone the activated actor before fixing a variable modulus. + std::unique_ptr child(static_cast(clone->clone())); + rel(*child, child->m, IRT_EQ, kind == 4 ? 5 : 13); + if ((child->status() == SS_FAILED) || !child->x.assigned() || (child->x.val() != (kind == 4 ? 3 : 6)) || + home.b.assigned() || (home.x.size() != 4) || clone->m.assigned()) + return arithmetic_failed("fixed modulus in child, kind " + str(kind) + ": child x, m; parent x, m", + Gecode::IntVarArgs() << child->x << child->m << clone->x << clone->m); + } + return true; } + }; - /// Algebraic deductions must not wait for unrelated variables to be fixed. - class NumberTheoryAlgebraic : public ::Test::Base { - class TestSpace : public Gecode::Space { - public: - Gecode::Space* - copy(void) override { - return nullptr; - } - }; - int kind; - + /// Reified identities do not require the remaining factors to be fixed. + class NumberTheoryIdentities : public ::Test::Base { + class TestSpace : public Gecode::Space { public: - NumberTheoryAlgebraic(int k) : ::Test::Base("Int::Arithmetic::NumberTheoryAlgebraic::" + str(k)), kind(k) {} - bool - run(void) override { - using namespace Gecode; - TestSpace home; - if (kind <= 2) { - IntVar a(home, 6, 6); - IntVar g(home, 3, 3); - IntVar x(home, kind == 1 ? -12 : 6, kind == 1 ? -6 : 12); - if (kind == 2) - dom(home, x, IntSet({6, 9, 12})); - gcd(home, a, x, g); - if ((home.status() == SS_FAILED) || !x.assigned() || (x.val() != (kind == 1 ? -9 : 9))) - return arithmetic_failed("coprime quotient: a, x, g", IntVarArgs() << a << x << g); - } else if (kind == 3) { - IntVar a(home, 12, 12); - IntVar x(home, 1, 24); - IntVar g(home, 7, 12); - gcd(home, a, x, g); - if ((home.status() == SS_FAILED) || !g.assigned() || (g.val() != 12)) - return arithmetic_failed("divisor quotient band: a, x, g", IntVarArgs() << a << x << g); - } else if (kind <= 5) { - IntVar d(home, kind == 4 ? 6 : -10, kind == 4 ? 10 : -6); - IntVar x(home, 1, 5); - BoolVar b(home, 1, 1); - divides(home, d, x, Reify(b)); - if (home.status() != SS_FAILED) - return arithmetic_failed("divisor magnitude: d, x", IntVarArgs() << d << x); - } else if (kind == 6) { - IntVar d(home, 0, 0); - IntVar x(home, -5, 5); - BoolVar b(home, 0, 0); - divides(home, d, x, Reify(b)); - if ((home.status() == SS_FAILED) || x.in(0)) - return arithmetic_failed("negated zero divisor: d, x", IntVarArgs() << d << x); - } else if (kind == 7) { - IntVar c(home, 6, 6); - IntVar x(home, 1, 100); - IntVar z(home, 1, 100); - IntVar y(home, 1, 1); - product_mod(home, IntVarArgs({c, x, z}), 12, y); - if (home.status() != SS_FAILED) - return arithmetic_failed("coefficient gcd failure: c, x, z, y", IntVarArgs() - << c << x << z << y); - } else if (kind == 8) { - IntVar c(home, -6, -6); - IntVar x(home, -100, 100); - IntVar z(home, -100, 100); - IntVar y(home, 4, 9); - product_mod(home, IntVarArgs({c, x, z}), 12, y); - if ((home.status() == SS_FAILED) || !y.assigned() || (y.val() != 6)) - return arithmetic_failed("coefficient result bounds: y", IntVarArgs() << y); - } else if (kind == 9) { - IntVar a(home, 2, 2); - IntVar b(home, 3, 3); - IntVar x(home, -100, 100); - IntVar y(home, 0, 5); - product_mod(home, IntVarArgs({a, x, b}), 6, y); - if ((home.status() == SS_FAILED) || !y.assigned() || (y.val() != 0)) - return arithmetic_failed("collective zero coefficient: y", IntVarArgs() << y); - } else if (kind == 10) { - IntVar c(home, 6, 6); - IntVar x(home, 1, 100); - IntVar z(home, 1, 100); - IntVar y(home, IntSet({1, 5, 7, 11})); - product_mod(home, IntVarArgs({c, x, z}), 12, y); - if (home.status() != SS_FAILED) - return arithmetic_failed("sparse result multiples: y", IntVarArgs() << y); - } else if (kind == 11) { - const int hi = Gecode::Int::Limits::max; - IntVar c(home, 6, 6); - IntVar x(home, 1, hi); - IntVar z(home, 1, hi); - IntVar y(home, 1, 1); - product_mod(home, IntVarArgs({c, x, z}), hi, y); - if (home.status() != SS_FAILED) - return arithmetic_failed("large coefficient gcd failure: y", IntVarArgs() << y); - } else { - const int hi = Gecode::Int::Limits::max; - IntVar a(home, -hi, -hi); - IntVar x(home, hi - 1, hi); - IntVar g(home, 1, 1); - gcd(home, a, x, g); - if ((home.status() == SS_FAILED) || !x.assigned() || (x.val() != hi - 1)) - return arithmetic_failed("limit coprimality: a, x, g", IntVarArgs() << a << x << g); - } - return true; + Gecode::Space* + copy() override { + return nullptr; } }; - /// Sparse endpoints must reach a fixpoint after a divisor is assigned. - class NumberTheorySparseBounds : public ::Test::Base { - class TestSpace : public Gecode::Space { - public: - Gecode::Space* - copy(void) override { - return nullptr; - } - }; - - public: - NumberTheorySparseBounds(void) : ::Test::Base("Int::Arithmetic::NumberTheorySparseBounds") {} - bool - run(void) override { - using namespace Gecode; - for (int division = 0; division < 2; division++) { + public: + NumberTheoryIdentities() : ::Test::Base("Int::Arithmetic::NumberTheoryIdentities") {} + bool + run() override { + using namespace Gecode; + for (ReifyMode rm : {RM_EQV, RM_IMP, RM_RIMP}) + for (int kind = 0; kind < 4; kind++) { TestSpace home; - IntVar x(home, IntSet({1, 3, 5, 6})); - IntVar y(home, 10, 10); - IntVar g(home, 1, 2); - BoolVar b(home, 1, 1); - if (division) - divides(home, g, x, Reify(b)); - else - gcd(home, x, y, g); + IntVar x(home, -7, 7); + IntVar zero(home, 0, 0); + IntVar m(home, 0, 7); + IntVar one(home, 1, 1); + BoolVar b(home, 0, 1); + if (kind == 0) + product(home, IntVarArgs({zero, x}), zero, Reify(b, rm)); + if (kind == 1) + product(home, IntVarArgs({x}), x, Reify(b, rm)); + if (kind == 2) + product_mod(home, IntVarArgs({zero, x}), m, zero, Reify(b, rm)); + if (kind == 3) + product_mod(home, IntVarArgs({x}), one, zero, Reify(b, rm)); if (home.status() == SS_FAILED) - return arithmetic_failed("initial propagation: x, y, g", Gecode::IntVarArgs() << x << y << g); - rel(home, g, IRT_EQ, 2); - if ((home.status() == SS_FAILED) || !x.assigned() || (x.val() != 6)) - return arithmetic_failed("assigned divisor: x, y, g", Gecode::IntVarArgs() << x << y << g); - } - return true; - } - }; - - /// Activation and rescheduling survive cloning and arithmetic rewrites. - class NumberTheoryLifecycle : public ::Test::Base { - class TestSpace : public Gecode::Space { - public: - Gecode::IntVar x; - Gecode::IntVar c; - Gecode::IntVar y; - Gecode::IntVar m; - Gecode::BoolVar b; - TestSpace(int kind) - : x(*this, Gecode::IntSet({1, 3, 5, 6})), c(*this, kind == 0 ? 10 : 2, kind == 0 ? 10 : 2), - y(*this, kind == 0 ? 2 : (kind == 4 ? 1 : 12), kind == 0 ? 2 : (kind == 4 ? 1 : 12)), - m(*this, kind == 4 ? 5 : 13, kind == 4 ? 7 : 17), b(*this, 0, 1) { - using namespace Gecode; - switch (kind) { - case 0: - gcd(*this, x, c, y, Reify(b)); - break; - case 1: - divides(*this, c, x, Reify(b)); - break; - case 2: - product(*this, IntVarArgs({x, c}), y, Reify(b)); - break; - case 3: - product_mod(*this, IntVarArgs({x, c}), 13, y, Reify(b)); - break; - case 4: - product_mod(*this, IntVarArgs({x, c}), m, y, Reify(b)); - break; - default: - GECODE_NEVER; + return arithmetic_failed("initial identity: x, zero, m, one", Gecode::IntVarArgs() + << x << zero << m << one); + if (kind == 2) { + // Zero residue alone does not establish a positive modulus. + if (b.assigned() || (m.min() != 0)) + return arithmetic_failed("modulus positivity unknown: x, zero, m, one", + Gecode::IntVarArgs() << x << zero << m << one); + rel(home, m, IRT_GQ, 1); + if (home.status() == SS_FAILED) + return arithmetic_failed("positive modulus: x, zero, m, one", Gecode::IntVarArgs() + << x << zero << m << one); } + if ((rm == RM_IMP) ? b.assigned() : (!b.assigned() || (b.val() != 1))) + return arithmetic_failed("reified truth: x, zero, m, one", Gecode::IntVarArgs() + << x << zero << m << one); + if ((x.min() != -7) || (x.max() != 7)) + return arithmetic_failed("unconstrained factor: x, zero, m, one", Gecode::IntVarArgs() + << x << zero << m << one); } - TestSpace(TestSpace& s) : Gecode::Space(s) { - x.update(*this, s.x); - c.update(*this, s.c); - y.update(*this, s.y); - m.update(*this, s.m); - b.update(*this, s.b); - } - Gecode::Space* - copy(void) override { - return new TestSpace(*this); - } - }; + return true; + } + }; + /// Known identities at the integer limits, independent of the oracles. + // Observe rewriting after the modulus changes at an initial fixpoint. + class NumberTheoryLimits : public ::Test::Base { + class TestSpace : public Gecode::Space { public: - NumberTheoryLifecycle(void) : ::Test::Base("Int::Arithmetic::NumberTheoryLifecycle") {} - bool - run(void) override { - using namespace Gecode; - for (int kind = 0; kind < 5; kind++) { - TestSpace home(kind); - if (home.status() == SS_FAILED) - return arithmetic_failed("initial propagation: home.x, home.c, home.y, home.m", - Gecode::IntVarArgs() << home.x << home.c << home.y << home.m); - std::unique_ptr clone(static_cast(home.clone())); - PropagatorGroup::all.disable(*clone); - rel(*clone, clone->b, IRT_EQ, 1); - PropagatorGroup::all.enable(*clone); - if ((clone->status() == SS_FAILED) || - ((kind != 4) && (!clone->x.assigned() || (clone->x.val() != 6)))) - return arithmetic_failed("activation after cloning, kind " + str(kind) + ": x, c, y, m", - Gecode::IntVarArgs() << clone->x << clone->c << clone->y << clone->m); - // Clone the activated actor before fixing a variable modulus. - std::unique_ptr child(static_cast(clone->clone())); - rel(*child, child->m, IRT_EQ, kind == 4 ? 5 : 13); - if ((child->status() == SS_FAILED) || !child->x.assigned() || - (child->x.val() != (kind == 4 ? 3 : 6)) || home.b.assigned() || (home.x.size() != 4) || - clone->m.assigned()) - return arithmetic_failed("fixed modulus in child, kind " + str(kind) + - ": child x, m; parent x, m", - Gecode::IntVarArgs() << child->x << child->m << clone->x << clone->m); - } - return true; + Gecode::Space* + copy() override { + return nullptr; } }; - /// Reified identities do not require the remaining factors to be fixed. - class NumberTheoryIdentities : public ::Test::Base { - class TestSpace : public Gecode::Space { - public: - Gecode::Space* - copy(void) override { - return nullptr; - } - }; - - public: - NumberTheoryIdentities(void) : ::Test::Base("Int::Arithmetic::NumberTheoryIdentities") {} - bool - run(void) override { - using namespace Gecode; - for (ReifyMode rm : {RM_EQV, RM_IMP, RM_RIMP}) - for (int kind = 0; kind < 4; kind++) { - TestSpace home; - IntVar x(home, -7, 7); - IntVar zero(home, 0, 0); - IntVar m(home, 0, 7); - IntVar one(home, 1, 1); - BoolVar b(home, 0, 1); - if (kind == 0) - product(home, IntVarArgs({zero, x}), zero, Reify(b, rm)); - if (kind == 1) - product(home, IntVarArgs({x}), x, Reify(b, rm)); - if (kind == 2) - product_mod(home, IntVarArgs({zero, x}), m, zero, Reify(b, rm)); - if (kind == 3) - product_mod(home, IntVarArgs({x}), one, zero, Reify(b, rm)); - if (home.status() == SS_FAILED) - return arithmetic_failed("initial identity: x, zero, m, one", Gecode::IntVarArgs() - << x << zero << m << one); - if (kind == 2) { - // Zero residue alone does not establish a positive modulus. - if (b.assigned() || (m.min() != 0)) - return arithmetic_failed("modulus positivity unknown: x, zero, m, one", - Gecode::IntVarArgs() << x << zero << m << one); - rel(home, m, IRT_GQ, 1); + public: + NumberTheoryLimits() : ::Test::Base("Int::Arithmetic::NumberTheoryLimits") {} + bool + run() override { + using namespace Gecode; + const int hi = Gecode::Int::Limits::max; + // hi-1 is -1 modulo hi. Its square is 1 and its cube is -1; + // negating one factor reverses these residues. The cube exceeds + // signed 64-bit range, but its residue remains exactly known. + for (int n = 2; n <= 3; n++) + for (int negative = 0; negative <= 1; negative++) + for (int variable = 0; variable <= 1; variable++) { + const int expected = ((n + negative) % 2 == 0) ? 1 : hi - 1; + { + TestSpace home; + IntVarArgs x(home, n, hi - 1, hi - 1); + if (negative) + x[0] = IntVar(home, 1 - hi, 1 - hi); + IntVar m(home, hi - 1, hi); + IntVar y(home, 0, hi - 1); + if (variable) + product_mod(home, x, m, y); + else + product_mod(home, x, hi, y); if (home.status() == SS_FAILED) - return arithmetic_failed("positive modulus: x, zero, m, one", - Gecode::IntVarArgs() << x << zero << m << one); + return arithmetic_failed("large product before rewrite: x, m, y", Gecode::IntVarArgs() + << x << m << y); + // Force variable-modulus rewriting after initial propagation. + rel(home, m, IRT_EQ, hi); + if ((home.status() == SS_FAILED) || !y.assigned() || (y.val() != expected)) + return arithmetic_failed("large product residue: x, m, y", Gecode::IntVarArgs() + << x << m << y); } - if ((rm == RM_IMP) ? b.assigned() : (!b.assigned() || (b.val() != 1))) - return arithmetic_failed("reified truth: x, zero, m, one", Gecode::IntVarArgs() - << x << zero << m << one); - if ((x.min() != -7) || (x.max() != 7)) - return arithmetic_failed("unconstrained factor: x, zero, m, one", - Gecode::IntVarArgs() << x << zero << m << one); } - return true; + return true; + } + }; + + /// Known modular residues whose unreduced product exceeds 64 bits. + class ProductModLimits : public Test { + int n; + bool negative; + bool variable; + + public: + ProductModLimits(int n0, bool neg, bool var) + : Test("Arithmetic::ProductMod::Limits::" + str(n0) + "::" + str(neg) + "::" + str(var), 1, + Gecode::IntSet({0, 1, Gecode::Int::Limits::max - 1}), true), + n(n0), negative(neg), variable(var) { + // Reified modular products do not promise a propagation fixpoint. + test_fixpoint = false; + } + bool + solution(const Assignment& x) const override { + return x[0] == (((n + negative) % 2 == 0) ? 1 : Gecode::Int::Limits::max - 1); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + const int hi = Gecode::Int::Limits::max; + IntVarArgs factors(home, n, hi - 1, hi - 1); + if (negative) + factors[0] = IntVar(home, 1 - hi, 1 - hi); + if (variable) { + IntVar modulus(home, hi, hi); + product_mod(home, factors, modulus, x[0]); + } else { + product_mod(home, factors, hi, x[0]); } - }; - - /// Known identities at the integer limits, independent of the oracles. - // Observe rewriting after the modulus changes at an initial fixpoint. - class NumberTheoryLimits : public ::Test::Base { - class TestSpace : public Gecode::Space { - public: - Gecode::Space* - copy(void) override { - return nullptr; - } - }; - - public: - NumberTheoryLimits(void) : ::Test::Base("Int::Arithmetic::NumberTheoryLimits") {} - bool - run(void) override { - using namespace Gecode; - const int hi = Gecode::Int::Limits::max; - // hi-1 is -1 modulo hi. Its square is 1 and its cube is -1; - // negating one factor reverses these residues. The cube exceeds - // signed 64-bit range, but its residue remains exactly known. - for (int n = 2; n <= 3; n++) - for (int negative = 0; negative <= 1; negative++) - for (int variable = 0; variable <= 1; variable++) { - const int expected = ((n + negative) % 2 == 0) ? 1 : hi - 1; - { - TestSpace home; - IntVarArgs x(home, n, hi - 1, hi - 1); - if (negative) - x[0] = IntVar(home, 1 - hi, 1 - hi); - IntVar m(home, hi - 1, hi); - IntVar y(home, 0, hi - 1); - if (variable) - product_mod(home, x, m, y); - else - product_mod(home, x, hi, y); - if (home.status() == SS_FAILED) - return arithmetic_failed("large product before rewrite: x, m, y", - Gecode::IntVarArgs() << x << m << y); - // Force variable-modulus rewriting after initial propagation. - rel(home, m, IRT_EQ, hi); - if ((home.status() == SS_FAILED) || !y.assigned() || (y.val() != expected)) - return arithmetic_failed("large product residue: x, m, y", Gecode::IntVarArgs() - << x << m << y); - } - } + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + using namespace Gecode; + const int hi = Gecode::Int::Limits::max; + IntVarArgs factors(home, n, hi - 1, hi - 1); + if (negative) + factors[0] = IntVar(home, 1 - hi, 1 - hi); + if (variable) { + IntVar modulus(home, hi, hi); + product_mod(home, factors, modulus, x[0], r); + } else { + product_mod(home, factors, hi, x[0], r); + } + } + }; + + /// Evaluate an exact product for testing without overflowing. + static bool + product_value(const Assignment& x, int n, int& product) { + for (int i = 0; i < n; i++) + if (x[i] == 0) { + product = 0; return true; } - }; + long long int p = 1; + for (int i = 0; i < n; i++) { + if (Gecode::Int::Limits::overflow_mul(p, static_cast(x[i]))) + return false; + p *= static_cast(x[i]); + } + if (!Gecode::Int::Limits::valid(p)) + return false; + product = static_cast(p); + return true; + } + + /// %Test for an ordinary and reified three-factor product + // Zero membership and assigned-product membership can change without + // a bounds event, including when factors or the result are aliased. + class ProductXYZR : public Test { + public: + ProductXYZR(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Product::XYZR::" + str(ipl) + "::" + s, 4, d, true, ipl) { + consistency_test_level = CTL_NONE; + test_fixpoint = false; + } + bool + solution(const Assignment& x) const override { + int p; + return product_value(x, 3, p) && (p == x[3]); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs f({x[0], x[1], x[2]}); + Gecode::product(home, f, x[3], ipl); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::IntVarArgs f({x[0], x[1], x[2]}); + Gecode::product(home, f, x[3], r, ipl); + } + }; + + /// %Test for the empty product + class ProductEmpty : public Test { + public: + ProductEmpty(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Product::Empty::" + str(ipl) + "::" + s, 1, d, true, ipl) { + consistency_test_level = CTL_NONE; + } + bool + solution(const Assignment& x) const override { + return x[0] == 1; + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::product(home, Gecode::IntVarArgs(), x[0], ipl); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::product(home, Gecode::IntVarArgs(), x[0], r, ipl); + } + }; + + /// %Test for the singleton product + class ProductSingleton : public Test { + public: + ProductSingleton(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Product::Singleton::" + str(ipl) + "::" + s, 2, d, true, ipl) { + consistency_test_level = CTL_NONE; + } + bool + solution(const Assignment& x) const override { + return x[0] == x[1]; + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::product(home, Gecode::IntVarArgs({x[0]}), x[1], ipl); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::product(home, Gecode::IntVarArgs({x[0]}), x[1], r, ipl); + } + }; + + /// %Test repeated factors and result aliasing + class ProductXXYAlias : public Test { + public: + ProductXXYAlias(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Product::XXYAlias::" + str(ipl) + "::" + s, 2, d, true, ipl) { + consistency_test_level = CTL_NONE; + test_fixpoint = false; + } + bool + solution(const Assignment& x) const override { + long long int p = static_cast(x[0]) * x[0] * x[1]; + return (p >= Gecode::Int::Limits::min) && (p <= Gecode::Int::Limits::max) && (p == x[1]); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::product(home, Gecode::IntVarArgs({x[0], x[0], x[1]}), x[1], ipl); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::product(home, Gecode::IntVarArgs({x[0], x[0], x[1]}), x[1], r, ipl); + } + }; + + /// Interleaved powers exercise grouping, cofactors, and cloned rewrites. + class ProductInterleaved : public Test { + int kind; + Gecode::IntVarArgs + factors(const Gecode::IntVarArray& x) const { + return Gecode::IntVarArgs({x[0], x[1], x[0], x[2], x[1], x[0]}); + } - /// Known modular residues whose unreduced product exceeds 64 bits. - class ProductModLimits : public Test { - int n; - bool negative; - bool variable; + public: + ProductInterleaved(int k) + : Test("Arithmetic::Product::Interleaved::" + str(k), k == 2 ? 5 : 4, Gecode::IntSet(-2, 3), true, + Gecode::IPL_BND), + kind(k) { + consistency_test_level = CTL_NONE; + test_fixpoint = false; + } + bool + solution(const Assignment& x) const override { + const int p = x[0] * x[0] * x[0] * x[1] * x[1] * x[2]; + if (kind == 0) + return p == x[3]; + const int m = kind == 1 ? 7 : x[4]; + return (m > 0) && (((p % m) + m) % m == x[3]); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + if (kind == 0) + Gecode::product(home, factors(x), x[3], ipl); + else if (kind == 1) + Gecode::product_mod(home, factors(x), 7, x[3], ipl); + else + Gecode::product_mod(home, factors(x), x[4], x[3], ipl); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + if (kind == 0) + Gecode::product(home, factors(x), x[3], r, ipl); + else if (kind == 1) + Gecode::product_mod(home, factors(x), 7, x[3], r, ipl); + else + Gecode::product_mod(home, factors(x), x[4], x[3], r, ipl); + } + }; + /// %Test forward and inverse product bounds on large factor domains + class ProductBoundsLarge : public ::Test::Base { + protected: + class TestSpace : public Gecode::Space { public: - ProductModLimits(int n0, bool neg, bool var) - : Test("Arithmetic::ProductMod::Limits::" + str(n0) + "::" + str(neg) + "::" + str(var), 1, - Gecode::IntSet({0, 1, Gecode::Int::Limits::max - 1}), true), - n(n0), negative(neg), variable(var) { - // Reified modular products do not promise a propagation fixpoint. - test_fixpoint = false; - } - bool - solution(const Assignment& x) const override { - return x[0] == (((n + negative) % 2 == 0) ? 1 : Gecode::Int::Limits::max - 1); - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - const int hi = Gecode::Int::Limits::max; - IntVarArgs factors(home, n, hi - 1, hi - 1); - if (negative) - factors[0] = IntVar(home, 1 - hi, 1 - hi); - if (variable) { - IntVar modulus(home, hi, hi); - product_mod(home, factors, modulus, x[0]); - } else { - product_mod(home, factors, hi, x[0]); - } - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - using namespace Gecode; - const int hi = Gecode::Int::Limits::max; - IntVarArgs factors(home, n, hi - 1, hi - 1); - if (negative) - factors[0] = IntVar(home, 1 - hi, 1 - hi); - if (variable) { - IntVar modulus(home, hi, hi); - product_mod(home, factors, modulus, x[0], r); - } else { - product_mod(home, factors, hi, x[0], r); - } + Gecode::Space* + copy() override { + return nullptr; } }; - /// Evaluate an exact product for testing without overflowing. + public: + ProductBoundsLarge() : ::Test::Base("Int::Arithmetic::Product::BoundsLarge") {} bool - product_value(const Assignment& x, int n, int& product) { - for (int i = 0; i < n; i++) - if (x[i] == 0) { - product = 0; - return true; - } - long long int p = 1; - for (int i = 0; i < n; i++) { - if (Gecode::Int::Limits::overflow_mul(p, static_cast(x[i]))) - return false; - p *= static_cast(x[i]); + run() override { + using namespace Gecode; + { + TestSpace home; + IntVarArgs x(home, 3, 2, 100); + IntVar y(home, 0, Gecode::Int::Limits::max); + BoolVar b(home, 1, 1); + product(home, x, y, Reify(b)); + if ((home.status() == SS_FAILED) || (y.min() != 8) || (y.max() != 1000000)) + return arithmetic_failed("forward bounds: x, y", Gecode::IntVarArgs() << x << y); + } + { + TestSpace home; + IntVarArgs x(home, 3, 10, 100); + IntVar y(home, 1000, 1000); + product(home, x, y); + if (home.status() == SS_FAILED) + return arithmetic_failed("inverse bounds failure: x, y", Gecode::IntVarArgs() << x << y); + for (int i = 0; i < x.size(); i++) + if (!x[i].assigned() || (x[i].val() != 10)) + return arithmetic_failed("inverse factor assignment: x, y", Gecode::IntVarArgs() << x << y); } - if (!Gecode::Int::Limits::valid(p)) - return false; - product = static_cast(p); return true; } + }; - /// %Test for an ordinary and reified three-factor product - // Zero membership and assigned-product membership can change without - // a bounds event, including when factors or the result are aliased. - class ProductXYZR : public Test { + /// Test zero, unit, and aggregate-sign product simplifications + class ProductSimplifySign : public ::Test::Base { + protected: + class TestSpace : public Gecode::Space { public: - ProductXYZR(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Product::XYZR::" + str(ipl) + "::" + s, 4, d, true, ipl) { - consistency_test_level = CTL_NONE; - test_fixpoint = false; - } - bool - solution(const Assignment& x) const override { - int p; - return product_value(x, 3, p) && (p == x[3]); - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs f({x[0], x[1], x[2]}); - Gecode::product(home, f, x[3], ipl); - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::IntVarArgs f({x[0], x[1], x[2]}); - Gecode::product(home, f, x[3], r, ipl); + Gecode::Space* + copy() override { + return nullptr; } }; - - /// %Test for the empty product - class ProductEmpty : public Test { + class CloneSpace : public Gecode::Space { public: - ProductEmpty(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Product::Empty::" + str(ipl) + "::" + s, 1, d, true, ipl) { - consistency_test_level = CTL_NONE; + Gecode::IntVar x; + Gecode::IntVar q; + Gecode::IntVar y; + CloneSpace() : x(*this, -2, 2), q(*this, 2, 2), y(*this, -10, 10) { + Gecode::product(*this, Gecode::IntVarArgs({x, q}), y); } - bool - solution(const Assignment& x) const override { - return x[0] == 1; + CloneSpace(CloneSpace& s) : Gecode::Space(s) { + x.update(*this, s.x); + q.update(*this, s.q); + y.update(*this, s.y); } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::product(home, Gecode::IntVarArgs(), x[0], ipl); - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::product(home, Gecode::IntVarArgs(), x[0], r, ipl); + Gecode::Space* + copy() override { + return new CloneSpace(*this); } }; - /// %Test for the singleton product - class ProductSingleton : public Test { - public: - ProductSingleton(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Product::Singleton::" + str(ipl) + "::" + s, 2, d, true, ipl) { - consistency_test_level = CTL_NONE; - } - bool - solution(const Assignment& x) const override { - return x[0] == x[1]; + public: + ProductSimplifySign() : ::Test::Base("Int::Arithmetic::Product::SimplifySign") {} + bool + run() override { + using namespace Gecode; + { + TestSpace home; + IntVar z(home, 0, 0); + IntVar x(home, -100, 100); + IntVar y(home, -100, 100); + product(home, IntVarArgs({x, z}), y); + if ((home.status() == SS_FAILED) || !y.assigned() || (y.val() != 0)) + return arithmetic_failed("zero factor: z, x, y", Gecode::IntVarArgs() << z << x << y); } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::product(home, Gecode::IntVarArgs({x[0]}), x[1], ipl); + { + TestSpace home; + IntVar one(home, 1, 1); + IntVar minus(home, -1, -1); + IntVar x(home, 2, 5); + IntVar y(home, -100, 100); + product(home, IntVarArgs({one, minus, minus, x}), y); + if ((home.status() == SS_FAILED) || (y.min() != 2) || (y.max() != 5)) + return arithmetic_failed("paired negative units: one, minus, x, y", Gecode::IntVarArgs() + << one << minus << x << y); + } + { + TestSpace home; + IntVar minus(home, -1, -1); + IntVar x(home, 2, 5); + IntVar y(home, -100, 100); + product(home, IntVarArgs({minus, x}), y); + if ((home.status() == SS_FAILED) || (y.min() != -5) || (y.max() != -2)) + return arithmetic_failed("negative unit: minus, x, y", Gecode::IntVarArgs() << minus << x << y); + } + { + TestSpace home; + IntVar x(home, 0, 5); + IntVar q(home, 1, 3); + IntVar y(home, 2, 10); + product(home, IntVarArgs({x, q}), y); + if ((home.status() == SS_FAILED) || (x.min() != 1)) + return arithmetic_failed("nonzero result: x, q, y", Gecode::IntVarArgs() << x << q << y); + } + { + TestSpace home; + IntVar x(home, -2, 2); + IntVar q(home, 1, 3); + IntVar y(home, 0, 0); + product(home, IntVarArgs({x, q}), y); + if ((home.status() == SS_FAILED) || !x.assigned() || (x.val() != 0)) + return arithmetic_failed("unique zero factor: x, q, y", Gecode::IntVarArgs() << x << q << y); + } + { + TestSpace home; + IntVar x(home, -5, 0); + IntVar q(home, 2, 4); + IntVar y(home, -100, 100); + product(home, IntVarArgs({x, q}), y); + if ((home.status() == SS_FAILED) || (y.max() != 0)) + return arithmetic_failed("nonpositive product: x, q, y", Gecode::IntVarArgs() << x << q << y); + } + { + TestSpace home; + IntVar x(home, -5, -2); + IntVar q(home, -4, -2); + IntVar y(home, -100, 100); + product(home, IntVarArgs({x, q}), y); + if ((home.status() == SS_FAILED) || (y.min() != 4)) + return arithmetic_failed("positive product: x, q, y", Gecode::IntVarArgs() << x << q << y); + } + { + TestSpace home; + const int hi = Gecode::Int::Limits::max; + IntVar minus(home, -1, -1); + IntVar x(home, hi, hi); + IntVar y(home, -hi, hi); + product(home, IntVarArgs({minus, x}), y); + if ((home.status() == SS_FAILED) || !y.assigned() || (y.val() != -hi)) + return arithmetic_failed("negative limit: minus, x, y", Gecode::IntVarArgs() << minus << x << y); + } + { + CloneSpace home; + if (home.status() == SS_FAILED) + return arithmetic_failed("initial clone state: home.x, home.q, home.y", + Gecode::IntVarArgs() << home.x << home.q << home.y); + CloneSpace* clone = static_cast(home.clone()); + PropagatorGroup::all.disable(*clone); + rel(home, home.x, IRT_NQ, 0); + rel(*clone, clone->x, IRT_NQ, 0); + (void)home.status(); + (void)clone->status(); + rel(home, home.y, IRT_GQ, 2); + rel(*clone, clone->y, IRT_GQ, 2); + PropagatorGroup::all.enable(*clone); + const bool ok = (home.status() != SS_FAILED) && (clone->status() != SS_FAILED) && (home.x.min() == 1) && + (clone->x.min() == 1) && (home.y.min() == 2) && (clone->y.min() == 2); + delete clone; + if (!ok) + return arithmetic_failed("rescheduling: home.x, home.q, home.y", Gecode::IntVarArgs() + << home.x << home.q << home.y); } - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::product(home, Gecode::IntVarArgs({x[0]}), x[1], r, ipl); + return true; + } + }; + + /// Test repeated powers and result-alias cancellation + class ProductPowerAlias : public ::Test::Base { + protected: + class TestSpace : public Gecode::Space { + public: + Gecode::Space* + copy() override { + return nullptr; } }; - /// %Test repeated factors and result aliasing - class ProductXXYAlias : public Test { - public: - ProductXXYAlias(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Product::XXYAlias::" + str(ipl) + "::" + s, 2, d, true, ipl) { - consistency_test_level = CTL_NONE; - test_fixpoint = false; + public: + ProductPowerAlias() : ::Test::Base("Int::Arithmetic::Product::PowerAlias") {} + bool + run() override { + using namespace Gecode; + { + TestSpace home; + IntVar x(home, -10, 10); + IntVar y(home, -10, 100); + product(home, IntVarArgs({x, x}), y); + if ((home.status() == SS_FAILED) || (y.min() != 0)) + return arithmetic_failed("square sign: x, y", Gecode::IntVarArgs() << x << y); + } + { + TestSpace home; + IntVar x(home, -10, 10); + IntVar y(home, 20, 30); + product(home, IntVarArgs({x, x}), y); + if ((home.status() == SS_FAILED) || (x.min() != -5) || (x.max() != 5)) + return arithmetic_failed("square inverse: x, y", Gecode::IntVarArgs() << x << y); + } + { + TestSpace home; + IntVar x(home, -10, 10); + IntVar y(home, 20, 30); + product(home, IntVarArgs({x, x, x}), y); + if ((home.status() == SS_FAILED) || !x.assigned() || (x.val() != 3)) + return arithmetic_failed("cube inverse: x, y", Gecode::IntVarArgs() << x << y); } - bool - solution(const Assignment& x) const override { - long long int p = static_cast(x[0]) * x[0] * x[1]; - return (p >= Gecode::Int::Limits::min) && (p <= Gecode::Int::Limits::max) && (p == x[1]); + { + TestSpace home; + IntVar x(home, -10, 10); + IntVar y(home, -30, -20); + product(home, IntVarArgs({x, x, x}), y); + if ((home.status() == SS_FAILED) || !x.assigned() || (x.val() != -3)) + return arithmetic_failed("negative cube inverse: x, y", Gecode::IntVarArgs() << x << y); } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::product(home, Gecode::IntVarArgs({x[0], x[0], x[1]}), x[1], ipl); + { + TestSpace home; + IntVar x(home, -10, 10); + IntVar two(home, 2, 2); + IntVar y(home, 50, 72); + product(home, IntVarArgs({x, x, two}), y); + if ((home.status() == SS_FAILED) || (x.min() != -6) || (x.max() != 6)) + return arithmetic_failed("square cofactor: x, two, y", Gecode::IntVarArgs() << x << two << y); + } + { + // x*y=y has only the zero branch when x cannot be one. + TestSpace home; + IntVar x(home, 2, 4); + IntVar y(home, -10, 10); + product(home, IntVarArgs({x, y}), y); + if ((home.status() == SS_FAILED) || !y.assigned() || (y.val() != 0)) + return arithmetic_failed("zero result alias: x, y", Gecode::IntVarArgs() << x << y); } - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::product(home, Gecode::IntVarArgs({x[0], x[0], x[1]}), x[1], r, ipl); + { + // A nonzero result permits cancellation of one result occurrence. + TestSpace home; + IntVar x(home, 0, 2); + IntVar y(home, 2, 10); + product(home, IntVarArgs({x, y}), y); + if ((home.status() == SS_FAILED) || !x.assigned() || (x.val() != 1)) + return arithmetic_failed("nonzero cancellation: x, y", Gecode::IntVarArgs() << x << y); + } + { + // Cancelling one of two result occurrences leaves y*x=1. + TestSpace home; + IntVar x(home, -1, 0); + IntVar y(home, -2, -1); + product(home, IntVarArgs({y, y, x}), y); + if ((home.status() == SS_FAILED) || !x.assigned() || !y.assigned() || (x.val() != -1) || + (y.val() != -1)) + return arithmetic_failed("repeated result cancellation: x, y", Gecode::IntVarArgs() << x << y); + } + { + // Direct n-ary evaluation retains zero after an overflowing prefix. + TestSpace home; + const int hi = Gecode::Int::Limits::max; + IntVar a(home, hi, hi); + IntVar z(home, 0, 0); + IntVar y(home, 0, 0); + product(home, IntVarArgs({a, a, z}), y); + if (home.status() == SS_FAILED) + return arithmetic_failed("overflow followed by zero: a, z, y", Gecode::IntVarArgs() << a << z << y); } - }; - - /// Interleaved powers exercise grouping, cofactors, and cloned rewrites. - class ProductInterleaved : public Test { - int kind; - Gecode::IntVarArgs - factors(const Gecode::IntVarArray& x) const { - return Gecode::IntVarArgs({x[0], x[1], x[0], x[2], x[1], x[0]}); + { + TestSpace home; + IntVar x(home, -10, 10); + IntVar y(home, 20, 30); + BoolVar b(home, 1, 1); + product(home, IntVarArgs({x, x}), y, Reify(b, RM_EQV)); + if ((home.status() == SS_FAILED) || (x.min() != -5) || (x.max() != 5)) + return arithmetic_failed("reified square: x, y", Gecode::IntVarArgs() << x << y); } + return true; + } + }; + /// Test zero-aware inverse bounds for every cofactor sign class + class ProductInverseBounds : public ::Test::Base { + protected: + class TestSpace : public Gecode::Space { public: - ProductInterleaved(int k) - : Test("Arithmetic::Product::Interleaved::" + str(k), k == 2 ? 5 : 4, Gecode::IntSet(-2, 3), true, - Gecode::IPL_BND), - kind(k) { - consistency_test_level = CTL_NONE; - test_fixpoint = false; - } - bool - solution(const Assignment& x) const override { - const int p = x[0] * x[0] * x[0] * x[1] * x[1] * x[2]; - if (kind == 0) - return p == x[3]; - const int m = kind == 1 ? 7 : x[4]; - return (m > 0) && (((p % m) + m) % m == x[3]); - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - if (kind == 0) - Gecode::product(home, factors(x), x[3], ipl); - else if (kind == 1) - Gecode::product_mod(home, factors(x), 7, x[3], ipl); - else - Gecode::product_mod(home, factors(x), x[4], x[3], ipl); - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - if (kind == 0) - Gecode::product(home, factors(x), x[3], r, ipl); - else if (kind == 1) - Gecode::product_mod(home, factors(x), 7, x[3], r, ipl); - else - Gecode::product_mod(home, factors(x), x[4], x[3], r, ipl); + Gecode::Space* + copy() override { + return nullptr; } }; + static bool + bounds(const Gecode::IntVar& x, int min, int max) { + return (x.min() == min) && (x.max() == max); + } - /// %Test forward and inverse product bounds on large factor domains - class ProductBoundsLarge : public ::Test::Base { - protected: - class TestSpace : public Gecode::Space { - public: - Gecode::Space* - copy(void) override { - return nullptr; - } + public: + ProductInverseBounds() : ::Test::Base("Int::Arithmetic::Product::InverseBounds") {} + bool + run() override { + using namespace Gecode; + struct Case { + int qmin; + int qmax; + int xmin; + int xmax; }; + const Case cases[] = { + {2, 4, 5, 12}, // Positive + {0, 4, 5, 24}, // Nonnegative + {-4, -2, -12, -5}, // Negative + {-4, 0, -24, -5}, // Nonpositive + {-4, 3, -24, 24} // Mixed across zero + }; + for (auto c : cases) { + TestSpace home; + IntVar x(home, -100, 100); + IntVar q(home, c.qmin, c.qmax); + IntVar y(home, 20, 24); + product(home, IntVarArgs({x, q}), y); + if ((home.status() == SS_FAILED) || !bounds(x, c.xmin, c.xmax)) { + if (opt.log) + olog << "Inverse bounds, cofactor [" << c.qmin << "," << c.qmax << "]: x=" << x << ", q=" << q + << ", y=" << y << "; expected x=[" << c.xmin << "," << c.xmax << "]" << '\n'; + return false; + } + } + { + // When both the cofactor and result can be zero, no inverse + // pruning of the other factor is sound. + TestSpace home; + IntVar x(home, -100, 100); + IntVar q(home, -2, 3); + IntVar y(home, -10, 10); + product(home, IntVarArgs({x, q}), y); + if ((home.status() == SS_FAILED) || !bounds(x, -100, 100)) + return arithmetic_failed("unconstrained zero product: x, q, y", Gecode::IntVarArgs() + << x << q << y); + } + { + TestSpace home; + IntVar x(home, -100, 100); + IntVar zero(home, 0, 0); + IntVar y(home, 1, 2); + product(home, IntVarArgs({x, zero}), y); + if (home.status() != SS_FAILED) + return arithmetic_failed("impossible zero product: x, zero, y", Gecode::IntVarArgs() + << x << zero << y); + } + { + TestSpace home; + const int hi = Gecode::Int::Limits::max; + IntVar x(home, -1, 1); + IntVar a(home, hi, hi); + IntVar b(home, hi, hi); + IntVar y(home, 0, 0); + product(home, IntVarArgs({x, a, b}), y); + if ((home.status() == SS_FAILED) || !x.assigned() || (x.val() != 0)) + return arithmetic_failed("overflowing cofactor: x, a, b, y", Gecode::IntVarArgs() + << x << a << b << y); + } + return true; + } + }; + /// Unit compaction must finish before a zero factor subsumes the actor. + class ProductCompactionZero : public ::Test::Base { + class TestSpace : public Gecode::Space { public: - ProductBoundsLarge(void) : ::Test::Base("Int::Arithmetic::Product::BoundsLarge") {} - bool - run(void) override { - using namespace Gecode; - { - TestSpace home; - IntVarArgs x(home, 3, 2, 100); - IntVar y(home, 0, Gecode::Int::Limits::max); - BoolVar b(home, 1, 1); - product(home, x, y, Reify(b)); - if ((home.status() == SS_FAILED) || (y.min() != 8) || (y.max() != 1000000)) - return arithmetic_failed("forward bounds: x, y", Gecode::IntVarArgs() << x << y); - } - { - TestSpace home; - IntVarArgs x(home, 3, 10, 100); - IntVar y(home, 1000, 1000); - product(home, x, y); - if (home.status() == SS_FAILED) - return arithmetic_failed("inverse bounds failure: x, y", Gecode::IntVarArgs() << x << y); - for (int i = 0; i < x.size(); i++) - if (!x[i].assigned() || (x[i].val() != 10)) - return arithmetic_failed("inverse factor assignment: x, y", Gecode::IntVarArgs() << x << y); - } - return true; + Gecode::Space* + copy() override { + return nullptr; } }; - /// Test zero, unit, and aggregate-sign product simplifications - class ProductSimplifySign : public ::Test::Base { - protected: - class TestSpace : public Gecode::Space { - public: - Gecode::Space* - copy(void) override { - return nullptr; - } - }; - class CloneSpace : public Gecode::Space { - public: - Gecode::IntVar x; - Gecode::IntVar q; - Gecode::IntVar y; - CloneSpace(void) : x(*this, -2, 2), q(*this, 2, 2), y(*this, -10, 10) { - Gecode::product(*this, Gecode::IntVarArgs({x, q}), y); - } - CloneSpace(CloneSpace& s) : Gecode::Space(s) { - x.update(*this, s.x); - q.update(*this, s.q); - y.update(*this, s.y); - } - Gecode::Space* - copy(void) override { - return new CloneSpace(*this); - } - }; - - public: - ProductSimplifySign(void) : ::Test::Base("Int::Arithmetic::Product::SimplifySign") {} - bool - run(void) override { - using namespace Gecode; - { - TestSpace home; - IntVar z(home, 0, 0); - IntVar x(home, -100, 100); - IntVar y(home, -100, 100); - product(home, IntVarArgs({x, z}), y); - if ((home.status() == SS_FAILED) || !y.assigned() || (y.val() != 0)) - return arithmetic_failed("zero factor: z, x, y", Gecode::IntVarArgs() << z << x << y); - } - { - TestSpace home; - IntVar one(home, 1, 1); - IntVar minus(home, -1, -1); - IntVar x(home, 2, 5); - IntVar y(home, -100, 100); - product(home, IntVarArgs({one, minus, minus, x}), y); - if ((home.status() == SS_FAILED) || (y.min() != 2) || (y.max() != 5)) - return arithmetic_failed("paired negative units: one, minus, x, y", - Gecode::IntVarArgs() << one << minus << x << y); - } - { - TestSpace home; - IntVar minus(home, -1, -1); - IntVar x(home, 2, 5); - IntVar y(home, -100, 100); - product(home, IntVarArgs({minus, x}), y); - if ((home.status() == SS_FAILED) || (y.min() != -5) || (y.max() != -2)) - return arithmetic_failed("negative unit: minus, x, y", Gecode::IntVarArgs() << minus << x << y); - } - { - TestSpace home; - IntVar x(home, 0, 5); - IntVar q(home, 1, 3); - IntVar y(home, 2, 10); - product(home, IntVarArgs({x, q}), y); - if ((home.status() == SS_FAILED) || (x.min() != 1)) - return arithmetic_failed("nonzero result: x, q, y", Gecode::IntVarArgs() << x << q << y); - } - { - TestSpace home; - IntVar x(home, -2, 2); - IntVar q(home, 1, 3); - IntVar y(home, 0, 0); - product(home, IntVarArgs({x, q}), y); - if ((home.status() == SS_FAILED) || !x.assigned() || (x.val() != 0)) - return arithmetic_failed("unique zero factor: x, q, y", Gecode::IntVarArgs() << x << q << y); - } - { - TestSpace home; - IntVar x(home, -5, 0); - IntVar q(home, 2, 4); - IntVar y(home, -100, 100); - product(home, IntVarArgs({x, q}), y); - if ((home.status() == SS_FAILED) || (y.max() != 0)) - return arithmetic_failed("nonpositive product: x, q, y", Gecode::IntVarArgs() << x << q << y); - } - { - TestSpace home; - IntVar x(home, -5, -2); - IntVar q(home, -4, -2); - IntVar y(home, -100, 100); - product(home, IntVarArgs({x, q}), y); - if ((home.status() == SS_FAILED) || (y.min() != 4)) - return arithmetic_failed("positive product: x, q, y", Gecode::IntVarArgs() << x << q << y); - } - { - TestSpace home; - const int hi = Gecode::Int::Limits::max; - IntVar minus(home, -1, -1); - IntVar x(home, hi, hi); - IntVar y(home, -hi, hi); - product(home, IntVarArgs({minus, x}), y); - if ((home.status() == SS_FAILED) || !y.assigned() || (y.val() != -hi)) - return arithmetic_failed("negative limit: minus, x, y", Gecode::IntVarArgs() - << minus << x << y); - } - { - CloneSpace home; - if (home.status() == SS_FAILED) - return arithmetic_failed("initial clone state: home.x, home.q, home.y", - Gecode::IntVarArgs() << home.x << home.q << home.y); - CloneSpace* clone = static_cast(home.clone()); - PropagatorGroup::all.disable(*clone); - rel(home, home.x, IRT_NQ, 0); - rel(*clone, clone->x, IRT_NQ, 0); - (void)home.status(); - (void)clone->status(); - rel(home, home.y, IRT_GQ, 2); - rel(*clone, clone->y, IRT_GQ, 2); - PropagatorGroup::all.enable(*clone); - const bool ok = (home.status() != SS_FAILED) && (clone->status() != SS_FAILED) && - (home.x.min() == 1) && (clone->x.min() == 1) && (home.y.min() == 2) && - (clone->y.min() == 2); - delete clone; - if (!ok) - return arithmetic_failed("rescheduling: home.x, home.q, home.y", - Gecode::IntVarArgs() << home.x << home.q << home.y); - } - return true; + public: + ProductCompactionZero() : ::Test::Base("Int::Arithmetic::Product::CompactionZero") {} + bool + run() override { + using namespace Gecode; + TestSpace home; + IntVarArgs x(home, 5, 0, 2); + IntVar y(home, 0, 32); + product(home, x, y); + if (home.status() == SS_FAILED) + return false; + rel(home, x[0], IRT_EQ, 1); + rel(home, x[4], IRT_EQ, 1); + rel(home, x[2], IRT_EQ, 0); + if ((home.status() == SS_FAILED) || !y.assigned() || (y.val() != 0)) + return arithmetic_failed("compaction with a zero factor", x); + return true; + } + }; + + /// Compute a canonical modular product for testing. + static int + product_mod_value(const Assignment& x, int n, int m) { + long long int p = 1 % m; + for (int i = 0; i < n; i++) { + long long int q = static_cast(x[i]) % m; + if (q < 0) + q += m; + p = (p * q) % m; + } + return static_cast(p); + } + + /// %Test for an ordinary and reified three-factor modular product + // Reified status tests observe interior residue membership, including + // the empty-product residue, but subscribe only to bounds changes. + class ProductModXYZR : public Test { + protected: + int m; + + public: + ProductModXYZR(const std::string& s, const Gecode::IntSet& d, int m0, Gecode::IntPropLevel ipl, bool r = true) + : Test("Arithmetic::ProductMod::XYZR::" + str(ipl) + "::" + s + (r ? "" : "::Plain"), 4, d, r, ipl), m(m0) { + consistency_test_level = CTL_NONE; + test_fixpoint = !r; + } + bool + solution(const Assignment& x) const override { + return product_mod_value(x, 3, m) == x[3]; + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::product_mod(home, Gecode::IntVarArgs({x[0], x[1], x[2]}), m, x[3], ipl); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::product_mod(home, Gecode::IntVarArgs({x[0], x[1], x[2]}), m, x[3], r, ipl); + } + }; + + /// Assigned coefficients with several free factors and all reification modes. + class ProductModCoefficient : public Test { + bool variable; + + public: + ProductModCoefficient(bool v) + : Test("Arithmetic::ProductMod::Coefficient::" + std::string(v ? "Variable" : "Fixed"), 3, + Gecode::IntSet(-3, 6), true, Gecode::IPL_BND), + variable(v) { + consistency_test_level = CTL_NONE; + test_fixpoint = false; + } + bool + solution(const Assignment& x) const override { + const int p = 6 * x[0] * x[1]; + return ((p % 12) + 12) % 12 == x[2]; + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVar c(home, 6, 6); + const Gecode::IntVarArgs factors({x[0], c, x[1]}); + if (variable) { + Gecode::IntVar m(home, 12, 12); + Gecode::product_mod(home, factors, m, x[2], ipl); + } else { + Gecode::product_mod(home, factors, 12, x[2], ipl); } - }; - - /// Test repeated powers and result-alias cancellation - class ProductPowerAlias : public ::Test::Base { - protected: - class TestSpace : public Gecode::Space { - public: - Gecode::Space* - copy(void) override { - return nullptr; - } - }; + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::IntVar c(home, 6, 6); + const Gecode::IntVarArgs factors({x[0], c, x[1]}); + if (variable) { + Gecode::IntVar m(home, 12, 12); + Gecode::product_mod(home, factors, m, x[2], r, ipl); + } else { + Gecode::product_mod(home, factors, 12, x[2], r, ipl); + } + } + }; + + /// Folded coefficients, repeated factors, and products beyond machine range. + class ProductModFolded : public Test { + int c; + int m; + + public: + ProductModFolded(int c0, int m0, bool r) + : Test("Arithmetic::ProductMod::Folded::" + str(c0) + "::" + str(m0) + (r ? "::Reified" : "::Plain"), 3, + Gecode::IntSet(-2, 6), r, Gecode::IPL_BND), + c(c0), m(m0) { + consistency_test_level = CTL_NONE; + test_fixpoint = !r; + } + bool + solution(const Assignment& x) const override { + long long int p = 1; + const int v[] = {c, x[0], c, x[0], x[1], c}; + for (int vi : v) + p = (p * ((vi % m + m) % m)) % m; + return p == x[2]; + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVar a(home, c, c); + Gecode::product_mod(home, Gecode::IntVarArgs({a, x[0], a, x[0], x[1], a}), m, x[2], ipl); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::IntVar a(home, c, c); + Gecode::product_mod(home, Gecode::IntVarArgs({a, x[0], a, x[0], x[1], a}), m, x[2], r, ipl); + } + }; + /// A nonzero modular result excludes every zero factor. + class ProductModNonzero : public ::Test::Base { + class TestSpace : public Gecode::Space { public: - ProductPowerAlias(void) : ::Test::Base("Int::Arithmetic::Product::PowerAlias") {} - bool - run(void) override { - using namespace Gecode; - { - TestSpace home; - IntVar x(home, -10, 10); - IntVar y(home, -10, 100); - product(home, IntVarArgs({x, x}), y); - if ((home.status() == SS_FAILED) || (y.min() != 0)) - return arithmetic_failed("square sign: x, y", Gecode::IntVarArgs() << x << y); - } - { - TestSpace home; - IntVar x(home, -10, 10); - IntVar y(home, 20, 30); - product(home, IntVarArgs({x, x}), y); - if ((home.status() == SS_FAILED) || (x.min() != -5) || (x.max() != 5)) - return arithmetic_failed("square inverse: x, y", Gecode::IntVarArgs() << x << y); - } - { - TestSpace home; - IntVar x(home, -10, 10); - IntVar y(home, 20, 30); - product(home, IntVarArgs({x, x, x}), y); - if ((home.status() == SS_FAILED) || !x.assigned() || (x.val() != 3)) - return arithmetic_failed("cube inverse: x, y", Gecode::IntVarArgs() << x << y); - } - { - TestSpace home; - IntVar x(home, -10, 10); - IntVar y(home, -30, -20); - product(home, IntVarArgs({x, x, x}), y); - if ((home.status() == SS_FAILED) || !x.assigned() || (x.val() != -3)) - return arithmetic_failed("negative cube inverse: x, y", Gecode::IntVarArgs() << x << y); - } - { - TestSpace home; - IntVar x(home, -10, 10); - IntVar two(home, 2, 2); - IntVar y(home, 50, 72); - product(home, IntVarArgs({x, x, two}), y); - if ((home.status() == SS_FAILED) || (x.min() != -6) || (x.max() != 6)) - return arithmetic_failed("square cofactor: x, two, y", Gecode::IntVarArgs() << x << two << y); - } - { - // x*y=y has only the zero branch when x cannot be one. - TestSpace home; - IntVar x(home, 2, 4); - IntVar y(home, -10, 10); - product(home, IntVarArgs({x, y}), y); - if ((home.status() == SS_FAILED) || !y.assigned() || (y.val() != 0)) - return arithmetic_failed("zero result alias: x, y", Gecode::IntVarArgs() << x << y); - } - { - // A nonzero result permits cancellation of one result occurrence. - TestSpace home; - IntVar x(home, 0, 2); - IntVar y(home, 2, 10); - product(home, IntVarArgs({x, y}), y); - if ((home.status() == SS_FAILED) || !x.assigned() || (x.val() != 1)) - return arithmetic_failed("nonzero cancellation: x, y", Gecode::IntVarArgs() << x << y); - } - { - // Cancelling one of two result occurrences leaves y*x=1. - TestSpace home; - IntVar x(home, -1, 0); - IntVar y(home, -2, -1); - product(home, IntVarArgs({y, y, x}), y); - if ((home.status() == SS_FAILED) || !x.assigned() || !y.assigned() || (x.val() != -1) || - (y.val() != -1)) - return arithmetic_failed("repeated result cancellation: x, y", Gecode::IntVarArgs() << x << y); - } - { - // Direct n-ary evaluation retains zero after an overflowing prefix. - TestSpace home; - const int hi = Gecode::Int::Limits::max; - IntVar a(home, hi, hi); - IntVar z(home, 0, 0); - IntVar y(home, 0, 0); - product(home, IntVarArgs({a, a, z}), y); - if (home.status() == SS_FAILED) - return arithmetic_failed("overflow followed by zero: a, z, y", Gecode::IntVarArgs() - << a << z << y); - } - { - TestSpace home; - IntVar x(home, -10, 10); - IntVar y(home, 20, 30); - BoolVar b(home, 1, 1); - product(home, IntVarArgs({x, x}), y, Reify(b, RM_EQV)); - if ((home.status() == SS_FAILED) || (x.min() != -5) || (x.max() != 5)) - return arithmetic_failed("reified square: x, y", Gecode::IntVarArgs() << x << y); - } - return true; + Gecode::Space* + copy() override { + return nullptr; } }; - /// Test zero-aware inverse bounds for every cofactor sign class - class ProductInverseBounds : public ::Test::Base { - protected: - class TestSpace : public Gecode::Space { - public: - Gecode::Space* - copy(void) override { - return nullptr; - } - }; - static bool - bounds(const Gecode::IntVar& x, int min, int max) { - return (x.min() == min) && (x.max() == max); - } - - public: - ProductInverseBounds(void) : ::Test::Base("Int::Arithmetic::Product::InverseBounds") {} - bool - run(void) override { - using namespace Gecode; - struct Case { - int qmin; - int qmax; - int xmin; - int xmax; - }; - const Case cases[] = { - {2, 4, 5, 12}, // Positive - {0, 4, 5, 24}, // Nonnegative - {-4, -2, -12, -5}, // Negative - {-4, 0, -24, -5}, // Nonpositive - {-4, 3, -24, 24} // Mixed across zero - }; - for (unsigned int i = 0; i < sizeof(cases) / sizeof(Case); i++) { + public: + ProductModNonzero() : ::Test::Base("Int::Arithmetic::ProductMod::Nonzero") {} + bool + run() override { + using namespace Gecode; + for (int negative = 0; negative < 2; negative++) + for (int variable = 0; variable < 2; variable++) { TestSpace home; - IntVar x(home, -100, 100); - IntVar q(home, cases[i].qmin, cases[i].qmax); - IntVar y(home, 20, 24); - product(home, IntVarArgs({x, q}), y); - if ((home.status() == SS_FAILED) || !bounds(x, cases[i].xmin, cases[i].xmax)) { - if (opt.log) - olog << "Inverse bounds, cofactor [" << cases[i].qmin << "," << cases[i].qmax - << "]: x=" << x << ", q=" << q << ", y=" << y << "; expected x=[" << cases[i].xmin - << "," << cases[i].xmax << "]" << '\n'; + IntVarArgs x(home, 4, negative ? -1 : 0, negative ? 0 : 1); + IntVar y(home, 0, 6); + IntVar m(home, 7, 11); + if (variable) + product_mod(home, x, m, y); + else + product_mod(home, x, 7, y); + if (home.status() == SS_FAILED) return false; - } - } - { - // When both the cofactor and result can be zero, no inverse - // pruning of the other factor is sound. - TestSpace home; - IntVar x(home, -100, 100); - IntVar q(home, -2, 3); - IntVar y(home, -10, 10); - product(home, IntVarArgs({x, q}), y); - if ((home.status() == SS_FAILED) || !bounds(x, -100, 100)) - return arithmetic_failed("unconstrained zero product: x, q, y", Gecode::IntVarArgs() - << x << q << y); - } - { - TestSpace home; - IntVar x(home, -100, 100); - IntVar zero(home, 0, 0); - IntVar y(home, 1, 2); - product(home, IntVarArgs({x, zero}), y); - if (home.status() != SS_FAILED) - return arithmetic_failed("impossible zero product: x, zero, y", Gecode::IntVarArgs() - << x << zero << y); - } - { - TestSpace home; - const int hi = Gecode::Int::Limits::max; - IntVar x(home, -1, 1); - IntVar a(home, hi, hi); - IntVar b(home, hi, hi); - IntVar y(home, 0, 0); - product(home, IntVarArgs({x, a, b}), y); - if ((home.status() == SS_FAILED) || !x.assigned() || (x.val() != 0)) - return arithmetic_failed("overflowing cofactor: x, a, b, y", Gecode::IntVarArgs() - << x << a << b << y); + rel(home, y, IRT_EQ, 1); + if (home.status() == SS_FAILED) + return arithmetic_failed("nonzero result failed", x); + for (int i = 0; i < x.size(); i++) + if (!x[i].assigned() || (x[i].val() != (negative ? -1 : 1))) + return arithmetic_failed("nonzero result left zero endpoint", x); } - return true; - } - }; + return true; + } + }; - /// Unit compaction must finish before a zero factor subsumes the actor. - class ProductCompactionZero : public ::Test::Base { - class TestSpace : public Gecode::Space { - public: - Gecode::Space* - copy(void) override { - return nullptr; - } - }; + /// %Test for the empty modular product, including modulus one + class ProductModEmpty : public Test { + protected: + int m; + + public: + ProductModEmpty(const std::string& s, const Gecode::IntSet& d, int m0, Gecode::IntPropLevel ipl) + : Test("Arithmetic::ProductMod::Empty::" + str(ipl) + "::" + s, 1, d, true, ipl), m(m0) { + consistency_test_level = CTL_NONE; + } + bool + solution(const Assignment& x) const override { + return x[0] == (1 % m); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::product_mod(home, Gecode::IntVarArgs(), m, x[0], ipl); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::product_mod(home, Gecode::IntVarArgs(), m, x[0], r, ipl); + } + }; + + /// %Test for a singleton modular product + class ProductModSingleton : public Test { + protected: + int m; + + public: + ProductModSingleton(const std::string& s, const Gecode::IntSet& d, int m0, Gecode::IntPropLevel ipl, + bool r = true) + : Test("Arithmetic::ProductMod::Singleton::" + str(ipl) + "::" + s + (r ? "" : "::Plain"), 2, d, r, ipl), + m(m0) { + consistency_test_level = CTL_NONE; + test_fixpoint = !r; + } + bool + solution(const Assignment& x) const override { + int r = x[0] % m; + if (r < 0) + r += m; + return r == x[1]; + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::product_mod(home, Gecode::IntVarArgs({x[0]}), m, x[1], ipl); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::product_mod(home, Gecode::IntVarArgs({x[0]}), m, x[1], r, ipl); + } + }; + + /// %Test repeated factors with the result aliased to a factor + class ProductModXXYAlias : public Test { + protected: + int m; + + public: + ProductModXXYAlias(const std::string& s, const Gecode::IntSet& d, int m0, Gecode::IntPropLevel ipl, + bool r = true) + : Test("Arithmetic::ProductMod::XXYAlias::" + str(ipl) + "::" + s + (r ? "" : "::Plain"), 2, d, r, ipl), + m(m0) { + consistency_test_level = CTL_NONE; + test_fixpoint = !r; + } + bool + solution(const Assignment& x) const override { + long long int a = x[0] % m; + long long int b = x[1] % m; + if (a < 0) + a += m; + if (b < 0) + b += m; + return (((a * a) % m) * b) % m == x[1]; + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::product_mod(home, Gecode::IntVarArgs({x[0], x[0], x[1]}), m, x[1], ipl); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::product_mod(home, Gecode::IntVarArgs({x[0], x[0], x[1]}), m, x[1], r, ipl); + } + }; + /// Targeted algebraic and quotient-band propagation for fixed modulus + class ProductModAlgebraic : public ::Test::Base { + protected: + class TestSpace : public Gecode::Space { public: - ProductCompactionZero(void) : ::Test::Base("Int::Arithmetic::Product::CompactionZero") {} - bool - run(void) override { - using namespace Gecode; - TestSpace home; - IntVarArgs x(home, 5, 0, 2); - IntVar y(home, 0, 32); - product(home, x, y); - if (home.status() == SS_FAILED) - return false; - rel(home, x[0], IRT_EQ, 1); - rel(home, x[4], IRT_EQ, 1); - rel(home, x[2], IRT_EQ, 0); - if ((home.status() == SS_FAILED) || !y.assigned() || (y.val() != 0)) - return arithmetic_failed("compaction with a zero factor", x); - return true; + Gecode::Space* + copy() override { + return nullptr; } }; - /// Compute a canonical modular product for testing. - int - product_mod_value(const Assignment& x, int n, int m) { - long long int p = 1 % m; - for (int i = 0; i < n; i++) { - long long int q = static_cast(x[i]) % m; - if (q < 0) - q += m; - p = (p * q) % m; + public: + ProductModAlgebraic() : ::Test::Base("Int::Arithmetic::ProductMod::Algebraic") {} + bool + run() override { + using namespace Gecode; + { + TestSpace home; + IntVarArgs x(home, 3, -100, 100); + IntVar y(home, -10, 10); + product_mod(home, x, 1, y); + if ((home.status() == SS_FAILED) || !y.assigned() || (y.val() != 0)) + return arithmetic_failed("modulus one: x, y", Gecode::IntVarArgs() << x << y); } - return static_cast(p); - } - - /// %Test for an ordinary and reified three-factor modular product - // Reified status tests observe interior residue membership, including - // the empty-product residue, but subscribe only to bounds changes. - class ProductModXYZR : public Test { - protected: - int m; - - public: - ProductModXYZR(const std::string& s, const Gecode::IntSet& d, int m0, Gecode::IntPropLevel ipl, - bool r = true) - : Test("Arithmetic::ProductMod::XYZR::" + str(ipl) + "::" + s + (r ? "" : "::Plain"), 4, d, r, ipl), - m(m0) { - consistency_test_level = CTL_NONE; - test_fixpoint = !r; + { + TestSpace home; + IntVar z(home, 14, 14); + IntVar x(home, -1000, 1000); + IntVar y(home, 0, 6); + product_mod(home, IntVarArgs({z, x}), 7, y); + if ((home.status() == SS_FAILED) || !y.assigned() || (y.val() != 0)) + return arithmetic_failed("zero residue factor: z, x, y", Gecode::IntVarArgs() << z << x << y); } - bool - solution(const Assignment& x) const override { - return product_mod_value(x, 3, m) == x[3]; + { + TestSpace home; + IntVar one(home, 1, 1); + IntVar x(home, 20, 30); + IntVar y(home, 0, 99); + product_mod(home, IntVarArgs({one, x}), 100, y); + if ((home.status() == SS_FAILED) || (y.min() != 20) || (y.max() != 30)) + return arithmetic_failed("nonwrapping product: one, x, y", Gecode::IntVarArgs() << one << x << y); + } + { + TestSpace home; + IntVar x(home, 15, 19); + IntVar y(home, 0, 6); + product_mod(home, IntVarArgs({x}), 7, y); + if ((home.status() == SS_FAILED) || (y.min() != 1) || (y.max() != 5)) + return arithmetic_failed("positive quotient band: x, y", Gecode::IntVarArgs() << x << y); } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::product_mod(home, Gecode::IntVarArgs({x[0], x[1], x[2]}), m, x[3], ipl); + { + TestSpace home; + IntVar x(home, -20, -16); + IntVar y(home, 0, 6); + product_mod(home, IntVarArgs({x}), 7, y); + if ((home.status() == SS_FAILED) || (y.min() != 1) || (y.max() != 5)) + return arithmetic_failed("negative quotient band: x, y", Gecode::IntVarArgs() << x << y); } - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::product_mod(home, Gecode::IntVarArgs({x[0], x[1], x[2]}), m, x[3], r, ipl); + { + TestSpace home; + IntVar c(home, 6, 6); + IntVar x(home, -100, 100); + IntVar y(home, 9, 9); + product_mod(home, IntVarArgs({c, x}), 15, y); + if ((home.status() == SS_FAILED) || (x.min() != -96) || (x.max() != 99)) + return arithmetic_failed("linear congruence: c, x, y", Gecode::IntVarArgs() << c << x << y); + } + { + TestSpace home; + IntVar c(home, 6, 6); + IntVar x(home, -100, 100); + IntVar y(home, 8, 8); + product_mod(home, IntVarArgs({c, x}), 15, y); + if (home.status() != SS_FAILED) + return arithmetic_failed("inconsistent congruence: c, x, y", Gecode::IntVarArgs() << c << x << y); + } + { + TestSpace home; + IntVar z(home, 0, 0); + IntVar x(home, -100, 100); + IntVar y(home, 0, 1); + BoolVar b(home, 0, 1); + product_mod(home, IntVarArgs({z, x}), 7, y, Reify(b)); + rel(home, y, IRT_EQ, 0); + if ((home.status() == SS_FAILED) || !b.assigned() || (b.val() != 1)) + return arithmetic_failed("reified zero residue: z, x, y", Gecode::IntVarArgs() << z << x << y); } - }; - - /// Assigned coefficients with several free factors and all reification modes. - class ProductModCoefficient : public Test { - bool variable; + return true; + } + }; + + /// %Test for an ordinary two-factor product with a variable modulus + // Empty-product status observes membership of 0/1 in the result, and + // divisor status observes interior modulus membership. Reposting can + // therefore strengthen propagation without a subscribed bounds event. + class ProductModVarXYMR : public Test { + public: + ProductModVarXYMR(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::ProductModVar::XYMR::" + str(ipl) + "::" + s, 4, d, true, ipl) { + consistency_test_level = CTL_NONE; + test_fixpoint = false; + } + bool + solution(const Assignment& x) const override { + return (x[2] > 0) && (product_mod_value(x, 2, x[2]) == x[3]); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::product_mod(home, Gecode::IntVarArgs({x[0], x[1]}), x[2], x[3], ipl); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::product_mod(home, Gecode::IntVarArgs({x[0], x[1]}), x[2], x[3], r, ipl); + } + }; + + /// %Test for the empty product with a variable modulus + class ProductModVarEmpty : public Test { + public: + ProductModVarEmpty(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::ProductModVar::Empty::" + str(ipl) + "::" + s, 2, d, true, ipl) { + consistency_test_level = CTL_NONE; + test_fixpoint = false; + } + bool + solution(const Assignment& x) const override { + return (x[0] > 0) && (x[1] == (1 % x[0])); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::product_mod(home, Gecode::IntVarArgs(), x[0], x[1], ipl); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::product_mod(home, Gecode::IntVarArgs(), x[0], x[1], r, ipl); + } + }; + + /// %Test for a singleton product with a variable modulus + class ProductModVarSingleton : public Test { + public: + ProductModVarSingleton(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::ProductModVar::Singleton::" + str(ipl) + "::" + s, 3, d, true, ipl) { + consistency_test_level = CTL_NONE; + test_fixpoint = false; + } + bool + solution(const Assignment& x) const override { + if (x[1] <= 0) + return false; + int r = x[0] % x[1]; + if (r < 0) + r += x[1]; + return r == x[2]; + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::product_mod(home, Gecode::IntVarArgs({x[0]}), x[1], x[2], ipl); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::product_mod(home, Gecode::IntVarArgs({x[0]}), x[1], x[2], r, ipl); + } + }; + + /// %Test repeated factors with a variable modulus + class ProductModVarRepeated : public Test { + public: + ProductModVarRepeated(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::ProductModVar::Repeated::" + str(ipl) + "::" + s, 3, d, true, ipl) { + consistency_test_level = CTL_NONE; + test_fixpoint = false; + } + bool + solution(const Assignment& x) const override { + if (x[1] <= 0) + return false; + long long int a = x[0] % x[1]; + if (a < 0) + a += x[1]; + return (a * a) % x[1] == x[2]; + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::product_mod(home, Gecode::IntVarArgs({x[0], x[0]}), x[1], x[2], ipl); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::product_mod(home, Gecode::IntVarArgs({x[0], x[0]}), x[1], x[2], r, ipl); + } + }; + + /// %Test modulus/factor aliasing + class ProductModVarModFactorAlias : public Test { + public: + ProductModVarModFactorAlias(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::ProductModVar::ModFactorAlias::" + str(ipl) + "::" + s, 2, d, true, ipl) { + consistency_test_level = CTL_NONE; + test_fixpoint = false; + } + bool + solution(const Assignment& x) const override { + return (x[0] > 0) && (x[1] == 0); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::product_mod(home, Gecode::IntVarArgs({x[0]}), x[0], x[1], ipl); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::product_mod(home, Gecode::IntVarArgs({x[0]}), x[0], x[1], r, ipl); + } + }; + + /// %Test factor/result aliasing + class ProductModVarFactorResultAlias : public Test { + public: + ProductModVarFactorResultAlias(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::ProductModVar::FactorResultAlias::" + str(ipl) + "::" + s, 2, d, true, ipl) { + consistency_test_level = CTL_NONE; + test_fixpoint = false; + } + bool + solution(const Assignment& x) const override { + if (x[1] <= 0) + return false; + int r = x[0] % x[1]; + if (r < 0) + r += x[1]; + return r == x[0]; + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::product_mod(home, Gecode::IntVarArgs({x[0]}), x[1], x[0], ipl); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::product_mod(home, Gecode::IntVarArgs({x[0]}), x[1], x[0], r, ipl); + } + }; + + /// %Test modulus/result aliasing, which is necessarily inconsistent + class ProductModVarModResultAlias : public Test { + public: + ProductModVarModResultAlias(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::ProductModVar::ModResultAlias::" + str(ipl) + "::" + s, 2, d, true, ipl) { + consistency_test_level = CTL_NONE; + } + bool + solution(const Assignment&) const override { + return false; + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::product_mod(home, Gecode::IntVarArgs({x[0]}), x[1], x[1], ipl); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::product_mod(home, Gecode::IntVarArgs({x[0]}), x[1], x[1], r, ipl); + } + }; + /// Targeted bounds and arithmetic checks for a variable modulus + class ProductModVarBounds : public ::Test::Base { + protected: + class TestSpace : public Gecode::Space { public: - ProductModCoefficient(bool v) - : Test("Arithmetic::ProductMod::Coefficient::" + std::string(v ? "Variable" : "Fixed"), 3, - Gecode::IntSet(-3, 6), true, Gecode::IPL_BND), - variable(v) { - consistency_test_level = CTL_NONE; - test_fixpoint = false; - } - bool - solution(const Assignment& x) const override { - const int p = 6 * x[0] * x[1]; - return ((p % 12) + 12) % 12 == x[2]; - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVar c(home, 6, 6); - const Gecode::IntVarArgs factors({x[0], c, x[1]}); - if (variable) { - Gecode::IntVar m(home, 12, 12); - Gecode::product_mod(home, factors, m, x[2], ipl); - } else { - Gecode::product_mod(home, factors, 12, x[2], ipl); - } - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::IntVar c(home, 6, 6); - const Gecode::IntVarArgs factors({x[0], c, x[1]}); - if (variable) { - Gecode::IntVar m(home, 12, 12); - Gecode::product_mod(home, factors, m, x[2], r, ipl); - } else { - Gecode::product_mod(home, factors, 12, x[2], r, ipl); - } + Gecode::Space* + copy() override { + return nullptr; } }; - /// Folded coefficients, repeated factors, and products beyond machine range. - class ProductModFolded : public Test { - int c; - int m; + public: + ProductModVarBounds() : ::Test::Base("Int::Arithmetic::ProductModVar::Bounds") {} + bool + run() override { + using namespace Gecode; + { + TestSpace home; + const int vm[5] = {-7, 0, 1, 4, 9}; + IntVar m(home, IntSet(vm, 5)); + IntVar y(home, -5, 12); + product_mod(home, IntVarArgs(), m, y); + if ((home.status() == SS_FAILED) || (m.min() != 1) || (y.min() != 0) || (y.max() >= m.max())) + return arithmetic_failed("empty product range: m, y", Gecode::IntVarArgs() << m << y); + } + { + TestSpace home; + IntVar x(home, Gecode::Int::Limits::max, Gecode::Int::Limits::max); + IntVar m(home, Gecode::Int::Limits::max, Gecode::Int::Limits::max); + IntVar y(home, 0, 0); + product_mod(home, IntVarArgs({x}), m, y); + if (home.status() == SS_FAILED) + return arithmetic_failed("integer limit modulus: x, m, y", Gecode::IntVarArgs() << x << m << y); + } + { + TestSpace home; + IntVar x(home, 3, 5); + IntVar c(home, 2, 2); + IntVar m(home, 5, 6); + IntVar y(home, 2, 2); + product_mod(home, IntVarArgs({x, c}), m, y); + if (home.status() == SS_FAILED) + return arithmetic_failed("delayed factor bounds: x, c, m, y", Gecode::IntVarArgs() + << x << c << m << y); + rel(home, x, IRT_LQ, 4); + if ((home.status() == SS_FAILED) || !x.assigned() || (x.val() != 4)) + return arithmetic_failed("nonwrapping variable modulus: x, c, m, y", Gecode::IntVarArgs() + << x << c << m << y); + } + { + TestSpace home; + IntVar x(home, 10, 20); + IntVar c(home, 10, 20); + IntVar m(home, 401, 509); + IntVar y(home, 0, 600); + product_mod(home, IntVarArgs({x, c}), m, y); + if ((home.status() == SS_FAILED) || (y.min() != 100) || (y.max() != 400)) + return arithmetic_failed("check 5: x, c, m, y", Gecode::IntVarArgs() << x << c << m << y); + } + return true; + } + }; + /// Modulus bounds must reach a fixpoint after jumping over a domain hole. + class ProductModVarSparseModulus : public ::Test::Base { + class TestSpace : public Gecode::Space { public: - ProductModFolded(int c0, int m0, bool r) - : Test("Arithmetic::ProductMod::Folded::" + str(c0) + "::" + str(m0) + (r ? "::Reified" : "::Plain"), 3, - Gecode::IntSet(-2, 6), r, Gecode::IPL_BND), - c(c0), m(m0) { - consistency_test_level = CTL_NONE; - test_fixpoint = !r; - } - bool - solution(const Assignment& x) const override { - long long int p = 1; - const int v[] = {c, x[0], c, x[0], x[1], c}; - for (int i = 0; i < 6; i++) - p = (p * ((v[i] % m + m) % m)) % m; - return p == x[2]; - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVar a(home, c, c); - Gecode::product_mod(home, Gecode::IntVarArgs({a, x[0], a, x[0], x[1], a}), m, x[2], ipl); - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::IntVar a(home, c, c); - Gecode::product_mod(home, Gecode::IntVarArgs({a, x[0], a, x[0], x[1], a}), m, x[2], r, ipl); + Gecode::Space* + copy() override { + return nullptr; } }; + /// Whether the remaining modulus domain contains a solution + bool supported; - /// A nonzero modular result excludes every zero factor. - class ProductModNonzero : public ::Test::Base { - class TestSpace : public Gecode::Space { - public: - Gecode::Space* - copy(void) override { - return nullptr; - } - }; + public: + ProductModVarSparseModulus(bool s) + : ::Test::Base("Int::Arithmetic::ProductModVar::SparseModulus::" + + std::string(s ? "Assignment" : "Failure")), + supported(s) {} + bool + run() override { + using namespace Gecode; + TestSpace home; + IntVar p(home, 60, 60); + IntVar y(home, 4, 4); + IntVar m(home, IntSet({20, supported ? 28 : 25, 100})); + product_mod(home, IntVarArgs({p}), m, y); + branch(home, m, INT_VAL_MIN()); + const SpaceStatus status = home.status(); + // m must divide 60-4=56. Dropping 100 exposes a single quotient + // band, which must be reconsidered without an external wakeup. + if (supported) { + if ((status == SS_FAILED) || !m.assigned() || (m.val() != 28)) + return arithmetic_failed("sparse modulus must become 28: p, m, y", IntVarArgs() << p << m << y); + } else if (status != SS_FAILED) { + return arithmetic_failed("sparse modulus has no divisor of 56: p, m, y", IntVarArgs() << p << m << y); + } + return true; + } + }; + /// Targeted algebraic propagation for a variable modulus + class ProductModVarAlgebraic : public ::Test::Base { + protected: + class TestSpace : public Gecode::Space { public: - ProductModNonzero(void) : ::Test::Base("Int::Arithmetic::ProductMod::Nonzero") {} - bool - run(void) override { - using namespace Gecode; - for (int negative = 0; negative < 2; negative++) - for (int variable = 0; variable < 2; variable++) { - TestSpace home; - IntVarArgs x(home, 4, negative ? -1 : 0, negative ? 0 : 1); - IntVar y(home, 0, 6); - IntVar m(home, 7, 11); - if (variable) - product_mod(home, x, m, y); - else - product_mod(home, x, 7, y); - if (home.status() == SS_FAILED) - return false; - rel(home, y, IRT_EQ, 1); - if (home.status() == SS_FAILED) - return arithmetic_failed("nonzero result failed", x); - for (int i = 0; i < x.size(); i++) - if (!x[i].assigned() || (x[i].val() != (negative ? -1 : 1))) - return arithmetic_failed("nonzero result left zero endpoint", x); - } - return true; + Gecode::Space* + copy() override { + return nullptr; } }; + static bool + domain(const Gecode::IntVar& x, const int* v, int n) { + if (x.size() != static_cast(n)) + return false; + for (int i = 0; i < n; i++) + if (!x.in(v[i])) + return false; + return true; + } - /// %Test for the empty modular product, including modulus one - class ProductModEmpty : public Test { - protected: - int m; - - public: - ProductModEmpty(const std::string& s, const Gecode::IntSet& d, int m0, Gecode::IntPropLevel ipl) - : Test("Arithmetic::ProductMod::Empty::" + str(ipl) + "::" + s, 1, d, true, ipl), m(m0) { - consistency_test_level = CTL_NONE; + public: + ProductModVarAlgebraic() : ::Test::Base("Int::Arithmetic::ProductModVar::Algebraic") {} + bool + run() override { + using namespace Gecode; + { + TestSpace home; + IntVar m(home, 2, Gecode::Int::Limits::max); + IntVar z(home, -100, 100); + IntVar y(home, 0, 100); + product_mod(home, IntVarArgs({z, m}), m, y); + if ((home.status() == SS_FAILED) || !y.assigned() || (y.val() != 0)) + return arithmetic_failed("modulus factor: m, z, y", Gecode::IntVarArgs() << m << z << y); } - bool - solution(const Assignment& x) const override { - return x[0] == (1 % m); + { + TestSpace home; + const int mv[5] = {-3, 0, 1, 7, 1000000}; + IntVar m(home, IntSet(mv, 5)); + IntVar y(home, 0, 0); + product_mod(home, IntVarArgs(), m, y); + if ((home.status() == SS_FAILED) || !m.assigned() || (m.val() != 1)) + return arithmetic_failed("empty product zero: m, y", Gecode::IntVarArgs() << m << y); + } + { + TestSpace home; + const int mv[4] = {1, 2, 17, 1000000}; + const int keep[3] = {2, 17, 1000000}; + IntVar m(home, IntSet(mv, 4)); + IntVar y(home, 1, 1); + product_mod(home, IntVarArgs(), m, y); + if ((home.status() == SS_FAILED) || !domain(m, keep, 3)) + return arithmetic_failed("empty product one: m, y", Gecode::IntVarArgs() << m << y); + } + { + TestSpace home; + const int mv[10] = {5, 7, 8, 9, 14, 16, 28, 55, 56, 1000000}; + IntVar a(home, 6, 6); + IntVar c(home, 10, 10); + IntVar m(home, IntSet(mv, 10)); + IntVar y(home, 4, 4); + product_mod(home, IntVarArgs({a, c}), m, y); + if ((home.status() == SS_FAILED) || (m.min() != 5) || (m.max() != 56)) + return arithmetic_failed("divisor upper bound: a, c, m, y", Gecode::IntVarArgs() + << a << c << m << y); } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::product_mod(home, Gecode::IntVarArgs(), m, x[0], ipl); + { + TestSpace home; + const int mv[7] = {4, 5, 6, 7, 10, 11, 60}; + IntVar a(home, 6, 6); + IntVar c(home, 10, 10); + IntVar m(home, IntSet(mv, 7)); + IntVar y(home, 0, 0); + product_mod(home, IntVarArgs({a, c}), m, y); + if ((home.status() == SS_FAILED) || (m.min() != 4) || (m.max() != 60)) + return arithmetic_failed("sparse divisor range: a, c, m, y", Gecode::IntVarArgs() + << a << c << m << y); + } + { + TestSpace home; + const int mv[3] = {13, 101, 1000000}; + IntVar y(home, 12, 12); + IntVar m(home, IntSet(mv, 3)); + product_mod(home, IntVarArgs({y}), m, y); + if ((home.status() == SS_FAILED) || !domain(m, mv, 3)) + return arithmetic_failed("result factor: y, m", Gecode::IntVarArgs() << y << m); + } + { + TestSpace home; + const int mv[3] = {2, 17, 1000000}; + IntVar z(home, 0, 0); + IntVar y(home, 0, 0); + IntVar m(home, IntSet(mv, 3)); + product_mod(home, IntVarArgs({z}), m, y); + if ((home.status() == SS_FAILED) || !domain(m, mv, 3)) + return arithmetic_failed("zero factor: z, y, m", Gecode::IntVarArgs() << z << y << m); + } + { + TestSpace home; + const int hi = Gecode::Int::Limits::max; + IntVar a(home, hi, hi); + IntVar c(home, hi, hi); + IntVar d(home, hi, hi); + IntVar m(home, 2, hi); + IntVar y(home, 0, 0); + product_mod(home, IntVarArgs({a, c, d}), m, y); + if (home.status() == SS_FAILED) + return arithmetic_failed("overflowing assigned product: a, c, d, m, y", + Gecode::IntVarArgs() << a << c << d << m << y); } - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::product_mod(home, Gecode::IntVarArgs(), m, x[0], r, ipl); + { + TestSpace home; + const int hi = Gecode::Int::Limits::max; + IntVar x(home, hi, hi); + IntVar m(home, 1, hi); + IntVar y(home, 0, 0); + product_mod(home, IntVarArgs({x}), m, y); + if ((home.status() == SS_FAILED) || (m.min() != 1) || (m.max() != hi)) + return arithmetic_failed("limit dividend: x, m, y", Gecode::IntVarArgs() << x << m << y); + } + { + TestSpace home; + const int hi = Gecode::Int::Limits::max; + IntVar x(home, hi, hi); + IntVar m(home, 2, hi); + IntVar y(home, 1, 1); + product_mod(home, IntVarArgs({x}), m, y); + if ((home.status() == SS_FAILED) || (m.min() != 2) || (m.max() != hi - 1)) + return arithmetic_failed("limit difference: x, m, y", Gecode::IntVarArgs() << x << m << y); } - }; - - /// %Test for a singleton modular product - class ProductModSingleton : public Test { - protected: - int m; + return true; + } + }; - public: - ProductModSingleton(const std::string& s, const Gecode::IntSet& d, int m0, Gecode::IntPropLevel ipl, - bool r = true) - : Test("Arithmetic::ProductMod::Singleton::" + str(ipl) + "::" + s + (r ? "" : "::Plain"), 2, d, r, - ipl), - m(m0) { - consistency_test_level = CTL_NONE; - test_fixpoint = !r; - } - bool - solution(const Assignment& x) const override { - int r = x[0] % m; - if (r < 0) - r += m; - return r == x[1]; - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::product_mod(home, Gecode::IntVarArgs({x[0]}), m, x[1], ipl); - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::product_mod(home, Gecode::IntVarArgs({x[0]}), m, x[1], r, ipl); - } - }; + /// Inactive implications preserve every assignment in the input domains. + class ProductModVarInactive : public Test { + int mode; - /// %Test repeated factors with the result aliased to a factor - class ProductModXXYAlias : public Test { - protected: - int m; + public: + ProductModVarInactive(int m) : Test("Arithmetic::ProductModVar::Inactive::" + str(m), 3, -4, 7), mode(m) {} + bool + solution(const Assignment& x) const override { + return ((x[0] == -3) || (x[0] == -1) || (x[0] == 0) || (x[0] == 2) || (x[0] == 5)) && + ((x[1] == -2) || (x[1] == 0) || (x[1] == 1) || (x[1] == 4)) && + ((x[2] == -4) || (x[2] == 0) || (x[2] == 3) || (x[2] == 7)); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + Gecode::dom(home, x[0], IntSet({-3, -1, 0, 2, 5})); + Gecode::dom(home, x[1], IntSet({-2, 0, 1, 4})); + Gecode::dom(home, x[2], IntSet({-4, 0, 3, 7})); + BoolVar b(home, mode, mode); + product_mod(home, IntVarArgs({x[0], x[0]}), x[1], x[2], Reify(b, mode == 0 ? RM_IMP : RM_RIMP)); + } + }; + /// %Test that a nonpositive modular-product modulus is rejected + class ProductModInvalidModulus : public ::Test::Base { + protected: + class TestSpace : public Gecode::Space { public: - ProductModXXYAlias(const std::string& s, const Gecode::IntSet& d, int m0, Gecode::IntPropLevel ipl, - bool r = true) - : Test("Arithmetic::ProductMod::XXYAlias::" + str(ipl) + "::" + s + (r ? "" : "::Plain"), 2, d, r, ipl), - m(m0) { - consistency_test_level = CTL_NONE; - test_fixpoint = !r; - } - bool - solution(const Assignment& x) const override { - long long int a = x[0] % m; - long long int b = x[1] % m; - if (a < 0) - a += m; - if (b < 0) - b += m; - return (((a * a) % m) * b) % m == x[1]; - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::product_mod(home, Gecode::IntVarArgs({x[0], x[0], x[1]}), m, x[1], ipl); - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::product_mod(home, Gecode::IntVarArgs({x[0], x[0], x[1]}), m, x[1], r, ipl); + Gecode::Space* + copy() override { + return nullptr; } }; - /// Targeted algebraic and quotient-band propagation for fixed modulus - class ProductModAlgebraic : public ::Test::Base { - protected: - class TestSpace : public Gecode::Space { - public: - Gecode::Space* - copy(void) override { - return nullptr; - } - }; - - public: - ProductModAlgebraic(void) : ::Test::Base("Int::Arithmetic::ProductMod::Algebraic") {} - bool - run(void) override { - using namespace Gecode; - { - TestSpace home; - IntVarArgs x(home, 3, -100, 100); - IntVar y(home, -10, 10); - product_mod(home, x, 1, y); - if ((home.status() == SS_FAILED) || !y.assigned() || (y.val() != 0)) - return arithmetic_failed("modulus one: x, y", Gecode::IntVarArgs() << x << y); - } - { - TestSpace home; - IntVar z(home, 14, 14); - IntVar x(home, -1000, 1000); - IntVar y(home, 0, 6); - product_mod(home, IntVarArgs({z, x}), 7, y); - if ((home.status() == SS_FAILED) || !y.assigned() || (y.val() != 0)) - return arithmetic_failed("zero residue factor: z, x, y", Gecode::IntVarArgs() << z << x << y); - } - { - TestSpace home; - IntVar one(home, 1, 1); - IntVar x(home, 20, 30); - IntVar y(home, 0, 99); - product_mod(home, IntVarArgs({one, x}), 100, y); - if ((home.status() == SS_FAILED) || (y.min() != 20) || (y.max() != 30)) - return arithmetic_failed("nonwrapping product: one, x, y", Gecode::IntVarArgs() - << one << x << y); + public: + ProductModInvalidModulus() : ::Test::Base("Int::Arithmetic::ProductMod::InvalidModulus") {} + bool + run() override { + TestSpace home; + Gecode::IntVar y(home, 0, 1); + for (int m = 0; m >= -1; m--) { + try { + Gecode::product_mod(home, Gecode::IntVarArgs(), m, y); + return arithmetic_failed("accepted invalid modulus: y", Gecode::IntVarArgs() << y); + } catch (const Gecode::Int::OutOfLimits&) { + // Expected } - { - TestSpace home; - IntVar x(home, 15, 19); - IntVar y(home, 0, 6); - product_mod(home, IntVarArgs({x}), 7, y); - if ((home.status() == SS_FAILED) || (y.min() != 1) || (y.max() != 5)) - return arithmetic_failed("positive quotient band: x, y", Gecode::IntVarArgs() << x << y); - } - { - TestSpace home; - IntVar x(home, -20, -16); - IntVar y(home, 0, 6); - product_mod(home, IntVarArgs({x}), 7, y); - if ((home.status() == SS_FAILED) || (y.min() != 1) || (y.max() != 5)) - return arithmetic_failed("negative quotient band: x, y", Gecode::IntVarArgs() << x << y); - } - { - TestSpace home; - IntVar c(home, 6, 6); - IntVar x(home, -100, 100); - IntVar y(home, 9, 9); - product_mod(home, IntVarArgs({c, x}), 15, y); - if ((home.status() == SS_FAILED) || (x.min() != -96) || (x.max() != 99)) - return arithmetic_failed("linear congruence: c, x, y", Gecode::IntVarArgs() << c << x << y); - } - { - TestSpace home; - IntVar c(home, 6, 6); - IntVar x(home, -100, 100); - IntVar y(home, 8, 8); - product_mod(home, IntVarArgs({c, x}), 15, y); - if (home.status() != SS_FAILED) - return arithmetic_failed("inconsistent congruence: c, x, y", Gecode::IntVarArgs() - << c << x << y); - } - { - TestSpace home; - IntVar z(home, 0, 0); - IntVar x(home, -100, 100); - IntVar y(home, 0, 1); - BoolVar b(home, 0, 1); - product_mod(home, IntVarArgs({z, x}), 7, y, Reify(b)); - rel(home, y, IRT_EQ, 0); - if ((home.status() == SS_FAILED) || !b.assigned() || (b.val() != 1)) - return arithmetic_failed("reified zero residue: z, x, y", Gecode::IntVarArgs() << z << x << y); - } - return true; - } - }; - - /// %Test for an ordinary two-factor product with a variable modulus - // Empty-product status observes membership of 0/1 in the result, and - // divisor status observes interior modulus membership. Reposting can - // therefore strengthen propagation without a subscribed bounds event. - class ProductModVarXYMR : public Test { - public: - ProductModVarXYMR(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::ProductModVar::XYMR::" + str(ipl) + "::" + s, 4, d, true, ipl) { - consistency_test_level = CTL_NONE; - test_fixpoint = false; - } - bool - solution(const Assignment& x) const override { - return (x[2] > 0) && (product_mod_value(x, 2, x[2]) == x[3]); - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::product_mod(home, Gecode::IntVarArgs({x[0], x[1]}), x[2], x[3], ipl); - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::product_mod(home, Gecode::IntVarArgs({x[0], x[1]}), x[2], x[3], r, ipl); - } - }; - - /// %Test for the empty product with a variable modulus - class ProductModVarEmpty : public Test { - public: - ProductModVarEmpty(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::ProductModVar::Empty::" + str(ipl) + "::" + s, 2, d, true, ipl) { - consistency_test_level = CTL_NONE; - test_fixpoint = false; - } - bool - solution(const Assignment& x) const override { - return (x[0] > 0) && (x[1] == (1 % x[0])); - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::product_mod(home, Gecode::IntVarArgs(), x[0], x[1], ipl); - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::product_mod(home, Gecode::IntVarArgs(), x[0], x[1], r, ipl); - } - }; - - /// %Test for a singleton product with a variable modulus - class ProductModVarSingleton : public Test { - public: - ProductModVarSingleton(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::ProductModVar::Singleton::" + str(ipl) + "::" + s, 3, d, true, ipl) { - consistency_test_level = CTL_NONE; - test_fixpoint = false; - } - bool - solution(const Assignment& x) const override { - if (x[1] <= 0) - return false; - int r = x[0] % x[1]; - if (r < 0) - r += x[1]; - return r == x[2]; - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::product_mod(home, Gecode::IntVarArgs({x[0]}), x[1], x[2], ipl); - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::product_mod(home, Gecode::IntVarArgs({x[0]}), x[1], x[2], r, ipl); - } - }; - - /// %Test repeated factors with a variable modulus - class ProductModVarRepeated : public Test { - public: - ProductModVarRepeated(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::ProductModVar::Repeated::" + str(ipl) + "::" + s, 3, d, true, ipl) { - consistency_test_level = CTL_NONE; - test_fixpoint = false; - } - bool - solution(const Assignment& x) const override { - if (x[1] <= 0) - return false; - long long int a = x[0] % x[1]; - if (a < 0) - a += x[1]; - return (a * a) % x[1] == x[2]; - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::product_mod(home, Gecode::IntVarArgs({x[0], x[0]}), x[1], x[2], ipl); - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::product_mod(home, Gecode::IntVarArgs({x[0], x[0]}), x[1], x[2], r, ipl); - } - }; - - /// %Test modulus/factor aliasing - class ProductModVarModFactorAlias : public Test { - public: - ProductModVarModFactorAlias(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::ProductModVar::ModFactorAlias::" + str(ipl) + "::" + s, 2, d, true, ipl) { - consistency_test_level = CTL_NONE; - test_fixpoint = false; - } - bool - solution(const Assignment& x) const override { - return (x[0] > 0) && (x[1] == 0); - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::product_mod(home, Gecode::IntVarArgs({x[0]}), x[0], x[1], ipl); - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::product_mod(home, Gecode::IntVarArgs({x[0]}), x[0], x[1], r, ipl); - } - }; - - /// %Test factor/result aliasing - class ProductModVarFactorResultAlias : public Test { - public: - ProductModVarFactorResultAlias(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::ProductModVar::FactorResultAlias::" + str(ipl) + "::" + s, 2, d, true, ipl) { - consistency_test_level = CTL_NONE; - test_fixpoint = false; - } - bool - solution(const Assignment& x) const override { - if (x[1] <= 0) - return false; - int r = x[0] % x[1]; - if (r < 0) - r += x[1]; - return r == x[0]; - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::product_mod(home, Gecode::IntVarArgs({x[0]}), x[1], x[0], ipl); - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::product_mod(home, Gecode::IntVarArgs({x[0]}), x[1], x[0], r, ipl); - } - }; - - /// %Test modulus/result aliasing, which is necessarily inconsistent - class ProductModVarModResultAlias : public Test { - public: - ProductModVarModResultAlias(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::ProductModVar::ModResultAlias::" + str(ipl) + "::" + s, 2, d, true, ipl) { - consistency_test_level = CTL_NONE; - } - bool - solution(const Assignment&) const override { - return false; - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::product_mod(home, Gecode::IntVarArgs({x[0]}), x[1], x[1], ipl); - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::product_mod(home, Gecode::IntVarArgs({x[0]}), x[1], x[1], r, ipl); - } - }; - - /// Targeted bounds and arithmetic checks for a variable modulus - class ProductModVarBounds : public ::Test::Base { - protected: - class TestSpace : public Gecode::Space { - public: - Gecode::Space* - copy(void) override { - return nullptr; - } - }; - - public: - ProductModVarBounds(void) : ::Test::Base("Int::Arithmetic::ProductModVar::Bounds") {} - bool - run(void) override { - using namespace Gecode; - { - TestSpace home; - const int vm[5] = {-7, 0, 1, 4, 9}; - IntVar m(home, IntSet(vm, 5)); - IntVar y(home, -5, 12); - product_mod(home, IntVarArgs(), m, y); - if ((home.status() == SS_FAILED) || (m.min() != 1) || (y.min() != 0) || (y.max() >= m.max())) - return arithmetic_failed("empty product range: m, y", Gecode::IntVarArgs() << m << y); - } - { - TestSpace home; - IntVar x(home, Gecode::Int::Limits::max, Gecode::Int::Limits::max); - IntVar m(home, Gecode::Int::Limits::max, Gecode::Int::Limits::max); - IntVar y(home, 0, 0); - product_mod(home, IntVarArgs({x}), m, y); - if (home.status() == SS_FAILED) - return arithmetic_failed("integer limit modulus: x, m, y", Gecode::IntVarArgs() << x << m << y); - } - { - TestSpace home; - IntVar x(home, 3, 5); - IntVar c(home, 2, 2); - IntVar m(home, 5, 6); - IntVar y(home, 2, 2); - product_mod(home, IntVarArgs({x, c}), m, y); - if (home.status() == SS_FAILED) - return arithmetic_failed("delayed factor bounds: x, c, m, y", Gecode::IntVarArgs() - << x << c << m << y); - rel(home, x, IRT_LQ, 4); - if ((home.status() == SS_FAILED) || !x.assigned() || (x.val() != 4)) - return arithmetic_failed("nonwrapping variable modulus: x, c, m, y", Gecode::IntVarArgs() - << x << c << m << y); - } - { - TestSpace home; - IntVar x(home, 10, 20); - IntVar c(home, 10, 20); - IntVar m(home, 401, 509); - IntVar y(home, 0, 600); - product_mod(home, IntVarArgs({x, c}), m, y); - if ((home.status() == SS_FAILED) || (y.min() != 100) || (y.max() != 400)) - return arithmetic_failed("check 5: x, c, m, y", Gecode::IntVarArgs() << x << c << m << y); - } - return true; - } - }; - - /// Modulus bounds must reach a fixpoint after jumping over a domain hole. - class ProductModVarSparseModulus : public ::Test::Base { - class TestSpace : public Gecode::Space { - public: - Gecode::Space* - copy(void) override { - return nullptr; - } - }; - /// Whether the remaining modulus domain contains a solution - bool supported; - - public: - ProductModVarSparseModulus(bool s) - : ::Test::Base("Int::Arithmetic::ProductModVar::SparseModulus::" + - std::string(s ? "Assignment" : "Failure")), - supported(s) {} - bool - run(void) override { - using namespace Gecode; - TestSpace home; - IntVar p(home, 60, 60); - IntVar y(home, 4, 4); - IntVar m(home, IntSet({20, supported ? 28 : 25, 100})); - product_mod(home, IntVarArgs({p}), m, y); - branch(home, m, INT_VAL_MIN()); - const SpaceStatus status = home.status(); - // m must divide 60-4=56. Dropping 100 exposes a single quotient - // band, which must be reconsidered without an external wakeup. - if (supported) { - if ((status == SS_FAILED) || !m.assigned() || (m.val() != 28)) - return arithmetic_failed("sparse modulus must become 28: p, m, y", IntVarArgs() << p << m << y); - } else if (status != SS_FAILED) { - return arithmetic_failed("sparse modulus has no divisor of 56: p, m, y", IntVarArgs() - << p << m << y); - } - return true; - } - }; - - /// Targeted algebraic propagation for a variable modulus - class ProductModVarAlgebraic : public ::Test::Base { - protected: - class TestSpace : public Gecode::Space { - public: - Gecode::Space* - copy(void) override { - return nullptr; - } - }; - static bool - domain(const Gecode::IntVar& x, const int* v, int n) { - if (x.size() != static_cast(n)) - return false; - for (int i = 0; i < n; i++) - if (!x.in(v[i])) - return false; - return true; - } - - public: - ProductModVarAlgebraic(void) : ::Test::Base("Int::Arithmetic::ProductModVar::Algebraic") {} - bool - run(void) override { - using namespace Gecode; - { - TestSpace home; - IntVar m(home, 2, Gecode::Int::Limits::max); - IntVar z(home, -100, 100); - IntVar y(home, 0, 100); - product_mod(home, IntVarArgs({z, m}), m, y); - if ((home.status() == SS_FAILED) || !y.assigned() || (y.val() != 0)) - return arithmetic_failed("modulus factor: m, z, y", Gecode::IntVarArgs() << m << z << y); - } - { - TestSpace home; - const int mv[5] = {-3, 0, 1, 7, 1000000}; - IntVar m(home, IntSet(mv, 5)); - IntVar y(home, 0, 0); - product_mod(home, IntVarArgs(), m, y); - if ((home.status() == SS_FAILED) || !m.assigned() || (m.val() != 1)) - return arithmetic_failed("empty product zero: m, y", Gecode::IntVarArgs() << m << y); - } - { - TestSpace home; - const int mv[4] = {1, 2, 17, 1000000}; - const int keep[3] = {2, 17, 1000000}; - IntVar m(home, IntSet(mv, 4)); - IntVar y(home, 1, 1); - product_mod(home, IntVarArgs(), m, y); - if ((home.status() == SS_FAILED) || !domain(m, keep, 3)) - return arithmetic_failed("empty product one: m, y", Gecode::IntVarArgs() << m << y); - } - { - TestSpace home; - const int mv[10] = {5, 7, 8, 9, 14, 16, 28, 55, 56, 1000000}; - IntVar a(home, 6, 6); - IntVar c(home, 10, 10); - IntVar m(home, IntSet(mv, 10)); - IntVar y(home, 4, 4); - product_mod(home, IntVarArgs({a, c}), m, y); - if ((home.status() == SS_FAILED) || (m.min() != 5) || (m.max() != 56)) - return arithmetic_failed("divisor upper bound: a, c, m, y", Gecode::IntVarArgs() - << a << c << m << y); - } - { - TestSpace home; - const int mv[7] = {4, 5, 6, 7, 10, 11, 60}; - IntVar a(home, 6, 6); - IntVar c(home, 10, 10); - IntVar m(home, IntSet(mv, 7)); - IntVar y(home, 0, 0); - product_mod(home, IntVarArgs({a, c}), m, y); - if ((home.status() == SS_FAILED) || (m.min() != 4) || (m.max() != 60)) - return arithmetic_failed("sparse divisor range: a, c, m, y", Gecode::IntVarArgs() - << a << c << m << y); - } - { - TestSpace home; - const int mv[3] = {13, 101, 1000000}; - IntVar y(home, 12, 12); - IntVar m(home, IntSet(mv, 3)); - product_mod(home, IntVarArgs({y}), m, y); - if ((home.status() == SS_FAILED) || !domain(m, mv, 3)) - return arithmetic_failed("result factor: y, m", Gecode::IntVarArgs() << y << m); - } - { - TestSpace home; - const int mv[3] = {2, 17, 1000000}; - IntVar z(home, 0, 0); - IntVar y(home, 0, 0); - IntVar m(home, IntSet(mv, 3)); - product_mod(home, IntVarArgs({z}), m, y); - if ((home.status() == SS_FAILED) || !domain(m, mv, 3)) - return arithmetic_failed("zero factor: z, y, m", Gecode::IntVarArgs() << z << y << m); - } - { - TestSpace home; - const int hi = Gecode::Int::Limits::max; - IntVar a(home, hi, hi); - IntVar c(home, hi, hi); - IntVar d(home, hi, hi); - IntVar m(home, 2, hi); - IntVar y(home, 0, 0); - product_mod(home, IntVarArgs({a, c, d}), m, y); - if (home.status() == SS_FAILED) - return arithmetic_failed("overflowing assigned product: a, c, d, m, y", - Gecode::IntVarArgs() << a << c << d << m << y); - } - { - TestSpace home; - const int hi = Gecode::Int::Limits::max; - IntVar x(home, hi, hi); - IntVar m(home, 1, hi); - IntVar y(home, 0, 0); - product_mod(home, IntVarArgs({x}), m, y); - if ((home.status() == SS_FAILED) || (m.min() != 1) || (m.max() != hi)) - return arithmetic_failed("limit dividend: x, m, y", Gecode::IntVarArgs() << x << m << y); - } - { - TestSpace home; - const int hi = Gecode::Int::Limits::max; - IntVar x(home, hi, hi); - IntVar m(home, 2, hi); - IntVar y(home, 1, 1); - product_mod(home, IntVarArgs({x}), m, y); - if ((home.status() == SS_FAILED) || (m.min() != 2) || (m.max() != hi - 1)) - return arithmetic_failed("limit difference: x, m, y", Gecode::IntVarArgs() << x << m << y); - } - return true; - } - }; - - /// Inactive implications preserve every assignment in the input domains. - class ProductModVarInactive : public Test { - int mode; - - public: - ProductModVarInactive(int m) : Test("Arithmetic::ProductModVar::Inactive::" + str(m), 3, -4, 7), mode(m) {} - bool - solution(const Assignment& x) const override { - return ((x[0] == -3) || (x[0] == -1) || (x[0] == 0) || (x[0] == 2) || (x[0] == 5)) && - ((x[1] == -2) || (x[1] == 0) || (x[1] == 1) || (x[1] == 4)) && - ((x[2] == -4) || (x[2] == 0) || (x[2] == 3) || (x[2] == 7)); - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - Gecode::dom(home, x[0], IntSet({-3, -1, 0, 2, 5})); - Gecode::dom(home, x[1], IntSet({-2, 0, 1, 4})); - Gecode::dom(home, x[2], IntSet({-4, 0, 3, 7})); - BoolVar b(home, mode, mode); - product_mod(home, IntVarArgs({x[0], x[0]}), x[1], x[2], Reify(b, mode == 0 ? RM_IMP : RM_RIMP)); - } - }; - - /// %Test that a nonpositive modular-product modulus is rejected - class ProductModInvalidModulus : public ::Test::Base { - protected: - class TestSpace : public Gecode::Space { - public: - Gecode::Space* - copy(void) override { - return nullptr; - } - }; - - public: - ProductModInvalidModulus(void) : ::Test::Base("Int::Arithmetic::ProductMod::InvalidModulus") {} - bool - run(void) override { - TestSpace home; - Gecode::IntVar y(home, 0, 1); - for (int m = 0; m >= -1; m--) { - try { - Gecode::product_mod(home, Gecode::IntVarArgs(), m, y); - return arithmetic_failed("accepted invalid modulus: y", Gecode::IntVarArgs() << y); - } catch (const Gecode::Int::OutOfLimits&) { - } - } - return true; - } - }; - - /// %Test for multiplication constraint - class MultXYZ : public Test { - public: - /// Create and register test - MultXYZ(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Mult::XYZ::" + str(ipl) + "::" + s, 3, d, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - double d0 = static_cast(x[0]); - double d1 = static_cast(x[1]); - double d2 = static_cast(x[2]); - return d0 * d1 == d2; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::mult(home, x[0], x[1], x[2], ipl); - } - }; - - /// %Test for multiplication constraint with shared variables - class MultXXY : public Test { - public: - /// Create and register test - MultXXY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Mult::XXY::" + str(ipl) + "::" + s, 2, d, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - double d0 = static_cast(x[0]); - double d1 = static_cast(x[0]); - double d2 = static_cast(x[1]); - return d0 * d1 == d2; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::mult(home, x[0], x[0], x[1], ipl); - } - }; - - /// %Test for multiplication constraint with shared variables - class MultXYX : public Test { - public: - /// Create and register test - MultXYX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Mult::XYX::" + str(ipl) + "::" + s, 2, d, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - double d0 = static_cast(x[0]); - double d1 = static_cast(x[1]); - double d2 = static_cast(x[0]); - return d0 * d1 == d2; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::mult(home, x[0], x[1], x[0], ipl); - } - }; - - /// %Test for multiplication constraint with shared variables - class MultXYY : public Test { - public: - /// Create and register test - MultXYY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Mult::XYY::" + str(ipl) + "::" + s, 2, d, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - double d0 = static_cast(x[0]); - double d1 = static_cast(x[1]); - double d2 = static_cast(x[1]); - return d0 * d1 == d2; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::mult(home, x[0], x[1], x[1], ipl); - } - }; - - /// %Test for multiplication constraint with shared variables - class MultXXX : public Test { - public: - /// Create and register test - MultXXX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Mult::XXX::" + str(ipl) + "::" + s, 1, d, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - double d0 = static_cast(x[0]); - double d1 = static_cast(x[0]); - double d2 = static_cast(x[0]); - return d0 * d1 == d2; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::mult(home, x[0], x[0], x[0], ipl); - } - }; - - /// %Test for squaring constraint - class SqrXY : public Test { - public: - /// Create and register test - SqrXY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Sqr::XY::" + str(ipl) + "::" + s, 2, d, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - double d0 = static_cast(x[0]); - double d1 = static_cast(x[1]); - return d0 * d0 == d1; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::sqr(home, x[0], x[1], ipl); - } - }; - - /// %Test for squaring constraint with shared variables - class SqrXX : public Test { - public: - /// Create and register test - SqrXX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Sqr::XX::" + str(ipl) + "::" + s, 1, d, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - double d0 = static_cast(x[0]); - return d0 * d0 == d0; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::sqr(home, x[0], x[0], ipl); - } - }; - - /// %Test for square root constraint - class SqrtXY : public Test { - public: - /// Create and register test - SqrtXY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Sqrt::XY::" + str(ipl) + "::" + s, 2, d, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - double d0 = static_cast(x[0]); - double d1 = static_cast(x[1]); - return (d0 >= 0) && (d0 >= d1 * d1) && (d0 < (d1 + 1) * (d1 + 1)); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::sqrt(home, x[0], x[1], ipl); - } - }; - - /// %Test for square root constraint with shared variables - class SqrtXX : public Test { - public: - /// Create and register test - SqrtXX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Sqrt::XX::" + str(ipl) + "::" + s, 1, d, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - double d0 = static_cast(x[0]); - return (d0 >= 0) && (d0 >= d0 * d0) && (d0 < (d0 + 1) * (d0 + 1)); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::sqrt(home, x[0], x[0], ipl); - } - }; - - /// %Test for power constraint - class PowXY : public Test { - protected: - /// The exponent - int n; - - public: - /// Create and register test - PowXY(TestTags tags, const std::string& s, int n0, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test(tags, "Arithmetic::Pow::XY::" + str(n0) + "::" + str(ipl) + "::" + s, 2, d, false, ipl), n(n0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - long long int p = 1; - for (int i = 0; i < n; i++) { - p *= x[0]; - if ((p < Gecode::Int::Limits::min) || (p > Gecode::Int::Limits::max)) - return false; - } - return p == x[1]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - if (n > 4) - pow(home, x[0], n, x[1], ipl); - else - rel(home, expr(home, pow(x[0], n), ipl), IRT_EQ, x[1], ipl); - } - }; - - /// %Test for power constraint with shared variables - class PowXX : public Test { - protected: - /// The exponent - int n; - - public: - /// Create and register test - PowXX(TestTags tags, const std::string& s, int n0, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test(tags, "Arithmetic::Pow::XX::" + str(n0) + "::" + str(ipl) + "::" + s, 1, d, false, ipl), n(n0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - long long int p = 1; - for (int i = 0; i < n; i++) { - p *= x[0]; - if ((p < Gecode::Int::Limits::min) || (p > Gecode::Int::Limits::max)) - return false; - } - return p == x[0]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::pow(home, x[0], n, x[0], ipl); - } - }; - - bool - powgr(int n, long long int r, int x) { - assert(r >= 0); - long long int y = r; - long long int p = 1; - do { - p *= y; - n--; - if (p > x) - return true; - } while (n > 0); - return false; - } - - int - floor_nth_root(int n, int x) { - if (x < 2) - return x; - /* - * We look for l such that: l^n <= x < (l+1)^n - */ - long long int l = 1; - long long int u = x; - do { - long long int m = (l + u) >> 1; - if (powgr(n, m, x)) - u = m; - else - l = m; - } while (l + 1 < u); - return static_cast(l); - } - - bool - powle(int n, long long int r, int x) { - assert(r >= 0); - long long int y = r; - long long int p = 1; - do { - p *= y; - n--; - if (p >= x) - return false; - } while (n > 0); - assert(y < x); - return true; - } - - int - ceil_nth_root(int n, int x) { - if (x < 2) - return x; - /* - * We look for u such that: (u-1)^n < x <= u^n - */ - long long int l = 1; - long long int u = x; - do { - long long int m = (l + u) >> 1; - if (powle(n, m, x)) - l = m; - else - u = m; - } while (l + 1 < u); - return static_cast(u); - } - - /// %Test for nroot constraint - class NrootXY : public Test { - protected: - /// The root index - int n; - /// Floor - public: - /// Create and register test - NrootXY(TestTags tags, const std::string& s, int n0, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test(tags, "Arithmetic::Nroot::XY::" + str(n0) + "::" + str(ipl) + "::" + s, 2, d, false, ipl), - n(n0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - if (n == 1) - return x[0] == x[1]; - if ((n % 2 == 0) && ((x[0] < 0) || (x[1] < 0))) - return false; - int r = (x[0] < 0) ? -ceil_nth_root(n, -x[0]) : floor_nth_root(n, x[0]); - return r == x[1]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - if (n > 4) - nroot(home, x[0], n, x[1], ipl); - else - rel(home, expr(home, nroot(x[0], n), ipl), IRT_EQ, x[1], ipl); - } - }; - - /// %Test for nroot constraint with shared variables - class NrootXX : public Test { - protected: - /// The root index - int n; - - public: - /// Create and register test - NrootXX(TestTags tags, const std::string& s, int n0, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test(tags, "Arithmetic::Nroot::XX::" + str(n0) + "::" + str(ipl) + "::" + s, 1, d, false, ipl), - n(n0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - if (n == 1) - return true; - if (n % 2 == 0) { - return (x[0] >= 0) && (x[0] <= 1); - } else { - return (x[0] >= -2) && (x[0] <= 1); - } - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::nroot(home, x[0], n, x[0], ipl); - } - }; - - /// %Test for division/modulo constraint - class DivMod : public Test { - private: - /// Return the absolute value of \a a - static int - abs(int a) { - return a < 0 ? -a : a; - } - /// Return the sign of \a a - static int - sgn(int a) { - return a < 0 ? -1 : 1; - } - - public: - /// Create and register test - DivMod(const std::string& s, const Gecode::IntSet& d) : Test("Arithmetic::DivMod::" + s, 4, d) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return x[0] == static_cast(x[1]) * x[2] + x[3] && abs(x[3]) < abs(x[1]) && - (x[3] == 0 || sgn(x[3]) == sgn(x[0])); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::divmod(home, x[0], x[1], x[2], x[3]); - } - }; - - /// %Test for division constraint - class Div : public Test { - public: - /// Create and register test - Div(const std::string& s, const Gecode::IntSet& d) : Test("Arithmetic::Div::" + s, 3, d) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - if (x[1] == 0) - return false; - int divsign = (x[0] / x[1] < 0) ? -1 : 1; - int divresult = - divsign * - static_cast(floor(static_cast(std::abs(x[0])) / static_cast(std::abs(x[1])))); - return x[2] == divresult; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::div(home, x[0], x[1], x[2]); - } - }; - - /// %Test for modulo constraint - class Mod : public Test { - public: - /// Create and register test - Mod(const std::string& s, const Gecode::IntSet& d) : Test("Arithmetic::Mod::" + s, 3, d) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - if (x[1] == 0) - return false; - int divsign = (x[0] / x[1] < 0) ? -1 : 1; - int divresult = - divsign * - static_cast(floor(static_cast(std::abs(x[0])) / static_cast(std::abs(x[1])))); - return x[0] == static_cast(x[1]) * divresult + x[2]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::mod(home, x[0], x[1], x[2]); - } - }; - - /// %Test for absolute value constraint - class AbsXY : public Test { - public: - /// Create and register test - AbsXY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test(TestTags::check(), "Arithmetic::Abs::XY::" + str(ipl) + "::" + s, 2, d, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - double d0 = static_cast(x[0]); - double d1 = static_cast(x[1]); - return (d0 < 0 ? -d0 : d0) == d1; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::abs(home, x[0], x[1], ipl); - } - }; - - /// %Test for absolute value constraint with shared variables - class AbsXX : public Test { - public: - /// Create and register test - AbsXX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test(TestTags::check(), "Arithmetic::Abs::XX::" + str(ipl) + "::" + s, 1, d, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - double d0 = static_cast(x[0]); - double d1 = static_cast(x[0]); - return (d0 < 0 ? -d0 : d0) == d1; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::abs(home, x[0], x[0], ipl); - } - }; - - /// %Test for binary minimum constraint - class MinXYZ : public Test { - public: - /// Create and register test - MinXYZ(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Min::Bin::XYZ::" + str(ipl) + "::" + s, 3, d, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return std::min(x[0], x[1]) == x[2]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::min(home, x[0], x[1], x[2], ipl); - } - }; - - /// %Test for binary minimum constraint with shared variables - class MinXXY : public Test { - public: - /// Create and register test - MinXXY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Min::Bin::XYX::" + str(ipl) + "::" + s, 2, d) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return std::min(x[0], x[0]) == x[1]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::min(home, x[0], x[0], x[1], ipl); - } - }; - - /// %Test for binary minimum constraint with shared variables - class MinXYX : public Test { - public: - /// Create and register test - MinXYX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Min::Bin::XYX::" + str(ipl) + "::" + s, 2, d) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return std::min(x[0], x[1]) == x[0]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::min(home, x[0], x[1], x[0], ipl); - } - }; - - /// %Test for binary minimum constraint with shared variables - class MinXYY : public Test { - public: - /// Create and register test - MinXYY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Min::Bin::XYY::" + str(ipl) + "::" + s, 2, d) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return std::min(x[0], x[1]) == x[1]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::min(home, x[0], x[1], x[1], ipl); - } - }; - - /// %Test for binary minimum constraint with shared variables - class MinXXX : public Test { - public: - /// Create and register test - MinXXX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Min::Bin::XXX::" + str(ipl) + "::" + s, 1, d) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return std::min(x[0], x[0]) == x[0]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::min(home, x[0], x[0], x[0], ipl); - } - }; - - /// %Test for binary maximum constraint - class MaxXYZ : public Test { - public: - /// Create and register test - MaxXYZ(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Max::Bin::XYZ::" + str(ipl) + "::" + s, 3, d) { - consistency_test_level = CTL_BOUNDS_Z; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return std::max(x[0], x[1]) == x[2]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::max(home, x[0], x[1], x[2], ipl); - } - }; - - /// %Test for binary maximum constraint with shared variables - class MaxXXY : public Test { - public: - /// Create and register test - MaxXXY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Max::Bin::XXY::" + str(ipl) + "::" + s, 2, d) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return std::max(x[0], x[0]) == x[1]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::max(home, x[0], x[0], x[1], ipl); - } - }; - - /// %Test for binary maximum constraint with shared variables - class MaxXYX : public Test { - public: - /// Create and register test - MaxXYX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Max::Bin::XYX::" + str(ipl) + "::" + s, 2, d) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return std::max(x[0], x[1]) == x[0]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::max(home, x[0], x[1], x[0], ipl); - } - }; - - /// %Test for binary maximum constraint with shared variables - class MaxXYY : public Test { - public: - /// Create and register test - MaxXYY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Max::Bin::XYY::" + str(ipl) + "::" + s, 2, d) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return std::max(x[0], x[1]) == x[1]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::max(home, x[0], x[1], x[1], ipl); - } - }; - - /// %Test for binary maximum constraint with shared variables - class MaxXXX : public Test { - public: - /// Create and register test - MaxXXX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("Arithmetic::Max::Bin::XXX::" + str(ipl) + "::" + s, 1, d) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return std::max(x[0], x[0]) == x[0]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::max(home, x[0], x[0], x[0], ipl); - } - }; - - /// %Test for n-ary minimmum constraint - class MinNary : public Test { - public: - /// Create and register test - MinNary(Gecode::IntPropLevel ipl) : Test("Arithmetic::Min::Nary::" + str(ipl), 4, -4, 4, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return std::min(std::min(x[0], x[1]), x[2]) == x[3]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs m(3); - m[0] = x[0]; - m[1] = x[1]; - m[2] = x[2]; - Gecode::min(home, m, x[3], ipl); - } - }; - - /// %Test for n-ary minimmum constraint with shared variables - class MinNaryShared : public Test { - public: - /// Create and register test - MinNaryShared(Gecode::IntPropLevel ipl) - : Test("Arithmetic::Min::Nary::Shared::" + str(ipl), 3, -4, 4, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return std::min(std::min(x[0], x[1]), x[2]) == x[1]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs m(3); - m[0] = x[0]; - m[1] = x[1]; - m[2] = x[2]; - Gecode::min(home, m, x[1], ipl); - } - }; - - /// %Test for n-ary maximum constraint - class MaxNary : public Test { - public: - /// Create and register test - MaxNary(Gecode::IntPropLevel ipl) - : Test(TestTags::check(), "Arithmetic::Max::Nary::" + str(ipl), 4, -4, 4, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return std::max(std::max(x[0], x[1]), x[2]) == x[3]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs m(3); - m[0] = x[0]; - m[1] = x[1]; - m[2] = x[2]; - Gecode::max(home, m, x[3], ipl); - } - }; - - /// %Test for n-ary maximum constraint with shared variables - class MaxNaryShared : public Test { - public: - /// Create and register test - MaxNaryShared(Gecode::IntPropLevel ipl) - : Test(TestTags::check(), "Arithmetic::Max::Nary::Shared::" + str(ipl), 3, -4, 4, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return std::max(std::max(x[0], x[1]), x[2]) == x[1]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs m(3); - m[0] = x[0]; - m[1] = x[1]; - m[2] = x[2]; - Gecode::max(home, m, x[1], ipl); - } - }; - - /// %Test for argument maximum constraint - class ArgMax : public Test { - protected: - /// Offset to be used - int offset; - /// Whether to use tie-breaking - bool tie_break; - - public: - /// Create and register test - ArgMax(int n, int o, bool tb) - : Test(TestTags::check(), "Arithmetic::ArgMax::" + str(o) + "::" + str(tb) + "::" + str(n), n + 1, 0, - n + 1, false, tb ? Gecode::IPL_DEF : Gecode::IPL_DOM), - offset(o), tie_break(tb) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() - 1; - if ((x[n] < offset) || (x[n] >= n + offset)) - return false; - int m = x[0]; - int p = 0; - for (int i = 1; i < n; i++) - if (x[i] > m) { - p = i; - m = x[i]; - } - return tie_break ? (p + offset == x[n]) : (m == x[x[n] - offset]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - int n = x.size() - 1; - Gecode::IntVarArgs m(n); - for (int i = 0; i < n; i++) - m[i] = x[i]; - Gecode::argmax(home, m, offset, x[n], tie_break); - } - }; - - /// %Test for argument maximum constraint with shared variables - class ArgMaxShared : public Test { - protected: - /// Whether to use tie-breaking - bool tie_break; - - public: - /// Create and register test - ArgMaxShared(int n, bool tb) - : Test(TestTags::check(), "Arithmetic::ArgMax::Shared::" + str(tb) + "::" + str(n), n + 1, 0, n + 1, - false), - tie_break(tb) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() - 1; - if ((x[n] < 0) || (x[n] >= 2 * n)) - return false; - Gecode::IntArgs y(2 * n); - for (int i = 0; i < n; i++) - y[2 * i + 0] = y[2 * i + 1] = x[i]; - int m = y[0]; - int p = 0; - for (int i = 1; i < 2 * n; i++) - if (y[i] > m) { - p = i; - m = y[i]; - } - return tie_break ? (p == x[n]) : (m == y[x[n]]); } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - int n = x.size() - 1; - Gecode::IntVarArgs m(2 * n); - for (int i = 0; i < n; i++) - m[2 * i + 0] = m[2 * i + 1] = x[i]; - Gecode::argmax(home, m, x[n], tie_break); - } - }; - - /// %Test for argument minimum constraint - class ArgMin : public Test { - protected: - /// Which offset to use - int offset; - /// Whether to use tie-breaking - bool tie_break; - - public: - /// Create and register test - ArgMin(int n, int o, bool tb) - : Test("Arithmetic::ArgMin::" + str(o) + "::" + str(tb) + "::" + str(n), n + 1, 0, n + 1, false, - tb ? Gecode::IPL_DEF : Gecode::IPL_DOM), - offset(o), tie_break(tb) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() - 1; - if ((x[n] < offset) || (x[n] >= n + offset)) + return true; + } + }; + + /// %Test for multiplication constraint + class MultXYZ : public Test { + public: + /// Create and register test + MultXYZ(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Mult::XYZ::" + str(ipl) + "::" + s, 3, d, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + double d0 = static_cast(x[0]); + double d1 = static_cast(x[1]); + double d2 = static_cast(x[2]); + return d0 * d1 == d2; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::mult(home, x[0], x[1], x[2], ipl); + } + }; + + /// %Test for multiplication constraint with shared variables + class MultXXY : public Test { + public: + /// Create and register test + MultXXY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Mult::XXY::" + str(ipl) + "::" + s, 2, d, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + double d0 = static_cast(x[0]); + double d1 = static_cast(x[0]); + double d2 = static_cast(x[1]); + return d0 * d1 == d2; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::mult(home, x[0], x[0], x[1], ipl); + } + }; + + /// %Test for multiplication constraint with shared variables + class MultXYX : public Test { + public: + /// Create and register test + MultXYX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Mult::XYX::" + str(ipl) + "::" + s, 2, d, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + double d0 = static_cast(x[0]); + double d1 = static_cast(x[1]); + double d2 = static_cast(x[0]); + return d0 * d1 == d2; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::mult(home, x[0], x[1], x[0], ipl); + } + }; + + /// %Test for multiplication constraint with shared variables + class MultXYY : public Test { + public: + /// Create and register test + MultXYY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Mult::XYY::" + str(ipl) + "::" + s, 2, d, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + double d0 = static_cast(x[0]); + double d1 = static_cast(x[1]); + double d2 = static_cast(x[1]); + return d0 * d1 == d2; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::mult(home, x[0], x[1], x[1], ipl); + } + }; + + /// %Test for multiplication constraint with shared variables + class MultXXX : public Test { + public: + /// Create and register test + MultXXX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Mult::XXX::" + str(ipl) + "::" + s, 1, d, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + double d0 = static_cast(x[0]); + double d1 = static_cast(x[0]); + double d2 = static_cast(x[0]); + return d0 * d1 == d2; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::mult(home, x[0], x[0], x[0], ipl); + } + }; + + /// %Test for squaring constraint + class SqrXY : public Test { + public: + /// Create and register test + SqrXY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Sqr::XY::" + str(ipl) + "::" + s, 2, d, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + double d0 = static_cast(x[0]); + double d1 = static_cast(x[1]); + return d0 * d0 == d1; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::sqr(home, x[0], x[1], ipl); + } + }; + + /// %Test for squaring constraint with shared variables + class SqrXX : public Test { + public: + /// Create and register test + SqrXX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Sqr::XX::" + str(ipl) + "::" + s, 1, d, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + double d0 = static_cast(x[0]); + return d0 * d0 == d0; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::sqr(home, x[0], x[0], ipl); + } + }; + + /// %Test for square root constraint + class SqrtXY : public Test { + public: + /// Create and register test + SqrtXY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Sqrt::XY::" + str(ipl) + "::" + s, 2, d, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + double d0 = static_cast(x[0]); + double d1 = static_cast(x[1]); + return (d0 >= 0) && (d0 >= d1 * d1) && (d0 < (d1 + 1) * (d1 + 1)); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::sqrt(home, x[0], x[1], ipl); + } + }; + + /// %Test for square root constraint with shared variables + class SqrtXX : public Test { + public: + /// Create and register test + SqrtXX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Sqrt::XX::" + str(ipl) + "::" + s, 1, d, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + double d0 = static_cast(x[0]); + return (d0 >= 0) && (d0 >= d0 * d0) && (d0 < (d0 + 1) * (d0 + 1)); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::sqrt(home, x[0], x[0], ipl); + } + }; + + /// %Test for power constraint + class PowXY : public Test { + protected: + /// The exponent + int n; + + public: + /// Create and register test + PowXY(TestTags tags, const std::string& s, int n0, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test(tags, "Arithmetic::Pow::XY::" + str(n0) + "::" + str(ipl) + "::" + s, 2, d, false, ipl), n(n0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + long long int p = 1; + for (int i = 0; i < n; i++) { + p *= x[0]; + if ((p < Gecode::Int::Limits::min) || (p > Gecode::Int::Limits::max)) return false; - int m = x[0]; - int p = 0; - for (int i = 1; i < n; i++) - if (x[i] < m) { - p = i; - m = x[i]; - } - return tie_break ? (p + offset == x[n]) : (m == x[x[n] - offset]); } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - int n = x.size() - 1; - Gecode::IntVarArgs m(n); - for (int i = 0; i < n; i++) - m[i] = x[i]; - Gecode::argmin(home, m, offset, x[n], tie_break); - } - }; - - /// %Test for argument minimum constraint with shared variables - class ArgMinShared : public Test { - protected: - /// Whether to use tie-breaking - bool tie_break; - - public: - /// Create and register test - ArgMinShared(int n, bool tb) - : Test("Arithmetic::ArgMin::Shared::" + str(tb) + "::" + str(n), n + 1, 0, n + 1, false), - tie_break(tb) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() - 1; - if ((x[n] < 0) || (x[n] >= 2 * n)) + return p == x[1]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + if (n > 4) + pow(home, x[0], n, x[1], ipl); + else + rel(home, expr(home, pow(x[0], n), ipl), IRT_EQ, x[1], ipl); + } + }; + + /// %Test for power constraint with shared variables + class PowXX : public Test { + protected: + /// The exponent + int n; + + public: + /// Create and register test + PowXX(TestTags tags, const std::string& s, int n0, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test(tags, "Arithmetic::Pow::XX::" + str(n0) + "::" + str(ipl) + "::" + s, 1, d, false, ipl), n(n0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + long long int p = 1; + for (int i = 0; i < n; i++) { + p *= x[0]; + if ((p < Gecode::Int::Limits::min) || (p > Gecode::Int::Limits::max)) return false; - Gecode::IntArgs y(2 * n); - for (int i = 0; i < n; i++) - y[2 * i + 0] = y[2 * i + 1] = x[i]; - int m = y[0]; - int p = 0; - for (int i = 1; i < 2 * n; i++) - if (y[i] < m) { - p = i; - m = y[i]; - } - return tie_break ? (p == x[n]) : (m == y[x[n]]); } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - int n = x.size() - 1; - Gecode::IntVarArgs m(2 * n); - for (int i = 0; i < n; i++) - m[2 * i + 0] = m[2 * i + 1] = x[i]; - Gecode::argmin(home, m, x[n], tie_break); + return p == x[0]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::pow(home, x[0], n, x[0], ipl); + } + }; + + static bool + powgr(int n, long long int r, int x) { + assert(r >= 0); + long long int y = r; + long long int p = 1; + do { + p *= y; + n--; + if (p > x) + return true; + } while (n > 0); + return false; + } + + static int + floor_nth_root(int n, int x) { + if (x < 2) + return x; + /* + * We look for l such that: l^n <= x < (l+1)^n + */ + long long int l = 1; + long long int u = x; + do { + long long int m = (l + u) >> 1; + if (powgr(n, m, x)) + u = m; + else + l = m; + } while (l + 1 < u); + return static_cast(l); + } + + static bool + powle(int n, long long int r, int x) { + assert(r >= 0); + long long int y = r; + long long int p = 1; + do { + p *= y; + n--; + if (p >= x) + return false; + } while (n > 0); + assert(y < x); + return true; + } + + static int + ceil_nth_root(int n, int x) { + if (x < 2) + return x; + /* + * We look for u such that: (u-1)^n < x <= u^n + */ + long long int l = 1; + long long int u = x; + do { + long long int m = (l + u) >> 1; + if (powle(n, m, x)) + l = m; + else + u = m; + } while (l + 1 < u); + return static_cast(u); + } + + /// %Test for nroot constraint + class NrootXY : public Test { + protected: + /// The root index + int n; + /// Floor + public: + /// Create and register test + NrootXY(TestTags tags, const std::string& s, int n0, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test(tags, "Arithmetic::Nroot::XY::" + str(n0) + "::" + str(ipl) + "::" + s, 2, d, false, ipl), n(n0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + if (n == 1) + return x[0] == x[1]; + if ((n % 2 == 0) && ((x[0] < 0) || (x[1] < 0))) + return false; + int r = (x[0] < 0) ? -ceil_nth_root(n, -x[0]) : floor_nth_root(n, x[0]); + return r == x[1]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + if (n > 4) + nroot(home, x[0], n, x[1], ipl); + else + rel(home, expr(home, nroot(x[0], n), ipl), IRT_EQ, x[1], ipl); + } + }; + + /// %Test for nroot constraint with shared variables + class NrootXX : public Test { + protected: + /// The root index + int n; + + public: + /// Create and register test + NrootXX(TestTags tags, const std::string& s, int n0, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test(tags, "Arithmetic::Nroot::XX::" + str(n0) + "::" + str(ipl) + "::" + s, 1, d, false, ipl), n(n0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + if (n == 1) + return true; + if (n % 2 == 0) { + return (x[0] >= 0) && (x[0] <= 1); } - }; - - /// %Test for Boolean argument maximum constraint - class ArgMaxBool : public Test { - protected: - /// Offset to be used - int offset; - /// Whether to use tie-breaking - bool tie_break; + return (x[0] >= -2) && (x[0] <= 1); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::nroot(home, x[0], n, x[0], ipl); + } + }; + + /// %Test for division/modulo constraint + class DivMod : public Test { + private: + /// Return the absolute value of \a a + static int + abs(int a) { + return a < 0 ? -a : a; + } + /// Return the sign of \a a + static int + sgn(int a) { + return a < 0 ? -1 : 1; + } - public: - /// Create and register test - ArgMaxBool(int n, int o, bool tb) - : Test(TestTags::check(), "Arithmetic::ArgMaxBool::" + str(o) + "::" + str(tb) + "::" + str(n), n + 1, - 0, n + 1, false, tb ? Gecode::IPL_DEF : Gecode::IPL_DOM), - offset(o), tie_break(tb) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() - 1; - if ((x[n] < offset) || (x[n] >= n + offset)) - return false; - int m = x[0]; - int p = 0; - if (x[0] > 1) + public: + /// Create and register test + DivMod(const std::string& s, const Gecode::IntSet& d) : Test("Arithmetic::DivMod::" + s, 4, d) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return x[0] == static_cast(x[1]) * x[2] + x[3] && abs(x[3]) < abs(x[1]) && + (x[3] == 0 || sgn(x[3]) == sgn(x[0])); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::divmod(home, x[0], x[1], x[2], x[3]); + } + }; + + /// %Test for division constraint + class Div : public Test { + public: + /// Create and register test + Div(const std::string& s, const Gecode::IntSet& d) : Test("Arithmetic::Div::" + s, 3, d) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + if (x[1] == 0) + return false; + int divsign = (x[0] / x[1] < 0) ? -1 : 1; + int divresult = + divsign * + static_cast(floor(static_cast(std::abs(x[0])) / static_cast(std::abs(x[1])))); + return x[2] == divresult; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::div(home, x[0], x[1], x[2]); + } + }; + + /// %Test for modulo constraint + class Mod : public Test { + public: + /// Create and register test + Mod(const std::string& s, const Gecode::IntSet& d) : Test("Arithmetic::Mod::" + s, 3, d) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + if (x[1] == 0) + return false; + int divsign = (x[0] / x[1] < 0) ? -1 : 1; + int divresult = + divsign * + static_cast(floor(static_cast(std::abs(x[0])) / static_cast(std::abs(x[1])))); + return x[0] == static_cast(x[1]) * divresult + x[2]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::mod(home, x[0], x[1], x[2]); + } + }; + + /// %Test for absolute value constraint + class AbsXY : public Test { + public: + /// Create and register test + AbsXY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test(TestTags::check(), "Arithmetic::Abs::XY::" + str(ipl) + "::" + s, 2, d, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + double d0 = static_cast(x[0]); + double d1 = static_cast(x[1]); + return (d0 < 0 ? -d0 : d0) == d1; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::abs(home, x[0], x[1], ipl); + } + }; + + /// %Test for absolute value constraint with shared variables + class AbsXX : public Test { + public: + /// Create and register test + AbsXX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test(TestTags::check(), "Arithmetic::Abs::XX::" + str(ipl) + "::" + s, 1, d, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + double d0 = static_cast(x[0]); + double d1 = static_cast(x[0]); + return (d0 < 0 ? -d0 : d0) == d1; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::abs(home, x[0], x[0], ipl); + } + }; + + /// %Test for binary minimum constraint + class MinXYZ : public Test { + public: + /// Create and register test + MinXYZ(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Min::Bin::XYZ::" + str(ipl) + "::" + s, 3, d, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return std::min(x[0], x[1]) == x[2]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::min(home, x[0], x[1], x[2], ipl); + } + }; + + /// %Test for binary minimum constraint with shared variables + class MinXXY : public Test { + public: + /// Create and register test + MinXXY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Min::Bin::XYX::" + str(ipl) + "::" + s, 2, d) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return std::min(x[0], x[0]) == x[1]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::min(home, x[0], x[0], x[1], ipl); + } + }; + + /// %Test for binary minimum constraint with shared variables + class MinXYX : public Test { + public: + /// Create and register test + MinXYX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Min::Bin::XYX::" + str(ipl) + "::" + s, 2, d) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return std::min(x[0], x[1]) == x[0]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::min(home, x[0], x[1], x[0], ipl); + } + }; + + /// %Test for binary minimum constraint with shared variables + class MinXYY : public Test { + public: + /// Create and register test + MinXYY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Min::Bin::XYY::" + str(ipl) + "::" + s, 2, d) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return std::min(x[0], x[1]) == x[1]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::min(home, x[0], x[1], x[1], ipl); + } + }; + + /// %Test for binary minimum constraint with shared variables + class MinXXX : public Test { + public: + /// Create and register test + MinXXX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Min::Bin::XXX::" + str(ipl) + "::" + s, 1, d) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return std::min(x[0], x[0]) == x[0]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::min(home, x[0], x[0], x[0], ipl); + } + }; + + /// %Test for binary maximum constraint + class MaxXYZ : public Test { + public: + /// Create and register test + MaxXYZ(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Max::Bin::XYZ::" + str(ipl) + "::" + s, 3, d) { + consistency_test_level = CTL_BOUNDS_Z; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return std::max(x[0], x[1]) == x[2]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::max(home, x[0], x[1], x[2], ipl); + } + }; + + /// %Test for binary maximum constraint with shared variables + class MaxXXY : public Test { + public: + /// Create and register test + MaxXXY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Max::Bin::XXY::" + str(ipl) + "::" + s, 2, d) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return std::max(x[0], x[0]) == x[1]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::max(home, x[0], x[0], x[1], ipl); + } + }; + + /// %Test for binary maximum constraint with shared variables + class MaxXYX : public Test { + public: + /// Create and register test + MaxXYX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Max::Bin::XYX::" + str(ipl) + "::" + s, 2, d) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return std::max(x[0], x[1]) == x[0]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::max(home, x[0], x[1], x[0], ipl); + } + }; + + /// %Test for binary maximum constraint with shared variables + class MaxXYY : public Test { + public: + /// Create and register test + MaxXYY(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Max::Bin::XYY::" + str(ipl) + "::" + s, 2, d) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return std::max(x[0], x[1]) == x[1]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::max(home, x[0], x[1], x[1], ipl); + } + }; + + /// %Test for binary maximum constraint with shared variables + class MaxXXX : public Test { + public: + /// Create and register test + MaxXXX(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("Arithmetic::Max::Bin::XXX::" + str(ipl) + "::" + s, 1, d) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return std::max(x[0], x[0]) == x[0]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::max(home, x[0], x[0], x[0], ipl); + } + }; + + /// %Test for n-ary minimmum constraint + class MinNary : public Test { + public: + /// Create and register test + MinNary(Gecode::IntPropLevel ipl) : Test("Arithmetic::Min::Nary::" + str(ipl), 4, -4, 4, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return std::min({x[0], x[1], x[2]}) == x[3]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs m(3); + m[0] = x[0]; + m[1] = x[1]; + m[2] = x[2]; + Gecode::min(home, m, x[3], ipl); + } + }; + + /// %Test for n-ary minimmum constraint with shared variables + class MinNaryShared : public Test { + public: + /// Create and register test + MinNaryShared(Gecode::IntPropLevel ipl) + : Test("Arithmetic::Min::Nary::Shared::" + str(ipl), 3, -4, 4, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return std::min({x[0], x[1], x[2]}) == x[1]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs m(3); + m[0] = x[0]; + m[1] = x[1]; + m[2] = x[2]; + Gecode::min(home, m, x[1], ipl); + } + }; + + /// %Test for n-ary maximum constraint + class MaxNary : public Test { + public: + /// Create and register test + MaxNary(Gecode::IntPropLevel ipl) + : Test(TestTags::check(), "Arithmetic::Max::Nary::" + str(ipl), 4, -4, 4, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return std::max({x[0], x[1], x[2]}) == x[3]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs m(3); + m[0] = x[0]; + m[1] = x[1]; + m[2] = x[2]; + Gecode::max(home, m, x[3], ipl); + } + }; + + /// %Test for n-ary maximum constraint with shared variables + class MaxNaryShared : public Test { + public: + /// Create and register test + MaxNaryShared(Gecode::IntPropLevel ipl) + : Test(TestTags::check(), "Arithmetic::Max::Nary::Shared::" + str(ipl), 3, -4, 4, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return std::max({x[0], x[1], x[2]}) == x[1]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs m(3); + m[0] = x[0]; + m[1] = x[1]; + m[2] = x[2]; + Gecode::max(home, m, x[1], ipl); + } + }; + + /// %Test for argument maximum constraint + class ArgMax : public Test { + protected: + /// Offset to be used + int offset; + /// Whether to use tie-breaking + bool tie_break; + + public: + /// Create and register test + ArgMax(int n, int o, bool tb) + : Test(TestTags::check(), "Arithmetic::ArgMax::" + str(o) + "::" + str(tb) + "::" + str(n), n + 1, 0, n + 1, + false, tb ? Gecode::IPL_DEF : Gecode::IPL_DOM), + offset(o), tie_break(tb) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() - 1; + if ((x[n] < offset) || (x[n] >= n + offset)) + return false; + int m = x[0]; + int p = 0; + for (int i = 1; i < n; i++) + if (x[i] > m) { + p = i; + m = x[i]; + } + return tie_break ? (p + offset == x[n]) : (m == x[x[n] - offset]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + int n = x.size() - 1; + Gecode::IntVarArgs m(n); + for (int i = 0; i < n; i++) + m[i] = x[i]; + Gecode::argmax(home, m, offset, x[n], tie_break); + } + }; + + /// %Test for argument maximum constraint with shared variables + class ArgMaxShared : public Test { + protected: + /// Whether to use tie-breaking + bool tie_break; + + public: + /// Create and register test + ArgMaxShared(int n, bool tb) + : Test(TestTags::check(), "Arithmetic::ArgMax::Shared::" + str(tb) + "::" + str(n), n + 1, 0, n + 1, false), + tie_break(tb) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() - 1; + if ((x[n] < 0) || (x[n] >= 2 * n)) + return false; + Gecode::IntArgs y(2 * n); + for (int i = 0; i < n; i++) + y[2 * i + 0] = y[2 * i + 1] = x[i]; + int m = y[0]; + int p = 0; + for (int i = 1; i < 2 * n; i++) + if (y[i] > m) { + p = i; + m = y[i]; + } + return tie_break ? (p == x[n]) : (m == y[x[n]]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + int n = x.size() - 1; + Gecode::IntVarArgs m(2 * n); + for (int i = 0; i < n; i++) + m[2 * i + 0] = m[2 * i + 1] = x[i]; + Gecode::argmax(home, m, x[n], tie_break); + } + }; + + /// %Test for argument minimum constraint + class ArgMin : public Test { + protected: + /// Which offset to use + int offset; + /// Whether to use tie-breaking + bool tie_break; + + public: + /// Create and register test + ArgMin(int n, int o, bool tb) + : Test("Arithmetic::ArgMin::" + str(o) + "::" + str(tb) + "::" + str(n), n + 1, 0, n + 1, false, + tb ? Gecode::IPL_DEF : Gecode::IPL_DOM), + offset(o), tie_break(tb) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() - 1; + if ((x[n] < offset) || (x[n] >= n + offset)) + return false; + int m = x[0]; + int p = 0; + for (int i = 1; i < n; i++) + if (x[i] < m) { + p = i; + m = x[i]; + } + return tie_break ? (p + offset == x[n]) : (m == x[x[n] - offset]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + int n = x.size() - 1; + Gecode::IntVarArgs m(n); + for (int i = 0; i < n; i++) + m[i] = x[i]; + Gecode::argmin(home, m, offset, x[n], tie_break); + } + }; + + /// %Test for argument minimum constraint with shared variables + class ArgMinShared : public Test { + protected: + /// Whether to use tie-breaking + bool tie_break; + + public: + /// Create and register test + ArgMinShared(int n, bool tb) + : Test("Arithmetic::ArgMin::Shared::" + str(tb) + "::" + str(n), n + 1, 0, n + 1, false), tie_break(tb) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() - 1; + if ((x[n] < 0) || (x[n] >= 2 * n)) + return false; + Gecode::IntArgs y(2 * n); + for (int i = 0; i < n; i++) + y[2 * i + 0] = y[2 * i + 1] = x[i]; + int m = y[0]; + int p = 0; + for (int i = 1; i < 2 * n; i++) + if (y[i] < m) { + p = i; + m = y[i]; + } + return tie_break ? (p == x[n]) : (m == y[x[n]]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + int n = x.size() - 1; + Gecode::IntVarArgs m(2 * n); + for (int i = 0; i < n; i++) + m[2 * i + 0] = m[2 * i + 1] = x[i]; + Gecode::argmin(home, m, x[n], tie_break); + } + }; + + /// %Test for Boolean argument maximum constraint + class ArgMaxBool : public Test { + protected: + /// Offset to be used + int offset; + /// Whether to use tie-breaking + bool tie_break; + + public: + /// Create and register test + ArgMaxBool(int n, int o, bool tb) + : Test(TestTags::check(), "Arithmetic::ArgMaxBool::" + str(o) + "::" + str(tb) + "::" + str(n), n + 1, 0, + n + 1, false, tb ? Gecode::IPL_DEF : Gecode::IPL_DOM), + offset(o), tie_break(tb) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() - 1; + if ((x[n] < offset) || (x[n] >= n + offset)) + return false; + int m = x[0]; + int p = 0; + if (x[0] > 1) + return false; + for (int i = 1; i < n; i++) { + if (x[i] > 1) return false; - for (int i = 1; i < n; i++) { - if (x[i] > 1) - return false; - if (x[i] > m) { - p = i; - m = x[i]; - } + if (x[i] > m) { + p = i; + m = x[i]; } - return tie_break ? (p + offset == x[n]) : (m == x[x[n] - offset]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - int n = x.size() - 1; - Gecode::BoolVarArgs m(n); - for (int i = 0; i < n; i++) - m[i] = channel(home, x[i]); - Gecode::argmax(home, m, offset, x[n], tie_break); } - }; - - /// %Test for argument maximum constraint with shared variables - class ArgMaxBoolShared : public Test { - protected: - /// Whether to use tie-breaking - bool tie_break; - - public: - /// Create and register test - ArgMaxBoolShared(int n, bool tb) - : Test(TestTags::check(), "Arithmetic::ArgMaxBool::Shared::" + str(tb) + "::" + str(n), n + 1, 0, n + 1, - false), - tie_break(tb) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() - 1; - if ((x[n] < 0) || (x[n] >= 2 * n)) - return false; - Gecode::IntArgs y(2 * n); - for (int i = 0; i < n; i++) - y[2 * i + 0] = y[2 * i + 1] = x[i]; - int m = y[0]; - int p = 0; - if (y[0] > 1) + return tie_break ? (p + offset == x[n]) : (m == x[x[n] - offset]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + int n = x.size() - 1; + Gecode::BoolVarArgs m(n); + for (int i = 0; i < n; i++) + m[i] = channel(home, x[i]); + Gecode::argmax(home, m, offset, x[n], tie_break); + } + }; + + /// %Test for argument maximum constraint with shared variables + class ArgMaxBoolShared : public Test { + protected: + /// Whether to use tie-breaking + bool tie_break; + + public: + /// Create and register test + ArgMaxBoolShared(int n, bool tb) + : Test(TestTags::check(), "Arithmetic::ArgMaxBool::Shared::" + str(tb) + "::" + str(n), n + 1, 0, n + 1, + false), + tie_break(tb) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() - 1; + if ((x[n] < 0) || (x[n] >= 2 * n)) + return false; + Gecode::IntArgs y(2 * n); + for (int i = 0; i < n; i++) + y[2 * i + 0] = y[2 * i + 1] = x[i]; + int m = y[0]; + int p = 0; + if (y[0] > 1) + return false; + for (int i = 1; i < 2 * n; i++) { + if (y[i] > 1) return false; - for (int i = 1; i < 2 * n; i++) { - if (y[i] > 1) - return false; - if (y[i] > m) { - p = i; - m = y[i]; - } + if (y[i] > m) { + p = i; + m = y[i]; } - return tie_break ? (p == x[n]) : (m == y[x[n]]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - int n = x.size() - 1; - Gecode::BoolVarArgs m(2 * n); - for (int i = 0; i < n; i++) - m[2 * i + 0] = m[2 * i + 1] = channel(home, x[i]); - Gecode::argmax(home, m, x[n], tie_break); } - }; - - /// %Test for argument minimum constraint - class ArgMinBool : public Test { - protected: - /// Which offset to use - int offset; - /// Whether to use tie-breaking - bool tie_break; - - public: - /// Create and register test - ArgMinBool(int n, int o, bool tb) - : Test("Arithmetic::ArgMinBool::" + str(o) + "::" + str(tb) + "::" + str(n), n + 1, 0, n + 1, false, - tb ? Gecode::IPL_DEF : Gecode::IPL_DOM), - offset(o), tie_break(tb) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() - 1; - if ((x[n] < offset) || (x[n] >= n + offset)) - return false; - int m = x[0]; - int p = 0; - if (x[0] < 0 || x[0] > 1) + return tie_break ? (p == x[n]) : (m == y[x[n]]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + int n = x.size() - 1; + Gecode::BoolVarArgs m(2 * n); + for (int i = 0; i < n; i++) + m[2 * i + 0] = m[2 * i + 1] = channel(home, x[i]); + Gecode::argmax(home, m, x[n], tie_break); + } + }; + + /// %Test for argument minimum constraint + class ArgMinBool : public Test { + protected: + /// Which offset to use + int offset; + /// Whether to use tie-breaking + bool tie_break; + + public: + /// Create and register test + ArgMinBool(int n, int o, bool tb) + : Test("Arithmetic::ArgMinBool::" + str(o) + "::" + str(tb) + "::" + str(n), n + 1, 0, n + 1, false, + tb ? Gecode::IPL_DEF : Gecode::IPL_DOM), + offset(o), tie_break(tb) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() - 1; + if ((x[n] < offset) || (x[n] >= n + offset)) + return false; + int m = x[0]; + int p = 0; + if (x[0] < 0 || x[0] > 1) + return false; + for (int i = 1; i < n; i++) { + if (x[i] < 0 || x[i] > 1) return false; - for (int i = 1; i < n; i++) { - if (x[i] < 0 || x[i] > 1) - return false; - if (x[i] < m) { - p = i; - m = x[i]; - } + if (x[i] < m) { + p = i; + m = x[i]; } - return tie_break ? (p + offset == x[n]) : (m == x[x[n] - offset]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - int n = x.size() - 1; - Gecode::BoolVarArgs m(n); - for (int i = 0; i < n; i++) - m[i] = channel(home, x[i]); - Gecode::argmin(home, m, offset, x[n], tie_break); } - }; - - /// %Test for argument minimum constraint with shared variables - class ArgMinBoolShared : public Test { - protected: - /// Whether to use tie-breaking - bool tie_break; - - public: - /// Create and register test - ArgMinBoolShared(int n, bool tb) - : Test("Arithmetic::ArgMinBool::Shared::" + str(tb) + "::" + str(n), n + 1, 0, n + 1, false), - tie_break(tb) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() - 1; - if ((x[n] < 0) || (x[n] >= 2 * n)) - return false; - Gecode::IntArgs y(2 * n); - for (int i = 0; i < n; i++) - y[2 * i + 0] = y[2 * i + 1] = x[i]; - int m = y[0]; - int p = 0; - if (y[0] > 1) + return tie_break ? (p + offset == x[n]) : (m == x[x[n] - offset]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + int n = x.size() - 1; + Gecode::BoolVarArgs m(n); + for (int i = 0; i < n; i++) + m[i] = channel(home, x[i]); + Gecode::argmin(home, m, offset, x[n], tie_break); + } + }; + + /// %Test for argument minimum constraint with shared variables + class ArgMinBoolShared : public Test { + protected: + /// Whether to use tie-breaking + bool tie_break; + + public: + /// Create and register test + ArgMinBoolShared(int n, bool tb) + : Test("Arithmetic::ArgMinBool::Shared::" + str(tb) + "::" + str(n), n + 1, 0, n + 1, false), + tie_break(tb) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() - 1; + if ((x[n] < 0) || (x[n] >= 2 * n)) + return false; + Gecode::IntArgs y(2 * n); + for (int i = 0; i < n; i++) + y[2 * i + 0] = y[2 * i + 1] = x[i]; + int m = y[0]; + int p = 0; + if (y[0] > 1) + return false; + for (int i = 1; i < 2 * n; i++) { + if (y[i] > 1) return false; - for (int i = 1; i < 2 * n; i++) { - if (y[i] > 1) - return false; - if (y[i] < m) { - p = i; - m = y[i]; - } + if (y[i] < m) { + p = i; + m = y[i]; } - return tie_break ? (p == x[n]) : (m == y[x[n]]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - int n = x.size() - 1; - Gecode::BoolVarArgs m(2 * n); - for (int i = 0; i < n; i++) - m[2 * i + 0] = m[2 * i + 1] = channel(home, x[i]); - Gecode::argmin(home, m, x[n], tie_break); } - }; - - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - - const int va[7] = {Gecode::Int::Limits::min, Gecode::Int::Limits::min + 1, -1, 0, 1, - Gecode::Int::Limits::max - 1, Gecode::Int::Limits::max}; - const int vb[9] = { - static_cast(-sqrt(static_cast(-Gecode::Int::Limits::min))), -4, -2, -1, 0, 1, 2, 4, - static_cast(sqrt(static_cast(Gecode::Int::Limits::max)))}; - - Gecode::IntSet a(va, 7); - Gecode::IntSet b(vb, 9); - Gecode::IntSet c(-8, 8); - Gecode::IntSet d(-70, 70); - const int vg[7] = {-12, -6, -1, 0, 4, 9, 12}; - Gecode::IntSet g(vg, 7); - const int vp[5] = {Gecode::Int::Limits::min, -1, 0, 1, Gecode::Int::Limits::max}; - Gecode::IntSet p(vp, 5); - Gecode::IntSet q(-2, 2); - - (void)new DivMod("A", a); - (void)new DivMod("B", b); - (void)new DivMod("C", c); - - (void)new Div("A", a); - (void)new Div("B", b); - (void)new Div("C", c); - - (void)new Mod("A", a); - (void)new Mod("B", b); - (void)new Mod("C", c); - - // These constraints ignore the propagation level. - (void)new GcdXYZ("C", c, Gecode::IPL_BND); - (void)new GcdXYZ("C", c, Gecode::IPL_BND, false); - (void)new GcdXYZ("Sparse", g, Gecode::IPL_BND); - (void)new GcdXYZ("Sparse", g, Gecode::IPL_BND, false); - (void)new GcdXYZ("Limits", p, Gecode::IPL_BND); - (void)new GcdXYZ("Limits", p, Gecode::IPL_BND, false); - (void)new GcdXXY("C", c, Gecode::IPL_BND); - (void)new GcdXXY("C", c, Gecode::IPL_BND, false); - (void)new GcdXYX("C", c, Gecode::IPL_BND); - (void)new GcdXYX("C", c, Gecode::IPL_BND, false); - for (int sw = 0; sw < 2; sw++) { - (void)new GcdXYX("Nonpositive", Gecode::IntSet(-2, 0), Gecode::IPL_BND, true, sw != 0); - (void)new GcdXYX("Nonpositive", Gecode::IntSet(-2, 0), Gecode::IPL_BND, false, sw != 0); - } - (void)new GcdXXX("C", c, Gecode::IPL_BND); - - (void)new DividesXY("C", c, Gecode::IPL_BND); - (void)new DividesXY("Sparse", g, Gecode::IPL_BND); - (void)new DividesXX("C", c, Gecode::IPL_BND); - - (void)new ProductXYZR("C", q, Gecode::IPL_BND); - (void)new ProductXYZR("Sparse", g, Gecode::IPL_BND); - (void)new ProductXYZR("Limits", p, Gecode::IPL_BND); - (void)new ProductEmpty("C", q, Gecode::IPL_BND); - (void)new ProductSingleton("C", q, Gecode::IPL_BND); - (void)new ProductXXYAlias("C", q, Gecode::IPL_BND); - - (void)new ProductModXYZR("C", q, 5, Gecode::IPL_BND); - (void)new ProductModXYZR("C", q, 5, Gecode::IPL_BND, false); - (void)new ProductModXYZR("Sparse", g, 7, Gecode::IPL_BND); - (void)new ProductModXYZR("Sparse", g, 7, Gecode::IPL_BND, false); - (void)new ProductModEmpty("C", q, 5, Gecode::IPL_BND); - (void)new ProductModEmpty("ModulusOne", q, 1, Gecode::IPL_BND); - (void)new ProductModSingleton("C", g, 5, Gecode::IPL_BND); - (void)new ProductModSingleton("C", g, 5, Gecode::IPL_BND, false); - (void)new ProductModXXYAlias("C", q, 5, Gecode::IPL_BND); - (void)new ProductModXXYAlias("C", q, 5, Gecode::IPL_BND, false); - - (void)new ProductModVarXYMR("C", q, Gecode::IPL_BND); - (void)new ProductModVarXYMR("Sparse", g, Gecode::IPL_BND); - (void)new ProductModVarEmpty("C", q, Gecode::IPL_BND); - (void)new ProductModVarSingleton("C", q, Gecode::IPL_BND); - (void)new ProductModVarRepeated("C", q, Gecode::IPL_BND); - (void)new ProductModVarModFactorAlias("C", q, Gecode::IPL_BND); - (void)new ProductModVarFactorResultAlias("C", q, Gecode::IPL_BND); - (void)new ProductModVarModResultAlias("C", q, Gecode::IPL_BND); - - for (IntPropLevels ipls; ipls(); ++ipls) { - (void)new AbsXY("A", a, ipls.ipl()); - (void)new AbsXY("B", b, ipls.ipl()); - (void)new AbsXY("C", c, ipls.ipl()); - - (void)new AbsXX("A", a, ipls.ipl()); - (void)new AbsXX("B", b, ipls.ipl()); - (void)new AbsXX("C", c, ipls.ipl()); - if (ipls.ipl() != Gecode::IPL_VAL) { - (void)new MultXYZ("A", a, ipls.ipl()); - (void)new MultXYZ("B", b, ipls.ipl()); - (void)new MultXYZ("C", c, ipls.ipl()); - - (void)new MultXXY("A", a, ipls.ipl()); - (void)new MultXXY("B", b, ipls.ipl()); - (void)new MultXXY("C", c, ipls.ipl()); - - (void)new MultXYX("A", a, ipls.ipl()); - (void)new MultXYX("B", b, ipls.ipl()); - (void)new MultXYX("C", c, ipls.ipl()); - - (void)new MultXYY("A", a, ipls.ipl()); - (void)new MultXYY("B", b, ipls.ipl()); - (void)new MultXYY("C", c, ipls.ipl()); - - (void)new MultXXX("A", a, ipls.ipl()); - (void)new MultXXX("B", b, ipls.ipl()); - (void)new MultXXX("C", c, ipls.ipl()); - - (void)new SqrXY("A", a, ipls.ipl()); - (void)new SqrXY("B", b, ipls.ipl()); - (void)new SqrXY("C", c, ipls.ipl()); - - (void)new SqrXX("A", a, ipls.ipl()); - (void)new SqrXX("B", b, ipls.ipl()); - (void)new SqrXX("C", c, ipls.ipl()); - - for (int n = 0; n <= 6; n++) { - TestTags distinct_tags = - (n == 3) && (ipls.ipl() == Gecode::IPL_BND) ? TestTags::standard() : TestTags::sweep(); - (void)new PowXY(TestTags::sweep(), "A", n, a, ipls.ipl()); - (void)new PowXY(TestTags::sweep(), "B", n, b, ipls.ipl()); - (void)new PowXY(distinct_tags, "C", n, c, ipls.ipl()); - (void)new PowXY(TestTags::sweep(), "D", n, d, ipls.ipl()); - - TestTags tags = - (n == 0) && (ipls.ipl() == Gecode::IPL_BND) ? TestTags::standard() : TestTags::sweep(); - (void)new PowXX(tags, "A", n, a, ipls.ipl()); - (void)new PowXX(TestTags::sweep(), "B", n, b, ipls.ipl()); - (void)new PowXX(TestTags::sweep(), "C", n, c, ipls.ipl()); - (void)new PowXX(TestTags::sweep(), "D", n, d, ipls.ipl()); - } - - for (int n = 1; n <= 6; n++) { - TestTags distinct_tags = - (n == 3) && (ipls.ipl() == Gecode::IPL_BND) ? TestTags::standard() : TestTags::sweep(); - (void)new NrootXY(TestTags::sweep(), "A", n, a, ipls.ipl()); - (void)new NrootXY(TestTags::sweep(), "B", n, b, ipls.ipl()); - (void)new NrootXY(distinct_tags, "C", n, c, ipls.ipl()); - (void)new NrootXY(TestTags::sweep(), "D", n, d, ipls.ipl()); - - TestTags tags = - (n == 1) && (ipls.ipl() == Gecode::IPL_BND) ? TestTags::standard() : TestTags::sweep(); - (void)new NrootXX(tags, "A", n, a, ipls.ipl()); - (void)new NrootXX(TestTags::sweep(), "B", n, b, ipls.ipl()); - (void)new NrootXX(TestTags::sweep(), "C", n, c, ipls.ipl()); - (void)new NrootXX(TestTags::sweep(), "D", n, d, ipls.ipl()); - } - - for (int n = 30; n <= 34; n++) { - (void)new PowXY(TestTags::sweep(), "C", n, c, ipls.ipl()); - (void)new PowXX(TestTags::sweep(), "C", n, c, ipls.ipl()); - (void)new NrootXY(TestTags::sweep(), "C", n, c, ipls.ipl()); - (void)new NrootXX(TestTags::sweep(), "C", n, c, ipls.ipl()); - } - - (void)new SqrtXY("A", a, ipls.ipl()); - (void)new SqrtXY("B", b, ipls.ipl()); - (void)new SqrtXY("C", c, ipls.ipl()); - - (void)new SqrtXX("A", a, ipls.ipl()); - (void)new SqrtXX("B", b, ipls.ipl()); - (void)new SqrtXX("C", c, ipls.ipl()); - - (void)new MinXYZ("A", a, ipls.ipl()); - (void)new MinXYZ("B", b, ipls.ipl()); - (void)new MinXYZ("C", c, ipls.ipl()); - - (void)new MinXXY("A", a, ipls.ipl()); - (void)new MinXXY("B", b, ipls.ipl()); - (void)new MinXXY("C", c, ipls.ipl()); - - (void)new MinXYX("A", a, ipls.ipl()); - (void)new MinXYX("B", b, ipls.ipl()); - (void)new MinXYX("C", c, ipls.ipl()); - - (void)new MinXYY("A", a, ipls.ipl()); - (void)new MinXYY("B", b, ipls.ipl()); - (void)new MinXYY("C", c, ipls.ipl()); - - (void)new MinXXX("A", a, ipls.ipl()); - (void)new MinXXX("B", b, ipls.ipl()); - (void)new MinXXX("C", c, ipls.ipl()); - - (void)new MaxXYZ("A", a, ipls.ipl()); - (void)new MaxXYZ("B", b, ipls.ipl()); - (void)new MaxXYZ("C", c, ipls.ipl()); - - (void)new MaxXXY("A", a, ipls.ipl()); - (void)new MaxXXY("B", b, ipls.ipl()); - (void)new MaxXXY("C", c, ipls.ipl()); - - (void)new MaxXYX("A", a, ipls.ipl()); - (void)new MaxXYX("B", b, ipls.ipl()); - (void)new MaxXYX("C", c, ipls.ipl()); - - (void)new MaxXYY("A", a, ipls.ipl()); - (void)new MaxXYY("B", b, ipls.ipl()); - (void)new MaxXYY("C", c, ipls.ipl()); - - (void)new MaxXXX("A", a, ipls.ipl()); - (void)new MaxXXX("B", b, ipls.ipl()); - (void)new MaxXXX("C", c, ipls.ipl()); + return tie_break ? (p == x[n]) : (m == y[x[n]]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + int n = x.size() - 1; + Gecode::BoolVarArgs m(2 * n); + for (int i = 0; i < n; i++) + m[2 * i + 0] = m[2 * i + 1] = channel(home, x[i]); + Gecode::argmin(home, m, x[n], tie_break); + } + }; + + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + + const int va[7] = {Gecode::Int::Limits::min, Gecode::Int::Limits::min + 1, -1, 0, 1, + Gecode::Int::Limits::max - 1, Gecode::Int::Limits::max}; + const int vb[9] = { + static_cast(-sqrt(static_cast(-Gecode::Int::Limits::min))), -4, -2, -1, 0, 1, 2, 4, + static_cast(sqrt(static_cast(Gecode::Int::Limits::max)))}; + + Gecode::IntSet a(va, 7); + Gecode::IntSet b(vb, 9); + Gecode::IntSet c(-8, 8); + Gecode::IntSet d(-70, 70); + const int vg[7] = {-12, -6, -1, 0, 4, 9, 12}; + Gecode::IntSet g(vg, 7); + const int vp[5] = {Gecode::Int::Limits::min, -1, 0, 1, Gecode::Int::Limits::max}; + Gecode::IntSet p(vp, 5); + Gecode::IntSet q(-2, 2); + + (void)new DivMod("A", a); + (void)new DivMod("B", b); + (void)new DivMod("C", c); + + (void)new Div("A", a); + (void)new Div("B", b); + (void)new Div("C", c); + + (void)new Mod("A", a); + (void)new Mod("B", b); + (void)new Mod("C", c); + + // These constraints ignore the propagation level. + (void)new GcdXYZ("C", c, Gecode::IPL_BND); + (void)new GcdXYZ("C", c, Gecode::IPL_BND, false); + (void)new GcdXYZ("Sparse", g, Gecode::IPL_BND); + (void)new GcdXYZ("Sparse", g, Gecode::IPL_BND, false); + (void)new GcdXYZ("Limits", p, Gecode::IPL_BND); + (void)new GcdXYZ("Limits", p, Gecode::IPL_BND, false); + (void)new GcdXXY("C", c, Gecode::IPL_BND); + (void)new GcdXXY("C", c, Gecode::IPL_BND, false); + (void)new GcdXYX("C", c, Gecode::IPL_BND); + (void)new GcdXYX("C", c, Gecode::IPL_BND, false); + for (int sw = 0; sw < 2; sw++) { + (void)new GcdXYX("Nonpositive", Gecode::IntSet(-2, 0), Gecode::IPL_BND, true, sw != 0); + (void)new GcdXYX("Nonpositive", Gecode::IntSet(-2, 0), Gecode::IPL_BND, false, sw != 0); + } + (void)new GcdXXX("C", c, Gecode::IPL_BND); + + (void)new DividesXY("C", c, Gecode::IPL_BND); + (void)new DividesXY("Sparse", g, Gecode::IPL_BND); + (void)new DividesXX("C", c, Gecode::IPL_BND); + + (void)new ProductXYZR("C", q, Gecode::IPL_BND); + (void)new ProductXYZR("Sparse", g, Gecode::IPL_BND); + (void)new ProductXYZR("Limits", p, Gecode::IPL_BND); + (void)new ProductEmpty("C", q, Gecode::IPL_BND); + (void)new ProductSingleton("C", q, Gecode::IPL_BND); + (void)new ProductXXYAlias("C", q, Gecode::IPL_BND); + + (void)new ProductModXYZR("C", q, 5, Gecode::IPL_BND); + (void)new ProductModXYZR("C", q, 5, Gecode::IPL_BND, false); + (void)new ProductModXYZR("Sparse", g, 7, Gecode::IPL_BND); + (void)new ProductModXYZR("Sparse", g, 7, Gecode::IPL_BND, false); + (void)new ProductModEmpty("C", q, 5, Gecode::IPL_BND); + (void)new ProductModEmpty("ModulusOne", q, 1, Gecode::IPL_BND); + (void)new ProductModSingleton("C", g, 5, Gecode::IPL_BND); + (void)new ProductModSingleton("C", g, 5, Gecode::IPL_BND, false); + (void)new ProductModXXYAlias("C", q, 5, Gecode::IPL_BND); + (void)new ProductModXXYAlias("C", q, 5, Gecode::IPL_BND, false); + + (void)new ProductModVarXYMR("C", q, Gecode::IPL_BND); + (void)new ProductModVarXYMR("Sparse", g, Gecode::IPL_BND); + (void)new ProductModVarEmpty("C", q, Gecode::IPL_BND); + (void)new ProductModVarSingleton("C", q, Gecode::IPL_BND); + (void)new ProductModVarRepeated("C", q, Gecode::IPL_BND); + (void)new ProductModVarModFactorAlias("C", q, Gecode::IPL_BND); + (void)new ProductModVarFactorResultAlias("C", q, Gecode::IPL_BND); + (void)new ProductModVarModResultAlias("C", q, Gecode::IPL_BND); + + for (IntPropLevels ipls; ipls(); ++ipls) { + (void)new AbsXY("A", a, ipls.ipl()); + (void)new AbsXY("B", b, ipls.ipl()); + (void)new AbsXY("C", c, ipls.ipl()); + + (void)new AbsXX("A", a, ipls.ipl()); + (void)new AbsXX("B", b, ipls.ipl()); + (void)new AbsXX("C", c, ipls.ipl()); + if (ipls.ipl() != Gecode::IPL_VAL) { + (void)new MultXYZ("A", a, ipls.ipl()); + (void)new MultXYZ("B", b, ipls.ipl()); + (void)new MultXYZ("C", c, ipls.ipl()); + + (void)new MultXXY("A", a, ipls.ipl()); + (void)new MultXXY("B", b, ipls.ipl()); + (void)new MultXXY("C", c, ipls.ipl()); + + (void)new MultXYX("A", a, ipls.ipl()); + (void)new MultXYX("B", b, ipls.ipl()); + (void)new MultXYX("C", c, ipls.ipl()); + + (void)new MultXYY("A", a, ipls.ipl()); + (void)new MultXYY("B", b, ipls.ipl()); + (void)new MultXYY("C", c, ipls.ipl()); + + (void)new MultXXX("A", a, ipls.ipl()); + (void)new MultXXX("B", b, ipls.ipl()); + (void)new MultXXX("C", c, ipls.ipl()); + + (void)new SqrXY("A", a, ipls.ipl()); + (void)new SqrXY("B", b, ipls.ipl()); + (void)new SqrXY("C", c, ipls.ipl()); + + (void)new SqrXX("A", a, ipls.ipl()); + (void)new SqrXX("B", b, ipls.ipl()); + (void)new SqrXX("C", c, ipls.ipl()); + + for (int n = 0; n <= 6; n++) { + TestTags distinct_tags = + (n == 3) && (ipls.ipl() == Gecode::IPL_BND) ? TestTags::standard() : TestTags::sweep(); + (void)new PowXY(TestTags::sweep(), "A", n, a, ipls.ipl()); + (void)new PowXY(TestTags::sweep(), "B", n, b, ipls.ipl()); + (void)new PowXY(distinct_tags, "C", n, c, ipls.ipl()); + (void)new PowXY(TestTags::sweep(), "D", n, d, ipls.ipl()); + + TestTags tags = + (n == 0) && (ipls.ipl() == Gecode::IPL_BND) ? TestTags::standard() : TestTags::sweep(); + (void)new PowXX(tags, "A", n, a, ipls.ipl()); + (void)new PowXX(TestTags::sweep(), "B", n, b, ipls.ipl()); + (void)new PowXX(TestTags::sweep(), "C", n, c, ipls.ipl()); + (void)new PowXX(TestTags::sweep(), "D", n, d, ipls.ipl()); + } - (void)new MinNary(ipls.ipl()); - (void)new MinNaryShared(ipls.ipl()); - (void)new MaxNary(ipls.ipl()); - (void)new MaxNaryShared(ipls.ipl()); + for (int n = 1; n <= 6; n++) { + TestTags distinct_tags = + (n == 3) && (ipls.ipl() == Gecode::IPL_BND) ? TestTags::standard() : TestTags::sweep(); + (void)new NrootXY(TestTags::sweep(), "A", n, a, ipls.ipl()); + (void)new NrootXY(TestTags::sweep(), "B", n, b, ipls.ipl()); + (void)new NrootXY(distinct_tags, "C", n, c, ipls.ipl()); + (void)new NrootXY(TestTags::sweep(), "D", n, d, ipls.ipl()); + + TestTags tags = + (n == 1) && (ipls.ipl() == Gecode::IPL_BND) ? TestTags::standard() : TestTags::sweep(); + (void)new NrootXX(tags, "A", n, a, ipls.ipl()); + (void)new NrootXX(TestTags::sweep(), "B", n, b, ipls.ipl()); + (void)new NrootXX(TestTags::sweep(), "C", n, c, ipls.ipl()); + (void)new NrootXX(TestTags::sweep(), "D", n, d, ipls.ipl()); } - } - for (int i = 1; i < 5; i++) { - (void)new ArgMax(i, 0, true); - (void)new ArgMax(i, 1, true); - (void)new ArgMaxShared(i, true); - (void)new ArgMin(i, 0, true); - (void)new ArgMin(i, 1, true); - (void)new ArgMinShared(i, true); - (void)new ArgMax(i, 0, false); - (void)new ArgMax(i, 1, false); - (void)new ArgMaxShared(i, false); - (void)new ArgMin(i, 0, false); - (void)new ArgMin(i, 1, false); - (void)new ArgMinShared(i, false); - - (void)new ArgMaxBool(i, 0, true); - (void)new ArgMaxBool(i, 1, true); - (void)new ArgMaxBoolShared(i, true); - (void)new ArgMinBool(i, 0, true); - (void)new ArgMinBool(i, 1, true); - (void)new ArgMinBoolShared(i, true); - (void)new ArgMaxBool(i, 0, false); - (void)new ArgMaxBool(i, 1, false); - (void)new ArgMaxBoolShared(i, false); - (void)new ArgMinBool(i, 0, false); - (void)new ArgMinBool(i, 1, false); - (void)new ArgMinBoolShared(i, false); - } - (void)new NumberTheorySparseBounds; - for (int k = 0; k < 13; k++) - (void)new NumberTheoryAlgebraic(k); - (void)new NumberTheoryLifecycle; - (void)new NumberTheoryLimits; - (void)new DividesXY("Limits", p, Gecode::IPL_BND); - for (int n = 2; n <= 3; n++) - for (bool negative : {false, true}) - for (bool variable : {false, true}) - (void)new ProductModLimits(n, negative, variable); - (void)new NumberTheoryIdentities; - (void)new ProductModInvalidModulus; - (void)new ProductModAlgebraic; - (void)new ProductModNonzero; - (void)new ProductCompactionZero; - for (int r = 0; r < 2; r++) { - (void)new ProductModFolded(-2, 7, r != 0); - (void)new ProductModFolded(6, 12, r != 0); - (void)new ProductModFolded(6, 15, r != 0); - (void)new ProductModFolded(Gecode::Int::Limits::max, 5, r != 0); - } - for (int k = 0; k < 3; k++) - (void)new ProductInterleaved(k); - (void)new ProductModCoefficient(false); - (void)new ProductModCoefficient(true); - (void)new ProductModVarBounds; - (void)new ProductModVarSparseModulus(false); - (void)new ProductModVarSparseModulus(true); - (void)new ProductModVarAlgebraic; - (void)new ProductModVarInactive(0); - (void)new ProductModVarInactive(1); - (void)new ProductBoundsLarge; - (void)new ProductSimplifySign; - (void)new ProductPowerAlias; - (void)new ProductInverseBounds; - } - }; + for (int n = 30; n <= 34; n++) { + (void)new PowXY(TestTags::sweep(), "C", n, c, ipls.ipl()); + (void)new PowXX(TestTags::sweep(), "C", n, c, ipls.ipl()); + (void)new NrootXY(TestTags::sweep(), "C", n, c, ipls.ipl()); + (void)new NrootXX(TestTags::sweep(), "C", n, c, ipls.ipl()); + } - Create c; - //@} + (void)new SqrtXY("A", a, ipls.ipl()); + (void)new SqrtXY("B", b, ipls.ipl()); + (void)new SqrtXY("C", c, ipls.ipl()); + + (void)new SqrtXX("A", a, ipls.ipl()); + (void)new SqrtXX("B", b, ipls.ipl()); + (void)new SqrtXX("C", c, ipls.ipl()); + + (void)new MinXYZ("A", a, ipls.ipl()); + (void)new MinXYZ("B", b, ipls.ipl()); + (void)new MinXYZ("C", c, ipls.ipl()); + + (void)new MinXXY("A", a, ipls.ipl()); + (void)new MinXXY("B", b, ipls.ipl()); + (void)new MinXXY("C", c, ipls.ipl()); + + (void)new MinXYX("A", a, ipls.ipl()); + (void)new MinXYX("B", b, ipls.ipl()); + (void)new MinXYX("C", c, ipls.ipl()); + + (void)new MinXYY("A", a, ipls.ipl()); + (void)new MinXYY("B", b, ipls.ipl()); + (void)new MinXYY("C", c, ipls.ipl()); + + (void)new MinXXX("A", a, ipls.ipl()); + (void)new MinXXX("B", b, ipls.ipl()); + (void)new MinXXX("C", c, ipls.ipl()); + + (void)new MaxXYZ("A", a, ipls.ipl()); + (void)new MaxXYZ("B", b, ipls.ipl()); + (void)new MaxXYZ("C", c, ipls.ipl()); + + (void)new MaxXXY("A", a, ipls.ipl()); + (void)new MaxXXY("B", b, ipls.ipl()); + (void)new MaxXXY("C", c, ipls.ipl()); + + (void)new MaxXYX("A", a, ipls.ipl()); + (void)new MaxXYX("B", b, ipls.ipl()); + (void)new MaxXYX("C", c, ipls.ipl()); + + (void)new MaxXYY("A", a, ipls.ipl()); + (void)new MaxXYY("B", b, ipls.ipl()); + (void)new MaxXYY("C", c, ipls.ipl()); + + (void)new MaxXXX("A", a, ipls.ipl()); + (void)new MaxXXX("B", b, ipls.ipl()); + (void)new MaxXXX("C", c, ipls.ipl()); + + (void)new MinNary(ipls.ipl()); + (void)new MinNaryShared(ipls.ipl()); + (void)new MaxNary(ipls.ipl()); + (void)new MaxNaryShared(ipls.ipl()); + } + } + + for (int i = 1; i < 5; i++) { + (void)new ArgMax(i, 0, true); + (void)new ArgMax(i, 1, true); + (void)new ArgMaxShared(i, true); + (void)new ArgMin(i, 0, true); + (void)new ArgMin(i, 1, true); + (void)new ArgMinShared(i, true); + (void)new ArgMax(i, 0, false); + (void)new ArgMax(i, 1, false); + (void)new ArgMaxShared(i, false); + (void)new ArgMin(i, 0, false); + (void)new ArgMin(i, 1, false); + (void)new ArgMinShared(i, false); + + (void)new ArgMaxBool(i, 0, true); + (void)new ArgMaxBool(i, 1, true); + (void)new ArgMaxBoolShared(i, true); + (void)new ArgMinBool(i, 0, true); + (void)new ArgMinBool(i, 1, true); + (void)new ArgMinBoolShared(i, true); + (void)new ArgMaxBool(i, 0, false); + (void)new ArgMaxBool(i, 1, false); + (void)new ArgMaxBoolShared(i, false); + (void)new ArgMinBool(i, 0, false); + (void)new ArgMinBool(i, 1, false); + (void)new ArgMinBoolShared(i, false); + } + (void)new NumberTheorySparseBounds; + for (int k = 0; k < 13; k++) + (void)new NumberTheoryAlgebraic(k); + (void)new NumberTheoryLifecycle; + (void)new NumberTheoryLimits; + (void)new DividesXY("Limits", p, Gecode::IPL_BND); + for (int n = 2; n <= 3; n++) + for (bool negative : {false, true}) + for (bool variable : {false, true}) + (void)new ProductModLimits(n, negative, variable); + (void)new NumberTheoryIdentities; + (void)new ProductModInvalidModulus; + (void)new ProductModAlgebraic; + (void)new ProductModNonzero; + (void)new ProductCompactionZero; + for (int r = 0; r < 2; r++) { + (void)new ProductModFolded(-2, 7, r != 0); + (void)new ProductModFolded(6, 12, r != 0); + (void)new ProductModFolded(6, 15, r != 0); + (void)new ProductModFolded(Gecode::Int::Limits::max, 5, r != 0); + } + for (int k = 0; k < 3; k++) + (void)new ProductInterleaved(k); + (void)new ProductModCoefficient(false); + (void)new ProductModCoefficient(true); + (void)new ProductModVarBounds; + (void)new ProductModVarSparseModulus(false); + (void)new ProductModVarSparseModulus(true); + (void)new ProductModVarAlgebraic; + (void)new ProductModVarInactive(0); + (void)new ProductModVarInactive(1); + (void)new ProductBoundsLarge; + (void)new ProductSimplifySign; + (void)new ProductPowerAlias; + (void)new ProductInverseBounds; + } + }; - } // namespace Arithmetic -}} // namespace Test::Int + Create c; + //@} +} // namespace Test::Int::Arithmetic // STATISTICS: test-int diff --git a/test/int/basic.cpp b/test/int/basic.cpp index 0d4c4d013f..4fe9719f00 100644 --- a/test/int/basic.cpp +++ b/test/int/basic.cpp @@ -32,114 +32,109 @@ #include "test/int.hh" -namespace Test { namespace Int { +/// %Tests for basic setup +namespace Test::Int::Basic { - /// %Tests for basic setup - namespace Basic { + /** + * \defgroup TaskTestIntBasic Basic setup + * \ingroup TaskTestInt + */ + //@{ - /** - * \defgroup TaskTestIntBasic Basic setup - * \ingroup TaskTestInt - */ - //@{ + /// %Test whether testing infrastructure for integer variables works + class Basic : public Test { + public: + /// Initialize test + Basic(int n) : Test("Basic::A", 3, -n, n, true) {} + /// Initialize test + Basic(Gecode::IntArgs& i) : Test("Basic::B", 3, Gecode::IntSet(i), true) {} + /// Check whether \a x is a solution + bool + solution(const Assignment&) const override { + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space&, Gecode::IntVarArray&) override {} + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray&, Gecode::Reify r) override { + if (r.mode() != Gecode::RM_IMP) + Gecode::rel(home, r.var(), Gecode::IRT_EQ, 1); + } + }; - /// %Test whether testing infrastructure for integer variables works - class Basic : public Test { - public: - /// Initialize test - Basic(int n) : Test("Basic::A", 3, -n, n, true) {} - /// Initialize test - Basic(Gecode::IntArgs& i) : Test("Basic::B", 3, Gecode::IntSet(i), true) {} - /// Check whether \a x is a solution - bool - solution(const Assignment&) const override { - return true; - } - /// Post constraint on \a x - void - post(Gecode::Space&, Gecode::IntVarArray&) override {} - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray&, Gecode::Reify r) override { - if (r.mode() != Gecode::RM_IMP) - Gecode::rel(home, r.var(), Gecode::IRT_EQ, 1); - } - }; - - Gecode::IntArgs i({1, 2, 3, 4}); - Basic b1(3); - Basic b2(i); - - /// %Test for comparing integer sets - class IntSetCompare : public Base { - public: - /// Create and register test - IntSetCompare(void) : Base("Int::Basic::IntSet::Compare") {} - /// Perform test - bool - run(void) override { - using namespace Gecode; - IntSet s({1, 3, 5}); - IntSet same({1, 3, 5}); - IntSet other(1, 5); - IntSet s_copy(s); - return compares_equal(s, same) && compares_equal(s, s_copy) && compares_unequal(s, other) && - compares_equal(IntSet::empty, IntSet(1, 0)) && compares_unequal(s, IntSet::empty); - } - }; + Gecode::IntArgs i({1, 2, 3, 4}); + Basic b1(3); + Basic b2(i); - IntSetCompare int_set_compare; + /// %Test for comparing integer sets + class IntSetCompare : public Base { + public: + /// Create and register test + IntSetCompare() : Base("Int::Basic::IntSet::Compare") {} + /// Perform test + bool + run() override { + using namespace Gecode; + IntSet s({1, 3, 5}); + IntSet same({1, 3, 5}); + IntSet other(1, 5); + IntSet s_copy(s); + return compares_equal(s, same) && compares_equal(s, s_copy) && compares_unequal(s, other) && + compares_equal(IntSet::empty, IntSet(1, 0)) && compares_unequal(s, IntSet::empty); + } + }; - /// %Test for comparing integer and Boolean views - class ViewCompare : public Base { - private: - /// Space for the variables behind the views - class Fixture : public Gecode::Space { - public: - Fixture(void) = default; - // NOLINTNEXTLINE(modernize-use-equals-default) - Fixture(Fixture& fixture) : Gecode::Space(fixture) {} - Gecode::Space* - copy(void) override { - return new Fixture(*this); - } - }; + IntSetCompare int_set_compare; + /// %Test for comparing integer and Boolean views + class ViewCompare : public Base { + private: + /// Space for the variables behind the views + class Fixture : public Gecode::Space { public: - /// Create and register test - ViewCompare(void) : Base("Int::Basic::View::Compare") {} - /// Perform test - bool - run(void) override { - using namespace Gecode; - using namespace Gecode::Int; - Fixture home; - IntView x(IntVar(home, 0, 5)); - IntView y(IntVar(home, 0, 5)); - BoolView b(BoolVar(home, 0, 1)); - BoolView c(BoolVar(home, 0, 1)); - MinusView mx(x); - return compares_equal(mx, MinusView(x)) && compares_unequal(mx, MinusView(y)) && - compares_equal(OffsetView(x, 2), OffsetView(x, 2)) && - compares_unequal(OffsetView(x, 2), OffsetView(x, 3)) && - compares_unequal(OffsetView(x, 2), OffsetView(y, 2)) && - compares_equal(IntScaleView(2, x), IntScaleView(2, x)) && - compares_unequal(IntScaleView(2, x), IntScaleView(3, x)) && - compares_unequal(IntScaleView(2, x), IntScaleView(2, y)) && - compares_equal(ConstIntView(4), ConstIntView(4)) && - compares_unequal(ConstIntView(4), ConstIntView(5)) && - compares_equal(ZeroIntView(), ZeroIntView()) && - compares_equal(CachedView(x), CachedView(x)) && - compares_unequal(CachedView(x), CachedView(y)) && - compares_equal(NegBoolView(b), NegBoolView(b)) && - compares_unequal(NegBoolView(b), NegBoolView(c)) && compares_unequal(x, mx); + Fixture() = default; + // NOLINTNEXTLINE(modernize-use-equals-default) + Fixture(Fixture& fixture) : Gecode::Space(fixture) {} + Gecode::Space* + copy() override { + return new Fixture(*this); } }; - ViewCompare view_compare; - //@} + public: + /// Create and register test + ViewCompare() : Base("Int::Basic::View::Compare") {} + /// Perform test + bool + run() override { + using namespace Gecode; + using namespace Gecode::Int; + Fixture home; + IntView x(IntVar(home, 0, 5)); + IntView y(IntVar(home, 0, 5)); + BoolView b(BoolVar(home, 0, 1)); + BoolView c(BoolVar(home, 0, 1)); + MinusView mx(x); + return compares_equal(mx, MinusView(x)) && compares_unequal(mx, MinusView(y)) && + compares_equal(OffsetView(x, 2), OffsetView(x, 2)) && + compares_unequal(OffsetView(x, 2), OffsetView(x, 3)) && + compares_unequal(OffsetView(x, 2), OffsetView(y, 2)) && + compares_equal(IntScaleView(2, x), IntScaleView(2, x)) && + compares_unequal(IntScaleView(2, x), IntScaleView(3, x)) && + compares_unequal(IntScaleView(2, x), IntScaleView(2, y)) && + compares_equal(ConstIntView(4), ConstIntView(4)) && + compares_unequal(ConstIntView(4), ConstIntView(5)) && compares_equal(ZeroIntView(), ZeroIntView()) && + compares_equal(CachedView(x), CachedView(x)) && + compares_unequal(CachedView(x), CachedView(y)) && + compares_equal(NegBoolView(b), NegBoolView(b)) && compares_unequal(NegBoolView(b), NegBoolView(c)) && + compares_unequal(x, mx); + } + }; - } // namespace Basic -}} // namespace Test::Int + ViewCompare view_compare; + //@} +} // namespace Test::Int::Basic // STATISTICS: test-int diff --git a/test/int/bin-packing.cpp b/test/int/bin-packing.cpp index 7da8eb1814..997bc82a90 100644 --- a/test/int/bin-packing.cpp +++ b/test/int/bin-packing.cpp @@ -36,570 +36,565 @@ #include #include -namespace Test { namespace Int { - - /// %Tests for bin-packing constraint - namespace BinPacking { - - /** - * \defgroup TaskTestIntBinPacking Bin-packing constraints - * \ingroup TaskTestInt - */ - //@{ - /// Generate load and bin assignments - class LoadBinAssignment : public Assignment { - protected: - /// Number of bins - int n_bins; - /// Number of items - int n_items; - /// Domain for load variables - Gecode::IntSet d_load; - /// Domain for bin variables - Gecode::IntSet d_bin; - /// Load to generate (unless -1) - int load; - /// Iterator for each variable - Gecode::IntSetValues* dsv; - - public: - /// Initialize assignments for load and bin variables - LoadBinAssignment(int m, const Gecode::IntSet& d_m, int n, const Gecode::IntSet& d_n, int l) - : Assignment(m + n, d_m), n_bins(m), n_items(n), d_load(d_m), d_bin(d_n), load(l), - dsv(new Gecode::IntSetValues[static_cast(m + n)]) { - for (int i = n_bins; i--;) - dsv[i].init(d_load); - for (int i = n_items; i--;) - dsv[n_bins + i].init(d_bin); - } - /// Test whether all assignments have been iterated - bool - has_more(void) const override { - return dsv[0](); - } - /// Move to next assignment - void - next(Gecode::Support::RandomGenerator&) override { - // Try to generate next bin assignment - { - int i = n_items - 1; - while (i >= 0) { - ++dsv[n_bins + i]; - if (dsv[n_bins + i]()) - return; - dsv[n_bins + (i--)].init(d_bin); - } +/// %Tests for bin-packing constraint +namespace Test::Int::BinPacking { + + /** + * \defgroup TaskTestIntBinPacking Bin-packing constraints + * \ingroup TaskTestInt + */ + //@{ + /// Generate load and bin assignments + class LoadBinAssignment : public Assignment { + protected: + /// Number of bins + int n_bins; + /// Number of items + int n_items; + /// Domain for load variables + Gecode::IntSet d_load; + /// Domain for bin variables + Gecode::IntSet d_bin; + /// Load to generate (unless -1) + int load; + /// Iterator for each variable + Gecode::IntSetValues* dsv; + + public: + /// Initialize assignments for load and bin variables + LoadBinAssignment(int m, const Gecode::IntSet& d_m, int n, const Gecode::IntSet& d_n, int l) + : Assignment(m + n, d_m), n_bins(m), n_items(n), d_load(d_m), d_bin(d_n), load(l), + dsv(new Gecode::IntSetValues[static_cast(m + n)]) { + for (int i = n_bins; i--;) + dsv[i].init(d_load); + for (int i = n_items; i--;) + dsv[n_bins + i].init(d_bin); + } + /// Test whether all assignments have been iterated + bool + has_more() const override { + return dsv[0](); + } + /// Move to next assignment + void + next(Gecode::Support::RandomGenerator&) override { + // Try to generate next bin assignment + { + int i = n_items - 1; + while (i >= 0) { + ++dsv[n_bins + i]; + if (dsv[n_bins + i]()) + return; + dsv[n_bins + (i--)].init(d_bin); } - // Try to generate next load assignment - { - retry: - int i = n_bins - 1; - while (true) { - ++dsv[i]; - if (dsv[i]() || (i == 0)) { - if (dsv[i]() && (load >= 0)) { - int l = 0; - for (int k = 0; k < n_bins; k++) - l += dsv[k].val(); - if (load != l) - goto retry; - } - return; + } + // Try to generate next load assignment + { + retry: + int i = n_bins - 1; + while (true) { + ++dsv[i]; + if (dsv[i]() || (i == 0)) { + if (dsv[i]() && (load >= 0)) { + int l = 0; + for (int k = 0; k < n_bins; k++) + l += dsv[k].val(); + if (load != l) + goto retry; } - dsv[i--].init(d_load); + return; } + dsv[i--].init(d_load); } } - /// Return value for variable \a i - int - operator[](int i) const override { - assert((i >= 0) && (i < n_bins + n_items)); - return dsv[i].val(); - } - /// Destructor - ~LoadBinAssignment(void) override { - delete[] dsv; - } - }; - - /// %Test with different bin loads and items - class BPT : public Test { - protected: - /// Number of bins - int m; - /// Item sizes - Gecode::IntArgs s; - /// Whether to generate only valid loads - bool valid; - /// Total item sizes - int t; - /// Array of sufficient size for computing item loads - mutable int il[8]; - /// Compute total size - static int - total(const Gecode::IntArgs& s) { - int t = 0; - for (int i = s.size(); i--;) - t += s[i]; - return t; - } - - public: - /// Create and register test for \a m bins and item sizes \a s - BPT(int m0, const Gecode::IntArgs& s0, bool v = true) - : Test("BinPacking::" + str(m0) + "::" + str(s0) + "::" + (v ? "+" : "-"), m0 + s0.size(), 0, 100), - m(m0), s(s0), valid(v), t(total(s)) { - test_search = false; - } - /// Create assignment - Assignment* - assignment(void) const override { - // Compute plausible bin sizes - int a = t / m; - return new LoadBinAssignment(m, Gecode::IntSet(a - 1, a + 2), s.size(), Gecode::IntSet(0, m - 1), - valid ? t : -1); - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - // Loads are from 0 to m-1, after that are items - // Check whether loads sum up to total size - int l = 0; - for (int j = m; j--;) - l += x[j]; - if (l != t) + } + /// Return value for variable \a i + int + operator[](int i) const override { + assert((i >= 0) && (i < n_bins + n_items)); + return dsv[i].val(); + } + /// Destructor + ~LoadBinAssignment() override { + delete[] dsv; + } + }; + + /// %Test with different bin loads and items + class BPT : public Test { + protected: + /// Number of bins + int m; + /// Item sizes + Gecode::IntArgs s; + /// Whether to generate only valid loads + bool valid; + /// Total item sizes + int t; + /// Array of sufficient size for computing item loads + mutable int il[8]; + /// Compute total size + static int + total(const Gecode::IntArgs& s) { + int t = 0; + for (int i = s.size(); i--;) + t += s[i]; + return t; + } + + public: + /// Create and register test for \a m bins and item sizes \a s + BPT(int m0, const Gecode::IntArgs& s0, bool v = true) + : Test("BinPacking::" + str(m0) + "::" + str(s0) + "::" + (v ? "+" : "-"), m0 + s0.size(), 0, 100), m(m0), + s(s0), valid(v), t(total(s)) { + test_search = false; + } + /// Create assignment + Assignment* + assignment() const override { + // Compute plausible bin sizes + int a = t / m; + return new LoadBinAssignment(m, Gecode::IntSet(a - 1, a + 2), s.size(), Gecode::IntSet(0, m - 1), + valid ? t : -1); + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + // Loads are from 0 to m-1, after that are items + // Check whether loads sum up to total size + int l = 0; + for (int j = m; j--;) + l += x[j]; + if (l != t) + return false; + // Check whether items are at possible bins + for (int j = m; j--;) + if ((x[m + j] < 0) || (x[m + j] >= m)) return false; - // Check whether items are at possible bins - for (int j = m; j--;) - if ((x[m + j] < 0) || (x[m + j] >= m)) - return false; - // Compute whether items add up + // Compute whether items add up + for (int j = m; j--;) + il[j] = 0; + for (int i = s.size(); i--;) + il[x[m + i]] += s[i]; + for (int j = m; j--;) + if (il[j] != x[j]) + return false; + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + IntVarArgs l(m); + IntVarArgs b(s.size()); + for (int j = m; j--;) + l[j] = x[j]; + for (int i = s.size(); i--;) + b[i] = x[m + i]; + bin_packing(home, l, b, s); + } + }; + + /// %Test with different bin loads and items + class MBPT : public Test { + protected: + /// Dimension + int d; + /// Number of bins + int m; + /// Item sizes + Gecode::IntArgs s; + /// Bin capacities + Gecode::IntArgs c; + /// Array of sufficient size for computing item loads + mutable int il[4][8]; + + public: + /// Create and register test for \a d0 dimensions, \a m0 bins, item sizes \a s0, and capacities \a c0 + MBPT(int d0, int m0, const Gecode::IntArgs& s0, const Gecode::IntArgs& c0) + : Test("MultiBinPacking::" + str(d0) + "::" + str(m0) + "::" + str(s0) + "::" + str(c0), s0.size() / d0, 0, + m0 - 1), + d(d0), m(m0), s(s0), c(c0) { + test_search = false; + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + // x are the bin variables + for (int k = d; k--;) for (int j = m; j--;) - il[j] = 0; - for (int i = s.size(); i--;) - il[x[m + i]] += s[i]; + il[k][j] = 0; + for (int k = d; k--;) + for (int i = x.size(); i--;) + il[k][x[i]] += s[i * d + k]; + for (int k = d; k--;) for (int j = m; j--;) - if (il[j] != x[j]) + if (il[k][j] > c[k]) return false; - return true; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - IntVarArgs l(m); - IntVarArgs b(s.size()); - for (int j = m; j--;) - l[j] = x[j]; - for (int i = s.size(); i--;) - b[i] = x[m + i]; - bin_packing(home, l, b, s); + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + IntVarArgs l(d * m); + for (int j = m * d; j--;) + l[j] = IntVar(home, 0, Gecode::Int::Limits::max); + bin_packing(home, d, l, x, s, c); + } + }; + + /// Test for testing the max-clique finding for multi bin-packing + class CliqueMBPT : public Base { + protected: + /// Number of items + int n_items; + /// Expected clique + Gecode::IntArgs clique; + /// Simple test space class + class TestSpace : public Gecode::Space { + public: + // Constructor + TestSpace() = default; + // Copy function + Gecode::Space* + copy() override { + return nullptr; } }; - /// %Test with different bin loads and items - class MBPT : public Test { - protected: - /// Dimension - int d; - /// Number of bins - int m; - /// Item sizes - Gecode::IntArgs s; - /// Bin capacities - Gecode::IntArgs c; - /// Array of sufficient size for computing item loads - mutable int il[4][8]; - - public: - /// Create and register test for \a d0 dimensions, \a m0 bins, item sizes \a s0, and capacities \a c0 - MBPT(int d0, int m0, const Gecode::IntArgs& s0, const Gecode::IntArgs& c0) - : Test("MultiBinPacking::" + str(d0) + "::" + str(m0) + "::" + str(s0) + "::" + str(c0), s0.size() / d0, - 0, m0 - 1), - d(d0), m(m0), s(s0), c(c0) { - test_search = false; - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - // x are the bin variables - for (int k = d; k--;) - for (int j = m; j--;) - il[k][j] = 0; - for (int k = d; k--;) - for (int i = x.size(); i--;) - il[k][x[i]] += s[i * d + k]; - for (int k = d; k--;) - for (int j = m; j--;) - if (il[k][j] > c[k]) - return false; - return true; + public: + /// Test for number of items \a n expected clique \a c + CliqueMBPT(const Gecode::IntArgs& c) : Base("Int::MultiBinPacking::Clique::" + Test::str(c)), clique(c) {} + /// Run the actual test + bool + run() override { + using namespace Gecode; + TestSpace* home = new TestSpace; + /* + * Set up a multi-dimensional bin packing problems of dimension 2 + * where the item sizes in one dimension are all one but for some + * random items and two in the other dimension if the item is + * included in the clique and where the capacity in both dimensions + * is 3. + */ + // Number of items + int n_items = clique[clique.size() - 1] + 1; + // Capacity + IntArgs c({3, 3}); + // Item sizes + IntArgs s(2 * n_items); + for (int i = 2 * n_items; i--;) + s[i] = 1; + // Create some random conflicts + for (int i = clique.size() - 1; i--;) + s[_rand(n_items) * 2 + 0] = 2; + // Create conflicts corresponding to the clique + for (int i = clique.size(); i--;) + s[clique[i] * 2 + 1] = 2; + // Load and bin variables + IntVarArgs b(*home, n_items, 0, n_items - 1); + IntVarArgs l(*home, 2 * n_items, 0, 3); + IntSet mc = bin_packing(*home, 2, l, b, s, c); + if (home->status() == SS_FAILED) { + delete home; + return false; } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - IntVarArgs l(d * m); - for (int j = m * d; j--;) - l[j] = IntVar(home, 0, Gecode::Int::Limits::max); - bin_packing(home, d, l, x, s, c); + if (static_cast(clique.size()) != mc.size()) { + delete home; + return false; } - }; - - /// Test for testing the max-clique finding for multi bin-packing - class CliqueMBPT : public Base { - protected: - /// Number of items - int n_items; - /// Expected clique - Gecode::IntArgs clique; - /// Simple test space class - class TestSpace : public Gecode::Space { - public: - // Constructor - TestSpace(void) = default; - // Copy function - Gecode::Space* - copy(void) override { - return nullptr; - } - }; - - public: - /// Test for number of items \a n expected clique \a c - CliqueMBPT(const Gecode::IntArgs& c) : Base("Int::MultiBinPacking::Clique::" + Test::str(c)), clique(c) {} - /// Run the actual test - bool - run(void) override { - using namespace Gecode; - TestSpace* home = new TestSpace; - /* - * Set up a multi-dimensional bin packing problems of dimension 2 - * where the item sizes in one dimension are all one but for some - * random items and two in the other dimension if the item is - * included in the clique and where the capacity in both dimensions - * is 3. - */ - // Number of items - int n_items = clique[clique.size() - 1] + 1; - // Capacity - IntArgs c({3, 3}); - // Item sizes - IntArgs s(2 * n_items); - for (int i = 2 * n_items; i--;) - s[i] = 1; - // Create some random conflicts - for (int i = clique.size() - 1; i--;) - s[_rand(n_items) * 2 + 0] = 2; - // Create conflicts corresponding to the clique - for (int i = clique.size(); i--;) - s[clique[i] * 2 + 1] = 2; - // Load and bin variables - IntVarArgs b(*home, n_items, 0, n_items - 1); - IntVarArgs l(*home, 2 * n_items, 0, 3); - IntSet mc = bin_packing(*home, 2, l, b, s, c); - if (home->status() == SS_FAILED) { - delete home; - return false; - } - if (static_cast(clique.size()) != mc.size()) { + for (int i = clique.size(); i--;) + if (!mc.in(clique[i])) { delete home; return false; } - for (int i = clique.size(); i--;) - if (!mc.in(clique[i])) { - delete home; - return false; - } - delete home; - return true; + delete home; + return true; + } + }; + + /// Test the bin-packing propagation levels + class PropagationLevels : public Base { + protected: + /// Simple test space class + class TestSpace : public Gecode::Space { + public: + TestSpace() = default; + Gecode::Space* + copy() override { + return nullptr; } }; - - /// Test the bin-packing propagation levels - class PropagationLevels : public Base { - protected: - /// Simple test space class - class TestSpace : public Gecode::Space { - public: - TestSpace(void) = default; - Gecode::Space* - copy(void) override { - return nullptr; - } - }; - /// Check one propagation-level test case - bool - check_case(int n_bins, int capacity, const Gecode::IntArgs& sizes, const bool expected_failed[4]) const { - using namespace Gecode; - IntPropLevel const levels[] = {IPL_BASIC, IPL_DEF, IPL_ADVANCED, IPL_FULL}; - for (unsigned int i = 0; i < 4; i += 1) { - TestSpace* home = new TestSpace; - IntVarArgs l(*home, n_bins, 0, capacity); - IntVarArgs b(*home, sizes.size(), 0, n_bins - 1); - bin_packing(*home, l, b, sizes, levels[i]); - bool failed = home->status() == SS_FAILED; - delete home; - if (failed != expected_failed[i]) - return false; - } + /// Check one propagation-level test case + bool + check_case(int n_bins, int capacity, const Gecode::IntArgs& sizes, const bool expected_failed[4]) const { + using namespace Gecode; + IntPropLevel const levels[] = {IPL_BASIC, IPL_DEF, IPL_ADVANCED, IPL_FULL}; + for (unsigned int i = 0; i < 4; i += 1) { + TestSpace* home = new TestSpace; + IntVarArgs l(*home, n_bins, 0, capacity); + IntVarArgs b(*home, sizes.size(), 0, n_bins - 1); + bin_packing(*home, l, b, sizes, levels[i]); + bool failed = home->status() == SS_FAILED; + delete home; + if (failed != expected_failed[i]) + return false; + } + return true; + } + + public: + /// Constructor + PropagationLevels() : Base("Int::BinPacking::PropagationLevels") {} + /// Run the actual test + bool + run() override { + using namespace Gecode; + bool const advanced_failed[] = {false, true, true, true}; + bool const full_failed[] = {false, false, false, true}; + return check_case(3, 5, IntArgs({4, 2, 2, 2, 2, 2}), advanced_failed) && + check_case(5, 35, IntArgs({32, 30, 24, 21, 19, 11, 10, 9, 8, 5, 3}), full_failed); + } + }; + + /// Space without variables + class Fixture : public Gecode::Space { + public: + Fixture() = default; + // NOLINTNEXTLINE(modernize-use-equals-default) + Fixture(Fixture& fixture) : Gecode::Space(fixture) {} + Gecode::Space* + copy() override { + return new Fixture(*this); + } + }; + + /// %Test that both bin-packing overloads post nothing for zero items + class Empty : public Base { + public: + Empty() : Base("Int::BinPacking::Empty") {} + bool + run() override { + using namespace Gecode; + IntVarArgs e; + IntArgs s; + Fixture none, loads, loaded, multi_none, multi_loads, multi_loaded; + bin_packing(none, e, e, s); + IntVarArgs l(loads, 2, 0, 3); + bin_packing(loads, l, e, s); + bin_packing(loaded, IntVarArgs(loaded, 1, 1, 3), e, s); + IntSet clique_none = bin_packing(multi_none, 1, e, e, s, IntArgs({1})); + IntVarArgs ml(multi_loads, 2, 0, 3); + IntSet clique_loads = bin_packing(multi_loads, 2, ml, e, s, IntArgs({1, 1})); + bin_packing(multi_loaded, 1, IntVarArgs(multi_loaded, 1, 1, 3), e, s, IntArgs({3})); + return (none.status() == SS_SOLVED) && (loads.status() == SS_SOLVED) && l[0].assigned() && + (l[0].val() == 0) && l[1].assigned() && (l[1].val() == 0) && (loaded.status() == SS_FAILED) && + (multi_none.status() == SS_SOLVED) && (clique_none.size() == 0) && + (multi_loads.status() == SS_SOLVED) && ml[0].assigned() && (ml[0].val() == 0) && ml[1].assigned() && + (ml[1].val() == 0) && (clique_loads.size() == 0) && (multi_loaded.status() == SS_FAILED); + } + }; + + Empty empty; + + /// %Test that multi-dimensional bin packing needs at least one dimension + class NoDimension : public Base { + private: + /// Test whether posting with \a d dimensions throws Int::OutOfLimits + static bool + is_rejected(int d) { + using namespace Gecode; + Fixture home; + IntVarArgs l; + IntVarArgs b(home, 1, 0, 0); + IntArgs none; + try { + bin_packing(home, d, l, b, none, none); + } catch (const Gecode::Int::OutOfLimits&) { return true; } - - public: - /// Constructor - PropagationLevels(void) : Base("Int::BinPacking::PropagationLevels") {} - /// Run the actual test - bool - run(void) override { - using namespace Gecode; - bool const advanced_failed[] = {false, true, true, true}; - bool const full_failed[] = {false, false, false, true}; - return check_case(3, 5, IntArgs({4, 2, 2, 2, 2, 2}), advanced_failed) && - check_case(5, 35, IntArgs({32, 30, 24, 21, 19, 11, 10, 9, 8, 5, 3}), full_failed); + return false; + } + /// Test whether shared variables are reported before the dimension + static bool + reports_same_first() { + using namespace Gecode; + Fixture home; + IntVarArgs x(home, 1, 0, 1); + IntArgs none; + try { + bin_packing(home, 0, x, x, none, none); + } catch (const Gecode::Int::ArgumentSame&) { + return true; } - }; - - /// Space without variables + return false; + } + + public: + NoDimension() : Base("Int::BinPacking::NoDimension") {} + bool + run() override { + return is_rejected(0) && is_rejected(-1) && reports_same_first(); + } + }; + + NoDimension no_dimension; + + /// %Test for comparing bin-packing items + class ItemCompare : public Base { + private: + /// Space for the bin variables class Fixture : public Gecode::Space { public: - Fixture(void) = default; + Fixture() = default; // NOLINTNEXTLINE(modernize-use-equals-default) Fixture(Fixture& fixture) : Gecode::Space(fixture) {} Gecode::Space* - copy(void) override { + copy() override { return new Fixture(*this); } }; - /// %Test that both bin-packing overloads post nothing for zero items - class Empty : public Base { - public: - Empty(void) : Base("Int::BinPacking::Empty") {} - bool - run(void) override { - using namespace Gecode; - IntVarArgs e; - IntArgs s; - Fixture none, loads, loaded, multi_none, multi_loads, multi_loaded; - bin_packing(none, e, e, s); - IntVarArgs l(loads, 2, 0, 3); - bin_packing(loads, l, e, s); - bin_packing(loaded, IntVarArgs(loaded, 1, 1, 3), e, s); - IntSet clique_none = bin_packing(multi_none, 1, e, e, s, IntArgs({1})); - IntVarArgs ml(multi_loads, 2, 0, 3); - IntSet clique_loads = bin_packing(multi_loads, 2, ml, e, s, IntArgs({1, 1})); - bin_packing(multi_loaded, 1, IntVarArgs(multi_loaded, 1, 1, 3), e, s, IntArgs({3})); - return (none.status() == SS_SOLVED) && (loads.status() == SS_SOLVED) && l[0].assigned() && - (l[0].val() == 0) && l[1].assigned() && (l[1].val() == 0) && (loaded.status() == SS_FAILED) && - (multi_none.status() == SS_SOLVED) && (clique_none.size() == 0) && - (multi_loads.status() == SS_SOLVED) && ml[0].assigned() && (ml[0].val() == 0) && - ml[1].assigned() && (ml[1].val() == 0) && (clique_loads.size() == 0) && - (multi_loaded.status() == SS_FAILED); - } - }; - - Empty empty; - - /// %Test that multi-dimensional bin packing needs at least one dimension - class NoDimension : public Base { - private: - /// Test whether posting with \a d dimensions throws Int::OutOfLimits - static bool - is_rejected(int d) { - using namespace Gecode; - Fixture home; - IntVarArgs l; - IntVarArgs b(home, 1, 0, 0); - IntArgs none; - try { - bin_packing(home, d, l, b, none, none); - } catch (const Gecode::Int::OutOfLimits&) { - return true; - } - return false; - } - /// Test whether shared variables are reported before the dimension - static bool - reports_same_first(void) { - using namespace Gecode; - Fixture home; - IntVarArgs x(home, 1, 0, 1); - IntArgs none; - try { - bin_packing(home, 0, x, x, none, none); - } catch (const Gecode::Int::ArgumentSame&) { - return true; + public: + ItemCompare() : Base("Int::BinPacking::Item::Compare") {} + bool + run() override { + using namespace Gecode; + using Gecode::Int::BinPacking::Item; + Fixture home; + Gecode::Int::IntView b(IntVar(home, 0, 3)); + Gecode::Int::IntView c(IntVar(home, 0, 3)); + const Item i(b, 2); + const Item i_copy(i); + return compares_equal(i, i_copy) && compares_equal(i, Item(b, 2)) && compares_unequal(i, Item(b, 3)) && + compares_unequal(i, Item(c, 2)); + } + }; + + ItemCompare item_compare; + + /// Large weights must preserve every feasible bin assignment. + class DFFLargeWeights : public Test { + int capacity; + int weight; + + public: + DFFLargeWeights(int n, int c, int w) + : Test("BinPacking::DFFLargeWeights::" + str(n) + "::" + str(w), n, 0, 1), capacity(c), weight(w) {} + bool + solution(const Assignment& x) const override { + long long loads[2] = {0, 0}; + for (int i = 0; i < x.size(); i++) + loads[x[i]] += weight; + return (loads[0] <= capacity) && (loads[1] <= capacity); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs loads(home, 2, 0, capacity); + Gecode::IntArgs sizes(x.size()); + for (int i = 0; i < x.size(); i++) + sizes[i] = weight; + Gecode::bin_packing(home, loads, x, sizes); + } + }; + + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + using namespace Gecode; + + { + IntArgs s0({0, 0, 0, 0}); + IntArgs s1({2, 1, 1}); + IntArgs s2({1, 2, 3, 4}); + IntArgs s3({4, 3, 2, 1}); + IntArgs s4({1, 2, 4, 8}); + IntArgs s5({1, 1, 1, 1}); + IntArgs s6({1, 1, 2, 2}); + IntArgs s7({1, 3, 3, 4}); + IntArgs s8({1, 3, 3, 0, 4, 0}); + IntArgs s9({1, 2, 4, 8, 16, 32}); + + for (int m = 1; m < 4; m++) { + (void)new BPT(m, s0); + (void)new BPT(m, s1); + (void)new BPT(m, s2); + (void)new BPT(m, s3); + (void)new BPT(m, s4); + (void)new BPT(m, s5); + (void)new BPT(m, s6); + (void)new BPT(m, s7); + (void)new BPT(m, s8); + (void)new BPT(m, s9); + (void)new BPT(m, s1, false); } - return false; } - public: - NoDimension(void) : Base("Int::BinPacking::NoDimension") {} - bool - run(void) override { - return is_rejected(0) && is_rejected(-1) && reports_same_first(); + { + IntArgs s1({1, 2, 2, 1, 1, 2, 2, 1}); + IntArgs c1({3, 3}); + (void)new MBPT(2, 4, s1, c1); + (void)new MBPT(2, 6, s1, c1); + IntArgs s2({1, 1, 1, 1, 1, 1}); + IntArgs c21({1, 1}); + IntArgs c22({2, 2}); + (void)new MBPT(2, 6, s2, c21); + (void)new MBPT(2, 6, s2, c22); + IntArgs s3({1, 2, 3, 3, 2, 1, 2, 1, 3, 1, 3, 2}); + IntArgs c31({3, 3, 3}); + IntArgs c32({4, 4, 4}); + IntArgs c33({6, 6, 6}); + (void)new MBPT(3, 4, s3, c31); + (void)new MBPT(3, 4, s3, c32); + (void)new MBPT(3, 4, s3, c33); + (void)new MBPT(3, 5, s3, c31); + (void)new MBPT(3, 5, s3, c32); + (void)new MBPT(3, 5, s3, c33); } - }; - - NoDimension no_dimension; - - /// %Test for comparing bin-packing items - class ItemCompare : public Base { - private: - /// Space for the bin variables - class Fixture : public Gecode::Space { - public: - Fixture(void) = default; - // NOLINTNEXTLINE(modernize-use-equals-default) - Fixture(Fixture& fixture) : Gecode::Space(fixture) {} - Gecode::Space* - copy(void) override { - return new Fixture(*this); - } - }; - - public: - ItemCompare(void) : Base("Int::BinPacking::Item::Compare") {} - bool - run(void) override { - using namespace Gecode; - using Gecode::Int::BinPacking::Item; - Fixture home; - Gecode::Int::IntView b(IntVar(home, 0, 3)); - Gecode::Int::IntView c(IntVar(home, 0, 3)); - const Item i(b, 2); - const Item i_copy(i); - return compares_equal(i, i_copy) && compares_equal(i, Item(b, 2)) && compares_unequal(i, Item(b, 3)) && - compares_unequal(i, Item(c, 2)); - } - }; - - ItemCompare item_compare; - - /// Large weights must preserve every feasible bin assignment. - class DFFLargeWeights : public Test { - int capacity; - int weight; - public: - DFFLargeWeights(int n, int c, int w) - : Test("BinPacking::DFFLargeWeights::" + str(n) + "::" + str(w), n, 0, 1), capacity(c), weight(w) {} - bool - solution(const Assignment& x) const override { - long long loads[2] = {0, 0}; - for (int i = 0; i < x.size(); i++) - loads[x[i]] += weight; - return (loads[0] <= capacity) && (loads[1] <= capacity); - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs loads(home, 2, 0, capacity); - Gecode::IntArgs sizes(x.size()); - for (int i = 0; i < x.size(); i++) - sizes[i] = weight; - Gecode::bin_packing(home, loads, x, sizes); + { + IntArgs c1({0, 2, 4, 6}); + IntArgs c2({1, 2, 3, 4, 5, 6, 7, 8}); + IntArgs c3({1, 3, 7, 10, 15, 22, 27, 97}); + IntArgs c41({1, 2, 3, 4, 5, 6, 7, 14}); + IntArgs c42({1, 2, 3, 4, 5, 6, 7, 15}); + IntArgs c43({1, 2, 3, 4, 5, 6, 7, 16}); + IntArgs c44({1, 2, 3, 4, 5, 6, 7, 30}); + IntArgs c45({1, 2, 3, 4, 5, 6, 7, 31}); + IntArgs c46({1, 2, 3, 4, 5, 6, 7, 32}); + IntArgs c47({1, 2, 3, 4, 5, 6, 7, 62}); + IntArgs c48({1, 2, 3, 4, 5, 6, 7, 63}); + IntArgs c49({1, 2, 3, 4, 5, 6, 7, 64}); + + (void)new CliqueMBPT(c1); + (void)new CliqueMBPT(c2); + (void)new CliqueMBPT(c3); + (void)new CliqueMBPT(c41); + (void)new CliqueMBPT(c42); + (void)new CliqueMBPT(c43); + (void)new CliqueMBPT(c44); + (void)new CliqueMBPT(c45); + (void)new CliqueMBPT(c46); + (void)new CliqueMBPT(c47); + (void)new CliqueMBPT(c48); + (void)new CliqueMBPT(c49); } - }; - - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - using namespace Gecode; - - { - IntArgs s0({0, 0, 0, 0}); - IntArgs s1({2, 1, 1}); - IntArgs s2({1, 2, 3, 4}); - IntArgs s3({4, 3, 2, 1}); - IntArgs s4({1, 2, 4, 8}); - IntArgs s5({1, 1, 1, 1}); - IntArgs s6({1, 1, 2, 2}); - IntArgs s7({1, 3, 3, 4}); - IntArgs s8({1, 3, 3, 0, 4, 0}); - IntArgs s9({1, 2, 4, 8, 16, 32}); - - for (int m = 1; m < 4; m++) { - (void)new BPT(m, s0); - (void)new BPT(m, s1); - (void)new BPT(m, s2); - (void)new BPT(m, s3); - (void)new BPT(m, s4); - (void)new BPT(m, s5); - (void)new BPT(m, s6); - (void)new BPT(m, s7); - (void)new BPT(m, s8); - (void)new BPT(m, s9); - (void)new BPT(m, s1, false); - } - } - - { - IntArgs s1({1, 2, 2, 1, 1, 2, 2, 1}); - IntArgs c1({3, 3}); - (void)new MBPT(2, 4, s1, c1); - (void)new MBPT(2, 6, s1, c1); - IntArgs s2({1, 1, 1, 1, 1, 1}); - IntArgs c21({1, 1}); - IntArgs c22({2, 2}); - (void)new MBPT(2, 6, s2, c21); - (void)new MBPT(2, 6, s2, c22); - IntArgs s3({1, 2, 3, 3, 2, 1, 2, 1, 3, 1, 3, 2}); - IntArgs c31({3, 3, 3}); - IntArgs c32({4, 4, 4}); - IntArgs c33({6, 6, 6}); - (void)new MBPT(3, 4, s3, c31); - (void)new MBPT(3, 4, s3, c32); - (void)new MBPT(3, 4, s3, c33); - (void)new MBPT(3, 5, s3, c31); - (void)new MBPT(3, 5, s3, c32); - (void)new MBPT(3, 5, s3, c33); - } - - { - IntArgs c1({0, 2, 4, 6}); - IntArgs c2({1, 2, 3, 4, 5, 6, 7, 8}); - IntArgs c3({1, 3, 7, 10, 15, 22, 27, 97}); - IntArgs c41({1, 2, 3, 4, 5, 6, 7, 14}); - IntArgs c42({1, 2, 3, 4, 5, 6, 7, 15}); - IntArgs c43({1, 2, 3, 4, 5, 6, 7, 16}); - IntArgs c44({1, 2, 3, 4, 5, 6, 7, 30}); - IntArgs c45({1, 2, 3, 4, 5, 6, 7, 31}); - IntArgs c46({1, 2, 3, 4, 5, 6, 7, 32}); - IntArgs c47({1, 2, 3, 4, 5, 6, 7, 62}); - IntArgs c48({1, 2, 3, 4, 5, 6, 7, 63}); - IntArgs c49({1, 2, 3, 4, 5, 6, 7, 64}); - - (void)new CliqueMBPT(c1); - (void)new CliqueMBPT(c2); - (void)new CliqueMBPT(c3); - (void)new CliqueMBPT(c41); - (void)new CliqueMBPT(c42); - (void)new CliqueMBPT(c43); - (void)new CliqueMBPT(c44); - (void)new CliqueMBPT(c45); - (void)new CliqueMBPT(c46); - (void)new CliqueMBPT(c47); - (void)new CliqueMBPT(c48); - (void)new CliqueMBPT(c49); - } - - (void)new PropagationLevels; - (void)new DFFLargeWeights(1, Gecode::Int::Limits::max, Gecode::Int::Limits::max); - (void)new DFFLargeWeights(1, Gecode::Int::Limits::max / 2, Gecode::Int::Limits::max / 2); - (void)new DFFLargeWeights(2, 1100000000, 1000000000); - } - }; - Create c; + (void)new PropagationLevels; + (void)new DFFLargeWeights(1, Gecode::Int::Limits::max, Gecode::Int::Limits::max); + (void)new DFFLargeWeights(1, Gecode::Int::Limits::max / 2, Gecode::Int::Limits::max / 2); + (void)new DFFLargeWeights(2, 1100000000, 1000000000); + } + }; - //@} + Create c; - } // namespace BinPacking + //@} -}} // namespace Test::Int +} // namespace Test::Int::BinPacking // STATISTICS: test-int diff --git a/test/int/bool.cpp b/test/int/bool.cpp index cc506dd7ff..6ee42df3d6 100644 --- a/test/int/bool.cpp +++ b/test/int/bool.cpp @@ -34,545 +34,538 @@ #include -namespace Test { namespace Int { - - /// %Tests for Boolean constraints - namespace Bool { - - inline int - check(int x0, Gecode::BoolOpType op, int x1) { - switch (op) { - case Gecode::BOT_AND: - return x0 & x1; - case Gecode::BOT_OR: - return x0 | x1; - case Gecode::BOT_IMP: - return (!x0) | x1; - case Gecode::BOT_EQV: - return x0 == x1; - case Gecode::BOT_XOR: - return x0 != x1; - default: - GECODE_NEVER; - } +/// %Tests for Boolean constraints +namespace Test::Int::Bool { + + static inline int + check(int x0, Gecode::BoolOpType op, int x1) { + switch (op) { + case Gecode::BOT_AND: + return x0 & x1; + case Gecode::BOT_OR: + return x0 | x1; + case Gecode::BOT_IMP: + return (!x0) | x1; + case Gecode::BOT_EQV: + return x0 == x1; + case Gecode::BOT_XOR: + return x0 != x1; + default: GECODE_NEVER; - return 0; - } - - /** - * \defgroup TaskTestIntBool Boolean constraints - * \ingroup TaskTestInt - */ - //@{ - /// %Test for binary Boolean operation - class BinXYZ : public Test { - protected: - /// Boolean operation type for test - Gecode::BoolOpType op; - - public: - /// Construct and register test - BinXYZ(Gecode::BoolOpType op0) : Test("Bool::Bin::XYZ::" + str(op0), 3, 0, 1), op(op0) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - return check(x[0], op, x[1]) == x[2]; - } - /// Post constraint - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - rel(home, channel(home, x[0]), op, channel(home, x[1]), channel(home, x[2])); - } - }; - - /// %Test for binary Boolean operation with shared variables - class BinXXY : public Test { - protected: - /// Boolean operation type for test - Gecode::BoolOpType op; - - public: - /// Construct and register test - BinXXY(Gecode::BoolOpType op0) : Test("Bool::Bin::XXY::" + str(op0), 2, 0, 1), op(op0) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - return check(x[0], op, x[0]) == x[1]; - } - /// Post constraint - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - BoolVar b = channel(home, x[0]); - rel(home, b, op, b, channel(home, x[1])); - } - }; - - /// %Test for binary Boolean operation with shared variables - class BinXYX : public Test { - protected: - /// Boolean operation type for test - Gecode::BoolOpType op; - - public: - /// Construct and register test - BinXYX(Gecode::BoolOpType op0) : Test("Bool::Bin::XYX::" + str(op0), 2, 0, 1), op(op0) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - return check(x[0], op, x[1]) == x[0]; - } - /// Post constraint - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - BoolVar b = channel(home, x[0]); - rel(home, b, op, channel(home, x[1]), b); - } - }; - - /// %Test for binary Boolean operation with shared variables - class BinXYY : public Test { - protected: - /// Boolean operation type for test - Gecode::BoolOpType op; - - public: - /// Construct and register test - BinXYY(Gecode::BoolOpType op0) : Test("Bool::Bin::XYY::" + str(op0), 2, 0, 1), op(op0) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - return check(x[0], op, x[1]) == x[1]; - } - /// Post constraint - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - BoolVar b = channel(home, x[1]); - rel(home, channel(home, x[0]), op, b, b); - } - }; - - /// %Test for binary Boolean operation with shared variables - class BinXXX : public Test { - protected: - /// Boolean operation type for test - Gecode::BoolOpType op; - - public: - /// Construct and register test - BinXXX(Gecode::BoolOpType op0) : Test("Bool::Bin::XXX::" + str(op0), 1, 0, 1), op(op0) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - return check(x[0], op, x[0]) == x[0]; - } - /// Post constraint - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - BoolVar b = channel(home, x[0]); - rel(home, b, op, b, b); - } - }; - - /// %Test for binary Boolean operation with constant - class BinConstXY : public Test { - protected: - /// Boolean operation type for test - Gecode::BoolOpType op; - /// Integer constant - int c; - - public: - /// Construct and register test - BinConstXY(Gecode::BoolOpType op0, int c0) - : Test("Bool::Bin::XY::" + str(op0) + "::" + str(c0), 2, 0, 1), op(op0), c(c0) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - return check(x[0], op, x[1]) == c; - } - /// Post constraint - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - rel(home, channel(home, x[0]), op, channel(home, x[1]), c); - } - }; - - /// %Test for binary Boolean operation with shared variables and constant - class BinConstXX : public Test { - protected: - /// Boolean operation type for test - Gecode::BoolOpType op; - /// Integer constant - int c; - - public: - /// Construct and register test - BinConstXX(Gecode::BoolOpType op0, int c0) - : Test("Bool::Bin::XX::" + str(op0) + "::" + str(c0), 1, 0, 1), op(op0), c(c0) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - return check(x[0], op, x[0]) == c; - } - /// Post constraint - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - BoolVar b = channel(home, x[0]); - rel(home, b, op, b, c); - } - }; - - /// %Test for Nary Boolean operation - class Nary : public Test { - protected: - /// Boolean operation type for test - Gecode::BoolOpType op; - - public: - /// Construct and register test - Nary(Gecode::BoolOpType op0, int n) - : Test("Bool::Nary::" + str(op0) + "::" + str(n), n + 1, 0, 1), op(op0) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() - 1; - int b = check(x[n - 2], op, x[n - 1]); - for (int i = 0; i < n - 2; i++) - b = check(x[i], op, b); - return b == x[n]; - } - /// Post constraint - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - BoolVarArgs b(x.size() - 1); - for (int i = x.size() - 1; i--;) - b[i] = channel(home, x[i]); - rel(home, op, b, channel(home, x[x.size() - 1])); - } - }; - - /// %Test for Nary Boolean operation - class NaryShared : public Test { - protected: - /// Boolean operation type for test - Gecode::BoolOpType op; - - public: - /// Construct and register test - NaryShared(Gecode::BoolOpType op0, int n) - : Test("Bool::Nary::Shared::" + str(op0) + "::" + str(n), n, 0, 1), op(op0) { - if ((op == Gecode::BOT_EQV) || (op == Gecode::BOT_XOR)) - test_fixpoint = false; - } - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size(); - int b = check(x[n - 2], op, x[n - 1]); - for (int i = 0; i < n - 2; i++) - b = check(x[i], op, b); - return b == x[n - 1]; - } - /// Post constraint - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - BoolVarArgs b(x.size()); - for (int i = x.size(); i--;) - b[i] = channel(home, x[i]); - rel(home, op, b, b[x.size() - 1]); - } - }; - - /// %Test for Nary Boolean operation with constant - class NaryConst : public Test { - protected: - /// Boolean operation type for test - Gecode::BoolOpType op; - /// Integer constant - int c; - - public: - /// Construct and register test - NaryConst(Gecode::BoolOpType op0, int n, int c0) - : Test("Bool::Nary::" + str(op0) + "::" + str(n) + "::" + str(c0), n, 0, 1), op(op0), c(c0) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size(); - int b = check(x[n - 2], op, x[n - 1]); - for (int i = 0; i < n - 2; i++) - b = check(x[i], op, b); - return b == c; - } - /// Post constraint - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - BoolVarArgs b(x.size()); - for (int i = x.size(); i--;) - b[i] = channel(home, x[i]); - rel(home, op, b, c); - } - }; - - /// %Test for Clause Boolean operation - class ClauseXYZ : public Test { - protected: - /// Boolean operation type for test - Gecode::BoolOpType op; - - public: - /// Construct and register test - ClauseXYZ(Gecode::BoolOpType op0, int n) - : Test("Bool::Clause::XYZ::" + str(op0) + "::" + str(n), n + 1, 0, 1), op(op0) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = (x.size() - 1) / 2; - int b; - if (n == 1) { - b = check(x[0], op, !x[1]); - } else { - b = check(x[0], op, !x[n]); - for (int i = 1; i < n; i++) - b = check(b, op, check(x[i], op, !x[n + i])); - } - return b == x[x.size() - 1]; - } - /// Post constraint - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - int n = (x.size() - 1) / 2; - BoolVarArgs a(n), b(n); - for (int i = n; i--;) { - a[i] = channel(home, x[i]); - b[i] = channel(home, x[i + n]); - } - clause(home, op, a, b, channel(home, x[x.size() - 1])); - } - }; - - /// %Test for Clause Boolean operation - class ClauseXXYYX : public Test { - protected: - /// Boolean operation type for test - Gecode::BoolOpType op; - - public: - /// Construct and register test - ClauseXXYYX(Gecode::BoolOpType op0, int n) - : Test("Bool::Clause::XXYYX::" + str(op0) + "::" + str(n), n, 0, 1), op(op0) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() / 2; - int b; - if (n == 1) { - b = check(x[0], op, !x[1]); - } else { - b = check(x[0], op, !x[n]); - for (int i = 1; i < n; i++) - b = check(b, op, check(x[i], op, !x[n + i])); - } - return b == x[0]; - } - /// Post constraint - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - int n = x.size() / 2; - BoolVarArgs a(2 * n), b(2 * n); - for (int i = n; i--;) { - a[i] = a[i + n] = channel(home, x[i]); - b[i] = b[i + n] = channel(home, x[i + n]); - } - clause(home, op, a, b, a[0]); - } - }; - - /// %Test for Clause Boolean operation - class ClauseXXY : public Test { - protected: - /// Boolean operation type for test - Gecode::BoolOpType op; - - public: - /// Construct and register test - ClauseXXY(Gecode::BoolOpType op0, int n) - : Test("Bool::Clause::XXY::" + str(op0) + "::" + str(n), n, 0, 1), op(op0) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - return (x[0] == 1) == (op == Gecode::BOT_OR); - } - /// Post constraint - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - int n = x.size() / 2; - BoolVarArgs a(2 * n), b(2 * n); - for (int i = n; i--;) { - a[i] = b[i + n] = channel(home, x[i]); - b[i] = a[i + n] = channel(home, x[i + n]); - } - clause(home, op, a, b, a[0]); - } - }; - - /// %Test for Clause Boolean operation with constant - class ClauseConst : public Test { - protected: - /// Boolean operation type for test - Gecode::BoolOpType op; - /// Integer constant - int c; - - public: - /// Construct and register test - ClauseConst(Gecode::BoolOpType op0, int n, int c0) - : Test("Bool::Clause::" + str(op0) + "::" + str(n) + "::" + str(c0), n, 0, 1), op(op0), c(c0) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() / 2; - int b; - if (n == 1) { - b = check(x[0], op, !x[1]); - } else { - b = check(x[0], op, !x[n]); - for (int i = 1; i < n; i++) - b = check(b, op, check(x[i], op, !x[n + i])); - } - return b == c; - } - /// Post constraint - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - int n = x.size() / 2; - BoolVarArgs a(n), b(n); - for (int i = n; i--;) { - a[i] = channel(home, x[i]); - b[i] = channel(home, x[i + n]); - } - clause(home, op, a, b, c); - } - }; - - /// %Test for if-then-else-constraint - class ITEInt : public Test { - public: - /// Construct and register test - ITEInt(Gecode::IntPropLevel ipl) : Test("ITE::Int::" + str(ipl), 4, -4, 4, false, ipl) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - if ((x[0] < 0) || (x[0] > 1)) - return false; - if (x[0] == 1) - return x[1] == x[3]; - else - return x[2] == x[3]; - } - /// Post constraint - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - if (_rand(2) != 0) - ite(home, channel(home, x[0]), x[1], x[2], x[3]); - else - rel(home, ite(channel(home, x[0]), x[1], x[2]) == x[3]); - } - }; - - /// %Test for if-then-else-constraint - class ITEBool : public Test { - public: - /// Construct and register test - ITEBool(void) : Test("ITE::Bool", 4, 0, 1, false) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - if (x[0] == 1) - return x[1] == x[3]; - else - return x[2] == x[3]; - } - /// Post constraint - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - ite(home, channel(home, x[0]), channel(home, x[1]), channel(home, x[2]), channel(home, x[3])); - } - }; - - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - using namespace Gecode; - for (BoolOpTypes bots; bots(); ++bots) { - (void)new BinXYZ(bots.bot()); - (void)new BinXXY(bots.bot()); - (void)new BinXYX(bots.bot()); - (void)new BinXYY(bots.bot()); - (void)new BinXXX(bots.bot()); - (void)new BinConstXY(bots.bot(), 0); - (void)new BinConstXY(bots.bot(), 1); - (void)new BinConstXX(bots.bot(), 0); - (void)new BinConstXX(bots.bot(), 1); - (void)new Nary(bots.bot(), 2); - (void)new Nary(bots.bot(), 6); - (void)new Nary(bots.bot(), 10); - (void)new NaryShared(bots.bot(), 2); - (void)new NaryShared(bots.bot(), 6); - (void)new NaryShared(bots.bot(), 10); - (void)new NaryConst(bots.bot(), 2, 0); - (void)new NaryConst(bots.bot(), 6, 0); - (void)new NaryConst(bots.bot(), 10, 0); - (void)new NaryConst(bots.bot(), 2, 1); - (void)new NaryConst(bots.bot(), 6, 1); - (void)new NaryConst(bots.bot(), 10, 1); - if ((bots.bot() == BOT_AND) || (bots.bot() == BOT_OR)) { - (void)new ClauseXYZ(bots.bot(), 2); - (void)new ClauseXYZ(bots.bot(), 6); - (void)new ClauseXYZ(bots.bot(), 10); - (void)new ClauseXXYYX(bots.bot(), 2); - (void)new ClauseXXYYX(bots.bot(), 6); - (void)new ClauseXXYYX(bots.bot(), 10); - (void)new ClauseXXY(bots.bot(), 2); - (void)new ClauseXXY(bots.bot(), 6); - (void)new ClauseXXY(bots.bot(), 10); - (void)new ClauseConst(bots.bot(), 2, 0); - (void)new ClauseConst(bots.bot(), 6, 0); - (void)new ClauseConst(bots.bot(), 10, 0); - (void)new ClauseConst(bots.bot(), 2, 1); - (void)new ClauseConst(bots.bot(), 6, 1); - (void)new ClauseConst(bots.bot(), 10, 1); - } + } + GECODE_NEVER; + return 0; + } + + /** + * \defgroup TaskTestIntBool Boolean constraints + * \ingroup TaskTestInt + */ + //@{ + /// %Test for binary Boolean operation + class BinXYZ : public Test { + protected: + /// Boolean operation type for test + Gecode::BoolOpType op; + + public: + /// Construct and register test + BinXYZ(Gecode::BoolOpType op0) : Test("Bool::Bin::XYZ::" + str(op0), 3, 0, 1), op(op0) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + return check(x[0], op, x[1]) == x[2]; + } + /// Post constraint + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + rel(home, channel(home, x[0]), op, channel(home, x[1]), channel(home, x[2])); + } + }; + + /// %Test for binary Boolean operation with shared variables + class BinXXY : public Test { + protected: + /// Boolean operation type for test + Gecode::BoolOpType op; + + public: + /// Construct and register test + BinXXY(Gecode::BoolOpType op0) : Test("Bool::Bin::XXY::" + str(op0), 2, 0, 1), op(op0) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + return check(x[0], op, x[0]) == x[1]; + } + /// Post constraint + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + BoolVar b = channel(home, x[0]); + rel(home, b, op, b, channel(home, x[1])); + } + }; + + /// %Test for binary Boolean operation with shared variables + class BinXYX : public Test { + protected: + /// Boolean operation type for test + Gecode::BoolOpType op; + + public: + /// Construct and register test + BinXYX(Gecode::BoolOpType op0) : Test("Bool::Bin::XYX::" + str(op0), 2, 0, 1), op(op0) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + return check(x[0], op, x[1]) == x[0]; + } + /// Post constraint + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + BoolVar b = channel(home, x[0]); + rel(home, b, op, channel(home, x[1]), b); + } + }; + + /// %Test for binary Boolean operation with shared variables + class BinXYY : public Test { + protected: + /// Boolean operation type for test + Gecode::BoolOpType op; + + public: + /// Construct and register test + BinXYY(Gecode::BoolOpType op0) : Test("Bool::Bin::XYY::" + str(op0), 2, 0, 1), op(op0) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + return check(x[0], op, x[1]) == x[1]; + } + /// Post constraint + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + BoolVar b = channel(home, x[1]); + rel(home, channel(home, x[0]), op, b, b); + } + }; + + /// %Test for binary Boolean operation with shared variables + class BinXXX : public Test { + protected: + /// Boolean operation type for test + Gecode::BoolOpType op; + + public: + /// Construct and register test + BinXXX(Gecode::BoolOpType op0) : Test("Bool::Bin::XXX::" + str(op0), 1, 0, 1), op(op0) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + return check(x[0], op, x[0]) == x[0]; + } + /// Post constraint + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + BoolVar b = channel(home, x[0]); + rel(home, b, op, b, b); + } + }; + + /// %Test for binary Boolean operation with constant + class BinConstXY : public Test { + protected: + /// Boolean operation type for test + Gecode::BoolOpType op; + /// Integer constant + int c; + + public: + /// Construct and register test + BinConstXY(Gecode::BoolOpType op0, int c0) + : Test("Bool::Bin::XY::" + str(op0) + "::" + str(c0), 2, 0, 1), op(op0), c(c0) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + return check(x[0], op, x[1]) == c; + } + /// Post constraint + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + rel(home, channel(home, x[0]), op, channel(home, x[1]), c); + } + }; + + /// %Test for binary Boolean operation with shared variables and constant + class BinConstXX : public Test { + protected: + /// Boolean operation type for test + Gecode::BoolOpType op; + /// Integer constant + int c; + + public: + /// Construct and register test + BinConstXX(Gecode::BoolOpType op0, int c0) + : Test("Bool::Bin::XX::" + str(op0) + "::" + str(c0), 1, 0, 1), op(op0), c(c0) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + return check(x[0], op, x[0]) == c; + } + /// Post constraint + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + BoolVar b = channel(home, x[0]); + rel(home, b, op, b, c); + } + }; + + /// %Test for Nary Boolean operation + class Nary : public Test { + protected: + /// Boolean operation type for test + Gecode::BoolOpType op; + + public: + /// Construct and register test + Nary(Gecode::BoolOpType op0, int n) : Test("Bool::Nary::" + str(op0) + "::" + str(n), n + 1, 0, 1), op(op0) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() - 1; + int b = check(x[n - 2], op, x[n - 1]); + for (int i = 0; i < n - 2; i++) + b = check(x[i], op, b); + return b == x[n]; + } + /// Post constraint + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + BoolVarArgs b(x.size() - 1); + for (int i = x.size() - 1; i--;) + b[i] = channel(home, x[i]); + rel(home, op, b, channel(home, x[x.size() - 1])); + } + }; + + /// %Test for Nary Boolean operation + class NaryShared : public Test { + protected: + /// Boolean operation type for test + Gecode::BoolOpType op; + + public: + /// Construct and register test + NaryShared(Gecode::BoolOpType op0, int n) + : Test("Bool::Nary::Shared::" + str(op0) + "::" + str(n), n, 0, 1), op(op0) { + if ((op == Gecode::BOT_EQV) || (op == Gecode::BOT_XOR)) + test_fixpoint = false; + } + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size(); + int b = check(x[n - 2], op, x[n - 1]); + for (int i = 0; i < n - 2; i++) + b = check(x[i], op, b); + return b == x[n - 1]; + } + /// Post constraint + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + BoolVarArgs b(x.size()); + for (int i = x.size(); i--;) + b[i] = channel(home, x[i]); + rel(home, op, b, b[x.size() - 1]); + } + }; + + /// %Test for Nary Boolean operation with constant + class NaryConst : public Test { + protected: + /// Boolean operation type for test + Gecode::BoolOpType op; + /// Integer constant + int c; + + public: + /// Construct and register test + NaryConst(Gecode::BoolOpType op0, int n, int c0) + : Test("Bool::Nary::" + str(op0) + "::" + str(n) + "::" + str(c0), n, 0, 1), op(op0), c(c0) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size(); + int b = check(x[n - 2], op, x[n - 1]); + for (int i = 0; i < n - 2; i++) + b = check(x[i], op, b); + return b == c; + } + /// Post constraint + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + BoolVarArgs b(x.size()); + for (int i = x.size(); i--;) + b[i] = channel(home, x[i]); + rel(home, op, b, c); + } + }; + + /// %Test for Clause Boolean operation + class ClauseXYZ : public Test { + protected: + /// Boolean operation type for test + Gecode::BoolOpType op; + + public: + /// Construct and register test + ClauseXYZ(Gecode::BoolOpType op0, int n) + : Test("Bool::Clause::XYZ::" + str(op0) + "::" + str(n), n + 1, 0, 1), op(op0) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = (x.size() - 1) / 2; + int b; + if (n == 1) { + b = check(x[0], op, !x[1]); + } else { + b = check(x[0], op, !x[n]); + for (int i = 1; i < n; i++) + b = check(b, op, check(x[i], op, !x[n + i])); + } + return b == x[x.size() - 1]; + } + /// Post constraint + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + int n = (x.size() - 1) / 2; + BoolVarArgs a(n), b(n); + for (int i = n; i--;) { + a[i] = channel(home, x[i]); + b[i] = channel(home, x[i + n]); + } + clause(home, op, a, b, channel(home, x[x.size() - 1])); + } + }; + + /// %Test for Clause Boolean operation + class ClauseXXYYX : public Test { + protected: + /// Boolean operation type for test + Gecode::BoolOpType op; + + public: + /// Construct and register test + ClauseXXYYX(Gecode::BoolOpType op0, int n) + : Test("Bool::Clause::XXYYX::" + str(op0) + "::" + str(n), n, 0, 1), op(op0) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() / 2; + int b; + if (n == 1) { + b = check(x[0], op, !x[1]); + } else { + b = check(x[0], op, !x[n]); + for (int i = 1; i < n; i++) + b = check(b, op, check(x[i], op, !x[n + i])); + } + return b == x[0]; + } + /// Post constraint + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + int n = x.size() / 2; + BoolVarArgs a(2 * n), b(2 * n); + for (int i = n; i--;) { + a[i] = a[i + n] = channel(home, x[i]); + b[i] = b[i + n] = channel(home, x[i + n]); + } + clause(home, op, a, b, a[0]); + } + }; + + /// %Test for Clause Boolean operation + class ClauseXXY : public Test { + protected: + /// Boolean operation type for test + Gecode::BoolOpType op; + + public: + /// Construct and register test + ClauseXXY(Gecode::BoolOpType op0, int n) + : Test("Bool::Clause::XXY::" + str(op0) + "::" + str(n), n, 0, 1), op(op0) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + return (x[0] == 1) == (op == Gecode::BOT_OR); + } + /// Post constraint + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + int n = x.size() / 2; + BoolVarArgs a(2 * n), b(2 * n); + for (int i = n; i--;) { + a[i] = b[i + n] = channel(home, x[i]); + b[i] = a[i + n] = channel(home, x[i + n]); + } + clause(home, op, a, b, a[0]); + } + }; + + /// %Test for Clause Boolean operation with constant + class ClauseConst : public Test { + protected: + /// Boolean operation type for test + Gecode::BoolOpType op; + /// Integer constant + int c; + + public: + /// Construct and register test + ClauseConst(Gecode::BoolOpType op0, int n, int c0) + : Test("Bool::Clause::" + str(op0) + "::" + str(n) + "::" + str(c0), n, 0, 1), op(op0), c(c0) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() / 2; + int b; + if (n == 1) { + b = check(x[0], op, !x[1]); + } else { + b = check(x[0], op, !x[n]); + for (int i = 1; i < n; i++) + b = check(b, op, check(x[i], op, !x[n + i])); + } + return b == c; + } + /// Post constraint + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + int n = x.size() / 2; + BoolVarArgs a(n), b(n); + for (int i = n; i--;) { + a[i] = channel(home, x[i]); + b[i] = channel(home, x[i + n]); + } + clause(home, op, a, b, c); + } + }; + + /// %Test for if-then-else-constraint + class ITEInt : public Test { + public: + /// Construct and register test + ITEInt(Gecode::IntPropLevel ipl) : Test("ITE::Int::" + str(ipl), 4, -4, 4, false, ipl) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + if ((x[0] < 0) || (x[0] > 1)) + return false; + if (x[0] == 1) + return x[1] == x[3]; + return x[2] == x[3]; + } + /// Post constraint + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + if (_rand(2) != 0) + ite(home, channel(home, x[0]), x[1], x[2], x[3]); + else + rel(home, ite(channel(home, x[0]), x[1], x[2]) == x[3]); + } + }; + + /// %Test for if-then-else-constraint + class ITEBool : public Test { + public: + /// Construct and register test + ITEBool() : Test("ITE::Bool", 4, 0, 1, false) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + if (x[0] == 1) + return x[1] == x[3]; + return x[2] == x[3]; + } + /// Post constraint + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + ite(home, channel(home, x[0]), channel(home, x[1]), channel(home, x[2]), channel(home, x[3])); + } + }; + + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + using namespace Gecode; + for (BoolOpTypes bots; bots(); ++bots) { + (void)new BinXYZ(bots.bot()); + (void)new BinXXY(bots.bot()); + (void)new BinXYX(bots.bot()); + (void)new BinXYY(bots.bot()); + (void)new BinXXX(bots.bot()); + (void)new BinConstXY(bots.bot(), 0); + (void)new BinConstXY(bots.bot(), 1); + (void)new BinConstXX(bots.bot(), 0); + (void)new BinConstXX(bots.bot(), 1); + (void)new Nary(bots.bot(), 2); + (void)new Nary(bots.bot(), 6); + (void)new Nary(bots.bot(), 10); + (void)new NaryShared(bots.bot(), 2); + (void)new NaryShared(bots.bot(), 6); + (void)new NaryShared(bots.bot(), 10); + (void)new NaryConst(bots.bot(), 2, 0); + (void)new NaryConst(bots.bot(), 6, 0); + (void)new NaryConst(bots.bot(), 10, 0); + (void)new NaryConst(bots.bot(), 2, 1); + (void)new NaryConst(bots.bot(), 6, 1); + (void)new NaryConst(bots.bot(), 10, 1); + if ((bots.bot() == BOT_AND) || (bots.bot() == BOT_OR)) { + (void)new ClauseXYZ(bots.bot(), 2); + (void)new ClauseXYZ(bots.bot(), 6); + (void)new ClauseXYZ(bots.bot(), 10); + (void)new ClauseXXYYX(bots.bot(), 2); + (void)new ClauseXXYYX(bots.bot(), 6); + (void)new ClauseXXYYX(bots.bot(), 10); + (void)new ClauseXXY(bots.bot(), 2); + (void)new ClauseXXY(bots.bot(), 6); + (void)new ClauseXXY(bots.bot(), 10); + (void)new ClauseConst(bots.bot(), 2, 0); + (void)new ClauseConst(bots.bot(), 6, 0); + (void)new ClauseConst(bots.bot(), 10, 0); + (void)new ClauseConst(bots.bot(), 2, 1); + (void)new ClauseConst(bots.bot(), 6, 1); + (void)new ClauseConst(bots.bot(), 10, 1); } } - }; - - Create c; - ITEInt itebnd(Gecode::IPL_BND); - ITEInt itedom(Gecode::IPL_DOM); - ITEBool itebool; + } + }; - //@} + Create c; + ITEInt itebnd(Gecode::IPL_BND); + ITEInt itedom(Gecode::IPL_DOM); + ITEBool itebool; - } // namespace Bool -}} // namespace Test::Int + //@} +} // namespace Test::Int::Bool // STATISTICS: test-int diff --git a/test/int/channel.cpp b/test/int/channel.cpp index eee4b19a53..792878873b 100644 --- a/test/int/channel.cpp +++ b/test/int/channel.cpp @@ -34,203 +34,199 @@ #include -namespace Test { namespace Int { - - /// %Tests for channel constraints - namespace Channel { - - /** - * \defgroup TaskTestIntChannel Channel constraints - * \ingroup TaskTestInt - */ - //@{ - /// Simple test for channel (testing all variables) - class ChannelFull : public Test { - private: - int xoff; //< Offset for the x variables - int yoff; //< Offset for the y variables - public: - /// Construct and register test - ChannelFull(int xoff0, int yoff0, Gecode::IntPropLevel ipl) - : Test(TestTags::sweep(), "Channel::Full::" + str(xoff0) + "::" + str(yoff0) + "::" + str(ipl), 8, 0, 3, - false, ipl), - xoff(xoff0), yoff(yoff0) { - consistency_test_level = CTL_NONE; - } - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - for (int i = 0; i < 4; i++) - if (x[4 + x[i]] != i) - return false; - return true; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - IntVarArgs xa(4); - IntVarArgs ya(4); - for (int i = 4; i--;) { - if (xoff != 0) { - IntVar xo(home, xoff, 3 + xoff); - Gecode::rel(home, x[i] == xo - xoff); - xa[i] = xo; - } else { - xa[i] = x[i]; - } - if (yoff != 0) { - IntVar yo(home, yoff, 3 + yoff); - Gecode::rel(home, x[4 + i] == yo - yoff); - ya[i] = yo; - } else { - ya[i] = x[4 + i]; - } +/// %Tests for channel constraints +namespace Test::Int::Channel { + + /** + * \defgroup TaskTestIntChannel Channel constraints + * \ingroup TaskTestInt + */ + //@{ + /// Simple test for channel (testing all variables) + class ChannelFull : public Test { + private: + int xoff; //< Offset for the x variables + int yoff; //< Offset for the y variables + public: + /// Construct and register test + ChannelFull(int xoff0, int yoff0, Gecode::IntPropLevel ipl) + : Test(TestTags::sweep(), "Channel::Full::" + str(xoff0) + "::" + str(yoff0) + "::" + str(ipl), 8, 0, 3, + false, ipl), + xoff(xoff0), yoff(yoff0) { + consistency_test_level = CTL_NONE; + } + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + for (int i = 0; i < 4; i++) + if (x[4 + x[i]] != i) + return false; + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + IntVarArgs xa(4); + IntVarArgs ya(4); + for (int i = 4; i--;) { + if (xoff != 0) { + IntVar xo(home, xoff, 3 + xoff); + Gecode::rel(home, x[i] == xo - xoff); + xa[i] = xo; + } else { + xa[i] = x[i]; + } + if (yoff != 0) { + IntVar yo(home, yoff, 3 + yoff); + Gecode::rel(home, x[4 + i] == yo - yoff); + ya[i] = yo; + } else { + ya[i] = x[4 + i]; } - channel(home, xa, xoff, ya, yoff, ipl); - } - }; - - /// Simple test for channel (testing single set of variables) - class ChannelHalf : public Test { - public: - /// Construct and register test - ChannelHalf(Gecode::IntPropLevel ipl) - : Test(TestTags::sweep(), "Channel::Half::" + str(ipl), 6, 0, 5, false, ipl) { - consistency_test_level = CTL_NONE; - } - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - for (int i = 0; i < 6; i++) - for (int j = i + 1; j < 6; j++) - if (x[i] == x[j]) - return false; - return true; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - Gecode::IntVarArgs y(home, 6, dom); - for (int i = 0; i < 6; i++) - for (int j = 0; j < 6; j++) { - Gecode::BoolVar b(home, 0, 1); - rel(home, x[i], Gecode::IRT_EQ, j, b); - rel(home, y[j], Gecode::IRT_EQ, i, b); - } - channel(home, x, y, ipl); - } - }; - - /// %Test channel with shared variables - class ChannelShared : public Test { - public: - /// Construct and register test - ChannelShared(Gecode::IntPropLevel ipl) - : Test(TestTags::sweep(), "Channel::Shared::" + str(ipl), 6, 0, 5, false, ipl) { - consistency_test_level = CTL_NONE; - } - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - for (int i = 0; i < 6; i++) - if (x[x[i]] != i) - return false; - return true; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - channel(home, x, x, ipl); - } - }; - - /// %Test channel between integer and Boolean variable - class ChannelLinkSingle : public Test { - public: - /// Construct and register test - ChannelLinkSingle(void) : Test(TestTags::sweep(), "Channel::Bool::Single", 2, -1, 2) { - consistency_test_level = CTL_NONE; - } - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - return ((x[0] == 0) || (x[0] == 1)) && (x[0] == x[1]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - Gecode::BoolVar b(home, 0, 1); - channel(home, x[0], b); - channel(home, x[1], b); } - }; - - /// %Test channel between integer variable and array of Boolean variables - class ChannelLinkMulti : public Test { - private: - int o; - - public: - /// Construct and register test - ChannelLinkMulti(TestTags tags, const std::string& s, int min, int max, int o0) - : Test(tags, "Channel::Bool::Multi::" + s, 7, min, max), o(o0) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() - 1; - for (int i = n; i--;) - if ((x[i] != 0) && (x[i] != 1)) + channel(home, xa, xoff, ya, yoff, ipl); + } + }; + + /// Simple test for channel (testing single set of variables) + class ChannelHalf : public Test { + public: + /// Construct and register test + ChannelHalf(Gecode::IntPropLevel ipl) + : Test(TestTags::sweep(), "Channel::Half::" + str(ipl), 6, 0, 5, false, ipl) { + consistency_test_level = CTL_NONE; + } + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + for (int i = 0; i < 6; i++) + for (int j = i + 1; j < 6; j++) + if (x[i] == x[j]) return false; - int k = x[n] - o; - if ((k < 0) || (k >= n)) + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + Gecode::IntVarArgs y(home, 6, dom); + for (int i = 0; i < 6; i++) + for (int j = 0; j < 6; j++) { + Gecode::BoolVar b(home, 0, 1); + rel(home, x[i], Gecode::IRT_EQ, j, b); + rel(home, y[j], Gecode::IRT_EQ, i, b); + } + channel(home, x, y, ipl); + } + }; + + /// %Test channel with shared variables + class ChannelShared : public Test { + public: + /// Construct and register test + ChannelShared(Gecode::IntPropLevel ipl) + : Test(TestTags::sweep(), "Channel::Shared::" + str(ipl), 6, 0, 5, false, ipl) { + consistency_test_level = CTL_NONE; + } + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + for (int i = 0; i < 6; i++) + if (x[x[i]] != i) return false; - for (int i = 0; i < k; i++) - if (x[i] != 0) - return false; - for (int i = k + 1; i < n; i++) - if (x[i] != 0) - return false; - return x[k] == 1; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - int n = x.size() - 1; - Gecode::BoolVarArgs b(n); - for (int i = n; i--;) - b[i] = channel(home, x[i]); - channel(home, b, x[n], o); - } - }; - - ChannelFull cfd(0, 0, Gecode::IPL_DOM); - ChannelFull cfv(0, 0, Gecode::IPL_VAL); - - ChannelFull cfd11(1, 1, Gecode::IPL_DOM); - ChannelFull cfv11(1, 1, Gecode::IPL_VAL); - - ChannelFull cfd35(3, 5, Gecode::IPL_DOM); - ChannelFull cfv35(3, 5, Gecode::IPL_VAL); - - ChannelHalf chd(Gecode::IPL_DOM); - ChannelHalf chv(Gecode::IPL_VAL); - - ChannelShared csd(Gecode::IPL_DOM); - ChannelShared csv(Gecode::IPL_VAL); - - ChannelLinkSingle cls; - - ChannelLinkMulti clma(TestTags::standard(), "A", 0, 5, 0); - ChannelLinkMulti clmb(TestTags::sweep(), "B", 1, 6, 1); - ChannelLinkMulti clmc(TestTags::sweep(), "C", -1, 4, -1); - //@} - - } // namespace Channel -}} // namespace Test::Int - + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + channel(home, x, x, ipl); + } + }; + + /// %Test channel between integer and Boolean variable + class ChannelLinkSingle : public Test { + public: + /// Construct and register test + ChannelLinkSingle() : Test(TestTags::sweep(), "Channel::Bool::Single", 2, -1, 2) { + consistency_test_level = CTL_NONE; + } + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + return ((x[0] == 0) || (x[0] == 1)) && (x[0] == x[1]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + Gecode::BoolVar b(home, 0, 1); + channel(home, x[0], b); + channel(home, x[1], b); + } + }; + + /// %Test channel between integer variable and array of Boolean variables + class ChannelLinkMulti : public Test { + private: + int o; + + public: + /// Construct and register test + ChannelLinkMulti(TestTags tags, const std::string& s, int min, int max, int o0) + : Test(tags, "Channel::Bool::Multi::" + s, 7, min, max), o(o0) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() - 1; + for (int i = n; i--;) + if ((x[i] != 0) && (x[i] != 1)) + return false; + int k = x[n] - o; + if ((k < 0) || (k >= n)) + return false; + for (int i = 0; i < k; i++) + if (x[i] != 0) + return false; + for (int i = k + 1; i < n; i++) + if (x[i] != 0) + return false; + return x[k] == 1; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + int n = x.size() - 1; + Gecode::BoolVarArgs b(n); + for (int i = n; i--;) + b[i] = channel(home, x[i]); + channel(home, b, x[n], o); + } + }; + + ChannelFull cfd(0, 0, Gecode::IPL_DOM); + ChannelFull cfv(0, 0, Gecode::IPL_VAL); + + ChannelFull cfd11(1, 1, Gecode::IPL_DOM); + ChannelFull cfv11(1, 1, Gecode::IPL_VAL); + + ChannelFull cfd35(3, 5, Gecode::IPL_DOM); + ChannelFull cfv35(3, 5, Gecode::IPL_VAL); + + ChannelHalf chd(Gecode::IPL_DOM); + ChannelHalf chv(Gecode::IPL_VAL); + + ChannelShared csd(Gecode::IPL_DOM); + ChannelShared csv(Gecode::IPL_VAL); + + ChannelLinkSingle cls; + + ChannelLinkMulti clma(TestTags::standard(), "A", 0, 5, 0); + ChannelLinkMulti clmb(TestTags::sweep(), "B", 1, 6, 1); + ChannelLinkMulti clmc(TestTags::sweep(), "C", -1, 4, -1); + //@} + +} // namespace Test::Int::Channel // STATISTICS: test-int diff --git a/test/int/circuit.cpp b/test/int/circuit.cpp index e4349e2779..d52aef04a9 100644 --- a/test/int/circuit.cpp +++ b/test/int/circuit.cpp @@ -33,347 +33,343 @@ #include "test/int.hh" #include -namespace Test { namespace Int { +/// %Tests for circuit constraints +namespace Test::Int::Circuit { - /// %Tests for circuit constraints - namespace Circuit { + /** + * \defgroup TaskTestIntCircuit Circuit constraints + * \ingroup TaskTestInt + */ + //@{ + /// Simple test for circuit constraint + class Circuit : public Test { + private: + /// Offset + int offset; - /** - * \defgroup TaskTestIntCircuit Circuit constraints - * \ingroup TaskTestInt - */ - //@{ - /// Simple test for circuit constraint - class Circuit : public Test { - private: - /// Offset - int offset; - - public: - /// Create and register test - Circuit(int n, int min, int max, int off, Gecode::IntPropLevel ipl) - : Test(TestTags::sweep(), "Circuit::" + str(ipl) + "::" + str(n) + "::" + str(off), n, min, max, false, - ipl), - offset(off) { - consistency_test_level = CTL_NONE; - test_fixpoint = false; - } - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - for (int i = x.size(); i--;) - if ((x[i] < 0) || (x[i] > x.size() - 1)) - return false; - int reachable = 0; - { - int j = 0; - for (int i = x.size(); i--;) { - j = x[j]; - reachable |= (1 << j); - } + public: + /// Create and register test + Circuit(int n, int min, int max, int off, Gecode::IntPropLevel ipl) + : Test(TestTags::sweep(), "Circuit::" + str(ipl) + "::" + str(n) + "::" + str(off), n, min, max, false, + ipl), + offset(off) { + consistency_test_level = CTL_NONE; + test_fixpoint = false; + } + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + for (int i = x.size(); i--;) + if ((x[i] < 0) || (x[i] > x.size() - 1)) + return false; + int reachable = 0; + { + int j = 0; + for (int i = x.size(); i--;) { + j = x[j]; + reachable |= (1 << j); } - for (int i = x.size(); i--;) - if (!(reachable & (1 << i))) - return false; - return true; } - /// Post circuit constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - if (offset > 0) { - Gecode::IntVarArgs xx(x.size()); - for (int i = x.size(); i--;) - xx[i] = Gecode::expr(home, x[i] + offset); - Gecode::circuit(home, offset, xx, ipl); - } else { - Gecode::circuit(home, x, ipl); - } + for (int i = x.size(); i--;) + if (!(reachable & (1 << i))) + return false; + return true; + } + /// Post circuit constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + if (offset > 0) { + Gecode::IntVarArgs xx(x.size()); + for (int i = x.size(); i--;) + xx[i] = Gecode::expr(home, x[i] + offset); + Gecode::circuit(home, offset, xx, ipl); + } else { + Gecode::circuit(home, x, ipl); } - }; + } + }; - /// Simple test for Hamiltonian path constraint - class Path : public Test { - private: - /// Offset - int offset; + /// Simple test for Hamiltonian path constraint + class Path : public Test { + private: + /// Offset + int offset; - public: - /// Create and register test - Path(int n, int min, int max, int off, Gecode::IntPropLevel ipl) - : Test(TestTags::sweep(), "Path::" + str(ipl) + "::" + str(n) + "::" + str(off), n + 2, min, max, false, - ipl), - offset(off) { - consistency_test_level = CTL_NONE; - test_fixpoint = false; + public: + /// Create and register test + Path(int n, int min, int max, int off, Gecode::IntPropLevel ipl) + : Test(TestTags::sweep(), "Path::" + str(ipl) + "::" + str(n) + "::" + str(off), n + 2, min, max, false, + ipl), + offset(off) { + consistency_test_level = CTL_NONE; + test_fixpoint = false; + } + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() - 2; + int s = x[n]; + int e = x[n + 1]; + if ((s < 0) || (s > n) || (e < 0) || (e > n) || (x[e] != n)) + return false; + for (int i = n; i--;) + if ((i != e) && ((x[i] < 0) || (x[i] > n))) + return false; + int reachable = (1 << s); + { + int j = s; + for (int i = n; i--;) { + j = x[j]; + reachable |= (1 << j); + } } - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() - 2; - int s = x[n]; - int e = x[n + 1]; - if ((s < 0) || (s > n) || (e < 0) || (e > n) || (x[e] != n)) + for (int i = n; i--;) + if (!(reachable & (1 << i))) return false; + return true; + } + /// Post path constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + int n = x.size() - 2; + Gecode::IntVarArgs xx(n); + if (offset > 0) { for (int i = n; i--;) - if ((i != e) && ((x[i] < 0) || (x[i] > n))) - return false; - int reachable = (1 << s); - { - int j = s; - for (int i = n; i--;) { - j = x[j]; - reachable |= (1 << j); - } - } + xx[i] = Gecode::expr(home, x[i] + offset); + Gecode::path(home, offset, xx, Gecode::expr(home, x[n] + offset), Gecode::expr(home, x[n + 1] + offset), + ipl); + } else { for (int i = n; i--;) - if (!(reachable & (1 << i))) - return false; - return true; + xx[i] = x[i]; + Gecode::path(home, xx, x[n], x[n + 1], ipl); } - /// Post path constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - int n = x.size() - 2; - Gecode::IntVarArgs xx(n); - if (offset > 0) { - for (int i = n; i--;) - xx[i] = Gecode::expr(home, x[i] + offset); - Gecode::path(home, offset, xx, Gecode::expr(home, x[n] + offset), - Gecode::expr(home, x[n + 1] + offset), ipl); - } else { - for (int i = n; i--;) - xx[i] = x[i]; - Gecode::path(home, xx, x[n], x[n + 1], ipl); - } - } - }; + } + }; - /// Simple test for circuit constraint with total cost - class CircuitCost : public Test { - private: - /// Offset - int offset; + /// Simple test for circuit constraint with total cost + class CircuitCost : public Test { + private: + /// Offset + int offset; - public: - /// Create and register test - CircuitCost(int n, int min, int max, int off, Gecode::IntPropLevel ipl) - : Test((ipl == Gecode::IPL_DOM) && (n == 4) && (off == 0) ? TestTags::standard() : TestTags::sweep(), - "Circuit::Cost::" + str(ipl) + "::" + str(n) + "::" + str(off), n + 1, min, max, false, ipl), - offset(off) { - consistency_test_level = CTL_NONE; - test_fixpoint = false; - } - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() - 1; - for (int i = n; i--;) - if ((x[i] < 0) || (x[i] > n - 1)) - return false; - int reachable = 0; - { - int j = 0; - for (int i = n; i--;) { - j = x[j]; - reachable |= (1 << j); - } + public: + /// Create and register test + CircuitCost(int n, int min, int max, int off, Gecode::IntPropLevel ipl) + : Test((ipl == Gecode::IPL_DOM) && (n == 4) && (off == 0) ? TestTags::standard() : TestTags::sweep(), + "Circuit::Cost::" + str(ipl) + "::" + str(n) + "::" + str(off), n + 1, min, max, false, ipl), + offset(off) { + consistency_test_level = CTL_NONE; + test_fixpoint = false; + } + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() - 1; + for (int i = n; i--;) + if ((x[i] < 0) || (x[i] > n - 1)) + return false; + int reachable = 0; + { + int j = 0; + for (int i = n; i--;) { + j = x[j]; + reachable |= (1 << j); } - for (int i = n; i--;) - if (!(reachable & (1 << i))) - return false; - int c = 0; - for (int i = n; i--;) - c += x[i]; - return c == x[n]; } - /// Post circuit constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - int n = x.size() - 1; - IntArgs c(n * n); + for (int i = n; i--;) + if (!(reachable & (1 << i))) + return false; + int c = 0; + for (int i = n; i--;) + c += x[i]; + return c == x[n]; + } + /// Post circuit constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + int n = x.size() - 1; + IntArgs c(n * n); + for (int i = 0; i < n; i++) + for (int j = 0; j < n; j++) + c[i * n + j] = j; + IntVarArgs y(n); + if (offset > 0) { + for (int i = n; i--;) + y[i] = Gecode::expr(home, x[i] + offset); + Gecode::circuit(home, c, offset, y, x[n], ipl); + } else { for (int i = 0; i < n; i++) - for (int j = 0; j < n; j++) - c[i * n + j] = j; - IntVarArgs y(n); - if (offset > 0) { - for (int i = n; i--;) - y[i] = Gecode::expr(home, x[i] + offset); - Gecode::circuit(home, c, offset, y, x[n], ipl); - } else { - for (int i = 0; i < n; i++) - y[i] = x[i]; - circuit(home, c, y, x[n], ipl); - } + y[i] = x[i]; + circuit(home, c, y, x[n], ipl); } - }; + } + }; - /// Simple test for path constraint with total cost - class PathCost : public Test { - private: - /// Offset - int offset; + /// Simple test for path constraint with total cost + class PathCost : public Test { + private: + /// Offset + int offset; - public: - /// Create and register test - PathCost(int n, int min, int max, int off, Gecode::IntPropLevel ipl) - : Test((ipl == Gecode::IPL_DOM) && (n == 3) && (off == 0) ? TestTags::standard() : TestTags::sweep(), - "Path::Cost::" + str(ipl) + "::" + str(n) + "::" + str(off), n + 3, min, max, false, ipl), - offset(off) { - consistency_test_level = CTL_NONE; - test_fixpoint = false; - } - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() - 3; - int s = x[n]; - int e = x[n + 1]; - int c = x[n + 2] + n; - if ((s < 0) || (s > n) || (e < 0) || (e > n) || (x[e] != n)) + public: + /// Create and register test + PathCost(int n, int min, int max, int off, Gecode::IntPropLevel ipl) + : Test((ipl == Gecode::IPL_DOM) && (n == 3) && (off == 0) ? TestTags::standard() : TestTags::sweep(), + "Path::Cost::" + str(ipl) + "::" + str(n) + "::" + str(off), n + 3, min, max, false, ipl), + offset(off) { + consistency_test_level = CTL_NONE; + test_fixpoint = false; + } + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() - 3; + int s = x[n]; + int e = x[n + 1]; + int c = x[n + 2] + n; + if ((s < 0) || (s > n) || (e < 0) || (e > n) || (x[e] != n)) + return false; + for (int i = n; i--;) + if ((i != e) && ((x[i] < 0) || (x[i] > n))) return false; - for (int i = n; i--;) - if ((i != e) && ((x[i] < 0) || (x[i] > n))) - return false; - int reachable = (1 << s); - { - int j = s; - for (int i = n; i--;) { - j = x[j]; - reachable |= (1 << j); - } + int reachable = (1 << s); + { + int j = s; + for (int i = n; i--;) { + j = x[j]; + reachable |= (1 << j); } - for (int i = n; i--;) - if (!(reachable & (1 << i))) - return false; - for (int i = n; i--;) - c -= x[i]; - return c == 0; } - /// Post circuit constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - int n = x.size() - 3; - IntArgs c(n * n); + for (int i = n; i--;) + if (!(reachable & (1 << i))) + return false; + for (int i = n; i--;) + c -= x[i]; + return c == 0; + } + /// Post circuit constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + int n = x.size() - 3; + IntArgs c(n * n); + for (int i = 0; i < n; i++) + for (int j = 0; j < n; j++) + c[i * n + j] = j; + IntVarArgs y(n); + if (offset > 0) { + for (int i = n; i--;) + y[i] = Gecode::expr(home, x[i] + offset); + path(home, c, offset, y, expr(home, x[n] + offset), expr(home, x[n + 1] + offset), x[n + 2], ipl); + } else { for (int i = 0; i < n; i++) - for (int j = 0; j < n; j++) - c[i * n + j] = j; - IntVarArgs y(n); - if (offset > 0) { - for (int i = n; i--;) - y[i] = Gecode::expr(home, x[i] + offset); - path(home, c, offset, y, expr(home, x[n] + offset), expr(home, x[n + 1] + offset), x[n + 2], ipl); - } else { - for (int i = 0; i < n; i++) - y[i] = x[i]; - path(home, c, y, x[n], x[n + 1], x[n + 2], ipl); - } + y[i] = x[i]; + path(home, c, y, x[n], x[n + 1], x[n + 2], ipl); } - }; + } + }; - /// Simple test for circuit constraint with full cost information - class CircuitFullCost : public Test { - private: - /// Offset - int offset; + /// Simple test for circuit constraint with full cost information + class CircuitFullCost : public Test { + private: + /// Offset + int offset; - public: - /// Create and register test - CircuitFullCost(int n, int min, int max, int off, Gecode::IntPropLevel ipl) - : Test(TestTags::sweep(), "Circuit::FullCost::" + str(ipl) + "::" + str(n) + "::" + str(off), 2 * n + 1, - min, max, false, ipl), - offset(off) { - consistency_test_level = CTL_NONE; - test_fixpoint = false; - } - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = (x.size() - 1) / 2; - for (int i = n; i--;) - if ((x[i] < 0) || (x[i] > n - 1)) - return false; - int reachable = 0; - { - int j = 0; - for (int i = n; i--;) { - j = x[j]; - reachable |= (1 << j); - } + public: + /// Create and register test + CircuitFullCost(int n, int min, int max, int off, Gecode::IntPropLevel ipl) + : Test(TestTags::sweep(), "Circuit::FullCost::" + str(ipl) + "::" + str(n) + "::" + str(off), 2 * n + 1, + min, max, false, ipl), + offset(off) { + consistency_test_level = CTL_NONE; + test_fixpoint = false; + } + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = (x.size() - 1) / 2; + for (int i = n; i--;) + if ((x[i] < 0) || (x[i] > n - 1)) + return false; + int reachable = 0; + { + int j = 0; + for (int i = n; i--;) { + j = x[j]; + reachable |= (1 << j); } - for (int i = n; i--;) - if (!(reachable & (1 << i))) - return false; - for (int i = n; i--;) - if ((x[i] / 2) != x[n + i]) - return false; - int c = 0; - for (int i = n; i--;) - c += x[n + i]; - return c == x[2 * n]; } - /// Post circuit constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - int n = (x.size() - 1) / 2; - IntArgs c(n * n); + for (int i = n; i--;) + if (!(reachable & (1 << i))) + return false; + for (int i = n; i--;) + if ((x[i] / 2) != x[n + i]) + return false; + int c = 0; + for (int i = n; i--;) + c += x[n + i]; + return c == x[2 * n]; + } + /// Post circuit constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + int n = (x.size() - 1) / 2; + IntArgs c(n * n); + for (int i = 0; i < n; i++) + for (int j = 0; j < n; j++) + c[i * n + j] = (j / 2); + IntVarArgs y(n), z(n); + for (int i = 0; i < n; i++) { + z[i] = x[n + i]; + } + if (offset > 0) { + for (int i = n; i--;) + y[i] = Gecode::expr(home, x[i] + offset); + Gecode::circuit(home, c, offset, y, z, x[2 * n], ipl); + } else { for (int i = 0; i < n; i++) - for (int j = 0; j < n; j++) - c[i * n + j] = (j / 2); - IntVarArgs y(n), z(n); - for (int i = 0; i < n; i++) { - z[i] = x[n + i]; - } - if (offset > 0) { - for (int i = n; i--;) - y[i] = Gecode::expr(home, x[i] + offset); - Gecode::circuit(home, c, offset, y, z, x[2 * n], ipl); - } else { - for (int i = 0; i < n; i++) - y[i] = x[i]; - circuit(home, c, y, z, x[2 * n], ipl); - } + y[i] = x[i]; + circuit(home, c, y, z, x[2 * n], ipl); } - }; + } + }; - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - for (int i = 1; i <= 6; i++) { - (void)new Circuit(i, 0, i - 1, 0, Gecode::IPL_VAL); - (void)new Circuit(i, 0, i - 1, 0, Gecode::IPL_DOM); - (void)new Circuit(i, 0, i - 1, 5, Gecode::IPL_VAL); - (void)new Circuit(i, 0, i - 1, 5, Gecode::IPL_DOM); - } - for (int i = 1; i <= 4; i++) { - (void)new Path(i, 0, i - 1, 0, Gecode::IPL_VAL); - (void)new Path(i, 0, i - 1, 0, Gecode::IPL_DOM); - (void)new Path(i, 0, i - 1, 5, Gecode::IPL_VAL); - (void)new Path(i, 0, i - 1, 5, Gecode::IPL_DOM); - } - (void)new CircuitCost(4, 0, 9, 0, Gecode::IPL_VAL); - (void)new CircuitCost(4, 0, 9, 0, Gecode::IPL_DOM); - (void)new CircuitFullCost(3, 0, 3, 0, Gecode::IPL_VAL); - (void)new CircuitFullCost(3, 0, 3, 0, Gecode::IPL_DOM); - (void)new CircuitCost(4, 0, 9, 5, Gecode::IPL_VAL); - (void)new CircuitCost(4, 0, 9, 5, Gecode::IPL_DOM); - (void)new CircuitFullCost(3, 0, 3, 5, Gecode::IPL_VAL); - (void)new CircuitFullCost(3, 0, 3, 5, Gecode::IPL_DOM); - (void)new PathCost(3, 0, 5, 0, Gecode::IPL_VAL); - (void)new PathCost(3, 0, 5, 0, Gecode::IPL_DOM); - (void)new PathCost(3, 0, 5, 5, Gecode::IPL_VAL); - (void)new PathCost(3, 0, 5, 5, Gecode::IPL_DOM); + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + for (int i = 1; i <= 6; i++) { + (void)new Circuit(i, 0, i - 1, 0, Gecode::IPL_VAL); + (void)new Circuit(i, 0, i - 1, 0, Gecode::IPL_DOM); + (void)new Circuit(i, 0, i - 1, 5, Gecode::IPL_VAL); + (void)new Circuit(i, 0, i - 1, 5, Gecode::IPL_DOM); } - }; - - Create c; - //@} + for (int i = 1; i <= 4; i++) { + (void)new Path(i, 0, i - 1, 0, Gecode::IPL_VAL); + (void)new Path(i, 0, i - 1, 0, Gecode::IPL_DOM); + (void)new Path(i, 0, i - 1, 5, Gecode::IPL_VAL); + (void)new Path(i, 0, i - 1, 5, Gecode::IPL_DOM); + } + (void)new CircuitCost(4, 0, 9, 0, Gecode::IPL_VAL); + (void)new CircuitCost(4, 0, 9, 0, Gecode::IPL_DOM); + (void)new CircuitFullCost(3, 0, 3, 0, Gecode::IPL_VAL); + (void)new CircuitFullCost(3, 0, 3, 0, Gecode::IPL_DOM); + (void)new CircuitCost(4, 0, 9, 5, Gecode::IPL_VAL); + (void)new CircuitCost(4, 0, 9, 5, Gecode::IPL_DOM); + (void)new CircuitFullCost(3, 0, 3, 5, Gecode::IPL_VAL); + (void)new CircuitFullCost(3, 0, 3, 5, Gecode::IPL_DOM); + (void)new PathCost(3, 0, 5, 0, Gecode::IPL_VAL); + (void)new PathCost(3, 0, 5, 0, Gecode::IPL_DOM); + (void)new PathCost(3, 0, 5, 5, Gecode::IPL_VAL); + (void)new PathCost(3, 0, 5, 5, Gecode::IPL_DOM); + } + }; - } // namespace Circuit -}} // namespace Test::Int + Create c; + //@} +} // namespace Test::Int::Circuit // STATISTICS: test-int diff --git a/test/int/count.cpp b/test/int/count.cpp index 8cda43e2c7..688fda2a26 100644 --- a/test/int/count.cpp +++ b/test/int/count.cpp @@ -32,411 +32,406 @@ #include "test/int.hh" -namespace Test { namespace Int { - - /// %Tests for count constraints - namespace Count { - - /** - * \defgroup TaskTestIntCount Count constraints - * \ingroup TaskTestInt - */ - //@{ - /// %Test number of equal integers equal to integer - class IntInt : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - IntInt(Gecode::IntRelType irt0) : Test("Count::Int::Int::" + str(irt0), 4, -2, 2), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int m = 0; - for (int i = x.size(); i--;) - if (x[i] == 0) - m++; - return cmp(m, irt, 2); +/// %Tests for count constraints +namespace Test::Int::Count { + + /** + * \defgroup TaskTestIntCount Count constraints + * \ingroup TaskTestInt + */ + //@{ + /// %Test number of equal integers equal to integer + class IntInt : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + IntInt(Gecode::IntRelType irt0) : Test("Count::Int::Int::" + str(irt0), 4, -2, 2), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int m = 0; + for (int i = x.size(); i--;) + if (x[i] == 0) + m++; + return cmp(m, irt, 2); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::count(home, x, 0, irt, 2); + } + }; + + /// %Test number of integers contained in an integer set equal to integer + class SetInt : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + SetInt(Gecode::IntRelType irt0) : Test("Count::Set::Int::" + str(irt0), 4, -2, 2), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int m = 0; + for (int i = x.size(); i--;) + if ((x[i] >= -1) && (x[i] <= 1)) + m++; + return cmp(m, irt, 2); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntSet s(-1, 1); + Gecode::count(home, x, s, irt, 2); + } + }; + + /// %Test number of equal integers equal to integer with duplicate variables + class IntIntDup : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + IntIntDup(Gecode::IntRelType irt0) : Test("Count::Int::Int::Dup::" + str(irt0), 4, -2, 2), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int m = 0; + for (int i = x.size(); i--;) + if (x[i] == 0) + m += 2; + return cmp(m, irt, 4); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs y(8); + for (int i = x.size(); i--;) + y[i] = y[4 + i] = x[i]; + Gecode::count(home, y, 0, irt, 4); + } + }; + + /// %Test number of equal integers equal to integer variable + class IntVar : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + IntVar(Gecode::IntRelType irt0) : Test("Count::Int::Var::" + str(irt0), 5, -2, 2), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int m = 0; + for (int i = 0; i < 4; i++) + if (x[i] == 0) + m++; + return cmp(m, irt, x[4]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs y(4); + for (int i = 0; i < 4; i++) + y[i] = x[i]; + Gecode::count(home, y, 0, irt, x[4]); + } + }; + + /// %Test number of integers contained in an integer set equal to integer variable + class SetVar : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + SetVar(Gecode::IntRelType irt0) : Test("Count::Set::Var::" + str(irt0), 5, -2, 2), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int m = 0; + for (int i = 0; i < 4; i++) + if ((x[i] >= -1) && (x[i] <= 1)) + m++; + return cmp(m, irt, x[4]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs y(4); + for (int i = 0; i < 4; i++) + y[i] = x[i]; + Gecode::IntSet s(-1, 1); + Gecode::count(home, y, s, irt, x[4]); + } + }; + + Gecode::IntArgs ints({1, 0, 3, 2}); + + /// %Test number of several equal integers equal to integer + class IntArrayInt : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + IntArrayInt(Gecode::IntRelType irt0) : Test("Count::IntArray::Int::" + str(irt0), 5, -2, 2), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int m = 0; + for (int i = 0; i < 4; i++) + if (x[i] == ints[i]) + m++; + return cmp(m, irt, 2); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs y(4); + for (int i = 0; i < 4; i++) + y[i] = x[i]; + Gecode::count(home, y, ints, irt, 2); + } + }; + + /// %Test number of several equal integers equal to integer variable + class IntArrayVar : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + IntArrayVar(Gecode::IntRelType irt0) : Test("Count::IntArray::Var::" + str(irt0), 5, -2, 2), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int m = 0; + for (int i = 0; i < 4; i++) + if (x[i] == ints[i]) + m++; + return cmp(m, irt, x[4]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs y(4); + for (int i = 0; i < 4; i++) + y[i] = x[i]; + Gecode::count(home, y, ints, irt, x[4]); + } + }; + + /// %Test number of equal integers equal to integer variable with sharing + class IntVarShared : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + IntVarShared(Gecode::IntRelType irt0) : Test("Count::Int::Var::Shared::" + str(irt0), 4, -2, 2), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int m = 0; + for (int i = 0; i < 4; i++) + if (x[i] == 0) + m++; + return cmp(m, irt, x[2]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::count(home, x, 0, irt, x[2]); + } + }; + + /// %Test number of equal variables equal to integer variable + class VarVar : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + VarVar(Gecode::IntRelType irt0, Gecode::IntPropLevel ipl) + : Test("Count::Var::Var::" + str(irt0) + "::" + str(ipl), 5, -2, 2, false, ipl), irt(irt0) { + consistency_test_level = CTL_NONE; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int m = 0; + for (int i = 0; i < 3; i++) + if (x[i] == x[3]) + m++; + return cmp(m, irt, x[4]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs y(3); + for (int i = 0; i < 3; i++) + y[i] = x[i]; + Gecode::count(home, y, x[3], irt, x[4], ipl); + } + }; + + /// %Test number of equal variables equal to integer + class VarInt : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + VarInt(Gecode::IntRelType irt0, Gecode::IntPropLevel ipl) + : Test("Count::Var::Int::" + str(irt0) + "::" + str(ipl), 4, -2, 2, false, ipl), irt(irt0) { + consistency_test_level = CTL_NONE; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int m = 0; + for (int i = 0; i < 3; i++) + if (x[i] == x[3]) + m++; + return cmp(m, irt, 2); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs y(3); + for (int i = 0; i < 3; i++) + y[i] = x[i]; + Gecode::count(home, y, x[3], irt, 2, ipl); + } + }; + + /// %Test number of equal variables equal to integer variable with sharing + class VarVarSharedA : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + VarVarSharedA(Gecode::IntRelType irt0) + : Test("Count::Var::Var::Shared::A::" + str(irt0), 5, -2, 2), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int m = 0; + for (int i = 0; i < 4; i++) + if (x[i] == x[1]) + m++; + return cmp(m, irt, x[4]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs y(4); + for (int i = 0; i < 4; i++) + y[i] = x[i]; + Gecode::count(home, y, x[1], irt, x[4]); + } + }; + + /// %Test number of equal variables equal to integer variable with sharing + class VarVarSharedB : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + VarVarSharedB(Gecode::IntRelType irt0) + : Test("Count::Var::Var::Shared::B::" + str(irt0), 5, -2, 2), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int m = 0; + for (int i = 0; i < 4; i++) + if (x[i] == x[4]) + m++; + return cmp(m, irt, x[3]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs y(4); + for (int i = 0; i < 4; i++) + y[i] = x[i]; + Gecode::count(home, y, x[4], irt, x[3]); + } + }; + + /// %Test number of equal variables equal to integer variable with sharing + class VarVarSharedC : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + VarVarSharedC(Gecode::IntRelType irt0) + : Test("Count::Var::Var::Shared::C::" + str(irt0), 4, -2, 2), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int m = 0; + for (int i = 0; i < 4; i++) + if (x[i] == x[1]) + m++; + return cmp(m, irt, x[3]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::count(home, x, x[1], irt, x[3]); + } + }; + + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + for (IntRelTypes irts; irts(); ++irts) { + (void)new IntInt(irts.irt()); + (void)new SetInt(irts.irt()); + (void)new IntIntDup(irts.irt()); + (void)new IntVar(irts.irt()); + (void)new SetVar(irts.irt()); + (void)new IntArrayInt(irts.irt()); + (void)new IntArrayVar(irts.irt()); + (void)new IntVarShared(irts.irt()); + (void)new VarVar(irts.irt(), Gecode::IPL_BND); + (void)new VarVar(irts.irt(), Gecode::IPL_DOM); + (void)new VarInt(irts.irt(), Gecode::IPL_BND); + (void)new VarInt(irts.irt(), Gecode::IPL_DOM); + (void)new VarVarSharedA(irts.irt()); + (void)new VarVarSharedB(irts.irt()); + (void)new VarVarSharedC(irts.irt()); } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::count(home, x, 0, irt, 2); - } - }; - - /// %Test number of integers contained in an integer set equal to integer - class SetInt : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - SetInt(Gecode::IntRelType irt0) : Test("Count::Set::Int::" + str(irt0), 4, -2, 2), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int m = 0; - for (int i = x.size(); i--;) - if ((x[i] >= -1) && (x[i] <= 1)) - m++; - return cmp(m, irt, 2); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntSet s(-1, 1); - Gecode::count(home, x, s, irt, 2); - } - }; - - /// %Test number of equal integers equal to integer with duplicate variables - class IntIntDup : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - IntIntDup(Gecode::IntRelType irt0) : Test("Count::Int::Int::Dup::" + str(irt0), 4, -2, 2), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int m = 0; - for (int i = x.size(); i--;) - if (x[i] == 0) - m += 2; - return cmp(m, irt, 4); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs y(8); - for (int i = x.size(); i--;) - y[i] = y[4 + i] = x[i]; - Gecode::count(home, y, 0, irt, 4); - } - }; - - /// %Test number of equal integers equal to integer variable - class IntVar : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - IntVar(Gecode::IntRelType irt0) : Test("Count::Int::Var::" + str(irt0), 5, -2, 2), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int m = 0; - for (int i = 0; i < 4; i++) - if (x[i] == 0) - m++; - return cmp(m, irt, x[4]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs y(4); - for (int i = 0; i < 4; i++) - y[i] = x[i]; - Gecode::count(home, y, 0, irt, x[4]); - } - }; - - /// %Test number of integers contained in an integer set equal to integer variable - class SetVar : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - SetVar(Gecode::IntRelType irt0) : Test("Count::Set::Var::" + str(irt0), 5, -2, 2), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int m = 0; - for (int i = 0; i < 4; i++) - if ((x[i] >= -1) && (x[i] <= 1)) - m++; - return cmp(m, irt, x[4]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs y(4); - for (int i = 0; i < 4; i++) - y[i] = x[i]; - Gecode::IntSet s(-1, 1); - Gecode::count(home, y, s, irt, x[4]); - } - }; - - Gecode::IntArgs ints({1, 0, 3, 2}); - - /// %Test number of several equal integers equal to integer - class IntArrayInt : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - IntArrayInt(Gecode::IntRelType irt0) : Test("Count::IntArray::Int::" + str(irt0), 5, -2, 2), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int m = 0; - for (int i = 0; i < 4; i++) - if (x[i] == ints[i]) - m++; - return cmp(m, irt, 2); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs y(4); - for (int i = 0; i < 4; i++) - y[i] = x[i]; - Gecode::count(home, y, ints, irt, 2); - } - }; - - /// %Test number of several equal integers equal to integer variable - class IntArrayVar : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - IntArrayVar(Gecode::IntRelType irt0) : Test("Count::IntArray::Var::" + str(irt0), 5, -2, 2), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int m = 0; - for (int i = 0; i < 4; i++) - if (x[i] == ints[i]) - m++; - return cmp(m, irt, x[4]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs y(4); - for (int i = 0; i < 4; i++) - y[i] = x[i]; - Gecode::count(home, y, ints, irt, x[4]); - } - }; - - /// %Test number of equal integers equal to integer variable with sharing - class IntVarShared : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - IntVarShared(Gecode::IntRelType irt0) - : Test("Count::Int::Var::Shared::" + str(irt0), 4, -2, 2), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int m = 0; - for (int i = 0; i < 4; i++) - if (x[i] == 0) - m++; - return cmp(m, irt, x[2]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::count(home, x, 0, irt, x[2]); - } - }; - - /// %Test number of equal variables equal to integer variable - class VarVar : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - VarVar(Gecode::IntRelType irt0, Gecode::IntPropLevel ipl) - : Test("Count::Var::Var::" + str(irt0) + "::" + str(ipl), 5, -2, 2, false, ipl), irt(irt0) { - consistency_test_level = CTL_NONE; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int m = 0; - for (int i = 0; i < 3; i++) - if (x[i] == x[3]) - m++; - return cmp(m, irt, x[4]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs y(3); - for (int i = 0; i < 3; i++) - y[i] = x[i]; - Gecode::count(home, y, x[3], irt, x[4], ipl); - } - }; - - /// %Test number of equal variables equal to integer - class VarInt : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - VarInt(Gecode::IntRelType irt0, Gecode::IntPropLevel ipl) - : Test("Count::Var::Int::" + str(irt0) + "::" + str(ipl), 4, -2, 2, false, ipl), irt(irt0) { - consistency_test_level = CTL_NONE; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int m = 0; - for (int i = 0; i < 3; i++) - if (x[i] == x[3]) - m++; - return cmp(m, irt, 2); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs y(3); - for (int i = 0; i < 3; i++) - y[i] = x[i]; - Gecode::count(home, y, x[3], irt, 2, ipl); - } - }; - - /// %Test number of equal variables equal to integer variable with sharing - class VarVarSharedA : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - VarVarSharedA(Gecode::IntRelType irt0) - : Test("Count::Var::Var::Shared::A::" + str(irt0), 5, -2, 2), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int m = 0; - for (int i = 0; i < 4; i++) - if (x[i] == x[1]) - m++; - return cmp(m, irt, x[4]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs y(4); - for (int i = 0; i < 4; i++) - y[i] = x[i]; - Gecode::count(home, y, x[1], irt, x[4]); - } - }; - - /// %Test number of equal variables equal to integer variable with sharing - class VarVarSharedB : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - VarVarSharedB(Gecode::IntRelType irt0) - : Test("Count::Var::Var::Shared::B::" + str(irt0), 5, -2, 2), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int m = 0; - for (int i = 0; i < 4; i++) - if (x[i] == x[4]) - m++; - return cmp(m, irt, x[3]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs y(4); - for (int i = 0; i < 4; i++) - y[i] = x[i]; - Gecode::count(home, y, x[4], irt, x[3]); - } - }; - - /// %Test number of equal variables equal to integer variable with sharing - class VarVarSharedC : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - VarVarSharedC(Gecode::IntRelType irt0) - : Test("Count::Var::Var::Shared::C::" + str(irt0), 4, -2, 2), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int m = 0; - for (int i = 0; i < 4; i++) - if (x[i] == x[1]) - m++; - return cmp(m, irt, x[3]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::count(home, x, x[1], irt, x[3]); - } - }; - - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - for (IntRelTypes irts; irts(); ++irts) { - (void)new IntInt(irts.irt()); - (void)new SetInt(irts.irt()); - (void)new IntIntDup(irts.irt()); - (void)new IntVar(irts.irt()); - (void)new SetVar(irts.irt()); - (void)new IntArrayInt(irts.irt()); - (void)new IntArrayVar(irts.irt()); - (void)new IntVarShared(irts.irt()); - (void)new VarVar(irts.irt(), Gecode::IPL_BND); - (void)new VarVar(irts.irt(), Gecode::IPL_DOM); - (void)new VarInt(irts.irt(), Gecode::IPL_BND); - (void)new VarInt(irts.irt(), Gecode::IPL_DOM); - (void)new VarVarSharedA(irts.irt()); - (void)new VarVarSharedB(irts.irt()); - (void)new VarVarSharedC(irts.irt()); - } - } - }; - - Create c; - //@} + } + }; - } // namespace Count -}} // namespace Test::Int + Create c; + //@} +} // namespace Test::Int::Count // STATISTICS: test-int diff --git a/test/int/cumulative.cpp b/test/int/cumulative.cpp index bdf86c6649..cd162a5f7e 100644 --- a/test/int/cumulative.cpp +++ b/test/int/cumulative.cpp @@ -35,714 +35,687 @@ #include #include - -namespace Test { namespace Int { - - /// Tests for cumulative scheduling constraints - namespace Cumulative { - - /** - * \defgroup TaskTestIntCumulative Cumulative scheduling constraints - * \ingroup TaskTestInt - */ - //@{ - /// Test for cumulative constraint with mandatory tasks - class ManFixPCumulative : public Test { - protected: - /// Capacity of resource - int c; - /// The processing times - Gecode::IntArgs p; - /// The resource usage - Gecode::IntArgs u; - /// Get a reasonable maximal start time - static int - st(int c, const Gecode::IntArgs& p, const Gecode::IntArgs& u) { - double e = 0; - for (int i = p.size(); i--;) - e += static_cast(p[i]) * u[i]; - return e / std::max(1, std::abs(c)); +#include + +/// Tests for cumulative scheduling constraints +namespace Test::Int::Cumulative { + + /** + * \defgroup TaskTestIntCumulative Cumulative scheduling constraints + * \ingroup TaskTestInt + */ + //@{ + /// Test for cumulative constraint with mandatory tasks + class ManFixPCumulative : public Test { + protected: + /// Capacity of resource + int c; + /// The processing times + Gecode::IntArgs p; + /// The resource usage + Gecode::IntArgs u; + /// Get a reasonable maximal start time + static int + st(int c, const Gecode::IntArgs& p, const Gecode::IntArgs& u) { + double e = 0; + for (int i = p.size(); i--;) + e += static_cast(p[i]) * u[i]; + return e / std::max(1, std::abs(c)); + } + /// Offset + int o; + + public: + /// Create and register test + ManFixPCumulative(int c0, const Gecode::IntArgs& p0, const Gecode::IntArgs& u0, int o0, + Gecode::IntPropLevel ipl0) + : Test(((u0.size() == 1) && (u0[0] == 0)) || ((o0 == 0) && (c0 == 4)) ? TestTags::check() + : TestTags(TestTags::sweep()), + "Cumulative::Man::Fix::" + str(o0) + "::" + str(c0) + "::" + str(p0) + "::" + str(u0) + + "::" + str(ipl0), + (c0 >= 0) ? p0.size() : p0.size() + 1, 0, st(c0, p0, u0), false, ipl0), + c(c0), p(p0), u(u0), o(o0) { + test_search = false; + test_fixpoint = false; + consistency_test_level = CTL_NONE; + } + /// Create and register initial assignment + Assignment* + assignment() const override { + return new RandomAssignment(arity, dom, 500, _rand); + } + /// Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int cmax = (c >= 0) ? c : x[x.size() - 1]; + int n = (c >= 0) ? x.size() : x.size() - 1; + + if (c < 0 && x[n] > -c) + return false; + + // Compute maximal time + int t = 0; + for (int i = 0; i < n; i++) + t = std::max(t, x[i] + std::max(1, p[i])); + // Compute resource usage (including at start times) + std::vector used(t, 0); + for (int i = 0; i < n; i++) + for (int t = 0; t < p[i]; t++) + used[x[i] + t] += u[i]; + // Check resource usage + for (int i = 0; i < t; i++) + if (used[i] > cmax) { + return false; + } + // Compute resource usage (only internal) + for (int i = 0; i < t; i++) + used[i] = 0; + for (int i = 0; i < n; i++) { + for (int t = 1; t < p[i]; t++) { + used[x[i] + t] += u[i]; + } } - /// Offset - int o; - - public: - /// Create and register test - ManFixPCumulative(int c0, const Gecode::IntArgs& p0, const Gecode::IntArgs& u0, int o0, - Gecode::IntPropLevel ipl0) - : Test(((u0.size() == 1) && (u0[0] == 0)) || ((o0 == 0) && (c0 == 4)) ? TestTags::check() - : TestTags(TestTags::sweep()), - "Cumulative::Man::Fix::" + str(o0) + "::" + str(c0) + "::" + str(p0) + "::" + str(u0) + - "::" + str(ipl0), - (c0 >= 0) ? p0.size() : p0.size() + 1, 0, st(c0, p0, u0), false, ipl0), - c(c0), p(p0), u(u0), o(o0) { - test_search = false; - test_fixpoint = false; - consistency_test_level = CTL_NONE; + // Check resource usage at start times + for (int i = 0; i < n; i++) + if (used[x[i]] + u[i] > cmax) { + return false; + } + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + int n = (c >= 0) ? x.size() : x.size() - 1; + Gecode::IntVarArgs xx; + if (o == 0) { + xx = x.slice(0, 1, n); + } else { + xx = Gecode::IntVarArgs(n); + for (int i = n; i--;) + xx[i] = Gecode::expr(home, x[i] + o, Gecode::IPL_DOM); } - /// Create and register initial assignment - Assignment* - assignment(void) const override { - return new RandomAssignment(arity, dom, 500, _rand); + if (c >= 0) { + Gecode::cumulative(home, c, xx, p, u, ipl); + } else { + Gecode::rel(home, x[n] <= -c); + Gecode::cumulative(home, x[n], xx, p, u, ipl); } - /// Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int cmax = (c >= 0) ? c : x[x.size() - 1]; - int n = (c >= 0) ? x.size() : x.size() - 1; - - if (c < 0 && x[n] > -c) - return false; - - // Compute maximal time - int t = 0; - for (int i = 0; i < n; i++) - t = std::max(t, x[i] + std::max(1, p[i])); - // Compute resource usage (including at start times) - int* used = new int[t]; - for (int i = 0; i < t; i++) - used[i] = 0; - for (int i = 0; i < n; i++) + } + }; + + /// Test for cumulative constraint with optional tasks + class OptFixPCumulative : public Test { + protected: + /// Capacity of resource + int c; + /// The processing times + Gecode::IntArgs p; + /// The resource usage + Gecode::IntArgs u; + /// Limit for optional tasks + int l; + /// Offset + int o; + /// Get a reasonable maximal start time + static int + st(int c, const Gecode::IntArgs& p, const Gecode::IntArgs& u) { + double e = 0; + for (int i = p.size(); i--;) + e += static_cast(p[i]) * u[i]; + return e / std::max(1, std::abs(c)); + } + + public: + /// Create and register test + OptFixPCumulative(int c0, const Gecode::IntArgs& p0, const Gecode::IntArgs& u0, int o0, + Gecode::IntPropLevel ipl0) + : Test((u0.size() == 1) && (u0[0] == 0) ? TestTags::check() + : (o0 == Gecode::Int::Limits::min) && (c0 == -1) ? TestTags(TestTags::standard()) + : TestTags(TestTags::sweep()), + "Cumulative::Opt::Fix::" + str(o0) + "::" + str(c0) + "::" + str(p0) + "::" + str(u0) + + "::" + str(ipl0), + (c0 >= 0) ? 2 * p0.size() : 2 * p0.size() + 1, 0, st(c0, p0, u0), false, ipl0), + c(c0), p(p0), u(u0), l(st(c, p, u) / 2), o(o0) { + test_search = false; + test_fixpoint = false; + consistency_test_level = CTL_NONE; + } + /// Create and register initial assignment + Assignment* + assignment() const override { + return new RandomAssignment(arity, dom, 500, _rand); + } + /// Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int nn = (c >= 0) ? x.size() : x.size() - 1; + int cmax = (c >= 0) ? c : x[nn]; + + if (c < 0 && x[nn] > -c) + return false; + + int n = nn / 2; + // Compute maximal time + int t = 0; + for (int i = 0; i < n; i++) + t = std::max(t, x[i] + std::max(1, p[i])); + // Compute resource usage (including at start times) + std::vector used(t, 0); + for (int i = 0; i < n; i++) + if (x[n + i] > l) for (int t = 0; t < p[i]; t++) used[x[i] + t] += u[i]; - // Check resource usage - for (int i = 0; i < t; i++) - if (used[i] > cmax) { - delete[] used; - return false; - } - // Compute resource usage (only internal) - for (int i = 0; i < t; i++) - used[i] = 0; - for (int i = 0; i < n; i++) { - for (int t = 1; t < p[i]; t++) { + // Check resource usage + for (int i = 0; i < t; i++) { + if (used[i] > cmax) { + return false; + } + } + // Compute resource usage (only internal) + for (int i = 0; i < t; i++) + used[i] = 0; + for (int i = 0; i < n; i++) + if (x[n + i] > l) { + for (int t = 1; t < p[i]; t++) used[x[i] + t] += u[i]; - } } - // Check resource usage at start times - for (int i = 0; i < n; i++) + // Check resource usage at start times + for (int i = 0; i < n; i++) + if (x[n + i] > l) if (used[x[i]] + u[i] > cmax) { - delete[] used; return false; } - delete[] used; - return true; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - int n = (c >= 0) ? x.size() : x.size() - 1; - Gecode::IntVarArgs xx; - if (o == 0) { - xx = x.slice(0, 1, n); - } else { - xx = Gecode::IntVarArgs(n); - for (int i = n; i--;) - xx[i] = Gecode::expr(home, x[i] + o, Gecode::IPL_DOM); - } - if (c >= 0) { - Gecode::cumulative(home, c, xx, p, u, ipl); - } else { - Gecode::rel(home, x[n] <= -c); - Gecode::cumulative(home, x[n], xx, p, u, ipl); - } - } - }; - - /// Test for cumulative constraint with optional tasks - class OptFixPCumulative : public Test { - protected: - /// Capacity of resource - int c; - /// The processing times - Gecode::IntArgs p; - /// The resource usage - Gecode::IntArgs u; - /// Limit for optional tasks - int l; - /// Offset - int o; - /// Get a reasonable maximal start time - static int - st(int c, const Gecode::IntArgs& p, const Gecode::IntArgs& u) { - double e = 0; - for (int i = p.size(); i--;) - e += static_cast(p[i]) * u[i]; - return e / std::max(1, std::abs(c)); + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + int nn = (c >= 0) ? x.size() : x.size() - 1; + int n = nn / 2; + Gecode::IntVarArgs s(n); + Gecode::BoolVarArgs m(n); + + for (int i = 0; i < n; i++) { + s[i] = (c >= 0) ? x[i] : Gecode::expr(home, x[i] + o, Gecode::IPL_DOM); + m[i] = Gecode::expr(home, x[n + i] > l); } - public: - /// Create and register test - OptFixPCumulative(int c0, const Gecode::IntArgs& p0, const Gecode::IntArgs& u0, int o0, - Gecode::IntPropLevel ipl0) - : Test((u0.size() == 1) && (u0[0] == 0) ? TestTags::check() - : (o0 == Gecode::Int::Limits::min) && (c0 == -1) ? TestTags(TestTags::standard()) - : TestTags(TestTags::sweep()), - "Cumulative::Opt::Fix::" + str(o0) + "::" + str(c0) + "::" + str(p0) + "::" + str(u0) + - "::" + str(ipl0), - (c0 >= 0) ? 2 * p0.size() : 2 * p0.size() + 1, 0, st(c0, p0, u0), false, ipl0), - c(c0), p(p0), u(u0), l(st(c, p, u) / 2), o(o0) { - test_search = false; - test_fixpoint = false; - consistency_test_level = CTL_NONE; + if (c >= 0) { + Gecode::cumulative(home, c, s, p, u, m, ipl); + } else { + Gecode::rel(home, x[nn] <= -c); + Gecode::cumulative(home, x[nn], s, p, u, m, ipl); } - /// Create and register initial assignment - Assignment* - assignment(void) const override { - return new RandomAssignment(arity, dom, 500, _rand); + } + }; + + /// Test for cumulative constraint with flexible mandatory tasks + class ManFlexCumulative : public Test { + protected: + /// Capacity of resource + int c; + /// Minimum processing time + int _min_p; + /// Maximum processing time + int _max_p; + /// The resource usage + Gecode::IntArgs u; + /// Get a reasonable maximal start time + static int + st(int c, int max_p, const Gecode::IntArgs& u) { + double e = 0; + for (int i = u.size(); i--;) + e += static_cast(max_p) * u[i]; + return e / std::max(1, std::abs(c)); + } + /// Offset + int o; + + public: + /// Create and register test + ManFlexCumulative(int c0, int min_p, int max_p, const Gecode::IntArgs& u0, int o0, Gecode::IntPropLevel ipl0) + : Test((u0.size() == 1) && (u0[0] == 0) ? TestTags::check() : TestTags::sweep(), + "Cumulative::Man::Flex::" + str(o0) + "::" + str(c0) + "::" + str(min_p) + "::" + str(max_p) + + "::" + str(u0) + "::" + str(ipl0), + (c0 >= 0) ? 2 * u0.size() : 2 * u0.size() + 1, 0, std::max(max_p, st(c0, max_p, u0)), false, ipl0), + c(c0), _min_p(min_p), _max_p(max_p), u(u0), o(o0) { + test_search = false; + test_fixpoint = false; + consistency_test_level = CTL_NONE; + } + /// Create and register initial assignment + Assignment* + assignment() const override { + return new RandomMixAssignment((c >= 0) ? arity / 2 : arity / 2 + 1, dom, arity / 2, + Gecode::IntSet(_min_p, _max_p), 500, _rand); + } + /// Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int nn = (c >= 0) ? x.size() : x.size() - 1; + int n = nn / 2; + int cmax = (c >= 0) ? c : x[n]; + int pstart = (c >= 0) ? n : n + 1; + + if (c < 0 && cmax > -c) + return false; + + // Compute maximal time + int t = 0; + for (int i = 0; i < n; i++) { + t = std::max(t, x[i] + std::max(1, x[pstart + i])); } - /// Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int nn = (c >= 0) ? x.size() : x.size() - 1; - int cmax = (c >= 0) ? c : x[nn]; - - if (c < 0 && x[nn] > -c) + // Compute resource usage (including at start times) + std::vector used(t, 0); + for (int i = 0; i < n; i++) + for (int t = 0; t < x[pstart + i]; t++) + used[x[i] + t] += u[i]; + // Check resource usage + for (int i = 0; i < t; i++) + if (used[i] > cmax) { return false; - - int n = nn / 2; - // Compute maximal time - int t = 0; - for (int i = 0; i < n; i++) - t = std::max(t, x[i] + std::max(1, p[i])); - // Compute resource usage (including at start times) - int* used = new int[t]; - for (int i = 0; i < t; i++) - used[i] = 0; - for (int i = 0; i < n; i++) - if (x[n + i] > l) - for (int t = 0; t < p[i]; t++) - used[x[i] + t] += u[i]; - // Check resource usage - for (int i = 0; i < t; i++) { - if (used[i] > cmax) { - delete[] used; - return false; - } } - // Compute resource usage (only internal) - for (int i = 0; i < t; i++) - used[i] = 0; - for (int i = 0; i < n; i++) - if (x[n + i] > l) { - for (int t = 1; t < p[i]; t++) - used[x[i] + t] += u[i]; - } - // Check resource usage at start times - for (int i = 0; i < n; i++) - if (x[n + i] > l) - if (used[x[i]] + u[i] > cmax) { - delete[] used; - return false; - } - delete[] used; - return true; + // Compute resource usage (only internal) + for (int i = 0; i < t; i++) + used[i] = 0; + for (int i = 0; i < n; i++) { + for (int t = 1; t < x[pstart + i]; t++) + used[x[i] + t] += u[i]; } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - int nn = (c >= 0) ? x.size() : x.size() - 1; - int n = nn / 2; - Gecode::IntVarArgs s(n); - Gecode::BoolVarArgs m(n); - - for (int i = 0; i < n; i++) { - s[i] = (c >= 0) ? x[i] : Gecode::expr(home, x[i] + o, Gecode::IPL_DOM); - m[i] = Gecode::expr(home, x[n + i] > l); - } - - if (c >= 0) { - Gecode::cumulative(home, c, s, p, u, m, ipl); - } else { - Gecode::rel(home, x[nn] <= -c); - Gecode::cumulative(home, x[nn], s, p, u, m, ipl); + // Check resource usage at start times + for (int i = 0; i < n; i++) + if (used[x[i]] + u[i] > cmax) { + return false; } + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + int nn = (c >= 0) ? x.size() : x.size() - 1; + int n = nn / 2; + int pstart = (c >= 0) ? n : n + 1; + Gecode::IntVarArgs s(n); + Gecode::IntVarArgs px(x.slice(pstart, 1, n)); + Gecode::IntVarArgs e(home, n, Gecode::Int::Limits::min, Gecode::Int::Limits::max); + for (int i = s.size(); i--;) { + s[i] = expr(home, o + x[i], Gecode::IPL_DOM); + rel(home, s[i] + px[i] == e[i]); + rel(home, _min_p <= px[i]); + rel(home, _max_p >= px[i]); } - }; - - /// Test for cumulative constraint with flexible mandatory tasks - class ManFlexCumulative : public Test { - protected: - /// Capacity of resource - int c; - /// Minimum processing time - int _min_p; - /// Maximum processing time - int _max_p; - /// The resource usage - Gecode::IntArgs u; - /// Get a reasonable maximal start time - static int - st(int c, int max_p, const Gecode::IntArgs& u) { - double e = 0; - for (int i = u.size(); i--;) - e += static_cast(max_p) * u[i]; - return e / std::max(1, std::abs(c)); - } - /// Offset - int o; - - public: - /// Create and register test - ManFlexCumulative(int c0, int min_p, int max_p, const Gecode::IntArgs& u0, int o0, - Gecode::IntPropLevel ipl0) - : Test((u0.size() == 1) && (u0[0] == 0) ? TestTags::check() : TestTags::sweep(), - "Cumulative::Man::Flex::" + str(o0) + "::" + str(c0) + "::" + str(min_p) + "::" + str(max_p) + - "::" + str(u0) + "::" + str(ipl0), - (c0 >= 0) ? 2 * u0.size() : 2 * u0.size() + 1, 0, std::max(max_p, st(c0, max_p, u0)), false, - ipl0), - c(c0), _min_p(min_p), _max_p(max_p), u(u0), o(o0) { - test_search = false; - test_fixpoint = false; - consistency_test_level = CTL_NONE; - } - /// Create and register initial assignment - Assignment* - assignment(void) const override { - return new RandomMixAssignment((c >= 0) ? arity / 2 : arity / 2 + 1, dom, arity / 2, - Gecode::IntSet(_min_p, _max_p), 500, _rand); + if (c >= 0) { + Gecode::cumulative(home, c, s, px, e, u, ipl); + } else { + rel(home, x[n] <= -c); + Gecode::cumulative(home, x[n], s, px, e, u, ipl); } - /// Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int nn = (c >= 0) ? x.size() : x.size() - 1; - int n = nn / 2; - int cmax = (c >= 0) ? c : x[n]; - int pstart = (c >= 0) ? n : n + 1; - - if (c < 0 && cmax > -c) - return false; - - // Compute maximal time - int t = 0; - for (int i = 0; i < n; i++) { - t = std::max(t, x[i] + std::max(1, x[pstart + i])); - } - // Compute resource usage (including at start times) - int* used = new int[t]; - for (int i = 0; i < t; i++) - used[i] = 0; - for (int i = 0; i < n; i++) + } + }; + + /// Test for cumulative constraint with optional flexible tasks + class OptFlexCumulative : public Test { + protected: + /// Capacity of resource + int c; + /// Minimum processing time + int _min_p; + /// Maximum processing time + int _max_p; + /// The resource usage + Gecode::IntArgs u; + /// Limit for optional tasks + int l; + /// Offset + int o; + /// Get a reasonable maximal start time + static int + st(int c, int max_p, const Gecode::IntArgs& u) { + double e = 0; + for (int i = u.size(); i--;) + e += static_cast(max_p) * u[i]; + return e / std::max(1, std::abs(c)); + } + + public: + /// Create and register test + OptFlexCumulative(int c0, int min_p, int max_p, const Gecode::IntArgs& u0, int o0, Gecode::IntPropLevel ipl0) + : Test((u0.size() == 1) && (u0[0] == 0) ? TestTags::check() + : (o0 == Gecode::Int::Limits::min) && (c0 == 4) && (min_p == 0) && (max_p == 2) + ? TestTags(TestTags::standard()) + : TestTags(TestTags::sweep()), + "Cumulative::Opt::Flex::" + str(o0) + "::" + str(c0) + "::" + str(min_p) + "::" + str(max_p) + + "::" + str(u0) + "::" + str(ipl0), + (c0 >= 0) ? 3 * u0.size() : 3 * u0.size() + 1, 0, std::max(max_p, st(c0, max_p, u0)), false, ipl0), + c(c0), _min_p(min_p), _max_p(max_p), u(u0), l(std::max(max_p, st(c0, max_p, u0)) / 2), o(o0) { + test_search = false; + test_fixpoint = false; + consistency_test_level = CTL_NONE; + } + /// Create and register initial assignment + Assignment* + assignment() const override { + return new RandomMixAssignment((c >= 0) ? 2 * (arity / 3) : 2 * (arity / 3) + 1, dom, arity / 3, + Gecode::IntSet(_min_p, _max_p), 500, _rand); + } + /// Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int nn = (c >= 0) ? x.size() : x.size() - 1; + int n = nn / 3; + int cmax = (c >= 0) ? c : x[2 * n]; + int pstart = (c >= 0) ? 2 * n : 2 * n + 1; + + if (c < 0 && cmax > -c) + return false; + + // Compute maximal time + int t = 0; + for (int i = 0; i < n; i++) + t = std::max(t, x[i] + std::max(1, x[pstart + i])); + // Compute resource usage (including at start times) + std::vector used(t, 0); + for (int i = 0; i < n; i++) + if (x[n + i] > l) for (int t = 0; t < x[pstart + i]; t++) used[x[i] + t] += u[i]; - // Check resource usage - for (int i = 0; i < t; i++) - if (used[i] > cmax) { - delete[] used; - return false; - } - // Compute resource usage (only internal) - for (int i = 0; i < t; i++) - used[i] = 0; - for (int i = 0; i < n; i++) { + // Check resource usage + for (int i = 0; i < t; i++) + if (used[i] > cmax) { + return false; + } + // Compute resource usage (only internal) + for (int i = 0; i < t; i++) + used[i] = 0; + for (int i = 0; i < n; i++) + if (x[n + i] > l) for (int t = 1; t < x[pstart + i]; t++) used[x[i] + t] += u[i]; + // Check resource usage at start times + for (int i = 0; i < n; i++) + if (x[n + i] > l && used[x[i]] + u[i] > cmax) { + return false; } - // Check resource usage at start times - for (int i = 0; i < n; i++) - if (used[x[i]] + u[i] > cmax) { - delete[] used; - return false; - } - delete[] used; - return true; + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + int nn = (c >= 0) ? x.size() : x.size() - 1; + int n = nn / 3; + int pstart = (c >= 0) ? 2 * n : 2 * n + 1; + + Gecode::IntVarArgs s(n); + Gecode::IntVarArgs px(n); + Gecode::IntVarArgs e(home, n, Gecode::Int::Limits::min, Gecode::Int::Limits::max); + for (int i = n; i--;) { + s[i] = expr(home, o + x[i]); + px[i] = x[pstart + i]; + rel(home, s[i] + px[i] == e[i]); + rel(home, _min_p <= px[i]); + rel(home, _max_p >= px[i]); } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - int nn = (c >= 0) ? x.size() : x.size() - 1; - int n = nn / 2; - int pstart = (c >= 0) ? n : n + 1; - Gecode::IntVarArgs s(n); - Gecode::IntVarArgs px(x.slice(pstart, 1, n)); - Gecode::IntVarArgs e(home, n, Gecode::Int::Limits::min, Gecode::Int::Limits::max); - for (int i = s.size(); i--;) { - s[i] = expr(home, o + x[i], Gecode::IPL_DOM); - rel(home, s[i] + px[i] == e[i]); - rel(home, _min_p <= px[i]); - rel(home, _max_p >= px[i]); - } - if (c >= 0) { - Gecode::cumulative(home, c, s, px, e, u, ipl); - } else { - rel(home, x[n] <= -c); - Gecode::cumulative(home, x[n], s, px, e, u, ipl); - } + Gecode::BoolVarArgs m(n); + for (int i = 0; i < n; i++) + m[i] = Gecode::expr(home, (x[n + i] > l)); + if (c >= 0) { + Gecode::cumulative(home, c, s, px, e, u, m, ipl); + } else { + Gecode::rel(home, x[2 * n] <= -c); + Gecode::cumulative(home, x[2 * n], s, px, e, u, m, ipl); } - }; - - /// Test for cumulative constraint with optional flexible tasks - class OptFlexCumulative : public Test { - protected: - /// Capacity of resource - int c; - /// Minimum processing time - int _min_p; - /// Maximum processing time - int _max_p; - /// The resource usage - Gecode::IntArgs u; - /// Limit for optional tasks - int l; - /// Offset - int o; - /// Get a reasonable maximal start time - static int - st(int c, int max_p, const Gecode::IntArgs& u) { - double e = 0; - for (int i = u.size(); i--;) - e += static_cast(max_p) * u[i]; - return e / std::max(1, std::abs(c)); + } + }; + + /// Fixed-end tasks must accept exactly the capacity-feasible schedules + class ManFixECumulative : public Test { + public: + ManFixECumulative() + : Test("Cumulative::Man::FixE", 4, Gecode::IntSet({0, 9, 19, 29, 39}), false, Gecode::IPL_ADVANCED) { + test_fixpoint = false; + consistency_test_level = CTL_NONE; + } + bool + solution(const Assignment& x) const override { + for (int i = 0; i < 4; i++) + if (x[i] >= 10 * (i + 1)) + return false; + for (int t = 0; t < 40; t++) { + int used = 0; + for (int i = 0; i < 4; i++) + if ((x[i] <= t) && (t < 10 * (i + 1))) + used += 2; + if (used > 4) + return false; } - + return true; + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntArgs ends({10, 20, 30, 40}); + Gecode::TaskTypeArgs types(4); + for (int i = 0; i < 4; i++) { + Gecode::dom(home, x[i], 0, ends[i] - 1); + types[i] = Gecode::TT_FIXED_END; + } + Gecode::cumulative(home, 4, types, x, ends, Gecode::IntArgs({2, 2, 2, 2}), ipl); + } + }; + ManFixECumulative man_fix_e_cumulative; + + /// Check overload detection before search, including capacity wakeups + // Complete assignments cannot distinguish basic from advanced propagation. + class KnapsackAugmentedOverload : public Test::Base { + private: + class Fixture : public Gecode::Space { public: - /// Create and register test - OptFlexCumulative(int c0, int min_p, int max_p, const Gecode::IntArgs& u0, int o0, - Gecode::IntPropLevel ipl0) - : Test((u0.size() == 1) && (u0[0] == 0) ? TestTags::check() - : (o0 == Gecode::Int::Limits::min) && (c0 == 4) && (min_p == 0) && (max_p == 2) - ? TestTags(TestTags::standard()) - : TestTags(TestTags::sweep()), - "Cumulative::Opt::Flex::" + str(o0) + "::" + str(c0) + "::" + str(min_p) + "::" + str(max_p) + - "::" + str(u0) + "::" + str(ipl0), - (c0 >= 0) ? 3 * u0.size() : 3 * u0.size() + 1, 0, std::max(max_p, st(c0, max_p, u0)), false, - ipl0), - c(c0), _min_p(min_p), _max_p(max_p), u(u0), l(std::max(max_p, st(c0, max_p, u0)) / 2), o(o0) { - test_search = false; - test_fixpoint = false; - consistency_test_level = CTL_NONE; + Gecode::IntVarArray starts; + Fixture(Gecode::IntPropLevel level) : starts(*this, 5, 0, 6) { + starts[0] = Gecode::IntVar(*this, 1, 4); + starts[1] = Gecode::IntVar(*this, 0, 6); + starts[2] = Gecode::IntVar(*this, 2, 6); + starts[3] = Gecode::IntVar(*this, 0, 0); + starts[4] = Gecode::IntVar(*this, 0, 1); + Gecode::cumulative(*this, 3, starts, Gecode::IntArgs({3, 1, 1, 2, 4}), Gecode::IntArgs({3, 3, 1, 2, 1}), + level); } - /// Create and register initial assignment - Assignment* - assignment(void) const override { - return new RandomMixAssignment((c >= 0) ? 2 * (arity / 3) : 2 * (arity / 3) + 1, dom, arity / 3, - Gecode::IntSet(_min_p, _max_p), 500, _rand); + Fixture(Fixture& fixture) : Gecode::Space(fixture) { + starts.update(*this, fixture.starts); } - /// Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int nn = (c >= 0) ? x.size() : x.size() - 1; - int n = nn / 3; - int cmax = (c >= 0) ? c : x[2 * n]; - int pstart = (c >= 0) ? 2 * n : 2 * n + 1; - - if (c < 0 && cmax > -c) - return false; - - // Compute maximal time - int t = 0; - for (int i = 0; i < n; i++) - t = std::max(t, x[i] + std::max(1, x[pstart + i])); - // Compute resource usage (including at start times) - int* used = new int[t]; - for (int i = 0; i < t; i++) - used[i] = 0; - for (int i = 0; i < n; i++) - if (x[n + i] > l) - for (int t = 0; t < x[pstart + i]; t++) - used[x[i] + t] += u[i]; - // Check resource usage - for (int i = 0; i < t; i++) - if (used[i] > cmax) { - delete[] used; - return false; - } - // Compute resource usage (only internal) - for (int i = 0; i < t; i++) - used[i] = 0; - for (int i = 0; i < n; i++) - if (x[n + i] > l) - for (int t = 1; t < x[pstart + i]; t++) - used[x[i] + t] += u[i]; - // Check resource usage at start times - for (int i = 0; i < n; i++) - if (x[n + i] > l && used[x[i]] + u[i] > cmax) { - delete[] used; - return false; - } - delete[] used; - return true; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - int nn = (c >= 0) ? x.size() : x.size() - 1; - int n = nn / 3; - int pstart = (c >= 0) ? 2 * n : 2 * n + 1; - - Gecode::IntVarArgs s(n); - Gecode::IntVarArgs px(n); - Gecode::IntVarArgs e(home, n, Gecode::Int::Limits::min, Gecode::Int::Limits::max); - for (int i = n; i--;) { - s[i] = expr(home, o + x[i]); - px[i] = x[pstart + i]; - rel(home, s[i] + px[i] == e[i]); - rel(home, _min_p <= px[i]); - rel(home, _max_p >= px[i]); - } - Gecode::BoolVarArgs m(n); - for (int i = 0; i < n; i++) - m[i] = Gecode::expr(home, (x[n + i] > l)); - if (c >= 0) { - Gecode::cumulative(home, c, s, px, e, u, m, ipl); - } else { - Gecode::rel(home, x[2 * n] <= -c); - Gecode::cumulative(home, x[2 * n], s, px, e, u, m, ipl); - } + Gecode::Space* + copy() override { + return new Fixture(*this); } }; - /// Fixed-end tasks must accept exactly the capacity-feasible schedules - class ManFixECumulative : public Test { + class VariableCapacityFixture : public Gecode::Space { public: - ManFixECumulative(void) - : Test("Cumulative::Man::FixE", 4, Gecode::IntSet({0, 9, 19, 29, 39}), false, Gecode::IPL_ADVANCED) { - test_fixpoint = false; - consistency_test_level = CTL_NONE; + Gecode::IntVarArray starts; + Gecode::IntVar capacity; + VariableCapacityFixture() : starts(*this, 5, 0, 6), capacity(*this, 3, 4) { + starts[0] = Gecode::IntVar(*this, 1, 4); + starts[1] = Gecode::IntVar(*this, 0, 6); + starts[2] = Gecode::IntVar(*this, 2, 6); + starts[3] = Gecode::IntVar(*this, 0, 0); + starts[4] = Gecode::IntVar(*this, 0, 1); + Gecode::cumulative(*this, capacity, starts, Gecode::IntArgs({3, 1, 1, 2, 4}), + Gecode::IntArgs({3, 3, 1, 2, 1}), Gecode::IPL_ADVANCED); } - bool - solution(const Assignment& x) const override { - for (int i = 0; i < 4; i++) - if (x[i] >= 10 * (i + 1)) - return false; - for (int t = 0; t < 40; t++) { - int used = 0; - for (int i = 0; i < 4; i++) - if ((x[i] <= t) && (t < 10 * (i + 1))) - used += 2; - if (used > 4) - return false; - } - return true; + VariableCapacityFixture(VariableCapacityFixture& fixture) : Gecode::Space(fixture) { + starts.update(*this, fixture.starts); + capacity.update(*this, fixture.capacity); } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntArgs ends({10, 20, 30, 40}); - Gecode::TaskTypeArgs types(4); - for (int i = 0; i < 4; i++) { - Gecode::dom(home, x[i], 0, ends[i] - 1); - types[i] = Gecode::TT_FIXED_END; - } - Gecode::cumulative(home, 4, types, x, ends, Gecode::IntArgs({2, 2, 2, 2}), ipl); + Gecode::Space* + copy() override { + return new VariableCapacityFixture(*this); } }; - ManFixECumulative man_fix_e_cumulative; - /// Check overload detection before search, including capacity wakeups - // Complete assignments cannot distinguish basic from advanced propagation. - class KnapsackAugmentedOverload : public Test::Base { - private: - class Fixture : public Gecode::Space { + static bool + variable_capacity_rechecks() { + VariableCapacityFixture root; + if (root.status() == Gecode::SS_FAILED) + return false; + std::unique_ptr clone(static_cast(root.clone())); + Gecode::rel(*clone, clone->capacity, Gecode::IRT_EQ, 3); + return clone->status() == Gecode::SS_FAILED; + } + + static bool + optional_subset() { + class OptionalSubsetFixture : public Gecode::Space { public: - Gecode::IntVarArray starts; - Fixture(Gecode::IntPropLevel level) : starts(*this, 5, 0, 6) { - starts[0] = Gecode::IntVar(*this, 1, 4); - starts[1] = Gecode::IntVar(*this, 0, 6); - starts[2] = Gecode::IntVar(*this, 2, 6); - starts[3] = Gecode::IntVar(*this, 0, 0); - starts[4] = Gecode::IntVar(*this, 0, 1); - Gecode::cumulative(*this, 3, starts, Gecode::IntArgs({3, 1, 1, 2, 4}), - Gecode::IntArgs({3, 3, 1, 2, 1}), level); - } - Fixture(Fixture& fixture) : Gecode::Space(fixture) { - starts.update(*this, fixture.starts); + OptionalSubsetFixture(Gecode::IntPropLevel level) { + const int n = 69; + Gecode::IntVarArgs starts(n); + Gecode::BoolVarArgs mandatory(n); + Gecode::IntArgs processing(n); + Gecode::IntArgs demand(n); + for (int i = 0; i < n; i++) { + starts[i] = Gecode::IntVar(*this, 2 * i, 2 * i); + mandatory[i] = Gecode::BoolVar(*this, i < 5 ? 1 : 0, 1); + processing[i] = 1; + demand[i] = 2 + (i & 1); + } + const int earliest[] = {1, 0, 2, 0, 0}; + const int latest[] = {4, 6, 6, 0, 1}; + const int durations[] = {3, 1, 1, 2, 4}; + const int demands[] = {3, 3, 1, 2, 1}; + for (int i = 0; i < 5; i++) { + starts[i] = Gecode::IntVar(*this, earliest[i], latest[i]); + processing[i] = durations[i]; + demand[i] = demands[i]; + } + Gecode::cumulative(*this, 3, starts, processing, demand, mandatory, level); } + // NOLINTNEXTLINE(modernize-use-equals-default) + OptionalSubsetFixture(OptionalSubsetFixture& fixture) : Gecode::Space(fixture) {} Gecode::Space* - copy(void) override { - return new Fixture(*this); + copy() override { + return new OptionalSubsetFixture(*this); } }; - class VariableCapacityFixture : public Gecode::Space { - public: - Gecode::IntVarArray starts; - Gecode::IntVar capacity; - VariableCapacityFixture(void) : starts(*this, 5, 0, 6), capacity(*this, 3, 4) { - starts[0] = Gecode::IntVar(*this, 1, 4); - starts[1] = Gecode::IntVar(*this, 0, 6); - starts[2] = Gecode::IntVar(*this, 2, 6); - starts[3] = Gecode::IntVar(*this, 0, 0); - starts[4] = Gecode::IntVar(*this, 0, 1); - Gecode::cumulative(*this, capacity, starts, Gecode::IntArgs({3, 1, 1, 2, 4}), - Gecode::IntArgs({3, 3, 1, 2, 1}), Gecode::IPL_ADVANCED); - } - VariableCapacityFixture(VariableCapacityFixture& fixture) : Gecode::Space(fixture) { - starts.update(*this, fixture.starts); - capacity.update(*this, fixture.capacity); + OptionalSubsetFixture basic(Gecode::IPL_BASIC); + OptionalSubsetFixture advanced(Gecode::IPL_ADVANCED); + return (basic.status() != Gecode::SS_FAILED) && (advanced.status() == Gecode::SS_FAILED); + } + + public: + KnapsackAugmentedOverload() : Test::Base("Cumulative::KnapsackAugmentedOverload") {} + + bool + run() override { + Fixture basic(Gecode::IPL_BASIC); + Fixture advanced(Gecode::IPL_ADVANCED); + return (basic.status() != Gecode::SS_FAILED) && (advanced.status() == Gecode::SS_FAILED) && + variable_capacity_rechecks() && optional_subset(); + } + }; + + KnapsackAugmentedOverload knapsack_augmented_overload; + + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + using namespace Gecode; + IntArgs p1({1, 1, 1, 1}); + IntArgs p2({2, 2, 2, 2}); + IntArgs p3({4, 3, 3, 5}); + IntArgs p4({4, 0, 3, 5}); + IntArgs p5({1, 1, 1}); + + IntArgs u1({1, 1, 1, 1}); + IntArgs u2({2, 2, 2, 2}); + IntArgs u3({2, 3, 4, 5}); + IntArgs u4({2, 3, 0, 5}); + IntArgs u5({1, 3, 2}); + + for (IntPropBasicAdvanced ipba; ipba(); ++ipba) { + // Tasks with no resource usage leave an empty task array. + for (int c : {4, -1}) { + (void)new ManFixPCumulative(c, IntArgs{1}, IntArgs{0}, 0, ipba.ipl()); + (void)new OptFixPCumulative(c, IntArgs{1}, IntArgs{0}, 0, ipba.ipl()); + (void)new ManFlexCumulative(c, 0, 2, IntArgs{0}, 0, ipba.ipl()); + (void)new OptFlexCumulative(c, 0, 2, IntArgs{0}, 0, ipba.ipl()); } - Gecode::Space* - copy(void) override { - return new VariableCapacityFixture(*this); - } - }; - - static bool - variable_capacity_rechecks(void) { - VariableCapacityFixture root; - if (root.status() == Gecode::SS_FAILED) - return false; - std::unique_ptr clone(static_cast(root.clone())); - Gecode::rel(*clone, clone->capacity, Gecode::IRT_EQ, 3); - return clone->status() == Gecode::SS_FAILED; - } - - static bool - optional_subset(void) { - class OptionalSubsetFixture : public Gecode::Space { - public: - OptionalSubsetFixture(Gecode::IntPropLevel level) { - const int n = 69; - Gecode::IntVarArgs starts(n); - Gecode::BoolVarArgs mandatory(n); - Gecode::IntArgs processing(n); - Gecode::IntArgs demand(n); - for (int i = 0; i < n; i++) { - starts[i] = Gecode::IntVar(*this, 2 * i, 2 * i); - mandatory[i] = Gecode::BoolVar(*this, i < 5 ? 1 : 0, 1); - processing[i] = 1; - demand[i] = 2 + (i & 1); - } - const int earliest[] = {1, 0, 2, 0, 0}; - const int latest[] = {4, 6, 6, 0, 1}; - const int durations[] = {3, 1, 1, 2, 4}; - const int demands[] = {3, 3, 1, 2, 1}; - for (int i = 0; i < 5; i++) { - starts[i] = Gecode::IntVar(*this, earliest[i], latest[i]); - processing[i] = durations[i]; - demand[i] = demands[i]; - } - Gecode::cumulative(*this, 3, starts, processing, demand, mandatory, level); - } - // NOLINTNEXTLINE(modernize-use-equals-default) - OptionalSubsetFixture(OptionalSubsetFixture& fixture) : Gecode::Space(fixture) {} - Gecode::Space* - copy(void) override { - return new OptionalSubsetFixture(*this); - } - }; - - OptionalSubsetFixture basic(Gecode::IPL_BASIC); - OptionalSubsetFixture advanced(Gecode::IPL_ADVANCED); - return (basic.status() != Gecode::SS_FAILED) && (advanced.status() == Gecode::SS_FAILED); - } - - public: - KnapsackAugmentedOverload(void) : Test::Base("Cumulative::KnapsackAugmentedOverload") {} - - bool - run(void) override { - Fixture basic(Gecode::IPL_BASIC); - Fixture advanced(Gecode::IPL_ADVANCED); - return (basic.status() != Gecode::SS_FAILED) && (advanced.status() == Gecode::SS_FAILED) && - variable_capacity_rechecks() && optional_subset(); - } - }; - - KnapsackAugmentedOverload knapsack_augmented_overload; - - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - using namespace Gecode; - IntArgs p1({1, 1, 1, 1}); - IntArgs p2({2, 2, 2, 2}); - IntArgs p3({4, 3, 3, 5}); - IntArgs p4({4, 0, 3, 5}); - IntArgs p5({1, 1, 1}); - - IntArgs u1({1, 1, 1, 1}); - IntArgs u2({2, 2, 2, 2}); - IntArgs u3({2, 3, 4, 5}); - IntArgs u4({2, 3, 0, 5}); - IntArgs u5({1, 3, 2}); - - for (IntPropBasicAdvanced ipba; ipba(); ++ipba) { - // Tasks with no resource usage leave an empty task array. - for (int c : {4, -1}) { - (void)new ManFixPCumulative(c, IntArgs{1}, IntArgs{0}, 0, ipba.ipl()); - (void)new OptFixPCumulative(c, IntArgs{1}, IntArgs{0}, 0, ipba.ipl()); - (void)new ManFlexCumulative(c, 0, 2, IntArgs{0}, 0, ipba.ipl()); - (void)new OptFlexCumulative(c, 0, 2, IntArgs{0}, 0, ipba.ipl()); - } - // Regression test: check correct detection of disjunctive case - (void)new ManFixPCumulative(3, p5, u5, 0, ipba.ipl()); - - for (int c = -7; c < 8; c++) { - int off = 0; - for (int coff = 0; coff < 2; coff++) { - (void)new ManFixPCumulative(c, p1, u1, off, ipba.ipl()); - (void)new ManFixPCumulative(c, p1, u2, off, ipba.ipl()); - (void)new ManFixPCumulative(c, p1, u3, off, ipba.ipl()); - (void)new ManFixPCumulative(c, p1, u4, off, ipba.ipl()); - (void)new ManFixPCumulative(c, p2, u1, off, ipba.ipl()); - (void)new ManFixPCumulative(c, p2, u2, off, ipba.ipl()); - (void)new ManFixPCumulative(c, p2, u3, off, ipba.ipl()); - (void)new ManFixPCumulative(c, p2, u4, off, ipba.ipl()); - (void)new ManFixPCumulative(c, p3, u1, off, ipba.ipl()); - (void)new ManFixPCumulative(c, p3, u2, off, ipba.ipl()); - (void)new ManFixPCumulative(c, p3, u3, off, ipba.ipl()); - (void)new ManFixPCumulative(c, p3, u4, off, ipba.ipl()); - (void)new ManFixPCumulative(c, p4, u1, off, ipba.ipl()); - (void)new ManFixPCumulative(c, p4, u2, off, ipba.ipl()); - (void)new ManFixPCumulative(c, p4, u3, off, ipba.ipl()); - (void)new ManFixPCumulative(c, p4, u4, off, ipba.ipl()); - - (void)new ManFlexCumulative(c, 0, 1, u1, off, ipba.ipl()); - (void)new ManFlexCumulative(c, 0, 1, u2, off, ipba.ipl()); - (void)new ManFlexCumulative(c, 0, 1, u3, off, ipba.ipl()); - (void)new ManFlexCumulative(c, 0, 1, u4, off, ipba.ipl()); - (void)new ManFlexCumulative(c, 0, 2, u1, off, ipba.ipl()); - (void)new ManFlexCumulative(c, 0, 2, u2, off, ipba.ipl()); - (void)new ManFlexCumulative(c, 0, 2, u3, off, ipba.ipl()); - (void)new ManFlexCumulative(c, 0, 2, u4, off, ipba.ipl()); - (void)new ManFlexCumulative(c, 3, 5, u1, off, ipba.ipl()); - (void)new ManFlexCumulative(c, 3, 5, u2, off, ipba.ipl()); - (void)new ManFlexCumulative(c, 3, 5, u3, off, ipba.ipl()); - (void)new ManFlexCumulative(c, 3, 5, u4, off, ipba.ipl()); - - (void)new OptFixPCumulative(c, p1, u1, off, ipba.ipl()); - (void)new OptFixPCumulative(c, p1, u2, off, ipba.ipl()); - (void)new OptFixPCumulative(c, p1, u3, off, ipba.ipl()); - (void)new OptFixPCumulative(c, p1, u4, off, ipba.ipl()); - (void)new OptFixPCumulative(c, p2, u1, off, ipba.ipl()); - (void)new OptFixPCumulative(c, p2, u2, off, ipba.ipl()); - (void)new OptFixPCumulative(c, p2, u3, off, ipba.ipl()); - (void)new OptFixPCumulative(c, p2, u4, off, ipba.ipl()); - (void)new OptFixPCumulative(c, p3, u1, off, ipba.ipl()); - (void)new OptFixPCumulative(c, p3, u2, off, ipba.ipl()); - (void)new OptFixPCumulative(c, p3, u3, off, ipba.ipl()); - (void)new OptFixPCumulative(c, p3, u4, off, ipba.ipl()); - (void)new OptFixPCumulative(c, p4, u1, off, ipba.ipl()); - (void)new OptFixPCumulative(c, p4, u2, off, ipba.ipl()); - (void)new OptFixPCumulative(c, p4, u3, off, ipba.ipl()); - (void)new OptFixPCumulative(c, p4, u4, off, ipba.ipl()); - - (void)new OptFlexCumulative(c, 0, 1, u1, off, ipba.ipl()); - (void)new OptFlexCumulative(c, 0, 1, u2, off, ipba.ipl()); - (void)new OptFlexCumulative(c, 0, 1, u3, off, ipba.ipl()); - (void)new OptFlexCumulative(c, 0, 1, u4, off, ipba.ipl()); - (void)new OptFlexCumulative(c, 0, 2, u1, off, ipba.ipl()); - (void)new OptFlexCumulative(c, 0, 2, u2, off, ipba.ipl()); - (void)new OptFlexCumulative(c, 0, 2, u3, off, ipba.ipl()); - (void)new OptFlexCumulative(c, 0, 2, u4, off, ipba.ipl()); - (void)new OptFlexCumulative(c, 3, 5, u1, off, ipba.ipl()); - (void)new OptFlexCumulative(c, 3, 5, u2, off, ipba.ipl()); - (void)new OptFlexCumulative(c, 3, 5, u3, off, ipba.ipl()); - (void)new OptFlexCumulative(c, 3, 5, u4, off, ipba.ipl()); - - off = Gecode::Int::Limits::min; - } + // Regression test: check correct detection of disjunctive case + (void)new ManFixPCumulative(3, p5, u5, 0, ipba.ipl()); + + for (int c = -7; c < 8; c++) { + int off = 0; + for (int coff = 0; coff < 2; coff++) { + (void)new ManFixPCumulative(c, p1, u1, off, ipba.ipl()); + (void)new ManFixPCumulative(c, p1, u2, off, ipba.ipl()); + (void)new ManFixPCumulative(c, p1, u3, off, ipba.ipl()); + (void)new ManFixPCumulative(c, p1, u4, off, ipba.ipl()); + (void)new ManFixPCumulative(c, p2, u1, off, ipba.ipl()); + (void)new ManFixPCumulative(c, p2, u2, off, ipba.ipl()); + (void)new ManFixPCumulative(c, p2, u3, off, ipba.ipl()); + (void)new ManFixPCumulative(c, p2, u4, off, ipba.ipl()); + (void)new ManFixPCumulative(c, p3, u1, off, ipba.ipl()); + (void)new ManFixPCumulative(c, p3, u2, off, ipba.ipl()); + (void)new ManFixPCumulative(c, p3, u3, off, ipba.ipl()); + (void)new ManFixPCumulative(c, p3, u4, off, ipba.ipl()); + (void)new ManFixPCumulative(c, p4, u1, off, ipba.ipl()); + (void)new ManFixPCumulative(c, p4, u2, off, ipba.ipl()); + (void)new ManFixPCumulative(c, p4, u3, off, ipba.ipl()); + (void)new ManFixPCumulative(c, p4, u4, off, ipba.ipl()); + + (void)new ManFlexCumulative(c, 0, 1, u1, off, ipba.ipl()); + (void)new ManFlexCumulative(c, 0, 1, u2, off, ipba.ipl()); + (void)new ManFlexCumulative(c, 0, 1, u3, off, ipba.ipl()); + (void)new ManFlexCumulative(c, 0, 1, u4, off, ipba.ipl()); + (void)new ManFlexCumulative(c, 0, 2, u1, off, ipba.ipl()); + (void)new ManFlexCumulative(c, 0, 2, u2, off, ipba.ipl()); + (void)new ManFlexCumulative(c, 0, 2, u3, off, ipba.ipl()); + (void)new ManFlexCumulative(c, 0, 2, u4, off, ipba.ipl()); + (void)new ManFlexCumulative(c, 3, 5, u1, off, ipba.ipl()); + (void)new ManFlexCumulative(c, 3, 5, u2, off, ipba.ipl()); + (void)new ManFlexCumulative(c, 3, 5, u3, off, ipba.ipl()); + (void)new ManFlexCumulative(c, 3, 5, u4, off, ipba.ipl()); + + (void)new OptFixPCumulative(c, p1, u1, off, ipba.ipl()); + (void)new OptFixPCumulative(c, p1, u2, off, ipba.ipl()); + (void)new OptFixPCumulative(c, p1, u3, off, ipba.ipl()); + (void)new OptFixPCumulative(c, p1, u4, off, ipba.ipl()); + (void)new OptFixPCumulative(c, p2, u1, off, ipba.ipl()); + (void)new OptFixPCumulative(c, p2, u2, off, ipba.ipl()); + (void)new OptFixPCumulative(c, p2, u3, off, ipba.ipl()); + (void)new OptFixPCumulative(c, p2, u4, off, ipba.ipl()); + (void)new OptFixPCumulative(c, p3, u1, off, ipba.ipl()); + (void)new OptFixPCumulative(c, p3, u2, off, ipba.ipl()); + (void)new OptFixPCumulative(c, p3, u3, off, ipba.ipl()); + (void)new OptFixPCumulative(c, p3, u4, off, ipba.ipl()); + (void)new OptFixPCumulative(c, p4, u1, off, ipba.ipl()); + (void)new OptFixPCumulative(c, p4, u2, off, ipba.ipl()); + (void)new OptFixPCumulative(c, p4, u3, off, ipba.ipl()); + (void)new OptFixPCumulative(c, p4, u4, off, ipba.ipl()); + + (void)new OptFlexCumulative(c, 0, 1, u1, off, ipba.ipl()); + (void)new OptFlexCumulative(c, 0, 1, u2, off, ipba.ipl()); + (void)new OptFlexCumulative(c, 0, 1, u3, off, ipba.ipl()); + (void)new OptFlexCumulative(c, 0, 1, u4, off, ipba.ipl()); + (void)new OptFlexCumulative(c, 0, 2, u1, off, ipba.ipl()); + (void)new OptFlexCumulative(c, 0, 2, u2, off, ipba.ipl()); + (void)new OptFlexCumulative(c, 0, 2, u3, off, ipba.ipl()); + (void)new OptFlexCumulative(c, 0, 2, u4, off, ipba.ipl()); + (void)new OptFlexCumulative(c, 3, 5, u1, off, ipba.ipl()); + (void)new OptFlexCumulative(c, 3, 5, u2, off, ipba.ipl()); + (void)new OptFlexCumulative(c, 3, 5, u3, off, ipba.ipl()); + (void)new OptFlexCumulative(c, 3, 5, u4, off, ipba.ipl()); + + off = Gecode::Int::Limits::min; } } } - }; - - Create c; - //@} + } + }; - } // namespace Cumulative -}} // namespace Test::Int + Create c; + //@} +} // namespace Test::Int::Cumulative // STATISTICS: test-int diff --git a/test/int/cumulatives.cpp b/test/int/cumulatives.cpp index c152367a65..3b6bc6ccdc 100644 --- a/test/int/cumulatives.cpp +++ b/test/int/cumulatives.cpp @@ -40,302 +40,292 @@ #include #include -namespace Test { namespace Int { +/// %Tests for scheduling constraints +namespace Test::Int::Cumulatives { - /// %Tests for scheduling constraints - namespace Cumulatives { - - /** - * \defgroup TaskTestIntCumulatives Cumnulatives scheduling constraint - * \ingroup TaskTestInt - */ - //@{ - /** - * \brief Script for generating assignments. - * - * We are only interested in assignments that represent tasks (s_i, - * d_i, e_i, h_i) such that the following hold: - * - The task starts at a positive time and has some extension. - * - The equation s_i + d_i = e_i holds. - * - The tasks are ordered to remove some symmetries, i.e., - * s_i <= s_{i+1} - */ - class Ass : public Gecode::Space { - public: - /// Store task information - Gecode::IntVarArray x; - /// Initialize model for assignments - Ass(int n, const Gecode::IntSet& d) : x(*this, n, d) { - using namespace Gecode; - for (int i = 0; i < n; i += 4) { - rel(*this, x[i + 0] >= 0); - rel(*this, x[i + 1] >= 0); - rel(*this, x[i + 2] >= 0); - rel(*this, x[i] + x[i + 1] == x[i + 2]); - branch(*this, x, INT_VAR_NONE(), INT_VAL_MIN()); - } - } - /// Constructor for cloning \a s - Ass(Ass& s) : Gecode::Space(s) { - x.update(*this, s.x); + /** + * \defgroup TaskTestIntCumulatives Cumnulatives scheduling constraint + * \ingroup TaskTestInt + */ + //@{ + /** + * \brief Script for generating assignments. + * + * We are only interested in assignments that represent tasks (s_i, + * d_i, e_i, h_i) such that the following hold: + * - The task starts at a positive time and has some extension. + * - The equation s_i + d_i = e_i holds. + * - The tasks are ordered to remove some symmetries, i.e., + * s_i <= s_{i+1} + */ + class Ass : public Gecode::Space { + public: + /// Store task information + Gecode::IntVarArray x; + /// Initialize model for assignments + Ass(int n, const Gecode::IntSet& d) : x(*this, n, d) { + using namespace Gecode; + for (int i = 0; i < n; i += 4) { + rel(*this, x[i + 0] >= 0); + rel(*this, x[i + 1] >= 0); + rel(*this, x[i + 2] >= 0); + rel(*this, x[i] + x[i + 1] == x[i + 2]); + branch(*this, x, INT_VAR_NONE(), INT_VAL_MIN()); } - /// Create copy during cloning - Gecode::Space* - copy(void) override { - return new Ass(*this); - } - }; - - /// Class for generating reasonable assignments - class CumulativeAssignment : public Assignment { - /// Current assignment - Ass* cur; - /// Next assignment - Ass* nxt; - /// Search engine to find assignments - Gecode::DFS* e; + } + /// Constructor for cloning \a s + Ass(Ass& s) : Gecode::Space(s) { + x.update(*this, s.x); + } + /// Create copy during cloning + Gecode::Space* + copy() override { + return new Ass(*this); + } + }; - public: - /// Initialize assignments for \a n0 variables and values \a d0 - CumulativeAssignment(int n, const Gecode::IntSet& d) : Assignment(n, d) { - Ass* a = new Ass(n, d); - e = new Gecode::DFS(a); - delete a; - nxt = cur = e->next(); - if (cur != nullptr) - nxt = e->next(); - } - /// %Test whether all assignments have been iterated - bool - has_more(void) const override { - return nxt != nullptr; - } - /// Move to next assignment - void - next(Gecode::Support::RandomGenerator&) override { - delete cur; - cur = nxt; - if (cur != nullptr) - nxt = e->next(); - } - /// Return value for variable \a i - int - operator[](int i) const override { - assert((i >= 0) && (i < n) && (cur != nullptr)); - return cur->x[i].val(); - } - /// Destructor - ~CumulativeAssignment(void) override { - delete cur; - delete nxt; - delete e; - } - }; + /// Class for generating reasonable assignments + class CumulativeAssignment : public Assignment { + /// Current assignment + Ass* cur; + /// Next assignment + Ass* nxt; + /// Search engine to find assignments + Gecode::DFS* e; - /// %Event to be scheduled - class Event { - public: - int p, h; ///< Position and height of event - bool start; ///< Whether event has just started - /// Initialize event - Event(int pos, int height, bool s) : p(pos), h(height), start(s) {} - /// %Test whether this event is before event \a e - bool - operator<(const Event& e) const { - return p < e.p; - } - }; + public: + /// Initialize assignments for \a n0 variables and values \a d0 + CumulativeAssignment(int n, const Gecode::IntSet& d) : Assignment(n, d) { + Ass* a = new Ass(n, d); + e = new Gecode::DFS(a); + delete a; + nxt = cur = e->next(); + if (cur != nullptr) + nxt = e->next(); + } + /// %Test whether all assignments have been iterated + bool + has_more() const override { + return nxt != nullptr; + } + /// Move to next assignment + void + next(Gecode::Support::RandomGenerator&) override { + delete cur; + cur = nxt; + if (cur != nullptr) + nxt = e->next(); + } + /// Return value for variable \a i + int + operator[](int i) const override { + assert((i >= 0) && (i < n) && (cur != nullptr)); + return cur->x[i].val(); + } + /// Destructor + ~CumulativeAssignment() override { + delete cur; + delete nxt; + delete e; + } + }; - /// Describe that event is below a certain limit - class Below { - public: - int limit; ///< limit - /// Initialize - Below(int l) : limit(l) {} - /// %Test whether \a val is below limit - bool - operator()(int val) { - return val <= limit; - } - }; - /// Describe that event is above a certain limit - class Above { - public: - int limit; ///< limit - /// Initialize - Above(int l) : limit(l) {} - /// %Test whether \a val is above limit - bool - operator()(int val) { - return val >= limit; - } - }; + /// %Event to be scheduled + class Event { + public: + int p, h; ///< Position and height of event + bool start; ///< Whether event has just started + /// Initialize event + Event(int pos, int height, bool s) : p(pos), h(height), start(s) {} + }; - /// Check whether event \a e is valid - template + /// Describe that event is below a certain limit + class Below { + public: + int limit; ///< limit + /// Initialize + Below(int l) : limit(l) {} + /// %Test whether \a val is below limit bool - valid(std::vector e, C comp) { - std::sort(e.begin(), e.end()); - unsigned int i = 0; - int p = 0; - int h = 0; - int n = 0; - while (i < e.size()) { - p = e[i].p; - while (i < e.size() && e[i].p == p) { - h += e[i].h; - n += (e[i].start ? +1 : -1); - ++i; - } - if (n && !comp(h)) - return false; + operator()(int val) { + return val <= limit; + } + }; + /// Describe that event is above a certain limit + class Above { + public: + int limit; ///< limit + /// Initialize + Above(int l) : limit(l) {} + /// %Test whether \a val is above limit + bool + operator()(int val) { + return val >= limit; + } + }; + + /// Check whether event \a e is valid + template + static bool + valid(std::vector e, C comp) { + std::ranges::sort(e, {}, &Event::p); + unsigned int i = 0; + int p = 0; + int h = 0; + int n = 0; + while (i < e.size()) { + p = e[i].p; + while (i < e.size() && e[i].p == p) { + h += e[i].h; + n += (e[i].start ? +1 : -1); + ++i; } - return true; + if (n && !comp(h)) + return false; } + return true; + } - /// %Test for cumulatives constraint - class Cumulatives : public Test { - protected: - int ntasks; ///< Number of tasks - bool at_most; ///< Whether to use at_most reasoning - int limit; ///< Limit - public: - /// Create and register test - Cumulatives(const std::string& s, int nt, bool am, int l) - : Test("Cumulatives::" + s, nt * 4, -1, 2), ntasks(nt), at_most(am), limit(l) { - test_search = false; + /// %Test for cumulatives constraint + class Cumulatives : public Test { + protected: + int ntasks; ///< Number of tasks + bool at_most; ///< Whether to use at_most reasoning + int limit; ///< Limit + public: + /// Create and register test + Cumulatives(const std::string& s, int nt, bool am, int l) + : Test("Cumulatives::" + s, nt * 4, -1, 2), ntasks(nt), at_most(am), limit(l) { + test_search = false; + } + /// Create first assignment + Assignment* + assignment() const override { + assert(arity == 4 * ntasks); + return new CumulativeAssignment(arity, dom); + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + std::vector e; + for (int i = 0; i < ntasks; ++i) { + int p = i * 4; + // Positive start, duration and end + if (x[p + 0] < 0 || x[p + 1] < 1 || x[p + 2] < 1) + return false; + // Start + Duration == End + if (x[p + 0] + x[p + 1] != x[p + 2]) { + return false; + } } - /// Create first assignment - Assignment* - assignment(void) const override { - assert(arity == 4 * ntasks); - return new CumulativeAssignment(arity, dom); + for (int i = 0; i < ntasks; ++i) { + int p = i * 4; + // Up at start, down at end. + e.emplace_back(x[p + 0], +x[p + 3], true); + e.emplace_back(x[p + 2], -x[p + 3], false); } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - std::vector e; - for (int i = 0; i < ntasks; ++i) { - int p = i * 4; - // Positive start, duration and end - if (x[p + 0] < 0 || x[p + 1] < 1 || x[p + 2] < 1) - return false; - // Start + Duration == End - if (x[p + 0] + x[p + 1] != x[p + 2]) { - return false; - } - } - for (int i = 0; i < ntasks; ++i) { - int p = i * 4; - // Up at start, down at end. - e.push_back(Event(x[p + 0], +x[p + 3], true)); - e.push_back(Event(x[p + 2], -x[p + 3], false)); - } - if (at_most) { - return valid(e, Below(limit)); - } else { - return valid(e, Above(limit)); - } + if (at_most) { + return valid(e, Below(limit)); } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - IntArgs m(ntasks), l({limit}); - IntVarArgs s(ntasks), d(ntasks), e(ntasks), h(ntasks); - for (int i = 0; i < ntasks; ++i) { - int p = i * 4; - m[i] = 0; - s[i] = x[p + 0]; - rel(home, x[p + 0], Gecode::IRT_GQ, 0); - d[i] = x[p + 1]; - rel(home, x[p + 1], Gecode::IRT_GQ, 1); - e[i] = x[p + 2]; - rel(home, x[p + 2], Gecode::IRT_GQ, 1); - h[i] = x[p + 3]; - } - cumulatives(home, m, s, d, e, h, l, at_most); + return valid(e, Above(limit)); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + IntArgs m(ntasks), l({limit}); + IntVarArgs s(ntasks), d(ntasks), e(ntasks), h(ntasks); + for (int i = 0; i < ntasks; ++i) { + int p = i * 4; + m[i] = 0; + s[i] = x[p + 0]; + rel(home, x[p + 0], Gecode::IRT_GQ, 0); + d[i] = x[p + 1]; + rel(home, x[p + 1], Gecode::IRT_GQ, 1); + e[i] = x[p + 2]; + rel(home, x[p + 2], Gecode::IRT_GQ, 1); + h[i] = x[p + 3]; } - }; - - /// Signed profile contributions must tighten the producer's usage - class ProfileContribution : public Test::Base { - private: - class Fixture : public Gecode::Space { - public: - Gecode::IntVar producer; - Fixture(bool at_most) : producer(*this, at_most ? -10 : 0, at_most ? 0 : 10) { - using namespace Gecode; - const int sign = at_most ? 1 : -1; - IntVarArgs usage({IntVar(*this, 3 * sign, 3 * sign), IntVar(*this, 5 * sign, 5 * sign), producer}); - cumulatives(*this, IntArgs({0, 0, 0}), IntVarArgs(*this, 3, 0, 0), IntVarArgs(*this, 3, 1, 1), - IntVarArgs(*this, 3, 1, 1), usage, IntArgs({0}), at_most); - } - Fixture(Fixture& fixture) : Gecode::Space(fixture) { - producer.update(*this, fixture.producer); - } - Gecode::Space* - copy(void) override { - return new Fixture(*this); - } - }; + cumulatives(home, m, s, d, e, h, l, at_most); + } + }; + /// Signed profile contributions must tighten the producer's usage + class ProfileContribution : public Test::Base { + private: + class Fixture : public Gecode::Space { public: - ProfileContribution(void) : Test::Base("Cumulatives::ProfileContribution", TestTags::check()) {} - bool - run(void) override { - Fixture upper(true), lower(false); - return (upper.status() != Gecode::SS_FAILED) && (lower.status() != Gecode::SS_FAILED) && - (upper.producer.min() == -10) && (upper.producer.max() == -8) && (lower.producer.min() == 8) && - (lower.producer.max() == 10); + Gecode::IntVar producer; + Fixture(bool at_most) : producer(*this, at_most ? -10 : 0, at_most ? 0 : 10) { + using namespace Gecode; + const int sign = at_most ? 1 : -1; + IntVarArgs usage({IntVar(*this, 3 * sign, 3 * sign), IntVar(*this, 5 * sign, 5 * sign), producer}); + cumulatives(*this, IntArgs({0, 0, 0}), IntVarArgs(*this, 3, 0, 0), IntVarArgs(*this, 3, 1, 1), + IntVarArgs(*this, 3, 1, 1), usage, IntArgs({0}), at_most); } - } profile_contribution; - - /// An empty producer must cancel before it can affect another task - class EmptyProfile : public Test { - public: - EmptyProfile(void) : Test(TestTags::check(), "Cumulatives::EmptyProfile", 1, -2, -1) {} - bool - solution(const Assignment&) const override { - return true; + Fixture(Fixture& fixture) : Gecode::Space(fixture) { + producer.update(*this, fixture.producer); } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - cumulatives(home, IntArgs({0, 0}), IntVarArgs(home, 2, 0, 0), - IntVarArgs({IntVar(home, 1, 1), IntVar(home, 0, 0)}), - IntVarArgs({IntVar(home, 1, 1), IntVar(home, 0, 0)}), - IntVarArgs({IntVar(home, 1, 1), x[0]}), IntArgs({1}), true); + Gecode::Space* + copy() override { + return new Fixture(*this); } - } empty_profile; + }; + + public: + ProfileContribution() : Test::Base("Cumulatives::ProfileContribution", TestTags::check()) {} + bool + run() override { + Fixture upper(true), lower(false); + return (upper.status() != Gecode::SS_FAILED) && (lower.status() != Gecode::SS_FAILED) && + (upper.producer.min() == -10) && (upper.producer.max() == -8) && (lower.producer.min() == 8) && + (lower.producer.max() == 10); + } + } profile_contribution; - Cumulatives c1t1("1t1", 1, true, 1); - Cumulatives c1f1("1f1", 1, false, 1); - Cumulatives c1t2("1t2", 1, true, 2); - Cumulatives c1f2("1f2", 1, false, 2); - Cumulatives c1t3("1t3", 1, true, 3); - Cumulatives c1f3("1f3", 1, false, 3); - Cumulatives c2t1("2t1", 2, true, 1); - Cumulatives c2f1("2f1", 2, false, 1); - Cumulatives c2t2("2t2", 2, true, 2); - Cumulatives c2f2("2f2", 2, false, 2); - Cumulatives c2t3("2t3", 2, true, 3); - Cumulatives c2f3("2f3", 2, false, 3); - Cumulatives c3t1("3t1", 3, true, 1); - Cumulatives c3f1("3f1", 3, false, 1); - Cumulatives c3t2("3t2", 3, true, 2); - Cumulatives c3f2("3f2", 3, false, 2); - Cumulatives c3t3("3t3", 3, true, 3); - Cumulatives c3f3("3f3", 3, false, 3); - Cumulatives c3t_1("3t-1", 3, true, -1); - Cumulatives c3f_1("3f-1", 3, false, -1); - Cumulatives c3t_2("3t-2", 3, true, -2); - Cumulatives c3f_2("3f-2", 3, false, -2); - Cumulatives c3t_3("3t-3", 3, true, -3); - Cumulatives c3f_3("3f-3", 3, false, -3); - //@} + /// An empty producer must cancel before it can affect another task + class EmptyProfile : public Test { + public: + EmptyProfile() : Test(TestTags::check(), "Cumulatives::EmptyProfile", 1, -2, -1) {} + bool + solution(const Assignment&) const override { + return true; + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + cumulatives(home, IntArgs({0, 0}), IntVarArgs(home, 2, 0, 0), + IntVarArgs({IntVar(home, 1, 1), IntVar(home, 0, 0)}), + IntVarArgs({IntVar(home, 1, 1), IntVar(home, 0, 0)}), IntVarArgs({IntVar(home, 1, 1), x[0]}), + IntArgs({1}), true); + } + } empty_profile; - } // namespace Cumulatives -}} // namespace Test::Int + Cumulatives c1t1("1t1", 1, true, 1); + Cumulatives c1f1("1f1", 1, false, 1); + Cumulatives c1t2("1t2", 1, true, 2); + Cumulatives c1f2("1f2", 1, false, 2); + Cumulatives c1t3("1t3", 1, true, 3); + Cumulatives c1f3("1f3", 1, false, 3); + Cumulatives c2t1("2t1", 2, true, 1); + Cumulatives c2f1("2f1", 2, false, 1); + Cumulatives c2t2("2t2", 2, true, 2); + Cumulatives c2f2("2f2", 2, false, 2); + Cumulatives c2t3("2t3", 2, true, 3); + Cumulatives c2f3("2f3", 2, false, 3); + Cumulatives c3t1("3t1", 3, true, 1); + Cumulatives c3f1("3f1", 3, false, 1); + Cumulatives c3t2("3t2", 3, true, 2); + Cumulatives c3f2("3f2", 3, false, 2); + Cumulatives c3t3("3t3", 3, true, 3); + Cumulatives c3f3("3f3", 3, false, 3); + Cumulatives c3t_1("3t-1", 3, true, -1); + Cumulatives c3f_1("3f-1", 3, false, -1); + Cumulatives c3t_2("3t-2", 3, true, -2); + Cumulatives c3f_2("3f-2", 3, false, -2); + Cumulatives c3t_3("3t-3", 3, true, -3); + Cumulatives c3f_3("3f-3", 3, false, -3); + //@} +} // namespace Test::Int::Cumulatives // STATISTICS: test-int diff --git a/test/int/distinct.cpp b/test/int/distinct.cpp index 9c68b5938d..5a99295a12 100644 --- a/test/int/distinct.cpp +++ b/test/int/distinct.cpp @@ -35,321 +35,317 @@ #include "test/int.hh" #include -namespace Test { namespace Int { +/// %Tests for distinct constraints +namespace Test::Int::Distinct { - /// %Tests for distinct constraints - namespace Distinct { - - /** - * \defgroup TaskTestIntDistinct Distinct constraints - * \ingroup TaskTestInt - */ - //@{ - /// Simple test for distinct constraint - template - class Distinct : public Test { - public: - /// Create and register test - Distinct(const Gecode::IntSet& d0, Gecode::IntPropLevel ipl, int n = 6) - : Test((useCount || (ipl != Gecode::IPL_VAL)) ? TestTags::sweep() : TestTags::standard(), - std::string(useCount ? "Count::Distinct::" : "Distinct::") + str(ipl) + "::Sparse::" + str(n), n, - d0, false, ipl) {} - /// Create and register test - Distinct(int min, int max, Gecode::IntPropLevel ipl) - : Test((!useCount || (ipl == Gecode::IPL_BND)) ? TestTags::standard() : TestTags::sweep(), - std::string(useCount ? "Count::Distinct::" : "Distinct::") + str(ipl) + "::Dense", 6, min, max, - false, ipl) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - for (int i = 0; i < x.size(); i++) - for (int j = i + 1; j < x.size(); j++) - if (x[i] == x[j]) - return false; - return true; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - if (!useCount) { - Gecode::distinct(home, x, ipl); - } else { - Gecode::IntSetRanges dr(dom); - int i = 0; - Gecode::IntArgs ia(Gecode::Iter::Ranges::size(dr)); - for (Gecode::IntSetValues dr2(dom); dr2(); ++dr2) - ia[i++] = dr2.val(); - Gecode::count(home, x, Gecode::IntSet(0, 1), ia, ipl); - } + /** + * \defgroup TaskTestIntDistinct Distinct constraints + * \ingroup TaskTestInt + */ + //@{ + /// Simple test for distinct constraint + template + class Distinct : public Test { + public: + /// Create and register test + Distinct(const Gecode::IntSet& d0, Gecode::IntPropLevel ipl, int n = 6) + : Test((useCount || (ipl != Gecode::IPL_VAL)) ? TestTags::sweep() : TestTags::standard(), + std::string(useCount ? "Count::Distinct::" : "Distinct::") + str(ipl) + "::Sparse::" + str(n), n, d0, + false, ipl) {} + /// Create and register test + Distinct(int min, int max, Gecode::IntPropLevel ipl) + : Test((!useCount || (ipl == Gecode::IPL_BND)) ? TestTags::standard() : TestTags::sweep(), + std::string(useCount ? "Count::Distinct::" : "Distinct::") + str(ipl) + "::Dense", 6, min, max, + false, ipl) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + for (int i = 0; i < x.size(); i++) + for (int j = i + 1; j < x.size(); j++) + if (x[i] == x[j]) + return false; + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + if (!useCount) { + Gecode::distinct(home, x, ipl); + } else { + Gecode::IntSetRanges dr(dom); + int i = 0; + Gecode::IntArgs ia(Gecode::Iter::Ranges::size(dr)); + for (Gecode::IntSetValues dr2(dom); dr2(); ++dr2) + ia[i++] = dr2.val(); + Gecode::count(home, x, Gecode::IntSet(0, 1), ia, ipl); } - }; + } + }; - /// Simple test for distinct constraint with offsets - class Offset : public Test { - public: - /// Create and register test - Offset(const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test(TestTags::sweep(), "Distinct::Offset::Sparse::" + str(ipl), 6, d, false, ipl) {} - /// Create and register test - Offset(int min, int max, Gecode::IntPropLevel ipl) - : Test(ipl == Gecode::IPL_BND ? TestTags::standard() : TestTags::sweep(), - "Distinct::Offset::Dense::" + str(ipl), 6, min, max, false, ipl) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - for (int i = 0; i < x.size(); i++) - for (int j = i + 1; j < x.size(); j++) - if (x[i] + i == x[j] + j) - return false; - return true; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntArgs c(x.size()); - for (int i = 0; i < x.size(); i++) - c[i] = i; - Gecode::distinct(home, c, x, ipl); - } - }; + /// Simple test for distinct constraint with offsets + class Offset : public Test { + public: + /// Create and register test + Offset(const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test(TestTags::sweep(), "Distinct::Offset::Sparse::" + str(ipl), 6, d, false, ipl) {} + /// Create and register test + Offset(int min, int max, Gecode::IntPropLevel ipl) + : Test(ipl == Gecode::IPL_BND ? TestTags::standard() : TestTags::sweep(), + "Distinct::Offset::Dense::" + str(ipl), 6, min, max, false, ipl) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + for (int i = 0; i < x.size(); i++) + for (int j = i + 1; j < x.size(); j++) + if (x[i] + i == x[j] + j) + return false; + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntArgs c(x.size()); + for (int i = 0; i < x.size(); i++) + c[i] = i; + Gecode::distinct(home, c, x, ipl); + } + }; - /// Simple test for optional distinct constraint - class Optional : public Test { - public: - /// Create and register test - Optional(const Gecode::IntArgs& d, Gecode::IntPropLevel ipl) - : Test("Distinct::Optional::" + str(ipl) + "::" + str(d), 6, Gecode::IntSet(d), false, ipl) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() / 2; - for (int i = 0; i < n; i++) - if ((x[i] < 0) || (x[i] > 1)) + /// Simple test for optional distinct constraint + class Optional : public Test { + public: + /// Create and register test + Optional(const Gecode::IntArgs& d, Gecode::IntPropLevel ipl) + : Test("Distinct::Optional::" + str(ipl) + "::" + str(d), 6, Gecode::IntSet(d), false, ipl) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() / 2; + for (int i = 0; i < n; i++) + if ((x[i] < 0) || (x[i] > 1)) + return false; + for (int i = 0; i < n; i++) + for (int j = i + 1; j < n; j++) + if ((x[i] == 1) && (x[j] == 1) && (x[n + i] == x[n + j])) return false; - for (int i = 0; i < n; i++) - for (int j = i + 1; j < n; j++) - if ((x[i] == 1) && (x[j] == 1) && (x[n + i] == x[n + j])) - return false; - return true; - } - /// Post constraint on \a bx - void - post(Gecode::Space& home, Gecode::IntVarArray& bx) override { - int n = bx.size() / 2; - Gecode::BoolVarArgs b(n); - Gecode::IntVarArgs x(n); - for (int i = 0; i < n; i++) { - b[i] = Gecode::channel(home, bx[i]); - x[i] = bx[n + i]; - } - Gecode::distinct(home, b, x, ipl); + return true; + } + /// Post constraint on \a bx + void + post(Gecode::Space& home, Gecode::IntVarArray& bx) override { + int n = bx.size() / 2; + Gecode::BoolVarArgs b(n); + Gecode::IntVarArgs x(n); + for (int i = 0; i < n; i++) { + b[i] = Gecode::channel(home, bx[i]); + x[i] = bx[n + i]; } - }; + Gecode::distinct(home, b, x, ipl); + } + }; - /// Simple test for distinct except constant constraint - class Except : public Test { - public: - /// Create and register test - Except(const Gecode::IntArgs& d, Gecode::IntPropLevel ipl) - : Test("Distinct::Except::" + str(ipl) + "::" + str(d), 3, Gecode::IntSet(d), false, ipl) { - consistency_test_level = CTL_NONE; - } - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - for (int i = 0; i < x.size(); i++) - for (int j = i + 1; j < x.size(); j++) - if ((x[i] != 0) && (x[j] != 0) && (x[i] == x[j])) - return false; - return true; - } - /// Post constraint on \a bx - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::distinct(home, x, 0, ipl); - } - }; + /// Simple test for distinct except constant constraint + class Except : public Test { + public: + /// Create and register test + Except(const Gecode::IntArgs& d, Gecode::IntPropLevel ipl) + : Test("Distinct::Except::" + str(ipl) + "::" + str(d), 3, Gecode::IntSet(d), false, ipl) { + consistency_test_level = CTL_NONE; + } + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + for (int i = 0; i < x.size(); i++) + for (int j = i + 1; j < x.size(); j++) + if ((x[i] != 0) && (x[j] != 0) && (x[i] == x[j])) + return false; + return true; + } + /// Post constraint on \a bx + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::distinct(home, x, 0, ipl); + } + }; + + /// Randomized test for distinct constraint + class Random : public Test { + public: + /// Create and register test + Random(int n, int min, int max, Gecode::IntPropLevel ipl) + : Test(TestTags::check(), "Distinct::Random::" + str(ipl), n, min, max, false, ipl) { + test_search = false; + } + /// Create and register initial assignment + Assignment* + assignment() const override { + return new RandomAssignment(arity, dom, 100, _rand); + } + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + for (int i = 0; i < x.size(); i++) + for (int j = i + 1; j < x.size(); j++) + if (x[i] == x[j]) + return false; + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::distinct(home, x, ipl); + } + }; - /// Randomized test for distinct constraint - class Random : public Test { + /// %Testing pathological cases + class Pathological : public Base { + protected: + /// Number of variables + int n; + /// Consistency level + Gecode::IntPropLevel ipl; + /// %Test space + class TestSpace : public Gecode::Space { public: - /// Create and register test - Random(int n, int min, int max, Gecode::IntPropLevel ipl) - : Test(TestTags::check(), "Distinct::Random::" + str(ipl), n, min, max, false, ipl) { - test_search = false; - } - /// Create and register initial assignment - Assignment* - assignment(void) const override { - return new RandomAssignment(arity, dom, 100, _rand); - } - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - for (int i = 0; i < x.size(); i++) - for (int j = i + 1; j < x.size(); j++) - if (x[i] == x[j]) - return false; - return true; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::distinct(home, x, ipl); + /// Constructor + TestSpace() = default; + /// Constructor for cloning \a s + // NOLINTNEXTLINE(modernize-use-equals-default) + TestSpace(TestSpace& s) : Gecode::Space(s) {} + /// Copy space during cloning + Gecode::Space* + copy() override { + return new TestSpace(*this); } }; - /// %Testing pathological cases - class Pathological : public Base { - protected: - /// Number of variables - int n; - /// Consistency level - Gecode::IntPropLevel ipl; - /// %Test space - class TestSpace : public Gecode::Space { - public: - /// Constructor - TestSpace(void) = default; - /// Constructor for cloning \a s - // NOLINTNEXTLINE(modernize-use-equals-default) - TestSpace(TestSpace& s) : Gecode::Space(s) {} - /// Copy space during cloning - Gecode::Space* - copy(void) override { - return new TestSpace(*this); + public: + /// Create and register test + Pathological(int n0, Gecode::IntPropLevel ipl0) + : Base("Int::Distinct::Pathological::" + Test::str(n0) + "::" + Test::str(ipl0), TestTags::sweep()), n(n0), + ipl(ipl0) {} + /// Perform test + bool + run() override { + using namespace Gecode; + { + TestSpace* s = new TestSpace; + IntVarArgs x(n); + for (int i = 0; i < n; i++) + x[i] = IntVar(*s, 0, i); + distinct(*s, x, ipl); + if (s->status() == SS_FAILED) { + delete s; + return false; } - }; - - public: - /// Create and register test - Pathological(int n0, Gecode::IntPropLevel ipl0) - : Base("Int::Distinct::Pathological::" + Test::str(n0) + "::" + Test::str(ipl0), TestTags::sweep()), - n(n0), ipl(ipl0) {} - /// Perform test - bool - run(void) override { - using namespace Gecode; - { - TestSpace* s = new TestSpace; - IntVarArgs x(n); - for (int i = 0; i < n; i++) - x[i] = IntVar(*s, 0, i); - distinct(*s, x, ipl); - if (s->status() == SS_FAILED) { + for (int i = 0; i < n; i++) + if (!x[i].assigned() || (x[i].val() != i)) { delete s; return false; } - for (int i = 0; i < n; i++) - if (!x[i].assigned() || (x[i].val() != i)) { - delete s; - return false; - } + delete s; + } + { + TestSpace* s = new TestSpace; + IntVarArgs x(2 * n); + for (int i = 0; i < n; i++) { + int v[] = {0, i}; + IntSet d(v, 2); + x[i] = IntVar(*s, d); + } + for (int i = n; i < 2 * n; i++) + x[i] = IntVar(*s, n - 1, i); + distinct(*s, x, ipl); + if (s->status() == SS_FAILED) { delete s; + return false; } - { - TestSpace* s = new TestSpace; - IntVarArgs x(2 * n); - for (int i = 0; i < n; i++) { - int v[] = {0, i}; - IntSet d(v, 2); - x[i] = IntVar(*s, d); - } - for (int i = n; i < 2 * n; i++) - x[i] = IntVar(*s, n - 1, i); - distinct(*s, x, ipl); - if (s->status() == SS_FAILED) { + for (int i = 0; i < n; i++) + if (!x[i].assigned() || (x[i].val() != i)) { delete s; return false; } - for (int i = 0; i < n; i++) - if (!x[i].assigned() || (x[i].val() != i)) { - delete s; - return false; - } - delete s; - } - return true; + delete s; } - }; - - const int v[7] = {-1001, -1000, -10, 0, 10, 1000, 1001}; - Gecode::IntSet d(v, 7); - const int vl[6] = {Gecode::Int::Limits::min + 0, Gecode::Int::Limits::min + 1, Gecode::Int::Limits::min + 2, - Gecode::Int::Limits::max - 2, Gecode::Int::Limits::max - 1, Gecode::Int::Limits::max - 0}; - Gecode::IntSet dl(vl, 6); + return true; + } + }; - Distinct dom_d(-3, 3, Gecode::IPL_DOM); - Distinct bnd_d(-3, 3, Gecode::IPL_BND); - Distinct val_d(-3, 3, Gecode::IPL_VAL); - Distinct dom_s(d, Gecode::IPL_DOM); - Distinct bnd_s(d, Gecode::IPL_BND); - Distinct val_s(d, Gecode::IPL_VAL); + const int v[7] = {-1001, -1000, -10, 0, 10, 1000, 1001}; + Gecode::IntSet d(v, 7); + const int vl[6] = {Gecode::Int::Limits::min + 0, Gecode::Int::Limits::min + 1, Gecode::Int::Limits::min + 2, + Gecode::Int::Limits::max - 2, Gecode::Int::Limits::max - 1, Gecode::Int::Limits::max - 0}; + Gecode::IntSet dl(vl, 6); - Distinct dom_l(dl, Gecode::IPL_DOM, 5); - Distinct bnd_l(dl, Gecode::IPL_BND, 5); - Distinct val_l(dl, Gecode::IPL_VAL, 5); + Distinct dom_d(-3, 3, Gecode::IPL_DOM); + Distinct bnd_d(-3, 3, Gecode::IPL_BND); + Distinct val_d(-3, 3, Gecode::IPL_VAL); + Distinct dom_s(d, Gecode::IPL_DOM); + Distinct bnd_s(d, Gecode::IPL_BND); + Distinct val_s(d, Gecode::IPL_VAL); - Distinct count_dom_d(-3, 3, Gecode::IPL_DOM); - Distinct count_bnd_d(-3, 3, Gecode::IPL_BND); - Distinct count_val_d(-3, 3, Gecode::IPL_VAL); - Distinct count_dom_s(d, Gecode::IPL_DOM); - Distinct count_bnd_s(d, Gecode::IPL_BND); - Distinct count_val_s(d, Gecode::IPL_VAL); + Distinct dom_l(dl, Gecode::IPL_DOM, 5); + Distinct bnd_l(dl, Gecode::IPL_BND, 5); + Distinct val_l(dl, Gecode::IPL_VAL, 5); - Offset dom_od(-3, 3, Gecode::IPL_DOM); - Offset bnd_od(-3, 3, Gecode::IPL_BND); - Offset val_od(-3, 3, Gecode::IPL_VAL); - Offset dom_os(d, Gecode::IPL_DOM); - Offset bnd_os(d, Gecode::IPL_BND); - Offset val_os(d, Gecode::IPL_VAL); + Distinct count_dom_d(-3, 3, Gecode::IPL_DOM); + Distinct count_bnd_d(-3, 3, Gecode::IPL_BND); + Distinct count_val_d(-3, 3, Gecode::IPL_VAL); + Distinct count_dom_s(d, Gecode::IPL_DOM); + Distinct count_bnd_s(d, Gecode::IPL_BND); + Distinct count_val_s(d, Gecode::IPL_VAL); - Gecode::IntArgs v1({Gecode::Int::Limits::min + 4, 0, 1, Gecode::Int::Limits::max}); - Gecode::IntArgs v2({Gecode::Int::Limits::min, 0, 1, Gecode::Int::Limits::max - 4}); - Gecode::IntArgs v3({0, 1, 2, 3}); - Gecode::IntArgs v4({0, 1, 2}); - Gecode::IntArgs v5({0, 1}); + Offset dom_od(-3, 3, Gecode::IPL_DOM); + Offset bnd_od(-3, 3, Gecode::IPL_BND); + Offset val_od(-3, 3, Gecode::IPL_VAL); + Offset dom_os(d, Gecode::IPL_DOM); + Offset bnd_os(d, Gecode::IPL_BND); + Offset val_os(d, Gecode::IPL_VAL); - Optional od1(v1, Gecode::IPL_DOM); - Optional ob1(v1, Gecode::IPL_BND); - Optional ov1(v1, Gecode::IPL_VAL); - Optional od2(v2, Gecode::IPL_DOM); - Optional ob2(v2, Gecode::IPL_BND); - Optional ov2(v2, Gecode::IPL_VAL); - Optional od3(v3, Gecode::IPL_DOM); - Optional ob3(v3, Gecode::IPL_BND); - Optional ov3(v3, Gecode::IPL_VAL); - Optional od4(v4, Gecode::IPL_DOM); - Optional ob4(v4, Gecode::IPL_BND); - Optional ov4(v4, Gecode::IPL_VAL); - Optional od5(v5, Gecode::IPL_DOM); - Optional ob5(v5, Gecode::IPL_BND); - Optional ov5(v5, Gecode::IPL_VAL); + Gecode::IntArgs v1({Gecode::Int::Limits::min + 4, 0, 1, Gecode::Int::Limits::max}); + Gecode::IntArgs v2({Gecode::Int::Limits::min, 0, 1, Gecode::Int::Limits::max - 4}); + Gecode::IntArgs v3({0, 1, 2, 3}); + Gecode::IntArgs v4({0, 1, 2}); + Gecode::IntArgs v5({0, 1}); - Except ed1(v1, Gecode::IPL_DOM); - Except eb1(v1, Gecode::IPL_BND); - Except ev1(v1, Gecode::IPL_VAL); - Except ed2(v2, Gecode::IPL_DOM); - Except eb2(v2, Gecode::IPL_BND); - Except ev2(v2, Gecode::IPL_VAL); - Except ed5(v5, Gecode::IPL_DOM); - Except eb5(v5, Gecode::IPL_BND); - Except ev5(v5, Gecode::IPL_VAL); + Optional od1(v1, Gecode::IPL_DOM); + Optional ob1(v1, Gecode::IPL_BND); + Optional ov1(v1, Gecode::IPL_VAL); + Optional od2(v2, Gecode::IPL_DOM); + Optional ob2(v2, Gecode::IPL_BND); + Optional ov2(v2, Gecode::IPL_VAL); + Optional od3(v3, Gecode::IPL_DOM); + Optional ob3(v3, Gecode::IPL_BND); + Optional ov3(v3, Gecode::IPL_VAL); + Optional od4(v4, Gecode::IPL_DOM); + Optional ob4(v4, Gecode::IPL_BND); + Optional ov4(v4, Gecode::IPL_VAL); + Optional od5(v5, Gecode::IPL_DOM); + Optional ob5(v5, Gecode::IPL_BND); + Optional ov5(v5, Gecode::IPL_VAL); - Random dom_r(20, -50, 50, Gecode::IPL_DOM); - Random bnd_r(50, -500, 500, Gecode::IPL_BND); - Random val_r(50, -500, 500, Gecode::IPL_VAL); + Except ed1(v1, Gecode::IPL_DOM); + Except eb1(v1, Gecode::IPL_BND); + Except ev1(v1, Gecode::IPL_VAL); + Except ed2(v2, Gecode::IPL_DOM); + Except eb2(v2, Gecode::IPL_BND); + Except ev2(v2, Gecode::IPL_VAL); + Except ed5(v5, Gecode::IPL_DOM); + Except eb5(v5, Gecode::IPL_BND); + Except ev5(v5, Gecode::IPL_VAL); - Pathological p_16_v(16, Gecode::IPL_VAL); - Pathological p_16_b(16, Gecode::IPL_BND); - Pathological p_16_d(16, Gecode::IPL_DOM); + Random dom_r(20, -50, 50, Gecode::IPL_DOM); + Random bnd_r(50, -500, 500, Gecode::IPL_BND); + Random val_r(50, -500, 500, Gecode::IPL_VAL); - Pathological p_32_v(32, Gecode::IPL_VAL); - Pathological p_32_b(32, Gecode::IPL_BND); - Pathological p_32_d(32, Gecode::IPL_DOM); - //@} + Pathological p_16_v(16, Gecode::IPL_VAL); + Pathological p_16_b(16, Gecode::IPL_BND); + Pathological p_16_d(16, Gecode::IPL_DOM); - } // namespace Distinct -}} // namespace Test::Int + Pathological p_32_v(32, Gecode::IPL_VAL); + Pathological p_32_b(32, Gecode::IPL_BND); + Pathological p_32_d(32, Gecode::IPL_DOM); + //@} +} // namespace Test::Int::Distinct // STATISTICS: test-int diff --git a/test/int/dom.cpp b/test/int/dom.cpp index 40141f9fa4..6e74c7e109 100644 --- a/test/int/dom.cpp +++ b/test/int/dom.cpp @@ -34,222 +34,218 @@ #include "test/int.hh" -namespace Test { namespace Int { +/// %Tests for domain constraints +namespace Test::Int::Dom { - /// %Tests for domain constraints - namespace Dom { - - /** - * \defgroup TaskTestIntDom Domain constraints - * \ingroup TaskTestInt - */ - //@{ - /// %Test for domain constraint (integer) - class DomInt : public Test { - public: - /// Create and register test - DomInt(int n) : Test("Dom::Int::" + str(n), n, -4, 4, n == 1, Gecode::IPL_DOM) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - for (int i = x.size(); i--;) - if (x[i] != -2) - return false; - return true; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - if (x.size() == 1) - Gecode::dom(home, x[0], -2); - else - Gecode::dom(home, x, -2); - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - assert(x.size() == 1); - if (_rand(2) != 0) { - Gecode::dom(home, x[0], -2, r); - } else { - switch (r.mode()) { - case Gecode::RM_EQV: - Gecode::rel(home, Gecode::dom(x[0], -2) == r.var()); - break; - case Gecode::RM_IMP: - Gecode::rel(home, Gecode::dom(x[0], -2) << r.var()); - break; - case Gecode::RM_RIMP: - Gecode::rel(home, Gecode::dom(x[0], -2) >> r.var()); - break; - default: - GECODE_NEVER; - } + /** + * \defgroup TaskTestIntDom Domain constraints + * \ingroup TaskTestInt + */ + //@{ + /// %Test for domain constraint (integer) + class DomInt : public Test { + public: + /// Create and register test + DomInt(int n) : Test("Dom::Int::" + str(n), n, -4, 4, n == 1, Gecode::IPL_DOM) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + for (int i = x.size(); i--;) + if (x[i] != -2) + return false; + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + if (x.size() == 1) + Gecode::dom(home, x[0], -2); + else + Gecode::dom(home, x, -2); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + assert(x.size() == 1); + if (_rand(2) != 0) { + Gecode::dom(home, x[0], -2, r); + } else { + switch (r.mode()) { + case Gecode::RM_EQV: + Gecode::rel(home, Gecode::dom(x[0], -2) == r.var()); + break; + case Gecode::RM_IMP: + Gecode::rel(home, Gecode::dom(x[0], -2) << r.var()); + break; + case Gecode::RM_RIMP: + Gecode::rel(home, Gecode::dom(x[0], -2) >> r.var()); + break; + default: + GECODE_NEVER; } } - }; + } + }; - /// %Test for domain constraint (range) - class DomRange : public Test { - public: - /// Create and register test - DomRange(int n) : Test("Dom::Range::" + str(n), n, -4, 4, n == 1, Gecode::IPL_DOM) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - for (int i = x.size(); i--;) - if ((x[i] < -2) || (x[i] > 2)) - return false; - return true; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - if (x.size() == 1) - Gecode::dom(home, x[0], -2, 2); - else - Gecode::dom(home, x, -2, 2); - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - assert(x.size() == 1); - if (_rand(2) != 0) { - Gecode::dom(home, x[0], -2, 2, r); - } else { - switch (r.mode()) { - case Gecode::RM_EQV: - Gecode::rel(home, Gecode::dom(x[0], -2, 2) == r.var()); - break; - case Gecode::RM_IMP: - Gecode::rel(home, Gecode::dom(x[0], -2, 2) << r.var()); - break; - case Gecode::RM_RIMP: - Gecode::rel(home, Gecode::dom(x[0], -2, 2) >> r.var()); - break; - default: - GECODE_NEVER; - } + /// %Test for domain constraint (range) + class DomRange : public Test { + public: + /// Create and register test + DomRange(int n) : Test("Dom::Range::" + str(n), n, -4, 4, n == 1, Gecode::IPL_DOM) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + for (int i = x.size(); i--;) + if ((x[i] < -2) || (x[i] > 2)) + return false; + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + if (x.size() == 1) + Gecode::dom(home, x[0], -2, 2); + else + Gecode::dom(home, x, -2, 2); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + assert(x.size() == 1); + if (_rand(2) != 0) { + Gecode::dom(home, x[0], -2, 2, r); + } else { + switch (r.mode()) { + case Gecode::RM_EQV: + Gecode::rel(home, Gecode::dom(x[0], -2, 2) == r.var()); + break; + case Gecode::RM_IMP: + Gecode::rel(home, Gecode::dom(x[0], -2, 2) << r.var()); + break; + case Gecode::RM_RIMP: + Gecode::rel(home, Gecode::dom(x[0], -2, 2) >> r.var()); + break; + default: + GECODE_NEVER; } } - }; + } + }; - /// %Test for domain constraint (empty range) - class DomRangeEmpty : public Test { - public: - /// Create and register test - DomRangeEmpty(void) : Test("Dom::Range::Empty", 1, -4, 4, true) {} - /// %Test whether \a x is solution - bool - solution(const Assignment&) const override { - return false; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray&) override { - home.fail(); - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::dom(home, x[0], 3, 2, r); - } - }; + /// %Test for domain constraint (empty range) + class DomRangeEmpty : public Test { + public: + /// Create and register test + DomRangeEmpty() : Test("Dom::Range::Empty", 1, -4, 4, true) {} + /// %Test whether \a x is solution + bool + solution(const Assignment&) const override { + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray&) override { + home.fail(); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::dom(home, x[0], 3, 2, r); + } + }; - /// %Test for domain constraint (set from an empty initializer list) - class DomDomEmpty : public Test { - /// Whether the list holds ranges rather than values - bool ranges; - /// Return the empty set built from an empty list - Gecode::IntSet - empty_set(void) const { - if (ranges) - return Gecode::IntSet(std::initializer_list>{}); - return Gecode::IntSet(std::initializer_list{}); - } + /// %Test for domain constraint (set from an empty initializer list) + class DomDomEmpty : public Test { + /// Whether the list holds ranges rather than values + bool ranges; + /// Return the empty set built from an empty list + Gecode::IntSet + empty_set() const { + if (ranges) + return Gecode::IntSet(std::initializer_list>{}); + return Gecode::IntSet(std::initializer_list{}); + } - public: - /// Create and register test - DomDomEmpty(bool r) - : Test(std::string("Dom::Dom::Empty::") + (r ? "Ranges" : "Values"), 1, -4, 4, true), ranges(r) {} - /// %Test whether \a x is solution - bool - solution(const Assignment&) const override { - return false; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::dom(home, x[0], empty_set()); - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::dom(home, x[0], empty_set(), r); - } - }; + public: + /// Create and register test + DomDomEmpty(bool r) + : Test(std::string("Dom::Dom::Empty::") + (r ? "Ranges" : "Values"), 1, -4, 4, true), ranges(r) {} + /// %Test whether \a x is solution + bool + solution(const Assignment&) const override { + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::dom(home, x[0], empty_set()); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::dom(home, x[0], empty_set(), r); + } + }; - const int r[4][2] = {{-4, -3}, {-1, -1}, {1, 1}, {3, 5}}; - Gecode::IntSet d(r, 4); + const int r[4][2] = {{-4, -3}, {-1, -1}, {1, 1}, {3, 5}}; + Gecode::IntSet d(r, 4); - /// %Test for domain constraint (full integer set) - class DomDom : public Test { - public: - /// Create and register test - DomDom(int n) : Test("Dom::Dom::" + str(n), n, -6, 6, n == 1, Gecode::IPL_DOM) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - for (int i = x.size(); i--;) - if (!(((x[i] >= -4) && (x[i] <= -3)) || ((x[i] >= -1) && (x[i] <= -1)) || - ((x[i] >= 1) && (x[i] <= 1)) || ((x[i] >= 3) && (x[i] <= 5)))) - return false; - return true; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - if (x.size() == 1) - Gecode::dom(home, x[0], d); - else - Gecode::dom(home, x, d); - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - assert(x.size() == 1); - if (_rand(2) != 0) { - Gecode::dom(home, x[0], d, r); - } else { - switch (r.mode()) { - case Gecode::RM_EQV: - Gecode::rel(home, Gecode::dom(x[0], d) == r.var()); - break; - case Gecode::RM_IMP: - Gecode::rel(home, Gecode::dom(x[0], d) << r.var()); - break; - case Gecode::RM_RIMP: - Gecode::rel(home, Gecode::dom(x[0], d) >> r.var()); - break; - default: - GECODE_NEVER; - } + /// %Test for domain constraint (full integer set) + class DomDom : public Test { + public: + /// Create and register test + DomDom(int n) : Test("Dom::Dom::" + str(n), n, -6, 6, n == 1, Gecode::IPL_DOM) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + for (int i = x.size(); i--;) + if (!(((x[i] >= -4) && (x[i] <= -3)) || ((x[i] >= -1) && (x[i] <= -1)) || + ((x[i] >= 1) && (x[i] <= 1)) || ((x[i] >= 3) && (x[i] <= 5)))) + return false; + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + if (x.size() == 1) + Gecode::dom(home, x[0], d); + else + Gecode::dom(home, x, d); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + assert(x.size() == 1); + if (_rand(2) != 0) { + Gecode::dom(home, x[0], d, r); + } else { + switch (r.mode()) { + case Gecode::RM_EQV: + Gecode::rel(home, Gecode::dom(x[0], d) == r.var()); + break; + case Gecode::RM_IMP: + Gecode::rel(home, Gecode::dom(x[0], d) << r.var()); + break; + case Gecode::RM_RIMP: + Gecode::rel(home, Gecode::dom(x[0], d) >> r.var()); + break; + default: + GECODE_NEVER; } } - }; - - DomInt di1(1); - DomInt di3(3); - DomRange dr1(1); - DomRange dr3(3); - DomDom dd1(1); - DomDom dd3(3); - DomRangeEmpty dre; - DomDomEmpty dde_values(false); - DomDomEmpty dde_ranges(true); - //@} + } + }; - } // namespace Dom -}} // namespace Test::Int + DomInt di1(1); + DomInt di3(3); + DomRange dr1(1); + DomRange dr3(3); + DomDom dd1(1); + DomDom dd3(3); + DomRangeEmpty dre; + DomDomEmpty dde_values(false); + DomDomEmpty dde_ranges(true); + //@} +} // namespace Test::Int::Dom // STATISTICS: test-int diff --git a/test/int/element.cpp b/test/int/element.cpp index 7393973df6..6871142aff 100644 --- a/test/int/element.cpp +++ b/test/int/element.cpp @@ -35,704 +35,697 @@ #include #include -namespace Test { namespace Int { - - /// %Tests for element constraints - namespace Element { - - /** - * \defgroup TaskTestIntElement Element constraints - * \ingroup TaskTestInt - */ - //@{ - /// %Test for element with integer array and integer variables - class IntIntVar : public Test { - protected: - /// Array of integers - Gecode::IntArgs c; - - public: - /// Create and register test - IntIntVar(const std::string& s, const Gecode::IntArgs& c0, int min, int max) - : Test("Element::Int::Int::Var::" + s, 2, min, max), c(c0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return (x[0] >= 0) && (x[0] < c.size()) && c[x[0]] == x[1]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::element(home, c, x[0], x[1]); - } - }; - - /// %Test for element with integer array and integer variables - class IntIntInt : public Test { - protected: - /// Array of integers - Gecode::IntArgs c; - /// Integer result - int r; - - public: - /// Create and register test - IntIntInt(const std::string& s, const Gecode::IntArgs& c0, int r0) - : Test("Element::Int::Int::Int::" + s + "::" + str(r0), 1, -4, 8), c(c0), r(r0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return (x[0] >= 0) && (x[0] < c.size()) && c[x[0]] == r; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::element(home, c, x[0], r); - } - }; - - /// %Test for element with integer array and single shared integer variable - class IntIntShared : public Test { - protected: - /// Array of integers - Gecode::IntArgs c; - - public: - /// Create and register test - IntIntShared(const std::string& s, const Gecode::IntArgs& c0, int min_domain = -4) - : Test("Element::Int::Int::Shared::" + s, 1, min_domain, 8), c(c0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return (x[0] >= 0) && (x[0] < c.size()) && c[x[0]] == x[0]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::element(home, c, x[0], x[0]); - } - }; - - /// %Test for element with integer array and integer and Boolean variable - class IntBoolVar : public Test { - protected: - /// Array of integers - Gecode::IntArgs c; - - public: - /// Create and register test - IntBoolVar(const std::string& s, const Gecode::IntArgs& c0) - : Test("Element::Int::Bool::Var::" + s, 2, -4, 8), c(c0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return (x[0] >= 0) && (x[0] < c.size()) && c[x[0]] == x[1]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::element(home, c, x[0], Gecode::channel(home, x[1])); - } - }; - - /// %Test for element with integer array and integer and Boolean variable - class IntBoolInt : public Test { - protected: - /// Array of integers - Gecode::IntArgs c; - /// Integer result - int r; - - public: - /// Create and register test - IntBoolInt(const std::string& s, const Gecode::IntArgs& c0, int r0) - : Test("Element::Int::Bool::Int::" + s + "::" + str(r0), 1, -4, 8), c(c0), r(r0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return (x[0] >= 0) && (x[0] < c.size()) && c[x[0]] == r; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::element(home, c, x[0], r); - } - }; - - /// %Test for element with variable array and integer variables - class VarIntVar : public Test { - public: - /// Create and register test - VarIntVar(Gecode::IntPropLevel ipl) : Test("Element::Var::Int::Var::" + str(ipl), 6, -1, 3, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return (x[0] >= 0) && (x[0] < x.size() - 2) && x[2 + x[0]] == x[1]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs c(x.size() - 2); - for (int i = 0; i < x.size() - 2; i++) - c[i] = x[2 + i]; - Gecode::element(home, c, x[0], x[1], ipl); - } - }; - - /// %Test for element with variable array and integer variables - class VarIntInt : public Test { - protected: - /// Integer result - int r; - - public: - /// Create and register test - VarIntInt(Gecode::IntPropLevel ipl, int r0) - : Test("Element::Var::Int::Int::" + str(ipl) + "::" + str(r0), 5, -1, 3, false, ipl), r(r0) { - consistency_test_level = CTL_NONE; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return (x[0] >= 0) && (x[0] < x.size() - 1) && x[1 + x[0]] == r; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs c(x.size() - 1); - for (int i = 0; i < x.size() - 1; i++) - c[i] = x[1 + i]; - Gecode::element(home, c, x[0], r, ipl); - } - }; - - /// %Test for element with variable array and shared integer variable - class VarIntShared : public Test { - public: - /// Create and register test - VarIntShared(Gecode::IntPropLevel ipl) - : Test("Element::Var::Int::Shared::" + str(ipl), 5, -1, 3, false, ipl) { - consistency_test_level = CTL_NONE; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return (x[0] >= 0) && (x[0] < x.size() - 1) && x[1 + x[0]] == x[0]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs c(x.size() - 1); - for (int i = 0; i < x.size() - 1; i++) - c[i] = x[1 + i]; - Gecode::element(home, c, x[0], x[0], ipl); - } - }; - - /// %Test for element with Boolean variable array and integer variable - class VarBoolVar : public Test { - public: - /// Create and register test - VarBoolVar(void) : Test("Element::Var::Bool::Var", 6, -1, 3, false) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - for (int i = 0; i < x.size() - 2; i++) - if ((x[2 + i] < 0) || (x[2 + i] > 1)) - return false; - return ((x[0] >= 0) && (x[0] < x.size() - 2) && x[2 + x[0]] == x[1] && (x[1] >= 0) && (x[1] <= 1)); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - BoolVarArgs c(x.size() - 2); - for (int i = 0; i < x.size() - 2; i++) - c[i] = channel(home, x[2 + i]); - element(home, c, x[0], channel(home, x[1])); - } - }; - - /// %Test for element with Boolean variable array and integer variable - class VarBoolInt : public Test { - protected: - /// Integer result - int r; - - public: - /// Create and register test - VarBoolInt(int r0) : Test("Element::Var::Bool::Int::" + str(r0), 5, -1, 3, false), r(r0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - for (int i = 0; i < x.size() - 1; i++) - if ((x[1 + i] < 0) || (x[1 + i] > 1)) - return false; - return ((x[0] >= 0) && (x[0] < x.size() - 1) && x[1 + x[0]] == r); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - BoolVarArgs c(x.size() - 1); - for (int i = 0; i < x.size() - 1; i++) - c[i] = channel(home, x[1 + i]); - if (r == 1) { - switch (_rand(3)) { - case 0: - element(home, c, x[0], 1); - break; - case 1: { - BoolVar one(home, 1, 1); - rel(home, element(c, x[0]) == one); - } break; - case 2: - rel(home, element(c, x[0])); - break; - default: - GECODE_NEVER; - } - } else { - element(home, c, x[0], r); - } - } - }; - - /// %Test for matrix element with integer array and integer variable - class MatrixIntIntVarXY : public Test { - protected: - /// Array for test matrix - Gecode::IntArgs tm; - - public: - /// Create and register test - MatrixIntIntVarXY(void) - : Test("Element::Matrix::Int::IntVar::XY", 3, 0, 5, false), tm({0, 1, 2, 3, 4, 5}) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - // x-coordinate: x[0], y-coordinate: x[1], result: x[2] - using namespace Gecode; - if ((x[0] > 2) || (x[1] > 1)) - return false; - Matrix m(tm, 3, 2); - return m(x[0], x[1]) == x[2]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - // x-coordinate: x[0], y-coordinate: x[1], result: x[2] - using namespace Gecode; - Matrix m(tm, 3, 2); - element(home, m, x[0], x[1], x[2]); - } - }; - - /// %Test for matrix element with integer array and integer variable - class MatrixIntIntVarXX : public Test { - protected: - /// Array for test matrix - Gecode::IntArgs tm; - - public: - /// Create and register test - MatrixIntIntVarXX(void) : Test("Element::Matrix::Int::IntVar::XX", 2, 0, 3, false), tm({0, 1, 2, 3}) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - // x-coordinate: x[0], y-coordinate: x[0], result: x[1] - using namespace Gecode; - if (x[0] > 1) - return false; - Matrix m(tm, 2, 2); - return m(x[0], x[0]) == x[1]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - // x-coordinate: x[0], y-coordinate: x[0], result: x[1] - using namespace Gecode; - Matrix m(tm, 2, 2); - element(home, m, x[0], x[0], x[1]); - } - }; - - /// %Test for matrix element with integer array and Boolean variable - class MatrixIntBoolVarXY : public Test { - protected: - /// Array for test matrix - Gecode::IntArgs tm; - - public: - /// Create and register test - MatrixIntBoolVarXY(void) : Test("Element::Matrix::Int::BoolVar::XY", 3, 0, 3, false), tm({0, 1, 1, 0}) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - // x-coordinate: x[0], y-coordinate: x[1], result: x[2] - using namespace Gecode; - if ((x[0] > 1) || (x[1] > 1)) - return false; - Matrix m(tm, 2, 2); - return m(x[0], x[1]) == x[2]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - // x-coordinate: x[0], y-coordinate: x[1], result: x[2] - using namespace Gecode; - Matrix m(tm, 2, 2); - element(home, m, x[0], x[1], channel(home, x[2])); - } - }; - - /// %Test for matrix element with integer array and Boolean variable - class MatrixIntBoolVarXX : public Test { - protected: - /// Array for test matrix - Gecode::IntArgs tm; - - public: - /// Create and register test - MatrixIntBoolVarXX(void) : Test("Element::Matrix::Int::BoolVar::XX", 2, 0, 3, false), tm({0, 1, 1, 0}) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - // x-coordinate: x[0], y-coordinate: x[0], result: x[1] - using namespace Gecode; - if (x[0] > 1) - return false; - Matrix m(tm, 2, 2); - return m(x[0], x[0]) == x[1]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - // x-coordinate: x[0], y-coordinate: x[0], result: x[1] - using namespace Gecode; - Matrix m(tm, 2, 2); - element(home, m, x[0], x[0], channel(home, x[1])); - } - }; - - /// %Test for matrix element with integer variable array and integer variable - class MatrixIntVarIntVarXY : public Test { - public: - /// Create and register test - MatrixIntVarIntVarXY(void) : Test("Element::Matrix::IntVar::IntVar::XY", 3 + 4, 0, 3, false) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - // x-coordinate: x[0], y-coordinate: x[1], result: x[2] - // remaining: matrix - using namespace Gecode; - if ((x[0] > 1) || (x[1] > 1)) +/// %Tests for element constraints +namespace Test::Int::Element { + + /** + * \defgroup TaskTestIntElement Element constraints + * \ingroup TaskTestInt + */ + //@{ + /// %Test for element with integer array and integer variables + class IntIntVar : public Test { + protected: + /// Array of integers + Gecode::IntArgs c; + + public: + /// Create and register test + IntIntVar(const std::string& s, const Gecode::IntArgs& c0, int min, int max) + : Test("Element::Int::Int::Var::" + s, 2, min, max), c(c0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return (x[0] >= 0) && (x[0] < c.size()) && c[x[0]] == x[1]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::element(home, c, x[0], x[1]); + } + }; + + /// %Test for element with integer array and integer variables + class IntIntInt : public Test { + protected: + /// Array of integers + Gecode::IntArgs c; + /// Integer result + int r; + + public: + /// Create and register test + IntIntInt(const std::string& s, const Gecode::IntArgs& c0, int r0) + : Test("Element::Int::Int::Int::" + s + "::" + str(r0), 1, -4, 8), c(c0), r(r0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return (x[0] >= 0) && (x[0] < c.size()) && c[x[0]] == r; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::element(home, c, x[0], r); + } + }; + + /// %Test for element with integer array and single shared integer variable + class IntIntShared : public Test { + protected: + /// Array of integers + Gecode::IntArgs c; + + public: + /// Create and register test + IntIntShared(const std::string& s, const Gecode::IntArgs& c0, int min_domain = -4) + : Test("Element::Int::Int::Shared::" + s, 1, min_domain, 8), c(c0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return (x[0] >= 0) && (x[0] < c.size()) && c[x[0]] == x[0]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::element(home, c, x[0], x[0]); + } + }; + + /// %Test for element with integer array and integer and Boolean variable + class IntBoolVar : public Test { + protected: + /// Array of integers + Gecode::IntArgs c; + + public: + /// Create and register test + IntBoolVar(const std::string& s, const Gecode::IntArgs& c0) + : Test("Element::Int::Bool::Var::" + s, 2, -4, 8), c(c0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return (x[0] >= 0) && (x[0] < c.size()) && c[x[0]] == x[1]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::element(home, c, x[0], Gecode::channel(home, x[1])); + } + }; + + /// %Test for element with integer array and integer and Boolean variable + class IntBoolInt : public Test { + protected: + /// Array of integers + Gecode::IntArgs c; + /// Integer result + int r; + + public: + /// Create and register test + IntBoolInt(const std::string& s, const Gecode::IntArgs& c0, int r0) + : Test("Element::Int::Bool::Int::" + s + "::" + str(r0), 1, -4, 8), c(c0), r(r0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return (x[0] >= 0) && (x[0] < c.size()) && c[x[0]] == r; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::element(home, c, x[0], r); + } + }; + + /// %Test for element with variable array and integer variables + class VarIntVar : public Test { + public: + /// Create and register test + VarIntVar(Gecode::IntPropLevel ipl) : Test("Element::Var::Int::Var::" + str(ipl), 6, -1, 3, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return (x[0] >= 0) && (x[0] < x.size() - 2) && x[2 + x[0]] == x[1]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs c(x.size() - 2); + for (int i = 0; i < x.size() - 2; i++) + c[i] = x[2 + i]; + Gecode::element(home, c, x[0], x[1], ipl); + } + }; + + /// %Test for element with variable array and integer variables + class VarIntInt : public Test { + protected: + /// Integer result + int r; + + public: + /// Create and register test + VarIntInt(Gecode::IntPropLevel ipl, int r0) + : Test("Element::Var::Int::Int::" + str(ipl) + "::" + str(r0), 5, -1, 3, false, ipl), r(r0) { + consistency_test_level = CTL_NONE; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return (x[0] >= 0) && (x[0] < x.size() - 1) && x[1 + x[0]] == r; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs c(x.size() - 1); + for (int i = 0; i < x.size() - 1; i++) + c[i] = x[1 + i]; + Gecode::element(home, c, x[0], r, ipl); + } + }; + + /// %Test for element with variable array and shared integer variable + class VarIntShared : public Test { + public: + /// Create and register test + VarIntShared(Gecode::IntPropLevel ipl) : Test("Element::Var::Int::Shared::" + str(ipl), 5, -1, 3, false, ipl) { + consistency_test_level = CTL_NONE; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return (x[0] >= 0) && (x[0] < x.size() - 1) && x[1 + x[0]] == x[0]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs c(x.size() - 1); + for (int i = 0; i < x.size() - 1; i++) + c[i] = x[1 + i]; + Gecode::element(home, c, x[0], x[0], ipl); + } + }; + + /// %Test for element with Boolean variable array and integer variable + class VarBoolVar : public Test { + public: + /// Create and register test + VarBoolVar() : Test("Element::Var::Bool::Var", 6, -1, 3, false) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + for (int i = 0; i < x.size() - 2; i++) + if ((x[2 + i] < 0) || (x[2 + i] > 1)) return false; - IntArgs tm(4); - tm[0] = x[3]; - tm[1] = x[4]; - tm[2] = x[5]; - tm[3] = x[6]; - Matrix m(tm, 2, 2); - return m(x[0], x[1]) == x[2]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - // x-coordinate: x[0], y-coordinate: x[1], result: x[2] - using namespace Gecode; - IntVarArgs tm(4); - tm[0] = x[3]; - tm[1] = x[4]; - tm[2] = x[5]; - tm[3] = x[6]; - Matrix m(tm, 2, 2); - element(home, m, x[0], x[1], x[2]); - } - }; - - /// %Test for matrix element with integer variable array and integer variable - class MatrixIntVarIntVarXX : public Test { - public: - /// Create and register test - MatrixIntVarIntVarXX(void) : Test("Element::Matrix::IntVar::IntVar::XX", 2 + 4, 0, 3, false) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - // x-coordinate: x[0], y-coordinate: x[0], result: x[1] - // remaining: matrix - using namespace Gecode; - if (x[0] > 1) + return ((x[0] >= 0) && (x[0] < x.size() - 2) && x[2 + x[0]] == x[1] && (x[1] >= 0) && (x[1] <= 1)); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + BoolVarArgs c(x.size() - 2); + for (int i = 0; i < x.size() - 2; i++) + c[i] = channel(home, x[2 + i]); + element(home, c, x[0], channel(home, x[1])); + } + }; + + /// %Test for element with Boolean variable array and integer variable + class VarBoolInt : public Test { + protected: + /// Integer result + int r; + + public: + /// Create and register test + VarBoolInt(int r0) : Test("Element::Var::Bool::Int::" + str(r0), 5, -1, 3, false), r(r0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + for (int i = 0; i < x.size() - 1; i++) + if ((x[1 + i] < 0) || (x[1 + i] > 1)) return false; - IntArgs tm(4); - tm[0] = x[2]; - tm[1] = x[3]; - tm[2] = x[4]; - tm[3] = x[5]; - Matrix m(tm, 2, 2); - return m(x[0], x[0]) == x[1]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - // x-coordinate: x[0], y-coordinate: x[1], result: x[1] - using namespace Gecode; - IntVarArgs tm(4); - tm[0] = x[2]; - tm[1] = x[3]; - tm[2] = x[4]; - tm[3] = x[5]; - Matrix m(tm, 2, 2); - element(home, m, x[0], x[0], x[1]); - } - }; - - /// %Test for matrix element with Boolean variable array and Boolean variable - class MatrixBoolVarBoolVarXY : public Test { - public: - /// Create and register test - MatrixBoolVarBoolVarXY(void) : Test("Element::Matrix::BoolVar::BoolVar::XY", 3 + 4, 0, 1, false) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - // x-coordinate: x[0], y-coordinate: x[1], result: x[2] - // remaining: matrix - using namespace Gecode; - IntArgs tm(4); - tm[0] = x[3]; - tm[1] = x[4]; - tm[2] = x[5]; - tm[3] = x[6]; - Matrix m(tm, 2, 2); - return m(x[0], x[1]) == x[2]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - // x-coordinate: x[0], y-coordinate: x[1], result: x[2] - using namespace Gecode; - BoolVarArgs tm(4); - tm[0] = channel(home, x[3]); - tm[1] = channel(home, x[4]); - tm[2] = channel(home, x[5]); - tm[3] = channel(home, x[6]); - Matrix m(tm, 2, 2); - element(home, m, x[0], x[1], channel(home, x[2])); - } - }; - - /// %Test for matrix element with Boolean variable array and Boolean variable - class MatrixBoolVarBoolVarXX : public Test { - public: - /// Create and register test - MatrixBoolVarBoolVarXX(void) : Test("Element::Matrix::BoolVar::BoolVar::XX", 2 + 4, 0, 1, false) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - // x-coordinate: x[0], y-coordinate: x[0], result: x[1] - // remaining: matrix - using namespace Gecode; - IntArgs tm(4); - tm[0] = x[2]; - tm[1] = x[3]; - tm[2] = x[4]; - tm[3] = x[5]; - Matrix m(tm, 2, 2); - return m(x[0], x[0]) == x[1]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - // x-coordinate: x[0], y-coordinate: x[1], result: x[1] - using namespace Gecode; - BoolVarArgs tm(4); - tm[0] = channel(home, x[2]); - tm[1] = channel(home, x[3]); - tm[2] = channel(home, x[4]); - tm[3] = channel(home, x[5]); - Matrix m(tm, 2, 2); - element(home, m, x[0], x[0], channel(home, x[1])); - } - }; - - /// Help class to create and register tests - class Create { - public: - /// %Test size-dependent optimizations - void - optimized(int idx, int val) { - Gecode::IntArgs c(idx); - for (int i = 0; i < idx; i++) - c[i] = std::max(val - i, 0); - (void)new IntIntVar(Test::str(idx) + "::" + Test::str(val) + "::val", c, val - 8, val - 1); - if (idx != val) - (void)new IntIntVar(Test::str(idx) + "::" + Test::str(val) + "::idx", c, idx - 8, idx - 1); - } - /// Perform creation and registration - Create(void) { - using namespace Gecode; - IntArgs ic1({-1, 1, -3, 3, -4}); - IntArgs ic2({-1, 1, -1, 1, -1, 1, 0, 0}); - IntArgs ic3({-1}); - IntArgs ic4({0, -1, 2, -2, 4, -3, 6}); - IntArgs ic5({0, 0, 1, 2, 3, 4}); - - IntArgs bc1({0, 1, 1, 0, 1}); - IntArgs bc2({1, 1, 0, 1, 0, 1, 0, 0}); - IntArgs bc3({1}); - - (void)new IntIntVar("A", ic1, -8, 8); - (void)new IntIntVar("B", ic2, -8, 8); - (void)new IntIntVar("C", ic3, -8, 8); - (void)new IntIntVar("D", ic4, -8, 8); - - // Test optimizations - { - int ov[] = {SCHAR_MAX - 1, SCHAR_MAX, SHRT_MAX - 1, SHRT_MAX, 0}; - for (int i = 0; ov[i] != 0; i++) - for (int j = 0; ov[j] != 0; j++) - optimized(ov[i], ov[j]); - } - - for (int i = -4; i <= 4; i++) { - (void)new IntIntInt("A", ic1, i); - (void)new IntIntInt("B", ic2, i); - (void)new IntIntInt("C", ic3, i); - (void)new IntIntInt("D", ic4, i); + return ((x[0] >= 0) && (x[0] < x.size() - 1) && x[1 + x[0]] == r); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + BoolVarArgs c(x.size() - 1); + for (int i = 0; i < x.size() - 1; i++) + c[i] = channel(home, x[1 + i]); + if (r == 1) { + switch (_rand(3)) { + case 0: + element(home, c, x[0], 1); + break; + case 1: { + BoolVar one(home, 1, 1); + rel(home, element(c, x[0]) == one); + } break; + case 2: + rel(home, element(c, x[0])); + break; + default: + GECODE_NEVER; } + } else { + element(home, c, x[0], r); + } + } + }; + + /// %Test for matrix element with integer array and integer variable + class MatrixIntIntVarXY : public Test { + protected: + /// Array for test matrix + Gecode::IntArgs tm; + + public: + /// Create and register test + MatrixIntIntVarXY() : Test("Element::Matrix::Int::IntVar::XY", 3, 0, 5, false), tm({0, 1, 2, 3, 4, 5}) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + // x-coordinate: x[0], y-coordinate: x[1], result: x[2] + using namespace Gecode; + if ((x[0] > 2) || (x[1] > 1)) + return false; + Matrix m(tm, 3, 2); + return m(x[0], x[1]) == x[2]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + // x-coordinate: x[0], y-coordinate: x[1], result: x[2] + using namespace Gecode; + Matrix m(tm, 3, 2); + element(home, m, x[0], x[1], x[2]); + } + }; + + /// %Test for matrix element with integer array and integer variable + class MatrixIntIntVarXX : public Test { + protected: + /// Array for test matrix + Gecode::IntArgs tm; + + public: + /// Create and register test + MatrixIntIntVarXX() : Test("Element::Matrix::Int::IntVar::XX", 2, 0, 3, false), tm({0, 1, 2, 3}) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + // x-coordinate: x[0], y-coordinate: x[0], result: x[1] + using namespace Gecode; + if (x[0] > 1) + return false; + Matrix m(tm, 2, 2); + return m(x[0], x[0]) == x[1]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + // x-coordinate: x[0], y-coordinate: x[0], result: x[1] + using namespace Gecode; + Matrix m(tm, 2, 2); + element(home, m, x[0], x[0], x[1]); + } + }; + + /// %Test for matrix element with integer array and Boolean variable + class MatrixIntBoolVarXY : public Test { + protected: + /// Array for test matrix + Gecode::IntArgs tm; + + public: + /// Create and register test + MatrixIntBoolVarXY() : Test("Element::Matrix::Int::BoolVar::XY", 3, 0, 3, false), tm({0, 1, 1, 0}) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + // x-coordinate: x[0], y-coordinate: x[1], result: x[2] + using namespace Gecode; + if ((x[0] > 1) || (x[1] > 1)) + return false; + Matrix m(tm, 2, 2); + return m(x[0], x[1]) == x[2]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + // x-coordinate: x[0], y-coordinate: x[1], result: x[2] + using namespace Gecode; + Matrix m(tm, 2, 2); + element(home, m, x[0], x[1], channel(home, x[2])); + } + }; + + /// %Test for matrix element with integer array and Boolean variable + class MatrixIntBoolVarXX : public Test { + protected: + /// Array for test matrix + Gecode::IntArgs tm; + + public: + /// Create and register test + MatrixIntBoolVarXX() : Test("Element::Matrix::Int::BoolVar::XX", 2, 0, 3, false), tm({0, 1, 1, 0}) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + // x-coordinate: x[0], y-coordinate: x[0], result: x[1] + using namespace Gecode; + if (x[0] > 1) + return false; + Matrix m(tm, 2, 2); + return m(x[0], x[0]) == x[1]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + // x-coordinate: x[0], y-coordinate: x[0], result: x[1] + using namespace Gecode; + Matrix m(tm, 2, 2); + element(home, m, x[0], x[0], channel(home, x[1])); + } + }; + + /// %Test for matrix element with integer variable array and integer variable + class MatrixIntVarIntVarXY : public Test { + public: + /// Create and register test + MatrixIntVarIntVarXY() : Test("Element::Matrix::IntVar::IntVar::XY", 3 + 4, 0, 3, false) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + // x-coordinate: x[0], y-coordinate: x[1], result: x[2] + // remaining: matrix + using namespace Gecode; + if ((x[0] > 1) || (x[1] > 1)) + return false; + IntArgs tm(4); + tm[0] = x[3]; + tm[1] = x[4]; + tm[2] = x[5]; + tm[3] = x[6]; + Matrix m(tm, 2, 2); + return m(x[0], x[1]) == x[2]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + // x-coordinate: x[0], y-coordinate: x[1], result: x[2] + using namespace Gecode; + IntVarArgs tm(4); + tm[0] = x[3]; + tm[1] = x[4]; + tm[2] = x[5]; + tm[3] = x[6]; + Matrix m(tm, 2, 2); + element(home, m, x[0], x[1], x[2]); + } + }; + + /// %Test for matrix element with integer variable array and integer variable + class MatrixIntVarIntVarXX : public Test { + public: + /// Create and register test + MatrixIntVarIntVarXX() : Test("Element::Matrix::IntVar::IntVar::XX", 2 + 4, 0, 3, false) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + // x-coordinate: x[0], y-coordinate: x[0], result: x[1] + // remaining: matrix + using namespace Gecode; + if (x[0] > 1) + return false; + IntArgs tm(4); + tm[0] = x[2]; + tm[1] = x[3]; + tm[2] = x[4]; + tm[3] = x[5]; + Matrix m(tm, 2, 2); + return m(x[0], x[0]) == x[1]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + // x-coordinate: x[0], y-coordinate: x[1], result: x[1] + using namespace Gecode; + IntVarArgs tm(4); + tm[0] = x[2]; + tm[1] = x[3]; + tm[2] = x[4]; + tm[3] = x[5]; + Matrix m(tm, 2, 2); + element(home, m, x[0], x[0], x[1]); + } + }; + + /// %Test for matrix element with Boolean variable array and Boolean variable + class MatrixBoolVarBoolVarXY : public Test { + public: + /// Create and register test + MatrixBoolVarBoolVarXY() : Test("Element::Matrix::BoolVar::BoolVar::XY", 3 + 4, 0, 1, false) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + // x-coordinate: x[0], y-coordinate: x[1], result: x[2] + // remaining: matrix + using namespace Gecode; + IntArgs tm(4); + tm[0] = x[3]; + tm[1] = x[4]; + tm[2] = x[5]; + tm[3] = x[6]; + Matrix m(tm, 2, 2); + return m(x[0], x[1]) == x[2]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + // x-coordinate: x[0], y-coordinate: x[1], result: x[2] + using namespace Gecode; + BoolVarArgs tm(4); + tm[0] = channel(home, x[3]); + tm[1] = channel(home, x[4]); + tm[2] = channel(home, x[5]); + tm[3] = channel(home, x[6]); + Matrix m(tm, 2, 2); + element(home, m, x[0], x[1], channel(home, x[2])); + } + }; + + /// %Test for matrix element with Boolean variable array and Boolean variable + class MatrixBoolVarBoolVarXX : public Test { + public: + /// Create and register test + MatrixBoolVarBoolVarXX() : Test("Element::Matrix::BoolVar::BoolVar::XX", 2 + 4, 0, 1, false) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + // x-coordinate: x[0], y-coordinate: x[0], result: x[1] + // remaining: matrix + using namespace Gecode; + IntArgs tm(4); + tm[0] = x[2]; + tm[1] = x[3]; + tm[2] = x[4]; + tm[3] = x[5]; + Matrix m(tm, 2, 2); + return m(x[0], x[0]) == x[1]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + // x-coordinate: x[0], y-coordinate: x[1], result: x[1] + using namespace Gecode; + BoolVarArgs tm(4); + tm[0] = channel(home, x[2]); + tm[1] = channel(home, x[3]); + tm[2] = channel(home, x[4]); + tm[3] = channel(home, x[5]); + Matrix m(tm, 2, 2); + element(home, m, x[0], x[0], channel(home, x[1])); + } + }; + + /// Help class to create and register tests + class Create { + public: + /// %Test size-dependent optimizations + void + optimized(int idx, int val) { + Gecode::IntArgs c(idx); + for (int i = 0; i < idx; i++) + c[i] = std::max(val - i, 0); + (void)new IntIntVar(Test::str(idx) + "::" + Test::str(val) + "::val", c, val - 8, val - 1); + if (idx != val) + (void)new IntIntVar(Test::str(idx) + "::" + Test::str(val) + "::idx", c, idx - 8, idx - 1); + } + /// Perform creation and registration + Create() { + using namespace Gecode; + IntArgs ic1({-1, 1, -3, 3, -4}); + IntArgs ic2({-1, 1, -1, 1, -1, 1, 0, 0}); + IntArgs ic3({-1}); + IntArgs ic4({0, -1, 2, -2, 4, -3, 6}); + IntArgs ic5({0, 0, 1, 2, 3, 4}); - (void)new IntIntShared("A", ic1); - (void)new IntIntShared("B", ic2); - (void)new IntIntShared("C", ic3); - (void)new IntIntShared("D", ic4); - (void)new IntIntShared("E", ic5, 1); + IntArgs bc1({0, 1, 1, 0, 1}); + IntArgs bc2({1, 1, 0, 1, 0, 1, 0, 0}); + IntArgs bc3({1}); - (void)new IntBoolVar("A", bc1); - (void)new IntBoolVar("B", bc2); - (void)new IntBoolVar("C", bc3); + (void)new IntIntVar("A", ic1, -8, 8); + (void)new IntIntVar("B", ic2, -8, 8); + (void)new IntIntVar("C", ic3, -8, 8); + (void)new IntIntVar("D", ic4, -8, 8); - for (int i = 0; i <= 1; i++) { - (void)new IntBoolInt("A", bc1, i); - (void)new IntBoolInt("B", bc2, i); - (void)new IntBoolInt("C", bc3, i); - } + // Test optimizations + { + int ov[] = {SCHAR_MAX - 1, SCHAR_MAX, SHRT_MAX - 1, SHRT_MAX, 0}; + for (int i = 0; ov[i] != 0; i++) + for (int j = 0; ov[j] != 0; j++) + optimized(ov[i], ov[j]); + } - (void)new VarIntVar(IPL_BND); - (void)new VarIntVar(IPL_DOM); + for (int i = -4; i <= 4; i++) { + (void)new IntIntInt("A", ic1, i); + (void)new IntIntInt("B", ic2, i); + (void)new IntIntInt("C", ic3, i); + (void)new IntIntInt("D", ic4, i); + } - for (int i = -4; i <= 4; i++) { - (void)new VarIntInt(IPL_BND, i); - (void)new VarIntInt(IPL_DOM, i); - } + (void)new IntIntShared("A", ic1); + (void)new IntIntShared("B", ic2); + (void)new IntIntShared("C", ic3); + (void)new IntIntShared("D", ic4); + (void)new IntIntShared("E", ic5, 1); - (void)new VarIntShared(IPL_BND); - (void)new VarIntShared(IPL_DOM); + (void)new IntBoolVar("A", bc1); + (void)new IntBoolVar("B", bc2); + (void)new IntBoolVar("C", bc3); - (void)new VarBoolVar(); - (void)new VarBoolInt(0); - (void)new VarBoolInt(1); + for (int i = 0; i <= 1; i++) { + (void)new IntBoolInt("A", bc1, i); + (void)new IntBoolInt("B", bc2, i); + (void)new IntBoolInt("C", bc3, i); + } - // Matrix tests - (void)new MatrixIntIntVarXY(); - (void)new MatrixIntIntVarXX(); - (void)new MatrixIntBoolVarXY(); - (void)new MatrixIntBoolVarXX(); + (void)new VarIntVar(IPL_BND); + (void)new VarIntVar(IPL_DOM); - (void)new MatrixIntVarIntVarXY(); - (void)new MatrixIntVarIntVarXX(); - (void)new MatrixBoolVarBoolVarXY(); - (void)new MatrixBoolVarBoolVarXX(); - } - }; - - Create c; - - /// Space with the variables for posting two-dimensional element - class MatrixFixture : public Gecode::Space { - public: - /// Column - Gecode::IntVar x; - /// Row - Gecode::IntVar y; - /// Integer result - Gecode::IntVar z; - /// Boolean result - Gecode::BoolVar b; - /// Create fixture - MatrixFixture(void) : x(*this, 0, 1), y(*this, 0, 1), z(*this, 0, 1), b(*this, 0, 1) {} - /// Constructor for cloning \a fixture - MatrixFixture(MatrixFixture& fixture) : Gecode::Space(fixture) { - x.update(*this, fixture.x); - y.update(*this, fixture.y); - z.update(*this, fixture.z); - b.update(*this, fixture.b); + for (int i = -4; i <= 4; i++) { + (void)new VarIntInt(IPL_BND, i); + (void)new VarIntInt(IPL_DOM, i); } - /// Copy during cloning - Gecode::Space* - copy(void) override { - return new MatrixFixture(*this); - } - }; - /// Test whether \a post throws an exception of type \a E on a new space - template - bool - is_rejected(Post post) { - MatrixFixture home; - try { - post(home); - } catch (const E&) { - return true; - } - return false; - } + (void)new VarIntShared(IPL_BND); + (void)new VarIntShared(IPL_DOM); - /// Test whether every overload throws \a E for an array of size \a n, width \a w, and height \a h - template - bool - is_rejected_by_all(int n, int w, int h) { - using namespace Gecode; - IntSharedArray c(IntArgs::create(n, 0, 0)); - return is_rejected([&](MatrixFixture& s) { element(s, c, s.x, w, s.y, h, s.z); }) && - is_rejected([&](MatrixFixture& s) { element(s, c, s.x, 0, w, s.y, 0, h, s.z); }) && - is_rejected([&](MatrixFixture& s) { element(s, c, s.x, w, s.y, h, s.b); }) && - is_rejected([&](MatrixFixture& s) { element(s, c, s.x, 0, w, s.y, 0, h, s.b); }) && - is_rejected([&](MatrixFixture& s) { element(s, IntVarArgs(s, n, 0, 1), s.x, w, s.y, h, s.z); }) && - is_rejected( - [&](MatrixFixture& s) { element(s, IntVarArgs(s, n, 0, 1), s.x, 0, w, s.y, 0, h, s.z); }) && - is_rejected( - [&](MatrixFixture& s) { element(s, BoolVarArgs(s, n, 0, 1), s.x, w, s.y, h, s.b); }) && - is_rejected( - [&](MatrixFixture& s) { element(s, BoolVarArgs(s, n, 0, 1), s.x, 0, w, s.y, 0, h, s.b); }); - } - - /// %Test that two-dimensional element rejects invalid matrices - class MatrixInvalid : public Base { - public: - /// Create and register test - MatrixInvalid(void) : Base("Int::Element::Matrix::Invalid") {} - /// Perform test - bool - run(void) override { - using Gecode::Int::ArgumentSizeMismatch; - using Gecode::Int::TooFewArguments; - return is_rejected_by_all(0, 0, 0) && is_rejected_by_all(0, 0, 5) && - is_rejected_by_all(0, 5, 0) && is_rejected_by_all(0, 1, 1) && - // The product is a multiple of 2^32 - is_rejected_by_all(0, 65536, 65536) && - is_rejected_by_all(3, 0, 5) && - is_rejected_by_all(6, 2, -3) && - is_rejected_by_all(1, -1, -1) && - is_rejected_by_all(6, -2, -3) && - // The product is 2 * 2^32 + 1 - is_rejected_by_all(1, 9, 954437177); - } - }; + (void)new VarBoolVar(); + (void)new VarBoolInt(0); + (void)new VarBoolInt(1); + + // Matrix tests + (void)new MatrixIntIntVarXY(); + (void)new MatrixIntIntVarXX(); + (void)new MatrixIntBoolVarXY(); + (void)new MatrixIntBoolVarXX(); - MatrixInvalid matrix_invalid; - //@} + (void)new MatrixIntVarIntVarXY(); + (void)new MatrixIntVarIntVarXX(); + (void)new MatrixBoolVarBoolVarXY(); + (void)new MatrixBoolVarBoolVarXX(); + } + }; + + Create c; + + /// Space with the variables for posting two-dimensional element + class MatrixFixture : public Gecode::Space { + public: + /// Column + Gecode::IntVar x; + /// Row + Gecode::IntVar y; + /// Integer result + Gecode::IntVar z; + /// Boolean result + Gecode::BoolVar b; + /// Create fixture + MatrixFixture() : x(*this, 0, 1), y(*this, 0, 1), z(*this, 0, 1), b(*this, 0, 1) {} + /// Constructor for cloning \a fixture + MatrixFixture(MatrixFixture& fixture) : Gecode::Space(fixture) { + x.update(*this, fixture.x); + y.update(*this, fixture.y); + z.update(*this, fixture.z); + b.update(*this, fixture.b); + } + /// Copy during cloning + Gecode::Space* + copy() override { + return new MatrixFixture(*this); + } + }; + + /// Test whether \a post throws an exception of type \a E on a new space + template + static bool + is_rejected(Post post) { + MatrixFixture home; + try { + post(home); + } catch (const E&) { + return true; + } + return false; + } + + /// Test whether every overload throws \a E for an array of size \a n, width \a w, and height \a h + template + static bool + is_rejected_by_all(int n, int w, int h) { + using namespace Gecode; + IntSharedArray c(IntArgs::create(n, 0, 0)); + return is_rejected([&](MatrixFixture& s) { element(s, c, s.x, w, s.y, h, s.z); }) && + is_rejected([&](MatrixFixture& s) { element(s, c, s.x, 0, w, s.y, 0, h, s.z); }) && + is_rejected([&](MatrixFixture& s) { element(s, c, s.x, w, s.y, h, s.b); }) && + is_rejected([&](MatrixFixture& s) { element(s, c, s.x, 0, w, s.y, 0, h, s.b); }) && + is_rejected([&](MatrixFixture& s) { element(s, IntVarArgs(s, n, 0, 1), s.x, w, s.y, h, s.z); }) && + is_rejected( + [&](MatrixFixture& s) { element(s, IntVarArgs(s, n, 0, 1), s.x, 0, w, s.y, 0, h, s.z); }) && + is_rejected([&](MatrixFixture& s) { element(s, BoolVarArgs(s, n, 0, 1), s.x, w, s.y, h, s.b); }) && + is_rejected( + [&](MatrixFixture& s) { element(s, BoolVarArgs(s, n, 0, 1), s.x, 0, w, s.y, 0, h, s.b); }); + } + + /// %Test that two-dimensional element rejects invalid matrices + class MatrixInvalid : public Base { + public: + /// Create and register test + MatrixInvalid() : Base("Int::Element::Matrix::Invalid") {} + /// Perform test + bool + run() override { + using Gecode::Int::ArgumentSizeMismatch; + using Gecode::Int::TooFewArguments; + return is_rejected_by_all(0, 0, 0) && is_rejected_by_all(0, 0, 5) && + is_rejected_by_all(0, 5, 0) && is_rejected_by_all(0, 1, 1) && + // The product is a multiple of 2^32 + is_rejected_by_all(0, 65536, 65536) && + is_rejected_by_all(3, 0, 5) && + is_rejected_by_all(6, 2, -3) && + is_rejected_by_all(1, -1, -1) && + is_rejected_by_all(6, -2, -3) && + // The product is 2 * 2^32 + 1 + is_rejected_by_all(1, 9, 954437177); + } + }; - } // namespace Element -}} // namespace Test::Int + MatrixInvalid matrix_invalid; + //@} +} // namespace Test::Int::Element // STATISTICS: test-int diff --git a/test/int/exec.cpp b/test/int/exec.cpp index 9f6b056c78..a9194d1473 100644 --- a/test/int/exec.cpp +++ b/test/int/exec.cpp @@ -34,163 +34,158 @@ #include -namespace Test { namespace Int { +/// %Tests for synchronized execution +namespace Test::Int::Exec { - /// %Tests for synchronized execution - namespace Exec { + /** + * \defgroup TaskTestIntExec Synchronized execution + * \ingroup TaskTestInt + */ + //@{ + /// Simple test for wait (integer variables) + class IntWait : public Test { + protected: + /// Whether to use std::function + bool sf; - /** - * \defgroup TaskTestIntExec Synchronized execution - * \ingroup TaskTestInt - */ - //@{ - /// Simple test for wait (integer variables) - class IntWait : public Test { - protected: - /// Whether to use std::function - bool sf; - - public: - /// Create and register test - IntWait(int n, bool sf0) - : Test("Wait::Int::" + str(n) + "::" + (sf0 ? "std::function" : "funptr"), n, 0, n, false), sf(sf0) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - for (int i = 0; i < x.size(); i++) - for (int j = i + 1; j < x.size(); j++) - if (x[i] == x[j]) - return false; - return true; - } - /// Post wait on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - auto f = static_cast>([](Space& home) { c(home); }); - if (x.size() > 1) { - if (sf) - Gecode::wait(home, x, f); - else - Gecode::wait(home, x, &c); - } else { - if (sf) - Gecode::wait(home, x[0], f); - else - Gecode::wait(home, x[0], &c); - } - } - /// Continuation to be executed - static void - c(Gecode::Space& _home) { - TestSpace& home = static_cast(_home); - for (int i = 0; i < home.x.size(); i++) - for (int j = i + 1; j < home.x.size(); j++) - if (home.x[i].val() == home.x[j].val()) - home.fail(); + public: + /// Create and register test + IntWait(int n, bool sf0) + : Test("Wait::Int::" + str(n) + "::" + (sf0 ? "std::function" : "funptr"), n, 0, n, false), sf(sf0) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + for (int i = 0; i < x.size(); i++) + for (int j = i + 1; j < x.size(); j++) + if (x[i] == x[j]) + return false; + return true; + } + /// Post wait on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + auto f = static_cast>([](Space& home) { c(home); }); + if (x.size() > 1) { + if (sf) + Gecode::wait(home, x, f); + else + Gecode::wait(home, x, &c); + } else { + if (sf) + Gecode::wait(home, x[0], f); + else + Gecode::wait(home, x[0], &c); } - }; + } + /// Continuation to be executed + static void + c(Gecode::Space& _home) { + TestSpace& home = static_cast(_home); + for (int i = 0; i < home.x.size(); i++) + for (int j = i + 1; j < home.x.size(); j++) + if (home.x[i].val() == home.x[j].val()) + home.fail(); + } + }; - /// Simple test for wait (Boolean variables) - class BoolWait : public Test { - protected: - /// Whether to use std::function - bool sf; + /// Simple test for wait (Boolean variables) + class BoolWait : public Test { + protected: + /// Whether to use std::function + bool sf; - public: - /// Create and register test - BoolWait(int n, bool sf0) - : Test("Wait::Bool::" + str(n) + "::" + (sf0 ? "std::function" : "funptr"), n, 0, 1, false), sf(sf0) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - int t = 0; - for (int i = 0; i < x.size(); i++) - t += x[i]; - return t == 2; + public: + /// Create and register test + BoolWait(int n, bool sf0) + : Test("Wait::Bool::" + str(n) + "::" + (sf0 ? "std::function" : "funptr"), n, 0, 1, false), sf(sf0) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + int t = 0; + for (int i = 0; i < x.size(); i++) + t += x[i]; + return t == 2; + } + /// Post wait on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + BoolVarArgs b(x.size()); + for (int i = b.size(); i--;) + b[i] = channel(home, x[i]); + auto f = static_cast>([](Space& home) { c(home); }); + if (b.size() > 1) { + if (sf) + Gecode::wait(home, b, f); + else + Gecode::wait(home, b, &c); + } else { + if (sf) + Gecode::wait(home, b[0], f); + else + Gecode::wait(home, b[0], &c); } - /// Post wait on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - BoolVarArgs b(x.size()); - for (int i = b.size(); i--;) - b[i] = channel(home, x[i]); - auto f = static_cast>([](Space& home) { c(home); }); - if (b.size() > 1) { - if (sf) - Gecode::wait(home, b, f); - else - Gecode::wait(home, b, &c); - } else { - if (sf) - Gecode::wait(home, b[0], f); - else - Gecode::wait(home, b[0], &c); - } - } - /// Continuation to be executed - static void - c(Gecode::Space& _home) { - TestSpace& home = static_cast(_home); - int t = 0; - for (int i = 0; i < home.x.size(); i++) - t += home.x[i].val(); - if (t != 2) - home.fail(); - } - }; + } + /// Continuation to be executed + static void + c(Gecode::Space& _home) { + TestSpace& home = static_cast(_home); + int t = 0; + for (auto var : home.x) + t += var.val(); + if (t != 2) + home.fail(); + } + }; - /// Simple test for when - class When : public Test { - protected: - /// Whether to use std::function - bool sf; + /// Simple test for when + class When : public Test { + protected: + /// Whether to use std::function + bool sf; - public: - /// Create and register test - When(bool sf0) - : Test(std::string("When::") + (sf0 ? "std::function" : "funptr"), 1, 0, 1, false), sf(sf0) {} - /// Check whether \a x is solution - bool - solution(const Assignment& x) const override { - return x[0] == 0; + public: + /// Create and register test + When(bool sf0) : Test(std::string("When::") + (sf0 ? "std::function" : "funptr"), 1, 0, 1, false), sf(sf0) {} + /// Check whether \a x is solution + bool + solution(const Assignment& x) const override { + return x[0] == 0; + } + /// Post when on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + if (sf) { + auto sft = static_cast>([](Space& home) { t(home); }); + auto sfe = static_cast>([](Space& home) { e(home); }); + when(home, channel(home, x[0]), sft, sfe); + } else { + when(home, channel(home, x[0]), &t, &e); } - /// Post when on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - if (sf) { - auto sft = static_cast>([](Space& home) { t(home); }); - auto sfe = static_cast>([](Space& home) { e(home); }); - when(home, channel(home, x[0]), sft, sfe); - } else { - when(home, channel(home, x[0]), &t, &e); - } - } - /// Then-function to be executed - static void - t(Gecode::Space& home) { - home.fail(); - } - /// Else-function to be executed - static void - e(Gecode::Space& home) { - (void)home; - } - }; - - IntWait iw1t(1, true), iw2t(2, true), iw3t(3, true), iw4t(4, true); - IntWait iw1f(1, false), iw2f(2, false), iw3f(3, false), iw4f(4, false); - BoolWait bw1t(1, true), bw2t(2, true), bw3t(3, true), bw4t(4, true); - BoolWait bw1f(1, false), bw2f(2, false), bw3f(3, false), bw4f(4, false); + } + /// Then-function to be executed + static void + t(Gecode::Space& home) { + home.fail(); + } + /// Else-function to be executed + static void + e(Gecode::Space& home) { + (void)home; + } + }; - When whent(true); - When whenf(false); - //@} + IntWait iw1t(1, true), iw2t(2, true), iw3t(3, true), iw4t(4, true); + IntWait iw1f(1, false), iw2f(2, false), iw3f(3, false), iw4f(4, false); + BoolWait bw1t(1, true), bw2t(2, true), bw3t(3, true), bw4t(4, true); + BoolWait bw1f(1, false), bw2f(2, false), bw3f(3, false), bw4f(4, false); - } // namespace Exec + When whent(true); + When whenf(false); + //@} -}} // namespace Test::Int +} // namespace Test::Int::Exec // STATISTICS: test-int diff --git a/test/int/extensional.cpp b/test/int/extensional.cpp index 2878343c39..9b20176839 100644 --- a/test/int/extensional.cpp +++ b/test/int/extensional.cpp @@ -42,2478 +42,2453 @@ #include #include -namespace Test { namespace Int { - - /// %Tests for extensional (relation) constraints - namespace Extensional { - - /** - * \defgroup TaskTestIntExtensional Extensional (relation) constraints - * \ingroup TaskTestInt - */ - //@{ - std::string - extensional_kind_name(Gecode::ExtensionalPropKind epk) { - switch (epk) { - case Gecode::EPK_DENSE: - return "Dense"; - case Gecode::EPK_SPARSE: - return "Sparse"; - case Gecode::EPK_DENSE_COMPRESSED: - return "DenseCompressed"; - case Gecode::EPK_AUTO: - return "Auto"; - default: - GECODE_NEVER; - return "Unknown"; - } +/// %Tests for extensional (relation) constraints +namespace Test::Int::Extensional { + + /** + * \defgroup TaskTestIntExtensional Extensional (relation) constraints + * \ingroup TaskTestInt + */ + //@{ + static std::string + extensional_kind_name(Gecode::ExtensionalPropKind epk) { + switch (epk) { + case Gecode::EPK_DENSE: + return "Dense"; + case Gecode::EPK_SPARSE: + return "Sparse"; + case Gecode::EPK_DENSE_COMPRESSED: + return "DenseCompressed"; + case Gecode::EPK_AUTO: + return "Auto"; + default: + GECODE_NEVER; + return "Unknown"; + } + } + + /// %Test with simple regular expression + class RegSimpleA : public Test { + public: + /// Create and register test + RegSimpleA() : Test("Extensional::Reg::Simple::A", 4, 2, 2) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return (((x[0] == 0) || (x[0] == 2)) && ((x[1] == -1) || (x[1] == 1)) && ((x[2] == 0) || (x[2] == 1)) && + ((x[3] == 0) || (x[3] == 1))); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + extensional(home, x, + (REG(0) | REG(2)) + (REG(-1) | REG(1)) + (REG(7) | REG(0) | REG(1)) + (REG(0) | REG(1))); + } + }; + + /// %Test with simple regular expression + class RegSimpleB : public Test { + public: + /// Create and register test + RegSimpleB() : Test("Extensional::Reg::Simple::B", 4, 2, 2) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return (x[0] < x[1]) && (x[1] < x[2]) && (x[2] < x[3]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + extensional(home, x, + (REG(-2) + REG(-1) + REG(0) + REG(1)) | (REG(-2) + REG(-1) + REG(0) + REG(2)) | + (REG(-2) + REG(-1) + REG(1) + REG(2)) | (REG(-2) + REG(0) + REG(1) + REG(2)) | + (REG(-1) + REG(0) + REG(1) + REG(2))); } + }; + + /// %Test with simple regular expression + class RegSimpleC : public Test { + public: + /// Create and register test + RegSimpleC() : Test("Extensional::Reg::Simple::C", 6, 0, 1) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int pos = 0; + int s = x.size(); + + while (pos < s && x[pos] == 0) + ++pos; + if (pos + 4 > s) + return false; - /// %Test with simple regular expression - class RegSimpleA : public Test { - public: - /// Create and register test - RegSimpleA(void) : Test("Extensional::Reg::Simple::A", 4, 2, 2) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return (((x[0] == 0) || (x[0] == 2)) && ((x[1] == -1) || (x[1] == 1)) && ((x[2] == 0) || (x[2] == 1)) && - ((x[3] == 0) || (x[3] == 1))); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - extensional(home, x, - (REG(0) | REG(2)) + (REG(-1) | REG(1)) + (REG(7) | REG(0) | REG(1)) + (REG(0) | REG(1))); - } - }; - - /// %Test with simple regular expression - class RegSimpleB : public Test { - public: - /// Create and register test - RegSimpleB(void) : Test("Extensional::Reg::Simple::B", 4, 2, 2) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return (x[0] < x[1]) && (x[1] < x[2]) && (x[2] < x[3]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - extensional(home, x, - (REG(-2) + REG(-1) + REG(0) + REG(1)) | (REG(-2) + REG(-1) + REG(0) + REG(2)) | - (REG(-2) + REG(-1) + REG(1) + REG(2)) | (REG(-2) + REG(0) + REG(1) + REG(2)) | - (REG(-1) + REG(0) + REG(1) + REG(2))); - } - }; - - /// %Test with simple regular expression - class RegSimpleC : public Test { - public: - /// Create and register test - RegSimpleC(void) : Test("Extensional::Reg::Simple::C", 6, 0, 1) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int pos = 0; - int s = x.size(); - - while (pos < s && x[pos] == 0) - ++pos; - if (pos + 4 > s) + for (int i = 0; i < 2; ++i, ++pos) + if (x[pos] != 1) return false; + if (pos + 2 > s) + return false; - for (int i = 0; i < 2; ++i, ++pos) - if (x[pos] != 1) - return false; - if (pos + 2 > s) + for (int i = 0; i < 1; ++i, ++pos) + if (x[pos] != 0) return false; + while (pos < s && x[pos] == 0) + ++pos; + if (pos + 1 > s) + return false; - for (int i = 0; i < 1; ++i, ++pos) - if (x[pos] != 0) - return false; - while (pos < s && x[pos] == 0) - ++pos; - if (pos + 1 > s) + for (int i = 0; i < 1; ++i, ++pos) + if (x[pos] != 1) return false; - - for (int i = 0; i < 1; ++i, ++pos) - if (x[pos] != 1) - return false; - while (pos < s) - if (x[pos++] != 0) - return false; - return true; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - extensional(home, x, *REG(0) + REG(1)(2, 2) + +REG(0) + REG(1)(1, 1) + *REG(0)); - } - }; - - /// %Test with regular expression for distinct constraint - class RegDistinct : public Test { - public: - /// Create and register test - RegDistinct(void) : Test("Extensional::Reg::Distinct", 4, -1, 4) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - for (int i = 0; i < x.size(); i++) { - if ((x[i] < 0) || (x[i] > 3)) + while (pos < s) + if (x[pos++] != 0) + return false; + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + extensional(home, x, *REG(0) + REG(1)(2, 2) + +REG(0) + REG(1)(1, 1) + *REG(0)); + } + }; + + /// %Test with regular expression for distinct constraint + class RegDistinct : public Test { + public: + /// Create and register test + RegDistinct() : Test("Extensional::Reg::Distinct", 4, -1, 4) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + for (int i = 0; i < x.size(); i++) { + if ((x[i] < 0) || (x[i] > 3)) + return false; + for (int j = i + 1; j < x.size(); j++) + if (x[i] == x[j]) return false; - for (int j = i + 1; j < x.size(); j++) - if (x[i] == x[j]) - return false; - } - return true; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - extensional(home, x, - (REG(0) + REG(1) + REG(2) + REG(3)) | (REG(0) + REG(1) + REG(3) + REG(2)) | - (REG(0) + REG(2) + REG(1) + REG(3)) | (REG(0) + REG(2) + REG(3) + REG(1)) | - (REG(0) + REG(3) + REG(1) + REG(2)) | (REG(0) + REG(3) + REG(2) + REG(1)) | - (REG(1) + REG(0) + REG(2) + REG(3)) | (REG(1) + REG(0) + REG(3) + REG(2)) | - (REG(1) + REG(2) + REG(0) + REG(3)) | (REG(1) + REG(2) + REG(3) + REG(0)) | - (REG(1) + REG(3) + REG(0) + REG(2)) | (REG(1) + REG(3) + REG(2) + REG(0)) | - (REG(2) + REG(0) + REG(1) + REG(3)) | (REG(2) + REG(0) + REG(3) + REG(1)) | - (REG(2) + REG(1) + REG(0) + REG(3)) | (REG(2) + REG(1) + REG(3) + REG(0)) | - (REG(2) + REG(3) + REG(0) + REG(1)) | (REG(2) + REG(3) + REG(1) + REG(0)) | - (REG(3) + REG(0) + REG(1) + REG(2)) | (REG(3) + REG(0) + REG(2) + REG(1)) | - (REG(3) + REG(1) + REG(0) + REG(2)) | (REG(3) + REG(1) + REG(2) + REG(0)) | - (REG(3) + REG(2) + REG(0) + REG(1)) | (REG(3) + REG(2) + REG(1) + REG(0))); - } - }; - - /// %Test with simple regular expression from Roland Yap - class RegRoland : public Test { - public: - /// Create and register test - RegRoland(int n) : Test("Extensional::Reg::Roland::" + str(n), n, 0, 1) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size(); - return ((n > 1) && (x[n - 2] == 0)) || ((n > 0) && (x[n - 1] == 0)); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - REG r0(0), r1(1); - REG r01 = r0 | r1; - extensional(home, x, *r01 + r0 + r01(0, 1)); - } - }; - - /// %Test with simple regular expression and shared variables (uses unsharing) - class RegSharedA : public Test { - public: - /// Create and register test - RegSharedA(void) : Test("Extensional::Reg::Shared::A", 4, 2, 2) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return (((x[0] == 0) || (x[0] == 2)) && ((x[1] == -1) || (x[1] == 1)) && ((x[2] == 0) || (x[2] == 1)) && - ((x[3] == 0) || (x[3] == 1))); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - IntVarArgs y(8); - for (int i = 0; i < 4; i++) - y[i] = y[i + 4] = x[i]; - unshare(home, y); - extensional( - home, y, - ((REG(0) | REG(2)) + (REG(-1) | REG(1)) + (REG(7) | REG(0) | REG(1)) + (REG(0) | REG(1)))(2, 2)); - } - }; - - /// %Test with simple regular expression and shared variables (uses unsharing) - class RegSharedB : public Test { - public: - /// Create and register test - RegSharedB(void) : Test("Extensional::Reg::Shared::B", 4, 2, 2) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return (((x[0] == 0) || (x[0] == 2)) && ((x[1] == -1) || (x[1] == 1)) && ((x[2] == 0) || (x[2] == 1)) && - ((x[3] == 0) || (x[3] == 1))); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - IntVarArgs y(12); - for (int i = 0; i < 4; i++) - y[i] = y[i + 4] = y[i + 8] = x[i]; - unshare(home, y); - extensional( - home, y, - ((REG(0) | REG(2)) + (REG(-1) | REG(1)) + (REG(7) | REG(0) | REG(1)) + (REG(0) | REG(1)))(3, 3)); - } - }; - - /// %Test with simple regular expression and shared variables (uses unsharing) - class RegSharedC : public Test { - public: - /// Create and register test - RegSharedC(void) : Test("Extensional::Reg::Shared::C", 4, 0, 1) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return (x[1] == 1) && (x[2] == 0) && (x[3] == 1); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - Gecode::BoolVarArgs y(8); - for (int i = 0; i < 4; i++) - y[i] = y[i + 4] = channel(home, x[i]); - unshare(home, y); - extensional(home, y, ((REG(0) | REG(1)) + REG(1) + REG(0) + REG(1))(2, 2)); } - }; - - /// %Test with simple regular expression and shared variables (uses unsharing) - class RegSharedD : public Test { - public: - /// Create and register test - RegSharedD(void) : Test("Extensional::Reg::Shared::D", 4, 0, 1) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return (x[1] == 1) && (x[2] == 0) && (x[3] == 1); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - Gecode::BoolVarArgs y(12); - for (int i = 0; i < 4; i++) - y[i] = y[i + 4] = y[i + 8] = channel(home, x[i]); - unshare(home, y); - extensional(home, y, ((REG(0) | REG(1)) + REG(1) + REG(0) + REG(1))(3, 3)); - } - }; - - /// %Test for empty DFA - class RegEmptyDFA : public Test { - public: - /// Create and register test - RegEmptyDFA(void) : Test("Extensional::Reg::Empty::DFA", 1, 0, 0) { - test_search = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - (void)x; - return false; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::DFA d; - Gecode::extensional(home, x, d); - } - }; - - /// %Test for empty regular expression - class RegEmptyREG : public Test { - public: - /// Create and register test - RegEmptyREG(void) : Test("Extensional::Reg::Empty::REG", 1, 0, 0) { - test_search = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - (void)x; - return false; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::REG r; - Gecode::extensional(home, x, r); - } - }; - - /// %Test for optimizations - class RegOpt : public Test { - protected: - /// DFA size characteristic - int n; - - public: - /// Create and register test - RegOpt(int n0) : Test("Extensional::Reg::Opt::" + str(n0), 1, 0, 15), n(n0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return (x[0] < n) && ((x[0] & 1) == 0); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - DFA::Transition* t = new DFA::Transition[n + 1]; - DFA::Transition* ti = t; - int* f = new int[n + 1]; - int* fi = f; - for (int i = 0; i < n; i++) { - ti->i_state = 0; - ti->symbol = i; - ti->o_state = i + 1; - ti++; - if ((i & 1) == 0) { - *fi = i + 1; - fi++; - } + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + extensional(home, x, + (REG(0) + REG(1) + REG(2) + REG(3)) | (REG(0) + REG(1) + REG(3) + REG(2)) | + (REG(0) + REG(2) + REG(1) + REG(3)) | (REG(0) + REG(2) + REG(3) + REG(1)) | + (REG(0) + REG(3) + REG(1) + REG(2)) | (REG(0) + REG(3) + REG(2) + REG(1)) | + (REG(1) + REG(0) + REG(2) + REG(3)) | (REG(1) + REG(0) + REG(3) + REG(2)) | + (REG(1) + REG(2) + REG(0) + REG(3)) | (REG(1) + REG(2) + REG(3) + REG(0)) | + (REG(1) + REG(3) + REG(0) + REG(2)) | (REG(1) + REG(3) + REG(2) + REG(0)) | + (REG(2) + REG(0) + REG(1) + REG(3)) | (REG(2) + REG(0) + REG(3) + REG(1)) | + (REG(2) + REG(1) + REG(0) + REG(3)) | (REG(2) + REG(1) + REG(3) + REG(0)) | + (REG(2) + REG(3) + REG(0) + REG(1)) | (REG(2) + REG(3) + REG(1) + REG(0)) | + (REG(3) + REG(0) + REG(1) + REG(2)) | (REG(3) + REG(0) + REG(2) + REG(1)) | + (REG(3) + REG(1) + REG(0) + REG(2)) | (REG(3) + REG(1) + REG(2) + REG(0)) | + (REG(3) + REG(2) + REG(0) + REG(1)) | (REG(3) + REG(2) + REG(1) + REG(0))); + } + }; + + /// %Test with simple regular expression from Roland Yap + class RegRoland : public Test { + public: + /// Create and register test + RegRoland(int n) : Test("Extensional::Reg::Roland::" + str(n), n, 0, 1) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size(); + return ((n > 1) && (x[n - 2] == 0)) || ((n > 0) && (x[n - 1] == 0)); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + REG r0(0), r1(1); + REG r01 = r0 | r1; + extensional(home, x, *r01 + r0 + r01(0, 1)); + } + }; + + /// %Test with simple regular expression and shared variables (uses unsharing) + class RegSharedA : public Test { + public: + /// Create and register test + RegSharedA() : Test("Extensional::Reg::Shared::A", 4, 2, 2) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return (((x[0] == 0) || (x[0] == 2)) && ((x[1] == -1) || (x[1] == 1)) && ((x[2] == 0) || (x[2] == 1)) && + ((x[3] == 0) || (x[3] == 1))); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + IntVarArgs y(8); + for (int i = 0; i < 4; i++) + y[i] = y[i + 4] = x[i]; + unshare(home, y); + extensional( + home, y, + ((REG(0) | REG(2)) + (REG(-1) | REG(1)) + (REG(7) | REG(0) | REG(1)) + (REG(0) | REG(1)))(2, 2)); + } + }; + + /// %Test with simple regular expression and shared variables (uses unsharing) + class RegSharedB : public Test { + public: + /// Create and register test + RegSharedB() : Test("Extensional::Reg::Shared::B", 4, 2, 2) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return (((x[0] == 0) || (x[0] == 2)) && ((x[1] == -1) || (x[1] == 1)) && ((x[2] == 0) || (x[2] == 1)) && + ((x[3] == 0) || (x[3] == 1))); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + IntVarArgs y(12); + for (int i = 0; i < 4; i++) + y[i] = y[i + 4] = y[i + 8] = x[i]; + unshare(home, y); + extensional( + home, y, + ((REG(0) | REG(2)) + (REG(-1) | REG(1)) + (REG(7) | REG(0) | REG(1)) + (REG(0) | REG(1)))(3, 3)); + } + }; + + /// %Test with simple regular expression and shared variables (uses unsharing) + class RegSharedC : public Test { + public: + /// Create and register test + RegSharedC() : Test("Extensional::Reg::Shared::C", 4, 0, 1) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return (x[1] == 1) && (x[2] == 0) && (x[3] == 1); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + Gecode::BoolVarArgs y(8); + for (int i = 0; i < 4; i++) + y[i] = y[i + 4] = channel(home, x[i]); + unshare(home, y); + extensional(home, y, ((REG(0) | REG(1)) + REG(1) + REG(0) + REG(1))(2, 2)); + } + }; + + /// %Test with simple regular expression and shared variables (uses unsharing) + class RegSharedD : public Test { + public: + /// Create and register test + RegSharedD() : Test("Extensional::Reg::Shared::D", 4, 0, 1) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return (x[1] == 1) && (x[2] == 0) && (x[3] == 1); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + Gecode::BoolVarArgs y(12); + for (int i = 0; i < 4; i++) + y[i] = y[i + 4] = y[i + 8] = channel(home, x[i]); + unshare(home, y); + extensional(home, y, ((REG(0) | REG(1)) + REG(1) + REG(0) + REG(1))(3, 3)); + } + }; + + /// %Test for empty DFA + class RegEmptyDFA : public Test { + public: + /// Create and register test + RegEmptyDFA() : Test("Extensional::Reg::Empty::DFA", 1, 0, 0) { + test_search = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + (void)x; + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::DFA d; + Gecode::extensional(home, x, d); + } + }; + + /// %Test for empty regular expression + class RegEmptyREG : public Test { + public: + /// Create and register test + RegEmptyREG() : Test("Extensional::Reg::Empty::REG", 1, 0, 0) { + test_search = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + (void)x; + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::REG r; + Gecode::extensional(home, x, r); + } + }; + + /// %Test for optimizations + class RegOpt : public Test { + protected: + /// DFA size characteristic + int n; + + public: + /// Create and register test + RegOpt(int n0) : Test("Extensional::Reg::Opt::" + str(n0), 1, 0, 15), n(n0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return (x[0] < n) && ((x[0] & 1) == 0); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + DFA::Transition* t = new DFA::Transition[n + 1]; + DFA::Transition* ti = t; + int* f = new int[n + 1]; + int* fi = f; + for (int i = 0; i < n; i++) { + ti->i_state = 0; + ti->symbol = i; + ti->o_state = i + 1; + ti++; + if ((i & 1) == 0) { + *fi = i + 1; + fi++; } - ti->i_state = -1; - *fi = -1; - DFA d(0, t, f, false); - delete[] t; - delete[] f; - extensional(home, x, d); - } - }; - - /// %Test an acyclic DFA whose states can occur at different depths - class RegAcyclicReconvergence : public Test { - public: - /// Create and register test - RegAcyclicReconvergence(void) - : Test("Extensional::Reg::Sparse::AcyclicReconvergence", 4, 0, 3, false, Gecode::IPL_DOM) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return ((x[0] == 0) && (x[1] == 2) && (x[2] == 2) && (x[3] == 2)) || - ((x[0] == 1) && (x[1] == 0) && (x[2] == 3) && (x[3] == 3)); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - // State 1 is reached at depth one by 0 and at depth two by 1,0. - // Its two acyclic suffixes have the corresponding lengths. - DFA d(0, {{0, 0, 1}, {0, 1, 2}, {2, 0, 1}, {1, 2, 3}, {3, 2, 4}, {4, 2, 7}, {1, 3, 5}, {5, 3, 7}}, {7}, - false); - extensional(home, x, d); - } - }; - - /// %Test a cyclic DFA whose frontier states recur across many layers - class RegCyclicFrontier : public Test { - public: - /// Create and register test - RegCyclicFrontier(void) - : Test("Extensional::Reg::Sparse::CyclicFrontier", 7, 0, 1, false, Gecode::IPL_DOM) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int parity = 0; - for (int i = 0; i < x.size(); i++) - parity ^= x[i]; - return parity == 0; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - DFA d(0, {{0, 0, 0}, {0, 1, 1}, {1, 0, 1}, {1, 1, 0}}, {0}, false); - extensional(home, x, d); - } - }; - - /// %Test compacting sparse external DFA state identifiers - class RegSparseStateNumbering : public Test { - public: - /// Create and register test - RegSparseStateNumbering(void) - : Test("Extensional::Reg::Sparse::StateNumbering", 2, 0, 1, false, Gecode::IPL_DOM) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return (x[0] == 0) && (x[1] == 1); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - DFA d(1000000, {{1000000, 0, 2000000}, {2000000, 1, 3000000}}, {3000000}, false); - extensional(home, x, d); - } - }; - - /// %Test repeated final states in dense and sparse DFA specifications - class RegDuplicateFinals : public Test { - protected: - bool minimize; - bool sparse; - - public: - RegDuplicateFinals(bool minimize0, bool sparse0) - : Test(std::string("Extensional::Reg::DuplicateFinals::") + (sparse0 ? "Sparse::" : "Dense::") + - (minimize0 ? "Minimize" : "Keep"), - 1, 0, 1, false, Gecode::IPL_DOM), - minimize(minimize0), sparse(sparse0) {} - - bool - solution(const Assignment& x) const override { - return x[0] == 0; } + ti->i_state = -1; + *fi = -1; + DFA d(0, t, f, false); + delete[] t; + delete[] f; + extensional(home, x, d); + } + }; + + /// %Test an acyclic DFA whose states can occur at different depths + class RegAcyclicReconvergence : public Test { + public: + /// Create and register test + RegAcyclicReconvergence() + : Test("Extensional::Reg::Sparse::AcyclicReconvergence", 4, 0, 3, false, Gecode::IPL_DOM) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return ((x[0] == 0) && (x[1] == 2) && (x[2] == 2) && (x[3] == 2)) || + ((x[0] == 1) && (x[1] == 0) && (x[2] == 3) && (x[3] == 3)); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + // State 1 is reached at depth one by 0 and at depth two by 1,0. + // Its two acyclic suffixes have the corresponding lengths. + DFA d(0, {{0, 0, 1}, {0, 1, 2}, {2, 0, 1}, {1, 2, 3}, {3, 2, 4}, {4, 2, 7}, {1, 3, 5}, {5, 3, 7}}, {7}, + false); + extensional(home, x, d); + } + }; + + /// %Test a cyclic DFA whose frontier states recur across many layers + class RegCyclicFrontier : public Test { + public: + /// Create and register test + RegCyclicFrontier() : Test("Extensional::Reg::Sparse::CyclicFrontier", 7, 0, 1, false, Gecode::IPL_DOM) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int parity = 0; + for (int i = 0; i < x.size(); i++) + parity ^= x[i]; + return parity == 0; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + DFA d(0, {{0, 0, 0}, {0, 1, 1}, {1, 0, 1}, {1, 1, 0}}, {0}, false); + extensional(home, x, d); + } + }; + + /// %Test compacting sparse external DFA state identifiers + class RegSparseStateNumbering : public Test { + public: + /// Create and register test + RegSparseStateNumbering() : Test("Extensional::Reg::Sparse::StateNumbering", 2, 0, 1, false, Gecode::IPL_DOM) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return (x[0] == 0) && (x[1] == 1); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + DFA d(1000000, {{1000000, 0, 2000000}, {2000000, 1, 3000000}}, {3000000}, false); + extensional(home, x, d); + } + }; + + /// %Test repeated final states in dense and sparse DFA specifications + class RegDuplicateFinals : public Test { + protected: + bool minimize; + bool sparse; + + public: + RegDuplicateFinals(bool minimize0, bool sparse0) + : Test(std::string("Extensional::Reg::DuplicateFinals::") + (sparse0 ? "Sparse::" : "Dense::") + + (minimize0 ? "Minimize" : "Keep"), + 1, 0, 1, false, Gecode::IPL_DOM), + minimize(minimize0), sparse(sparse0) {} + + bool + solution(const Assignment& x) const override { + return x[0] == 0; + } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - const int start = sparse ? 100 : 0; - const int final = sparse ? 200 : 1; - DFA d(start, {{start, 0, final}}, {final, final, final, final, final, final, final, final}, minimize); - extensional(home, x, d); - } - }; - - /// %Test the Boolean-view regular posting route - class RegBoolCyclicFrontier : public Test { - public: - /// Create and register test - RegBoolCyclicFrontier(void) - : Test("Extensional::Reg::Sparse::BoolCyclicFrontier", 7, 0, 1, false, Gecode::IPL_DOM) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int parity = 0; - for (int i = 0; i < x.size(); i++) - parity ^= x[i]; - return parity == 0; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - BoolVarArgs b(x.size()); - for (int i = 0; i < x.size(); i++) - b[i] = channel(home, x[i]); - DFA d(0, {{0, 0, 0}, {0, 1, 1}, {1, 0, 1}, {1, 1, 0}}, {0}, false); - extensional(home, b, d); - } - }; - - /// %Test deterministic generated DFAs against a reference runner - class RegRandomDifferential : public Test { - protected: - /// Number of DFA states - static const int n_dfa_states = 4; - /// Number of symbols - static const int n_symbols = 3; - /// Transition table, with -1 denoting no transition - int next[n_dfa_states][n_symbols]; - /// Allowed-symbol bit masks for each position - unsigned int allowed[5]; - /// Final-state bit mask - unsigned int finals; - - public: - /// Create and register test - RegRandomDifferential(unsigned int seed) - : Test("Extensional::Reg::Sparse::RandomDifferential::" + Test::str(static_cast(seed)), 5, 0, - n_symbols - 1, false, Gecode::IPL_DOM), - finals(0) { - unsigned int random = seed; - for (int state = 0; state < n_dfa_states; state++) - for (int symbol = 0; symbol < n_symbols; symbol++) { - random = 1664525U * random + 1013904223U; - next[state][symbol] = - ((random & 7U) == 0U) ? -1 : static_cast((random >> 8) % n_dfa_states); - } - for (int i = 0; i < 5; i++) { + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + const int start = sparse ? 100 : 0; + const int final = sparse ? 200 : 1; + DFA d(start, {{start, 0, final}}, {final, final, final, final, final, final, final, final}, minimize); + extensional(home, x, d); + } + }; + + /// %Test the Boolean-view regular posting route + class RegBoolCyclicFrontier : public Test { + public: + /// Create and register test + RegBoolCyclicFrontier() + : Test("Extensional::Reg::Sparse::BoolCyclicFrontier", 7, 0, 1, false, Gecode::IPL_DOM) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int parity = 0; + for (int i = 0; i < x.size(); i++) + parity ^= x[i]; + return parity == 0; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + BoolVarArgs b(x.size()); + for (int i = 0; i < x.size(); i++) + b[i] = channel(home, x[i]); + DFA d(0, {{0, 0, 0}, {0, 1, 1}, {1, 0, 1}, {1, 1, 0}}, {0}, false); + extensional(home, b, d); + } + }; + + /// %Test deterministic generated DFAs against a reference runner + class RegRandomDifferential : public Test { + protected: + /// Number of DFA states + static const int n_dfa_states = 4; + /// Number of symbols + static const int n_symbols = 3; + /// Transition table, with -1 denoting no transition + int next[n_dfa_states][n_symbols]; + /// Allowed-symbol bit masks for each position + unsigned int allowed[5]; + /// Final-state bit mask + unsigned int finals; + + public: + /// Create and register test + RegRandomDifferential(unsigned int seed) + : Test("Extensional::Reg::Sparse::RandomDifferential::" + Test::str(static_cast(seed)), 5, 0, + n_symbols - 1, false, Gecode::IPL_DOM), + finals(0) { + unsigned int random = seed; + for (auto& state : next) + for (int& symbol : state) { random = 1664525U * random + 1013904223U; - allowed[i] = 1U + ((random >> 12) % 7U); + symbol = ((random & 7U) == 0U) ? -1 : static_cast((random >> 8) % n_dfa_states); } + for (unsigned int& word : allowed) { random = 1664525U * random + 1013904223U; - finals = 1U + ((random >> 16) % 15U); + word = 1U + ((random >> 12) % 7U); } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int state = 0; - for (int i = 0; i < x.size(); i++) { - const int symbol = x[i]; - if (((allowed[i] & (1U << symbol)) == 0U) || (next[state][symbol] < 0)) - return false; - state = next[state][symbol]; - } - return (finals & (1U << state)) != 0U; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - DFA::Transition transitions[n_dfa_states * n_symbols + 1]; - int n_transitions = 0; - for (int state = 0; state < n_dfa_states; state++) - for (int symbol = 0; symbol < n_symbols; symbol++) - if (next[state][symbol] >= 0) - transitions[n_transitions++] = DFA::Transition(state, symbol, next[state][symbol]); - transitions[n_transitions].i_state = -1; - int final_states[n_dfa_states + 1]; - int n_final_states = 0; - for (int state = 0; state < n_dfa_states; state++) - if ((finals & (1U << state)) != 0U) - final_states[n_final_states++] = state; - final_states[n_final_states] = -1; - DFA d(0, transitions, final_states, false); - for (int i = 0; i < x.size(); i++) - for (int symbol = 0; symbol < n_symbols; symbol++) - if ((allowed[i] & (1U << symbol)) == 0U) - rel(home, x[i], IRT_NQ, symbol); - extensional(home, x, d); + random = 1664525U * random + 1013904223U; + finals = 1U + ((random >> 16) % 15U); + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int state = 0; + for (int i = 0; i < x.size(); i++) { + const int symbol = x[i]; + if (((allowed[i] & (1U << symbol)) == 0U) || (next[state][symbol] < 0)) + return false; + state = next[state][symbol]; } - }; - - /// %Test nondeterministic generated automata against a reference runner - class RegRandomNFADifferential : public Test { - protected: - /// Number of automaton states - static const int n_fa_states = 4; - /// Number of symbols - static const int n_symbols = 3; - /// Transition relation - bool next[n_fa_states][n_symbols][n_fa_states]; - /// Allowed-symbol bit masks for each position - unsigned int allowed[5]; - - public: - /// Create and register test - RegRandomNFADifferential(unsigned int seed) - : Test(TestTags::check(), - "Extensional::Reg::Sparse::RandomNFADifferential::" + Test::str(static_cast(seed)), 5, 0, - n_symbols - 1, false, Gecode::IPL_DOM) { - unsigned int random = seed; - for (int state = 0; state < n_fa_states; state++) - for (int symbol = 0; symbol < n_symbols; symbol++) - for (int output = 0; output < n_fa_states; output++) { - random = 1664525U * random + 1013904223U; - next[state][symbol][output] = ((random >> 29) == 0U); - } - // Keep a nondeterministic fork and both of its branches relevant. - next[0][0][1] = true; - next[0][0][2] = true; - next[1][1][3] = true; - next[2][2][3] = true; + return (finals & (1U << state)) != 0U; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + DFA::Transition transitions[n_dfa_states * n_symbols + 1]; + int n_transitions = 0; + for (int state = 0; state < n_dfa_states; state++) + for (int symbol = 0; symbol < n_symbols; symbol++) + if (next[state][symbol] >= 0) + transitions[n_transitions++] = DFA::Transition(state, symbol, next[state][symbol]); + transitions[n_transitions].i_state = -1; + int final_states[n_dfa_states + 1]; + int n_final_states = 0; + for (int state = 0; state < n_dfa_states; state++) + if ((finals & (1U << state)) != 0U) + final_states[n_final_states++] = state; + final_states[n_final_states] = -1; + DFA d(0, transitions, final_states, false); + for (int i = 0; i < x.size(); i++) for (int symbol = 0; symbol < n_symbols; symbol++) - next[3][symbol][3] = true; - for (int i = 0; i < 5; i++) { - random = 1664525U * random + 1013904223U; - allowed[i] = 1U + ((random >> 12) % 7U); - } - // Ensure both branches of the fixed fork can occur. - allowed[0] |= 1U; - allowed[1] |= 6U; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - unsigned int states = 1U; - for (int i = 0; i < x.size(); i++) { - const int symbol = x[i]; if ((allowed[i] & (1U << symbol)) == 0U) - return false; - unsigned int outputs = 0U; - for (int state = 0; state < n_fa_states; state++) - if ((states & (1U << state)) != 0U) - for (int output = 0; output < n_fa_states; output++) - if (next[state][symbol][output]) - outputs |= 1U << output; - states = outputs; - } - return (states & (1U << 3)) != 0U; + rel(home, x[i], IRT_NQ, symbol); + extensional(home, x, d); + } + }; + + /// %Test nondeterministic generated automata against a reference runner + class RegRandomNFADifferential : public Test { + protected: + /// Number of automaton states + static const int n_fa_states = 4; + /// Number of symbols + static const int n_symbols = 3; + /// Transition relation + bool next[n_fa_states][n_symbols][n_fa_states]; + /// Allowed-symbol bit masks for each position + unsigned int allowed[5]; + + public: + /// Create and register test + RegRandomNFADifferential(unsigned int seed) + : Test(TestTags::check(), + "Extensional::Reg::Sparse::RandomNFADifferential::" + Test::str(static_cast(seed)), 5, 0, + n_symbols - 1, false, Gecode::IPL_DOM) { + unsigned int random = seed; + for (auto& state : next) + for (auto& symbol : state) + for (bool& output : symbol) { + random = 1664525U * random + 1013904223U; + output = ((random >> 29) == 0U); + } + // Keep a nondeterministic fork and both of its branches relevant. + next[0][0][1] = true; + next[0][0][2] = true; + next[1][1][3] = true; + next[2][2][3] = true; + for (int symbol = 0; symbol < n_symbols; symbol++) + next[3][symbol][3] = true; + for (unsigned int& word : allowed) { + random = 1664525U * random + 1013904223U; + word = 1U + ((random >> 12) % 7U); } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - DFA::Transition transitions[n_fa_states * n_symbols * n_fa_states + 1]; - int n_transitions = 0; + // Ensure both branches of the fixed fork can occur. + allowed[0] |= 1U; + allowed[1] |= 6U; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + unsigned int states = 1U; + for (int i = 0; i < x.size(); i++) { + const int symbol = x[i]; + if ((allowed[i] & (1U << symbol)) == 0U) + return false; + unsigned int outputs = 0U; for (int state = 0; state < n_fa_states; state++) - for (int symbol = 0; symbol < n_symbols; symbol++) + if ((states & (1U << state)) != 0U) for (int output = 0; output < n_fa_states; output++) if (next[state][symbol][output]) - transitions[n_transitions++] = DFA::Transition(state, symbol, output); - transitions[n_transitions].i_state = -1; - int final_states[] = {3, -1}; - DFA d = DFA::nfa(0, transitions, final_states); + outputs |= 1U << output; + states = outputs; + } + return (states & (1U << 3)) != 0U; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + DFA::Transition transitions[n_fa_states * n_symbols * n_fa_states + 1]; + int n_transitions = 0; + for (int state = 0; state < n_fa_states; state++) + for (int symbol = 0; symbol < n_symbols; symbol++) + for (int output = 0; output < n_fa_states; output++) + if (next[state][symbol][output]) + transitions[n_transitions++] = DFA::Transition(state, symbol, output); + transitions[n_transitions].i_state = -1; + int final_states[] = {3, -1}; + DFA d = DFA::nfa(0, transitions, final_states); + for (int i = 0; i < x.size(); i++) + for (int symbol = 0; symbol < n_symbols; symbol++) + if ((allowed[i] & (1U << symbol)) == 0U) + rel(home, x[i], IRT_NQ, symbol); + extensional(home, x, d); + } + }; + + /// %Test cloning an assigned NFA prefix with branching and reconvergence + class RegNFAPrefix : public Test { + protected: + /// Whether to post through Boolean views + bool boolean; + + public: + /// Create and register test + RegNFAPrefix(bool b) + : Test(TestTags::check(), "Extensional::Reg::Sparse::NFAPrefix::" + std::string(b ? "Bool" : "Int"), 5, 0, + 1, false, Gecode::IPL_DOM), + boolean(b) {} + /// %Test whether \a x is a solution + bool + solution(const Assignment& x) const override { + return (x[0] == 0) && (x[1] == 0) && (x[2] == x[3]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + // The first assigned layer has one edge and can be discarded on + // cloning. The second has two edges and must be retained. Two + // paths read the prefix 0,0,0,0, while only one reads 0,0,1,1. + DFA d = DFA::nfa(0, + {{0, 0, 1}, + {1, 0, 2}, + {1, 0, 3}, + {2, 0, 4}, + {3, 0, 4}, + {3, 1, 5}, + {4, 0, 6}, + {5, 1, 6}, + {6, 0, 7}, + {6, 1, 7}}, + {7}); + if (boolean) { + BoolVarArgs b(x.size()); for (int i = 0; i < x.size(); i++) - for (int symbol = 0; symbol < n_symbols; symbol++) - if ((allowed[i] & (1U << symbol)) == 0U) - rel(home, x[i], IRT_NQ, symbol); + b[i] = channel(home, x[i]); + extensional(home, b, d); + } else { extensional(home, x, d); } - }; - - /// %Test cloning an assigned NFA prefix with branching and reconvergence - class RegNFAPrefix : public Test { - protected: - /// Whether to post through Boolean views - bool boolean; - - public: - /// Create and register test - RegNFAPrefix(bool b) - : Test(TestTags::check(), "Extensional::Reg::Sparse::NFAPrefix::" + std::string(b ? "Bool" : "Int"), 5, - 0, 1, false, Gecode::IPL_DOM), - boolean(b) {} - /// %Test whether \a x is a solution - bool - solution(const Assignment& x) const override { - return (x[0] == 0) && (x[1] == 0) && (x[2] == x[3]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - // The first assigned layer has one edge and can be discarded on - // cloning. The second has two edges and must be retained. Two - // paths read the prefix 0,0,0,0, while only one reads 0,0,1,1. - DFA d = DFA::nfa(0, - {{0, 0, 1}, - {1, 0, 2}, - {1, 0, 3}, - {2, 0, 4}, - {3, 0, 4}, - {3, 1, 5}, - {4, 0, 6}, - {5, 1, 6}, - {6, 0, 7}, - {6, 1, 7}}, - {7}); - if (boolean) { - BoolVarArgs b(x.size()); - for (int i = 0; i < x.size(); i++) - b[i] = channel(home, x[i]); - extensional(home, b, d); - } else { - extensional(home, x, d); + } + }; + + /// %Test backward pruning caused by a position-specific domain + class RegPositionDomainPruning : public Test { + public: + /// Create and register test + RegPositionDomainPruning() + : Test("Extensional::Reg::Sparse::PositionDomainPruning", 3, 0, 1, false, Gecode::IPL_DOM) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return (x[0] == 0) && (x[1] == 0) && (x[2] == 0); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + DFA d(0, {{0, 0, 1}, {0, 1, 2}, {1, 0, 3}, {2, 1, 4}, {3, 0, 5}, {4, 1, 6}}, {5, 6}, false); + rel(home, x[2], IRT_EQ, 0); + extensional(home, x, d); + } + }; + + /// %Test failure when the forward frontier misses the terminal boundary + class RegNoAcceptingPath : public Test { + public: + /// Create and register test + RegNoAcceptingPath() : Test("Extensional::Reg::Sparse::NoAcceptingPath", 3, 0, 0, false, Gecode::IPL_DOM) { + test_search = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + (void)x; + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + // Every position has a forward transition, but the sole final state + // is only reached after four symbols. + DFA d(0, {{0, 0, 1}, {1, 0, 2}, {2, 0, 3}, {3, 0, 4}}, {4}, false); + extensional(home, x, d); + } + }; + + /// %Test merging several reached DFA final states + class RegTerminalMerged : public Test { + public: + /// Create and register test + RegTerminalMerged() : Test("Extensional::Reg::Sparse::TerminalMerged", 1, 0, 2, false, Gecode::IPL_DOM) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + (void)x; + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + DFA d(0, {{0, 0, 1}, {0, 1, 2}, {0, 2, 3}}, {1, 2, 3}, false); + extensional(home, x, d); + } + }; + + /// %Test retaining separate terminal states when merging would overflow + class RegTerminalUnmerged : public Test { + public: + /// Create and register test + RegTerminalUnmerged() : Test("Extensional::Reg::Sparse::TerminalUnmerged", 8, 0, 1, false, Gecode::IPL_DOM) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return x[7] == 0; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + // Symbols are unique per level. No symbol labels more than 128 + // transitions, selecting the smallest Degree type, but 256 edges + // enter final states. + const int n_states = 511; + const int n_transitions = n_states - 1; + DFA::Transition* t = new DFA::Transition[n_transitions + 1]; + int ti = 0; + for (int depth = 0; depth < 8; depth++) { + const int first = (1 << depth) - 1; + const int width = 1 << depth; + for (int j = 0; j < width; j++) { + const int i = first + j; + t[ti++] = DFA::Transition(i, 2 * depth, 2 * i + 1); + t[ti++] = DFA::Transition(i, 2 * depth + 1, 2 * i + 2); } } - }; - - /// %Test backward pruning caused by a position-specific domain - class RegPositionDomainPruning : public Test { - public: - /// Create and register test - RegPositionDomainPruning(void) - : Test("Extensional::Reg::Sparse::PositionDomainPruning", 3, 0, 1, false, Gecode::IPL_DOM) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return (x[0] == 0) && (x[1] == 0) && (x[2] == 0); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - DFA d(0, {{0, 0, 1}, {0, 1, 2}, {1, 0, 3}, {2, 1, 4}, {3, 0, 5}, {4, 1, 6}}, {5, 6}, false); - rel(home, x[2], IRT_EQ, 0); - extensional(home, x, d); - } - }; - - /// %Test failure when the forward frontier misses the terminal boundary - class RegNoAcceptingPath : public Test { - public: - /// Create and register test - RegNoAcceptingPath(void) - : Test("Extensional::Reg::Sparse::NoAcceptingPath", 3, 0, 0, false, Gecode::IPL_DOM) { - test_search = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - (void)x; + t[ti].i_state = -1; + int* f = new int[257]; + for (int i = 0; i < 256; i++) + f[i] = 255 + i; + f[256] = -1; + DFA d(0, t, f, false); + delete[] t; + delete[] f; + // Every word reaches the final layer, where only the even symbol + // has a transition into a final state. + IntVarArgs symbols(x.size()); + for (int i = 0; i < x.size() - 1; i++) + symbols[i] = expr(home, 2 * i + x[i]); + symbols[7] = expr(home, 14 + 2 * x[7]); + extensional(home, symbols, d); + } + }; + + /// %Test for comparing DFAs + class DFACompare : public ::Test::Base { + public: + DFACompare() : ::Test::Base("Int::Extensional::DFA::Compare") {} + + bool + run() override { + using namespace Gecode; + DFA d(REG(0) + REG(1)); + DFA same(REG(0) + REG(1)); + DFA other(REG(1) + REG(0)); + // NOLINTNEXTLINE(performance-unnecessary-copy-initialization) + DFA d_copy(d); + DFA empty, other_empty; + return compares_equal(d, same) && compares_equal(d, d_copy) && compares_unequal(d, other) && + compares_equal(empty, other_empty) && compares_unequal(d, empty); + } + }; + + /// Space used by open regular tests + class OpenRegularSpace : public Gecode::Space { + public: + Gecode::IntVarArray x; + Gecode::OpenIntVarList list; + + OpenRegularSpace(const Gecode::DFA& d, int max = 8) : x(*this, 3, 0, 2), list(*this, max) { + Gecode::extensional(*this, list, d); + } + + OpenRegularSpace(OpenRegularSpace& s) : Gecode::Space(s) { + x.update(*this, s.x); + list.update(*this, s.list); + } + + Gecode::Space* + copy() override { + return new OpenRegularSpace(*this); + } + }; + + /// Test appending and closing an open regular list + class OpenRegularIncremental : public ::Test::Base { + public: + OpenRegularIncremental() : ::Test::Base("Int::Extensional::OpenReg::Incremental", TestTags::check()) {} + + bool + run() override { + using namespace Gecode; + DFA d(0, {{0, 0, 1}, {1, 1, 2}}, {2}, false); + OpenRegularSpace s(d); + + if (s.status() == SS_FAILED) + return false; + s.list.append(s, s.x[0]); + if ((s.status() == SS_FAILED) || !s.x[0].assigned() || (s.x[0].val() != 0)) + return false; + s.list.append(s, s.x[1]); + if ((s.status() == SS_FAILED) || !s.x[1].assigned() || (s.x[1].val() != 1)) + return false; + s.list.close(s); + if ((s.status() == SS_FAILED) || !s.list.length().assigned() || (s.list.length().val() != 2)) return false; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - // Every position has a forward transition, but the sole final state - // is only reached after four symbols. - DFA d(0, {{0, 0, 1}, {1, 0, 2}, {2, 0, 3}, {3, 0, 4}}, {4}, false); - extensional(home, x, d); - } - }; - - /// %Test merging several reached DFA final states - class RegTerminalMerged : public Test { - public: - /// Create and register test - RegTerminalMerged(void) - : Test("Extensional::Reg::Sparse::TerminalMerged", 1, 0, 2, false, Gecode::IPL_DOM) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - (void)x; - return true; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - DFA d(0, {{0, 0, 1}, {0, 1, 2}, {0, 2, 3}}, {1, 2, 3}, false); - extensional(home, x, d); - } - }; - - /// %Test retaining separate terminal states when merging would overflow - class RegTerminalUnmerged : public Test { - public: - /// Create and register test - RegTerminalUnmerged(void) - : Test("Extensional::Reg::Sparse::TerminalUnmerged", 8, 0, 1, false, Gecode::IPL_DOM) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return x[7] == 0; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - // Symbols are unique per level. No symbol labels more than 128 - // transitions, selecting the smallest Degree type, but 256 edges - // enter final states. - const int n_states = 511; - const int n_transitions = n_states - 1; - DFA::Transition* t = new DFA::Transition[n_transitions + 1]; - int ti = 0; - for (int depth = 0; depth < 8; depth++) { - const int first = (1 << depth) - 1; - const int width = 1 << depth; - for (int j = 0; j < width; j++) { - const int i = first + j; - t[ti++] = DFA::Transition(i, 2 * depth, 2 * i + 1); - t[ti++] = DFA::Transition(i, 2 * depth + 1, 2 * i + 2); - } - } - t[ti].i_state = -1; - int* f = new int[257]; - for (int i = 0; i < 256; i++) - f[i] = 255 + i; - f[256] = -1; - DFA d(0, t, f, false); - delete[] t; - delete[] f; - // Every word reaches the final layer, where only the even symbol - // has a transition into a final state. - IntVarArgs symbols(x.size()); - for (int i = 0; i < x.size() - 1; i++) - symbols[i] = expr(home, 2 * i + x[i]); - symbols[7] = expr(home, 14 + 2 * x[7]); - extensional(home, symbols, d); - } - }; - - /// %Test for comparing DFAs - class DFACompare : public ::Test::Base { - public: - DFACompare(void) : ::Test::Base("Int::Extensional::DFA::Compare") {} - - bool - run(void) override { - using namespace Gecode; - DFA d(REG(0) + REG(1)); - DFA same(REG(0) + REG(1)); - DFA other(REG(1) + REG(0)); - // NOLINTNEXTLINE(performance-unnecessary-copy-initialization) - DFA d_copy(d); - DFA empty, other_empty; - return compares_equal(d, same) && compares_equal(d, d_copy) && compares_unequal(d, other) && - compares_equal(empty, other_empty) && compares_unequal(d, empty); - } - }; - /// Space used by open regular tests - class OpenRegularSpace : public Gecode::Space { - public: - Gecode::IntVarArray x; - Gecode::OpenIntVarList list; + // Pruning the first item to 1 also closes its aliased length. + DFA alias_dfa(0, {{0, 1, 1}, {1, 2, 2}}, {2}, false); + OpenRegularSpace alias(alias_dfa, 2); + alias.list.append(alias, alias.list.length()); + return alias.status() == SS_FAILED; + } + }; - OpenRegularSpace(const Gecode::DFA& d, int max = 8) : x(*this, 3, 0, 2), list(*this, max) { - Gecode::extensional(*this, list, d); - } + /// Materializing required positions wakes regular filtering + class OpenRegularLengthWake : public ::Test::Base { + public: + OpenRegularLengthWake() : ::Test::Base("Int::Extensional::OpenReg::LengthWake") {} - OpenRegularSpace(OpenRegularSpace& s) : Gecode::Space(s) { - x.update(*this, s.x); - list.update(*this, s.list); - } + bool + run() override { + using namespace Gecode; + DFA d(0, {{0, 0, 1}, {1, 1, 2}}, {2}, false); + OpenRegularSpace s(d, 3); + rel(s, s.list.length(), IRT_GQ, 2); + if (s.status() == SS_FAILED) + return false; + return (s.list.known_length() == 2) && s.list[0].assigned() && (s.list[0].val() == 0) && + s.list[1].assigned() && (s.list[1].val() == 1); + } + }; - Gecode::Space* - copy(void) override { - return new OpenRegularSpace(*this); - } - }; + /// Filter prefixes whose accepting continuations exceed the length bound + class OpenRegularMaxLength : public ::Test::Base { + public: + OpenRegularMaxLength() : ::Test::Base("Int::Extensional::OpenReg::MaxLength", TestTags::check()) {} - /// Test appending and closing an open regular list - class OpenRegularIncremental : public ::Test::Base { - public: - OpenRegularIncremental(void) : ::Test::Base("Int::Extensional::OpenReg::Incremental", TestTags::check()) {} + bool + run() override { + using namespace Gecode; + // Accept 00 or 1000: only the first word fits a maximum of three. + DFA d(0, {{0, 0, 1}, {1, 0, 5}, {0, 1, 2}, {2, 0, 3}, {3, 0, 4}, {4, 0, 5}}, {5}, false); + OpenRegularSpace short_list(d, 1); + if (short_list.status() != SS_FAILED) + return false; + OpenRegularSpace initial(d, 3); + initial.list.append(initial, initial.x[0]); + if ((initial.status() == SS_FAILED) || !initial.x[0].assigned() || (initial.x[0].val() != 0)) + return false; - bool - run(void) override { - using namespace Gecode; - DFA d(0, {{0, 0, 1}, {1, 1, 2}}, {2}, false); - OpenRegularSpace s(d); + OpenRegularSpace source(d, 4); + source.list.append(source, source.x[0]); + if ((source.status() == SS_FAILED) || (source.x[0].size() != 2)) + return false; + OpenRegularSpace* clone = static_cast(source.clone()); + rel(*clone, clone->list.length(), IRT_LQ, 3); + const bool clone_ok = (clone->status() != SS_FAILED) && clone->x[0].assigned() && (clone->x[0].val() == 0); + delete clone; + if (!clone_ok || (source.x[0].size() != 2)) + return false; - if (s.status() == SS_FAILED) - return false; - s.list.append(s, s.x[0]); - if ((s.status() == SS_FAILED) || !s.x[0].assigned() || (s.x[0].val() != 0)) - return false; - s.list.append(s, s.x[1]); - if ((s.status() == SS_FAILED) || !s.x[1].assigned() || (s.x[1].val() != 1)) - return false; - s.list.close(s); - if ((s.status() == SS_FAILED) || !s.list.length().assigned() || (s.list.length().val() != 2)) - return false; + // A bound reduction also checks an already consumed prefix. + rel(source, source.x[0], IRT_EQ, 1); + if (source.status() == SS_FAILED) + return false; + rel(source, source.list.length(), IRT_LQ, 3); + if (source.status() != SS_FAILED) + return false; - // Pruning the first item to 1 also closes its aliased length. - DFA alias_dfa(0, {{0, 1, 1}, {1, 2, 2}}, {2}, false); - OpenRegularSpace alias(alias_dfa, 2); - alias.list.append(alias, alias.list.length()); - return alias.status() == SS_FAILED; - } - }; - - /// Materializing required positions wakes regular filtering - class OpenRegularLengthWake : public ::Test::Base { - public: - OpenRegularLengthWake(void) : ::Test::Base("Int::Extensional::OpenReg::LengthWake") {} - - bool - run(void) override { - using namespace Gecode; - DFA d(0, {{0, 0, 1}, {1, 1, 2}}, {2}, false); - OpenRegularSpace s(d, 3); - rel(s, s.list.length(), IRT_GQ, 2); - if (s.status() == SS_FAILED) - return false; - return (s.list.known_length() == 2) && s.list[0].assigned() && (s.list[0].val() == 0) && - s.list[1].assigned() && (s.list[1].val() == 1); - } - }; - - /// Filter prefixes whose accepting continuations exceed the length bound - class OpenRegularMaxLength : public ::Test::Base { - public: - OpenRegularMaxLength(void) : ::Test::Base("Int::Extensional::OpenReg::MaxLength", TestTags::check()) {} - - bool - run(void) override { - using namespace Gecode; - // Accept 00 or 1000: only the first word fits a maximum of three. - DFA d(0, {{0, 0, 1}, {1, 0, 5}, {0, 1, 2}, {2, 0, 3}, {3, 0, 4}, {4, 0, 5}}, {5}, false); - OpenRegularSpace short_list(d, 1); - if (short_list.status() != SS_FAILED) - return false; - OpenRegularSpace initial(d, 3); - initial.list.append(initial, initial.x[0]); - if ((initial.status() == SS_FAILED) || !initial.x[0].assigned() || (initial.x[0].val() != 0)) - return false; + // Keep the shorter nondeterministic path, even with a cycle. + DFA nfa = DFA::nfa(0, {{0, 0, 1}, {0, 0, 2}, {1, 0, 3}, {3, 0, 4}, {4, 0, 5}, {2, 1, 2}, {2, 0, 5}}, {5}); + OpenRegularSpace nondeterministic(nfa, 2); + nondeterministic.list.append(nondeterministic, nondeterministic.x[0]); + if (nondeterministic.status() == SS_FAILED) + return false; + nondeterministic.list.append(nondeterministic, nondeterministic.x[1]); + if ((nondeterministic.status() == SS_FAILED) || !nondeterministic.x[1].assigned() || + (nondeterministic.x[1].val() != 0)) + return false; - OpenRegularSpace source(d, 4); - source.list.append(source, source.x[0]); - if ((source.status() == SS_FAILED) || (source.x[0].size() != 2)) - return false; - OpenRegularSpace* clone = static_cast(source.clone()); - rel(*clone, clone->list.length(), IRT_LQ, 3); - const bool clone_ok = - (clone->status() != SS_FAILED) && clone->x[0].assigned() && (clone->x[0].val() == 0); - delete clone; - if (!clone_ok || (source.x[0].size() != 2)) - return false; + // Pruning an item aliased with length lowers the maximum while open. + DFA alias_dfa(0, {{0, 2, 1}, {1, 0, 2}, {2, 0, 3}, {3, 0, 4}, {0, 3, 5}, {5, 0, 6}, {6, 0, 4}}, {4}, false); + OpenRegularSpace alias(alias_dfa, 5); + alias.list.append(alias, alias.list.length()); + alias.list.append(alias, alias.x[0]); + return (alias.status() != SS_FAILED) && alias.list.length().assigned() && (alias.list.length().val() == 3); + } + }; - // A bound reduction also checks an already consumed prefix. - rel(source, source.x[0], IRT_EQ, 1); - if (source.status() == SS_FAILED) - return false; - rel(source, source.list.length(), IRT_LQ, 3); - if (source.status() != SS_FAILED) - return false; + /// Test backward pruning after appending a restricted variable + class OpenRegularBackward : public ::Test::Base { + public: + OpenRegularBackward() : ::Test::Base("Int::Extensional::OpenReg::Backward") {} - // Keep the shorter nondeterministic path, even with a cycle. - DFA nfa = - DFA::nfa(0, {{0, 0, 1}, {0, 0, 2}, {1, 0, 3}, {3, 0, 4}, {4, 0, 5}, {2, 1, 2}, {2, 0, 5}}, {5}); - OpenRegularSpace nondeterministic(nfa, 2); - nondeterministic.list.append(nondeterministic, nondeterministic.x[0]); - if (nondeterministic.status() == SS_FAILED) - return false; - nondeterministic.list.append(nondeterministic, nondeterministic.x[1]); - if ((nondeterministic.status() == SS_FAILED) || !nondeterministic.x[1].assigned() || - (nondeterministic.x[1].val() != 0)) - return false; + bool + run() override { + using namespace Gecode; + DFA d(0, {{0, 0, 1}, {0, 1, 2}, {1, 0, 3}, {2, 1, 4}, {3, 2, 5}, {4, 2, 5}}, {5}, false); + OpenRegularSpace s(d); + rel(s, s.x[1], IRT_EQ, 0); + s.list.append(s, s.x[0]); + if ((s.status() == SS_FAILED) || (s.x[0].min() != 0) || (s.x[0].max() != 1)) + return false; + s.list.append(s, s.x[1]); + return (s.status() != SS_FAILED) && s.x[0].assigned() && (s.x[0].val() == 0); + } + }; - // Pruning an item aliased with length lowers the maximum while open. - DFA alias_dfa(0, {{0, 2, 1}, {1, 0, 2}, {2, 0, 3}, {3, 0, 4}, {0, 3, 5}, {5, 0, 6}, {6, 0, 4}}, {4}, - false); - OpenRegularSpace alias(alias_dfa, 5); - alias.list.append(alias, alias.list.length()); - alias.list.append(alias, alias.x[0]); - return (alias.status() != SS_FAILED) && alias.list.length().assigned() && - (alias.list.length().val() == 3); - } - }; - - /// Test backward pruning after appending a restricted variable - class OpenRegularBackward : public ::Test::Base { - public: - OpenRegularBackward(void) : ::Test::Base("Int::Extensional::OpenReg::Backward") {} - - bool - run(void) override { - using namespace Gecode; - DFA d(0, {{0, 0, 1}, {0, 1, 2}, {1, 0, 3}, {2, 1, 4}, {3, 2, 5}, {4, 2, 5}}, {5}, false); - OpenRegularSpace s(d); - rel(s, s.x[1], IRT_EQ, 0); - s.list.append(s, s.x[0]); - if ((s.status() == SS_FAILED) || (s.x[0].min() != 0) || (s.x[0].max() != 1)) + /// Test domain notification on an appended variable + class OpenRegularDomainWake : public ::Test::Base { + public: + OpenRegularDomainWake() : ::Test::Base("Int::Extensional::OpenReg::DomainWake") {} + + bool + run() override { + using namespace Gecode; + DFA d(0, {{0, 0, 1}, {0, 1, 2}, {1, 0, 3}, {2, 1, 4}, {3, 2, 5}, {4, 2, 5}}, {5}, false); + OpenRegularSpace s(d); + s.list.append(s, s.x[0]); + s.list.append(s, s.x[1]); + if ((s.status() == SS_FAILED) || s.x[0].assigned()) + return false; + rel(s, s.x[1], IRT_EQ, 0); + return (s.status() != SS_FAILED) && s.x[0].assigned() && (s.x[0].val() == 0); + } + }; + + /// Test independent extension after cloning + class OpenRegularClone : public ::Test::Base { + public: + OpenRegularClone() : ::Test::Base("Int::Extensional::OpenReg::Clone", TestTags::check()) {} + + bool + run() override { + using namespace Gecode; + DFA d(0, {{0, 0, 1}, {1, 1, 2}}, {2}, false); + OpenRegularSpace source(d); + source.list.append(source, source.x[0]); + if (source.status() == SS_FAILED) + return false; + + OpenRegularSpace* clone = static_cast(source.clone()); + clone->list.append(*clone, clone->x[1]); + clone->list.close(*clone); + const bool clone_ok = (clone->status() != SS_FAILED) && (clone->list.known_length() == 2); + delete clone; + + source.list.close(source); + const bool source_failed = source.status() == SS_FAILED; + return clone_ok && source_failed && (source.list.known_length() == 1); + } + }; + + /// Test empty words and automata without accepting states + class OpenRegularEmpty : public Test { + public: + enum class Kind { ACCEPT, REJECT, NO_FINALS }; + + protected: + Kind kind; + + public: + OpenRegularEmpty(Kind k) : Test("Extensional::OpenReg::Empty::" + str(static_cast(k)), 1, 0, 0), kind(k) {} + bool + solution(const Assignment&) const override { + return kind == Kind::ACCEPT; + } + void + post(Gecode::Space& home, Gecode::IntVarArray&) override { + using namespace Gecode; + OpenIntVarList list(home, 8); + if (kind == Kind::ACCEPT) { + extensional(home, list, DFA()); + } else if (kind == Kind::REJECT) { + extensional(home, list, DFA(0, {{0, 0, 1}}, {1}, false)); + } else { + extensional(home, list, DFA(0, {{0, 0, 0}}, std::initializer_list{}, false)); + } + if (kind != Kind::NO_FINALS) + list.close(home); + } + }; + + /// Check domain consistency of the regular constraint on a closed open list + class OpenRegularClosed : public Test { + public: + OpenRegularClosed() : Test("Extensional::OpenReg::Closed", 3, 0, 2, false, Gecode::IPL_DOM) {} + bool + solution(const Assignment& x) const override { + int parity = 0; + for (int i = 0; i < x.size(); i++) { + if (x[i] == 2) return false; - s.list.append(s, s.x[1]); - return (s.status() != SS_FAILED) && s.x[0].assigned() && (s.x[0].val() == 0); + parity ^= x[i]; } - }; - - /// Test domain notification on an appended variable - class OpenRegularDomainWake : public ::Test::Base { - public: - OpenRegularDomainWake(void) : ::Test::Base("Int::Extensional::OpenReg::DomainWake") {} - - bool - run(void) override { - using namespace Gecode; - DFA d(0, {{0, 0, 1}, {0, 1, 2}, {1, 0, 3}, {2, 1, 4}, {3, 2, 5}, {4, 2, 5}}, {5}, false); - OpenRegularSpace s(d); - s.list.append(s, s.x[0]); - s.list.append(s, s.x[1]); - if ((s.status() == SS_FAILED) || s.x[0].assigned()) - return false; - rel(s, s.x[1], IRT_EQ, 0); - return (s.status() != SS_FAILED) && s.x[0].assigned() && (s.x[0].val() == 0); + return parity == 0; + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + OpenIntVarList list(home, x.size()); + for (auto xi : x) + list.append(home, xi); + list.close(home); + DFA d(0, {{0, 0, 0}, {0, 1, 1}, {1, 0, 1}, {1, 1, 0}}, {0}, false); + extensional(home, list, d); + } + }; + + ///% Transform a TupleSet into a DFA + static Gecode::DFA + tuple_set_to_dfa(const Gecode::TupleSet& ts) { + using namespace Gecode; + REG expression; + for (int i = 0; i < ts.tuples(); i++) { + REG r; + for (int j = 0; j < ts.arity(); j++) { + r += REG(ts[i][j]); + } + expression |= r; + } + DFA dfa(expression); + return dfa; + } + + /// %Test with tuple set + class TupleSetBase : public Test { + protected: + /// Simple test tupleset + Gecode::TupleSet t; + /// Whether the table is positive or negative + bool pos; + /// Support representation + Gecode::ExtensionalPropKind epk; + + public: + /// Create and register test + TupleSetBase(bool p, Gecode::ExtensionalPropKind epk0) + : Test(TestTags::sweep(), + "Extensional::TupleSet::" + extensional_kind_name(epk0) + "::" + str(p) + "::Base", 4, 1, 5, true, + Gecode::IPL_DOM), + t(4), pos(p), epk(epk0) { + using namespace Gecode; + IntArgs t1({2, 1, 2, 4}); + IntArgs t2({2, 2, 1, 4}); + IntArgs t3({4, 3, 4, 1}); + IntArgs t4({1, 3, 2, 3}); + IntArgs t5({3, 3, 3, 2}); + t.add(t1) + .add(t1) + .add(t2) + .add(t2) + .add(t3) + .add(t3) + .add(t4) + .add(t4) + .add(t5) + .add(t5) + .add(t5) + .add(t5) + .add(t5) + .add(t5) + .add(t5) + .add(t5) + .add(t1) + .add(t1) + .add(t2) + .add(t2) + .add(t3) + .add(t3) + .add(t4) + .add(t4) + .add(t5) + .add(t5) + .add(t5) + .add(t5) + .add(t5) + .add(t5) + .add(t5) + .add(t5) + .finalize(epk); + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return pos == ((x[0] == 1 && x[1] == 3 && x[2] == 2 && x[3] == 3) || + (x[0] == 2 && x[1] == 1 && x[2] == 2 && x[3] == 4) || + (x[0] == 2 && x[1] == 2 && x[2] == 1 && x[3] == 4) || + (x[0] == 3 && x[1] == 3 && x[2] == 3 && x[3] == 2) || + (x[0] == 4 && x[1] == 3 && x[2] == 4 && x[3] == 1)); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + TupleSet ts = TupleSet(t.arity(), tuple_set_to_dfa(t), epk); + assert(t == ts); + assert(ts.representation() == epk); + extensional(home, x, t, pos, ipl); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + extensional(home, x, t, pos, r, ipl); + } + }; + + /// %Test with tuple set + class TupleSetTest : public Test { + protected: + /// Whether the table is positive or negative + bool pos; + /// Support representation + Gecode::ExtensionalPropKind epk; + /// The tuple set to use + Gecode::TupleSet ts; + /// Whether to validate dfa2tupleset + bool to_dfa; + + public: + /// Create and register test + TupleSetTest(const std::string& s, bool p, const Gecode::IntSet& d0, const Gecode::TupleSet& ts0, bool td, + Gecode::ExtensionalPropKind epk0, TestTags tags = TestTags::sweep()) + : Test(tags, "Extensional::TupleSet::" + extensional_kind_name(epk0) + "::" + str(p) + "::" + s, + ts0.arity(), d0, true, Gecode::IPL_DOM), + pos(p), epk(epk0), ts(ts0), to_dfa(td) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + using namespace Gecode; + for (int i = ts.tuples(); i--;) { + TupleSet::Tuple t = ts[i]; + bool same = true; + for (int j = 0; (j < ts.arity()) && same; j++) + if (t[j] != x[j]) + same = false; + if (same) + return pos; + } + return !pos; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + if (to_dfa) { + TupleSet t = TupleSet(ts.arity(), tuple_set_to_dfa(ts), epk); + assert(ts == t); + assert(t.representation() == epk); } - }; - - /// Test independent extension after cloning - class OpenRegularClone : public ::Test::Base { - public: - OpenRegularClone(void) : ::Test::Base("Int::Extensional::OpenReg::Clone", TestTags::check()) {} - - bool - run(void) override { - using namespace Gecode; - DFA d(0, {{0, 0, 1}, {1, 1, 2}}, {2}, false); - OpenRegularSpace source(d); - source.list.append(source, source.x[0]); - if (source.status() == SS_FAILED) + extensional(home, x, ts, pos, ipl); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + using namespace Gecode; + extensional(home, x, ts, pos, r, ipl); + } + }; + + class RandomTupleSetTest : public TupleSetTest { + public: + /// Create and register test + RandomTupleSetTest(const std::string& s, bool p, const Gecode::IntSet& d0, const Gecode::TupleSet& ts0, + Gecode::ExtensionalPropKind epk0) + : TupleSetTest(s, p, d0, ts0, false, epk0) { + test_search = false; + } + /// Create and register initial assignment + Assignment* + assignment() const override { + using namespace Gecode; + return new RandomAssignment(arity, dom, 1000, _rand); + } + }; + + /// Sample both table tuples and arbitrary assignments in large domains. + class SparseAssignment : public RandomAssignment { + Gecode::TupleSet t; + void + tuple(Gecode::Support::RandomGenerator& rand) { + if ((a % 2) == 0) { + int row = rand(t.tuples()); + for (int i = 0; i < n; i++) + vals[i] = t[row][i]; + } + } + + public: + SparseAssignment(const Gecode::TupleSet& t0, const Gecode::IntSet& d, Gecode::Support::RandomGenerator& rand) + : RandomAssignment(t0.arity(), d, 32, rand), t(t0) { + tuple(rand); + } + void + next(Gecode::Support::RandomGenerator& rand) override { + RandomAssignment::next(rand); + tuple(rand); + } + }; + + /// Sparse tables with the original large support counts and arities. + class SparseTupleSet : public Test { + Gecode::TupleSet t; + + public: + SparseTupleSet(const std::string& name, int arity, int size) + : Test("Extensional::TupleSet::Sparse::" + name, arity, 0, size - 1, false, Gecode::IPL_DOM), t(arity) { + const int factors[] = {1, arity == 3 ? 7 : 3, arity == 3 ? 11 : 5, 7, 11, 13}; + for (int i = 0; i < size; i++) { + Gecode::IntArgs row(arity); + for (int j = 0; j < arity; j++) + row[j] = (i * factors[j]) % size; + t.add(row); + } + t.finalize(Gecode::EPK_SPARSE); + test_search = false; + consistency_test_level = CTL_NONE; + } + Assignment* + assignment() const override { + return new SparseAssignment(t, dom, _rand); + } + bool + solution(const Assignment& x) const override { + const int size = dom.max() + 1; + const int factors[] = {1, arity == 3 ? 7 : 3, arity == 3 ? 11 : 5, 7, 11, 13}; + for (int i = 1; i < arity; i++) + if (x[i] != (x[0] * factors[i]) % size) return false; + return true; + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::extensional(home, x, t, true, ipl); + } + }; + + /// The assignment harness needs one variable even for a nullary table. + class TupleSetNullary : public Test { + bool nonempty; + Gecode::TupleSet t; + + public: + TupleSetNullary(Gecode::ExtensionalPropKind epk, bool n) + : Test("Extensional::TupleSet::" + extensional_kind_name(epk) + "::Nullary::" + str(n), 1, 0, 0), + nonempty(n), t(0) { + // More copies of the empty tuple than the initial capacity of + // 1024 tuples, so that the tuple storage grows + if (nonempty) + for (int i = 0; i < 1025; i++) + t.add(Gecode::IntArgs(0)); + t.finalize(epk); + } + bool + solution(const Assignment&) const override { + return nonempty; + } + void + post(Gecode::Space& home, Gecode::IntVarArray&) override { + Gecode::extensional(home, Gecode::IntVarArgs(), t, true, Gecode::IPL_DOM); + } + }; - OpenRegularSpace* clone = static_cast(source.clone()); - clone->list.append(*clone, clone->x[1]); - clone->list.close(*clone); - const bool clone_ok = (clone->status() != SS_FAILED) && (clone->list.known_length() == 2); - delete clone; + /// Tells issued after posting exercise sparse advisor updates. + class SparseTupleSetIncremental : public Test { + int kind; + Gecode::TupleSet t; - source.list.close(source); - const bool source_failed = source.status() == SS_FAILED; - return clone_ok && source_failed && (source.list.known_length() == 1); - } - }; - - /// Test empty words and automata without accepting states - class OpenRegularEmpty : public Test { - public: - enum class Kind { ACCEPT, REJECT, NO_FINALS }; - - protected: - Kind kind; - - public: - OpenRegularEmpty(Kind k) - : Test("Extensional::OpenReg::Empty::" + str(static_cast(k)), 1, 0, 0), kind(k) {} - bool - solution(const Assignment&) const override { - return kind == Kind::ACCEPT; - } - void - post(Gecode::Space& home, Gecode::IntVarArray&) override { - using namespace Gecode; - OpenIntVarList list(home, 8); - if (kind == Kind::ACCEPT) { - extensional(home, list, DFA()); - } else if (kind == Kind::REJECT) { - extensional(home, list, DFA(0, {{0, 0, 1}}, {1}, false)); + public: + SparseTupleSetIncremental(const std::string& name, int k) + : Test("Extensional::TupleSet::Sparse::Incremental" + name, 2, 0, k == 2 ? 1 : 3, false, Gecode::IPL_DOM), + kind(k), t(2) { + using namespace Gecode; + if (kind == 2) + t.add(IntArgs({0, 1})).add(IntArgs({1, 0})); + else + t.add(IntArgs({0, 0})).add(IntArgs({1, 1})).add(IntArgs({2, kind == 1 ? 1 : 2})).add(IntArgs({3, 3})); + t.finalize(EPK_SPARSE); + } + bool + solution(const Assignment& x) const override { + if (kind == 0) + return (x[0] == 2) && (x[1] == 2); + if (kind == 1) + return false; + return (x[0] == 1) && (x[1] == 0); + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + if (kind == 2) { + BoolVarArgs b(2); + for (int i = 0; i < 2; i++) + b[i] = channel(home, x[i]); + extensional(home, b, t, true, ipl); + rel(home, b[0], IRT_NQ, 0); + } else { + extensional(home, x, t, true, ipl); + if (kind == 0) { + rel(home, x[0], IRT_NQ, 0); + rel(home, x[0], IRT_NQ, 1); + rel(home, x[1], IRT_NQ, 3); } else { - extensional(home, list, DFA(0, {{0, 0, 0}}, std::initializer_list{}, false)); - } - if (kind != Kind::NO_FINALS) - list.close(home); - } - }; - - /// Check domain consistency of the regular constraint on a closed open list - class OpenRegularClosed : public Test { - public: - OpenRegularClosed(void) : Test("Extensional::OpenReg::Closed", 3, 0, 2, false, Gecode::IPL_DOM) {} - bool - solution(const Assignment& x) const override { - int parity = 0; - for (int i = 0; i < x.size(); i++) { - if (x[i] == 2) - return false; - parity ^= x[i]; + rel(home, x[0], IRT_EQ, 2); + rel(home, x[1], IRT_NQ, 1); } - return parity == 0; - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - OpenIntVarList list(home, x.size()); - for (int i = 0; i < x.size(); i++) - list.append(home, x[i]); - list.close(home); - DFA d(0, {{0, 0, 0}, {0, 1, 1}, {1, 0, 1}, {1, 1, 0}}, {0}, false); - extensional(home, list, d); } - }; + } + }; - ///% Transform a TupleSet into a DFA - Gecode::DFA - tuple_set_to_dfa(const Gecode::TupleSet& ts) { + /// Disabled sparse propagators must defer failure until re-enabled + class SparseTupleSetDisabledFailure : public ::Test::Base { + public: + SparseTupleSetDisabledFailure() : ::Test::Base("Int::Extensional::TupleSet::Sparse::DisabledFailure") {} + + bool + run() override { using namespace Gecode; - REG expression; - for (int i = 0; i < ts.tuples(); i++) { - REG r; - for (int j = 0; j < ts.arity(); j++) { - r += REG(ts[i][j]); + + class DisabledSpace : public Space { + public: + IntVarArray x; + DisabledSpace(const TupleSet& t) : x(*this, 2, 0, 1) { + extensional(*this, x, t, true, IPL_DOM); } - expression |= r; - } - DFA dfa(expression); - return dfa; - } - - /// %Test with tuple set - class TupleSetBase : public Test { - protected: - /// Simple test tupleset - Gecode::TupleSet t; - /// Whether the table is positive or negative - bool pos; - /// Support representation - Gecode::ExtensionalPropKind epk; - - public: - /// Create and register test - TupleSetBase(bool p, Gecode::ExtensionalPropKind epk0) - : Test(TestTags::sweep(), - "Extensional::TupleSet::" + extensional_kind_name(epk0) + "::" + str(p) + "::Base", 4, 1, 5, - true, Gecode::IPL_DOM), - t(4), pos(p), epk(epk0) { - using namespace Gecode; - IntArgs t1({2, 1, 2, 4}); - IntArgs t2({2, 2, 1, 4}); - IntArgs t3({4, 3, 4, 1}); - IntArgs t4({1, 3, 2, 3}); - IntArgs t5({3, 3, 3, 2}); - t.add(t1) - .add(t1) - .add(t2) - .add(t2) - .add(t3) - .add(t3) - .add(t4) - .add(t4) - .add(t5) - .add(t5) - .add(t5) - .add(t5) - .add(t5) - .add(t5) - .add(t5) - .add(t5) - .add(t1) - .add(t1) - .add(t2) - .add(t2) - .add(t3) - .add(t3) - .add(t4) - .add(t4) - .add(t5) - .add(t5) - .add(t5) - .add(t5) - .add(t5) - .add(t5) - .add(t5) - .add(t5) - .finalize(epk); - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return pos == ((x[0] == 1 && x[1] == 3 && x[2] == 2 && x[3] == 3) || - (x[0] == 2 && x[1] == 1 && x[2] == 2 && x[3] == 4) || - (x[0] == 2 && x[1] == 2 && x[2] == 1 && x[3] == 4) || - (x[0] == 3 && x[1] == 3 && x[2] == 3 && x[3] == 2) || - (x[0] == 4 && x[1] == 3 && x[2] == 4 && x[3] == 1)); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - TupleSet ts = TupleSet(t.arity(), tuple_set_to_dfa(t), epk); - assert(t == ts); - assert(ts.representation() == epk); - extensional(home, x, t, pos, ipl); - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - extensional(home, x, t, pos, r, ipl); - } - }; - - /// %Test with tuple set - class TupleSetTest : public Test { - protected: - /// Whether the table is positive or negative - bool pos; - /// Support representation - Gecode::ExtensionalPropKind epk; - /// The tuple set to use - Gecode::TupleSet ts; - /// Whether to validate dfa2tupleset - bool to_dfa; - - public: - /// Create and register test - TupleSetTest(const std::string& s, bool p, const Gecode::IntSet& d0, const Gecode::TupleSet& ts0, bool td, - Gecode::ExtensionalPropKind epk0, TestTags tags = TestTags::sweep()) - : Test(tags, "Extensional::TupleSet::" + extensional_kind_name(epk0) + "::" + str(p) + "::" + s, - ts0.arity(), d0, true, Gecode::IPL_DOM), - pos(p), epk(epk0), ts(ts0), to_dfa(td) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - using namespace Gecode; - for (int i = ts.tuples(); i--;) { - TupleSet::Tuple t = ts[i]; - bool same = true; - for (int j = 0; (j < ts.arity()) && same; j++) - if (t[j] != x[j]) - same = false; - if (same) - return pos; + DisabledSpace(DisabledSpace& s) : Space(s) { + x.update(*this, s.x); } - return !pos; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - if (to_dfa) { - TupleSet t = TupleSet(ts.arity(), tuple_set_to_dfa(ts), epk); - assert(ts == t); - assert(t.representation() == epk); + Space* + copy() override { + return new DisabledSpace(*this); } - extensional(home, x, ts, pos, ipl); - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - using namespace Gecode; - extensional(home, x, ts, pos, r, ipl); - } - }; - - class RandomTupleSetTest : public TupleSetTest { - public: - /// Create and register test - RandomTupleSetTest(const std::string& s, bool p, const Gecode::IntSet& d0, const Gecode::TupleSet& ts0, - Gecode::ExtensionalPropKind epk0) - : TupleSetTest(s, p, d0, ts0, false, epk0) { - test_search = false; + }; + + TupleSet ts(2); + ts.add(IntArgs({0, 0})).add(IntArgs({1, 1})); + ts.finalize(EPK_SPARSE); + + DisabledSpace* s = new DisabledSpace(ts); + if (s->status() == SS_FAILED) { + delete s; + return false; } - /// Create and register initial assignment - Assignment* - assignment(void) const override { - using namespace Gecode; - return new RandomAssignment(arity, dom, 1000, _rand); + PropagatorGroup::all.disable(*s); + rel(*s, s->x[0], IRT_EQ, 0); + rel(*s, s->x[1], IRT_EQ, 1); + if (s->status() == SS_FAILED) { + delete s; + return false; } - }; - - /// Sample both table tuples and arbitrary assignments in large domains. - class SparseAssignment : public RandomAssignment { - Gecode::TupleSet t; - void - tuple(Gecode::Support::RandomGenerator& rand) { - if ((a % 2) == 0) { - int row = rand(t.tuples()); - for (int i = 0; i < n; i++) - vals[i] = t[row][i]; + + PropagatorGroup::all.enable(*s); + const bool failed = (s->status() == SS_FAILED); + delete s; + return failed; + } + }; + + /// Sparse delta processing must depend on supports, not numeric width + class SparseTupleSetWideDelta : public ::Test::Base { + public: + SparseTupleSetWideDelta() : ::Test::Base("Int::Extensional::TupleSet::Sparse::WideDelta") {} + + bool + run() override { + using namespace Gecode; + + const int gap = 1000000000; + const int lower = gap / 2; + TupleSet ts(1); + ts.add(IntArgs({0})).add(IntArgs({gap})); + ts.finalize(EPK_SPARSE); + + class NegativeSpace : public Space { + public: + IntVar x; + NegativeSpace(const TupleSet& t, int gap0, int lower0) : x(*this, 0, gap0) { + extensional(*this, IntVarArgs({x}), t, false, IPL_DOM); + rel(*this, x, IRT_GQ, lower0); } - } + NegativeSpace(NegativeSpace& s) : Space(s) { + x.update(*this, s.x); + } + Space* + copy() override { + return new NegativeSpace(*this); + } + }; - public: - SparseAssignment(const Gecode::TupleSet& t0, const Gecode::IntSet& d, - Gecode::Support::RandomGenerator& rand) - : RandomAssignment(t0.arity(), d, 32, rand), t(t0) { - tuple(rand); - } - void - next(Gecode::Support::RandomGenerator& rand) override { - RandomAssignment::next(rand); - tuple(rand); + NegativeSpace* n = new NegativeSpace(ts, gap, lower); + if ((n->status() == SS_FAILED) || (n->x.min() != lower) || (n->x.max() != gap - 1)) { + delete n; + return false; } - }; - - /// Sparse tables with the original large support counts and arities. - class SparseTupleSet : public Test { - Gecode::TupleSet t; - - public: - SparseTupleSet(const std::string& name, int arity, int size) - : Test("Extensional::TupleSet::Sparse::" + name, arity, 0, size - 1, false, Gecode::IPL_DOM), t(arity) { - const int factors[] = {1, arity == 3 ? 7 : 3, arity == 3 ? 11 : 5, 7, 11, 13}; - for (int i = 0; i < size; i++) { - Gecode::IntArgs row(arity); - for (int j = 0; j < arity; j++) - row[j] = (i * factors[j]) % size; - t.add(row); + delete n; + + class ReifiedSpace : public Space { + public: + IntVar x; + BoolVar b; + ReifiedSpace(const TupleSet& t, int gap0, int lower0) : x(*this, 0, gap0), b(*this, 0, 1) { + extensional(*this, IntVarArgs({x}), t, true, Reify(b, RM_EQV), IPL_DOM); + rel(*this, x, IRT_GQ, lower0); } - t.finalize(Gecode::EPK_SPARSE); - test_search = false; - consistency_test_level = CTL_NONE; + ReifiedSpace(ReifiedSpace& s) : Space(s) { + x.update(*this, s.x); + b.update(*this, s.b); + } + Space* + copy() override { + return new ReifiedSpace(*this); + } + }; + + ReifiedSpace* r = new ReifiedSpace(ts, gap, lower); + const bool ok = + (r->status() != SS_FAILED) && (r->x.min() == lower) && (r->x.max() == gap) && !r->b.assigned(); + delete r; + return ok; + } + }; + + /// Sparse/compressed tuplesets should materialize only requested support + class TupleSetSingleRepresentation : public ::Test::Base { + public: + TupleSetSingleRepresentation() : ::Test::Base("Int::Extensional::TupleSet::Support::SingleRepresentation") {} + + bool + run() override { + using namespace Gecode; + TupleSet ts(2); + for (int i = 0; i < 100; i++) + ts.add(IntArgs({i, (i * 3) % 100})); + ts.finalize(EPK_SPARSE); + if (ts.representation() != EPK_SPARSE) { + std::cerr << "ERROR: Sparse support not available" << '\n' << std::flush; + return false; } - Assignment* - assignment(void) const override { - return new SparseAssignment(t, dom, _rand); + if (ts.fst(0)->supports(ts.words(), ts.fst(0)->min) != nullptr) { + std::cerr << "ERROR: Sparse range exposed dense support" << '\n' << std::flush; + return false; } - bool - solution(const Assignment& x) const override { - const int size = dom.max() + 1; - const int factors[] = {1, arity == 3 ? 7 : 3, arity == 3 ? 11 : 5, 7, 11, 13}; - for (int i = 1; i < arity; i++) - if (x[i] != (x[0] * factors[i]) % size) - return false; - return true; + + TupleSet tc(2); + for (int i = 0; i < 100; i++) + tc.add(IntArgs({i, (i * 7) % 100})); + tc.finalize(EPK_DENSE_COMPRESSED); + if (tc.representation() != EPK_DENSE_COMPRESSED) { + std::cerr << "ERROR: Compressed support not available" << '\n' << std::flush; + return false; } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::extensional(home, x, t, true, ipl); + if (tc.fst(0)->supports(tc.words(), tc.fst(0)->min) != nullptr) { + std::cerr << "ERROR: Compressed range exposed dense support" << '\n' << std::flush; + return false; } - }; - - /// The assignment harness needs one variable even for a nullary table. - class TupleSetNullary : public Test { - bool nonempty; - Gecode::TupleSet t; - - public: - TupleSetNullary(Gecode::ExtensionalPropKind epk, bool n) - : Test("Extensional::TupleSet::" + extensional_kind_name(epk) + "::Nullary::" + str(n), 1, 0, 0), - nonempty(n), t(0) { - // More copies of the empty tuple than the initial capacity of - // 1024 tuples, so that the tuple storage grows - if (nonempty) - for (int i = 0; i < 1025; i++) - t.add(Gecode::IntArgs(0)); - t.finalize(epk); + + TupleSet td(2); + for (int i = 0; i < 100; i++) + td.add(IntArgs({i, (i * 11) % 100})); + td.finalize(); + if (td.representation() != EPK_DENSE) { + std::cerr << "ERROR: Default finalize did not keep dense support" << '\n' << std::flush; + return false; } - bool - solution(const Assignment&) const override { - return nonempty; + if (td.fst(0)->supports(td.words(), td.fst(0)->min) == nullptr) { + std::cerr << "ERROR: Dense range lost support data" << '\n' << std::flush; + return false; } - void - post(Gecode::Space& home, Gecode::IntVarArray&) override { - Gecode::extensional(home, Gecode::IntVarArgs(), t, true, Gecode::IPL_DOM); + + TupleSet empty_sparse(2); + empty_sparse.finalize(EPK_SPARSE); + if (empty_sparse.representation() != EPK_SPARSE) { + std::cerr << "ERROR: Empty sparse table forgot representation" << '\n' << std::flush; + return false; } - }; - - /// Tells issued after posting exercise sparse advisor updates. - class SparseTupleSetIncremental : public Test { - int kind; - Gecode::TupleSet t; - - public: - SparseTupleSetIncremental(const std::string& name, int k) - : Test("Extensional::TupleSet::Sparse::Incremental" + name, 2, 0, k == 2 ? 1 : 3, false, - Gecode::IPL_DOM), - kind(k), t(2) { - using namespace Gecode; - if (kind == 2) - t.add(IntArgs({0, 1})).add(IntArgs({1, 0})); - else - t.add(IntArgs({0, 0})) - .add(IntArgs({1, 1})) - .add(IntArgs({2, kind == 1 ? 1 : 2})) - .add(IntArgs({3, 3})); - t.finalize(EPK_SPARSE); + TupleSet empty_compressed(2); + empty_compressed.finalize(EPK_DENSE_COMPRESSED); + if (empty_compressed.representation() != EPK_DENSE_COMPRESSED) { + std::cerr << "ERROR: Empty compressed table forgot representation" << '\n' << std::flush; + return false; } - bool - solution(const Assignment& x) const override { - if (kind == 0) - return (x[0] == 2) && (x[1] == 2); - if (kind == 1) - return false; - return (x[0] == 1) && (x[1] == 0); + return true; + } + }; + + /// Sparse offset arrays need a representable terminal entry + class TupleSetSupportOffsetBoundary : public ::Test::Base { + public: + TupleSetSupportOffsetBoundary() : ::Test::Base("Int::Extensional::TupleSet::Support::OffsetBoundary") {} + + bool + run() override { + using Gecode::Int::Extensional::support_offsets_size; + const unsigned long long max = static_cast(std::numeric_limits::max()); + unsigned int n_offsets = 0U; + if (!support_offsets_size(max - 1ULL, n_offsets) || (n_offsets != std::numeric_limits::max())) + return false; + if (support_offsets_size(max, n_offsets)) + return false; + return !support_offsets_size(max + 1ULL, n_offsets); + } + }; + + /// Failed finalization is terminal and cannot expose partial support data + class TupleSetTerminalFinalizationFailure : public ::Test::Base { + public: + TupleSetTerminalFinalizationFailure() : ::Test::Base("Int::Extensional::TupleSet::Support::TerminalFailure") {} + + bool + run() override { + using namespace Gecode; + + const int n = 371000; + TupleSet ts(2); + for (int i = 0; i < n; i++) + ts.add(IntArgs({i, n + i})); + + bool rejected = false; + try { + ts.finalize(EPK_DENSE); + } catch (const Gecode::Int::OutOfLimits&) { + rejected = true; } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - if (kind == 2) { - BoolVarArgs b(2); - for (int i = 0; i < 2; i++) - b[i] = channel(home, x[i]); - extensional(home, b, t, true, ipl); - rel(home, b[0], IRT_NQ, 0); - } else { - extensional(home, x, t, true, ipl); - if (kind == 0) { - rel(home, x[0], IRT_NQ, 0); - rel(home, x[0], IRT_NQ, 1); - rel(home, x[1], IRT_NQ, 3); - } else { - rel(home, x[0], IRT_EQ, 2); - rel(home, x[1], IRT_NQ, 1); - } - } + if (!rejected || !ts.failed() || ts.finalized()) + return false; + + try { + (void)ts.representation(); + return false; + } catch (const Gecode::Int::NotYetFinalized&) { + // Expected } - }; - - /// Disabled sparse propagators must defer failure until re-enabled - class SparseTupleSetDisabledFailure : public ::Test::Base { - public: - SparseTupleSetDisabledFailure(void) : ::Test::Base("Int::Extensional::TupleSet::Sparse::DisabledFailure") {} - - bool - run(void) override { - using namespace Gecode; - - class DisabledSpace : public Space { - public: - IntVarArray x; - DisabledSpace(const TupleSet& t) : x(*this, 2, 0, 1) { - extensional(*this, x, t, true, IPL_DOM); - } - DisabledSpace(DisabledSpace& s) : Space(s) { - x.update(*this, s.x); - } - Space* - copy(void) override { - return new DisabledSpace(*this); - } - }; - TupleSet ts(2); - ts.add(IntArgs({0, 0})).add(IntArgs({1, 1})); + try { ts.finalize(EPK_SPARSE); + return false; + } catch (const Gecode::Int::AlreadyFinalized&) { + // Expected + } - DisabledSpace* s = new DisabledSpace(ts); - if (s->status() == SS_FAILED) { - delete s; - return false; + try { + ts.add(IntArgs({0, 0})); + return false; + } catch (const Gecode::Int::AlreadyFinalized&) { + // Expected + } + + class PostingSpace : public Space { + public: + IntVarArray x; + PostingSpace(const TupleSet& t) : x(*this, 2, 0, 1) { + extensional(*this, x, t); } - PropagatorGroup::all.disable(*s); - rel(*s, s->x[0], IRT_EQ, 0); - rel(*s, s->x[1], IRT_EQ, 1); - if (s->status() == SS_FAILED) { - delete s; - return false; + PostingSpace(PostingSpace& s) : Space(s) { + x.update(*this, s.x); + } + Space* + copy() override { + return new PostingSpace(*this); } + }; - PropagatorGroup::all.enable(*s); - const bool failed = (s->status() == SS_FAILED); + try { + PostingSpace* s = new PostingSpace(ts); delete s; - return failed; + return false; + } catch (const Gecode::Int::NotYetFinalized&) { + // Expected } - }; + return true; + } + }; - /// Sparse delta processing must depend on supports, not numeric width - class SparseTupleSetWideDelta : public ::Test::Base { - public: - SparseTupleSetWideDelta(void) : ::Test::Base("Int::Extensional::TupleSet::Sparse::WideDelta") {} + /// DFA-derived tuple sets preserve the requested support representation + class TupleSetDFARepresentation : public ::Test::Base { + public: + TupleSetDFARepresentation() : ::Test::Base("Int::Extensional::TupleSet::Support::DFARepresentation") {} - bool - run(void) override { - using namespace Gecode; + bool + run() override { + using namespace Gecode; - const int gap = 1000000000; - const int lower = gap / 2; - TupleSet ts(1); - ts.add(IntArgs({0})).add(IntArgs({gap})); - ts.finalize(EPK_SPARSE); + DFA dfa((REG(0) + REG(1)) | (REG(2) + REG(3))); + TupleSet sparse(2, dfa, EPK_SPARSE); + if ((sparse.representation() != EPK_SPARSE) || (sparse.tuples() != 2)) + return false; - class NegativeSpace : public Space { - public: - IntVar x; - NegativeSpace(const TupleSet& t, int gap0, int lower0) : x(*this, 0, gap0) { - extensional(*this, IntVarArgs({x}), t, false, IPL_DOM); - rel(*this, x, IRT_GQ, lower0); - } - NegativeSpace(NegativeSpace& s) : Space(s) { - x.update(*this, s.x); - } - Space* - copy(void) override { - return new NegativeSpace(*this); - } - }; + TupleSet compressed(2, dfa, EPK_DENSE_COMPRESSED); + if ((compressed.representation() != EPK_DENSE_COMPRESSED) || (compressed.tuples() != 2)) + return false; - NegativeSpace* n = new NegativeSpace(ts, gap, lower); - if ((n->status() == SS_FAILED) || (n->x.min() != lower) || (n->x.max() != gap - 1)) { - delete n; - return false; - } - delete n; + TupleSet dense(2, dfa); + if ((dense.representation() != EPK_DENSE) || (dense.tuples() != 2)) + return false; - class ReifiedSpace : public Space { - public: - IntVar x; - BoolVar b; - ReifiedSpace(const TupleSet& t, int gap0, int lower0) : x(*this, 0, gap0), b(*this, 0, 1) { - extensional(*this, IntVarArgs({x}), t, true, Reify(b, RM_EQV), IPL_DOM); - rel(*this, x, IRT_GQ, lower0); - } - ReifiedSpace(ReifiedSpace& s) : Space(s) { - x.update(*this, s.x); - b.update(*this, s.b); - } - Space* - copy(void) override { - return new ReifiedSpace(*this); - } - }; + TupleSet empty(3, dfa, EPK_SPARSE); + return (empty.representation() == EPK_SPARSE) && (empty.tuples() == 0); + } + }; - ReifiedSpace* r = new ReifiedSpace(ts, gap, lower); - const bool ok = - (r->status() != SS_FAILED) && (r->x.min() == lower) && (r->x.max() == gap) && !r->b.assigned(); - delete r; - return ok; - } - }; + /// %Test for comparing finalized tuple sets + class TupleSetCompare : public ::Test::Base { + public: + TupleSetCompare() : ::Test::Base("Int::Extensional::TupleSet::Compare") {} - /// Sparse/compressed tuplesets should materialize only requested support - class TupleSetSingleRepresentation : public ::Test::Base { - public: - TupleSetSingleRepresentation(void) - : ::Test::Base("Int::Extensional::TupleSet::Support::SingleRepresentation") {} + bool + run() override { + using namespace Gecode; + TupleSet t(2), same(2), other(2); + t.add(IntArgs({0, 1})).add(IntArgs({1, 0})).finalize(); + same.add(IntArgs({0, 1})).add(IntArgs({1, 0})).finalize(); + other.add(IntArgs({0, 1})).finalize(); + TupleSet t_copy(t); + if (!compares_equal(t, same) || !compares_equal(t, t_copy) || !compares_unequal(t, other)) + return false; + // A bool on the left compares with the tuple set's bool + // conversion; TupleSet::operator!= keeps these unambiguous. + // NOLINTNEXTLINE(readability-simplify-boolean-expr) + return (true == t) && !(true != t); + } + }; + + /// %Test for comparing the bit-set words that tuple-set supports use + class BitSetDataCompare : public ::Test::Base { + public: + BitSetDataCompare() : ::Test::Base("Int::Extensional::BitSetData::Compare") {} + + bool + run() override { + using Gecode::Support::BitSetData; + BitSetData b, other; + b.init(false); + other.init(false); + BitSetData b_copy(b); + if (!compares_equal(b, other) || !compares_equal(b, b_copy)) + return false; + other.set(3); + return compares_unequal(b, other); + } + }; - bool - run(void) override { - using namespace Gecode; - TupleSet ts(2); - for (int i = 0; i < 100; i++) - ts.add(IntArgs({i, (i * 3) % 100})); - ts.finalize(EPK_SPARSE); - if (ts.representation() != EPK_SPARSE) { - std::cerr << "ERROR: Sparse support not available" << '\n' << std::flush; - return false; - } - if (ts.fst(0)->supports(ts.words(), ts.fst(0)->min) != nullptr) { - std::cerr << "ERROR: Sparse range exposed dense support" << '\n' << std::flush; - return false; - } + /// Disabled compact propagators preserve pending work when cloned + class TupleSetDisabledClone : public ::Test::Base { + public: + TupleSetDisabledClone() : ::Test::Base("Int::Extensional::TupleSet::Support::DisabledClone") {} - TupleSet tc(2); - for (int i = 0; i < 100; i++) - tc.add(IntArgs({i, (i * 7) % 100})); - tc.finalize(EPK_DENSE_COMPRESSED); - if (tc.representation() != EPK_DENSE_COMPRESSED) { - std::cerr << "ERROR: Compressed support not available" << '\n' << std::flush; - return false; - } - if (tc.fst(0)->supports(tc.words(), tc.fst(0)->min) != nullptr) { - std::cerr << "ERROR: Compressed range exposed dense support" << '\n' << std::flush; - return false; - } + bool + run() override { + using namespace Gecode; - TupleSet td(2); - for (int i = 0; i < 100; i++) - td.add(IntArgs({i, (i * 11) % 100})); - td.finalize(); - if (td.representation() != EPK_DENSE) { - std::cerr << "ERROR: Default finalize did not keep dense support" << '\n' << std::flush; - return false; + enum Mode { MODE_POSITIVE, MODE_NEGATIVE, MODE_REIFIED }; + + class CloneSpace : public Space { + public: + IntVarArray x; + BoolVar b; + CloneSpace(const TupleSet& t, Mode mode) : x(*this, 2, 0, 2), b(*this, 0, 1) { + if (mode == MODE_REIFIED) + extensional(*this, x, t, true, Reify(b, RM_EQV), IPL_DOM); + else + extensional(*this, x, t, mode == MODE_POSITIVE, IPL_DOM); } - if (td.fst(0)->supports(td.words(), td.fst(0)->min) == nullptr) { - std::cerr << "ERROR: Dense range lost support data" << '\n' << std::flush; - return false; + CloneSpace(CloneSpace& s) : Space(s) { + x.update(*this, s.x); + b.update(*this, s.b); } + Space* + copy() override { + return new CloneSpace(*this); + } + }; + + auto check = [](ExtensionalPropKind epk) { + TupleSet ts(2); + ts.add(IntArgs({0, 0})).add(IntArgs({1, 1})).add(IntArgs({2, 2})); + ts.finalize(epk); - TupleSet empty_sparse(2); - empty_sparse.finalize(EPK_SPARSE); - if (empty_sparse.representation() != EPK_SPARSE) { - std::cerr << "ERROR: Empty sparse table forgot representation" << '\n' << std::flush; + CloneSpace* source = new CloneSpace(ts, MODE_POSITIVE); + if (source->status() == SS_FAILED) { + delete source; return false; } - TupleSet empty_compressed(2); - empty_compressed.finalize(EPK_DENSE_COMPRESSED); - if (empty_compressed.representation() != EPK_DENSE_COMPRESSED) { - std::cerr << "ERROR: Empty compressed table forgot representation" << '\n' << std::flush; + PropagatorGroup::all.disable(*source); + rel(*source, source->x[0], IRT_EQ, 1); + if ((source->status() == SS_FAILED) || !source->x[0].assigned() || (source->x[0].val() != 1) || + (source->x[1].size() != 3)) { + delete source; return false; } - return true; - } - }; - - /// Sparse offset arrays need a representable terminal entry - class TupleSetSupportOffsetBoundary : public ::Test::Base { - public: - TupleSetSupportOffsetBoundary(void) : ::Test::Base("Int::Extensional::TupleSet::Support::OffsetBoundary") {} - - bool - run(void) override { - using Gecode::Int::Extensional::support_offsets_size; - const unsigned long long max = - static_cast(std::numeric_limits::max()); - unsigned int n_offsets = 0U; - if (!support_offsets_size(max - 1ULL, n_offsets) || - (n_offsets != std::numeric_limits::max())) - return false; - if (support_offsets_size(max, n_offsets)) - return false; - return !support_offsets_size(max + 1ULL, n_offsets); - } - }; - /// Failed finalization is terminal and cannot expose partial support data - class TupleSetTerminalFinalizationFailure : public ::Test::Base { - public: - TupleSetTerminalFinalizationFailure(void) - : ::Test::Base("Int::Extensional::TupleSet::Support::TerminalFailure") {} + CloneSpace* clone = static_cast(source->clone()); + PropagatorGroup::all.enable(*clone); + const bool clone_ok = + (clone->status() != SS_FAILED) && clone->x[1].assigned() && (clone->x[1].val() == 1); + delete clone; - bool - run(void) override { - using namespace Gecode; + PropagatorGroup::all.enable(*source); + const bool source_ok = + (source->status() != SS_FAILED) && source->x[1].assigned() && (source->x[1].val() == 1); + delete source; + return clone_ok && source_ok; + }; - const int n = 371000; + auto check_empty = [](ExtensionalPropKind epk, Mode mode) { TupleSet ts(2); - for (int i = 0; i < n; i++) - ts.add(IntArgs({i, n + i})); - - bool rejected = false; - try { - ts.finalize(EPK_DENSE); - } catch (const Gecode::Int::OutOfLimits&) { - rejected = true; - } - if (!rejected || !ts.failed() || ts.finalized()) - return false; + ts.add(IntArgs({0, 0})).add(IntArgs({1, 1})); + ts.finalize(epk); - try { - (void)ts.representation(); + CloneSpace* source = new CloneSpace(ts, mode); + if (source->status() == SS_FAILED) { + delete source; return false; - } catch (const Gecode::Int::NotYetFinalized&) { } - - try { - ts.finalize(EPK_SPARSE); - return false; - } catch (const Gecode::Int::AlreadyFinalized&) { + PropagatorGroup::all.disable(*source); + if (mode == MODE_NEGATIVE) { + rel(*source, source->x[0], IRT_EQ, 2); + } else { + rel(*source, source->x[0], IRT_EQ, 0); + rel(*source, source->x[1], IRT_EQ, 1); } - - try { - ts.add(IntArgs({0, 0})); + if (source->status() == SS_FAILED) { + delete source; return false; - } catch (const Gecode::Int::AlreadyFinalized&) { } - class PostingSpace : public Space { - public: - IntVarArray x; - PostingSpace(const TupleSet& t) : x(*this, 2, 0, 1) { - extensional(*this, x, t); - } - PostingSpace(PostingSpace& s) : Space(s) { - x.update(*this, s.x); - } - Space* - copy(void) override { - return new PostingSpace(*this); - } + auto verify = [mode](CloneSpace& s) { + const SpaceStatus status = s.status(); + if (mode == MODE_POSITIVE) + return status == SS_FAILED; + if (status == SS_FAILED) + return false; + if (mode == MODE_REIFIED) + return s.b.assigned() && (s.b.val() == 0); + return s.x[1].size() == 3; }; - try { - PostingSpace* s = new PostingSpace(ts); - delete s; - return false; - } catch (const Gecode::Int::NotYetFinalized&) { - } - return true; - } - }; - - /// DFA-derived tuple sets preserve the requested support representation - class TupleSetDFARepresentation : public ::Test::Base { - public: - TupleSetDFARepresentation(void) : ::Test::Base("Int::Extensional::TupleSet::Support::DFARepresentation") {} - - bool - run(void) override { - using namespace Gecode; - - DFA dfa((REG(0) + REG(1)) | (REG(2) + REG(3))); - TupleSet sparse(2, dfa, EPK_SPARSE); - if ((sparse.representation() != EPK_SPARSE) || (sparse.tuples() != 2)) - return false; - - TupleSet compressed(2, dfa, EPK_DENSE_COMPRESSED); - if ((compressed.representation() != EPK_DENSE_COMPRESSED) || (compressed.tuples() != 2)) - return false; + CloneSpace* clone = static_cast(source->clone()); + PropagatorGroup::all.enable(*clone); + const bool clone_ok = verify(*clone); + delete clone; - TupleSet dense(2, dfa); - if ((dense.representation() != EPK_DENSE) || (dense.tuples() != 2)) - return false; + PropagatorGroup::all.enable(*source); + const bool source_ok = verify(*source); + delete source; + return clone_ok && source_ok; + }; - TupleSet empty(3, dfa, EPK_SPARSE); - return (empty.representation() == EPK_SPARSE) && (empty.tuples() == 0); - } - }; - - /// %Test for comparing finalized tuple sets - class TupleSetCompare : public ::Test::Base { - public: - TupleSetCompare(void) : ::Test::Base("Int::Extensional::TupleSet::Compare") {} - - bool - run(void) override { - using namespace Gecode; - TupleSet t(2), same(2), other(2); - t.add(IntArgs({0, 1})).add(IntArgs({1, 0})).finalize(); - same.add(IntArgs({0, 1})).add(IntArgs({1, 0})).finalize(); - other.add(IntArgs({0, 1})).finalize(); - TupleSet t_copy(t); - if (!compares_equal(t, same) || !compares_equal(t, t_copy) || !compares_unequal(t, other)) + for (ExtensionalPropKind epk : {EPK_DENSE, EPK_DENSE_COMPRESSED}) { + if (!check(epk)) return false; - // A bool on the left compares with the tuple set's bool - // conversion; TupleSet::operator!= keeps these unambiguous. - return (true == t) && !(true != t); - } - }; - - /// %Test for comparing the bit-set words that tuple-set supports use - class BitSetDataCompare : public ::Test::Base { - public: - BitSetDataCompare(void) : ::Test::Base("Int::Extensional::BitSetData::Compare") {} - - bool - run(void) override { - using Gecode::Support::BitSetData; - BitSetData b, other; - b.init(false); - other.init(false); - BitSetData b_copy(b); - if (!compares_equal(b, other) || !compares_equal(b, b_copy)) - return false; - other.set(3); - return compares_unequal(b, other); - } - }; - - /// Disabled compact propagators preserve pending work when cloned - class TupleSetDisabledClone : public ::Test::Base { - public: - TupleSetDisabledClone(void) : ::Test::Base("Int::Extensional::TupleSet::Support::DisabledClone") {} - - bool - run(void) override { - using namespace Gecode; - - enum Mode { MODE_POSITIVE, MODE_NEGATIVE, MODE_REIFIED }; - - class CloneSpace : public Space { - public: - IntVarArray x; - BoolVar b; - CloneSpace(const TupleSet& t, Mode mode) : x(*this, 2, 0, 2), b(*this, 0, 1) { - if (mode == MODE_REIFIED) - extensional(*this, x, t, true, Reify(b, RM_EQV), IPL_DOM); - else - extensional(*this, x, t, mode == MODE_POSITIVE, IPL_DOM); - } - CloneSpace(CloneSpace& s) : Space(s) { - x.update(*this, s.x); - b.update(*this, s.b); - } - Space* - copy(void) override { - return new CloneSpace(*this); - } - }; - - auto check = [](ExtensionalPropKind epk) { - TupleSet ts(2); - ts.add(IntArgs({0, 0})).add(IntArgs({1, 1})).add(IntArgs({2, 2})); - ts.finalize(epk); - - CloneSpace* source = new CloneSpace(ts, MODE_POSITIVE); - if (source->status() == SS_FAILED) { - delete source; - return false; - } - PropagatorGroup::all.disable(*source); - rel(*source, source->x[0], IRT_EQ, 1); - if ((source->status() == SS_FAILED) || !source->x[0].assigned() || (source->x[0].val() != 1) || - (source->x[1].size() != 3)) { - delete source; + for (Mode mode : {MODE_POSITIVE, MODE_NEGATIVE, MODE_REIFIED}) + if (!check_empty(epk, mode)) return false; - } - - CloneSpace* clone = static_cast(source->clone()); - PropagatorGroup::all.enable(*clone); - const bool clone_ok = - (clone->status() != SS_FAILED) && clone->x[1].assigned() && (clone->x[1].val() == 1); - delete clone; - - PropagatorGroup::all.enable(*source); - const bool source_ok = - (source->status() != SS_FAILED) && source->x[1].assigned() && (source->x[1].val() == 1); - delete source; - return clone_ok && source_ok; - }; + } + return true; + } + }; - auto check_empty = [](ExtensionalPropKind epk, Mode mode) { - TupleSet ts(2); - ts.add(IntArgs({0, 0})).add(IntArgs({1, 1})); - ts.finalize(epk); + /// AUTO finalization should work with default tuple-set posting overloads + class TupleSetAutoDefaultDispatch : public ::Test::Base { + public: + TupleSetAutoDefaultDispatch() + : ::Test::Base("Int::Extensional::TupleSet::Auto::DefaultDispatch", TestTags::check()) {} - CloneSpace* source = new CloneSpace(ts, mode); - if (source->status() == SS_FAILED) { - delete source; - return false; - } - PropagatorGroup::all.disable(*source); - if (mode == MODE_NEGATIVE) { - rel(*source, source->x[0], IRT_EQ, 2); - } else { - rel(*source, source->x[0], IRT_EQ, 0); - rel(*source, source->x[1], IRT_EQ, 1); - } - if (source->status() == SS_FAILED) { - delete source; - return false; - } + bool + run() override { + using namespace Gecode; - auto verify = [mode](CloneSpace& s) { - const SpaceStatus status = s.status(); - if (mode == MODE_POSITIVE) - return status == SS_FAILED; - if (status == SS_FAILED) - return false; - if (mode == MODE_REIFIED) - return s.b.assigned() && (s.b.val() == 0); - return s.x[1].size() == 3; - }; - - CloneSpace* clone = static_cast(source->clone()); - PropagatorGroup::all.enable(*clone); - const bool clone_ok = verify(*clone); - delete clone; - - PropagatorGroup::all.enable(*source); - const bool source_ok = verify(*source); - delete source; - return clone_ok && source_ok; - }; + TupleSet dense(2); + dense.add(IntArgs({0, 0})).add(IntArgs({1, 1})); + dense.finalize(EPK_AUTO); + if (dense.representation() != EPK_DENSE) { + std::cerr << "ERROR: Small AUTO table did not select dense" << '\n' << std::flush; + return false; + } - for (ExtensionalPropKind epk : {EPK_DENSE, EPK_DENSE_COMPRESSED}) { - if (!check(epk)) - return false; - for (Mode mode : {MODE_POSITIVE, MODE_NEGATIVE, MODE_REIFIED}) - if (!check_empty(epk, mode)) - return false; + class PositiveSpace : public Space { + public: + IntVarArray x; + PositiveSpace(const TupleSet& t) : x(*this, 2, 0, 1) { + extensional(*this, x, t); + branch(*this, x, INT_VAR_NONE(), INT_VAL_MIN()); } - return true; - } - }; - - /// AUTO finalization should work with default tuple-set posting overloads - class TupleSetAutoDefaultDispatch : public ::Test::Base { - public: - TupleSetAutoDefaultDispatch(void) - : ::Test::Base("Int::Extensional::TupleSet::Auto::DefaultDispatch", TestTags::check()) {} - - bool - run(void) override { - using namespace Gecode; - - TupleSet dense(2); - dense.add(IntArgs({0, 0})).add(IntArgs({1, 1})); - dense.finalize(EPK_AUTO); - if (dense.representation() != EPK_DENSE) { - std::cerr << "ERROR: Small AUTO table did not select dense" << '\n' << std::flush; - return false; + PositiveSpace(PositiveSpace& s) : Space(s) { + x.update(*this, s.x); } - - class PositiveSpace : public Space { - public: - IntVarArray x; - PositiveSpace(const TupleSet& t) : x(*this, 2, 0, 1) { - extensional(*this, x, t); - branch(*this, x, INT_VAR_NONE(), INT_VAL_MIN()); - } - PositiveSpace(PositiveSpace& s) : Space(s) { - x.update(*this, s.x); - } - Space* - copy(void) override { - return new PositiveSpace(*this); - } - }; - - PositiveSpace* dense_root = new PositiveSpace(dense); - DFS dense_engine(dense_root); - delete dense_root; - int dense_solutions = 0; - while (PositiveSpace* sol = dense_engine.next()) { - if (sol->x[0].val() != sol->x[1].val()) { - delete sol; - return false; - } - dense_solutions++; - delete sol; + Space* + copy() override { + return new PositiveSpace(*this); } - if (dense_solutions != 2) - return false; - - const int n = 5000; - TupleSet compressed(2); - for (int i = 0; i < n; i++) - compressed.add(IntArgs({i, (i * 7) % n})); - compressed.finalize(EPK_AUTO); - if (compressed.representation() != EPK_DENSE_COMPRESSED) { - std::cerr << "ERROR: Large AUTO table did not select compressed" << '\n' << std::flush; + }; + + PositiveSpace* dense_root = new PositiveSpace(dense); + DFS dense_engine(dense_root); + delete dense_root; + int dense_solutions = 0; + while (PositiveSpace* sol = dense_engine.next()) { + if (sol->x[0].val() != sol->x[1].val()) { + delete sol; return false; } + dense_solutions++; + delete sol; + } + if (dense_solutions != 2) + return false; - class ReifiedSpace : public Space { - public: - IntVarArray x; - BoolVar b; - ReifiedSpace(const TupleSet& t, int n0) : x(*this, 2, 0, n0 - 1), b(*this, 0, 1) { - extensional(*this, x, t, Reify(b, RM_EQV)); - rel(*this, b, IRT_EQ, 1); - rel(*this, x[0], IRT_EQ, 3); - branch(*this, x, INT_VAR_NONE(), INT_VAL_MIN()); - } - ReifiedSpace(ReifiedSpace& s) : Space(s) { - x.update(*this, s.x); - b.update(*this, s.b); - } - Space* - copy(void) override { - return new ReifiedSpace(*this); - } - }; - - ReifiedSpace* compressed_root = new ReifiedSpace(compressed, n); - DFS compressed_engine(compressed_root); - delete compressed_root; - ReifiedSpace* compressed_sol = compressed_engine.next(); - if (compressed_sol == nullptr) - return false; - const bool ok = (compressed_sol->x[0].val() == 3) && (compressed_sol->x[1].val() == ((3 * 7) % n)); - delete compressed_sol; - ReifiedSpace* extra = compressed_engine.next(); - const bool no_extra = (extra == nullptr); - delete extra; - return ok && no_extra; + const int n = 5000; + TupleSet compressed(2); + for (int i = 0; i < n; i++) + compressed.add(IntArgs({i, (i * 7) % n})); + compressed.finalize(EPK_AUTO); + if (compressed.representation() != EPK_DENSE_COMPRESSED) { + std::cerr << "ERROR: Large AUTO table did not select compressed" << '\n' << std::flush; + return false; } - }; - - /// Dense-compressed iterators should skip unsupported value gaps - class DenseCompressedTupleSetWideGap : public ::Test::Base { - public: - DenseCompressedTupleSetWideGap(void) - : ::Test::Base("Int::Extensional::TupleSet::DenseCompressed::WideGap") {} - - bool - run(void) override { - using namespace Gecode; - - const int gap = 1000000000; - TupleSet ts(1); - ts.add(IntArgs({0})).add(IntArgs({gap})); - ts.finalize(EPK_DENSE_COMPRESSED); - - class NegativeSpace : public Space { - public: - IntVar x; - NegativeSpace(const TupleSet& t, int gap0) : x(*this, 0, gap0) { - extensional(*this, IntVarArgs({x}), t, false, IPL_DOM); - } - NegativeSpace(NegativeSpace& s) : Space(s) { - x.update(*this, s.x); - } - Space* - copy(void) override { - return new NegativeSpace(*this); - } - }; - NegativeSpace* ns = new NegativeSpace(ts, gap); - if (ns->status() == SS_FAILED) { - delete ns; - return false; + class ReifiedSpace : public Space { + public: + IntVarArray x; + BoolVar b; + ReifiedSpace(const TupleSet& t, int n0) : x(*this, 2, 0, n0 - 1), b(*this, 0, 1) { + extensional(*this, x, t, Reify(b, RM_EQV)); + rel(*this, b, IRT_EQ, 1); + rel(*this, x[0], IRT_EQ, 3); + branch(*this, x, INT_VAR_NONE(), INT_VAL_MIN()); } - if (ns->x.in(0) || ns->x.in(gap)) { - delete ns; - return false; + ReifiedSpace(ReifiedSpace& s) : Space(s) { + x.update(*this, s.x); + b.update(*this, s.b); } - delete ns; + Space* + copy() override { + return new ReifiedSpace(*this); + } + }; - class ReifiedSpace : public Space { - public: - IntVar x; - BoolVar b; - ReifiedSpace(const TupleSet& t, int gap0, bool force) : x(*this, 0, gap0), b(*this, 0, 1) { - extensional(*this, IntVarArgs({x}), t, true, Reify(b, RM_EQV), IPL_DOM); - if (force) { - rel(*this, b, IRT_EQ, 1); - rel(*this, x, IRT_EQ, 0); - } - } - ReifiedSpace(ReifiedSpace& s) : Space(s) { - x.update(*this, s.x); - b.update(*this, s.b); - } - Space* - copy(void) override { - return new ReifiedSpace(*this); - } - }; + ReifiedSpace* compressed_root = new ReifiedSpace(compressed, n); + DFS compressed_engine(compressed_root); + delete compressed_root; + ReifiedSpace* compressed_sol = compressed_engine.next(); + if (compressed_sol == nullptr) + return false; + const bool ok = (compressed_sol->x[0].val() == 3) && (compressed_sol->x[1].val() == ((3 * 7) % n)); + delete compressed_sol; + ReifiedSpace* extra = compressed_engine.next(); + const bool no_extra = (extra == nullptr); + delete extra; + return ok && no_extra; + } + }; - ReifiedSpace* rs = new ReifiedSpace(ts, gap, false); - if (rs->status() == SS_FAILED) { - delete rs; - return false; - } - delete rs; + /// Dense-compressed iterators should skip unsupported value gaps + class DenseCompressedTupleSetWideGap : public ::Test::Base { + public: + DenseCompressedTupleSetWideGap() : ::Test::Base("Int::Extensional::TupleSet::DenseCompressed::WideGap") {} - ReifiedSpace* rfs = new ReifiedSpace(ts, gap, true); - if (rfs->status() == SS_FAILED) { - delete rfs; - return false; - } - if (!rfs->x.assigned() || (rfs->x.val() != 0) || !rfs->b.assigned() || (rfs->b.val() != 1)) { - delete rfs; - return false; - } - delete rfs; + bool + run() override { + using namespace Gecode; - class PositiveDeltaSpace : public Space { - public: - IntVar x; - PositiveDeltaSpace(const TupleSet& t, int gap0) : x(*this, 0, gap0) { - extensional(*this, IntVarArgs({x}), t, true, IPL_DOM); - rel(*this, x, IRT_NQ, 0); - } - PositiveDeltaSpace(PositiveDeltaSpace& s) : Space(s) { - x.update(*this, s.x); - } - Space* - copy(void) override { - return new PositiveDeltaSpace(*this); - } - }; + const int gap = 1000000000; + TupleSet ts(1); + ts.add(IntArgs({0})).add(IntArgs({gap})); + ts.finalize(EPK_DENSE_COMPRESSED); - PositiveDeltaSpace* ps = new PositiveDeltaSpace(ts, gap); - if (ps->status() == SS_FAILED) { - delete ps; - return false; + class NegativeSpace : public Space { + public: + IntVar x; + NegativeSpace(const TupleSet& t, int gap0) : x(*this, 0, gap0) { + extensional(*this, IntVarArgs({x}), t, false, IPL_DOM); } - if (!ps->x.assigned() || (ps->x.val() != gap)) { - delete ps; - return false; + NegativeSpace(NegativeSpace& s) : Space(s) { + x.update(*this, s.x); } - delete ps; + Space* + copy() override { + return new NegativeSpace(*this); + } + }; - return true; + NegativeSpace* ns = new NegativeSpace(ts, gap); + if (ns->status() == SS_FAILED) { + delete ns; + return false; } - }; - - /// %Test with large tuple set - class TupleSetLarge : public Test { - protected: - /// Whether the table is positive or negative - bool pos; - /// Support representation - Gecode::ExtensionalPropKind epk; - /// Tupleset used for testing - mutable Gecode::TupleSet t; - - public: - /// Create and register test - TupleSetLarge(double prob, bool p, Gecode::ExtensionalPropKind epk0) - : Test(TestTags::sweep(), - "Extensional::TupleSet::" + extensional_kind_name(epk0) + "::" + str(p) + "::Large", 5, 1, 5, - true, Gecode::IPL_DOM), - pos(p), epk(epk0), t(5) { - using namespace Gecode; - - CpltAssignment ass(5, IntSet(1, 5)); - while (ass.has_more()) { - if (_rand(100) <= prob * 100) { - IntArgs tuple(5); - for (int i = 5; i--;) - tuple[i] = ass[i]; - t.add(tuple); + if (ns->x.in(0) || ns->x.in(gap)) { + delete ns; + return false; + } + delete ns; + + class ReifiedSpace : public Space { + public: + IntVar x; + BoolVar b; + ReifiedSpace(const TupleSet& t, int gap0, bool force) : x(*this, 0, gap0), b(*this, 0, 1) { + extensional(*this, IntVarArgs({x}), t, true, Reify(b, RM_EQV), IPL_DOM); + if (force) { + rel(*this, b, IRT_EQ, 1); + rel(*this, x, IRT_EQ, 0); } - ass.next(_rand); } - t.finalize(epk); - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - using namespace Gecode; - for (int i = 0; i < t.tuples(); ++i) { - TupleSet::Tuple l = t[i]; - bool same = true; - for (int j = 0; j < t.arity() && same; ++j) - if (l[j] != x[j]) - same = false; - if (same) - return pos; + ReifiedSpace(ReifiedSpace& s) : Space(s) { + x.update(*this, s.x); + b.update(*this, s.b); } - return !pos; + Space* + copy() override { + return new ReifiedSpace(*this); + } + }; + + ReifiedSpace* rs = new ReifiedSpace(ts, gap, false); + if (rs->status() == SS_FAILED) { + delete rs; + return false; } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - extensional(home, x, t, pos, ipl); + delete rs; + + ReifiedSpace* rfs = new ReifiedSpace(ts, gap, true); + if (rfs->status() == SS_FAILED) { + delete rfs; + return false; } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - using namespace Gecode; - extensional(home, x, t, pos, r, ipl); + if (!rfs->x.assigned() || (rfs->x.val() != 0) || !rfs->b.assigned() || (rfs->b.val() != 1)) { + delete rfs; + return false; } - }; - - /// %Test with bool tuple set - class TupleSetBool : public Test { - protected: - /// Whether the table is positive or negative - bool pos; - /// Support representation - Gecode::ExtensionalPropKind epk; - /// Tupleset used for testing - mutable Gecode::TupleSet t; - - public: - /// Create and register test - TupleSetBool(double prob, bool p, Gecode::ExtensionalPropKind epk0) - : Test(TestTags::sweep(), - "Extensional::TupleSet::" + extensional_kind_name(epk0) + "::" + str(p) + "::Bool", 5, 0, 1, - true), - pos(p), epk(epk0), t(5) { - using namespace Gecode; - - CpltAssignment ass(5, IntSet(0, 1)); - while (ass.has_more()) { - if (_rand(100) <= prob * 100) { - IntArgs tuple(5); - for (int i = 5; i--;) - tuple[i] = ass[i]; - t.add(tuple); - } - ass.next(_rand); + delete rfs; + + class PositiveDeltaSpace : public Space { + public: + IntVar x; + PositiveDeltaSpace(const TupleSet& t, int gap0) : x(*this, 0, gap0) { + extensional(*this, IntVarArgs({x}), t, true, IPL_DOM); + rel(*this, x, IRT_NQ, 0); } - t.finalize(epk); - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - using namespace Gecode; - for (int i = 0; i < t.tuples(); ++i) { - TupleSet::Tuple l = t[i]; - bool same = true; - for (int j = 0; j < t.arity() && same; ++j) - if (l[j] != x[j]) - same = false; - if (same) - return pos; + PositiveDeltaSpace(PositiveDeltaSpace& s) : Space(s) { + x.update(*this, s.x); } - return !pos; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - BoolVarArgs y(x.size()); - for (int i = x.size(); i--;) - y[i] = channel(home, x[i]); - extensional(home, y, t, pos, ipl); + Space* + copy() override { + return new PositiveDeltaSpace(*this); + } + }; + + PositiveDeltaSpace* ps = new PositiveDeltaSpace(ts, gap); + if (ps->status() == SS_FAILED) { + delete ps; + return false; } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - using namespace Gecode; - BoolVarArgs y(x.size()); - for (int i = x.size(); i--;) - y[i] = channel(home, x[i]); - extensional(home, y, t, pos, r, ipl); + if (!ps->x.assigned() || (ps->x.val() != gap)) { + delete ps; + return false; } - }; - - /// Help class to create and register tests with a fixed table size - class TupleSetTestSize { - public: - /// Perform creation and registration - TupleSetTestSize(int size, bool pos, Gecode::ExtensionalPropKind epk, - Gecode::Support::RandomGenerator& rand) { - using namespace Gecode; - /// Find the arity needed for creating sufficient number of tuples - int arity = 2; - int n_tuples = 5 * 5; - while (n_tuples < size) { - arity++; - n_tuples *= 5; - } - /// Build TupleSet - TupleSet ts(arity); - CpltAssignment ass(arity, IntSet(0, 4)); - for (int i = size; i--;) { - assert(ass.has_more()); - IntArgs tuple(arity); - for (int j = arity; j--;) - tuple[j] = ass[j]; - ts.add(tuple); - ass.next(rand); + delete ps; + + return true; + } + }; + + /// %Test with large tuple set + class TupleSetLarge : public Test { + protected: + /// Whether the table is positive or negative + bool pos; + /// Support representation + Gecode::ExtensionalPropKind epk; + /// Tupleset used for testing + mutable Gecode::TupleSet t; + + public: + /// Create and register test + TupleSetLarge(double prob, bool p, Gecode::ExtensionalPropKind epk0) + : Test(TestTags::sweep(), + "Extensional::TupleSet::" + extensional_kind_name(epk0) + "::" + str(p) + "::Large", 5, 1, 5, true, + Gecode::IPL_DOM), + pos(p), epk(epk0), t(5) { + using namespace Gecode; + + CpltAssignment ass(5, IntSet(1, 5)); + while (ass.has_more()) { + if (_rand(100) <= prob * 100) { + IntArgs tuple(5); + for (int i = 5; i--;) + tuple[i] = ass[i]; + t.add(tuple); } - ts.finalize(epk); - assert(ts.tuples() == size); - // Create and register test - (void)new TupleSetTest(std::to_string(size), pos, IntSet(0, 4), ts, size <= 128, epk); + ass.next(_rand); } - }; - - Gecode::TupleSet - random_tuple_set(int n, int min, int max, double prob, Gecode::ExtensionalPropKind epk, - Gecode::Support::RandomGenerator& rand) { + t.finalize(epk); + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + using namespace Gecode; + for (int i = 0; i < t.tuples(); ++i) { + TupleSet::Tuple l = t[i]; + bool same = true; + for (int j = 0; j < t.arity() && same; ++j) + if (l[j] != x[j]) + same = false; + if (same) + return pos; + } + return !pos; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + extensional(home, x, t, pos, ipl); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + using namespace Gecode; + extensional(home, x, t, pos, r, ipl); + } + }; + + /// %Test with bool tuple set + class TupleSetBool : public Test { + protected: + /// Whether the table is positive or negative + bool pos; + /// Support representation + Gecode::ExtensionalPropKind epk; + /// Tupleset used for testing + mutable Gecode::TupleSet t; + + public: + /// Create and register test + TupleSetBool(double prob, bool p, Gecode::ExtensionalPropKind epk0) + : Test(TestTags::sweep(), + "Extensional::TupleSet::" + extensional_kind_name(epk0) + "::" + str(p) + "::Bool", 5, 0, 1, true), + pos(p), epk(epk0), t(5) { using namespace Gecode; - TupleSet t(n); - CpltAssignment ass(n, IntSet(min, max)); + + CpltAssignment ass(5, IntSet(0, 1)); while (ass.has_more()) { - if (rand(100) <= prob * 100) { - IntArgs tuple(n); - for (int i = n; i--;) + if (_rand(100) <= prob * 100) { + IntArgs tuple(5); + for (int i = 5; i--;) tuple[i] = ass[i]; t.add(tuple); } - ass.next(rand); + ass.next(_rand); } t.finalize(epk); - return t; - } - - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - // This code is executed on load, and thus a random number generator source from the supplied - // seed is not available. - // In order to get interesting data her, but still have deterministic and repeatable execution, a fixed seed - // is used for a local random number generator. - // TODO: Make this code later on test run, and use the supplied seed/random number generator. - Gecode::Support::RandomGenerator rand(42); - - using namespace Gecode; - for (ExtensionalPropKind epk : {EPK_DENSE, EPK_SPARSE, EPK_DENSE_COMPRESSED}) { - for (bool pos : {false, true}) { - { - TupleSet ts(4); - ts.add({2, 1, 2, 4}) - .add({2, 2, 1, 4}) - .add({4, 3, 4, 1}) - .add({1, 3, 2, 3}) - .add({3, 3, 3, 2}) - .add({5, 1, 4, 4}) - .add({2, 5, 1, 5}) - .add({4, 3, 5, 1}) - .add({1, 5, 2, 5}) - .add({5, 3, 3, 2}) - .finalize(epk); - (void)new TupleSetTest("A", pos, IntSet(0, 6), ts, true, epk); - } - { - TupleSet ts(4); - ts.finalize(epk); - (void)new TupleSetTest("Empty", pos, IntSet(1, 2), ts, true, epk); - } - { - TupleSet ts(4); - for (int n = 1024 * 16; n--;) - ts.add({1, 2, 3, 4}); - ts.finalize(epk); - (void)new TupleSetTest("Assigned", pos, IntSet(1, 4), ts, true, epk); - } - { - TupleSet ts(1); - ts.add({1}).add({2}).add({3}).finalize(epk); - (void)new TupleSetTest("Single", pos, IntSet(-4, 4), ts, true, epk); - } - { - int m = Gecode::Int::Limits::min; - TupleSet ts(3); - ts.add({m + 0, m + 1, m + 2}) - .add({m + 4, m + 1, m + 3}) - .add({m + 2, m + 3, m + 0}) - .add({m + 2, m + 3, m + 0}) - .add({m + 1, m + 2, m + 5}) - .add({m + 2, m + 3, m + 0}) - .add({m + 3, m + 6, m + 5}) - .finalize(epk); - (void)new TupleSetTest("Min", pos, IntSet(m, m + 7), ts, true, epk); - } - { - int m = Gecode::Int::Limits::max; - TupleSet ts(3); - ts.add({m - 0, m - 1, m - 2}) - .add({m - 4, m - 1, m - 3}) - .add({m - 2, m - 3, m - 0}) - .add({m - 2, m - 3, m - 0}) - .add({m - 1, m - 2, m - 5}) - .add({m - 2, m - 3, m - 0}) - .add({m - 3, m - 6, m - 5}) - .finalize(epk); - (void)new TupleSetTest("Max", pos, IntSet(m - 7, m), ts, true, epk); - } - { - int lower_limit = Gecode::Int::Limits::min; - int upper_limit = Gecode::Int::Limits::max; - TupleSet ts(3); - ts.add({upper_limit - 0, lower_limit + 1, upper_limit - 2}) - .add({lower_limit + 4, upper_limit - 1, upper_limit - 3}) - .add({lower_limit + 2, upper_limit - 3, lower_limit + 0}) - .add({upper_limit - 2, upper_limit - 3, upper_limit - 0}) - .finalize(epk); - (void)new TupleSetTest("MinMax", pos, - IntSet(IntArgs({lower_limit, lower_limit + 1, lower_limit + 4, - upper_limit - 3, upper_limit - 2, upper_limit})), - ts, true, epk); - } - { - TupleSet ts(7); - const int triangle_tuples = (epk == EPK_DENSE) ? 10000 : 1000; - for (int i = 0; i < triangle_tuples; i++) { - IntArgs tuple(7); - for (int j = 0; j < 7; j++) { - tuple[j] = rand(j + 1); - } - ts.add(tuple); + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + using namespace Gecode; + for (int i = 0; i < t.tuples(); ++i) { + TupleSet::Tuple l = t[i]; + bool same = true; + for (int j = 0; j < t.arity() && same; ++j) + if (l[j] != x[j]) + same = false; + if (same) + return pos; + } + return !pos; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + BoolVarArgs y(x.size()); + for (int i = x.size(); i--;) + y[i] = channel(home, x[i]); + extensional(home, y, t, pos, ipl); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + using namespace Gecode; + BoolVarArgs y(x.size()); + for (int i = x.size(); i--;) + y[i] = channel(home, x[i]); + extensional(home, y, t, pos, r, ipl); + } + }; + + /// Help class to create and register tests with a fixed table size + class TupleSetTestSize { + public: + /// Perform creation and registration + TupleSetTestSize(int size, bool pos, Gecode::ExtensionalPropKind epk, Gecode::Support::RandomGenerator& rand) { + using namespace Gecode; + /// Find the arity needed for creating sufficient number of tuples + int arity = 2; + int n_tuples = 5 * 5; + while (n_tuples < size) { + arity++; + n_tuples *= 5; + } + /// Build TupleSet + TupleSet ts(arity); + CpltAssignment ass(arity, IntSet(0, 4)); + for (int i = size; i--;) { + assert(ass.has_more()); + IntArgs tuple(arity); + for (int j = arity; j--;) + tuple[j] = ass[j]; + ts.add(tuple); + ass.next(rand); + } + ts.finalize(epk); + assert(ts.tuples() == size); + // Create and register test + (void)new TupleSetTest(std::to_string(size), pos, IntSet(0, 4), ts, size <= 128, epk); + } + }; + + static Gecode::TupleSet + random_tuple_set(int n, int min, int max, double prob, Gecode::ExtensionalPropKind epk, + Gecode::Support::RandomGenerator& rand) { + using namespace Gecode; + TupleSet t(n); + CpltAssignment ass(n, IntSet(min, max)); + while (ass.has_more()) { + if (rand(100) <= prob * 100) { + IntArgs tuple(n); + for (int i = n; i--;) + tuple[i] = ass[i]; + t.add(tuple); + } + ass.next(rand); + } + t.finalize(epk); + return t; + } + + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + // This code is executed on load, and thus a random number generator source from the supplied + // seed is not available. + // In order to get interesting data her, but still have deterministic and repeatable execution, a fixed seed + // is used for a local random number generator. + // TODO: Make this code later on test run, and use the supplied seed/random number generator. + Gecode::Support::RandomGenerator rand(42); + + using namespace Gecode; + for (ExtensionalPropKind epk : {EPK_DENSE, EPK_SPARSE, EPK_DENSE_COMPRESSED}) { + for (bool pos : {false, true}) { + { + TupleSet ts(4); + ts.add({2, 1, 2, 4}) + .add({2, 2, 1, 4}) + .add({4, 3, 4, 1}) + .add({1, 3, 2, 3}) + .add({3, 3, 3, 2}) + .add({5, 1, 4, 4}) + .add({2, 5, 1, 5}) + .add({4, 3, 5, 1}) + .add({1, 5, 2, 5}) + .add({5, 3, 3, 2}) + .finalize(epk); + (void)new TupleSetTest("A", pos, IntSet(0, 6), ts, true, epk); + } + { + TupleSet ts(4); + ts.finalize(epk); + (void)new TupleSetTest("Empty", pos, IntSet(1, 2), ts, true, epk); + } + { + TupleSet ts(4); + for (int n = 1024 * 16; n--;) + ts.add({1, 2, 3, 4}); + ts.finalize(epk); + (void)new TupleSetTest("Assigned", pos, IntSet(1, 4), ts, true, epk); + } + { + TupleSet ts(1); + ts.add({1}).add({2}).add({3}).finalize(epk); + (void)new TupleSetTest("Single", pos, IntSet(-4, 4), ts, true, epk); + } + { + int m = Gecode::Int::Limits::min; + TupleSet ts(3); + ts.add({m + 0, m + 1, m + 2}) + .add({m + 4, m + 1, m + 3}) + .add({m + 2, m + 3, m + 0}) + .add({m + 2, m + 3, m + 0}) + .add({m + 1, m + 2, m + 5}) + .add({m + 2, m + 3, m + 0}) + .add({m + 3, m + 6, m + 5}) + .finalize(epk); + (void)new TupleSetTest("Min", pos, IntSet(m, m + 7), ts, true, epk); + } + { + int m = Gecode::Int::Limits::max; + TupleSet ts(3); + ts.add({m - 0, m - 1, m - 2}) + .add({m - 4, m - 1, m - 3}) + .add({m - 2, m - 3, m - 0}) + .add({m - 2, m - 3, m - 0}) + .add({m - 1, m - 2, m - 5}) + .add({m - 2, m - 3, m - 0}) + .add({m - 3, m - 6, m - 5}) + .finalize(epk); + (void)new TupleSetTest("Max", pos, IntSet(m - 7, m), ts, true, epk); + } + { + int lower_limit = Gecode::Int::Limits::min; + int upper_limit = Gecode::Int::Limits::max; + TupleSet ts(3); + ts.add({upper_limit - 0, lower_limit + 1, upper_limit - 2}) + .add({lower_limit + 4, upper_limit - 1, upper_limit - 3}) + .add({lower_limit + 2, upper_limit - 3, lower_limit + 0}) + .add({upper_limit - 2, upper_limit - 3, upper_limit - 0}) + .finalize(epk); + (void)new TupleSetTest("MinMax", pos, + IntSet(IntArgs({lower_limit, lower_limit + 1, lower_limit + 4, + upper_limit - 3, upper_limit - 2, upper_limit})), + ts, true, epk); + } + { + TupleSet ts(7); + const int triangle_tuples = (epk == EPK_DENSE) ? 10000 : 1000; + for (int i = 0; i < triangle_tuples; i++) { + IntArgs tuple(7); + for (int j = 0; j < 7; j++) { + tuple[j] = rand(j + 1); } - ts.finalize(epk); - (void)new RandomTupleSetTest("Triangle", pos, IntSet(0, 6), ts, epk); + ts.add(tuple); } - { - for (int i = 0; i <= 64 * 6; i += 32) - (void)TupleSetTestSize(i, pos, epk, rand); + ts.finalize(epk); + (void)new RandomTupleSetTest("Triangle", pos, IntSet(0, 6), ts, epk); + } + { + for (int i = 0; i <= 64 * 6; i += 32) + (void)TupleSetTestSize(i, pos, epk, rand); + } + { + const double prob_small = (epk == EPK_DENSE) ? 0.05 : 0.01; + (void)new RandomTupleSetTest("Rand(10,-1,2)", pos, IntSet(-1, 2), + random_tuple_set(10, -1, 2, prob_small, epk, rand), epk); + if (epk == EPK_DENSE) + (void)new RandomTupleSetTest("Rand(5,-10,10)", pos, IntSet(-10, 10), + random_tuple_set(5, -10, 10, 0.05, epk, rand), epk); + } + { + TupleSet t(5); + CpltAssignment ass(4, IntSet(1, 4)); + while (ass.has_more()) { + IntArgs tuple(5); + tuple[4] = 1; + for (int i = 4; i--;) + tuple[i] = ass[i]; + t.add(tuple); + ass.next(rand); } - { - const double prob_small = (epk == EPK_DENSE) ? 0.05 : 0.01; - (void)new RandomTupleSetTest("Rand(10,-1,2)", pos, IntSet(-1, 2), - random_tuple_set(10, -1, 2, prob_small, epk, rand), epk); - if (epk == EPK_DENSE) - (void)new RandomTupleSetTest("Rand(5,-10,10)", pos, IntSet(-10, 10), - random_tuple_set(5, -10, 10, 0.05, epk, rand), epk); + t.add({2, 2, 4, 3, 4}); + t.finalize(epk); + (void)new TupleSetTest("FewLast", pos, IntSet(1, 4), t, false, epk); + } + { + TupleSet t(4); + CpltAssignment ass(4, IntSet(1, 6)); + while (ass.has_more()) { + t.add({ass[0], 0, ass[1], ass[2]}); + ass.next(rand); } - { - TupleSet t(5); - CpltAssignment ass(4, IntSet(1, 4)); - while (ass.has_more()) { - IntArgs tuple(5); - tuple[4] = 1; - for (int i = 4; i--;) - tuple[i] = ass[i]; + t.add({2, -1, 3, 4}); + t.finalize(epk); + (void)new TupleSetTest("FewMiddle", pos, IntSet(-1, 6), t, false, epk); + } + if (epk == EPK_DENSE) { + TupleSet t(10); + CpltAssignment ass(9, IntSet(1, 4)); + while (ass.has_more()) { + if (rand(100) <= 0.25 * 100) { + IntArgs tuple(10); + tuple[0] = 2; + for (int i = 9; i--;) + tuple[i + 1] = ass[i]; t.add(tuple); - ass.next(rand); - } - t.add({2, 2, 4, 3, 4}); - t.finalize(epk); - (void)new TupleSetTest("FewLast", pos, IntSet(1, 4), t, false, epk); - } - { - TupleSet t(4); - CpltAssignment ass(4, IntSet(1, 6)); - while (ass.has_more()) { - t.add({ass[0], 0, ass[1], ass[2]}); - ass.next(rand); - } - t.add({2, -1, 3, 4}); - t.finalize(epk); - (void)new TupleSetTest("FewMiddle", pos, IntSet(-1, 6), t, false, epk); - } - if (epk == EPK_DENSE) { - TupleSet t(10); - CpltAssignment ass(9, IntSet(1, 4)); - while (ass.has_more()) { - if (rand(100) <= 0.25 * 100) { - IntArgs tuple(10); - tuple[0] = 2; - for (int i = 9; i--;) - tuple[i + 1] = ass[i]; - t.add(tuple); - } - ass.next(rand); } - t.add({1, 1, 1, 1, 1, 1, 1, 1, 1, 1}); - t.add({1, 2, 3, 4, 4, 2, 1, 2, 3, 3}); - t.finalize(epk); - (void)new RandomTupleSetTest("FewHuge", pos, IntSet(1, 4), t, epk); + ass.next(rand); } - (void)new TupleSetBase(pos, epk); - (void)new TupleSetLarge(0.05, pos, epk); - (void)new TupleSetBool(0.3, pos, epk); + t.add({1, 1, 1, 1, 1, 1, 1, 1, 1, 1}); + t.add({1, 2, 3, 4, 4, 2, 1, 2, 3, 3}); + t.finalize(epk); + (void)new RandomTupleSetTest("FewHuge", pos, IntSet(1, 4), t, epk); } + (void)new TupleSetBase(pos, epk); + (void)new TupleSetLarge(0.05, pos, epk); + (void)new TupleSetBool(0.3, pos, epk); } } - }; - - Create c; - - RegSimpleA ra; - RegSimpleB rb; - RegSimpleC rc; - - RegDistinct rd; - - RegRoland rr1(1); - RegRoland rr2(2); - RegRoland rr3(3); - RegRoland rr4(4); - - RegSharedA rsa; - RegSharedB rsb; - RegSharedC rsc; - RegSharedD rsd; - - RegEmptyDFA redfa; - RegEmptyREG rereg; - - RegOpt ro0(CHAR_MAX - 1); - RegOpt ro1(CHAR_MAX); - RegOpt ro2(static_cast(UCHAR_MAX - 1)); - RegOpt ro3(static_cast(UCHAR_MAX)); - RegOpt ro4(SHRT_MAX - 1); - RegOpt ro5(SHRT_MAX); - RegOpt ro6(static_cast(USHRT_MAX - 1)); - RegOpt ro7(static_cast(USHRT_MAX)); - - RegAcyclicReconvergence reg_sparse_acyclic_reconvergence; - RegCyclicFrontier reg_sparse_cyclic_frontier; - RegSparseStateNumbering reg_sparse_state_numbering; - RegDuplicateFinals reg_duplicate_finals_dense_minimize(true, false); - RegDuplicateFinals reg_duplicate_finals_dense_keep(false, false); - RegDuplicateFinals reg_duplicate_finals_sparse_minimize(true, true); - RegDuplicateFinals reg_duplicate_finals_sparse_keep(false, true); - RegBoolCyclicFrontier reg_sparse_bool_cyclic_frontier; - RegRandomDifferential reg_sparse_random_differential_1(1); - RegRandomDifferential reg_sparse_random_differential_2(2); - RegRandomDifferential reg_sparse_random_differential_3(3); - RegRandomDifferential reg_sparse_random_differential_4(4); - RegRandomNFADifferential reg_sparse_random_nfa_differential_1(1); - RegRandomNFADifferential reg_sparse_random_nfa_differential_2(2); - RegRandomNFADifferential reg_sparse_random_nfa_differential_3(3); - RegRandomNFADifferential reg_sparse_random_nfa_differential_4(4); - RegNFAPrefix reg_sparse_nfa_prefix_int(false); - RegNFAPrefix reg_sparse_nfa_prefix_bool(true); - RegPositionDomainPruning reg_sparse_position_domain_pruning; - RegNoAcceptingPath reg_sparse_no_accepting_path; - RegTerminalMerged reg_sparse_terminal_merged; - RegTerminalUnmerged reg_sparse_terminal_unmerged; - OpenRegularIncremental open_regular_incremental; - OpenRegularLengthWake open_regular_length_wake; - OpenRegularMaxLength open_regular_max_length; - OpenRegularBackward open_regular_backward; - OpenRegularDomainWake open_regular_domain_wake; - OpenRegularClone open_regular_clone; - OpenRegularEmpty open_regular_empty_accept(OpenRegularEmpty::Kind::ACCEPT); - OpenRegularEmpty open_regular_empty_reject(OpenRegularEmpty::Kind::REJECT); - OpenRegularEmpty open_regular_no_finals(OpenRegularEmpty::Kind::NO_FINALS); - OpenRegularClosed open_regular_closed; - DFACompare dfa_compare; - - /// Exhaustive positive, negative, and reified sparse-table semantics. - class CreateSparse { - public: - CreateSparse(void) { - using namespace Gecode; - TupleSet equal(2), zero(2), full(2), first_zero(2); - equal.add(IntArgs({0, 0})).add(IntArgs({1, 1})).finalize(EPK_SPARSE); - zero.add(IntArgs({0, 0})).finalize(EPK_SPARSE); - full.add(IntArgs({0, 0})) - .add(IntArgs({0, 1})) - .add(IntArgs({1, 0})) - .add(IntArgs({1, 1})) - .finalize(EPK_SPARSE); - first_zero.add(IntArgs({0, 0})).add(IntArgs({0, 1})).finalize(EPK_SPARSE); - for (bool positive : {false, true}) { - (void)new TupleSetTest("Equal", positive, IntSet(0, 1), equal, false, EPK_SPARSE, - TestTags::standard()); - (void)new TupleSetTest("Zero", positive, IntSet(0, 1), zero, false, EPK_SPARSE, - TestTags::standard()); - (void)new TupleSetTest("Full", positive, IntSet(0, 1), full, false, EPK_SPARSE, - TestTags::standard()); - (void)new TupleSetTest("FirstZero", positive, IntSet(0, 1), first_zero, false, EPK_SPARSE, - TestTags::standard()); - } + } + }; + + Create c; + + RegSimpleA ra; + RegSimpleB rb; + RegSimpleC rc; + + RegDistinct rd; + + RegRoland rr1(1); + RegRoland rr2(2); + RegRoland rr3(3); + RegRoland rr4(4); + + RegSharedA rsa; + RegSharedB rsb; + RegSharedC rsc; + RegSharedD rsd; + + RegEmptyDFA redfa; + RegEmptyREG rereg; + + RegOpt ro0(CHAR_MAX - 1); + RegOpt ro1(CHAR_MAX); + RegOpt ro2((UCHAR_MAX - 1)); + RegOpt ro3((UCHAR_MAX)); + RegOpt ro4(SHRT_MAX - 1); + RegOpt ro5(SHRT_MAX); + RegOpt ro6((USHRT_MAX - 1)); + RegOpt ro7((USHRT_MAX)); + + RegAcyclicReconvergence reg_sparse_acyclic_reconvergence; + RegCyclicFrontier reg_sparse_cyclic_frontier; + RegSparseStateNumbering reg_sparse_state_numbering; + RegDuplicateFinals reg_duplicate_finals_dense_minimize(true, false); + RegDuplicateFinals reg_duplicate_finals_dense_keep(false, false); + RegDuplicateFinals reg_duplicate_finals_sparse_minimize(true, true); + RegDuplicateFinals reg_duplicate_finals_sparse_keep(false, true); + RegBoolCyclicFrontier reg_sparse_bool_cyclic_frontier; + RegRandomDifferential reg_sparse_random_differential_1(1); + RegRandomDifferential reg_sparse_random_differential_2(2); + RegRandomDifferential reg_sparse_random_differential_3(3); + RegRandomDifferential reg_sparse_random_differential_4(4); + RegRandomNFADifferential reg_sparse_random_nfa_differential_1(1); + RegRandomNFADifferential reg_sparse_random_nfa_differential_2(2); + RegRandomNFADifferential reg_sparse_random_nfa_differential_3(3); + RegRandomNFADifferential reg_sparse_random_nfa_differential_4(4); + RegNFAPrefix reg_sparse_nfa_prefix_int(false); + RegNFAPrefix reg_sparse_nfa_prefix_bool(true); + RegPositionDomainPruning reg_sparse_position_domain_pruning; + RegNoAcceptingPath reg_sparse_no_accepting_path; + RegTerminalMerged reg_sparse_terminal_merged; + RegTerminalUnmerged reg_sparse_terminal_unmerged; + OpenRegularIncremental open_regular_incremental; + OpenRegularLengthWake open_regular_length_wake; + OpenRegularMaxLength open_regular_max_length; + OpenRegularBackward open_regular_backward; + OpenRegularDomainWake open_regular_domain_wake; + OpenRegularClone open_regular_clone; + OpenRegularEmpty open_regular_empty_accept(OpenRegularEmpty::Kind::ACCEPT); + OpenRegularEmpty open_regular_empty_reject(OpenRegularEmpty::Kind::REJECT); + OpenRegularEmpty open_regular_no_finals(OpenRegularEmpty::Kind::NO_FINALS); + OpenRegularClosed open_regular_closed; + DFACompare dfa_compare; + + /// Exhaustive positive, negative, and reified sparse-table semantics. + class CreateSparse { + public: + CreateSparse() { + using namespace Gecode; + TupleSet equal(2), zero(2), full(2), first_zero(2); + equal.add(IntArgs({0, 0})).add(IntArgs({1, 1})).finalize(EPK_SPARSE); + zero.add(IntArgs({0, 0})).finalize(EPK_SPARSE); + full.add(IntArgs({0, 0})) + .add(IntArgs({0, 1})) + .add(IntArgs({1, 0})) + .add(IntArgs({1, 1})) + .finalize(EPK_SPARSE); + first_zero.add(IntArgs({0, 0})).add(IntArgs({0, 1})).finalize(EPK_SPARSE); + for (bool positive : {false, true}) { + (void)new TupleSetTest("Equal", positive, IntSet(0, 1), equal, false, EPK_SPARSE, TestTags::standard()); + (void)new TupleSetTest("Zero", positive, IntSet(0, 1), zero, false, EPK_SPARSE, TestTags::standard()); + (void)new TupleSetTest("Full", positive, IntSet(0, 1), full, false, EPK_SPARSE, TestTags::standard()); + (void)new TupleSetTest("FirstZero", positive, IntSet(0, 1), first_zero, false, EPK_SPARSE, + TestTags::standard()); } - } create_sparse; - - SparseTupleSet sparse_tuple_set_unary("Unary", 1, 2000); - SparseTupleSet sparse_tuple_set_ternary("Ternary", 3, 1500); - SparseTupleSet sparse_tuple_set_high_arity("HighArity", 6, 1000); - TupleSetNullary sparse_tuple_set_nullary(Gecode::EPK_SPARSE, true); - TupleSetNullary sparse_tuple_set_empty(Gecode::EPK_SPARSE, false); - TupleSetNullary dense_tuple_set_nullary(Gecode::EPK_DENSE, true); - TupleSetNullary dense_tuple_set_empty(Gecode::EPK_DENSE, false); - TupleSetNullary dense_compressed_tuple_set_nullary(Gecode::EPK_DENSE_COMPRESSED, true); - TupleSetNullary dense_compressed_tuple_set_empty(Gecode::EPK_DENSE_COMPRESSED, false); - SparseTupleSetIncremental sparse_tuple_set_incremental_delta("Delta", 0); - SparseTupleSetIncremental sparse_tuple_set_incremental_assign("Assign", 1); - SparseTupleSetIncremental sparse_tuple_set_incremental_bool("Bool", 2); - SparseTupleSetDisabledFailure sparse_tuple_set_disabled_failure; - SparseTupleSetWideDelta sparse_tuple_set_wide_delta; - TupleSetSingleRepresentation tuple_set_single_representation; - TupleSetSupportOffsetBoundary tuple_set_support_offset_boundary; - TupleSetTerminalFinalizationFailure tuple_set_terminal_failure; - TupleSetDFARepresentation tuple_set_dfa_representation; - TupleSetCompare tuple_set_compare; - BitSetDataCompare bit_set_data_compare; - TupleSetDisabledClone tuple_set_disabled_clone; - TupleSetAutoDefaultDispatch tuple_set_auto_default_dispatch; - DenseCompressedTupleSetWideGap dense_compressed_tuple_set_wide_gap; - //@} - - } // namespace Extensional -}} // namespace Test::Int - + } + } create_sparse; + + SparseTupleSet sparse_tuple_set_unary("Unary", 1, 2000); + SparseTupleSet sparse_tuple_set_ternary("Ternary", 3, 1500); + SparseTupleSet sparse_tuple_set_high_arity("HighArity", 6, 1000); + TupleSetNullary sparse_tuple_set_nullary(Gecode::EPK_SPARSE, true); + TupleSetNullary sparse_tuple_set_empty(Gecode::EPK_SPARSE, false); + TupleSetNullary dense_tuple_set_nullary(Gecode::EPK_DENSE, true); + TupleSetNullary dense_tuple_set_empty(Gecode::EPK_DENSE, false); + TupleSetNullary dense_compressed_tuple_set_nullary(Gecode::EPK_DENSE_COMPRESSED, true); + TupleSetNullary dense_compressed_tuple_set_empty(Gecode::EPK_DENSE_COMPRESSED, false); + SparseTupleSetIncremental sparse_tuple_set_incremental_delta("Delta", 0); + SparseTupleSetIncremental sparse_tuple_set_incremental_assign("Assign", 1); + SparseTupleSetIncremental sparse_tuple_set_incremental_bool("Bool", 2); + SparseTupleSetDisabledFailure sparse_tuple_set_disabled_failure; + SparseTupleSetWideDelta sparse_tuple_set_wide_delta; + TupleSetSingleRepresentation tuple_set_single_representation; + TupleSetSupportOffsetBoundary tuple_set_support_offset_boundary; + TupleSetTerminalFinalizationFailure tuple_set_terminal_failure; + TupleSetDFARepresentation tuple_set_dfa_representation; + TupleSetCompare tuple_set_compare; + BitSetDataCompare bit_set_data_compare; + TupleSetDisabledClone tuple_set_disabled_clone; + TupleSetAutoDefaultDispatch tuple_set_auto_default_dispatch; + DenseCompressedTupleSetWideGap dense_compressed_tuple_set_wide_gap; + //@} + +} // namespace Test::Int::Extensional // STATISTICS: test-int diff --git a/test/int/gcc.cpp b/test/int/gcc.cpp index 68a6299a74..3f7a0bb3bc 100644 --- a/test/int/gcc.cpp +++ b/test/int/gcc.cpp @@ -36,360 +36,350 @@ #include "test/int.hh" -namespace Test { namespace Int { +/// %Tests for counting constraints (global cardinality) +namespace Test::Int::GCC { - /// %Tests for counting constraints (global cardinality) - namespace GCC { - - /** - * \defgroup TaskTestIntGCC Counting constraints (global cardinality) - * \ingroup TaskTestInt - */ - //@{ - /// %Test for integer cardinality with min and max for all variables - class IntAllMinMax : public Test { - public: - /// Create and register test - IntAllMinMax(Gecode::IntPropLevel ipl) - : Test(TestTags::sweep(), "GCC::Int::All::MinMax::" + str(ipl), 4, -1, 3, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n[5]; - for (int i = 5; i--;) - n[i] = 0; - for (int i = x.size(); i--;) - n[x[i] + 1]++; - if (n[2] > 0) + /** + * \defgroup TaskTestIntGCC Counting constraints (global cardinality) + * \ingroup TaskTestInt + */ + //@{ + /// %Test for integer cardinality with min and max for all variables + class IntAllMinMax : public Test { + public: + /// Create and register test + IntAllMinMax(Gecode::IntPropLevel ipl) + : Test(TestTags::sweep(), "GCC::Int::All::MinMax::" + str(ipl), 4, -1, 3, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n[5]; + for (int i = 5; i--;) + n[i] = 0; + for (int i = x.size(); i--;) + n[x[i] + 1]++; + if (n[2] > 0) + return false; + for (int i = 5; i--;) + if (n[i] > 2) return false; - for (int i = 5; i--;) - if (n[i] > 2) - return false; - return true; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - IntArgs values(5); - IntSet fixed(0, 2); - IntSetArgs cards(5); - for (int i = 0; i < 5; i++) { - values[i] = i - 1; - cards[i] = fixed; - } - cards[2] = IntSet(0, 0); - count(home, x, cards, values, ipl); + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + IntArgs values(5); + IntSet fixed(0, 2); + IntSetArgs cards(5); + for (int i = 0; i < 5; i++) { + values[i] = i - 1; + cards[i] = fixed; } - }; + cards[2] = IntSet(0, 0); + count(home, x, cards, values, ipl); + } + }; - /// %Test for integer cardinality with min and max for all variables - class IntAllMinMaxDef : public Test { - public: - /// Create and register test - IntAllMinMaxDef(Gecode::IntPropLevel ipl) - : Test(TestTags::sweep(), "GCC::Int::All::MinMaxDef::" + str(ipl), 4, 0, 3, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n[4]; - for (int i = 4; i--;) - n[i] = 0; - for (int i = x.size(); i--;) - n[x[i]]++; - if (n[2] > 0) + /// %Test for integer cardinality with min and max for all variables + class IntAllMinMaxDef : public Test { + public: + /// Create and register test + IntAllMinMaxDef(Gecode::IntPropLevel ipl) + : Test(TestTags::sweep(), "GCC::Int::All::MinMaxDef::" + str(ipl), 4, 0, 3, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n[4]; + for (int i = 4; i--;) + n[i] = 0; + for (int i = x.size(); i--;) + n[x[i]]++; + if (n[2] > 0) + return false; + for (int i = 4; i--;) + if (n[i] > 2) return false; - for (int i = 4; i--;) - if (n[i] > 2) - return false; - return true; + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + IntSet fixed(0, 2); + IntSetArgs cards(4); + for (int i = 0; i < 4; i++) { + cards[i] = fixed; } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - IntSet fixed(0, 2); - IntSetArgs cards(4); - for (int i = 0; i < 4; i++) { - cards[i] = fixed; - } - cards[2] = IntSet(0, 0); - count(home, x, cards, ipl); - } - }; + cards[2] = IntSet(0, 0); + count(home, x, cards, ipl); + } + }; - /// %Test for integer cardinality with max cardinality for all variables - class IntAllMax : public Test { - public: - /// Create and register test - IntAllMax(Gecode::IntPropLevel ipl) - : Test(ipl == Gecode::IPL_BND ? TestTags::standard() : TestTags::sweep(), - "GCC::Int::All::Max::" + str(ipl), 4, 1, 2, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n[2]; - for (int i = 2; i--;) - n[i] = 0; - for (int i = x.size(); i--;) - n[x[i] - 1]++; - if (n[0] != 2 || n[1] != 2) - return false; - return true; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntArgs values({1, 2}); - Gecode::count(home, x, Gecode::IntSet(2, 2), values, ipl); - } - }; + /// %Test for integer cardinality with max cardinality for all variables + class IntAllMax : public Test { + public: + /// Create and register test + IntAllMax(Gecode::IntPropLevel ipl) + : Test(ipl == Gecode::IPL_BND ? TestTags::standard() : TestTags::sweep(), "GCC::Int::All::Max::" + str(ipl), + 4, 1, 2, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n[2]; + for (int i = 2; i--;) + n[i] = 0; + for (int i = x.size(); i--;) + n[x[i] - 1]++; + return (n[0] == 2) && (n[1] == 2); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntArgs values({1, 2}); + Gecode::count(home, x, Gecode::IntSet(2, 2), values, ipl); + } + }; - /// %Test for integer cardinality for some variables - template - class IntSome : public Test { - public: - /// Create and register test - IntSome(Gecode::IntPropLevel ipl) - : Test(TestTags::sweep(), std::string("GCC::Int::Some::") + (hole ? "::Hole" : "::Full") + str(ipl), 4, - 1, 4, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n[4]; - for (int i = 4; i--;) - n[i] = 0; - for (int i = x.size(); i--;) - n[x[i] - 1]++; - if ((n[0] < 2) || (n[1] < 2) || (n[2] > 0) || (n[3] > 0)) - return false; - return true; + /// %Test for integer cardinality for some variables + template + class IntSome : public Test { + public: + /// Create and register test + IntSome(Gecode::IntPropLevel ipl) + : Test(TestTags::sweep(), std::string("GCC::Int::Some::") + (hole ? "::Hole" : "::Full") + str(ipl), 4, 1, + 4, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n[4]; + for (int i = 4; i--;) + n[i] = 0; + for (int i = x.size(); i--;) + n[x[i] - 1]++; + return (n[0] >= 2) && (n[1] >= 2) && (n[2] <= 0) && (n[3] <= 0); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + IntArgs values({1, 2}); + Gecode::IntSet fixed; + if (!hole) { + fixed = IntSet(0, 2); + } else { + int ish[] = {0, 2}; + fixed = IntSet(ish, 2); } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - IntArgs values({1, 2}); - Gecode::IntSet fixed; - if (!hole) { - fixed = IntSet(0, 2); - } else { - int ish[] = {0, 2}; - fixed = IntSet(ish, 2); - } - Gecode::IntSetArgs cards(2); - cards[0] = fixed; - cards[1] = fixed; - count(home, x, cards, values, ipl); - } - }; + Gecode::IntSetArgs cards(2); + cards[0] = fixed; + cards[1] = fixed; + count(home, x, cards, values, ipl); + } + }; - /// %Test for variable cardinality for all cardinality values - class VarAll : public Test { - protected: - /// Number of non-cardinality variables - static const int n = 4; + /// %Test for variable cardinality for all cardinality values + class VarAll : public Test { + protected: + /// Number of non-cardinality variables + static const int n = 4; - public: - /// Create and register test - VarAll(Gecode::IntPropLevel ipl) - : Test(TestTags::sweep(), "GCC::Var::All::" + str(ipl), 7, 0, 2, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - // Number of cardinality variables - int m = x.size() - n; - for (int i = 0; i < n; i++) - if ((x[i] < 0) || (x[i] > 2)) - return false; - int* card = new int[m]; - for (int i = 0; i < m; i++) { - card[i] = 0; - if ((x[n + i] < 0) || (x[n + i] > 2)) { - delete[] card; - return false; - } + public: + /// Create and register test + VarAll(Gecode::IntPropLevel ipl) : Test(TestTags::sweep(), "GCC::Var::All::" + str(ipl), 7, 0, 2, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + // Number of cardinality variables + int m = x.size() - n; + for (int i = 0; i < n; i++) + if ((x[i] < 0) || (x[i] > 2)) + return false; + int* card = new int[m]; + for (int i = 0; i < m; i++) { + card[i] = 0; + if ((x[n + i] < 0) || (x[n + i] > 2)) { + delete[] card; + return false; } - for (int i = 0; i < n; i++) - card[x[i]]++; - for (int i = 0; i < m; i++) - if (card[i] != x[n + i]) { - delete[] card; - return false; - } - delete[] card; - return true; } - /// Post constraint on \a xy - void - post(Gecode::Space& home, Gecode::IntVarArray& xy) override { - using namespace Gecode; - // Number of cardinality variables - int m = xy.size() - n; + for (int i = 0; i < n; i++) + card[x[i]]++; + for (int i = 0; i < m; i++) + if (card[i] != x[n + i]) { + delete[] card; + return false; + } + delete[] card; + return true; + } + /// Post constraint on \a xy + void + post(Gecode::Space& home, Gecode::IntVarArray& xy) override { + using namespace Gecode; + // Number of cardinality variables + int m = xy.size() - n; - IntVarArgs x(n), y(m); - for (int i = 0; i < n; i++) - x[i] = xy[i]; - for (int i = 0; i < m; i++) - y[i] = xy[n + i]; - count(home, x, y, ipl); - } - }; + IntVarArgs x(n), y(m); + for (int i = 0; i < n; i++) + x[i] = xy[i]; + for (int i = 0; i < m; i++) + y[i] = xy[n + i]; + count(home, x, y, ipl); + } + }; - /// %Test for variable cardinality for some cardinality values - class VarSome : public Test { - protected: - /// Number of non-cardinality variables - int n; - /// Arity beyond which to use randomized tests - static const int random_arity = 7; + /// %Test for variable cardinality for some cardinality values + class VarSome : public Test { + protected: + /// Number of non-cardinality variables + int n; + /// Arity beyond which to use randomized tests + static const int random_arity = 7; - public: - /// Create and register test - VarSome(const std::string& s, int n0, int min, int max, Gecode::IntPropLevel ipl) - : Test(TestTags::sweep(), "GCC::Var::Some::" + s + "::" + str(ipl), n0 + (max - min) + 1, min, max, - false, ipl), - n(n0) { - consistency_test_level = CTL_NONE; - if (arity > random_arity) - test_search = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - // Number of cardinality variables - int m = x.size() - n; - int* card = new int[m]; - for (int i = 0; i < m; i++) { - card[i] = 0; - if ((x[n + i] < 0) || (x[n + i] > n)) { - delete[] card; - return false; - } + public: + /// Create and register test + VarSome(const std::string& s, int n0, int min, int max, Gecode::IntPropLevel ipl) + : Test(TestTags::sweep(), "GCC::Var::Some::" + s + "::" + str(ipl), n0 + (max - min) + 1, min, max, false, + ipl), + n(n0) { + consistency_test_level = CTL_NONE; + if (arity > random_arity) + test_search = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + // Number of cardinality variables + int m = x.size() - n; + int* card = new int[m]; + for (int i = 0; i < m; i++) { + card[i] = 0; + if ((x[n + i] < 0) || (x[n + i] > n)) { + delete[] card; + return false; } - for (int i = 0; i < n; i++) - card[x[i] - dom.min()]++; - for (int i = 0; i < m; i++) - if (card[i] != x[n + i]) { - delete[] card; - return false; - } - delete[] card; - return true; - } - /// Create and register initial assignment - Assignment* - assignment(void) const override { - if (arity > random_arity) - return new RandomAssignment(arity, dom, 4000, _rand); - else - return new CpltAssignment(arity, dom); - } - /// Post constraint on \a xy - void - post(Gecode::Space& home, Gecode::IntVarArray& xy) override { - using namespace Gecode; - // Number of cardinality variables - int m = xy.size() - n; - IntVarArgs x(n), y(m); - for (int i = 0; i < n; i++) - x[i] = xy[i]; - for (int i = 0; i < m; i++) - y[i] = xy[n + i]; - IntArgs values(m); - for (int i = m; i--;) - values[i] = i + dom.min(); - count(home, x, y, values, ipl); } - }; - - /// %Test every count overload with no variables or no values - class Empty : public Base { - private: - /// Space without variables - class Fixture : public Gecode::Space { - public: - Fixture(void) = default; - // NOLINTNEXTLINE(modernize-use-equals-default) - Fixture(Fixture& fixture) : Gecode::Space(fixture) {} - Gecode::Space* - copy(void) override { - return new Fixture(*this); + for (int i = 0; i < n; i++) + card[x[i] - dom.min()]++; + for (int i = 0; i < m; i++) + if (card[i] != x[n + i]) { + delete[] card; + return false; } - }; + delete[] card; + return true; + } + /// Create and register initial assignment + Assignment* + assignment() const override { + if (arity > random_arity) + return new RandomAssignment(arity, dom, 4000, _rand); + return new CpltAssignment(arity, dom); + } + /// Post constraint on \a xy + void + post(Gecode::Space& home, Gecode::IntVarArray& xy) override { + using namespace Gecode; + // Number of cardinality variables + int m = xy.size() - n; + IntVarArgs x(n), y(m); + for (int i = 0; i < n; i++) + x[i] = xy[i]; + for (int i = 0; i < m; i++) + y[i] = xy[n + i]; + IntArgs values(m); + for (int i = m; i--;) + values[i] = i + dom.min(); + count(home, x, y, values, ipl); + } + }; + /// %Test every count overload with no variables or no values + class Empty : public Base { + private: + /// Space without variables + class Fixture : public Gecode::Space { public: - Empty(void) : Base("Int::GCC::Empty") {} - bool - run(void) override { - using namespace Gecode; - IntVarArgs x; - IntVarArgs c; - IntSetArgs cs; - IntArgs v; - Fixture var, var_v, var_val, var_bnd, var_dom, set, set_v, set_c; - count(var, x, c); - count(var_v, x, c, v); - count(var_val, x, c, v, IPL_VAL); - count(var_bnd, x, c, v, IPL_BND); - count(var_dom, x, c, v, IPL_DOM); - count(set, x, cs); - count(set_v, x, cs, v); - count(set_c, x, IntSet(0, 1), v); - bool empty_solved = (var.status() == SS_SOLVED) && (var_v.status() == SS_SOLVED) && - (var_val.status() == SS_SOLVED) && (var_bnd.status() == SS_SOLVED) && - (var_dom.status() == SS_SOLVED) && (set.status() == SS_SOLVED) && - (set_v.status() == SS_SOLVED) && (set_c.status() == SS_SOLVED); - - // Without variables, every value occurs zero times - Fixture card, card_zero, card_one, card_hole; - IntVarArgs y(card, 2, 0, 2); - count(card, x, y, IntArgs({1, 1})); - count(card_zero, x, IntSetArgs({IntSet({0, 2})}), IntArgs({1})); - count(card_one, x, IntSetArgs({IntSet(1, 2)}), IntArgs({1})); - count(card_hole, x, IntSet({1, 3}), IntArgs({1})); - bool card_counted = (card.status() == SS_SOLVED) && y[0].assigned() && (y[0].val() == 0) && - y[1].assigned() && (y[1].val() == 0) && (card_zero.status() == SS_SOLVED) && - (card_one.status() == SS_FAILED) && (card_hole.status() == SS_FAILED); - - // Without values, no variable can take a value - Fixture no_var, no_var_v, no_set, no_set_v, no_set_c; - count(no_var, IntVarArgs(no_var, 1, 0, 2), c); - count(no_var_v, IntVarArgs(no_var_v, 1, 0, 2), c, v); - count(no_set, IntVarArgs(no_set, 1, 0, 2), cs); - count(no_set_v, IntVarArgs(no_set_v, 1, 0, 2), cs, v); - count(no_set_c, IntVarArgs(no_set_c, 1, 0, 2), IntSet(0, 1), v); - bool no_value_failed = (no_var.status() == SS_FAILED) && (no_var_v.status() == SS_FAILED) && - (no_set.status() == SS_FAILED) && (no_set_v.status() == SS_FAILED) && - (no_set_c.status() == SS_FAILED); - return empty_solved && card_counted && no_value_failed; + Fixture() = default; + // NOLINTNEXTLINE(modernize-use-equals-default) + Fixture(Fixture& fixture) : Gecode::Space(fixture) {} + Gecode::Space* + copy() override { + return new Fixture(*this); } }; - Empty empty; + public: + Empty() : Base("Int::GCC::Empty") {} + bool + run() override { + using namespace Gecode; + IntVarArgs x; + IntVarArgs c; + IntSetArgs cs; + IntArgs v; + Fixture var, var_v, var_val, var_bnd, var_dom, set, set_v, set_c; + count(var, x, c); + count(var_v, x, c, v); + count(var_val, x, c, v, IPL_VAL); + count(var_bnd, x, c, v, IPL_BND); + count(var_dom, x, c, v, IPL_DOM); + count(set, x, cs); + count(set_v, x, cs, v); + count(set_c, x, IntSet(0, 1), v); + bool empty_solved = (var.status() == SS_SOLVED) && (var_v.status() == SS_SOLVED) && + (var_val.status() == SS_SOLVED) && (var_bnd.status() == SS_SOLVED) && + (var_dom.status() == SS_SOLVED) && (set.status() == SS_SOLVED) && + (set_v.status() == SS_SOLVED) && (set_c.status() == SS_SOLVED); - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - for (IntPropLevels ipls; ipls(); ++ipls) { - (void)new IntAllMinMax(ipls.ipl()); - (void)new IntAllMinMaxDef(ipls.ipl()); - (void)new IntAllMax(ipls.ipl()); - (void)new IntSome(ipls.ipl()); - (void)new IntSome(ipls.ipl()); - (void)new VarAll(ipls.ipl()); - (void)new VarSome("Small", 2, -1, 3, ipls.ipl()); - (void)new VarSome("Large", 3, -1, 4, ipls.ipl()); - } - } - }; + // Without variables, every value occurs zero times + Fixture card, card_zero, card_one, card_hole; + IntVarArgs y(card, 2, 0, 2); + count(card, x, y, IntArgs({1, 1})); + count(card_zero, x, IntSetArgs({IntSet({0, 2})}), IntArgs({1})); + count(card_one, x, IntSetArgs({IntSet(1, 2)}), IntArgs({1})); + count(card_hole, x, IntSet({1, 3}), IntArgs({1})); + bool card_counted = (card.status() == SS_SOLVED) && y[0].assigned() && (y[0].val() == 0) && + y[1].assigned() && (y[1].val() == 0) && (card_zero.status() == SS_SOLVED) && + (card_one.status() == SS_FAILED) && (card_hole.status() == SS_FAILED); + + // Without values, no variable can take a value + Fixture no_var, no_var_v, no_set, no_set_v, no_set_c; + count(no_var, IntVarArgs(no_var, 1, 0, 2), c); + count(no_var_v, IntVarArgs(no_var_v, 1, 0, 2), c, v); + count(no_set, IntVarArgs(no_set, 1, 0, 2), cs); + count(no_set_v, IntVarArgs(no_set_v, 1, 0, 2), cs, v); + count(no_set_c, IntVarArgs(no_set_c, 1, 0, 2), IntSet(0, 1), v); + bool no_value_failed = (no_var.status() == SS_FAILED) && (no_var_v.status() == SS_FAILED) && + (no_set.status() == SS_FAILED) && (no_set_v.status() == SS_FAILED) && + (no_set_c.status() == SS_FAILED); + return empty_solved && card_counted && no_value_failed; + } + }; - Create c; - //@} + Empty empty; + + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + for (IntPropLevels ipls; ipls(); ++ipls) { + (void)new IntAllMinMax(ipls.ipl()); + (void)new IntAllMinMaxDef(ipls.ipl()); + (void)new IntAllMax(ipls.ipl()); + (void)new IntSome(ipls.ipl()); + (void)new IntSome(ipls.ipl()); + (void)new VarAll(ipls.ipl()); + (void)new VarSome("Small", 2, -1, 3, ipls.ipl()); + (void)new VarSome("Large", 3, -1, 4, ipls.ipl()); + } + } + }; - } // namespace GCC -}} // namespace Test::Int + Create c; + //@} +} // namespace Test::Int::GCC // STATISTICS: test-int diff --git a/test/int/inter-distance.cpp b/test/int/inter-distance.cpp index 91c0aa4027..97f61cdbdd 100644 --- a/test/int/inter-distance.cpp +++ b/test/int/inter-distance.cpp @@ -35,7 +35,7 @@ #include #include -namespace Test { namespace Int { namespace InterDistance { +namespace Test::Int::InterDistance { /// Exercise assignment, cloning, search, and bounds(Z) consistency class Distance : public Test { @@ -114,11 +114,11 @@ namespace Test { namespace Int { namespace InterDistance { RandomAssignment::next(rand); if (a % 2 == 0) { int m = n - static_cast(variable); - int distance = variable ? static_cast(rand(p + 1)) : p; + int distance = variable ? rand(p + 1) : p; int slack = d.max() - d.min() - (m - 1) * distance; int value = d.min(); for (int i = 0; i < m; i++) { - int extra = static_cast(rand(slack + 1)); + int extra = rand(slack + 1); slack -= extra; value += extra; vals[i] = value; @@ -126,7 +126,7 @@ namespace Test { namespace Int { namespace InterDistance { value += distance; } for (int i = m - 1; i > 0; i--) { - int j = static_cast(rand(i + 1)); + int j = rand(i + 1); std::swap(vals[i], vals[j]); } if (variable) @@ -150,7 +150,7 @@ namespace Test { namespace Int { namespace InterDistance { test_search = false; } Assignment* - assignment(void) const override { + assignment() const override { return new DistanceAssignment(arity, dom, p, variable, _rand); } bool @@ -188,7 +188,7 @@ namespace Test { namespace Int { namespace InterDistance { } } bool - has_more(void) const override { + has_more() const override { return values[0](); } void @@ -221,7 +221,7 @@ namespace Test { namespace Int { namespace InterDistance { test_search = false; } Assignment* - assignment(void) const override { + assignment() const override { return new ExampleAssignment(arity, domains); } bool @@ -252,7 +252,7 @@ namespace Test { namespace Int { namespace InterDistance { /// Posting contracts, vacuous constraints, and shared variables class Posting : public Base { static bool - constant_contracts(void) { + constant_contracts() { using namespace Gecode; IntSet domain(-2, 2); TestSpace s(0, domain, nullptr); @@ -290,13 +290,11 @@ namespace Test { namespace Int { namespace InterDistance { IntVar assigned(t, 3, 3); duplicate[0] = duplicate[1] = assigned; inter_distance(t, duplicate, 2); - if (t.status() != SS_FAILED) - return false; - return true; + return t.status() == SS_FAILED; } static bool - variable_contracts(void) { + variable_contracts() { using namespace Gecode; IntSet domain(-3, 9); TestSpace empty(0, domain, nullptr); @@ -331,15 +329,13 @@ namespace Test { namespace Int { namespace InterDistance { } catch (const Gecode::Int::ArgumentSame&) { repeated = true; } - if (!alias || !repeated) - return false; - return true; + return alias && repeated; } public: - Posting(void) : Base("Int::InterDistance::Posting", TestTags::check()) {} + Posting() : Base("Int::InterDistance::Posting", TestTags::check()) {} bool - run(void) override { + run() override { if (!constant_contracts()) { olog << "Constant posting contracts failed" << '\n'; return false; @@ -354,7 +350,7 @@ namespace Test { namespace Int { namespace InterDistance { class Create { public: - Create(void) { + Create() { using namespace Gecode; for (IntPropLevel level : {IPL_BASIC, IPL_ADVANCED, IPL_BASIC_ADVANCED}) { for (int n : {8, 24}) @@ -395,6 +391,6 @@ namespace Test { namespace Int { namespace InterDistance { } create; Posting posting; -}}} // namespace Test::Int::InterDistance +} // namespace Test::Int::InterDistance // STATISTICS: test-int diff --git a/test/int/linear.cpp b/test/int/linear.cpp index 31c1a7a30d..74b7a22e26 100644 --- a/test/int/linear.cpp +++ b/test/int/linear.cpp @@ -34,420 +34,416 @@ #include -namespace Test { namespace Int { +/// %Tests for linear constraints +namespace Test::Int::Linear { - /// %Tests for linear constraints - namespace Linear { + /// Check whether \a a has only one coefficients + static bool + one(const Gecode::IntArgs& a) { + for (int i = a.size(); i--;) + if (a[i] != 1) + return false; + return true; + } + + /** + * \defgroup TaskTestIntLinear Linear constraints + * \ingroup TaskTestInt + */ + //@{ + /// %Test linear relation over integer variables + class IntInt : public Test { + protected: + /// Coefficients + Gecode::IntArgs a; + /// Integer relation type to propagate + Gecode::IntRelType irt; + /// Result + int c; - /// Check whether \a a has only one coefficients + public: + /// Create and register test + IntInt(TestTags tags, const std::string& s, const Gecode::IntSet& d, const Gecode::IntArgs& a0, + Gecode::IntRelType irt0, int c0, Gecode::IntPropLevel ipl = Gecode::IPL_BND) + : Test(tags, + "Linear::Int::Int::" + str(irt0) + "::" + str(ipl) + "::" + s + "::" + str(c0) + + "::" + str(a0.size()), + a0.size(), d, ipl != Gecode::IPL_DOM, ipl), + a(a0), irt(irt0), c(c0) { + test_fixpoint = false; + } + /// %Test whether \a x is solution bool - one(const Gecode::IntArgs& a) { - for (int i = a.size(); i--;) - if (a[i] != 1) - return false; - return true; + solution(const Assignment& x) const override { + double e = 0.0; + for (int i = 0; i < x.size(); i++) + e += a[i] * x[i]; + return cmp(e, irt, static_cast(c)); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + if (one(a)) + Gecode::linear(home, x, irt, c, ipl); + else + Gecode::linear(home, a, x, irt, c, ipl); } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + if (one(a)) + Gecode::linear(home, x, irt, c, r, ipl); + else + Gecode::linear(home, a, x, irt, c, r, ipl); + } + }; - /** - * \defgroup TaskTestIntLinear Linear constraints - * \ingroup TaskTestInt - */ - //@{ - /// %Test linear relation over integer variables - class IntInt : public Test { - protected: - /// Coefficients - Gecode::IntArgs a; - /// Integer relation type to propagate - Gecode::IntRelType irt; - /// Result - int c; + /// %Test linear relation over integer variables + class IntVar : public Test { + protected: + /// Coefficients + Gecode::IntArgs a; + /// Integer relation type to propagate + Gecode::IntRelType irt; - public: - /// Create and register test - IntInt(TestTags tags, const std::string& s, const Gecode::IntSet& d, const Gecode::IntArgs& a0, - Gecode::IntRelType irt0, int c0, Gecode::IntPropLevel ipl = Gecode::IPL_BND) - : Test(tags, - "Linear::Int::Int::" + str(irt0) + "::" + str(ipl) + "::" + s + "::" + str(c0) + - "::" + str(a0.size()), - a0.size(), d, ipl != Gecode::IPL_DOM, ipl), - a(a0), irt(irt0), c(c0) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - double e = 0.0; - for (int i = 0; i < x.size(); i++) - e += a[i] * x[i]; - return cmp(e, irt, static_cast(c)); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - if (one(a)) - Gecode::linear(home, x, irt, c, ipl); - else - Gecode::linear(home, a, x, irt, c, ipl); - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - if (one(a)) - Gecode::linear(home, x, irt, c, r, ipl); - else - Gecode::linear(home, a, x, irt, c, r, ipl); - } - }; + public: + /// Create and register test + IntVar(const std::string& s, const Gecode::IntSet& d, const Gecode::IntArgs& a0, Gecode::IntRelType irt0, + Gecode::IntPropLevel ipl = Gecode::IPL_BND) + : Test(TestTags::sweep(), + "Linear::Int::Var::" + str(irt0) + "::" + str(ipl) + "::" + s + "::" + str(a0.size()), a0.size() + 1, + d, ipl != Gecode::IPL_DOM, ipl), + a(a0), irt(irt0) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + double e = 0.0; + for (int i = 0; i < a.size(); i++) + e += a[i] * x[i]; + return cmp(e, irt, static_cast(x[a.size()])); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + int n = a.size(); + Gecode::IntVarArgs y(n); + for (int i = n; i--;) + y[i] = x[i]; + if (one(a)) + Gecode::linear(home, y, irt, x[n], ipl); + else + Gecode::linear(home, a, y, irt, x[n], ipl); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + int n = a.size(); + Gecode::IntVarArgs y(n); + for (int i = n; i--;) + y[i] = x[i]; + if (one(a)) + Gecode::linear(home, y, irt, x[n], r, ipl); + else + Gecode::linear(home, a, y, irt, x[n], r, ipl); + } + }; - /// %Test linear relation over integer variables - class IntVar : public Test { - protected: - /// Coefficients - Gecode::IntArgs a; - /// Integer relation type to propagate - Gecode::IntRelType irt; + /// %Test linear relation over Boolean variables equal to constant + class BoolInt : public Test { + protected: + /// Coefficients + Gecode::IntArgs a; + /// Integer relation type to propagate + Gecode::IntRelType irt; + /// Righthand-side constant + int c; - public: - /// Create and register test - IntVar(const std::string& s, const Gecode::IntSet& d, const Gecode::IntArgs& a0, Gecode::IntRelType irt0, - Gecode::IntPropLevel ipl = Gecode::IPL_BND) - : Test(TestTags::sweep(), - "Linear::Int::Var::" + str(irt0) + "::" + str(ipl) + "::" + s + "::" + str(a0.size()), - a0.size() + 1, d, ipl != Gecode::IPL_DOM, ipl), - a(a0), irt(irt0) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - double e = 0.0; - for (int i = 0; i < a.size(); i++) - e += a[i] * x[i]; - return cmp(e, irt, static_cast(x[a.size()])); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - int n = a.size(); - Gecode::IntVarArgs y(n); - for (int i = n; i--;) - y[i] = x[i]; - if (one(a)) - Gecode::linear(home, y, irt, x[n], ipl); - else - Gecode::linear(home, a, y, irt, x[n], ipl); - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - int n = a.size(); - Gecode::IntVarArgs y(n); - for (int i = n; i--;) - y[i] = x[i]; - if (one(a)) - Gecode::linear(home, y, irt, x[n], r, ipl); - else - Gecode::linear(home, a, y, irt, x[n], r, ipl); - } - }; + public: + /// Create and register test + BoolInt(const std::string& s, const Gecode::IntArgs& a0, Gecode::IntRelType irt0, int c0) + : Test(irt0 == Gecode::IRT_LQ ? TestTags::check() : TestTags(TestTags::sweep()), + "Linear::Bool::Int::" + str(irt0) + "::" + s + "::" + str(a0.size()) + "::" + str(c0), a0.size(), 0, + 1, true, Gecode::IPL_DEF), + a(a0), irt(irt0), c(c0) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + double e = 0.0; + for (int i = 0; i < x.size(); i++) + e += a[i] * x[i]; + return cmp(e, irt, static_cast(c)); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::BoolVarArgs y(x.size()); + for (int i = x.size(); i--;) + y[i] = Gecode::channel(home, x[i]); + if (one(a)) + Gecode::linear(home, y, irt, c, Gecode::IPL_DEF); + else + Gecode::linear(home, a, y, irt, c, Gecode::IPL_DEF); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::BoolVarArgs y(x.size()); + for (int i = x.size(); i--;) + y[i] = Gecode::channel(home, x[i]); + if (one(a)) + Gecode::linear(home, y, irt, c, r, Gecode::IPL_DEF); + else + Gecode::linear(home, a, y, irt, c, r, Gecode::IPL_DEF); + } + }; - /// %Test linear relation over Boolean variables equal to constant - class BoolInt : public Test { - protected: - /// Coefficients - Gecode::IntArgs a; - /// Integer relation type to propagate - Gecode::IntRelType irt; - /// Righthand-side constant - int c; + /// %Test linear relation over Boolean variables equal to integer variable + class BoolVar : public Test { + protected: + /// Coefficients + Gecode::IntArgs a; + /// Integer relation type to propagate + Gecode::IntRelType irt; - public: - /// Create and register test - BoolInt(const std::string& s, const Gecode::IntArgs& a0, Gecode::IntRelType irt0, int c0) - : Test(irt0 == Gecode::IRT_LQ ? TestTags::check() : TestTags(TestTags::sweep()), - "Linear::Bool::Int::" + str(irt0) + "::" + s + "::" + str(a0.size()) + "::" + str(c0), a0.size(), - 0, 1, true, Gecode::IPL_DEF), - a(a0), irt(irt0), c(c0) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - double e = 0.0; - for (int i = 0; i < x.size(); i++) - e += a[i] * x[i]; - return cmp(e, irt, static_cast(c)); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::BoolVarArgs y(x.size()); - for (int i = x.size(); i--;) - y[i] = Gecode::channel(home, x[i]); - if (one(a)) - Gecode::linear(home, y, irt, c, Gecode::IPL_DEF); - else - Gecode::linear(home, a, y, irt, c, Gecode::IPL_DEF); - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::BoolVarArgs y(x.size()); - for (int i = x.size(); i--;) - y[i] = Gecode::channel(home, x[i]); - if (one(a)) - Gecode::linear(home, y, irt, c, r, Gecode::IPL_DEF); - else - Gecode::linear(home, a, y, irt, c, r, Gecode::IPL_DEF); - } - }; + public: + /// Create and register test + BoolVar(const std::string& s, int min, int max, const Gecode::IntArgs& a0, Gecode::IntRelType irt0) + : Test(TestTags::sweep(), "Linear::Bool::Var::" + str(irt0) + "::" + s, a0.size() + 1, min, max, true), + a(a0), irt(irt0) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() - 1; + for (int i = 0; i < n; i++) + if ((x[i] < 0) || (x[i] > 1)) + return false; + double e = 0.0; + for (int i = 0; i < n; i++) + e += a[i] * x[i]; + return cmp(e, irt, static_cast(x[n])); + } + /// %Test whether \a x is to be ignored + bool + ignore(const Assignment& x) const override { + for (int i = x.size() - 1; i--;) + if ((x[i] < 0) || (x[i] > 1)) + return true; + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + int n = x.size() - 1; + Gecode::BoolVarArgs y(n); + for (int i = n; i--;) + y[i] = Gecode::channel(home, x[i]); + if (one(a)) + Gecode::linear(home, y, irt, x[n]); + else + Gecode::linear(home, a, y, irt, x[n]); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + int n = x.size() - 1; + Gecode::BoolVarArgs y(n); + for (int i = n; i--;) + y[i] = Gecode::channel(home, x[i]); + if (one(a)) + Gecode::linear(home, y, irt, x[n], r); + else + Gecode::linear(home, a, y, irt, x[n], r); + } + }; - /// %Test linear relation over Boolean variables equal to integer variable - class BoolVar : public Test { - protected: - /// Coefficients - Gecode::IntArgs a; - /// Integer relation type to propagate - Gecode::IntRelType irt; + /// Space with an integer and a Boolean variable for sums without terms + class EmptyFixture : public Gecode::Space { + public: + /// Right-hand side variable + Gecode::IntVar y; + /// Reification variable + Gecode::BoolVar b; + /// Create fixture + EmptyFixture() : y(*this, -2, 2), b(*this, 0, 1) {} + /// Constructor for cloning \a fixture + EmptyFixture(EmptyFixture& fixture) : Gecode::Space(fixture) { + y.update(*this, fixture.y); + b.update(*this, fixture.b); + } + /// Copy during cloning + Gecode::Space* + copy() override { + return new EmptyFixture(*this); + } + /// Test whether the space is solved with \a b equal to \a val + bool + is_solved_with_b(int val) { + return (status() == Gecode::SS_SOLVED) && b.assigned() && (b.val() == val); + } + }; - public: - /// Create and register test - BoolVar(const std::string& s, int min, int max, const Gecode::IntArgs& a0, Gecode::IntRelType irt0) - : Test(TestTags::sweep(), "Linear::Bool::Var::" + str(irt0) + "::" + s, a0.size() + 1, min, max, true), - a(a0), irt(irt0) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() - 1; - for (int i = 0; i < n; i++) - if ((x[i] < 0) || (x[i] > 1)) - return false; - double e = 0.0; - for (int i = 0; i < n; i++) - e += a[i] * x[i]; - return cmp(e, irt, static_cast(x[n])); - } - /// %Test whether \a x is to be ignored - bool - ignore(const Assignment& x) const override { - for (int i = x.size() - 1; i--;) - if ((x[i] < 0) || (x[i] > 1)) - return true; - return false; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - int n = x.size() - 1; - Gecode::BoolVarArgs y(n); - for (int i = n; i--;) - y[i] = Gecode::channel(home, x[i]); - if (one(a)) - Gecode::linear(home, y, irt, x[n]); - else - Gecode::linear(home, a, y, irt, x[n]); - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - int n = x.size() - 1; - Gecode::BoolVarArgs y(n); - for (int i = n; i--;) - y[i] = Gecode::channel(home, x[i]); - if (one(a)) - Gecode::linear(home, y, irt, x[n], r); - else - Gecode::linear(home, a, y, irt, x[n], r); - } - }; + /// %Test linear constraints over no variables + class Empty : public Base { + public: + /// Create and register test + Empty() : Base("Int::Linear::Empty") {} + /// Perform test + bool + run() override { + using namespace Gecode; + IntVarArgs x; + BoolVarArgs bx; + IntArgs a; + EmptyFixture eq, nq, bool_lq, bool_y, reified, imp, pmi; + linear(eq, x, IRT_EQ, 0, IPL_DOM); + linear(nq, a, x, IRT_NQ, 0); + linear(bool_lq, a, bx, IRT_LQ, -1); + linear(bool_y, bx, IRT_EQ, bool_y.y); + linear(reified, x, IRT_EQ, 1, Reify(reified.b)); + linear(imp, a, bx, IRT_GQ, 1, Reify(imp.b, RM_IMP)); + linear(pmi, bx, IRT_LQ, 0, Reify(pmi.b, RM_RIMP)); + return (eq.status() == SS_SOLVED) && (nq.status() == SS_FAILED) && (bool_lq.status() == SS_FAILED) && + (bool_y.status() == SS_SOLVED) && bool_y.y.assigned() && (bool_y.y.val() == 0) && + reified.is_solved_with_b(0) && imp.is_solved_with_b(0) && pmi.is_solved_with_b(1); + } + }; + Empty empty; - /// Space with an integer and a Boolean variable for sums without terms - class EmptyFixture : public Gecode::Space { - public: - /// Right-hand side variable - Gecode::IntVar y; - /// Reification variable - Gecode::BoolVar b; - /// Create fixture - EmptyFixture(void) : y(*this, -2, 2), b(*this, 0, 1) {} - /// Constructor for cloning \a fixture - EmptyFixture(EmptyFixture& fixture) : Gecode::Space(fixture) { - y.update(*this, fixture.y); - b.update(*this, fixture.b); - } - /// Copy during cloning - Gecode::Space* - copy(void) override { - return new EmptyFixture(*this); - } - /// Test whether the space is solved with \a b equal to \a val - bool - is_solved_with_b(int val) { - return (status() == Gecode::SS_SOLVED) && b.assigned() && (b.val() == val); - } - }; + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + using namespace Gecode; + { + IntSet d1(-2, 2); + const int dv2[] = {-4, -1, 0, 1, 4}; + IntSet d2(dv2, 5); - /// %Test linear constraints over no variables - class Empty : public Base { - public: - /// Create and register test - Empty(void) : Base("Int::Linear::Empty") {} - /// Perform test - bool - run(void) override { - using namespace Gecode; - IntVarArgs x; - BoolVarArgs bx; - IntArgs a; - EmptyFixture eq, nq, bool_lq, bool_y, reified, imp, pmi; - linear(eq, x, IRT_EQ, 0, IPL_DOM); - linear(nq, a, x, IRT_NQ, 0); - linear(bool_lq, a, bx, IRT_LQ, -1); - linear(bool_y, bx, IRT_EQ, bool_y.y); - linear(reified, x, IRT_EQ, 1, Reify(reified.b)); - linear(imp, a, bx, IRT_GQ, 1, Reify(imp.b, RM_IMP)); - linear(pmi, bx, IRT_LQ, 0, Reify(pmi.b, RM_RIMP)); - return (eq.status() == SS_SOLVED) && (nq.status() == SS_FAILED) && (bool_lq.status() == SS_FAILED) && - (bool_y.status() == SS_SOLVED) && bool_y.y.assigned() && (bool_y.y.val() == 0) && - reified.is_solved_with_b(0) && imp.is_solved_with_b(0) && pmi.is_solved_with_b(1); - } - }; - Empty empty; + const int dv3[] = {0, 1500000000}; + IntSet d3(dv3, 2); - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - using namespace Gecode; - { - IntSet d1(-2, 2); - const int dv2[] = {-4, -1, 0, 1, 4}; - IntSet d2(dv2, 5); + IntArgs a1({0}); - const int dv3[] = {0, 1500000000}; - IntSet d3(dv3, 2); + for (IntRelTypes irts; irts(); ++irts) { + TestTags tags = irts.irt() == Gecode::IRT_EQ ? TestTags::standard() : TestTags::sweep(); + (void)new IntInt(tags, "11", d1, a1, irts.irt(), 0); + (void)new IntVar("11", d1, a1, irts.irt()); + (void)new IntInt(TestTags::sweep(), "21", d2, a1, irts.irt(), 0); + (void)new IntVar("21", d2, a1, irts.irt()); + (void)new IntInt(TestTags::sweep(), "31", d3, a1, irts.irt(), 150000000); + } + (void)new IntInt(TestTags::sweep(), "11", d1, a1, IRT_EQ, 0, IPL_DOM); + (void)new IntVar("11", d1, a1, IRT_EQ, IPL_DOM); + (void)new IntInt(TestTags::sweep(), "21", d2, a1, IRT_EQ, 0, IPL_DOM); + (void)new IntVar("21", d2, a1, IRT_EQ, IPL_DOM); - IntArgs a1({0}); + const int av2[5] = {1, 1, 1, 1, 1}; + const int av3[5] = {1, -1, -1, 1, -1}; + const int av4[5] = {2, 3, 5, 7, 11}; + const int av5[5] = {-2, 3, -5, 7, -11}; + for (int i = 1; i <= 5; i++) { + IntArgs a2(i, av2); + IntArgs a3(i, av3); + IntArgs a4(i, av4); + IntArgs a5(i, av5); for (IntRelTypes irts; irts(); ++irts) { - TestTags tags = irts.irt() == Gecode::IRT_EQ ? TestTags::standard() : TestTags::sweep(); - (void)new IntInt(tags, "11", d1, a1, irts.irt(), 0); - (void)new IntVar("11", d1, a1, irts.irt()); - (void)new IntInt(TestTags::sweep(), "21", d2, a1, irts.irt(), 0); - (void)new IntVar("21", d2, a1, irts.irt()); - (void)new IntInt(TestTags::sweep(), "31", d3, a1, irts.irt(), 150000000); + (void)new IntInt(TestTags::sweep(), "12", d1, a2, irts.irt(), 0); + (void)new IntInt(TestTags::sweep(), "13", d1, a3, irts.irt(), 0); + (void)new IntInt(TestTags::sweep(), "14", d1, a4, irts.irt(), 0); + (void)new IntInt(TestTags::sweep(), "15", d1, a5, irts.irt(), 0); + (void)new IntInt(TestTags::sweep(), "22", d2, a2, irts.irt(), 0); + (void)new IntInt(TestTags::sweep(), "23", d2, a3, irts.irt(), 0); + (void)new IntInt(TestTags::sweep(), "24", d2, a4, irts.irt(), 0); + (void)new IntInt(TestTags::sweep(), "25", d2, a5, irts.irt(), 0); + (void)new IntInt(TestTags::sweep(), "32", d3, a2, irts.irt(), 1500000000); + if (i < 5) { + (void)new IntVar("12", d1, a2, irts.irt()); + (void)new IntVar("13", d1, a3, irts.irt()); + (void)new IntVar("14", d1, a4, irts.irt()); + (void)new IntVar("15", d1, a5, irts.irt()); + (void)new IntVar("22", d2, a2, irts.irt()); + (void)new IntVar("23", d2, a3, irts.irt()); + (void)new IntVar("24", d2, a4, irts.irt()); + (void)new IntVar("25", d2, a5, irts.irt()); + } } - (void)new IntInt(TestTags::sweep(), "11", d1, a1, IRT_EQ, 0, IPL_DOM); - (void)new IntVar("11", d1, a1, IRT_EQ, IPL_DOM); - (void)new IntInt(TestTags::sweep(), "21", d2, a1, IRT_EQ, 0, IPL_DOM); - (void)new IntVar("21", d2, a1, IRT_EQ, IPL_DOM); - - const int av2[5] = {1, 1, 1, 1, 1}; - const int av3[5] = {1, -1, -1, 1, -1}; - const int av4[5] = {2, 3, 5, 7, 11}; - const int av5[5] = {-2, 3, -5, 7, -11}; + (void)new IntInt(TestTags::sweep(), "12", d1, a2, IRT_EQ, 0, IPL_DOM); + (void)new IntInt(TestTags::sweep(), "13", d1, a3, IRT_EQ, 0, IPL_DOM); + (void)new IntInt(TestTags::sweep(), "14", d1, a4, IRT_EQ, 0, IPL_DOM); + (void)new IntInt(TestTags::sweep(), "15", d1, a5, IRT_EQ, 0, IPL_DOM); + (void)new IntInt(TestTags::sweep(), "22", d2, a2, IRT_EQ, 0, IPL_DOM); + (void)new IntInt(TestTags::sweep(), "23", d2, a3, IRT_EQ, 0, IPL_DOM); + (void)new IntInt(TestTags::sweep(), "24", d2, a4, IRT_EQ, 0, IPL_DOM); + (void)new IntInt(TestTags::sweep(), "25", d2, a5, IRT_EQ, 0, IPL_DOM); + if (i < 4) { + (void)new IntVar("12", d1, a2, IRT_EQ, IPL_DOM); + (void)new IntVar("13", d1, a3, IRT_EQ, IPL_DOM); + (void)new IntVar("14", d1, a4, IRT_EQ, IPL_DOM); + (void)new IntVar("15", d1, a5, IRT_EQ, IPL_DOM); + } + } + } + { + const int av1[10] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; + const int av2[10] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; - for (int i = 1; i <= 5; i++) { - IntArgs a2(i, av2); - IntArgs a3(i, av3); - IntArgs a4(i, av4); - IntArgs a5(i, av5); + for (int i = 1; i <= 10; i += 3) { + IntArgs a1(i, av1); + IntArgs a2(i, av2); + for (int c = 0; c <= 6; c++) for (IntRelTypes irts; irts(); ++irts) { - (void)new IntInt(TestTags::sweep(), "12", d1, a2, irts.irt(), 0); - (void)new IntInt(TestTags::sweep(), "13", d1, a3, irts.irt(), 0); - (void)new IntInt(TestTags::sweep(), "14", d1, a4, irts.irt(), 0); - (void)new IntInt(TestTags::sweep(), "15", d1, a5, irts.irt(), 0); - (void)new IntInt(TestTags::sweep(), "22", d2, a2, irts.irt(), 0); - (void)new IntInt(TestTags::sweep(), "23", d2, a3, irts.irt(), 0); - (void)new IntInt(TestTags::sweep(), "24", d2, a4, irts.irt(), 0); - (void)new IntInt(TestTags::sweep(), "25", d2, a5, irts.irt(), 0); - (void)new IntInt(TestTags::sweep(), "32", d3, a2, irts.irt(), 1500000000); - if (i < 5) { - (void)new IntVar("12", d1, a2, irts.irt()); - (void)new IntVar("13", d1, a3, irts.irt()); - (void)new IntVar("14", d1, a4, irts.irt()); - (void)new IntVar("15", d1, a5, irts.irt()); - (void)new IntVar("22", d2, a2, irts.irt()); - (void)new IntVar("23", d2, a3, irts.irt()); - (void)new IntVar("24", d2, a4, irts.irt()); - (void)new IntVar("25", d2, a5, irts.irt()); - } + (void)new BoolInt("1", a1, irts.irt(), c); + (void)new BoolInt("2", a2, irts.irt(), -c); } - (void)new IntInt(TestTags::sweep(), "12", d1, a2, IRT_EQ, 0, IPL_DOM); - (void)new IntInt(TestTags::sweep(), "13", d1, a3, IRT_EQ, 0, IPL_DOM); - (void)new IntInt(TestTags::sweep(), "14", d1, a4, IRT_EQ, 0, IPL_DOM); - (void)new IntInt(TestTags::sweep(), "15", d1, a5, IRT_EQ, 0, IPL_DOM); - (void)new IntInt(TestTags::sweep(), "22", d2, a2, IRT_EQ, 0, IPL_DOM); - (void)new IntInt(TestTags::sweep(), "23", d2, a3, IRT_EQ, 0, IPL_DOM); - (void)new IntInt(TestTags::sweep(), "24", d2, a4, IRT_EQ, 0, IPL_DOM); - (void)new IntInt(TestTags::sweep(), "25", d2, a5, IRT_EQ, 0, IPL_DOM); - if (i < 4) { - (void)new IntVar("12", d1, a2, IRT_EQ, IPL_DOM); - (void)new IntVar("13", d1, a3, IRT_EQ, IPL_DOM); - (void)new IntVar("14", d1, a4, IRT_EQ, IPL_DOM); - (void)new IntVar("15", d1, a5, IRT_EQ, IPL_DOM); - } - } } - { - const int av1[10] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; - const int av2[10] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; - for (int i = 1; i <= 10; i += 3) { - IntArgs a1(i, av1); - IntArgs a2(i, av2); - for (int c = 0; c <= 6; c++) - for (IntRelTypes irts; irts(); ++irts) { - (void)new BoolInt("1", a1, irts.irt(), c); - (void)new BoolInt("2", a2, irts.irt(), -c); - } - } - - IntArgs a3({1, 2, 3, 4, 5}); - IntArgs a4({-1, -2, -3, -4, -5}); - IntArgs a5({-1, -2, 1, 2, 4}); + IntArgs a3({1, 2, 3, 4, 5}); + IntArgs a4({-1, -2, -3, -4, -5}); + IntArgs a5({-1, -2, 1, 2, 4}); - for (IntRelTypes irts; irts(); ++irts) { - for (int c = 0; c <= 16; c++) { - (void)new BoolInt("3", a3, irts.irt(), c); - (void)new BoolInt("4", a4, irts.irt(), -c); - (void)new BoolInt("5", a5, irts.irt(), c); - (void)new BoolInt("6", a5, irts.irt(), -c); - } + for (IntRelTypes irts; irts(); ++irts) { + for (int c = 0; c <= 16; c++) { + (void)new BoolInt("3", a3, irts.irt(), c); + (void)new BoolInt("4", a4, irts.irt(), -c); + (void)new BoolInt("5", a5, irts.irt(), c); + (void)new BoolInt("6", a5, irts.irt(), -c); } + } - for (int i = 1; i <= 5; i += 2) { - IntArgs a1(i, av1); - IntArgs a2(i, av2); - for (IntRelTypes irts; irts(); ++irts) { - (void)new BoolVar("1::" + Test::str(i), 0, 5, a1, irts.irt()); - (void)new BoolVar("2::" + Test::str(i), -5, 0, a2, irts.irt()); - } + for (int i = 1; i <= 5; i += 2) { + IntArgs a1(i, av1); + IntArgs a2(i, av2); + for (IntRelTypes irts; irts(); ++irts) { + (void)new BoolVar("1::" + Test::str(i), 0, 5, a1, irts.irt()); + (void)new BoolVar("2::" + Test::str(i), -5, 0, a2, irts.irt()); } + } - IntArgs a6({1, 2, 3, 4}); - IntArgs a7({-1, -2, -3, -4}); - IntArgs a8({-1, -2, 1, 2}); - IntArgs a9({-1, -2, 1, 2, -3, 3}); + IntArgs a6({1, 2, 3, 4}); + IntArgs a7({-1, -2, -3, -4}); + IntArgs a8({-1, -2, 1, 2}); + IntArgs a9({-1, -2, 1, 2, -3, 3}); - for (IntRelTypes irts; irts(); ++irts) { - (void)new BoolVar("6", 0, 10, a6, irts.irt()); - (void)new BoolVar("7", -10, 0, a7, irts.irt()); - (void)new BoolVar("8", -3, 3, a8, irts.irt()); - (void)new BoolVar("9", -3, 3, a9, irts.irt()); - } + for (IntRelTypes irts; irts(); ++irts) { + (void)new BoolVar("6", 0, 10, a6, irts.irt()); + (void)new BoolVar("7", -10, 0, a7, irts.irt()); + (void)new BoolVar("8", -3, 3, a8, irts.irt()); + (void)new BoolVar("9", -3, 3, a9, irts.irt()); } } - }; - - Create c; - //@} + } + }; - } // namespace Linear -}} // namespace Test::Int + Create c; + //@} +} // namespace Test::Int::Linear // STATISTICS: test-int diff --git a/test/int/member.cpp b/test/int/member.cpp index 456fd8c4f3..cbc6ea4fc9 100644 --- a/test/int/member.cpp +++ b/test/int/member.cpp @@ -33,104 +33,100 @@ #include #include "test/int.hh" -namespace Test { namespace Int { +/// %Tests for membership constraints +namespace Test::Int::Member { - /// %Tests for membership constraints - namespace Member { + /** + * \defgroup TaskTestIntMember Membership constraints + * \ingroup TaskTestInt + */ + //@{ + /// %Test membership for integer variables + class Int : public Test { + public: + /// Create and register test + Int(int n) : Test("Member::Int::" + str(n), n + 1, 0, n, true) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() - 1; + for (int i = n; i--;) + if (x[i] == x[n]) + return true; + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + int n = x.size() - 1; + IntVarArgs y(n); + for (int i = n; i--;) + y[i] = x[i]; + member(home, y, x[n]); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + using namespace Gecode; + int n = x.size() - 1; + IntVarArgs y(n); + for (int i = n; i--;) + y[i] = x[i]; + member(home, y, x[n], r); + } + }; - /** - * \defgroup TaskTestIntMember Membership constraints - * \ingroup TaskTestInt - */ - //@{ - /// %Test membership for integer variables - class Int : public Test { - public: - /// Create and register test - Int(int n) : Test("Member::Int::" + str(n), n + 1, 0, n, true) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() - 1; - for (int i = n; i--;) - if (x[i] == x[n]) - return true; - return false; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - int n = x.size() - 1; - IntVarArgs y(n); - for (int i = n; i--;) - y[i] = x[i]; - member(home, y, x[n]); - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - using namespace Gecode; - int n = x.size() - 1; - IntVarArgs y(n); - for (int i = n; i--;) - y[i] = x[i]; - member(home, y, x[n], r); - } - }; - - /// %Test membership for Boolean variables - class Bool : public Test { - public: - /// Create and register test - Bool(int n) : Test("Member::Bool::" + str(n), n + 1, 0, 1, true) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() - 1; - for (int i = n; i--;) - if (x[i] == x[n]) - return true; - return false; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - int n = x.size() - 1; - BoolVarArgs y(n); - for (int i = n; i--;) - y[i] = channel(home, x[i]); - member(home, y, channel(home, x[n])); - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - using namespace Gecode; - int n = x.size() - 1; - BoolVarArgs y(n); - for (int i = n; i--;) - y[i] = channel(home, x[i]); - member(home, y, channel(home, x[n]), r); - } - }; + /// %Test membership for Boolean variables + class Bool : public Test { + public: + /// Create and register test + Bool(int n) : Test("Member::Bool::" + str(n), n + 1, 0, 1, true) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() - 1; + for (int i = n; i--;) + if (x[i] == x[n]) + return true; + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + int n = x.size() - 1; + BoolVarArgs y(n); + for (int i = n; i--;) + y[i] = channel(home, x[i]); + member(home, y, channel(home, x[n])); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + using namespace Gecode; + int n = x.size() - 1; + BoolVarArgs y(n); + for (int i = n; i--;) + y[i] = channel(home, x[i]); + member(home, y, channel(home, x[n]), r); + } + }; - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - for (int i = 0; i <= 4; i++) { - (void)new Int(i); - (void)new Bool(i); - } + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + for (int i = 0; i <= 4; i++) { + (void)new Int(i); + (void)new Bool(i); } - }; - - Create c; - //@} + } + }; - } // namespace Member -}} // namespace Test::Int + Create c; + //@} +} // namespace Test::Int::Member // STATISTICS: test-int diff --git a/test/int/min-distance.cpp b/test/int/min-distance.cpp index 830ccbddf6..293136f303 100644 --- a/test/int/min-distance.cpp +++ b/test/int/min-distance.cpp @@ -34,11 +34,11 @@ #include -namespace Test { namespace Int { namespace MinDistance { +namespace Test::Int::MinDistance { /// Distances with both a zero off-diagonal pair and threshold boundaries - Gecode::IntArgs - matrix(void) { + static Gecode::IntArgs + matrix() { return Gecode::IntArgs({0, 0, 3, 4, 0, 0, 2, 1, 3, 2, 0, 4, 4, 1, 4, 0}); } @@ -95,8 +95,8 @@ namespace Test { namespace Int { namespace MinDistance { const IntVar& z = a[alias == 2 ? 0 : positions]; if (requirements) { IntArgs r(positions * positions); - for (int i = 0; i < r.size(); i++) - r[i] = 0; + for (int& ri : r) + ri = 0; r[positions - 1] = r[(positions - 1) * positions] = 3; minimum_distance(home, x, z, d, r, ipl, kind); } else { @@ -120,7 +120,7 @@ namespace Test { namespace Int { namespace MinDistance { z.update(*this, s.z); } Gecode::Space* - copy(void) override { + copy() override { return new Model(*this); } }; @@ -129,9 +129,9 @@ namespace Test { namespace Int { namespace MinDistance { // Check domain bounds before assignment and ownership across Space clones. class Propagation : public Base { public: - Propagation(void) : Base("Int::MinDistance::Propagation", TestTags::check()) {} + Propagation() : Base("Int::MinDistance::Propagation", TestTags::check()) {} bool - run(void) override { + run() override { using namespace Gecode; const MinDistancePropKind kinds[] = {MDP_DECOMPOSED, MDP_SINGLE}; const IntPropLevel levels[] = {IPL_BASIC, IPL_ADVANCED}; @@ -178,39 +178,41 @@ namespace Test { namespace Int { namespace MinDistance { if (lifetime.expired() || (clone->status() == SS_FAILED)) return false; clone.reset(); - if (!lifetime.expired()) - return false; - return true; + return lifetime.expired(); } }; /// Matrix and callback validation class Arguments : public Base { public: - Arguments(void) : Base("Int::MinDistance::Arguments", TestTags::check()) {} + Arguments() : Base("Int::MinDistance::Arguments", TestTags::check()) {} bool - run(void) override { + run() override { using namespace Gecode; try { IntDistance invalid(2, IntArgs({0, 1, 2, 0})); return false; } catch (const Gecode::Int::IllegalOperation&) { + // Expected } try { IntDistance invalid(2, IntArgs({0, -1, -1, 0})); return false; } catch (const Gecode::Int::OutOfLimits&) { + // Expected } try { IntDistance invalid(2, std::function()); return false; } catch (const InvalidFunction&) { + // Expected } try { IntDistance invalid(2, [](int, int) { return -1; }); (void)invalid(0, 1); return false; } catch (const Gecode::Int::OutOfLimits&) { + // Expected } try { Model space(2, 4, 0, 4, MDP_DECOMPOSED, IPL_BASIC, [](int a, int b) { return std::abs(a - b); }); @@ -219,6 +221,7 @@ namespace Test { namespace Int { namespace MinDistance { minimum_distance(space, x, z, IntDistance(4, matrix())); return false; } catch (const Gecode::Int::TooFewArguments&) { + // Expected } return true; } @@ -227,7 +230,7 @@ namespace Test { namespace Int { namespace MinDistance { /// Register the compact semantic matrix class Create { public: - Create(void) { + Create() { const Gecode::MinDistancePropKind kinds[] = {Gecode::MDP_DECOMPOSED, Gecode::MDP_SINGLE}; const Gecode::IntPropLevel levels[] = {Gecode::IPL_BASIC, Gecode::IPL_ADVANCED}; for (int n : {2, 3}) @@ -248,6 +251,6 @@ namespace Test { namespace Int { namespace MinDistance { }; Create create; -}}} // namespace Test::Int::MinDistance +} // namespace Test::Int::MinDistance // STATISTICS: test-int diff --git a/test/int/mm-arithmetic.cpp b/test/int/mm-arithmetic.cpp index 23a11b1fca..a068f6ed5f 100644 --- a/test/int/mm-arithmetic.cpp +++ b/test/int/mm-arithmetic.cpp @@ -34,341 +34,334 @@ #include -namespace Test { namespace Int { - - /// %Tests for minimal modelling constraints (arithmetic) - namespace MiniModelArithmetic { - - /** - * \defgroup TaskTestIntMiniModelArithmetic Minimal modelling constraints (arithmetic) - * \ingroup TaskTestInt - */ - //@{ - /// %Test for multiplication constraint - class Mult : public Test { - public: - /// Create and register test - Mult(const std::string& s, const Gecode::IntSet& d) : Test("MiniModel::Mult::" + s, 3, d) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - double d0 = static_cast(x[0]); - double d1 = static_cast(x[1]); - double d2 = static_cast(x[2]); - return d0 * d1 == d2; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - rel(home, expr(home, x[0] * x[1]), IRT_EQ, x[2], IPL_DOM); - } - }; - - /// %Test for division constraint - class Div : public Test { - public: - /// Create and register test - Div(const std::string& s, const Gecode::IntSet& d) : Test("MiniModel::Div::" + s, 3, d) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return (x[1] != 0) && (x[0] / x[1] == x[2]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - rel(home, expr(home, x[0] / x[1]), IRT_EQ, x[2], IPL_DOM); - } - }; - - /// %Test for division constraint - class Mod : public Test { - public: - /// Create and register test - Mod(const std::string& s, const Gecode::IntSet& d) : Test("MiniModel::Mod::" + s, 3, d) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return (x[1] != 0) && (x[0] % x[1] == x[2]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - rel(home, expr(home, x[0] % x[1]), IRT_EQ, x[2], IPL_DOM); - } - }; - - /// %Test for addition constraint - class Plus : public Test { - public: - /// Create and register test - Plus(const std::string& s, const Gecode::IntSet& d) : Test("MiniModel::Plus::" + s, 3, d) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - double d0 = static_cast(x[0]); - double d1 = static_cast(x[1]); - double d2 = static_cast(x[2]); - return ((d0 + d1 >= Gecode::Int::Limits::min) && (d0 + d1 <= Gecode::Int::Limits::max) && - (d0 + d1 == d2)); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - rel(home, expr(home, x[0] + x[1]), IRT_EQ, x[2], IPL_DOM); - } - }; - - /// %Test for subtraction constraint - class Minus : public Test { - public: - /// Create and register test - Minus(const std::string& s, const Gecode::IntSet& d) : Test("MiniModel::Minus::" + s, 3, d) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - double d0 = static_cast(x[0]); - double d1 = static_cast(x[1]); - double d2 = static_cast(x[2]); - return ((d0 - d1 >= Gecode::Int::Limits::min) && (d0 - d1 <= Gecode::Int::Limits::max) && - (d0 - d1 == d2)); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - rel(home, expr(home, x[0] - x[1]), IRT_EQ, x[2], IPL_DOM); - } - }; - - /// %Test for sqr constraint - class Sqr : public Test { - public: - /// Create and register test - Sqr(const std::string& s, const Gecode::IntSet& d) : Test("MiniModel::Sqr::" + s, 2, d) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - double d0 = static_cast(x[0]); - double d1 = static_cast(x[1]); - return d0 * d0 == d1; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - rel(home, expr(home, sqr(x[0])), IRT_EQ, x[1], IPL_DOM); - } - }; - - /// %Test for sqrt constraint - class Sqrt : public Test { - public: - /// Create and register test - Sqrt(const std::string& s, const Gecode::IntSet& d) : Test("MiniModel::Sqrt::" + s, 2, d) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - double d0 = static_cast(x[0]); - double d1 = static_cast(x[1]); - return (d0 >= 0) && (d0 >= d1 * d1) && (d0 < (d1 + 1) * (d1 + 1)); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - rel(home, expr(home, sqrt(x[0])), IRT_EQ, x[1], IPL_DOM); - } - }; - - /// %Test for absolute value constraint - class Abs : public Test { - public: - /// Create and register test - Abs(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) - : Test("MiniModel::Abs::" + str(ipl) + "::" + s, 2, d, false, ipl) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - double d0 = static_cast(x[0]); - double d1 = static_cast(x[1]); - return (d0 < 0.0 ? -d0 : d0) == d1; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - rel(home, expr(home, abs(x[0]), ipl), IRT_EQ, x[1], IPL_DOM); - } - }; - - /// %Test for binary minimum constraint - class Min : public Test { - public: - /// Create and register test - Min(const std::string& s, const Gecode::IntSet& d) : Test("MiniModel::Min::Bin::" + s, 3, d) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return std::min(x[0], x[1]) == x[2]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - rel(home, expr(home, min(x[0], x[1])), IRT_EQ, x[2], IPL_DOM); - } - }; - - /// %Test for binary maximum constraint - class Max : public Test { - public: - /// Create and register test - Max(const std::string& s, const Gecode::IntSet& d) : Test("MiniModel::Max::Bin::" + s, 3, d) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return std::max(x[0], x[1]) == x[2]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - rel(home, expr(home, max(x[0], x[1])), IRT_EQ, x[2], IPL_DOM); - } - }; - - /// %Test for n-ary minimmum constraint - class MinNary : public Test { - public: - /// Create and register test - MinNary(void) : Test("MiniModel::Min::Nary", 4, -4, 4) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return std::min(std::min(x[0], x[1]), x[2]) == x[3]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - IntVarArgs m(3); - m[0] = x[0]; - m[1] = x[1]; - m[2] = x[2]; - rel(home, expr(home, min(m)), IRT_EQ, x[3], IPL_DOM); - } - }; - - /// %Test for n-ary maximum constraint - class MaxNary : public Test { - public: - /// Create and register test - MaxNary(void) : Test("MiniModel::Max::Nary", 4, -4, 4) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return std::max(std::max(x[0], x[1]), x[2]) == x[3]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - IntVarArgs m(3); - m[0] = x[0]; - m[1] = x[1]; - m[2] = x[2]; - rel(home, expr(home, max(m)), IRT_EQ, x[3], IPL_DOM); - } - }; - - const int v1[7] = {Gecode::Int::Limits::min, Gecode::Int::Limits::min + 1, -1, 0, 1, - Gecode::Int::Limits::max - 1, Gecode::Int::Limits::max}; - const int v2[9] = { - static_cast(-sqrt(static_cast(-Gecode::Int::Limits::min))), -4, -2, -1, 0, 1, 2, 4, - static_cast(sqrt(static_cast(Gecode::Int::Limits::max)))}; - - Gecode::IntSet d1(v1, 7); - Gecode::IntSet d2(v2, 9); - Gecode::IntSet d3(-8, 8); - - Mult mult_max("A", d1); - Mult mult_med("B", d2); - Mult mult_min("C", d3); - - Div div_max("A", d1); - Div div_med("B", d2); - Div div_min("C", d3); - - Mod mod_max("A", d1); - Mod mod_med("B", d2); - Mod mod_min("C", d3); - - Plus plus_max("A", d1); - Plus plus_med("B", d2); - Plus plus_min("C", d3); - - Minus minus_max("A", d1); - Minus minus_med("B", d2); - Minus minus_min("C", d3); - - Sqr sqr_max("A", d1); - Sqr sqr_med("B", d2); - Sqr sqr_min("C", d3); - - Sqrt sqrt_max("A", d1); - Sqrt sqrt_med("B", d2); - Sqrt sqrt_min("C", d3); - - Abs abs_bnd_max("A", d1, Gecode::IPL_BND); - Abs abs_bnd_med("B", d2, Gecode::IPL_BND); - Abs abs_bnd_min("C", d3, Gecode::IPL_BND); - Abs abs_dom_max("A", d1, Gecode::IPL_DOM); - Abs abs_dom_med("B", d2, Gecode::IPL_DOM); - Abs abs_dom_min("C", d3, Gecode::IPL_DOM); - - Min min_max("A", d1); - Min min_med("B", d2); - Min min_min("C", d3); - - Max max_max("A", d1); - Max max_med("B", d2); - Max max_min("C", d3); - - MinNary min_nary; - MaxNary max_nary; - - //@} - } // namespace MiniModelArithmetic - -}} // namespace Test::Int +/// %Tests for minimal modelling constraints (arithmetic) +namespace Test::Int::MiniModelArithmetic { + + /** + * \defgroup TaskTestIntMiniModelArithmetic Minimal modelling constraints (arithmetic) + * \ingroup TaskTestInt + */ + //@{ + /// %Test for multiplication constraint + class Mult : public Test { + public: + /// Create and register test + Mult(const std::string& s, const Gecode::IntSet& d) : Test("MiniModel::Mult::" + s, 3, d) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + double d0 = static_cast(x[0]); + double d1 = static_cast(x[1]); + double d2 = static_cast(x[2]); + return d0 * d1 == d2; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + rel(home, expr(home, x[0] * x[1]), IRT_EQ, x[2], IPL_DOM); + } + }; + + /// %Test for division constraint + class Div : public Test { + public: + /// Create and register test + Div(const std::string& s, const Gecode::IntSet& d) : Test("MiniModel::Div::" + s, 3, d) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return (x[1] != 0) && (x[0] / x[1] == x[2]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + rel(home, expr(home, x[0] / x[1]), IRT_EQ, x[2], IPL_DOM); + } + }; + + /// %Test for division constraint + class Mod : public Test { + public: + /// Create and register test + Mod(const std::string& s, const Gecode::IntSet& d) : Test("MiniModel::Mod::" + s, 3, d) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return (x[1] != 0) && (x[0] % x[1] == x[2]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + rel(home, expr(home, x[0] % x[1]), IRT_EQ, x[2], IPL_DOM); + } + }; + + /// %Test for addition constraint + class Plus : public Test { + public: + /// Create and register test + Plus(const std::string& s, const Gecode::IntSet& d) : Test("MiniModel::Plus::" + s, 3, d) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + double d0 = static_cast(x[0]); + double d1 = static_cast(x[1]); + double d2 = static_cast(x[2]); + return ((d0 + d1 >= Gecode::Int::Limits::min) && (d0 + d1 <= Gecode::Int::Limits::max) && (d0 + d1 == d2)); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + rel(home, expr(home, x[0] + x[1]), IRT_EQ, x[2], IPL_DOM); + } + }; + + /// %Test for subtraction constraint + class Minus : public Test { + public: + /// Create and register test + Minus(const std::string& s, const Gecode::IntSet& d) : Test("MiniModel::Minus::" + s, 3, d) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + double d0 = static_cast(x[0]); + double d1 = static_cast(x[1]); + double d2 = static_cast(x[2]); + return ((d0 - d1 >= Gecode::Int::Limits::min) && (d0 - d1 <= Gecode::Int::Limits::max) && (d0 - d1 == d2)); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + rel(home, expr(home, x[0] - x[1]), IRT_EQ, x[2], IPL_DOM); + } + }; + + /// %Test for sqr constraint + class Sqr : public Test { + public: + /// Create and register test + Sqr(const std::string& s, const Gecode::IntSet& d) : Test("MiniModel::Sqr::" + s, 2, d) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + double d0 = static_cast(x[0]); + double d1 = static_cast(x[1]); + return d0 * d0 == d1; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + rel(home, expr(home, sqr(x[0])), IRT_EQ, x[1], IPL_DOM); + } + }; + + /// %Test for sqrt constraint + class Sqrt : public Test { + public: + /// Create and register test + Sqrt(const std::string& s, const Gecode::IntSet& d) : Test("MiniModel::Sqrt::" + s, 2, d) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + double d0 = static_cast(x[0]); + double d1 = static_cast(x[1]); + return (d0 >= 0) && (d0 >= d1 * d1) && (d0 < (d1 + 1) * (d1 + 1)); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + rel(home, expr(home, sqrt(x[0])), IRT_EQ, x[1], IPL_DOM); + } + }; + + /// %Test for absolute value constraint + class Abs : public Test { + public: + /// Create and register test + Abs(const std::string& s, const Gecode::IntSet& d, Gecode::IntPropLevel ipl) + : Test("MiniModel::Abs::" + str(ipl) + "::" + s, 2, d, false, ipl) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + double d0 = static_cast(x[0]); + double d1 = static_cast(x[1]); + return (d0 < 0.0 ? -d0 : d0) == d1; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + rel(home, expr(home, abs(x[0]), ipl), IRT_EQ, x[1], IPL_DOM); + } + }; + + /// %Test for binary minimum constraint + class Min : public Test { + public: + /// Create and register test + Min(const std::string& s, const Gecode::IntSet& d) : Test("MiniModel::Min::Bin::" + s, 3, d) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return std::min(x[0], x[1]) == x[2]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + rel(home, expr(home, min(x[0], x[1])), IRT_EQ, x[2], IPL_DOM); + } + }; + + /// %Test for binary maximum constraint + class Max : public Test { + public: + /// Create and register test + Max(const std::string& s, const Gecode::IntSet& d) : Test("MiniModel::Max::Bin::" + s, 3, d) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return std::max(x[0], x[1]) == x[2]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + rel(home, expr(home, max(x[0], x[1])), IRT_EQ, x[2], IPL_DOM); + } + }; + + /// %Test for n-ary minimmum constraint + class MinNary : public Test { + public: + /// Create and register test + MinNary() : Test("MiniModel::Min::Nary", 4, -4, 4) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return std::min({x[0], x[1], x[2]}) == x[3]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + IntVarArgs m(3); + m[0] = x[0]; + m[1] = x[1]; + m[2] = x[2]; + rel(home, expr(home, min(m)), IRT_EQ, x[3], IPL_DOM); + } + }; + + /// %Test for n-ary maximum constraint + class MaxNary : public Test { + public: + /// Create and register test + MaxNary() : Test("MiniModel::Max::Nary", 4, -4, 4) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return std::max({x[0], x[1], x[2]}) == x[3]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + IntVarArgs m(3); + m[0] = x[0]; + m[1] = x[1]; + m[2] = x[2]; + rel(home, expr(home, max(m)), IRT_EQ, x[3], IPL_DOM); + } + }; + + const int v1[7] = {Gecode::Int::Limits::min, Gecode::Int::Limits::min + 1, -1, 0, 1, + Gecode::Int::Limits::max - 1, Gecode::Int::Limits::max}; + const int v2[9] = {static_cast(-sqrt(static_cast(-Gecode::Int::Limits::min))), -4, -2, -1, 0, 1, 2, 4, + static_cast(sqrt(static_cast(Gecode::Int::Limits::max)))}; + + Gecode::IntSet d1(v1, 7); + Gecode::IntSet d2(v2, 9); + Gecode::IntSet d3(-8, 8); + + Mult mult_max("A", d1); + Mult mult_med("B", d2); + Mult mult_min("C", d3); + + Div div_max("A", d1); + Div div_med("B", d2); + Div div_min("C", d3); + + Mod mod_max("A", d1); + Mod mod_med("B", d2); + Mod mod_min("C", d3); + + Plus plus_max("A", d1); + Plus plus_med("B", d2); + Plus plus_min("C", d3); + + Minus minus_max("A", d1); + Minus minus_med("B", d2); + Minus minus_min("C", d3); + + Sqr sqr_max("A", d1); + Sqr sqr_med("B", d2); + Sqr sqr_min("C", d3); + + Sqrt sqrt_max("A", d1); + Sqrt sqrt_med("B", d2); + Sqrt sqrt_min("C", d3); + + Abs abs_bnd_max("A", d1, Gecode::IPL_BND); + Abs abs_bnd_med("B", d2, Gecode::IPL_BND); + Abs abs_bnd_min("C", d3, Gecode::IPL_BND); + Abs abs_dom_max("A", d1, Gecode::IPL_DOM); + Abs abs_dom_med("B", d2, Gecode::IPL_DOM); + Abs abs_dom_min("C", d3, Gecode::IPL_DOM); + + Min min_max("A", d1); + Min min_med("B", d2); + Min min_min("C", d3); + + Max max_max("A", d1); + Max max_med("B", d2); + Max max_min("C", d3); + + MinNary min_nary; + MaxNary max_nary; + + //@} +} // namespace Test::Int::MiniModelArithmetic // STATISTICS: test-minimodel diff --git a/test/int/mm-bool.cpp b/test/int/mm-bool.cpp index bb89bdbe35..2edad433b1 100644 --- a/test/int/mm-bool.cpp +++ b/test/int/mm-bool.cpp @@ -38,2009 +38,1994 @@ #include -namespace Test { namespace Int { +/// %Tests for minimal modelling constraints (Boolean) +namespace Test::Int::MiniModelBoolean { - /// %Tests for minimal modelling constraints (Boolean) - namespace MiniModelBoolean { + /// Boolean opcode + enum BoolOpcode { + BO_NOT, ///< Negation + BO_AND, ///< Conjunction + BO_OR, ///< Disjunction + BO_IMP, ///< Implication + BO_XOR, ///< Exclusive or + BO_EQV, ///< Equivalence + BO_HLT ///< Stop execution + }; - /// Boolean opcode - enum BoolOpcode { - BO_NOT, ///< Negation - BO_AND, ///< Conjunction - BO_OR, ///< Disjunction - BO_IMP, ///< Implication - BO_XOR, ///< Exclusive or - BO_EQV, ///< Equivalence - BO_HLT ///< Stop execution - }; + /// Type for representing a Boolean instruction + class BoolInstr { + public: + BoolOpcode o; ///< Which instruction to execute + unsigned char x, y, z; ///< Instruction arguments, \a z is destination (or \a y for negation) + }; - /// Type for representing a Boolean instruction - class BoolInstr { - public: - BoolOpcode o; ///< Which instruction to execute - unsigned char x, y, z; ///< Instruction arguments, \a z is destination (or \a y for negation) - }; - - /// Executes Boolean instruction for evaluation (checking) - int - eval(const BoolInstr* pc, int reg[]) { - while (true) { - switch (pc->o) { - case BO_NOT: - reg[pc->y] = !reg[pc->x]; - break; - case BO_AND: - reg[pc->z] = reg[pc->x] & reg[pc->y]; - break; - case BO_OR: - reg[pc->z] = reg[pc->x] | reg[pc->y]; - break; - case BO_IMP: - reg[pc->z] = (!reg[pc->x]) | reg[pc->y]; - break; - case BO_XOR: - reg[pc->z] = reg[pc->x] ^ reg[pc->y]; - break; - case BO_EQV: - reg[pc->z] = reg[pc->x] == reg[pc->y]; - break; - case BO_HLT: - return reg[pc->x]; - default: - GECODE_NEVER; - } - pc++; + /// Executes Boolean instruction for evaluation (checking) + static int + eval(const BoolInstr* pc, int reg[]) { + while (true) { + switch (pc->o) { + case BO_NOT: + reg[pc->y] = !reg[pc->x]; + break; + case BO_AND: + reg[pc->z] = reg[pc->x] & reg[pc->y]; + break; + case BO_OR: + reg[pc->z] = reg[pc->x] | reg[pc->y]; + break; + case BO_IMP: + reg[pc->z] = (!reg[pc->x]) | reg[pc->y]; + break; + case BO_XOR: + reg[pc->z] = reg[pc->x] ^ reg[pc->y]; + break; + case BO_EQV: + reg[pc->z] = reg[pc->x] == reg[pc->y]; + break; + case BO_HLT: + return reg[pc->x]; + default: + GECODE_NEVER; } - GECODE_NEVER; + pc++; } + GECODE_NEVER; + } - /// Executes Boolean instruction for constructing Boolean expressions - Gecode::BoolExpr - eval(const BoolInstr* pc, Gecode::BoolExpr reg[]) { - using namespace Gecode; - while (true) { - switch (pc->o) { - case BO_NOT: - reg[pc->y] = !reg[pc->x]; - break; - case BO_AND: - reg[pc->z] = reg[pc->x] && reg[pc->y]; - break; - case BO_OR: - reg[pc->z] = reg[pc->x] || reg[pc->y]; - break; - case BO_IMP: - reg[pc->z] = (reg[pc->x] >> reg[pc->y]); - break; - case BO_XOR: - reg[pc->z] = reg[pc->x] ^ reg[pc->y]; - break; - case BO_EQV: - reg[pc->z] = (reg[pc->x] == reg[pc->y]); - break; - case BO_HLT: - return reg[pc->x]; - default: - GECODE_NEVER; - } - pc++; + /// Executes Boolean instruction for constructing Boolean expressions + static Gecode::BoolExpr + eval(const BoolInstr* pc, Gecode::BoolExpr reg[]) { + using namespace Gecode; + while (true) { + switch (pc->o) { + case BO_NOT: + reg[pc->y] = !reg[pc->x]; + break; + case BO_AND: + reg[pc->z] = reg[pc->x] && reg[pc->y]; + break; + case BO_OR: + reg[pc->z] = reg[pc->x] || reg[pc->y]; + break; + case BO_IMP: + reg[pc->z] = (reg[pc->x] >> reg[pc->y]); + break; + case BO_XOR: + reg[pc->z] = reg[pc->x] ^ reg[pc->y]; + break; + case BO_EQV: + reg[pc->z] = (reg[pc->x] == reg[pc->y]); + break; + case BO_HLT: + return reg[pc->x]; + default: + GECODE_NEVER; } - GECODE_NEVER; + pc++; } + GECODE_NEVER; + } - /** - * \defgroup TaskTestIntMiniModelBool Minimal modelling constraints (Boolean constraints) - * \ingroup TaskTestInt - */ - //@{ - /// %Test Boolean expressions with integer result - class BoolExprInt : public Test { - protected: - /// Boolean instruction sequence - const BoolInstr* bis; - /// Result of expression - int c; + /** + * \defgroup TaskTestIntMiniModelBool Minimal modelling constraints (Boolean constraints) + * \ingroup TaskTestInt + */ + //@{ + /// %Test Boolean expressions with integer result + class BoolExprInt : public Test { + protected: + /// Boolean instruction sequence + const BoolInstr* bis; + /// Result of expression + int c; - public: - /// Create and register test - BoolExprInt(const BoolInstr* bis0, const std::string& s, int c0) - : Test("MiniModel::BoolExpr::Int::" + s + "::" + str(c0), 4, 0, 1), bis(bis0), c(c0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int reg[4] = {(x[0] != x[2]), x[1], (x[2] > 0), x[3]}; - return eval(bis, reg) == c; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - Gecode::BoolExpr reg[4] = {(x[0] != x[2]), channel(home, x[1]), (x[2] > 0), channel(home, x[3])}; - if (c == 0) - Gecode::rel(home, !(eval(bis, reg))); - else - Gecode::rel(home, eval(bis, reg)); - } - }; + public: + /// Create and register test + BoolExprInt(const BoolInstr* bis0, const std::string& s, int c0) + : Test("MiniModel::BoolExpr::Int::" + s + "::" + str(c0), 4, 0, 1), bis(bis0), c(c0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int reg[4] = {(x[0] != x[2]), x[1], (x[2] > 0), x[3]}; + return eval(bis, reg) == c; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + Gecode::BoolExpr reg[4] = {(x[0] != x[2]), channel(home, x[1]), (x[2] > 0), channel(home, x[3])}; + if (c == 0) + Gecode::rel(home, !(eval(bis, reg))); + else + Gecode::rel(home, eval(bis, reg)); + } + }; - /// %Test posting Boolean expressions - class BoolExprVar : public Test { - protected: - /// Boolean instruction sequence - const BoolInstr* bis; + /// %Test posting Boolean expressions + class BoolExprVar : public Test { + protected: + /// Boolean instruction sequence + const BoolInstr* bis; - public: - /// Create and register test - BoolExprVar(const BoolInstr* bis0, const std::string& s) - : Test("MiniModel::BoolExpr::Var::" + s, 5, 0, 1), bis(bis0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int reg[4] = {(x[0] > x[2]), x[1], (x[2] != 1), x[3]}; - return eval(bis, reg) == x[4]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - Gecode::BoolExpr reg[4] = {(x[0] > x[2]), channel(home, x[1]), (channel(home, x[2]) != 1), - channel(home, x[3])}; - rel(home, Gecode::expr(home, eval(bis, reg)), IRT_EQ, channel(home, x[4])); - } - }; + public: + /// Create and register test + BoolExprVar(const BoolInstr* bis0, const std::string& s) + : Test("MiniModel::BoolExpr::Var::" + s, 5, 0, 1), bis(bis0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int reg[4] = {(x[0] > x[2]), x[1], (x[2] != 1), x[3]}; + return eval(bis, reg) == x[4]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + Gecode::BoolExpr reg[4] = {(x[0] > x[2]), channel(home, x[1]), (channel(home, x[2]) != 1), + channel(home, x[3])}; + rel(home, Gecode::expr(home, eval(bis, reg)), IRT_EQ, channel(home, x[4])); + } + }; - static_assert(std::is_convertible::value, - "Boolean constants must convert to Boolean expressions"); - static_assert(!std::is_convertible::value, - "Integer constants must remain integer expressions"); - static_assert(!std::is_convertible::value, - "Pointers must not convert to Boolean expressions"); + static_assert(std::is_convertible_v, + "Boolean constants must convert to Boolean expressions"); + static_assert(!std::is_convertible_v, "Integer constants must remain integer expressions"); + static_assert(!std::is_convertible_v, "Pointers must not convert to Boolean expressions"); - static_assert(std::is_same(), true)), Gecode::IntVar>::value && - std::is_same(), 0)), Gecode::IntVar>::value, - "Numeric posting overloads must keep their return type"); + static_assert(std::is_same_v(), true)), Gecode::IntVar>, + "Numeric posting overloads must keep their return type"); + static_assert(std::is_same_v(), 0)), Gecode::IntVar>, + "Numeric posting overloads must keep their return type"); - /// %Test Boolean constants and their composition with variables - class BoolExprConstant : public Test { - protected: - /// Value of constant - bool value; - /// Expression to test - int mode; + /// %Test Boolean constants and their composition with variables + class BoolExprConstant : public Test { + protected: + /// Value of constant + bool value; + /// Expression to test + int mode; - public: - /// Create and register test - BoolExprConstant(bool value0, int mode0) - : Test(TestTags::check(), "MiniModel::BoolExpr::Constant::" + str(value0) + "::" + str(mode0), 3, 0, 1), - value(value0), mode(mode0) {} - /// %Test whether an assignment is a solution - bool - solution(const Assignment& x) const override { - switch (mode) { - case 0: - return x[2] == value; - case 1: - return x[2] == !value; - case 2: - return x[2] == (value && (x[0] != 0)); - case 3: - return x[2] == ((x[0] != 0) || value); - case 4: - return value; - case 5: - return x[2] == (!value && (x[0] != 0) && (x[1] != 0)); - case 6: - return x[2] == ((x[0] != 0) || !value || (x[1] != 0)); - case 7: - return x[2] == (value == (x[0] != 0)); - case 8: - return (x[0] != x[1]) == value; - case 9: - return x[2] == (!value || (x[0] != 0)); - case 10: - return x[2] == ((x[0] == 0) || value); - case 11: - return !value; - case 12: - return x[2] == value; - default: - GECODE_NEVER; - } - return false; + public: + /// Create and register test + BoolExprConstant(bool value0, int mode0) + : Test(TestTags::check(), "MiniModel::BoolExpr::Constant::" + str(value0) + "::" + str(mode0), 3, 0, 1), + value(value0), mode(mode0) {} + /// %Test whether an assignment is a solution + bool + solution(const Assignment& x) const override { + switch (mode) { + case 0: + return x[2] == value; + case 1: + return x[2] == !value; + case 2: + return x[2] == (value && (x[0] != 0)); + case 3: + return x[2] == ((x[0] != 0) || value); + case 4: + return value; + case 5: + return x[2] == (!value && (x[0] != 0) && (x[1] != 0)); + case 6: + return x[2] == ((x[0] != 0) || !value || (x[1] != 0)); + case 7: + return x[2] == (value == (x[0] != 0)); + case 8: + return (x[0] != x[1]) == value; + case 9: + return x[2] == (!value || (x[0] != 0)); + case 10: + return x[2] == ((x[0] == 0) || value); + case 11: + return !value; + case 12: + return x[2] == value; + default: + GECODE_NEVER; } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - BoolExpr e = value; - switch (mode) { - case 0: - break; - case 1: - e = !e; - break; - case 2: - e = e && channel(home, x[0]); - break; - case 3: - e = channel(home, x[0]) || e; - break; - case 4: - rel(home, e); - return; - case 5: - e = (!e && channel(home, x[0])) && channel(home, x[1]); - break; - case 6: - e = (channel(home, x[0]) || !e) || channel(home, x[1]); - break; - case 7: - e = e == channel(home, x[0]); - break; - case 8: - rel(home, (x[0] != x[1]) == e); - return; - case 9: - e = e >> channel(home, x[0]); - break; - case 10: - e = channel(home, x[0]) >> e; - break; - case 11: - rel(home, !e); - return; - case 12: { - BoolExpr empty; - e = empty && e; - e = e && empty; - e = empty || e; - e = e || empty; - } break; - default: - GECODE_NEVER; - } - rel(home, expr(home, e), IRT_EQ, channel(home, x[2])); + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + BoolExpr e = value; + switch (mode) { + case 0: + break; + case 1: + e = !e; + break; + case 2: + e = e && channel(home, x[0]); + break; + case 3: + e = channel(home, x[0]) || e; + break; + case 4: + rel(home, e); + return; + case 5: + e = (!e && channel(home, x[0])) && channel(home, x[1]); + break; + case 6: + e = (channel(home, x[0]) || !e) || channel(home, x[1]); + break; + case 7: + e = e == channel(home, x[0]); + break; + case 8: + rel(home, (x[0] != x[1]) == e); + return; + case 9: + e = e >> channel(home, x[0]); + break; + case 10: + e = channel(home, x[0]) >> e; + break; + case 11: + rel(home, !e); + return; + case 12: { + BoolExpr empty; + e = empty && e; + e = e && empty; + e = empty || e; + e = e || empty; + } break; + default: + GECODE_NEVER; } - }; + rel(home, expr(home, e), IRT_EQ, channel(home, x[2])); + } + }; - /// %Test Boolean expressions with default-constructed accumulators - class BoolExprDefaultAccumulator : public Test { - protected: - /// Boolean operation to accumulate - BoolOpcode o; - /// Whether the default expression starts on the right hand side - bool rhs; + /// %Test Boolean expressions with default-constructed accumulators + class BoolExprDefaultAccumulator : public Test { + protected: + /// Boolean operation to accumulate + BoolOpcode o; + /// Whether the default expression starts on the right hand side + bool rhs; - public: - /// Create and register test - BoolExprDefaultAccumulator(BoolOpcode o0, bool rhs0) - : Test("MiniModel::BoolExpr::Default::" + std::string(o0 == BO_AND ? "And" : "Or") + - (rhs0 ? "::Rhs" : "::Lhs"), - 3, 0, 1), - o(o0), rhs(rhs0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int r = (o == BO_AND) ? (x[0] & x[1]) : (x[0] | x[1]); - return r == x[2]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - Gecode::BoolExpr e; - Gecode::BoolExpr x0(channel(home, x[0])); - Gecode::BoolExpr x1(channel(home, x[1])); - if (o == BO_AND) { - e = rhs ? (x0 && e) : (e && x0); - e = e && x1; - } else { - e = rhs ? (x0 || e) : (e || x0); - e = e || x1; - } - rel(home, expr(home, e), IRT_EQ, channel(home, x[2])); + public: + /// Create and register test + BoolExprDefaultAccumulator(BoolOpcode o0, bool rhs0) + : Test("MiniModel::BoolExpr::Default::" + std::string(o0 == BO_AND ? "And" : "Or") + + (rhs0 ? "::Rhs" : "::Lhs"), + 3, 0, 1), + o(o0), rhs(rhs0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int r = (o == BO_AND) ? (x[0] & x[1]) : (x[0] | x[1]); + return r == x[2]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + Gecode::BoolExpr e; + Gecode::BoolExpr x0(channel(home, x[0])); + Gecode::BoolExpr x1(channel(home, x[1])); + if (o == BO_AND) { + e = rhs ? (x0 && e) : (e && x0); + e = e && x1; + } else { + e = rhs ? (x0 || e) : (e || x0); + e = e || x1; } - }; + rel(home, expr(home, e), IRT_EQ, channel(home, x[2])); + } + }; - /// Invalid Boolean expressions that must fail when materialized - enum BoolExprInvalidKind { - BE_EMPTY, - BE_NOT_EMPTY, - BE_IMP_EMPTY_LHS, - BE_IMP_EMPTY_RHS, - BE_RIMP_EMPTY_LHS, - BE_RIMP_EMPTY_RHS, - BE_NOT_AND, - BE_NOT_OR, - BE_XOR_EMPTY, - BE_EQV_EMPTY, - BE_NEQ_EMPTY, - BE_CONST_IMP_EMPTY, - BE_EMPTY_EQV_CONST - }; + /// Invalid Boolean expressions that must fail when materialized + enum BoolExprInvalidKind { + BE_EMPTY, + BE_NOT_EMPTY, + BE_IMP_EMPTY_LHS, + BE_IMP_EMPTY_RHS, + BE_RIMP_EMPTY_LHS, + BE_RIMP_EMPTY_RHS, + BE_NOT_AND, + BE_NOT_OR, + BE_XOR_EMPTY, + BE_EQV_EMPTY, + BE_NEQ_EMPTY, + BE_CONST_IMP_EMPTY, + BE_EMPTY_EQV_CONST + }; - /// %Test invalid Boolean expressions - class BoolExprInvalid : public Test { - protected: - /// Kind of invalid expression - BoolExprInvalidKind k; + /// %Test invalid Boolean expressions + class BoolExprInvalid : public Test { + protected: + /// Kind of invalid expression + BoolExprInvalidKind k; - public: - /// Create and register test - BoolExprInvalid(BoolExprInvalidKind k0, const std::string& s) - : Test("MiniModel::BoolExpr::Invalid::" + s, 1, 0, 1), k(k0) {} - /// %Test whether an assignment is a solution - bool - solution(const Assignment&) const override { - return false; + public: + /// Create and register test + BoolExprInvalid(BoolExprInvalidKind k0, const std::string& s) + : Test("MiniModel::BoolExpr::Invalid::" + s, 1, 0, 1), k(k0) {} + /// %Test whether an assignment is a solution + bool + solution(const Assignment&) const override { + return false; + } + /// Post expression and check that materialization fails + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + BoolExpr empty; + BoolExpr v(channel(home, x[0])); + BoolExpr e; + switch (k) { + case BE_EMPTY: + e = empty; + break; + case BE_NOT_EMPTY: + e = !empty; + break; + case BE_IMP_EMPTY_LHS: + e = empty >> v; + break; + case BE_IMP_EMPTY_RHS: + e = v >> empty; + break; + case BE_RIMP_EMPTY_LHS: + e = empty << v; + break; + case BE_RIMP_EMPTY_RHS: + e = v << empty; + break; + case BE_NOT_AND: + e = !empty && v; + break; + case BE_NOT_OR: + e = !empty || v; + break; + case BE_XOR_EMPTY: + e = empty ^ v; + break; + case BE_EQV_EMPTY: + e = empty == v; + break; + case BE_NEQ_EMPTY: + e = empty != v; + break; + case BE_CONST_IMP_EMPTY: + e = false >> empty; + break; + case BE_EMPTY_EQV_CONST: + e = empty == true; + break; + default: + GECODE_NEVER; } - /// Post expression and check that materialization fails - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - BoolExpr empty; - BoolExpr v(channel(home, x[0])); - BoolExpr e; - switch (k) { - case BE_EMPTY: - e = empty; - break; - case BE_NOT_EMPTY: - e = !empty; - break; - case BE_IMP_EMPTY_LHS: - e = empty >> v; - break; - case BE_IMP_EMPTY_RHS: - e = v >> empty; - break; - case BE_RIMP_EMPTY_LHS: - e = empty << v; - break; - case BE_RIMP_EMPTY_RHS: - e = v << empty; - break; - case BE_NOT_AND: - e = !empty && v; - break; - case BE_NOT_OR: - e = !empty || v; - break; - case BE_XOR_EMPTY: - e = empty ^ v; - break; - case BE_EQV_EMPTY: - e = empty == v; - break; - case BE_NEQ_EMPTY: - e = empty != v; - break; - case BE_CONST_IMP_EMPTY: - e = false >> empty; - break; - case BE_EMPTY_EQV_CONST: - e = empty == true; - break; - default: - GECODE_NEVER; - } - try { - (void)expr(home, e); - } catch (MiniModel::TooFewArguments&) { - home.fail(); - return; - } - throw Exception("Test::BoolExprInvalid", "Expected MiniModel::TooFewArguments"); + try { + (void)expr(home, e); + } catch (MiniModel::TooFewArguments&) { + home.fail(); + return; } - }; + throw Exception("Test::BoolExprInvalid", "Expected MiniModel::TooFewArguments"); + } + }; - const BoolInstr bi000[] = {{BO_AND, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi001[] = {{BO_AND, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi002[] = {{BO_AND, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi003[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi004[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi005[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi006[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi007[] = {{BO_AND, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi008[] = {{BO_AND, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi009[] = {{BO_AND, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi010[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi011[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi012[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi013[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi014[] = {{BO_AND, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi015[] = {{BO_AND, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi016[] = {{BO_AND, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi017[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi018[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi019[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi020[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi021[] = {{BO_AND, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi022[] = {{BO_AND, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi023[] = {{BO_AND, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi024[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi025[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi026[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi027[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi028[] = {{BO_AND, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi029[] = {{BO_AND, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi030[] = {{BO_AND, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi031[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi032[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi033[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi034[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi035[] = {{BO_AND, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi036[] = {{BO_AND, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi037[] = {{BO_AND, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi038[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi039[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi040[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi041[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi042[] = {{BO_AND, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi043[] = {{BO_AND, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi044[] = {{BO_AND, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi045[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi046[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi047[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi048[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi049[] = {{BO_AND, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi050[] = {{BO_AND, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi051[] = {{BO_AND, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi052[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi053[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi054[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi055[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi056[] = {{BO_AND, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi057[] = {{BO_AND, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi058[] = {{BO_AND, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi059[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi060[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi061[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi062[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi063[] = {{BO_AND, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi064[] = {{BO_AND, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi065[] = {{BO_AND, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi066[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi067[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi068[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi069[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi070[] = {{BO_AND, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi071[] = {{BO_AND, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi072[] = {{BO_AND, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi073[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi074[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi075[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi076[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi077[] = {{BO_AND, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi078[] = {{BO_AND, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi079[] = {{BO_AND, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi080[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi081[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi082[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi083[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi084[] = {{BO_AND, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi085[] = {{BO_AND, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi086[] = {{BO_AND, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi087[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi088[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi089[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi090[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi091[] = {{BO_AND, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi092[] = {{BO_AND, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi093[] = {{BO_AND, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi094[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi095[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi096[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi097[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi098[] = {{BO_AND, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi099[] = {{BO_AND, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi100[] = {{BO_AND, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi101[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi102[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi103[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi104[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi105[] = {{BO_AND, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi106[] = {{BO_AND, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi107[] = {{BO_AND, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi108[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi109[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi110[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi111[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi112[] = {{BO_AND, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi113[] = {{BO_AND, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi114[] = {{BO_AND, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi115[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi116[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi117[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi118[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi119[] = {{BO_AND, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi120[] = {{BO_AND, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi121[] = {{BO_AND, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi122[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi123[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi124[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi125[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi126[] = {{BO_AND, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi127[] = {{BO_AND, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi128[] = {{BO_AND, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi129[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi130[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi131[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi132[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi133[] = {{BO_AND, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi134[] = {{BO_AND, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi135[] = {{BO_AND, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi136[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi137[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi138[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi139[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi140[] = {{BO_AND, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi141[] = {{BO_AND, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi142[] = {{BO_AND, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi143[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi144[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi145[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi146[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi147[] = {{BO_AND, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi148[] = {{BO_AND, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi149[] = {{BO_AND, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi150[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi151[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi152[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi153[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi154[] = {{BO_AND, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi155[] = {{BO_AND, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi156[] = {{BO_AND, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi157[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi158[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi159[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi160[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi161[] = {{BO_AND, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi162[] = {{BO_AND, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi163[] = {{BO_AND, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi164[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi165[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi166[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi167[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi168[] = {{BO_AND, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi169[] = {{BO_AND, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi170[] = {{BO_AND, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi171[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi172[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi173[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi174[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi175[] = {{BO_OR, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi176[] = {{BO_OR, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi177[] = {{BO_OR, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi178[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi179[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi180[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi181[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi182[] = {{BO_OR, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi183[] = {{BO_OR, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi184[] = {{BO_OR, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi185[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi186[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi187[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi188[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi189[] = {{BO_OR, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi190[] = {{BO_OR, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi191[] = {{BO_OR, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi192[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi193[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi194[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi195[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi196[] = {{BO_OR, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi197[] = {{BO_OR, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi198[] = {{BO_OR, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi199[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi200[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi201[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi202[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi203[] = {{BO_OR, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi204[] = {{BO_OR, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi205[] = {{BO_OR, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi206[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi207[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi208[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi209[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi210[] = {{BO_OR, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi211[] = {{BO_OR, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi212[] = {{BO_OR, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi213[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi214[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi215[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi216[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi217[] = {{BO_OR, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi218[] = {{BO_OR, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi219[] = {{BO_OR, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi220[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi221[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi222[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi223[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi224[] = {{BO_OR, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi225[] = {{BO_OR, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi226[] = {{BO_OR, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi227[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi228[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi229[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi230[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi231[] = {{BO_OR, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi232[] = {{BO_OR, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi233[] = {{BO_OR, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi234[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi235[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi236[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi237[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi238[] = {{BO_OR, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi239[] = {{BO_OR, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi240[] = {{BO_OR, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi241[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi242[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi243[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi244[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi245[] = {{BO_OR, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi246[] = {{BO_OR, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi247[] = {{BO_OR, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi248[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi249[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi250[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi251[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi252[] = {{BO_OR, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi253[] = {{BO_OR, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi254[] = {{BO_OR, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi255[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi256[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi257[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi258[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi259[] = {{BO_OR, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi260[] = {{BO_OR, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi261[] = {{BO_OR, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi262[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi263[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi264[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi265[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi266[] = {{BO_OR, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi267[] = {{BO_OR, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi268[] = {{BO_OR, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi269[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi270[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi271[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi272[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi273[] = {{BO_OR, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi274[] = {{BO_OR, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi275[] = {{BO_OR, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi276[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi277[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi278[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi279[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi280[] = {{BO_OR, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi281[] = {{BO_OR, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi282[] = {{BO_OR, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi283[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi284[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi285[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi286[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi287[] = {{BO_OR, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi288[] = {{BO_OR, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi289[] = {{BO_OR, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi290[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi291[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi292[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi293[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi294[] = {{BO_OR, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi295[] = {{BO_OR, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi296[] = {{BO_OR, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi297[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi298[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi299[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi300[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi301[] = {{BO_OR, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi302[] = {{BO_OR, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi303[] = {{BO_OR, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi304[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi305[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi306[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi307[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi308[] = {{BO_OR, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi309[] = {{BO_OR, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi310[] = {{BO_OR, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi311[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi312[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi313[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi314[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi315[] = {{BO_OR, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi316[] = {{BO_OR, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi317[] = {{BO_OR, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi318[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi319[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi320[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi321[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi322[] = {{BO_OR, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi323[] = {{BO_OR, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi324[] = {{BO_OR, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi325[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi326[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi327[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi328[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi329[] = {{BO_OR, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi330[] = {{BO_OR, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi331[] = {{BO_OR, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi332[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi333[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi334[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi335[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi336[] = {{BO_OR, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi337[] = {{BO_OR, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi338[] = {{BO_OR, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi339[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi340[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi341[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi342[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi343[] = {{BO_OR, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi344[] = {{BO_OR, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi345[] = {{BO_OR, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi346[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi347[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi348[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi349[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi350[] = {{BO_IMP, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi351[] = {{BO_IMP, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi352[] = {{BO_IMP, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi353[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi354[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi355[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi356[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi357[] = {{BO_IMP, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi358[] = {{BO_IMP, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi359[] = {{BO_IMP, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi360[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi361[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi362[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi363[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi364[] = {{BO_IMP, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi365[] = {{BO_IMP, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi366[] = {{BO_IMP, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi367[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi368[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi369[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi370[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi371[] = {{BO_IMP, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi372[] = {{BO_IMP, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi373[] = {{BO_IMP, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi374[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi375[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi376[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi377[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi378[] = {{BO_IMP, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi379[] = {{BO_IMP, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi380[] = {{BO_IMP, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi381[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi382[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi383[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi384[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi385[] = {{BO_IMP, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi386[] = {{BO_IMP, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi387[] = {{BO_IMP, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi388[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi389[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi390[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi391[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi392[] = {{BO_IMP, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi393[] = {{BO_IMP, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi394[] = {{BO_IMP, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi395[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi396[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi397[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi398[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi399[] = {{BO_IMP, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi400[] = {{BO_IMP, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi401[] = {{BO_IMP, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi402[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi403[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi404[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi405[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi406[] = {{BO_IMP, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi407[] = {{BO_IMP, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi408[] = {{BO_IMP, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi409[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi410[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi411[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi412[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi413[] = {{BO_IMP, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi414[] = {{BO_IMP, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi415[] = {{BO_IMP, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi416[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi417[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi418[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi419[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi420[] = {{BO_IMP, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi421[] = {{BO_IMP, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi422[] = {{BO_IMP, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi423[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi424[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi425[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi426[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi427[] = {{BO_IMP, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi428[] = {{BO_IMP, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi429[] = {{BO_IMP, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi430[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi431[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi432[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi433[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi434[] = {{BO_IMP, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi435[] = {{BO_IMP, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi436[] = {{BO_IMP, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi437[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi438[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi439[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi440[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi441[] = {{BO_IMP, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi442[] = {{BO_IMP, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi443[] = {{BO_IMP, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi444[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi445[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi446[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi447[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi448[] = {{BO_IMP, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi449[] = {{BO_IMP, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi450[] = {{BO_IMP, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi451[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi452[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi453[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi454[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi455[] = {{BO_IMP, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi456[] = {{BO_IMP, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi457[] = {{BO_IMP, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi458[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi459[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi460[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi461[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi462[] = {{BO_IMP, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi463[] = {{BO_IMP, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi464[] = {{BO_IMP, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi465[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi466[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi467[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi468[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi469[] = {{BO_IMP, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi470[] = {{BO_IMP, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi471[] = {{BO_IMP, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi472[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi473[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi474[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi475[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi476[] = {{BO_IMP, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi477[] = {{BO_IMP, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi478[] = {{BO_IMP, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi479[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi480[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi481[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi482[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi483[] = {{BO_IMP, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi484[] = {{BO_IMP, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi485[] = {{BO_IMP, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi486[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi487[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi488[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi489[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi490[] = {{BO_IMP, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi491[] = {{BO_IMP, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi492[] = {{BO_IMP, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi493[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi494[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi495[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi496[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi497[] = {{BO_IMP, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi498[] = {{BO_IMP, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi499[] = {{BO_IMP, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi500[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi501[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi502[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi503[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi504[] = {{BO_IMP, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi505[] = {{BO_IMP, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi506[] = {{BO_IMP, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi507[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi508[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi509[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi510[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi511[] = {{BO_IMP, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi512[] = {{BO_IMP, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi513[] = {{BO_IMP, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi514[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi515[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi516[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi517[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi518[] = {{BO_IMP, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi519[] = {{BO_IMP, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi520[] = {{BO_IMP, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi521[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi522[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi523[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi524[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi525[] = {{BO_XOR, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi526[] = {{BO_XOR, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi527[] = {{BO_XOR, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi528[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi529[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi530[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi531[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi532[] = {{BO_XOR, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi533[] = {{BO_XOR, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi534[] = {{BO_XOR, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi535[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi536[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi537[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi538[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi539[] = {{BO_XOR, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi540[] = {{BO_XOR, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi541[] = {{BO_XOR, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi542[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi543[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi544[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi545[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi546[] = {{BO_XOR, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi547[] = {{BO_XOR, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi548[] = {{BO_XOR, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi549[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi550[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi551[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi552[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi553[] = {{BO_XOR, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi554[] = {{BO_XOR, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi555[] = {{BO_XOR, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi556[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi557[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi558[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi559[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi560[] = {{BO_XOR, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi561[] = {{BO_XOR, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi562[] = {{BO_XOR, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi563[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi564[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi565[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi566[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi567[] = {{BO_XOR, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi568[] = {{BO_XOR, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi569[] = {{BO_XOR, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi570[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi571[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi572[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi573[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi574[] = {{BO_XOR, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi575[] = {{BO_XOR, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi576[] = {{BO_XOR, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi577[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi578[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi579[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi580[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi581[] = {{BO_XOR, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi582[] = {{BO_XOR, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi583[] = {{BO_XOR, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi584[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi585[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi586[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi587[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi588[] = {{BO_XOR, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi589[] = {{BO_XOR, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi590[] = {{BO_XOR, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi591[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi592[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi593[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi594[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi595[] = {{BO_XOR, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi596[] = {{BO_XOR, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi597[] = {{BO_XOR, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi598[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi599[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi600[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi601[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi602[] = {{BO_XOR, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi603[] = {{BO_XOR, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi604[] = {{BO_XOR, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi605[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi606[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi607[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi608[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi609[] = {{BO_XOR, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi610[] = {{BO_XOR, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi611[] = {{BO_XOR, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi612[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi613[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi614[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi615[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi616[] = {{BO_XOR, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi617[] = {{BO_XOR, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi618[] = {{BO_XOR, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi619[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi620[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi621[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi622[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi623[] = {{BO_XOR, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi624[] = {{BO_XOR, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi625[] = {{BO_XOR, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi626[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi627[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi628[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi629[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi630[] = {{BO_XOR, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi631[] = {{BO_XOR, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi632[] = {{BO_XOR, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi633[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi634[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi635[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi636[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi637[] = {{BO_XOR, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi638[] = {{BO_XOR, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi639[] = {{BO_XOR, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi640[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi641[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi642[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi643[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi644[] = {{BO_XOR, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi645[] = {{BO_XOR, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi646[] = {{BO_XOR, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi647[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi648[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi649[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi650[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi651[] = {{BO_XOR, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi652[] = {{BO_XOR, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi653[] = {{BO_XOR, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi654[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi655[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi656[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi657[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi658[] = {{BO_XOR, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi659[] = {{BO_XOR, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi660[] = {{BO_XOR, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi661[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi662[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi663[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi664[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi665[] = {{BO_XOR, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi666[] = {{BO_XOR, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi667[] = {{BO_XOR, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi668[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi669[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi670[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi671[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi672[] = {{BO_XOR, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi673[] = {{BO_XOR, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi674[] = {{BO_XOR, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi675[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi676[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi677[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi678[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi679[] = {{BO_XOR, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi680[] = {{BO_XOR, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi681[] = {{BO_XOR, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi682[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi683[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi684[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi685[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi686[] = {{BO_XOR, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi687[] = {{BO_XOR, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi688[] = {{BO_XOR, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi689[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi690[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi691[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi692[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi693[] = {{BO_XOR, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi694[] = {{BO_XOR, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi695[] = {{BO_XOR, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi696[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi697[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi698[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi699[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi700[] = {{BO_EQV, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi701[] = {{BO_EQV, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi702[] = {{BO_EQV, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi703[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi704[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi705[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi706[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi707[] = {{BO_EQV, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi708[] = {{BO_EQV, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi709[] = {{BO_EQV, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi710[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi711[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi712[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi713[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi714[] = {{BO_EQV, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi715[] = {{BO_EQV, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi716[] = {{BO_EQV, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi717[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi718[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi719[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi720[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi721[] = {{BO_EQV, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi722[] = {{BO_EQV, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi723[] = {{BO_EQV, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi724[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi725[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi726[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi727[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi728[] = {{BO_EQV, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi729[] = {{BO_EQV, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi730[] = {{BO_EQV, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi731[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi732[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi733[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi734[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi735[] = {{BO_EQV, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi736[] = {{BO_EQV, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi737[] = {{BO_EQV, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi738[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi739[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi740[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi741[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi742[] = {{BO_EQV, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi743[] = {{BO_EQV, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi744[] = {{BO_EQV, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi745[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi746[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi747[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi748[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi749[] = {{BO_EQV, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi750[] = {{BO_EQV, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi751[] = {{BO_EQV, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi752[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi753[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi754[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi755[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi756[] = {{BO_EQV, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi757[] = {{BO_EQV, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi758[] = {{BO_EQV, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi759[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi760[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi761[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi762[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi763[] = {{BO_EQV, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi764[] = {{BO_EQV, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi765[] = {{BO_EQV, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi766[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi767[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi768[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi769[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi770[] = {{BO_EQV, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi771[] = {{BO_EQV, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi772[] = {{BO_EQV, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi773[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi774[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi775[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi776[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi777[] = {{BO_EQV, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi778[] = {{BO_EQV, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi779[] = {{BO_EQV, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi780[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi781[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi782[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi783[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi784[] = {{BO_EQV, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi785[] = {{BO_EQV, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi786[] = {{BO_EQV, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi787[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi788[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi789[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi790[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi791[] = {{BO_EQV, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi792[] = {{BO_EQV, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi793[] = {{BO_EQV, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi794[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi795[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi796[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi797[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi798[] = {{BO_EQV, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi799[] = {{BO_EQV, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi800[] = {{BO_EQV, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi801[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi802[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi803[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi804[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi805[] = {{BO_EQV, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi806[] = {{BO_EQV, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi807[] = {{BO_EQV, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi808[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi809[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi810[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi811[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi812[] = {{BO_EQV, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi813[] = {{BO_EQV, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi814[] = {{BO_EQV, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi815[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi816[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi817[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi818[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi819[] = {{BO_EQV, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi820[] = {{BO_EQV, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi821[] = {{BO_EQV, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi822[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi823[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi824[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi825[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi826[] = {{BO_EQV, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi827[] = {{BO_EQV, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi828[] = {{BO_EQV, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi829[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi830[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi831[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi832[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi833[] = {{BO_EQV, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi834[] = {{BO_EQV, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi835[] = {{BO_EQV, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi836[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi837[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi838[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi839[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi840[] = {{BO_EQV, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi841[] = {{BO_EQV, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi842[] = {{BO_EQV, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi843[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi844[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi845[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi846[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi847[] = {{BO_EQV, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi848[] = {{BO_EQV, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi849[] = {{BO_EQV, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi850[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi851[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi852[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi853[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi854[] = {{BO_EQV, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi855[] = {{BO_EQV, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi856[] = {{BO_EQV, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi857[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi858[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi859[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi860[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi861[] = {{BO_EQV, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi862[] = {{BO_EQV, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi863[] = {{BO_EQV, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi864[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi865[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi866[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi867[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi868[] = {{BO_EQV, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi869[] = {{BO_EQV, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi870[] = {{BO_EQV, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi871[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi872[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, - {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi873[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, - {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr bi874[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, - {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi000[] = {{BO_AND, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi001[] = {{BO_AND, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi002[] = {{BO_AND, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi003[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi004[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi005[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi006[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi007[] = {{BO_AND, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi008[] = {{BO_AND, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi009[] = {{BO_AND, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi010[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi011[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi012[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi013[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi014[] = {{BO_AND, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi015[] = {{BO_AND, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi016[] = {{BO_AND, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi017[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi018[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi019[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi020[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi021[] = {{BO_AND, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi022[] = {{BO_AND, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi023[] = {{BO_AND, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi024[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi025[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi026[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi027[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi028[] = {{BO_AND, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi029[] = {{BO_AND, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi030[] = {{BO_AND, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi031[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi032[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi033[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi034[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi035[] = {{BO_AND, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi036[] = {{BO_AND, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi037[] = {{BO_AND, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi038[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi039[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi040[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi041[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi042[] = {{BO_AND, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi043[] = {{BO_AND, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi044[] = {{BO_AND, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi045[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi046[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi047[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi048[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi049[] = {{BO_AND, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi050[] = {{BO_AND, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi051[] = {{BO_AND, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi052[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi053[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi054[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi055[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi056[] = {{BO_AND, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi057[] = {{BO_AND, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi058[] = {{BO_AND, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi059[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi060[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi061[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi062[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi063[] = {{BO_AND, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi064[] = {{BO_AND, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi065[] = {{BO_AND, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi066[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi067[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi068[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi069[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi070[] = {{BO_AND, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi071[] = {{BO_AND, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi072[] = {{BO_AND, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi073[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi074[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi075[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi076[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi077[] = {{BO_AND, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi078[] = {{BO_AND, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi079[] = {{BO_AND, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi080[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi081[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi082[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi083[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi084[] = {{BO_AND, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi085[] = {{BO_AND, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi086[] = {{BO_AND, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi087[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi088[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi089[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi090[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi091[] = {{BO_AND, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi092[] = {{BO_AND, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi093[] = {{BO_AND, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi094[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi095[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi096[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi097[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi098[] = {{BO_AND, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi099[] = {{BO_AND, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi100[] = {{BO_AND, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi101[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi102[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi103[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi104[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi105[] = {{BO_AND, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi106[] = {{BO_AND, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi107[] = {{BO_AND, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi108[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi109[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi110[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi111[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi112[] = {{BO_AND, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi113[] = {{BO_AND, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi114[] = {{BO_AND, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi115[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi116[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi117[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi118[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi119[] = {{BO_AND, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi120[] = {{BO_AND, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi121[] = {{BO_AND, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi122[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi123[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi124[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi125[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi126[] = {{BO_AND, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi127[] = {{BO_AND, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi128[] = {{BO_AND, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi129[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi130[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi131[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi132[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi133[] = {{BO_AND, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi134[] = {{BO_AND, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi135[] = {{BO_AND, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi136[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi137[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi138[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi139[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi140[] = {{BO_AND, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi141[] = {{BO_AND, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi142[] = {{BO_AND, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi143[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi144[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi145[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi146[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi147[] = {{BO_AND, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi148[] = {{BO_AND, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi149[] = {{BO_AND, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi150[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi151[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi152[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi153[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi154[] = {{BO_AND, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi155[] = {{BO_AND, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi156[] = {{BO_AND, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi157[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi158[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi159[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi160[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi161[] = {{BO_AND, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi162[] = {{BO_AND, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi163[] = {{BO_AND, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi164[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi165[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi166[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi167[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi168[] = {{BO_AND, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi169[] = {{BO_AND, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi170[] = {{BO_AND, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi171[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_AND, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi172[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi173[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi174[] = {{BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi175[] = {{BO_OR, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi176[] = {{BO_OR, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi177[] = {{BO_OR, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi178[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi179[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi180[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi181[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi182[] = {{BO_OR, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi183[] = {{BO_OR, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi184[] = {{BO_OR, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi185[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi186[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi187[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi188[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi189[] = {{BO_OR, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi190[] = {{BO_OR, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi191[] = {{BO_OR, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi192[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi193[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi194[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi195[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi196[] = {{BO_OR, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi197[] = {{BO_OR, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi198[] = {{BO_OR, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi199[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi200[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi201[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi202[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi203[] = {{BO_OR, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi204[] = {{BO_OR, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi205[] = {{BO_OR, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi206[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi207[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi208[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi209[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi210[] = {{BO_OR, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi211[] = {{BO_OR, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi212[] = {{BO_OR, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi213[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi214[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi215[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi216[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi217[] = {{BO_OR, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi218[] = {{BO_OR, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi219[] = {{BO_OR, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi220[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi221[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi222[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi223[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi224[] = {{BO_OR, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi225[] = {{BO_OR, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi226[] = {{BO_OR, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi227[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi228[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi229[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi230[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi231[] = {{BO_OR, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi232[] = {{BO_OR, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi233[] = {{BO_OR, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi234[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi235[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi236[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi237[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi238[] = {{BO_OR, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi239[] = {{BO_OR, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi240[] = {{BO_OR, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi241[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi242[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi243[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi244[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi245[] = {{BO_OR, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi246[] = {{BO_OR, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi247[] = {{BO_OR, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi248[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi249[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi250[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi251[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi252[] = {{BO_OR, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi253[] = {{BO_OR, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi254[] = {{BO_OR, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi255[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi256[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi257[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi258[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi259[] = {{BO_OR, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi260[] = {{BO_OR, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi261[] = {{BO_OR, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi262[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi263[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi264[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi265[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi266[] = {{BO_OR, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi267[] = {{BO_OR, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi268[] = {{BO_OR, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi269[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi270[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi271[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi272[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi273[] = {{BO_OR, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi274[] = {{BO_OR, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi275[] = {{BO_OR, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi276[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi277[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi278[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi279[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi280[] = {{BO_OR, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi281[] = {{BO_OR, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi282[] = {{BO_OR, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi283[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi284[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi285[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi286[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi287[] = {{BO_OR, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi288[] = {{BO_OR, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi289[] = {{BO_OR, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi290[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi291[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi292[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi293[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi294[] = {{BO_OR, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi295[] = {{BO_OR, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi296[] = {{BO_OR, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi297[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi298[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi299[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi300[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi301[] = {{BO_OR, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi302[] = {{BO_OR, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi303[] = {{BO_OR, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi304[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi305[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi306[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi307[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi308[] = {{BO_OR, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi309[] = {{BO_OR, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi310[] = {{BO_OR, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi311[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi312[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi313[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi314[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi315[] = {{BO_OR, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi316[] = {{BO_OR, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi317[] = {{BO_OR, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi318[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi319[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi320[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi321[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi322[] = {{BO_OR, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi323[] = {{BO_OR, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi324[] = {{BO_OR, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi325[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi326[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi327[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi328[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi329[] = {{BO_OR, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi330[] = {{BO_OR, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi331[] = {{BO_OR, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi332[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi333[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi334[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi335[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi336[] = {{BO_OR, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi337[] = {{BO_OR, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi338[] = {{BO_OR, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi339[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi340[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi341[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi342[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi343[] = {{BO_OR, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi344[] = {{BO_OR, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi345[] = {{BO_OR, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi346[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_OR, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi347[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi348[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi349[] = {{BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi350[] = {{BO_IMP, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi351[] = {{BO_IMP, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi352[] = {{BO_IMP, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi353[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi354[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi355[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi356[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi357[] = {{BO_IMP, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi358[] = {{BO_IMP, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi359[] = {{BO_IMP, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi360[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi361[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi362[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi363[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi364[] = {{BO_IMP, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi365[] = {{BO_IMP, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi366[] = {{BO_IMP, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi367[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi368[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi369[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi370[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi371[] = {{BO_IMP, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi372[] = {{BO_IMP, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi373[] = {{BO_IMP, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi374[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi375[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi376[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi377[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi378[] = {{BO_IMP, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi379[] = {{BO_IMP, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi380[] = {{BO_IMP, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi381[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi382[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi383[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi384[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi385[] = {{BO_IMP, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi386[] = {{BO_IMP, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi387[] = {{BO_IMP, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi388[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi389[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi390[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi391[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi392[] = {{BO_IMP, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi393[] = {{BO_IMP, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi394[] = {{BO_IMP, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi395[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi396[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi397[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi398[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi399[] = {{BO_IMP, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi400[] = {{BO_IMP, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi401[] = {{BO_IMP, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi402[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi403[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi404[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi405[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi406[] = {{BO_IMP, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi407[] = {{BO_IMP, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi408[] = {{BO_IMP, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi409[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi410[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi411[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi412[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi413[] = {{BO_IMP, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi414[] = {{BO_IMP, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi415[] = {{BO_IMP, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi416[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi417[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi418[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi419[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi420[] = {{BO_IMP, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi421[] = {{BO_IMP, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi422[] = {{BO_IMP, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi423[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi424[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi425[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi426[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi427[] = {{BO_IMP, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi428[] = {{BO_IMP, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi429[] = {{BO_IMP, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi430[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi431[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi432[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi433[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi434[] = {{BO_IMP, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi435[] = {{BO_IMP, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi436[] = {{BO_IMP, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi437[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi438[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi439[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi440[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi441[] = {{BO_IMP, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi442[] = {{BO_IMP, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi443[] = {{BO_IMP, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi444[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi445[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi446[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi447[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi448[] = {{BO_IMP, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi449[] = {{BO_IMP, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi450[] = {{BO_IMP, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi451[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi452[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi453[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi454[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi455[] = {{BO_IMP, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi456[] = {{BO_IMP, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi457[] = {{BO_IMP, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi458[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi459[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi460[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi461[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi462[] = {{BO_IMP, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi463[] = {{BO_IMP, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi464[] = {{BO_IMP, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi465[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi466[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi467[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi468[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi469[] = {{BO_IMP, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi470[] = {{BO_IMP, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi471[] = {{BO_IMP, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi472[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi473[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi474[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi475[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi476[] = {{BO_IMP, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi477[] = {{BO_IMP, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi478[] = {{BO_IMP, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi479[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi480[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi481[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi482[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi483[] = {{BO_IMP, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi484[] = {{BO_IMP, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi485[] = {{BO_IMP, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi486[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi487[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi488[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi489[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi490[] = {{BO_IMP, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi491[] = {{BO_IMP, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi492[] = {{BO_IMP, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi493[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi494[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi495[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi496[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi497[] = {{BO_IMP, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi498[] = {{BO_IMP, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi499[] = {{BO_IMP, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi500[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi501[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi502[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi503[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi504[] = {{BO_IMP, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi505[] = {{BO_IMP, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi506[] = {{BO_IMP, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi507[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi508[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi509[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi510[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi511[] = {{BO_IMP, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi512[] = {{BO_IMP, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi513[] = {{BO_IMP, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi514[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi515[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi516[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi517[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi518[] = {{BO_IMP, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi519[] = {{BO_IMP, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi520[] = {{BO_IMP, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi521[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_IMP, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi522[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi523[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi524[] = {{BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi525[] = {{BO_XOR, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi526[] = {{BO_XOR, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi527[] = {{BO_XOR, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi528[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi529[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi530[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi531[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi532[] = {{BO_XOR, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi533[] = {{BO_XOR, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi534[] = {{BO_XOR, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi535[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi536[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi537[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi538[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi539[] = {{BO_XOR, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi540[] = {{BO_XOR, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi541[] = {{BO_XOR, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi542[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi543[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi544[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi545[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi546[] = {{BO_XOR, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi547[] = {{BO_XOR, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi548[] = {{BO_XOR, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi549[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi550[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi551[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi552[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi553[] = {{BO_XOR, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi554[] = {{BO_XOR, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi555[] = {{BO_XOR, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi556[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi557[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi558[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi559[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi560[] = {{BO_XOR, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi561[] = {{BO_XOR, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi562[] = {{BO_XOR, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi563[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi564[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi565[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi566[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi567[] = {{BO_XOR, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi568[] = {{BO_XOR, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi569[] = {{BO_XOR, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi570[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi571[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi572[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi573[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi574[] = {{BO_XOR, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi575[] = {{BO_XOR, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi576[] = {{BO_XOR, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi577[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi578[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi579[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi580[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi581[] = {{BO_XOR, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi582[] = {{BO_XOR, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi583[] = {{BO_XOR, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi584[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi585[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi586[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi587[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi588[] = {{BO_XOR, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi589[] = {{BO_XOR, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi590[] = {{BO_XOR, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi591[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi592[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi593[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi594[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi595[] = {{BO_XOR, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi596[] = {{BO_XOR, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi597[] = {{BO_XOR, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi598[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi599[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi600[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi601[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi602[] = {{BO_XOR, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi603[] = {{BO_XOR, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi604[] = {{BO_XOR, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi605[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi606[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi607[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi608[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi609[] = {{BO_XOR, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi610[] = {{BO_XOR, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi611[] = {{BO_XOR, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi612[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi613[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi614[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi615[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi616[] = {{BO_XOR, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi617[] = {{BO_XOR, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi618[] = {{BO_XOR, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi619[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi620[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi621[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi622[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi623[] = {{BO_XOR, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi624[] = {{BO_XOR, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi625[] = {{BO_XOR, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi626[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi627[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi628[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi629[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi630[] = {{BO_XOR, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi631[] = {{BO_XOR, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi632[] = {{BO_XOR, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi633[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi634[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi635[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi636[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi637[] = {{BO_XOR, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi638[] = {{BO_XOR, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi639[] = {{BO_XOR, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi640[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi641[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi642[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi643[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi644[] = {{BO_XOR, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi645[] = {{BO_XOR, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi646[] = {{BO_XOR, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi647[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi648[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi649[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi650[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi651[] = {{BO_XOR, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi652[] = {{BO_XOR, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi653[] = {{BO_XOR, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi654[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi655[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi656[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi657[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi658[] = {{BO_XOR, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi659[] = {{BO_XOR, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi660[] = {{BO_XOR, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi661[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi662[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi663[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi664[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi665[] = {{BO_XOR, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi666[] = {{BO_XOR, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi667[] = {{BO_XOR, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi668[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi669[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi670[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi671[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi672[] = {{BO_XOR, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi673[] = {{BO_XOR, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi674[] = {{BO_XOR, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi675[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi676[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi677[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi678[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi679[] = {{BO_XOR, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi680[] = {{BO_XOR, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi681[] = {{BO_XOR, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi682[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi683[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi684[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi685[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi686[] = {{BO_XOR, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi687[] = {{BO_XOR, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi688[] = {{BO_XOR, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi689[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi690[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi691[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi692[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi693[] = {{BO_XOR, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi694[] = {{BO_XOR, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi695[] = {{BO_XOR, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi696[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_XOR, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi697[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi698[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi699[] = {{BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi700[] = {{BO_EQV, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi701[] = {{BO_EQV, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi702[] = {{BO_EQV, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi703[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi704[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi705[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi706[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi707[] = {{BO_EQV, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi708[] = {{BO_EQV, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi709[] = {{BO_EQV, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi710[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi711[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi712[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi713[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi714[] = {{BO_EQV, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi715[] = {{BO_EQV, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi716[] = {{BO_EQV, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi717[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi718[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi719[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi720[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi721[] = {{BO_EQV, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi722[] = {{BO_EQV, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi723[] = {{BO_EQV, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi724[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi725[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi726[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi727[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi728[] = {{BO_EQV, 0, 1, 0}, {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi729[] = {{BO_EQV, 0, 1, 0}, {BO_AND, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi730[] = {{BO_EQV, 2, 3, 2}, {BO_AND, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi731[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi732[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_AND, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi733[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi734[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_AND, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi735[] = {{BO_EQV, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi736[] = {{BO_EQV, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi737[] = {{BO_EQV, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi738[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi739[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi740[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi741[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi742[] = {{BO_EQV, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi743[] = {{BO_EQV, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi744[] = {{BO_EQV, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi745[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi746[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi747[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi748[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi749[] = {{BO_EQV, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi750[] = {{BO_EQV, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi751[] = {{BO_EQV, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi752[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi753[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi754[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi755[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi756[] = {{BO_EQV, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi757[] = {{BO_EQV, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi758[] = {{BO_EQV, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi759[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi760[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi761[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi762[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi763[] = {{BO_EQV, 0, 1, 0}, {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi764[] = {{BO_EQV, 0, 1, 0}, {BO_OR, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi765[] = {{BO_EQV, 2, 3, 2}, {BO_OR, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi766[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi767[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_OR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi768[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi769[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_OR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi770[] = {{BO_EQV, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi771[] = {{BO_EQV, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi772[] = {{BO_EQV, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi773[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi774[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi775[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi776[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi777[] = {{BO_EQV, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi778[] = {{BO_EQV, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi779[] = {{BO_EQV, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi780[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi781[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi782[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi783[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi784[] = {{BO_EQV, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi785[] = {{BO_EQV, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi786[] = {{BO_EQV, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi787[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi788[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi789[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi790[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi791[] = {{BO_EQV, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi792[] = {{BO_EQV, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi793[] = {{BO_EQV, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi794[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi795[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi796[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi797[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi798[] = {{BO_EQV, 0, 1, 0}, {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi799[] = {{BO_EQV, 0, 1, 0}, {BO_IMP, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi800[] = {{BO_EQV, 2, 3, 2}, {BO_IMP, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi801[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi802[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_IMP, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi803[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi804[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_IMP, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi805[] = {{BO_EQV, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi806[] = {{BO_EQV, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi807[] = {{BO_EQV, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi808[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi809[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi810[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi811[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi812[] = {{BO_EQV, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi813[] = {{BO_EQV, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi814[] = {{BO_EQV, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi815[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi816[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi817[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi818[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi819[] = {{BO_EQV, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi820[] = {{BO_EQV, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi821[] = {{BO_EQV, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi822[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi823[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi824[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi825[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi826[] = {{BO_EQV, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi827[] = {{BO_EQV, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi828[] = {{BO_EQV, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi829[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi830[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi831[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi832[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi833[] = {{BO_EQV, 0, 1, 0}, {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi834[] = {{BO_EQV, 0, 1, 0}, {BO_XOR, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi835[] = {{BO_EQV, 2, 3, 2}, {BO_XOR, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi836[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi837[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_XOR, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi838[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi839[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_XOR, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi840[] = {{BO_EQV, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi841[] = {{BO_EQV, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_AND, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi842[] = {{BO_EQV, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi843[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi844[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi845[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_AND, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi846[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_AND, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi847[] = {{BO_EQV, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi848[] = {{BO_EQV, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_OR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi849[] = {{BO_EQV, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi850[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi851[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi852[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_OR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi853[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_OR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi854[] = {{BO_EQV, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi855[] = {{BO_EQV, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_IMP, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi856[] = {{BO_EQV, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi857[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi858[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi859[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_IMP, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi860[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_IMP, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi861[] = {{BO_EQV, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi862[] = {{BO_EQV, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_XOR, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi863[] = {{BO_EQV, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi864[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi865[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi866[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_XOR, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi867[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_XOR, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi868[] = {{BO_EQV, 0, 1, 0}, {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi869[] = {{BO_EQV, 0, 1, 0}, {BO_EQV, 0, 2, 0}, {BO_EQV, 0, 3, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi870[] = {{BO_EQV, 2, 3, 2}, {BO_EQV, 1, 2, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi871[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_EQV, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi872[] = {{BO_NOT, 0, 0, 0}, {BO_NOT, 2, 2, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 0, 1, 0}, + {BO_EQV, 2, 3, 1}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi873[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, + {BO_NOT, 1, 1, 0}, {BO_EQV, 0, 1, 0}, {BO_HLT, 0, 0, 0}}; + const BoolInstr bi874[] = {{BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_EQV, 2, 3, 1}, {BO_NOT, 1, 1, 0}, + {BO_EQV, 0, 1, 0}, {BO_NOT, 0, 0, 0}, {BO_HLT, 0, 0, 0}}; - const BoolInstr* bi[] = { - &bi000[0], &bi001[0], &bi002[0], &bi003[0], &bi004[0], &bi005[0], &bi006[0], &bi007[0], &bi008[0], - &bi009[0], &bi010[0], &bi011[0], &bi012[0], &bi013[0], &bi014[0], &bi015[0], &bi016[0], &bi017[0], - &bi018[0], &bi019[0], &bi020[0], &bi021[0], &bi022[0], &bi023[0], &bi024[0], &bi025[0], &bi026[0], - &bi027[0], &bi028[0], &bi029[0], &bi030[0], &bi031[0], &bi032[0], &bi033[0], &bi034[0], &bi035[0], - &bi036[0], &bi037[0], &bi038[0], &bi039[0], &bi040[0], &bi041[0], &bi042[0], &bi043[0], &bi044[0], - &bi045[0], &bi046[0], &bi047[0], &bi048[0], &bi049[0], &bi050[0], &bi051[0], &bi052[0], &bi053[0], - &bi054[0], &bi055[0], &bi056[0], &bi057[0], &bi058[0], &bi059[0], &bi060[0], &bi061[0], &bi062[0], - &bi063[0], &bi064[0], &bi065[0], &bi066[0], &bi067[0], &bi068[0], &bi069[0], &bi070[0], &bi071[0], - &bi072[0], &bi073[0], &bi074[0], &bi075[0], &bi076[0], &bi077[0], &bi078[0], &bi079[0], &bi080[0], - &bi081[0], &bi082[0], &bi083[0], &bi084[0], &bi085[0], &bi086[0], &bi087[0], &bi088[0], &bi089[0], - &bi090[0], &bi091[0], &bi092[0], &bi093[0], &bi094[0], &bi095[0], &bi096[0], &bi097[0], &bi098[0], - &bi099[0], &bi100[0], &bi101[0], &bi102[0], &bi103[0], &bi104[0], &bi105[0], &bi106[0], &bi107[0], - &bi108[0], &bi109[0], &bi110[0], &bi111[0], &bi112[0], &bi113[0], &bi114[0], &bi115[0], &bi116[0], - &bi117[0], &bi118[0], &bi119[0], &bi120[0], &bi121[0], &bi122[0], &bi123[0], &bi124[0], &bi125[0], - &bi126[0], &bi127[0], &bi128[0], &bi129[0], &bi130[0], &bi131[0], &bi132[0], &bi133[0], &bi134[0], - &bi135[0], &bi136[0], &bi137[0], &bi138[0], &bi139[0], &bi140[0], &bi141[0], &bi142[0], &bi143[0], - &bi144[0], &bi145[0], &bi146[0], &bi147[0], &bi148[0], &bi149[0], &bi150[0], &bi151[0], &bi152[0], - &bi153[0], &bi154[0], &bi155[0], &bi156[0], &bi157[0], &bi158[0], &bi159[0], &bi160[0], &bi161[0], - &bi162[0], &bi163[0], &bi164[0], &bi165[0], &bi166[0], &bi167[0], &bi168[0], &bi169[0], &bi170[0], - &bi171[0], &bi172[0], &bi173[0], &bi174[0], &bi175[0], &bi176[0], &bi177[0], &bi178[0], &bi179[0], - &bi180[0], &bi181[0], &bi182[0], &bi183[0], &bi184[0], &bi185[0], &bi186[0], &bi187[0], &bi188[0], - &bi189[0], &bi190[0], &bi191[0], &bi192[0], &bi193[0], &bi194[0], &bi195[0], &bi196[0], &bi197[0], - &bi198[0], &bi199[0], &bi200[0], &bi201[0], &bi202[0], &bi203[0], &bi204[0], &bi205[0], &bi206[0], - &bi207[0], &bi208[0], &bi209[0], &bi210[0], &bi211[0], &bi212[0], &bi213[0], &bi214[0], &bi215[0], - &bi216[0], &bi217[0], &bi218[0], &bi219[0], &bi220[0], &bi221[0], &bi222[0], &bi223[0], &bi224[0], - &bi225[0], &bi226[0], &bi227[0], &bi228[0], &bi229[0], &bi230[0], &bi231[0], &bi232[0], &bi233[0], - &bi234[0], &bi235[0], &bi236[0], &bi237[0], &bi238[0], &bi239[0], &bi240[0], &bi241[0], &bi242[0], - &bi243[0], &bi244[0], &bi245[0], &bi246[0], &bi247[0], &bi248[0], &bi249[0], &bi250[0], &bi251[0], - &bi252[0], &bi253[0], &bi254[0], &bi255[0], &bi256[0], &bi257[0], &bi258[0], &bi259[0], &bi260[0], - &bi261[0], &bi262[0], &bi263[0], &bi264[0], &bi265[0], &bi266[0], &bi267[0], &bi268[0], &bi269[0], - &bi270[0], &bi271[0], &bi272[0], &bi273[0], &bi274[0], &bi275[0], &bi276[0], &bi277[0], &bi278[0], - &bi279[0], &bi280[0], &bi281[0], &bi282[0], &bi283[0], &bi284[0], &bi285[0], &bi286[0], &bi287[0], - &bi288[0], &bi289[0], &bi290[0], &bi291[0], &bi292[0], &bi293[0], &bi294[0], &bi295[0], &bi296[0], - &bi297[0], &bi298[0], &bi299[0], &bi300[0], &bi301[0], &bi302[0], &bi303[0], &bi304[0], &bi305[0], - &bi306[0], &bi307[0], &bi308[0], &bi309[0], &bi310[0], &bi311[0], &bi312[0], &bi313[0], &bi314[0], - &bi315[0], &bi316[0], &bi317[0], &bi318[0], &bi319[0], &bi320[0], &bi321[0], &bi322[0], &bi323[0], - &bi324[0], &bi325[0], &bi326[0], &bi327[0], &bi328[0], &bi329[0], &bi330[0], &bi331[0], &bi332[0], - &bi333[0], &bi334[0], &bi335[0], &bi336[0], &bi337[0], &bi338[0], &bi339[0], &bi340[0], &bi341[0], - &bi342[0], &bi343[0], &bi344[0], &bi345[0], &bi346[0], &bi347[0], &bi348[0], &bi349[0], &bi350[0], - &bi351[0], &bi352[0], &bi353[0], &bi354[0], &bi355[0], &bi356[0], &bi357[0], &bi358[0], &bi359[0], - &bi360[0], &bi361[0], &bi362[0], &bi363[0], &bi364[0], &bi365[0], &bi366[0], &bi367[0], &bi368[0], - &bi369[0], &bi370[0], &bi371[0], &bi372[0], &bi373[0], &bi374[0], &bi375[0], &bi376[0], &bi377[0], - &bi378[0], &bi379[0], &bi380[0], &bi381[0], &bi382[0], &bi383[0], &bi384[0], &bi385[0], &bi386[0], - &bi387[0], &bi388[0], &bi389[0], &bi390[0], &bi391[0], &bi392[0], &bi393[0], &bi394[0], &bi395[0], - &bi396[0], &bi397[0], &bi398[0], &bi399[0], &bi400[0], &bi401[0], &bi402[0], &bi403[0], &bi404[0], - &bi405[0], &bi406[0], &bi407[0], &bi408[0], &bi409[0], &bi410[0], &bi411[0], &bi412[0], &bi413[0], - &bi414[0], &bi415[0], &bi416[0], &bi417[0], &bi418[0], &bi419[0], &bi420[0], &bi421[0], &bi422[0], - &bi423[0], &bi424[0], &bi425[0], &bi426[0], &bi427[0], &bi428[0], &bi429[0], &bi430[0], &bi431[0], - &bi432[0], &bi433[0], &bi434[0], &bi435[0], &bi436[0], &bi437[0], &bi438[0], &bi439[0], &bi440[0], - &bi441[0], &bi442[0], &bi443[0], &bi444[0], &bi445[0], &bi446[0], &bi447[0], &bi448[0], &bi449[0], - &bi450[0], &bi451[0], &bi452[0], &bi453[0], &bi454[0], &bi455[0], &bi456[0], &bi457[0], &bi458[0], - &bi459[0], &bi460[0], &bi461[0], &bi462[0], &bi463[0], &bi464[0], &bi465[0], &bi466[0], &bi467[0], - &bi468[0], &bi469[0], &bi470[0], &bi471[0], &bi472[0], &bi473[0], &bi474[0], &bi475[0], &bi476[0], - &bi477[0], &bi478[0], &bi479[0], &bi480[0], &bi481[0], &bi482[0], &bi483[0], &bi484[0], &bi485[0], - &bi486[0], &bi487[0], &bi488[0], &bi489[0], &bi490[0], &bi491[0], &bi492[0], &bi493[0], &bi494[0], - &bi495[0], &bi496[0], &bi497[0], &bi498[0], &bi499[0], &bi500[0], &bi501[0], &bi502[0], &bi503[0], - &bi504[0], &bi505[0], &bi506[0], &bi507[0], &bi508[0], &bi509[0], &bi510[0], &bi511[0], &bi512[0], - &bi513[0], &bi514[0], &bi515[0], &bi516[0], &bi517[0], &bi518[0], &bi519[0], &bi520[0], &bi521[0], - &bi522[0], &bi523[0], &bi524[0], &bi525[0], &bi526[0], &bi527[0], &bi528[0], &bi529[0], &bi530[0], - &bi531[0], &bi532[0], &bi533[0], &bi534[0], &bi535[0], &bi536[0], &bi537[0], &bi538[0], &bi539[0], - &bi540[0], &bi541[0], &bi542[0], &bi543[0], &bi544[0], &bi545[0], &bi546[0], &bi547[0], &bi548[0], - &bi549[0], &bi550[0], &bi551[0], &bi552[0], &bi553[0], &bi554[0], &bi555[0], &bi556[0], &bi557[0], - &bi558[0], &bi559[0], &bi560[0], &bi561[0], &bi562[0], &bi563[0], &bi564[0], &bi565[0], &bi566[0], - &bi567[0], &bi568[0], &bi569[0], &bi570[0], &bi571[0], &bi572[0], &bi573[0], &bi574[0], &bi575[0], - &bi576[0], &bi577[0], &bi578[0], &bi579[0], &bi580[0], &bi581[0], &bi582[0], &bi583[0], &bi584[0], - &bi585[0], &bi586[0], &bi587[0], &bi588[0], &bi589[0], &bi590[0], &bi591[0], &bi592[0], &bi593[0], - &bi594[0], &bi595[0], &bi596[0], &bi597[0], &bi598[0], &bi599[0], &bi600[0], &bi601[0], &bi602[0], - &bi603[0], &bi604[0], &bi605[0], &bi606[0], &bi607[0], &bi608[0], &bi609[0], &bi610[0], &bi611[0], - &bi612[0], &bi613[0], &bi614[0], &bi615[0], &bi616[0], &bi617[0], &bi618[0], &bi619[0], &bi620[0], - &bi621[0], &bi622[0], &bi623[0], &bi624[0], &bi625[0], &bi626[0], &bi627[0], &bi628[0], &bi629[0], - &bi630[0], &bi631[0], &bi632[0], &bi633[0], &bi634[0], &bi635[0], &bi636[0], &bi637[0], &bi638[0], - &bi639[0], &bi640[0], &bi641[0], &bi642[0], &bi643[0], &bi644[0], &bi645[0], &bi646[0], &bi647[0], - &bi648[0], &bi649[0], &bi650[0], &bi651[0], &bi652[0], &bi653[0], &bi654[0], &bi655[0], &bi656[0], - &bi657[0], &bi658[0], &bi659[0], &bi660[0], &bi661[0], &bi662[0], &bi663[0], &bi664[0], &bi665[0], - &bi666[0], &bi667[0], &bi668[0], &bi669[0], &bi670[0], &bi671[0], &bi672[0], &bi673[0], &bi674[0], - &bi675[0], &bi676[0], &bi677[0], &bi678[0], &bi679[0], &bi680[0], &bi681[0], &bi682[0], &bi683[0], - &bi684[0], &bi685[0], &bi686[0], &bi687[0], &bi688[0], &bi689[0], &bi690[0], &bi691[0], &bi692[0], - &bi693[0], &bi694[0], &bi695[0], &bi696[0], &bi697[0], &bi698[0], &bi699[0], &bi700[0], &bi701[0], - &bi702[0], &bi703[0], &bi704[0], &bi705[0], &bi706[0], &bi707[0], &bi708[0], &bi709[0], &bi710[0], - &bi711[0], &bi712[0], &bi713[0], &bi714[0], &bi715[0], &bi716[0], &bi717[0], &bi718[0], &bi719[0], - &bi720[0], &bi721[0], &bi722[0], &bi723[0], &bi724[0], &bi725[0], &bi726[0], &bi727[0], &bi728[0], - &bi729[0], &bi730[0], &bi731[0], &bi732[0], &bi733[0], &bi734[0], &bi735[0], &bi736[0], &bi737[0], - &bi738[0], &bi739[0], &bi740[0], &bi741[0], &bi742[0], &bi743[0], &bi744[0], &bi745[0], &bi746[0], - &bi747[0], &bi748[0], &bi749[0], &bi750[0], &bi751[0], &bi752[0], &bi753[0], &bi754[0], &bi755[0], - &bi756[0], &bi757[0], &bi758[0], &bi759[0], &bi760[0], &bi761[0], &bi762[0], &bi763[0], &bi764[0], - &bi765[0], &bi766[0], &bi767[0], &bi768[0], &bi769[0], &bi770[0], &bi771[0], &bi772[0], &bi773[0], - &bi774[0], &bi775[0], &bi776[0], &bi777[0], &bi778[0], &bi779[0], &bi780[0], &bi781[0], &bi782[0], - &bi783[0], &bi784[0], &bi785[0], &bi786[0], &bi787[0], &bi788[0], &bi789[0], &bi790[0], &bi791[0], - &bi792[0], &bi793[0], &bi794[0], &bi795[0], &bi796[0], &bi797[0], &bi798[0], &bi799[0], &bi800[0], - &bi801[0], &bi802[0], &bi803[0], &bi804[0], &bi805[0], &bi806[0], &bi807[0], &bi808[0], &bi809[0], - &bi810[0], &bi811[0], &bi812[0], &bi813[0], &bi814[0], &bi815[0], &bi816[0], &bi817[0], &bi818[0], - &bi819[0], &bi820[0], &bi821[0], &bi822[0], &bi823[0], &bi824[0], &bi825[0], &bi826[0], &bi827[0], - &bi828[0], &bi829[0], &bi830[0], &bi831[0], &bi832[0], &bi833[0], &bi834[0], &bi835[0], &bi836[0], - &bi837[0], &bi838[0], &bi839[0], &bi840[0], &bi841[0], &bi842[0], &bi843[0], &bi844[0], &bi845[0], - &bi846[0], &bi847[0], &bi848[0], &bi849[0], &bi850[0], &bi851[0], &bi852[0], &bi853[0], &bi854[0], - &bi855[0], &bi856[0], &bi857[0], &bi858[0], &bi859[0], &bi860[0], &bi861[0], &bi862[0], &bi863[0], - &bi864[0], &bi865[0], &bi866[0], &bi867[0], &bi868[0], &bi869[0], &bi870[0], &bi871[0], &bi872[0], - &bi873[0], &bi874[0]}; + const BoolInstr* bi[] = { + &bi000[0], &bi001[0], &bi002[0], &bi003[0], &bi004[0], &bi005[0], &bi006[0], &bi007[0], &bi008[0], &bi009[0], + &bi010[0], &bi011[0], &bi012[0], &bi013[0], &bi014[0], &bi015[0], &bi016[0], &bi017[0], &bi018[0], &bi019[0], + &bi020[0], &bi021[0], &bi022[0], &bi023[0], &bi024[0], &bi025[0], &bi026[0], &bi027[0], &bi028[0], &bi029[0], + &bi030[0], &bi031[0], &bi032[0], &bi033[0], &bi034[0], &bi035[0], &bi036[0], &bi037[0], &bi038[0], &bi039[0], + &bi040[0], &bi041[0], &bi042[0], &bi043[0], &bi044[0], &bi045[0], &bi046[0], &bi047[0], &bi048[0], &bi049[0], + &bi050[0], &bi051[0], &bi052[0], &bi053[0], &bi054[0], &bi055[0], &bi056[0], &bi057[0], &bi058[0], &bi059[0], + &bi060[0], &bi061[0], &bi062[0], &bi063[0], &bi064[0], &bi065[0], &bi066[0], &bi067[0], &bi068[0], &bi069[0], + &bi070[0], &bi071[0], &bi072[0], &bi073[0], &bi074[0], &bi075[0], &bi076[0], &bi077[0], &bi078[0], &bi079[0], + &bi080[0], &bi081[0], &bi082[0], &bi083[0], &bi084[0], &bi085[0], &bi086[0], &bi087[0], &bi088[0], &bi089[0], + &bi090[0], &bi091[0], &bi092[0], &bi093[0], &bi094[0], &bi095[0], &bi096[0], &bi097[0], &bi098[0], &bi099[0], + &bi100[0], &bi101[0], &bi102[0], &bi103[0], &bi104[0], &bi105[0], &bi106[0], &bi107[0], &bi108[0], &bi109[0], + &bi110[0], &bi111[0], &bi112[0], &bi113[0], &bi114[0], &bi115[0], &bi116[0], &bi117[0], &bi118[0], &bi119[0], + &bi120[0], &bi121[0], &bi122[0], &bi123[0], &bi124[0], &bi125[0], &bi126[0], &bi127[0], &bi128[0], &bi129[0], + &bi130[0], &bi131[0], &bi132[0], &bi133[0], &bi134[0], &bi135[0], &bi136[0], &bi137[0], &bi138[0], &bi139[0], + &bi140[0], &bi141[0], &bi142[0], &bi143[0], &bi144[0], &bi145[0], &bi146[0], &bi147[0], &bi148[0], &bi149[0], + &bi150[0], &bi151[0], &bi152[0], &bi153[0], &bi154[0], &bi155[0], &bi156[0], &bi157[0], &bi158[0], &bi159[0], + &bi160[0], &bi161[0], &bi162[0], &bi163[0], &bi164[0], &bi165[0], &bi166[0], &bi167[0], &bi168[0], &bi169[0], + &bi170[0], &bi171[0], &bi172[0], &bi173[0], &bi174[0], &bi175[0], &bi176[0], &bi177[0], &bi178[0], &bi179[0], + &bi180[0], &bi181[0], &bi182[0], &bi183[0], &bi184[0], &bi185[0], &bi186[0], &bi187[0], &bi188[0], &bi189[0], + &bi190[0], &bi191[0], &bi192[0], &bi193[0], &bi194[0], &bi195[0], &bi196[0], &bi197[0], &bi198[0], &bi199[0], + &bi200[0], &bi201[0], &bi202[0], &bi203[0], &bi204[0], &bi205[0], &bi206[0], &bi207[0], &bi208[0], &bi209[0], + &bi210[0], &bi211[0], &bi212[0], &bi213[0], &bi214[0], &bi215[0], &bi216[0], &bi217[0], &bi218[0], &bi219[0], + &bi220[0], &bi221[0], &bi222[0], &bi223[0], &bi224[0], &bi225[0], &bi226[0], &bi227[0], &bi228[0], &bi229[0], + &bi230[0], &bi231[0], &bi232[0], &bi233[0], &bi234[0], &bi235[0], &bi236[0], &bi237[0], &bi238[0], &bi239[0], + &bi240[0], &bi241[0], &bi242[0], &bi243[0], &bi244[0], &bi245[0], &bi246[0], &bi247[0], &bi248[0], &bi249[0], + &bi250[0], &bi251[0], &bi252[0], &bi253[0], &bi254[0], &bi255[0], &bi256[0], &bi257[0], &bi258[0], &bi259[0], + &bi260[0], &bi261[0], &bi262[0], &bi263[0], &bi264[0], &bi265[0], &bi266[0], &bi267[0], &bi268[0], &bi269[0], + &bi270[0], &bi271[0], &bi272[0], &bi273[0], &bi274[0], &bi275[0], &bi276[0], &bi277[0], &bi278[0], &bi279[0], + &bi280[0], &bi281[0], &bi282[0], &bi283[0], &bi284[0], &bi285[0], &bi286[0], &bi287[0], &bi288[0], &bi289[0], + &bi290[0], &bi291[0], &bi292[0], &bi293[0], &bi294[0], &bi295[0], &bi296[0], &bi297[0], &bi298[0], &bi299[0], + &bi300[0], &bi301[0], &bi302[0], &bi303[0], &bi304[0], &bi305[0], &bi306[0], &bi307[0], &bi308[0], &bi309[0], + &bi310[0], &bi311[0], &bi312[0], &bi313[0], &bi314[0], &bi315[0], &bi316[0], &bi317[0], &bi318[0], &bi319[0], + &bi320[0], &bi321[0], &bi322[0], &bi323[0], &bi324[0], &bi325[0], &bi326[0], &bi327[0], &bi328[0], &bi329[0], + &bi330[0], &bi331[0], &bi332[0], &bi333[0], &bi334[0], &bi335[0], &bi336[0], &bi337[0], &bi338[0], &bi339[0], + &bi340[0], &bi341[0], &bi342[0], &bi343[0], &bi344[0], &bi345[0], &bi346[0], &bi347[0], &bi348[0], &bi349[0], + &bi350[0], &bi351[0], &bi352[0], &bi353[0], &bi354[0], &bi355[0], &bi356[0], &bi357[0], &bi358[0], &bi359[0], + &bi360[0], &bi361[0], &bi362[0], &bi363[0], &bi364[0], &bi365[0], &bi366[0], &bi367[0], &bi368[0], &bi369[0], + &bi370[0], &bi371[0], &bi372[0], &bi373[0], &bi374[0], &bi375[0], &bi376[0], &bi377[0], &bi378[0], &bi379[0], + &bi380[0], &bi381[0], &bi382[0], &bi383[0], &bi384[0], &bi385[0], &bi386[0], &bi387[0], &bi388[0], &bi389[0], + &bi390[0], &bi391[0], &bi392[0], &bi393[0], &bi394[0], &bi395[0], &bi396[0], &bi397[0], &bi398[0], &bi399[0], + &bi400[0], &bi401[0], &bi402[0], &bi403[0], &bi404[0], &bi405[0], &bi406[0], &bi407[0], &bi408[0], &bi409[0], + &bi410[0], &bi411[0], &bi412[0], &bi413[0], &bi414[0], &bi415[0], &bi416[0], &bi417[0], &bi418[0], &bi419[0], + &bi420[0], &bi421[0], &bi422[0], &bi423[0], &bi424[0], &bi425[0], &bi426[0], &bi427[0], &bi428[0], &bi429[0], + &bi430[0], &bi431[0], &bi432[0], &bi433[0], &bi434[0], &bi435[0], &bi436[0], &bi437[0], &bi438[0], &bi439[0], + &bi440[0], &bi441[0], &bi442[0], &bi443[0], &bi444[0], &bi445[0], &bi446[0], &bi447[0], &bi448[0], &bi449[0], + &bi450[0], &bi451[0], &bi452[0], &bi453[0], &bi454[0], &bi455[0], &bi456[0], &bi457[0], &bi458[0], &bi459[0], + &bi460[0], &bi461[0], &bi462[0], &bi463[0], &bi464[0], &bi465[0], &bi466[0], &bi467[0], &bi468[0], &bi469[0], + &bi470[0], &bi471[0], &bi472[0], &bi473[0], &bi474[0], &bi475[0], &bi476[0], &bi477[0], &bi478[0], &bi479[0], + &bi480[0], &bi481[0], &bi482[0], &bi483[0], &bi484[0], &bi485[0], &bi486[0], &bi487[0], &bi488[0], &bi489[0], + &bi490[0], &bi491[0], &bi492[0], &bi493[0], &bi494[0], &bi495[0], &bi496[0], &bi497[0], &bi498[0], &bi499[0], + &bi500[0], &bi501[0], &bi502[0], &bi503[0], &bi504[0], &bi505[0], &bi506[0], &bi507[0], &bi508[0], &bi509[0], + &bi510[0], &bi511[0], &bi512[0], &bi513[0], &bi514[0], &bi515[0], &bi516[0], &bi517[0], &bi518[0], &bi519[0], + &bi520[0], &bi521[0], &bi522[0], &bi523[0], &bi524[0], &bi525[0], &bi526[0], &bi527[0], &bi528[0], &bi529[0], + &bi530[0], &bi531[0], &bi532[0], &bi533[0], &bi534[0], &bi535[0], &bi536[0], &bi537[0], &bi538[0], &bi539[0], + &bi540[0], &bi541[0], &bi542[0], &bi543[0], &bi544[0], &bi545[0], &bi546[0], &bi547[0], &bi548[0], &bi549[0], + &bi550[0], &bi551[0], &bi552[0], &bi553[0], &bi554[0], &bi555[0], &bi556[0], &bi557[0], &bi558[0], &bi559[0], + &bi560[0], &bi561[0], &bi562[0], &bi563[0], &bi564[0], &bi565[0], &bi566[0], &bi567[0], &bi568[0], &bi569[0], + &bi570[0], &bi571[0], &bi572[0], &bi573[0], &bi574[0], &bi575[0], &bi576[0], &bi577[0], &bi578[0], &bi579[0], + &bi580[0], &bi581[0], &bi582[0], &bi583[0], &bi584[0], &bi585[0], &bi586[0], &bi587[0], &bi588[0], &bi589[0], + &bi590[0], &bi591[0], &bi592[0], &bi593[0], &bi594[0], &bi595[0], &bi596[0], &bi597[0], &bi598[0], &bi599[0], + &bi600[0], &bi601[0], &bi602[0], &bi603[0], &bi604[0], &bi605[0], &bi606[0], &bi607[0], &bi608[0], &bi609[0], + &bi610[0], &bi611[0], &bi612[0], &bi613[0], &bi614[0], &bi615[0], &bi616[0], &bi617[0], &bi618[0], &bi619[0], + &bi620[0], &bi621[0], &bi622[0], &bi623[0], &bi624[0], &bi625[0], &bi626[0], &bi627[0], &bi628[0], &bi629[0], + &bi630[0], &bi631[0], &bi632[0], &bi633[0], &bi634[0], &bi635[0], &bi636[0], &bi637[0], &bi638[0], &bi639[0], + &bi640[0], &bi641[0], &bi642[0], &bi643[0], &bi644[0], &bi645[0], &bi646[0], &bi647[0], &bi648[0], &bi649[0], + &bi650[0], &bi651[0], &bi652[0], &bi653[0], &bi654[0], &bi655[0], &bi656[0], &bi657[0], &bi658[0], &bi659[0], + &bi660[0], &bi661[0], &bi662[0], &bi663[0], &bi664[0], &bi665[0], &bi666[0], &bi667[0], &bi668[0], &bi669[0], + &bi670[0], &bi671[0], &bi672[0], &bi673[0], &bi674[0], &bi675[0], &bi676[0], &bi677[0], &bi678[0], &bi679[0], + &bi680[0], &bi681[0], &bi682[0], &bi683[0], &bi684[0], &bi685[0], &bi686[0], &bi687[0], &bi688[0], &bi689[0], + &bi690[0], &bi691[0], &bi692[0], &bi693[0], &bi694[0], &bi695[0], &bi696[0], &bi697[0], &bi698[0], &bi699[0], + &bi700[0], &bi701[0], &bi702[0], &bi703[0], &bi704[0], &bi705[0], &bi706[0], &bi707[0], &bi708[0], &bi709[0], + &bi710[0], &bi711[0], &bi712[0], &bi713[0], &bi714[0], &bi715[0], &bi716[0], &bi717[0], &bi718[0], &bi719[0], + &bi720[0], &bi721[0], &bi722[0], &bi723[0], &bi724[0], &bi725[0], &bi726[0], &bi727[0], &bi728[0], &bi729[0], + &bi730[0], &bi731[0], &bi732[0], &bi733[0], &bi734[0], &bi735[0], &bi736[0], &bi737[0], &bi738[0], &bi739[0], + &bi740[0], &bi741[0], &bi742[0], &bi743[0], &bi744[0], &bi745[0], &bi746[0], &bi747[0], &bi748[0], &bi749[0], + &bi750[0], &bi751[0], &bi752[0], &bi753[0], &bi754[0], &bi755[0], &bi756[0], &bi757[0], &bi758[0], &bi759[0], + &bi760[0], &bi761[0], &bi762[0], &bi763[0], &bi764[0], &bi765[0], &bi766[0], &bi767[0], &bi768[0], &bi769[0], + &bi770[0], &bi771[0], &bi772[0], &bi773[0], &bi774[0], &bi775[0], &bi776[0], &bi777[0], &bi778[0], &bi779[0], + &bi780[0], &bi781[0], &bi782[0], &bi783[0], &bi784[0], &bi785[0], &bi786[0], &bi787[0], &bi788[0], &bi789[0], + &bi790[0], &bi791[0], &bi792[0], &bi793[0], &bi794[0], &bi795[0], &bi796[0], &bi797[0], &bi798[0], &bi799[0], + &bi800[0], &bi801[0], &bi802[0], &bi803[0], &bi804[0], &bi805[0], &bi806[0], &bi807[0], &bi808[0], &bi809[0], + &bi810[0], &bi811[0], &bi812[0], &bi813[0], &bi814[0], &bi815[0], &bi816[0], &bi817[0], &bi818[0], &bi819[0], + &bi820[0], &bi821[0], &bi822[0], &bi823[0], &bi824[0], &bi825[0], &bi826[0], &bi827[0], &bi828[0], &bi829[0], + &bi830[0], &bi831[0], &bi832[0], &bi833[0], &bi834[0], &bi835[0], &bi836[0], &bi837[0], &bi838[0], &bi839[0], + &bi840[0], &bi841[0], &bi842[0], &bi843[0], &bi844[0], &bi845[0], &bi846[0], &bi847[0], &bi848[0], &bi849[0], + &bi850[0], &bi851[0], &bi852[0], &bi853[0], &bi854[0], &bi855[0], &bi856[0], &bi857[0], &bi858[0], &bi859[0], + &bi860[0], &bi861[0], &bi862[0], &bi863[0], &bi864[0], &bi865[0], &bi866[0], &bi867[0], &bi868[0], &bi869[0], + &bi870[0], &bi871[0], &bi872[0], &bi873[0], &bi874[0]}; - /** - * \brief %Test for Boolean element (regression) - * - * Contributed by Matthias Balzer - */ - class BoolElement : public Test { - protected: - /// How to post - int mode; + /** + * \brief %Test for Boolean element (regression) + * + * Contributed by Matthias Balzer + */ + class BoolElement : public Test { + protected: + /// How to post + int mode; - public: - /// Create and register test - BoolElement(const std::string& s, int m) : Test("MiniModel::BoolElement::" + s, 2, 0, 1), mode(m) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return (x[0] == 0) && (x[1] == 1); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - BoolVarArgs l(2); - l[0] = channel(home, x[0]); - l[1] = channel(home, x[1]); - switch (mode) { - case 0: { - BoolVar b0 = expr(home, !element(l, 0)); - BoolVar b1 = expr(home, element(l, 1)); - rel(home, b0 && b1); - } break; - case 1: { - BoolVar b = expr(home, !element(l, 0) && element(l, 1)); - rel(home, b); - } break; - case 2: - rel(home, !element(l, 0) && element(l, 1)); - break; - default: - GECODE_NEVER; - } + public: + /// Create and register test + BoolElement(const std::string& s, int m) : Test("MiniModel::BoolElement::" + s, 2, 0, 1), mode(m) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return (x[0] == 0) && (x[1] == 1); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + BoolVarArgs l(2); + l[0] = channel(home, x[0]); + l[1] = channel(home, x[1]); + switch (mode) { + case 0: { + BoolVar b0 = expr(home, !element(l, 0)); + BoolVar b1 = expr(home, element(l, 1)); + rel(home, b0 && b1); + } break; + case 1: { + BoolVar b = expr(home, !element(l, 0) && element(l, 1)); + rel(home, b); + } break; + case 2: + rel(home, !element(l, 0) && element(l, 1)); + break; + default: + GECODE_NEVER; } - }; + } + }; - /// Space with an index variable for element over no Boolean variables - class EmptyFixture : public Gecode::Space { - public: - /// Index variable - Gecode::IntVar y; - /// Create fixture - EmptyFixture(void) : y(*this, 0, 1) {} - /// Constructor for cloning \a fixture - EmptyFixture(EmptyFixture& fixture) : Gecode::Space(fixture) { - y.update(*this, fixture.y); - } - /// Copy during cloning - Gecode::Space* - copy(void) override { - return new EmptyFixture(*this); - } - }; + /// Space with an index variable for element over no Boolean variables + class EmptyFixture : public Gecode::Space { + public: + /// Index variable + Gecode::IntVar y; + /// Create fixture + EmptyFixture() : y(*this, 0, 1) {} + /// Constructor for cloning \a fixture + EmptyFixture(EmptyFixture& fixture) : Gecode::Space(fixture) { + y.update(*this, fixture.y); + } + /// Copy during cloning + Gecode::Space* + copy() override { + return new EmptyFixture(*this); + } + }; - /// %Test that element over no Boolean variables throws at posting - class BoolElementEmpty : public Base { - public: - /// Create and register test - BoolElementEmpty(void) : Base("Int::MiniModel::BoolElement::Empty") {} - /// Perform test - bool - run(void) override { - using namespace Gecode; - BoolVarArgs x; - EmptyFixture home; - try { - (void)expr(home, element(x, home.y)); - } catch (Gecode::Int::TooFewArguments&) { - return true; - } - return false; + /// %Test that element over no Boolean variables throws at posting + class BoolElementEmpty : public Base { + public: + /// Create and register test + BoolElementEmpty() : Base("Int::MiniModel::BoolElement::Empty") {} + /// Perform test + bool + run() override { + using namespace Gecode; + BoolVarArgs x; + EmptyFixture home; + try { + (void)expr(home, element(x, home.y)); + } catch (Gecode::Int::TooFewArguments&) { + return true; } - }; - BoolElementEmpty bool_element_empty; + return false; + } + }; + BoolElementEmpty bool_element_empty; - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - int n = sizeof(bi) / sizeof(BoolInstr*); - for (int i = 0; i < n; i++) { - std::string s = Test::str(i); - if (i < 10) { - s.insert(0, "00"); - } else if (i < 100) { - s.insert(0, "0"); - } - (void)new BoolExprInt(bi[i], s, 0); - (void)new BoolExprInt(bi[i], s, 1); - (void)new BoolExprVar(bi[i], s); - } - (void)new BoolElement("Expr::A", 0); - (void)new BoolElement("Expr::B", 1); - (void)new BoolElement("Rel", 2); - for (int mode = 0; mode < 13; mode++) { - (void)new BoolExprConstant(false, mode); - (void)new BoolExprConstant(true, mode); + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + int n = sizeof(bi) / sizeof(BoolInstr*); + for (int i = 0; i < n; i++) { + std::string s = Test::str(i); + if (i < 10) { + s.insert(0, "00"); + } else if (i < 100) { + s.insert(0, "0"); } - (void)new BoolExprDefaultAccumulator(BO_AND, false); - (void)new BoolExprDefaultAccumulator(BO_AND, true); - (void)new BoolExprDefaultAccumulator(BO_OR, false); - (void)new BoolExprDefaultAccumulator(BO_OR, true); - (void)new BoolExprInvalid(BE_EMPTY, "Empty"); - (void)new BoolExprInvalid(BE_NOT_EMPTY, "NotEmpty"); - (void)new BoolExprInvalid(BE_IMP_EMPTY_LHS, "Imp::EmptyLhs"); - (void)new BoolExprInvalid(BE_IMP_EMPTY_RHS, "Imp::EmptyRhs"); - (void)new BoolExprInvalid(BE_RIMP_EMPTY_LHS, "RImp::EmptyLhs"); - (void)new BoolExprInvalid(BE_RIMP_EMPTY_RHS, "RImp::EmptyRhs"); - (void)new BoolExprInvalid(BE_NOT_AND, "NotAnd"); - (void)new BoolExprInvalid(BE_NOT_OR, "NotOr"); - (void)new BoolExprInvalid(BE_XOR_EMPTY, "Xor"); - (void)new BoolExprInvalid(BE_EQV_EMPTY, "Eqv"); - (void)new BoolExprInvalid(BE_NEQ_EMPTY, "Neq"); - (void)new BoolExprInvalid(BE_CONST_IMP_EMPTY, "FalseImpEmpty"); - (void)new BoolExprInvalid(BE_EMPTY_EQV_CONST, "EmptyEqvTrue"); + (void)new BoolExprInt(bi[i], s, 0); + (void)new BoolExprInt(bi[i], s, 1); + (void)new BoolExprVar(bi[i], s); } - }; - - Create c; - //@} - } // namespace MiniModelBoolean + (void)new BoolElement("Expr::A", 0); + (void)new BoolElement("Expr::B", 1); + (void)new BoolElement("Rel", 2); + for (int mode = 0; mode < 13; mode++) { + (void)new BoolExprConstant(false, mode); + (void)new BoolExprConstant(true, mode); + } + (void)new BoolExprDefaultAccumulator(BO_AND, false); + (void)new BoolExprDefaultAccumulator(BO_AND, true); + (void)new BoolExprDefaultAccumulator(BO_OR, false); + (void)new BoolExprDefaultAccumulator(BO_OR, true); + (void)new BoolExprInvalid(BE_EMPTY, "Empty"); + (void)new BoolExprInvalid(BE_NOT_EMPTY, "NotEmpty"); + (void)new BoolExprInvalid(BE_IMP_EMPTY_LHS, "Imp::EmptyLhs"); + (void)new BoolExprInvalid(BE_IMP_EMPTY_RHS, "Imp::EmptyRhs"); + (void)new BoolExprInvalid(BE_RIMP_EMPTY_LHS, "RImp::EmptyLhs"); + (void)new BoolExprInvalid(BE_RIMP_EMPTY_RHS, "RImp::EmptyRhs"); + (void)new BoolExprInvalid(BE_NOT_AND, "NotAnd"); + (void)new BoolExprInvalid(BE_NOT_OR, "NotOr"); + (void)new BoolExprInvalid(BE_XOR_EMPTY, "Xor"); + (void)new BoolExprInvalid(BE_EQV_EMPTY, "Eqv"); + (void)new BoolExprInvalid(BE_NEQ_EMPTY, "Neq"); + (void)new BoolExprInvalid(BE_CONST_IMP_EMPTY, "FalseImpEmpty"); + (void)new BoolExprInvalid(BE_EMPTY_EQV_CONST, "EmptyEqvTrue"); + } + }; -}} // namespace Test::Int + Create c; + //@} +} // namespace Test::Int::MiniModelBoolean // STATISTICS: test-minimodel diff --git a/test/int/mm-count.cpp b/test/int/mm-count.cpp index 4cd669a165..3ceb4cb058 100644 --- a/test/int/mm-count.cpp +++ b/test/int/mm-count.cpp @@ -34,297 +34,293 @@ #include -namespace Test { namespace Int { +/// %Tests for minimal modelling constraints (counting) +namespace Test::Int::MiniModelCount { - /// %Tests for minimal modelling constraints (counting) - namespace MiniModelCount { + /// Expand relation to abbreviation + static std::string + expand(Gecode::IntRelType irt) { + switch (irt) { + case Gecode::IRT_EQ: + return "Exactly"; + case Gecode::IRT_LQ: + return "AtMost"; + case Gecode::IRT_GQ: + return "AtLeast"; + default: + GECODE_NEVER; + } + GECODE_NEVER; + return ""; + } - /// Expand relation to abbreviation - std::string - expand(Gecode::IntRelType irt) { + /** + * \defgroup TaskTestIntMiniModelCount Minimal modelling constraints (counting) + * \ingroup TaskTestInt + */ + //@{ + /// %Test number of equal integers equal to integer + class IntInt : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + IntInt(Gecode::IntRelType irt0) : Test("MiniModel::" + expand(irt0) + "::Int::Int", 4, -2, 2), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int m = 0; + for (int i = x.size(); i--;) + if (x[i] == 0) + m++; + return cmp(m, irt, 2); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { switch (irt) { case Gecode::IRT_EQ: - return "Exactly"; + Gecode::exactly(home, x, 0, 2); + break; case Gecode::IRT_LQ: - return "AtMost"; + Gecode::at_most(home, x, 0, 2); + break; case Gecode::IRT_GQ: - return "AtLeast"; + Gecode::at_least(home, x, 0, 2); + break; default: GECODE_NEVER; } - GECODE_NEVER; - return ""; } + }; - /** - * \defgroup TaskTestIntMiniModelCount Minimal modelling constraints (counting) - * \ingroup TaskTestInt - */ - //@{ - /// %Test number of equal integers equal to integer - class IntInt : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - IntInt(Gecode::IntRelType irt0) : Test("MiniModel::" + expand(irt0) + "::Int::Int", 4, -2, 2), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int m = 0; - for (int i = x.size(); i--;) - if (x[i] == 0) - m++; - return cmp(m, irt, 2); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - switch (irt) { - case Gecode::IRT_EQ: - Gecode::exactly(home, x, 0, 2); - break; - case Gecode::IRT_LQ: - Gecode::at_most(home, x, 0, 2); - break; - case Gecode::IRT_GQ: - Gecode::at_least(home, x, 0, 2); - break; - default: - GECODE_NEVER; - } - } - }; - - /// %Test number of equal integers equal to integer variable - class IntVar : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; + /// %Test number of equal integers equal to integer variable + class IntVar : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; - public: - /// Create and register test - IntVar(Gecode::IntRelType irt0) : Test("MiniModel::" + expand(irt0) + "::Int::Var", 5, -2, 2), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int m = 0; - for (int i = 0; i < 4; i++) - if (x[i] == 0) - m++; - return cmp(m, irt, x[4]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs y(4); - for (int i = 0; i < 4; i++) - y[i] = x[i]; - switch (irt) { - case Gecode::IRT_EQ: - Gecode::exactly(home, y, 0, x[4]); - break; - case Gecode::IRT_LQ: - Gecode::at_most(home, y, 0, x[4]); - break; - case Gecode::IRT_GQ: - Gecode::at_least(home, y, 0, x[4]); - break; - default: - GECODE_NEVER; - } + public: + /// Create and register test + IntVar(Gecode::IntRelType irt0) : Test("MiniModel::" + expand(irt0) + "::Int::Var", 5, -2, 2), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int m = 0; + for (int i = 0; i < 4; i++) + if (x[i] == 0) + m++; + return cmp(m, irt, x[4]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs y(4); + for (int i = 0; i < 4; i++) + y[i] = x[i]; + switch (irt) { + case Gecode::IRT_EQ: + Gecode::exactly(home, y, 0, x[4]); + break; + case Gecode::IRT_LQ: + Gecode::at_most(home, y, 0, x[4]); + break; + case Gecode::IRT_GQ: + Gecode::at_least(home, y, 0, x[4]); + break; + default: + GECODE_NEVER; } - }; + } + }; - /// %Test number of equal variables equal to integer variable - class VarVar : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; + /// %Test number of equal variables equal to integer variable + class VarVar : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; - public: - /// Create and register test - VarVar(Gecode::IntRelType irt0) : Test("MiniModel::" + expand(irt0) + "::Var::Var", 5, -2, 2), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int m = 0; - for (int i = 0; i < 3; i++) - if (x[i] == x[3]) - m++; - return cmp(m, irt, x[4]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs y(3); - for (int i = 0; i < 3; i++) - y[i] = x[i]; - switch (irt) { - case Gecode::IRT_EQ: - Gecode::exactly(home, y, x[3], x[4]); - break; - case Gecode::IRT_LQ: - Gecode::at_most(home, y, x[3], x[4]); - break; - case Gecode::IRT_GQ: - Gecode::at_least(home, y, x[3], x[4]); - break; - default: - GECODE_NEVER; - } + public: + /// Create and register test + VarVar(Gecode::IntRelType irt0) : Test("MiniModel::" + expand(irt0) + "::Var::Var", 5, -2, 2), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int m = 0; + for (int i = 0; i < 3; i++) + if (x[i] == x[3]) + m++; + return cmp(m, irt, x[4]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs y(3); + for (int i = 0; i < 3; i++) + y[i] = x[i]; + switch (irt) { + case Gecode::IRT_EQ: + Gecode::exactly(home, y, x[3], x[4]); + break; + case Gecode::IRT_LQ: + Gecode::at_most(home, y, x[3], x[4]); + break; + case Gecode::IRT_GQ: + Gecode::at_least(home, y, x[3], x[4]); + break; + default: + GECODE_NEVER; } - }; + } + }; - /// %Test number of equal variables equal to integer - class VarInt : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; + /// %Test number of equal variables equal to integer + class VarInt : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; - public: - /// Create and register test - VarInt(Gecode::IntRelType irt0) : Test("MiniModel::" + expand(irt0) + "::Var::Int", 4, -2, 2), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int m = 0; - for (int i = 0; i < 3; i++) - if (x[i] == x[3]) - m++; - return cmp(m, irt, 2); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs y(3); - for (int i = 0; i < 3; i++) - y[i] = x[i]; - switch (irt) { - case Gecode::IRT_EQ: - Gecode::exactly(home, y, x[3], 2); - break; - case Gecode::IRT_LQ: - Gecode::at_most(home, y, x[3], 2); - break; - case Gecode::IRT_GQ: - Gecode::at_least(home, y, x[3], 2); - break; - default: - GECODE_NEVER; - } + public: + /// Create and register test + VarInt(Gecode::IntRelType irt0) : Test("MiniModel::" + expand(irt0) + "::Var::Int", 4, -2, 2), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int m = 0; + for (int i = 0; i < 3; i++) + if (x[i] == x[3]) + m++; + return cmp(m, irt, 2); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs y(3); + for (int i = 0; i < 3; i++) + y[i] = x[i]; + switch (irt) { + case Gecode::IRT_EQ: + Gecode::exactly(home, y, x[3], 2); + break; + case Gecode::IRT_LQ: + Gecode::at_most(home, y, x[3], 2); + break; + case Gecode::IRT_GQ: + Gecode::at_least(home, y, x[3], 2); + break; + default: + GECODE_NEVER; } - }; + } + }; - Gecode::IntArgs ints({1, 0, 3, 2}); + Gecode::IntArgs ints({1, 0, 3, 2}); - /// %Test number of several equal integers equal to integer - class IntArrayInt : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; + /// %Test number of several equal integers equal to integer + class IntArrayInt : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; - public: - /// Create and register test - IntArrayInt(Gecode::IntRelType irt0) - : Test("MiniModel::" + expand(irt0) + "::IntArray::Int", 5, -2, 2), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int m = 0; - for (int i = 0; i < 4; i++) - if (x[i] == ints[i]) - m++; - return cmp(m, irt, 2); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs y(4); - for (int i = 0; i < 4; i++) - y[i] = x[i]; - switch (irt) { - case Gecode::IRT_EQ: - Gecode::exactly(home, y, ints, 2); - break; - case Gecode::IRT_LQ: - Gecode::at_most(home, y, ints, 2); - break; - case Gecode::IRT_GQ: - Gecode::at_least(home, y, ints, 2); - break; - default: - GECODE_NEVER; - } + public: + /// Create and register test + IntArrayInt(Gecode::IntRelType irt0) + : Test("MiniModel::" + expand(irt0) + "::IntArray::Int", 5, -2, 2), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int m = 0; + for (int i = 0; i < 4; i++) + if (x[i] == ints[i]) + m++; + return cmp(m, irt, 2); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs y(4); + for (int i = 0; i < 4; i++) + y[i] = x[i]; + switch (irt) { + case Gecode::IRT_EQ: + Gecode::exactly(home, y, ints, 2); + break; + case Gecode::IRT_LQ: + Gecode::at_most(home, y, ints, 2); + break; + case Gecode::IRT_GQ: + Gecode::at_least(home, y, ints, 2); + break; + default: + GECODE_NEVER; } - }; - - /// %Test number of several equal integers equal to integer variable - class IntArrayVar : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; + } + }; - public: - /// Create and register test - IntArrayVar(Gecode::IntRelType irt0) - : Test("MiniModel::" + expand(irt0) + "::IntArray::Var", 5, -2, 2), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int m = 0; - for (int i = 0; i < 4; i++) - if (x[i] == ints[i]) - m++; - return cmp(m, irt, x[4]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::IntVarArgs y(4); - for (int i = 0; i < 4; i++) - y[i] = x[i]; - switch (irt) { - case Gecode::IRT_EQ: - Gecode::exactly(home, y, ints, x[4]); - break; - case Gecode::IRT_LQ: - Gecode::at_most(home, y, ints, x[4]); - break; - case Gecode::IRT_GQ: - Gecode::at_least(home, y, ints, x[4]); - break; - default: - GECODE_NEVER; - } - } - }; + /// %Test number of several equal integers equal to integer variable + class IntArrayVar : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - for (IntRelTypes irts; irts(); ++irts) - if ((irts.irt() == Gecode::IRT_EQ) || (irts.irt() == Gecode::IRT_LQ) || - (irts.irt() == Gecode::IRT_GQ)) { - (void)new IntInt(irts.irt()); - (void)new IntVar(irts.irt()); - (void)new VarVar(irts.irt()); - (void)new VarInt(irts.irt()); - (void)new IntArrayInt(irts.irt()); - (void)new IntArrayVar(irts.irt()); - } + public: + /// Create and register test + IntArrayVar(Gecode::IntRelType irt0) + : Test("MiniModel::" + expand(irt0) + "::IntArray::Var", 5, -2, 2), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int m = 0; + for (int i = 0; i < 4; i++) + if (x[i] == ints[i]) + m++; + return cmp(m, irt, x[4]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::IntVarArgs y(4); + for (int i = 0; i < 4; i++) + y[i] = x[i]; + switch (irt) { + case Gecode::IRT_EQ: + Gecode::exactly(home, y, ints, x[4]); + break; + case Gecode::IRT_LQ: + Gecode::at_most(home, y, ints, x[4]); + break; + case Gecode::IRT_GQ: + Gecode::at_least(home, y, ints, x[4]); + break; + default: + GECODE_NEVER; } - }; + } + }; - Create c; - //@} + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + for (IntRelTypes irts; irts(); ++irts) + if ((irts.irt() == Gecode::IRT_EQ) || (irts.irt() == Gecode::IRT_LQ) || + (irts.irt() == Gecode::IRT_GQ)) { + (void)new IntInt(irts.irt()); + (void)new IntVar(irts.irt()); + (void)new VarVar(irts.irt()); + (void)new VarInt(irts.irt()); + (void)new IntArrayInt(irts.irt()); + (void)new IntArrayVar(irts.irt()); + } + } + }; - } // namespace MiniModelCount + Create c; + //@} -}} // namespace Test::Int +} // namespace Test::Int::MiniModelCount // STATISTICS: test-minimodel diff --git a/test/int/mm-lin.cpp b/test/int/mm-lin.cpp index cb7f01a389..fa5e66a42d 100644 --- a/test/int/mm-lin.cpp +++ b/test/int/mm-lin.cpp @@ -38,2603 +38,1394 @@ #include -namespace Test { namespace Int { +/// %Tests for minimal modelling constraints (linear) +namespace Test::Int::MiniModelLin { - /// %Tests for minimal modelling constraints (linear) - namespace MiniModelLin { + /// Linear opcode + enum LinOpcode { + LO_ACE, ///< Add integer and expression + LO_AEC, ///< Add expression and integer + LO_AEE, ///< Add expressions + LO_SCE, ///< Subtract integer and expression + LO_SEC, ///< Subtract expression and integer + LO_SEE, ///< Subtract expressions + LO_SE, ///< Unary subtraction + LO_MCE, ///< Multiply constant and expression + LO_MEC, ///< Multiply constant and expression + LO_HLT ///< Stop execution + }; - /// Linear opcode - enum LinOpcode { - LO_ACE, ///< Add integer and expression - LO_AEC, ///< Add expression and integer - LO_AEE, ///< Add expressions - LO_SCE, ///< Subtract integer and expression - LO_SEC, ///< Subtract expression and integer - LO_SEE, ///< Subtract expressions - LO_SE, ///< Unary subtraction - LO_MCE, ///< Multiply constant and expression - LO_MEC, ///< Multiply constant and expression - LO_HLT ///< Stop execution - }; + /// Type for representing a linear instruction + class LinInstr { + public: + LinOpcode o; ///< Which instruction to execute + unsigned char x, y, z; ///< Instruction arguments, \a y is destination (or \a z) + int c; ///< Numerical constant + }; - /// Type for representing a linear instruction - class LinInstr { - public: - LinOpcode o; ///< Which instruction to execute - unsigned char x, y, z; ///< Instruction arguments, \a y is destination (or \a z) - int c; ///< Numerical constant - }; - - /// Evaluate linear instructions - template - Expr - eval(const LinInstr* pc, Expr reg[]) { - while (true) { - switch (pc->o) { - case LO_ACE: - reg[pc->y] = pc->c + reg[pc->x]; - break; - case LO_AEC: - reg[pc->y] = reg[pc->x] + pc->c; - break; - case LO_AEE: - reg[pc->z] = reg[pc->x] + reg[pc->y]; - break; - case LO_SCE: - reg[pc->y] = pc->c - reg[pc->x]; - break; - case LO_SEC: - reg[pc->y] = reg[pc->x] - pc->c; - break; - case LO_SEE: - reg[pc->z] = reg[pc->x] - reg[pc->y]; - break; - case LO_SE: - reg[pc->y] = -reg[pc->x]; - break; - case LO_MCE: - reg[pc->y] = pc->c * reg[pc->x]; - break; - case LO_MEC: - reg[pc->y] = reg[pc->x] * pc->c; - break; - case LO_HLT: - return reg[pc->x]; - default: - GECODE_NEVER; - } - pc++; + /// Evaluate linear instructions + template + static Expr + eval(const LinInstr* pc, Expr reg[]) { + while (true) { + switch (pc->o) { + case LO_ACE: + reg[pc->y] = pc->c + reg[pc->x]; + break; + case LO_AEC: + reg[pc->y] = reg[pc->x] + pc->c; + break; + case LO_AEE: + reg[pc->z] = reg[pc->x] + reg[pc->y]; + break; + case LO_SCE: + reg[pc->y] = pc->c - reg[pc->x]; + break; + case LO_SEC: + reg[pc->y] = reg[pc->x] - pc->c; + break; + case LO_SEE: + reg[pc->z] = reg[pc->x] - reg[pc->y]; + break; + case LO_SE: + reg[pc->y] = -reg[pc->x]; + break; + case LO_MCE: + reg[pc->y] = pc->c * reg[pc->x]; + break; + case LO_MEC: + reg[pc->y] = reg[pc->x] * pc->c; + break; + case LO_HLT: + return reg[pc->x]; + default: + GECODE_NEVER; } - GECODE_NEVER; + pc++; } + GECODE_NEVER; + } - /** - * \defgroup TaskTestIntMiniModelLin Minimal modeling constraints (linear constraints) - * \ingroup TaskTestInt - */ - //@{ - /// %Test public default linear expression behavior - class LinExprDefault : public Test { - public: - LinExprDefault(void) : Test("MiniModel::LinExpr::Default", 1, -5, 5) {} - bool - solution(const Assignment& x) const override { - return x[0] == 1; - } - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - LinIntExpr e; - // Exercise copying a default-constructed expression. - // NOLINTNEXTLINE(performance-unnecessary-copy-initialization) - LinIntExpr c(e); - LinIntExpr a = e + x[0]; - LinIntExpr b = 2 + c; - LinIntExpr m = 3 * e; - rel(home, a + b + m == 3); - } - }; + /** + * \defgroup TaskTestIntMiniModelLin Minimal modeling constraints (linear constraints) + * \ingroup TaskTestInt + */ + //@{ + /// %Test public default linear expression behavior + class LinExprDefault : public Test { + public: + LinExprDefault() : Test("MiniModel::LinExpr::Default", 1, -5, 5) {} + bool + solution(const Assignment& x) const override { + return x[0] == 1; + } + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + LinIntExpr e; + // Exercise copying a default-constructed expression. + // NOLINTNEXTLINE(performance-unnecessary-copy-initialization) + LinIntExpr c(e); + LinIntExpr a = e + x[0]; + LinIntExpr b = 2 + c; + LinIntExpr m = 3 * e; + rel(home, a + b + m == 3); + } + }; - /// %Test linear expressions over integer variables - class LinExprInt : public Test { - protected: - /// Linear instruction sequence - const LinInstr* lis; + /// %Test linear expressions over integer variables + class LinExprInt : public Test { + protected: + /// Linear instruction sequence + const LinInstr* lis; - public: - /// Create and register test - LinExprInt(const LinInstr* lis0, const std::string& s) - : Test(TestTags::sweep(), "MiniModel::LinExpr::Int::" + s, 4, -3, 3), lis(lis0) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int reg[3] = {x[0], x[1], x[2]}; - return eval(lis, reg) == x[3]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - Gecode::LinIntExpr reg[3] = {x[0], x[1], x[2]}; - rel(home, x[3], IRT_EQ, Gecode::expr(home, eval(lis, reg))); - } - }; + public: + /// Create and register test + LinExprInt(const LinInstr* lis0, const std::string& s) + : Test(TestTags::sweep(), "MiniModel::LinExpr::Int::" + s, 4, -3, 3), lis(lis0) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int reg[3] = {x[0], x[1], x[2]}; + return eval(lis, reg) == x[3]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + Gecode::LinIntExpr reg[3] = {x[0], x[1], x[2]}; + rel(home, x[3], IRT_EQ, Gecode::expr(home, eval(lis, reg))); + } + }; - /// %Test linear expressions over Boolean variables - class LinExprBool : public Test { - protected: - /// Linear instruction sequence - const LinInstr* lis; + /// %Test linear expressions over Boolean variables + class LinExprBool : public Test { + protected: + /// Linear instruction sequence + const LinInstr* lis; - public: - /// Create and register test - LinExprBool(TestTags tags, const LinInstr* lis0, const std::string& s) - : Test(tags, "MiniModel::LinExpr::Bool::" + s, 4, -3, 3), lis(lis0) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - for (int i = 3; i--;) - if ((x[i] < 0) || (x[i] > 1)) - return false; - int reg[3] = {x[0], x[1], x[2]}; - return eval(lis, reg) == x[3]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - Gecode::LinIntExpr reg[3] = {channel(home, x[0]), channel(home, x[1]), channel(home, x[2])}; - rel(home, x[3], IRT_EQ, Gecode::expr(home, eval(lis, reg))); - } - }; + public: + /// Create and register test + LinExprBool(TestTags tags, const LinInstr* lis0, const std::string& s) + : Test(tags, "MiniModel::LinExpr::Bool::" + s, 4, -3, 3), lis(lis0) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + for (int i = 3; i--;) + if ((x[i] < 0) || (x[i] > 1)) + return false; + int reg[3] = {x[0], x[1], x[2]}; + return eval(lis, reg) == x[3]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + Gecode::LinIntExpr reg[3] = {channel(home, x[0]), channel(home, x[1]), channel(home, x[2])}; + rel(home, x[3], IRT_EQ, Gecode::expr(home, eval(lis, reg))); + } + }; - /// %Test linear expressions over integer and Boolean variables - class LinExprMixed : public Test { - protected: - /// Linear instruction sequence - const LinInstr* lis; + /// %Test linear expressions over integer and Boolean variables + class LinExprMixed : public Test { + protected: + /// Linear instruction sequence + const LinInstr* lis; - public: - /// Create and register test - LinExprMixed(const LinInstr* lis0, const std::string& s) - : Test(TestTags::sweep(), "MiniModel::LinExpr::Mixed::" + s, 4, -3, 3), lis(lis0) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - if ((x[2] < 0) || (x[2] > 1)) - return false; - int reg[3] = {x[0], x[1], x[2]}; - return eval(lis, reg) == x[3]; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - Gecode::LinIntExpr reg[3] = {x[0], x[1], channel(home, x[2])}; - rel(home, x[3], IRT_EQ, Gecode::expr(home, eval(lis, reg))); - } - }; + public: + /// Create and register test + LinExprMixed(const LinInstr* lis0, const std::string& s) + : Test(TestTags::sweep(), "MiniModel::LinExpr::Mixed::" + s, 4, -3, 3), lis(lis0) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + if ((x[2] < 0) || (x[2] > 1)) + return false; + int reg[3] = {x[0], x[1], x[2]}; + return eval(lis, reg) == x[3]; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + Gecode::LinIntExpr reg[3] = {x[0], x[1], channel(home, x[2])}; + rel(home, x[3], IRT_EQ, Gecode::expr(home, eval(lis, reg))); + } + }; - /// %Test linear relations over integer variables - class LinRelInt : public Test { - protected: - /// Linear instruction sequence for left hand side - const LinInstr* l_lis; - /// Linear instruction sequence for right hand side - const LinInstr* r_lis; - /// Integer relation type to propagate - Gecode::IntRelType irt; + /// %Test linear relations over integer variables + class LinRelInt : public Test { + protected: + /// Linear instruction sequence for left hand side + const LinInstr* l_lis; + /// Linear instruction sequence for right hand side + const LinInstr* r_lis; + /// Integer relation type to propagate + Gecode::IntRelType irt; - public: - /// Create and register test - LinRelInt(const LinInstr* l_lis0, const LinInstr* r_lis0, Gecode::IntRelType irt0, const std::string& s) - : Test("MiniModel::LinRel::Int::" + s + "::" + str(irt0), 3, -3, 3, true), l_lis(l_lis0), r_lis(r_lis0), - irt(irt0) { - test_fixpoint = false; - rms = (1 << std::to_underlying(Gecode::RM_EQV)); - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int l_reg[3] = {x[0], x[1], x[2]}; - int r_reg[3] = {x[0], x[1], x[2]}; - return cmp(eval(l_lis, l_reg), irt, eval(r_lis, r_reg)); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - Gecode::LinIntExpr l_reg[3] = {x[0], x[1], x[2]}; - Gecode::LinIntExpr r_reg[3] = {x[0], x[1], x[2]}; - switch (irt) { - case IRT_EQ: { - IntVar x = Gecode::expr(home, eval(l_lis, l_reg)); - IntVar y = Gecode::expr(home, eval(r_lis, r_reg)); - IntArgs a({1, -1}); - IntVarArgs xy(2); - xy[0] = x; - xy[1] = y; - Gecode::rel(home, 0 == sum(a, xy)); - } break; - case IRT_NQ: - Gecode::rel(home, eval(l_lis, l_reg) - eval(r_lis, r_reg) != 0); - break; - case IRT_LQ: - Gecode::rel(home, !(eval(l_lis, l_reg) > eval(r_lis, r_reg))); - break; - case IRT_LT: - Gecode::rel(home, eval(l_lis, l_reg) < eval(r_lis, r_reg)); - break; - case IRT_GQ: - Gecode::rel(home, eval(l_lis, l_reg) >= eval(r_lis, r_reg)); - break; - case IRT_GR: - Gecode::rel(home, !(eval(l_lis, l_reg) <= eval(r_lis, r_reg))); - break; - default: - GECODE_NEVER; - } + public: + /// Create and register test + LinRelInt(const LinInstr* l_lis0, const LinInstr* r_lis0, Gecode::IntRelType irt0, const std::string& s) + : Test("MiniModel::LinRel::Int::" + s + "::" + str(irt0), 3, -3, 3, true), l_lis(l_lis0), r_lis(r_lis0), + irt(irt0) { + test_fixpoint = false; + rms = (1 << std::to_underlying(Gecode::RM_EQV)); + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int l_reg[3] = {x[0], x[1], x[2]}; + int r_reg[3] = {x[0], x[1], x[2]}; + return cmp(eval(l_lis, l_reg), irt, eval(r_lis, r_reg)); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + Gecode::LinIntExpr l_reg[3] = {x[0], x[1], x[2]}; + Gecode::LinIntExpr r_reg[3] = {x[0], x[1], x[2]}; + switch (irt) { + case IRT_EQ: { + IntVar x = Gecode::expr(home, eval(l_lis, l_reg)); + IntVar y = Gecode::expr(home, eval(r_lis, r_reg)); + IntArgs a({1, -1}); + IntVarArgs xy(2); + xy[0] = x; + xy[1] = y; + Gecode::rel(home, 0 == sum(a, xy)); + } break; + case IRT_NQ: + Gecode::rel(home, eval(l_lis, l_reg) - eval(r_lis, r_reg) != 0); + break; + case IRT_LQ: + Gecode::rel(home, !(eval(l_lis, l_reg) > eval(r_lis, r_reg))); + break; + case IRT_LT: + Gecode::rel(home, eval(l_lis, l_reg) < eval(r_lis, r_reg)); + break; + case IRT_GQ: + Gecode::rel(home, eval(l_lis, l_reg) >= eval(r_lis, r_reg)); + break; + case IRT_GR: + Gecode::rel(home, !(eval(l_lis, l_reg) <= eval(r_lis, r_reg))); + break; + default: + GECODE_NEVER; } - /// Post constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - using namespace Gecode; - assert(r.mode() == RM_EQV); - Gecode::LinIntExpr l_reg[3] = {x[0], x[1], x[2]}; - Gecode::LinIntExpr r_reg[3] = {x[0], x[1], x[2]}; - switch (irt) { - case IRT_EQ: - rel(home, Gecode::expr(home, (eval(l_lis, l_reg) == eval(r_lis, r_reg))), IRT_EQ, r.var()); - break; - case IRT_NQ: - Gecode::rel(home, (eval(l_lis, l_reg) != eval(r_lis, r_reg)) == r.var()); - break; - case IRT_LQ: - Gecode::rel(home, !((eval(l_lis, l_reg) <= eval(r_lis, r_reg)) ^ r.var())); - break; - case IRT_LT: - rel(home, Gecode::expr(home, (eval(l_lis, l_reg) < eval(r_lis, r_reg))), IRT_EQ, r.var()); - break; - case IRT_GQ: - Gecode::rel(home, (eval(l_lis, l_reg) >= eval(r_lis, r_reg)) == r.var()); - break; - case IRT_GR: - Gecode::rel(home, !((eval(l_lis, l_reg) > eval(r_lis, r_reg)) ^ r.var())); - break; - default: - GECODE_NEVER; - } + } + /// Post constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + using namespace Gecode; + assert(r.mode() == RM_EQV); + Gecode::LinIntExpr l_reg[3] = {x[0], x[1], x[2]}; + Gecode::LinIntExpr r_reg[3] = {x[0], x[1], x[2]}; + switch (irt) { + case IRT_EQ: + rel(home, Gecode::expr(home, (eval(l_lis, l_reg) == eval(r_lis, r_reg))), IRT_EQ, r.var()); + break; + case IRT_NQ: + Gecode::rel(home, (eval(l_lis, l_reg) != eval(r_lis, r_reg)) == r.var()); + break; + case IRT_LQ: + Gecode::rel(home, !((eval(l_lis, l_reg) <= eval(r_lis, r_reg)) ^ r.var())); + break; + case IRT_LT: + rel(home, Gecode::expr(home, (eval(l_lis, l_reg) < eval(r_lis, r_reg))), IRT_EQ, r.var()); + break; + case IRT_GQ: + Gecode::rel(home, (eval(l_lis, l_reg) >= eval(r_lis, r_reg)) == r.var()); + break; + case IRT_GR: + Gecode::rel(home, !((eval(l_lis, l_reg) > eval(r_lis, r_reg)) ^ r.var())); + break; + default: + GECODE_NEVER; } - }; + } + }; - /// %Test linear relations over Boolean variables - class LinRelBool : public Test { - protected: - /// Linear instruction sequence for left hand side - const LinInstr* l_lis; - /// Linear instruction sequence for right hand side - const LinInstr* r_lis; - /// Integer relation type to propagate - Gecode::IntRelType irt; + /// %Test linear relations over Boolean variables + class LinRelBool : public Test { + protected: + /// Linear instruction sequence for left hand side + const LinInstr* l_lis; + /// Linear instruction sequence for right hand side + const LinInstr* r_lis; + /// Integer relation type to propagate + Gecode::IntRelType irt; - public: - /// Create and register test - LinRelBool(const LinInstr* l_lis0, const LinInstr* r_lis0, Gecode::IntRelType irt0, const std::string& s) - : Test("MiniModel::LinRel::Bool::" + s + "::" + str(irt0), 3, 0, 1, true), l_lis(l_lis0), r_lis(r_lis0), - irt(irt0) { - test_fixpoint = false; - rms = (1 << std::to_underlying(Gecode::RM_EQV)); - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int l_reg[3] = {x[0], x[1], x[2]}; - int r_reg[3] = {x[0], x[1], x[2]}; - return cmp(eval(l_lis, l_reg), irt, eval(r_lis, r_reg)); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - BoolVarArgs y(3); - y[0] = channel(home, x[0]); - y[1] = channel(home, x[1]); - y[2] = channel(home, x[2]); - Gecode::LinIntExpr l_reg[3] = {y[0], y[1], y[2]}; - Gecode::LinIntExpr r_reg[3] = {y[0], y[1], y[2]}; - switch (irt) { - case IRT_EQ: { - IntVar x = Gecode::expr(home, eval(l_lis, l_reg)); - IntVar y = Gecode::expr(home, eval(r_lis, r_reg)); - IntArgs a({-2, 2}); - IntVarArgs xy(2); - xy[0] = x; - xy[1] = y; - Gecode::rel(home, 0 == sum(a, xy)); - } break; - case IRT_NQ: - Gecode::rel(home, eval(l_lis, l_reg) - eval(r_lis, r_reg) != 0); - break; - case IRT_LQ: - Gecode::rel(home, !(eval(l_lis, l_reg) > eval(r_lis, r_reg))); - break; - case IRT_LT: - Gecode::rel(home, eval(l_lis, l_reg) < eval(r_lis, r_reg)); - break; - case IRT_GQ: - Gecode::rel(home, eval(l_lis, l_reg) >= eval(r_lis, r_reg)); - break; - case IRT_GR: - Gecode::rel(home, !(eval(l_lis, l_reg) <= eval(r_lis, r_reg))); - break; - default: - GECODE_NEVER; - } + public: + /// Create and register test + LinRelBool(const LinInstr* l_lis0, const LinInstr* r_lis0, Gecode::IntRelType irt0, const std::string& s) + : Test("MiniModel::LinRel::Bool::" + s + "::" + str(irt0), 3, 0, 1, true), l_lis(l_lis0), r_lis(r_lis0), + irt(irt0) { + test_fixpoint = false; + rms = (1 << std::to_underlying(Gecode::RM_EQV)); + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int l_reg[3] = {x[0], x[1], x[2]}; + int r_reg[3] = {x[0], x[1], x[2]}; + return cmp(eval(l_lis, l_reg), irt, eval(r_lis, r_reg)); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + BoolVarArgs y(3); + y[0] = channel(home, x[0]); + y[1] = channel(home, x[1]); + y[2] = channel(home, x[2]); + Gecode::LinIntExpr l_reg[3] = {y[0], y[1], y[2]}; + Gecode::LinIntExpr r_reg[3] = {y[0], y[1], y[2]}; + switch (irt) { + case IRT_EQ: { + IntVar x = Gecode::expr(home, eval(l_lis, l_reg)); + IntVar y = Gecode::expr(home, eval(r_lis, r_reg)); + IntArgs a({-2, 2}); + IntVarArgs xy(2); + xy[0] = x; + xy[1] = y; + Gecode::rel(home, 0 == sum(a, xy)); + } break; + case IRT_NQ: + Gecode::rel(home, eval(l_lis, l_reg) - eval(r_lis, r_reg) != 0); + break; + case IRT_LQ: + Gecode::rel(home, !(eval(l_lis, l_reg) > eval(r_lis, r_reg))); + break; + case IRT_LT: + Gecode::rel(home, eval(l_lis, l_reg) < eval(r_lis, r_reg)); + break; + case IRT_GQ: + Gecode::rel(home, eval(l_lis, l_reg) >= eval(r_lis, r_reg)); + break; + case IRT_GR: + Gecode::rel(home, !(eval(l_lis, l_reg) <= eval(r_lis, r_reg))); + break; + default: + GECODE_NEVER; } - /// Post constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - using namespace Gecode; - assert(r.mode() == RM_EQV); - BoolVarArgs y(3); - y[0] = channel(home, x[0]); - y[1] = channel(home, x[1]); - y[2] = channel(home, x[2]); - Gecode::LinIntExpr l_reg[3] = {y[0], y[1], y[2]}; - Gecode::LinIntExpr r_reg[3] = {y[0], y[1], y[2]}; - switch (irt) { - case IRT_EQ: - rel(home, Gecode::expr(home, (eval(l_lis, l_reg) == eval(r_lis, r_reg))), IRT_EQ, r.var()); - break; - case IRT_NQ: - Gecode::rel(home, (eval(l_lis, l_reg) != eval(r_lis, r_reg)) == r.var()); - break; - case IRT_LQ: - Gecode::rel(home, !((eval(l_lis, l_reg) <= eval(r_lis, r_reg)) ^ r.var())); - break; - case IRT_LT: - rel(home, Gecode::expr(home, (eval(l_lis, l_reg) < eval(r_lis, r_reg))), IRT_EQ, r.var()); - break; - case IRT_GQ: - Gecode::rel(home, (eval(l_lis, l_reg) >= eval(r_lis, r_reg)) == r.var()); - break; - case IRT_GR: - Gecode::rel(home, !((eval(l_lis, l_reg) > eval(r_lis, r_reg)) ^ r.var())); - break; - default: - GECODE_NEVER; - } + } + /// Post constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + using namespace Gecode; + assert(r.mode() == RM_EQV); + BoolVarArgs y(3); + y[0] = channel(home, x[0]); + y[1] = channel(home, x[1]); + y[2] = channel(home, x[2]); + Gecode::LinIntExpr l_reg[3] = {y[0], y[1], y[2]}; + Gecode::LinIntExpr r_reg[3] = {y[0], y[1], y[2]}; + switch (irt) { + case IRT_EQ: + rel(home, Gecode::expr(home, (eval(l_lis, l_reg) == eval(r_lis, r_reg))), IRT_EQ, r.var()); + break; + case IRT_NQ: + Gecode::rel(home, (eval(l_lis, l_reg) != eval(r_lis, r_reg)) == r.var()); + break; + case IRT_LQ: + Gecode::rel(home, !((eval(l_lis, l_reg) <= eval(r_lis, r_reg)) ^ r.var())); + break; + case IRT_LT: + rel(home, Gecode::expr(home, (eval(l_lis, l_reg) < eval(r_lis, r_reg))), IRT_EQ, r.var()); + break; + case IRT_GQ: + Gecode::rel(home, (eval(l_lis, l_reg) >= eval(r_lis, r_reg)) == r.var()); + break; + case IRT_GR: + Gecode::rel(home, !((eval(l_lis, l_reg) > eval(r_lis, r_reg)) ^ r.var())); + break; + default: + GECODE_NEVER; } - }; + } + }; - /// %Test linear relations over integer and Boolean variables - class LinRelMixed : public Test { - protected: - /// Linear instruction sequence for left hand side - const LinInstr* l_lis; - /// Linear instruction sequence for right hand side - const LinInstr* r_lis; - /// Integer relation type to propagate - Gecode::IntRelType irt; + /// %Test linear relations over integer and Boolean variables + class LinRelMixed : public Test { + protected: + /// Linear instruction sequence for left hand side + const LinInstr* l_lis; + /// Linear instruction sequence for right hand side + const LinInstr* r_lis; + /// Integer relation type to propagate + Gecode::IntRelType irt; - public: - /// Create and register test - LinRelMixed(const LinInstr* l_lis0, const LinInstr* r_lis0, Gecode::IntRelType irt0, const std::string& s) - : Test("MiniModel::LinRel::Mixed::" + s + "::" + str(irt0), 6, 0, 1, true), l_lis(l_lis0), - r_lis(r_lis0), irt(irt0) { - test_fixpoint = false; - rms = (1 << std::to_underlying(Gecode::RM_EQV)); - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int l_reg[3] = {x[0], x[1], x[2]}; - int r_reg[3] = {x[3], x[4], x[5]}; - return cmp(eval(l_lis, l_reg), irt, eval(r_lis, r_reg)); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - Gecode::LinIntExpr l_reg[3] = {channel(home, x[0]), x[1], x[2]}; - Gecode::LinIntExpr r_reg[3] = {channel(home, x[3]), x[4], channel(home, x[5])}; - switch (irt) { - case IRT_EQ: - Gecode::rel(home, 0 == eval(l_lis, l_reg) - eval(r_lis, r_reg)); - break; - case IRT_NQ: - Gecode::rel(home, eval(l_lis, l_reg) - eval(r_lis, r_reg) != 0); - break; - case IRT_LQ: - Gecode::rel(home, !(eval(l_lis, l_reg) > eval(r_lis, r_reg))); - break; - case IRT_LT: - Gecode::rel(home, eval(l_lis, l_reg) < eval(r_lis, r_reg)); - break; - case IRT_GQ: - Gecode::rel(home, eval(l_lis, l_reg) >= eval(r_lis, r_reg)); - break; - case IRT_GR: - Gecode::rel(home, !(eval(l_lis, l_reg) <= eval(r_lis, r_reg))); - break; - default: - GECODE_NEVER; - } + public: + /// Create and register test + LinRelMixed(const LinInstr* l_lis0, const LinInstr* r_lis0, Gecode::IntRelType irt0, const std::string& s) + : Test("MiniModel::LinRel::Mixed::" + s + "::" + str(irt0), 6, 0, 1, true), l_lis(l_lis0), r_lis(r_lis0), + irt(irt0) { + test_fixpoint = false; + rms = (1 << std::to_underlying(Gecode::RM_EQV)); + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int l_reg[3] = {x[0], x[1], x[2]}; + int r_reg[3] = {x[3], x[4], x[5]}; + return cmp(eval(l_lis, l_reg), irt, eval(r_lis, r_reg)); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + Gecode::LinIntExpr l_reg[3] = {channel(home, x[0]), x[1], x[2]}; + Gecode::LinIntExpr r_reg[3] = {channel(home, x[3]), x[4], channel(home, x[5])}; + switch (irt) { + case IRT_EQ: + Gecode::rel(home, 0 == eval(l_lis, l_reg) - eval(r_lis, r_reg)); + break; + case IRT_NQ: + Gecode::rel(home, eval(l_lis, l_reg) - eval(r_lis, r_reg) != 0); + break; + case IRT_LQ: + Gecode::rel(home, !(eval(l_lis, l_reg) > eval(r_lis, r_reg))); + break; + case IRT_LT: + Gecode::rel(home, eval(l_lis, l_reg) < eval(r_lis, r_reg)); + break; + case IRT_GQ: + Gecode::rel(home, eval(l_lis, l_reg) >= eval(r_lis, r_reg)); + break; + case IRT_GR: + Gecode::rel(home, !(eval(l_lis, l_reg) <= eval(r_lis, r_reg))); + break; + default: + GECODE_NEVER; } - /// Post constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - using namespace Gecode; - assert(r.mode() == RM_EQV); - Gecode::LinIntExpr l_reg[3] = {channel(home, x[0]), x[1], x[2]}; - Gecode::LinIntExpr r_reg[3] = {channel(home, x[3]), x[4], channel(home, x[5])}; - switch (irt) { - case IRT_EQ: - rel(home, Gecode::expr(home, (eval(l_lis, l_reg) == eval(r_lis, r_reg))), IRT_EQ, r.var()); - break; - case IRT_NQ: - rel(home, Gecode::expr(home, (eval(l_lis, l_reg) != eval(r_lis, r_reg))), IRT_EQ, r.var()); - break; - case IRT_LQ: - rel(home, Gecode::expr(home, (eval(l_lis, l_reg) <= eval(r_lis, r_reg))), IRT_EQ, r.var()); - break; - case IRT_LT: - rel(home, Gecode::expr(home, (eval(l_lis, l_reg) < eval(r_lis, r_reg))), IRT_EQ, r.var()); - break; - case IRT_GQ: - rel(home, Gecode::expr(home, (eval(l_lis, l_reg) >= eval(r_lis, r_reg))), IRT_EQ, r.var()); - break; - case IRT_GR: - rel(home, Gecode::expr(home, (eval(l_lis, l_reg) > eval(r_lis, r_reg))), IRT_EQ, r.var()); - break; - default: - GECODE_NEVER; - } + } + /// Post constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + using namespace Gecode; + assert(r.mode() == RM_EQV); + Gecode::LinIntExpr l_reg[3] = {channel(home, x[0]), x[1], x[2]}; + Gecode::LinIntExpr r_reg[3] = {channel(home, x[3]), x[4], channel(home, x[5])}; + switch (irt) { + case IRT_EQ: + rel(home, Gecode::expr(home, (eval(l_lis, l_reg) == eval(r_lis, r_reg))), IRT_EQ, r.var()); + break; + case IRT_NQ: + rel(home, Gecode::expr(home, (eval(l_lis, l_reg) != eval(r_lis, r_reg))), IRT_EQ, r.var()); + break; + case IRT_LQ: + rel(home, Gecode::expr(home, (eval(l_lis, l_reg) <= eval(r_lis, r_reg))), IRT_EQ, r.var()); + break; + case IRT_LT: + rel(home, Gecode::expr(home, (eval(l_lis, l_reg) < eval(r_lis, r_reg))), IRT_EQ, r.var()); + break; + case IRT_GQ: + rel(home, Gecode::expr(home, (eval(l_lis, l_reg) >= eval(r_lis, r_reg))), IRT_EQ, r.var()); + break; + case IRT_GR: + rel(home, Gecode::expr(home, (eval(l_lis, l_reg) > eval(r_lis, r_reg))), IRT_EQ, r.var()); + break; + default: + GECODE_NEVER; } - }; + } + }; - const LinInstr li000[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li001[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li002[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li003[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li004[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li005[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li006[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li007[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li008[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li009[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li010[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li011[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li012[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li013[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li014[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li015[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li016[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li017[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li018[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li019[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li020[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li021[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li022[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li023[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li024[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li025[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li026[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li027[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li028[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li029[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li030[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li031[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li032[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li033[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li034[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li035[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li036[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li037[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li038[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li039[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li040[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li041[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li042[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li043[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li044[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li045[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li046[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li047[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li048[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li049[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li050[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li051[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li052[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li053[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li054[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li055[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li056[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li057[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li058[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li059[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li060[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li061[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li062[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li063[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li064[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li065[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li066[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li067[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li068[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li069[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li070[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li071[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li072[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li073[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li074[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li075[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li076[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li077[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li078[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li079[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li080[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li081[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li082[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li083[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li084[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li085[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li086[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li087[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li088[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li089[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li090[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li091[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li092[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li093[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li094[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li095[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li096[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li097[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li098[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li099[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li100[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li101[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li102[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li103[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li104[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li105[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li106[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li107[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li108[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li109[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li110[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li111[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li112[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li113[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li114[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li115[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li116[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li117[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li118[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li119[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li120[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li121[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li122[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li123[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li124[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li125[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li126[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li127[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li128[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li129[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li130[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li131[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li132[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li133[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li134[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li135[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li136[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li137[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li138[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li139[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li140[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li141[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li142[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li143[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li144[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li145[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li146[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li147[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li148[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li149[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li150[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li151[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li152[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li153[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li154[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li155[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li156[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li157[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li158[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li159[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li160[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li161[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li162[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li163[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li164[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li165[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li166[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li167[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li168[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li169[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li170[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li171[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li172[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li173[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li174[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li175[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li176[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li177[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li178[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li179[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li180[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li181[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li182[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li183[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li184[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li185[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li186[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li187[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li188[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li189[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li190[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li191[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li192[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li193[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li194[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li195[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li196[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li197[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li198[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li199[] = {{LO_AEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li200[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li201[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li202[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li203[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li204[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li205[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li206[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li207[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li208[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li209[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li210[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li211[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li212[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li213[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li214[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li215[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li216[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li217[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li218[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li219[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li220[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li221[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li222[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li223[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li224[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li225[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li226[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li227[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li228[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li229[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li230[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li231[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li232[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li233[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li234[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li235[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li236[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li237[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li238[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li239[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_AEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li240[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li241[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li242[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li243[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li244[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li245[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li246[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li247[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li248[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li249[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li250[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li251[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li252[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li253[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li254[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li255[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li256[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li257[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li258[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li259[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li260[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li261[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li262[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li263[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li264[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li265[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li266[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li267[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li268[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li269[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li270[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li271[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li272[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li273[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li274[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li275[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li276[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li277[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li278[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li279[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li280[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li281[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li282[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li283[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li284[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li285[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li286[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li287[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li288[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li289[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li290[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li291[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li292[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li293[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li294[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li295[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li296[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li297[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li298[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li299[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li300[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li301[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li302[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li303[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li304[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li305[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li306[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li307[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li308[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li309[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li310[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li311[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li312[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li313[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li314[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li315[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li316[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li317[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li318[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li319[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_SEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li320[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li321[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li322[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li323[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li324[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li325[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li326[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li327[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li328[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li329[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li330[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li331[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li332[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li333[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li334[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li335[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li336[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li337[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li338[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li339[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li340[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li341[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li342[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li343[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li344[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li345[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li346[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li347[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li348[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li349[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li350[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li351[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li352[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li353[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li354[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li355[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li356[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li357[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li358[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li359[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MCE, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li360[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li361[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li362[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li363[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li364[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li365[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li366[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li367[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li368[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li369[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li370[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li371[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li372[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li373[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li374[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li375[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, -1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li376[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li377[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li378[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li379[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li380[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li381[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li382[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li383[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 0}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li384[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li385[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li386[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li387[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li388[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li389[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li390[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li391[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 1}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li392[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li393[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li394[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li395[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_AEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li396[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, -1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li397[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_ACE, 0, 0, 0, 1}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li398[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; - const LinInstr li399[] = {{LO_SEE, 0, 1, 0, 0}, - {LO_MEC, 0, 0, 0, 2}, - {LO_SEE, 0, 2, 0, 0}, - {LO_SE, 0, 0, 0, 0}, - {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li000[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li001[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li002[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li003[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li004[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li005[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li006[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li007[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li008[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li009[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li010[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li011[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li012[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li013[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li014[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li015[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li016[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li017[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li018[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li019[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li020[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li021[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li022[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li023[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li024[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li025[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li026[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li027[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li028[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li029[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li030[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li031[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li032[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li033[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li034[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li035[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li036[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li037[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li038[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li039[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li040[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li041[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li042[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li043[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li044[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li045[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li046[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li047[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li048[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li049[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li050[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li051[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li052[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li053[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li054[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li055[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li056[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li057[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li058[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li059[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li060[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li061[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li062[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li063[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li064[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li065[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li066[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li067[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li068[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li069[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li070[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li071[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li072[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li073[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li074[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li075[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li076[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li077[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li078[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li079[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li080[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li081[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li082[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li083[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li084[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li085[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li086[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li087[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li088[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li089[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li090[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li091[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li092[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li093[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li094[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li095[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li096[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li097[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li098[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li099[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li100[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li101[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li102[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li103[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li104[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li105[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li106[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li107[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li108[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li109[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li110[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li111[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li112[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li113[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li114[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li115[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li116[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li117[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li118[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li119[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li120[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li121[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li122[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li123[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li124[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li125[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li126[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li127[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li128[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li129[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li130[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li131[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li132[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li133[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li134[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li135[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li136[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li137[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li138[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li139[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li140[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li141[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li142[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li143[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li144[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li145[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li146[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li147[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li148[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li149[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li150[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li151[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li152[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li153[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li154[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li155[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li156[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li157[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li158[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li159[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li160[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li161[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li162[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li163[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li164[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li165[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li166[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li167[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li168[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li169[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li170[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li171[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li172[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li173[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li174[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li175[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li176[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li177[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li178[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li179[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li180[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li181[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li182[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li183[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li184[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li185[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li186[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li187[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li188[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li189[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li190[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li191[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li192[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li193[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li194[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li195[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li196[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li197[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li198[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li199[] = { + {LO_AEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li200[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li201[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li202[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li203[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li204[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li205[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li206[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li207[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li208[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li209[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li210[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li211[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li212[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li213[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li214[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li215[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li216[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li217[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li218[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li219[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li220[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li221[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li222[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li223[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li224[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li225[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li226[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li227[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li228[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li229[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li230[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li231[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li232[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li233[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li234[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li235[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li236[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li237[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li238[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li239[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_AEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li240[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li241[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li242[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li243[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li244[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li245[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li246[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li247[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li248[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li249[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li250[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li251[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li252[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li253[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li254[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li255[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li256[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li257[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li258[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li259[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li260[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li261[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li262[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li263[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li264[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li265[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li266[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li267[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li268[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li269[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li270[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li271[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li272[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li273[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li274[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li275[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li276[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li277[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li278[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li279[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li280[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li281[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li282[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li283[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li284[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li285[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li286[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li287[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li288[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li289[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li290[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li291[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li292[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li293[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li294[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li295[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li296[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li297[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li298[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li299[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li300[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li301[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li302[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li303[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li304[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li305[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li306[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li307[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li308[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li309[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li310[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li311[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li312[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li313[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li314[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li315[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li316[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li317[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li318[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li319[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_SEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li320[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li321[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li322[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li323[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li324[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li325[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li326[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li327[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li328[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li329[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li330[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li331[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li332[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li333[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li334[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li335[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li336[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li337[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li338[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li339[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li340[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li341[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li342[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li343[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li344[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li345[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li346[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li347[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li348[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li349[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li350[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li351[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li352[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li353[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li354[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li355[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li356[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li357[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li358[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li359[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MCE, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li360[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li361[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li362[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li363[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li364[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li365[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li366[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li367[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li368[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li369[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li370[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li371[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li372[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li373[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li374[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li375[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, -1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li376[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li377[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li378[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li379[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li380[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li381[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li382[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li383[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 0}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li384[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li385[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li386[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li387[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li388[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li389[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li390[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li391[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 1}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li392[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li393[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li394[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li395[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_AEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li396[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, -1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li397[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_ACE, 0, 0, 0, 1}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li398[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; + const LinInstr li399[] = { + {LO_SEE, 0, 1, 0, 0}, {LO_MEC, 0, 0, 0, 2}, {LO_SEE, 0, 2, 0, 0}, {LO_SE, 0, 0, 0, 0}, {LO_HLT, 0, 0, 0, 0}}; - const LinInstr* li[] = { - &li000[0], &li001[0], &li002[0], &li003[0], &li004[0], &li005[0], &li006[0], &li007[0], &li008[0], - &li009[0], &li010[0], &li011[0], &li012[0], &li013[0], &li014[0], &li015[0], &li016[0], &li017[0], - &li018[0], &li019[0], &li020[0], &li021[0], &li022[0], &li023[0], &li024[0], &li025[0], &li026[0], - &li027[0], &li028[0], &li029[0], &li030[0], &li031[0], &li032[0], &li033[0], &li034[0], &li035[0], - &li036[0], &li037[0], &li038[0], &li039[0], &li040[0], &li041[0], &li042[0], &li043[0], &li044[0], - &li045[0], &li046[0], &li047[0], &li048[0], &li049[0], &li050[0], &li051[0], &li052[0], &li053[0], - &li054[0], &li055[0], &li056[0], &li057[0], &li058[0], &li059[0], &li060[0], &li061[0], &li062[0], - &li063[0], &li064[0], &li065[0], &li066[0], &li067[0], &li068[0], &li069[0], &li070[0], &li071[0], - &li072[0], &li073[0], &li074[0], &li075[0], &li076[0], &li077[0], &li078[0], &li079[0], &li080[0], - &li081[0], &li082[0], &li083[0], &li084[0], &li085[0], &li086[0], &li087[0], &li088[0], &li089[0], - &li090[0], &li091[0], &li092[0], &li093[0], &li094[0], &li095[0], &li096[0], &li097[0], &li098[0], - &li099[0], &li100[0], &li101[0], &li102[0], &li103[0], &li104[0], &li105[0], &li106[0], &li107[0], - &li108[0], &li109[0], &li110[0], &li111[0], &li112[0], &li113[0], &li114[0], &li115[0], &li116[0], - &li117[0], &li118[0], &li119[0], &li120[0], &li121[0], &li122[0], &li123[0], &li124[0], &li125[0], - &li126[0], &li127[0], &li128[0], &li129[0], &li130[0], &li131[0], &li132[0], &li133[0], &li134[0], - &li135[0], &li136[0], &li137[0], &li138[0], &li139[0], &li140[0], &li141[0], &li142[0], &li143[0], - &li144[0], &li145[0], &li146[0], &li147[0], &li148[0], &li149[0], &li150[0], &li151[0], &li152[0], - &li153[0], &li154[0], &li155[0], &li156[0], &li157[0], &li158[0], &li159[0], &li160[0], &li161[0], - &li162[0], &li163[0], &li164[0], &li165[0], &li166[0], &li167[0], &li168[0], &li169[0], &li170[0], - &li171[0], &li172[0], &li173[0], &li174[0], &li175[0], &li176[0], &li177[0], &li178[0], &li179[0], - &li180[0], &li181[0], &li182[0], &li183[0], &li184[0], &li185[0], &li186[0], &li187[0], &li188[0], - &li189[0], &li190[0], &li191[0], &li192[0], &li193[0], &li194[0], &li195[0], &li196[0], &li197[0], - &li198[0], &li199[0], &li200[0], &li201[0], &li202[0], &li203[0], &li204[0], &li205[0], &li206[0], - &li207[0], &li208[0], &li209[0], &li210[0], &li211[0], &li212[0], &li213[0], &li214[0], &li215[0], - &li216[0], &li217[0], &li218[0], &li219[0], &li220[0], &li221[0], &li222[0], &li223[0], &li224[0], - &li225[0], &li226[0], &li227[0], &li228[0], &li229[0], &li230[0], &li231[0], &li232[0], &li233[0], - &li234[0], &li235[0], &li236[0], &li237[0], &li238[0], &li239[0], &li240[0], &li241[0], &li242[0], - &li243[0], &li244[0], &li245[0], &li246[0], &li247[0], &li248[0], &li249[0], &li250[0], &li251[0], - &li252[0], &li253[0], &li254[0], &li255[0], &li256[0], &li257[0], &li258[0], &li259[0], &li260[0], - &li261[0], &li262[0], &li263[0], &li264[0], &li265[0], &li266[0], &li267[0], &li268[0], &li269[0], - &li270[0], &li271[0], &li272[0], &li273[0], &li274[0], &li275[0], &li276[0], &li277[0], &li278[0], - &li279[0], &li280[0], &li281[0], &li282[0], &li283[0], &li284[0], &li285[0], &li286[0], &li287[0], - &li288[0], &li289[0], &li290[0], &li291[0], &li292[0], &li293[0], &li294[0], &li295[0], &li296[0], - &li297[0], &li298[0], &li299[0], &li300[0], &li301[0], &li302[0], &li303[0], &li304[0], &li305[0], - &li306[0], &li307[0], &li308[0], &li309[0], &li310[0], &li311[0], &li312[0], &li313[0], &li314[0], - &li315[0], &li316[0], &li317[0], &li318[0], &li319[0], &li320[0], &li321[0], &li322[0], &li323[0], - &li324[0], &li325[0], &li326[0], &li327[0], &li328[0], &li329[0], &li330[0], &li331[0], &li332[0], - &li333[0], &li334[0], &li335[0], &li336[0], &li337[0], &li338[0], &li339[0], &li340[0], &li341[0], - &li342[0], &li343[0], &li344[0], &li345[0], &li346[0], &li347[0], &li348[0], &li349[0], &li350[0], - &li351[0], &li352[0], &li353[0], &li354[0], &li355[0], &li356[0], &li357[0], &li358[0], &li359[0], - &li360[0], &li361[0], &li362[0], &li363[0], &li364[0], &li365[0], &li366[0], &li367[0], &li368[0], - &li369[0], &li370[0], &li371[0], &li372[0], &li373[0], &li374[0], &li375[0], &li376[0], &li377[0], - &li378[0], &li379[0], &li380[0], &li381[0], &li382[0], &li383[0], &li384[0], &li385[0], &li386[0], - &li387[0], &li388[0], &li389[0], &li390[0], &li391[0], &li392[0], &li393[0], &li394[0], &li395[0], - &li396[0], &li397[0], &li398[0], &li399[0], - }; + const LinInstr* li[] = { + &li000[0], &li001[0], &li002[0], &li003[0], &li004[0], &li005[0], &li006[0], &li007[0], &li008[0], &li009[0], + &li010[0], &li011[0], &li012[0], &li013[0], &li014[0], &li015[0], &li016[0], &li017[0], &li018[0], &li019[0], + &li020[0], &li021[0], &li022[0], &li023[0], &li024[0], &li025[0], &li026[0], &li027[0], &li028[0], &li029[0], + &li030[0], &li031[0], &li032[0], &li033[0], &li034[0], &li035[0], &li036[0], &li037[0], &li038[0], &li039[0], + &li040[0], &li041[0], &li042[0], &li043[0], &li044[0], &li045[0], &li046[0], &li047[0], &li048[0], &li049[0], + &li050[0], &li051[0], &li052[0], &li053[0], &li054[0], &li055[0], &li056[0], &li057[0], &li058[0], &li059[0], + &li060[0], &li061[0], &li062[0], &li063[0], &li064[0], &li065[0], &li066[0], &li067[0], &li068[0], &li069[0], + &li070[0], &li071[0], &li072[0], &li073[0], &li074[0], &li075[0], &li076[0], &li077[0], &li078[0], &li079[0], + &li080[0], &li081[0], &li082[0], &li083[0], &li084[0], &li085[0], &li086[0], &li087[0], &li088[0], &li089[0], + &li090[0], &li091[0], &li092[0], &li093[0], &li094[0], &li095[0], &li096[0], &li097[0], &li098[0], &li099[0], + &li100[0], &li101[0], &li102[0], &li103[0], &li104[0], &li105[0], &li106[0], &li107[0], &li108[0], &li109[0], + &li110[0], &li111[0], &li112[0], &li113[0], &li114[0], &li115[0], &li116[0], &li117[0], &li118[0], &li119[0], + &li120[0], &li121[0], &li122[0], &li123[0], &li124[0], &li125[0], &li126[0], &li127[0], &li128[0], &li129[0], + &li130[0], &li131[0], &li132[0], &li133[0], &li134[0], &li135[0], &li136[0], &li137[0], &li138[0], &li139[0], + &li140[0], &li141[0], &li142[0], &li143[0], &li144[0], &li145[0], &li146[0], &li147[0], &li148[0], &li149[0], + &li150[0], &li151[0], &li152[0], &li153[0], &li154[0], &li155[0], &li156[0], &li157[0], &li158[0], &li159[0], + &li160[0], &li161[0], &li162[0], &li163[0], &li164[0], &li165[0], &li166[0], &li167[0], &li168[0], &li169[0], + &li170[0], &li171[0], &li172[0], &li173[0], &li174[0], &li175[0], &li176[0], &li177[0], &li178[0], &li179[0], + &li180[0], &li181[0], &li182[0], &li183[0], &li184[0], &li185[0], &li186[0], &li187[0], &li188[0], &li189[0], + &li190[0], &li191[0], &li192[0], &li193[0], &li194[0], &li195[0], &li196[0], &li197[0], &li198[0], &li199[0], + &li200[0], &li201[0], &li202[0], &li203[0], &li204[0], &li205[0], &li206[0], &li207[0], &li208[0], &li209[0], + &li210[0], &li211[0], &li212[0], &li213[0], &li214[0], &li215[0], &li216[0], &li217[0], &li218[0], &li219[0], + &li220[0], &li221[0], &li222[0], &li223[0], &li224[0], &li225[0], &li226[0], &li227[0], &li228[0], &li229[0], + &li230[0], &li231[0], &li232[0], &li233[0], &li234[0], &li235[0], &li236[0], &li237[0], &li238[0], &li239[0], + &li240[0], &li241[0], &li242[0], &li243[0], &li244[0], &li245[0], &li246[0], &li247[0], &li248[0], &li249[0], + &li250[0], &li251[0], &li252[0], &li253[0], &li254[0], &li255[0], &li256[0], &li257[0], &li258[0], &li259[0], + &li260[0], &li261[0], &li262[0], &li263[0], &li264[0], &li265[0], &li266[0], &li267[0], &li268[0], &li269[0], + &li270[0], &li271[0], &li272[0], &li273[0], &li274[0], &li275[0], &li276[0], &li277[0], &li278[0], &li279[0], + &li280[0], &li281[0], &li282[0], &li283[0], &li284[0], &li285[0], &li286[0], &li287[0], &li288[0], &li289[0], + &li290[0], &li291[0], &li292[0], &li293[0], &li294[0], &li295[0], &li296[0], &li297[0], &li298[0], &li299[0], + &li300[0], &li301[0], &li302[0], &li303[0], &li304[0], &li305[0], &li306[0], &li307[0], &li308[0], &li309[0], + &li310[0], &li311[0], &li312[0], &li313[0], &li314[0], &li315[0], &li316[0], &li317[0], &li318[0], &li319[0], + &li320[0], &li321[0], &li322[0], &li323[0], &li324[0], &li325[0], &li326[0], &li327[0], &li328[0], &li329[0], + &li330[0], &li331[0], &li332[0], &li333[0], &li334[0], &li335[0], &li336[0], &li337[0], &li338[0], &li339[0], + &li340[0], &li341[0], &li342[0], &li343[0], &li344[0], &li345[0], &li346[0], &li347[0], &li348[0], &li349[0], + &li350[0], &li351[0], &li352[0], &li353[0], &li354[0], &li355[0], &li356[0], &li357[0], &li358[0], &li359[0], + &li360[0], &li361[0], &li362[0], &li363[0], &li364[0], &li365[0], &li366[0], &li367[0], &li368[0], &li369[0], + &li370[0], &li371[0], &li372[0], &li373[0], &li374[0], &li375[0], &li376[0], &li377[0], &li378[0], &li379[0], + &li380[0], &li381[0], &li382[0], &li383[0], &li384[0], &li385[0], &li386[0], &li387[0], &li388[0], &li389[0], + &li390[0], &li391[0], &li392[0], &li393[0], &li394[0], &li395[0], &li396[0], &li397[0], &li398[0], &li399[0], + }; - /// Space with an integer and a Boolean variable for sums without terms - class EmptyFixture : public Gecode::Space { - public: - /// Right-hand side variable - Gecode::IntVar y; - /// Reification variable - Gecode::BoolVar b; - /// Create fixture - EmptyFixture(void) : y(*this, -2, 2), b(*this, 0, 1) {} - /// Constructor for cloning \a fixture - EmptyFixture(EmptyFixture& fixture) : Gecode::Space(fixture) { - y.update(*this, fixture.y); - b.update(*this, fixture.b); - } - /// Copy during cloning - Gecode::Space* - copy(void) override { - return new EmptyFixture(*this); - } - }; + /// Space with an integer and a Boolean variable for sums without terms + class EmptyFixture : public Gecode::Space { + public: + /// Right-hand side variable + Gecode::IntVar y; + /// Reification variable + Gecode::BoolVar b; + /// Create fixture + EmptyFixture() : y(*this, -2, 2), b(*this, 0, 1) {} + /// Constructor for cloning \a fixture + EmptyFixture(EmptyFixture& fixture) : Gecode::Space(fixture) { + y.update(*this, fixture.y); + b.update(*this, fixture.b); + } + /// Copy during cloning + Gecode::Space* + copy() override { + return new EmptyFixture(*this); + } + }; - /// %Test linear relations over sums without variables - class LinRelEmpty : public Base { - public: - /// Create and register test - LinRelEmpty(void) : Base("Int::MiniModel::LinRel::Empty") {} - /// Perform test - bool - run(void) override { - using namespace Gecode; - IntVarArgs x; - BoolVarArgs bx; - IntArgs a; - EmptyFixture eq, gr, bool_eq, constant, reified; - rel(eq, sum(x) == 0); - rel(gr, sum(a, x) > 0); - rel(bool_eq, sum(bx) == 1); - rel(constant, sum(a) == 0); - rel(reified, (sum(x) == 1) == reified.b); - return (eq.status() == SS_SOLVED) && (gr.status() == SS_FAILED) && (bool_eq.status() == SS_FAILED) && - (constant.status() == SS_SOLVED) && (reified.status() == SS_SOLVED) && reified.b.assigned() && - (reified.b.val() == 0); - } - }; - LinRelEmpty lin_rel_empty; + /// %Test linear relations over sums without variables + class LinRelEmpty : public Base { + public: + /// Create and register test + LinRelEmpty() : Base("Int::MiniModel::LinRel::Empty") {} + /// Perform test + bool + run() override { + using namespace Gecode; + IntVarArgs x; + BoolVarArgs bx; + IntArgs a; + EmptyFixture eq, gr, bool_eq, constant, reified; + rel(eq, sum(x) == 0); + rel(gr, sum(a, x) > 0); + rel(bool_eq, sum(bx) == 1); + rel(constant, sum(a) == 0); + rel(reified, (sum(x) == 1) == reified.b); + return (eq.status() == SS_SOLVED) && (gr.status() == SS_FAILED) && (bool_eq.status() == SS_FAILED) && + (constant.status() == SS_SOLVED) && (reified.status() == SS_SOLVED) && reified.b.assigned() && + (reified.b.val() == 0); + } + }; + LinRelEmpty lin_rel_empty; - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - int n = sizeof(li) / sizeof(LinInstr*); - for (int i = 0; i < n; i++) { - std::string s = Test::str(i); - if (i < 10) { - s.insert(0, "00"); - } else if (i < 100) { - s.insert(0, "0"); - } - (void)new LinExprInt(li[i], s); - TestTags bool_tags = (i == 352) ? TestTags::check() : TestTags(TestTags::sweep()); - (void)new LinExprBool(bool_tags, li[i], s); - (void)new LinExprMixed(li[i], s); + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + int n = sizeof(li) / sizeof(LinInstr*); + for (int i = 0; i < n; i++) { + std::string s = Test::str(i); + if (i < 10) { + s.insert(0, "00"); + } else if (i < 100) { + s.insert(0, "0"); } - IntRelTypes irts; - for (int i = 0; i < n / 2; i++) { - std::string s = Test::str(i); - if (i < 10) { - s.insert(0, "00"); - } else if (i < 100) { - s.insert(0, "0"); - } - (void)new LinRelInt(li[2 * i], li[2 * i + 1], irts.irt(), s); - (void)new LinRelBool(li[2 * i], li[2 * i + 1], irts.irt(), s); - (void)new LinRelMixed(li[2 * i], li[2 * i + 1], irts.irt(), s); - ++irts; - if (!irts()) - irts.reset(); + (void)new LinExprInt(li[i], s); + TestTags bool_tags = (i == 352) ? TestTags::check() : TestTags(TestTags::sweep()); + (void)new LinExprBool(bool_tags, li[i], s); + (void)new LinExprMixed(li[i], s); + } + IntRelTypes irts; + for (int i = 0; i < n / 2; i++) { + std::string s = Test::str(i); + if (i < 10) { + s.insert(0, "00"); + } else if (i < 100) { + s.insert(0, "0"); } + (void)new LinRelInt(li[2 * i], li[2 * i + 1], irts.irt(), s); + (void)new LinRelBool(li[2 * i], li[2 * i + 1], irts.irt(), s); + (void)new LinRelMixed(li[2 * i], li[2 * i + 1], irts.irt(), s); + ++irts; + if (!irts()) + irts.reset(); } - }; - - LinExprDefault lin_expr_default; - Create c; - //@} - } // namespace MiniModelLin + } + }; -}} // namespace Test::Int + LinExprDefault lin_expr_default; + Create c; + //@} +} // namespace Test::Int::MiniModelLin // STATISTICS: test-minimodel diff --git a/test/int/mm-rel.cpp b/test/int/mm-rel.cpp index c94149529f..54df898ccd 100644 --- a/test/int/mm-rel.cpp +++ b/test/int/mm-rel.cpp @@ -34,104 +34,100 @@ #include -namespace Test { namespace Int { +/// %Tests for minimal modelling constraints (simple relations) +namespace Test::Int::MiniModel { - /// %Tests for minimal modelling constraints (simple relations) - namespace MiniModel { + /** + * \defgroup TaskTestIntMiniModelRel Minimal modelling constraints (relation) + * \ingroup TaskTestInt + */ + //@{ + /// %Test for relation between arrays of integer variables + class IntLex : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; - /** - * \defgroup TaskTestIntMiniModelRel Minimal modelling constraints (relation) - * \ingroup TaskTestInt - */ - //@{ - /// %Test for relation between arrays of integer variables - class IntLex : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - IntLex(Gecode::IntRelType irt0) : Test("MiniModel::Lex::Int::" + str(irt0), 6, -2, 2), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() >> 1; - for (int i = 0; i < n; i++) - if (x[i] != x[n + i]) - return cmp(x[i], irt, x[n + i]); - return ((irt == Gecode::IRT_LQ) || (irt == Gecode::IRT_GQ) || (irt == Gecode::IRT_EQ)); - GECODE_NEVER; - return false; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - int n = x.size() >> 1; - IntVarArgs y(n); - IntVarArgs z(n); - for (int i = 0; i < n; i++) { - y[i] = x[i]; - z[i] = x[n + i]; - } - lex(home, y, irt, z); + public: + /// Create and register test + IntLex(Gecode::IntRelType irt0) : Test("MiniModel::Lex::Int::" + str(irt0), 6, -2, 2), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() >> 1; + for (int i = 0; i < n; i++) + if (x[i] != x[n + i]) + return cmp(x[i], irt, x[n + i]); + return ((irt == Gecode::IRT_LQ) || (irt == Gecode::IRT_GQ) || (irt == Gecode::IRT_EQ)); + GECODE_NEVER; + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + int n = x.size() >> 1; + IntVarArgs y(n); + IntVarArgs z(n); + for (int i = 0; i < n; i++) { + y[i] = x[i]; + z[i] = x[n + i]; } - }; + lex(home, y, irt, z); + } + }; - /// %Test for relation between arrays of Boolean variables - class BoolLex : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; + /// %Test for relation between arrays of Boolean variables + class BoolLex : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; - public: - /// Create and register test - BoolLex(Gecode::IntRelType irt0) : Test("MiniModel::Lex::Bool::" + str(irt0), 10, 0, 1), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() >> 1; - for (int i = 0; i < n; i++) - if (x[i] != x[n + i]) - return cmp(x[i], irt, x[n + i]); - return ((irt == Gecode::IRT_LQ) || (irt == Gecode::IRT_GQ) || (irt == Gecode::IRT_EQ)); - GECODE_NEVER; - return false; + public: + /// Create and register test + BoolLex(Gecode::IntRelType irt0) : Test("MiniModel::Lex::Bool::" + str(irt0), 10, 0, 1), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() >> 1; + for (int i = 0; i < n; i++) + if (x[i] != x[n + i]) + return cmp(x[i], irt, x[n + i]); + return ((irt == Gecode::IRT_LQ) || (irt == Gecode::IRT_GQ) || (irt == Gecode::IRT_EQ)); + GECODE_NEVER; + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + int n = x.size() >> 1; + BoolVarArgs y(n); + BoolVarArgs z(n); + for (int i = 0; i < n; i++) { + y[i] = channel(home, x[i]); + z[i] = channel(home, x[n + i]); } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - int n = x.size() >> 1; - BoolVarArgs y(n); - BoolVarArgs z(n); - for (int i = 0; i < n; i++) { - y[i] = channel(home, x[i]); - z[i] = channel(home, x[n + i]); - } - lex(home, y, irt, z); - } - }; + lex(home, y, irt, z); + } + }; - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - using namespace Gecode; - for (IntRelTypes irts; irts(); ++irts) { - (void)new IntLex(irts.irt()); - (void)new BoolLex(irts.irt()); - } + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + using namespace Gecode; + for (IntRelTypes irts; irts(); ++irts) { + (void)new IntLex(irts.irt()); + (void)new BoolLex(irts.irt()); } - }; - - Create c; - //@} + } + }; - } // namespace MiniModel + Create c; + //@} -}} // namespace Test::Int +} // namespace Test::Int::MiniModel // STATISTICS: test-minimodel diff --git a/test/int/no-overlap.cpp b/test/int/no-overlap.cpp index c902913828..69dcd3e17f 100644 --- a/test/int/no-overlap.cpp +++ b/test/int/no-overlap.cpp @@ -35,312 +35,307 @@ #include #include -namespace Test { namespace Int { +/// %Tests for no-overlap constraint +namespace Test::Int::NoOverlap { - /// %Tests for no-overlap constraint - namespace NoOverlap { + /** + * \defgroup TaskTestIntNoOverlap No-overlap constraints + * \ingroup TaskTestInt + */ + //@{ + /// %Test for no-overlap with integer dimensions (rectangles) + class Int2 : public Test { + protected: + /// Width + Gecode::IntArgs w; + /// Height + Gecode::IntArgs h; - /** - * \defgroup TaskTestIntNoOverlap No-overlap constraints - * \ingroup TaskTestInt - */ - //@{ - /// %Test for no-overlap with integer dimensions (rectangles) - class Int2 : public Test { - protected: - /// Width - Gecode::IntArgs w; - /// Height - Gecode::IntArgs h; - - public: - /// Create and register test with maximal coordinate value \a m - Int2(TestTags tags, int m, const Gecode::IntArgs& w0, const Gecode::IntArgs& h0) - : Test(tags, "NoOverlap::Int::2::" + str(m) + "::" + str(w0) + "::" + str(h0), 2 * w0.size(), 0, m - 1), - w(w0), h(h0) {} - /// %Test whether \a xy is solution - bool - solution(const Assignment& xy) const override { - int n = xy.size() / 2; - for (int i = 0; i < n; i++) { - int xi = xy[2 * i + 0], yi = xy[2 * i + 1]; - for (int j = i + 1; j < n; j++) { - int xj = xy[2 * j + 0], yj = xy[2 * j + 1]; - if (!((xi + w[i] <= xj) || (xj + w[j] <= xi) || (yi + h[i] <= yj) || (yj + h[j] <= yi))) - return false; - } + public: + /// Create and register test with maximal coordinate value \a m + Int2(TestTags tags, int m, const Gecode::IntArgs& w0, const Gecode::IntArgs& h0) + : Test(tags, "NoOverlap::Int::2::" + str(m) + "::" + str(w0) + "::" + str(h0), 2 * w0.size(), 0, m - 1), + w(w0), h(h0) {} + /// %Test whether \a xy is solution + bool + solution(const Assignment& xy) const override { + int n = xy.size() / 2; + for (int i = 0; i < n; i++) { + int xi = xy[2 * i + 0], yi = xy[2 * i + 1]; + for (int j = i + 1; j < n; j++) { + int xj = xy[2 * j + 0], yj = xy[2 * j + 1]; + if (!((xi + w[i] <= xj) || (xj + w[j] <= xi) || (yi + h[i] <= yj) || (yj + h[j] <= yi))) + return false; } - return true; } - /// Post constraint on \a xy - void - post(Gecode::Space& home, Gecode::IntVarArray& xy) override { - using namespace Gecode; - int n = xy.size() / 2; - IntVarArgs x(n), y(n); - for (int i = 0; i < n; i++) { - x[i] = xy[2 * i + 0]; - y[i] = xy[2 * i + 1]; - } - no_overlap(home, x, w, y, h); + return true; + } + /// Post constraint on \a xy + void + post(Gecode::Space& home, Gecode::IntVarArray& xy) override { + using namespace Gecode; + int n = xy.size() / 2; + IntVarArgs x(n), y(n); + for (int i = 0; i < n; i++) { + x[i] = xy[2 * i + 0]; + y[i] = xy[2 * i + 1]; } - }; - /// %Test for no-overlap with optional rectangles - class IntOpt2 : public Test { - protected: - /// Width - Gecode::IntArgs w; - /// Height - Gecode::IntArgs h; + no_overlap(home, x, w, y, h); + } + }; + /// %Test for no-overlap with optional rectangles + class IntOpt2 : public Test { + protected: + /// Width + Gecode::IntArgs w; + /// Height + Gecode::IntArgs h; - public: - /// Create and register test with maximal value \a m and \a n rectangles - IntOpt2(int m, const Gecode::IntArgs& w0, const Gecode::IntArgs& h0) - : Test(TestTags::sweep(), "NoOverlap::Int::Opt::2::" + str(m) + "::" + str(w0) + "::" + str(h0), - 3 * w0.size(), 0, m - 1), - w(w0), h(h0) {} - /// %Test whether \a xyo is solution - bool - solution(const Assignment& xyo) const override { - int n = xyo.size() / 3; - for (int i = 0; i < n; i++) { - int xi = xyo[3 * i + 0], yi = xyo[3 * i + 1]; - int oi = xyo[3 * i + 2]; - for (int j = i + 1; j < n; j++) { - int xj = xyo[3 * j + 0], yj = xyo[3 * j + 1]; - int oj = xyo[3 * j + 2]; - if ((oi > 0) && (oj > 0) && - !((xi + w[i] <= xj) || (xj + w[j] <= xi) || (yi + h[i] <= yj) || (yj + h[j] <= yi))) - return false; - } + public: + /// Create and register test with maximal value \a m and \a n rectangles + IntOpt2(int m, const Gecode::IntArgs& w0, const Gecode::IntArgs& h0) + : Test(TestTags::sweep(), "NoOverlap::Int::Opt::2::" + str(m) + "::" + str(w0) + "::" + str(h0), + 3 * w0.size(), 0, m - 1), + w(w0), h(h0) {} + /// %Test whether \a xyo is solution + bool + solution(const Assignment& xyo) const override { + int n = xyo.size() / 3; + for (int i = 0; i < n; i++) { + int xi = xyo[3 * i + 0], yi = xyo[3 * i + 1]; + int oi = xyo[3 * i + 2]; + for (int j = i + 1; j < n; j++) { + int xj = xyo[3 * j + 0], yj = xyo[3 * j + 1]; + int oj = xyo[3 * j + 2]; + if ((oi > 0) && (oj > 0) && + !((xi + w[i] <= xj) || (xj + w[j] <= xi) || (yi + h[i] <= yj) || (yj + h[j] <= yi))) + return false; } - return true; } - /// Post constraint on \a xwyho - void - post(Gecode::Space& home, Gecode::IntVarArray& xyo) override { - using namespace Gecode; - int n = xyo.size() / 3; - IntVarArgs x(n), y(n); - BoolVarArgs o(n); - for (int i = 0; i < n; i++) { - x[i] = xyo[3 * i + 0]; - y[i] = xyo[3 * i + 1]; - o[i] = expr(home, xyo[3 * i + 2] > 0); - } - no_overlap(home, x, w, y, h, o); + return true; + } + /// Post constraint on \a xwyho + void + post(Gecode::Space& home, Gecode::IntVarArray& xyo) override { + using namespace Gecode; + int n = xyo.size() / 3; + IntVarArgs x(n), y(n); + BoolVarArgs o(n); + for (int i = 0; i < n; i++) { + x[i] = xyo[3 * i + 0]; + y[i] = xyo[3 * i + 1]; + o[i] = expr(home, xyo[3 * i + 2] > 0); } - }; + no_overlap(home, x, w, y, h, o); + } + }; - /// %Test for no-overlap with variable dimensions (rectangles) - class Var2 : public Test { - public: - /// Create and register test with maximal value \a m and \a n rectangles - Var2(int m, int n) : Test(TestTags::sweep(), "NoOverlap::Var::2::" + str(m) + "::" + str(n), 4 * n, 0, m) {} - /// %Test whether \a xwyh is solution - bool - solution(const Assignment& xwyh) const override { - int n = xwyh.size() / 4; - for (int i = 0; i < n; i++) { - int xi = xwyh[4 * i + 0], yi = xwyh[4 * i + 2]; - int wi = xwyh[4 * i + 1], hi = xwyh[4 * i + 3]; - for (int j = i + 1; j < n; j++) { - int xj = xwyh[4 * j + 0], yj = xwyh[4 * j + 2]; - int wj = xwyh[4 * j + 1], hj = xwyh[4 * j + 3]; - if (!((xi + wi <= xj) || (xj + wj <= xi) || (yi + hi <= yj) || (yj + hj <= yi))) - return false; - } + /// %Test for no-overlap with variable dimensions (rectangles) + class Var2 : public Test { + public: + /// Create and register test with maximal value \a m and \a n rectangles + Var2(int m, int n) : Test(TestTags::sweep(), "NoOverlap::Var::2::" + str(m) + "::" + str(n), 4 * n, 0, m) {} + /// %Test whether \a xwyh is solution + bool + solution(const Assignment& xwyh) const override { + int n = xwyh.size() / 4; + for (int i = 0; i < n; i++) { + int xi = xwyh[4 * i + 0], yi = xwyh[4 * i + 2]; + int wi = xwyh[4 * i + 1], hi = xwyh[4 * i + 3]; + for (int j = i + 1; j < n; j++) { + int xj = xwyh[4 * j + 0], yj = xwyh[4 * j + 2]; + int wj = xwyh[4 * j + 1], hj = xwyh[4 * j + 3]; + if (!((xi + wi <= xj) || (xj + wj <= xi) || (yi + hi <= yj) || (yj + hj <= yi))) + return false; } - return true; } - /// Post constraint on \a xwyh - void - post(Gecode::Space& home, Gecode::IntVarArray& xwyh) override { - using namespace Gecode; - int n = xwyh.size() / 4; - IntVarArgs x0(n), w(n), x1(n), y0(n), h(n), y1(n); - for (int i = 0; i < n; i++) { - x0[i] = xwyh[4 * i + 0]; - w[i] = xwyh[4 * i + 1]; - x1[i] = expr(home, x0[i] + w[i]); - y0[i] = xwyh[4 * i + 2]; - h[i] = xwyh[4 * i + 3]; - y1[i] = expr(home, y0[i] + h[i]); - } - no_overlap(home, x0, w, x1, y0, h, y1); + return true; + } + /// Post constraint on \a xwyh + void + post(Gecode::Space& home, Gecode::IntVarArray& xwyh) override { + using namespace Gecode; + int n = xwyh.size() / 4; + IntVarArgs x0(n), w(n), x1(n), y0(n), h(n), y1(n); + for (int i = 0; i < n; i++) { + x0[i] = xwyh[4 * i + 0]; + w[i] = xwyh[4 * i + 1]; + x1[i] = expr(home, x0[i] + w[i]); + y0[i] = xwyh[4 * i + 2]; + h[i] = xwyh[4 * i + 3]; + y1[i] = expr(home, y0[i] + h[i]); } - }; + no_overlap(home, x0, w, x1, y0, h, y1); + } + }; - /// %Test for no-overlap with optional rectangles - class VarOpt2 : public Test { - public: - /// Create and register test with maximal value \a m and \a n rectangles - VarOpt2(int m, int n) - : Test(TestTags::sweep(), "NoOverlap::Var::Opt::2::" + str(m) + "::" + str(n), 5 * n, 0, m) { - test_fixpoint = false; - } - /// %Test whether \a xwyho is solution - bool - solution(const Assignment& xwyho) const override { - int n = xwyho.size() / 5; - for (int i = 0; i < n; i++) { - int xi = xwyho[5 * i + 0], yi = xwyho[5 * i + 2]; - int wi = xwyho[5 * i + 1], hi = xwyho[5 * i + 3]; - int oi = xwyho[5 * i + 4]; - for (int j = i + 1; j < n; j++) { - int xj = xwyho[5 * j + 0], yj = xwyho[5 * j + 2]; - int wj = xwyho[5 * j + 1], hj = xwyho[5 * j + 3]; - int oj = xwyho[5 * j + 4]; - if ((oi > 0) && (oj > 0) && - !((xi + wi <= xj) || (xj + wj <= xi) || (yi + hi <= yj) || (yj + hj <= yi))) - return false; - } + /// %Test for no-overlap with optional rectangles + class VarOpt2 : public Test { + public: + /// Create and register test with maximal value \a m and \a n rectangles + VarOpt2(int m, int n) + : Test(TestTags::sweep(), "NoOverlap::Var::Opt::2::" + str(m) + "::" + str(n), 5 * n, 0, m) { + test_fixpoint = false; + } + /// %Test whether \a xwyho is solution + bool + solution(const Assignment& xwyho) const override { + int n = xwyho.size() / 5; + for (int i = 0; i < n; i++) { + int xi = xwyho[5 * i + 0], yi = xwyho[5 * i + 2]; + int wi = xwyho[5 * i + 1], hi = xwyho[5 * i + 3]; + int oi = xwyho[5 * i + 4]; + for (int j = i + 1; j < n; j++) { + int xj = xwyho[5 * j + 0], yj = xwyho[5 * j + 2]; + int wj = xwyho[5 * j + 1], hj = xwyho[5 * j + 3]; + int oj = xwyho[5 * j + 4]; + if ((oi > 0) && (oj > 0) && + !((xi + wi <= xj) || (xj + wj <= xi) || (yi + hi <= yj) || (yj + hj <= yi))) + return false; } - return true; } - /// Post constraint on \a xwyho - void - post(Gecode::Space& home, Gecode::IntVarArray& xwyho) override { - using namespace Gecode; - int n = xwyho.size() / 5; - IntVarArgs x0(n), w(n), x1(n), y0(n), h(n), y1(n); - BoolVarArgs o(n); - for (int i = 0; i < n; i++) { - x0[i] = xwyho[5 * i + 0]; - w[i] = xwyho[5 * i + 1]; - x1[i] = expr(home, x0[i] + w[i]); - y0[i] = xwyho[5 * i + 2]; - h[i] = xwyho[5 * i + 3]; - y1[i] = expr(home, y0[i] + h[i]); - o[i] = expr(home, xwyho[5 * i + 4] > 0); - } - no_overlap(home, x0, w, x1, y0, h, y1, o); + return true; + } + /// Post constraint on \a xwyho + void + post(Gecode::Space& home, Gecode::IntVarArray& xwyho) override { + using namespace Gecode; + int n = xwyho.size() / 5; + IntVarArgs x0(n), w(n), x1(n), y0(n), h(n), y1(n); + BoolVarArgs o(n); + for (int i = 0; i < n; i++) { + x0[i] = xwyho[5 * i + 0]; + w[i] = xwyho[5 * i + 1]; + x1[i] = expr(home, x0[i] + w[i]); + y0[i] = xwyho[5 * i + 2]; + h[i] = xwyho[5 * i + 3]; + y1[i] = expr(home, y0[i] + h[i]); + o[i] = expr(home, xwyho[5 * i + 4] > 0); } - }; + no_overlap(home, x0, w, x1, y0, h, y1, o); + } + }; - /// %Test for no-overlap with optional rectangles and shared variables - class VarOptShared2 : public Test { - public: - /// Create and register test with maximal value \a m and \a n rectangles - VarOptShared2(int m, int n) - : Test(TestTags::sweep(), "NoOverlap::Var::Opt::Shared::2::" + str(m) + "::" + str(n), 2 * n + 2, 0, - m) { - test_fixpoint = false; - } - /// %Test whether \a xwyho is solution - bool - solution(const Assignment& xwyho) const override { - int n = (xwyho.size() - 2) / 2; - for (int i = 0; i < n; i++) { - int xi = xwyho[2 * i + 0], yi = xwyho[2 * i + 0]; - int wi = xwyho[2 * i + 1], hi = xwyho[2 * i + 1]; - int oi = xwyho[2 * n + (i % 2)]; - for (int j = i + 1; j < n; j++) { - int xj = xwyho[2 * j + 0], yj = xwyho[2 * j + 0]; - int wj = xwyho[2 * j + 1], hj = xwyho[2 * j + 1]; - int oj = xwyho[2 * n + (j % 2)]; - if ((oi > 0) && (oj > 0) && - !((xi + wi <= xj) || (xj + wj <= xi) || (yi + hi <= yj) || (yj + hj <= yi))) - return false; - } + /// %Test for no-overlap with optional rectangles and shared variables + class VarOptShared2 : public Test { + public: + /// Create and register test with maximal value \a m and \a n rectangles + VarOptShared2(int m, int n) + : Test(TestTags::sweep(), "NoOverlap::Var::Opt::Shared::2::" + str(m) + "::" + str(n), 2 * n + 2, 0, m) { + test_fixpoint = false; + } + /// %Test whether \a xwyho is solution + bool + solution(const Assignment& xwyho) const override { + int n = (xwyho.size() - 2) / 2; + for (int i = 0; i < n; i++) { + int xi = xwyho[2 * i + 0], yi = xwyho[2 * i + 0]; + int wi = xwyho[2 * i + 1], hi = xwyho[2 * i + 1]; + int oi = xwyho[2 * n + (i % 2)]; + for (int j = i + 1; j < n; j++) { + int xj = xwyho[2 * j + 0], yj = xwyho[2 * j + 0]; + int wj = xwyho[2 * j + 1], hj = xwyho[2 * j + 1]; + int oj = xwyho[2 * n + (j % 2)]; + if ((oi > 0) && (oj > 0) && + !((xi + wi <= xj) || (xj + wj <= xi) || (yi + hi <= yj) || (yj + hj <= yi))) + return false; } - return true; } - /// Post constraint on \a xwyho - void - post(Gecode::Space& home, Gecode::IntVarArray& xwyho) override { - using namespace Gecode; - int n = (xwyho.size() - 2) / 2; - IntVarArgs x0(n), w(n), x1(n), y0(n), h(n), y1(n); - BoolVarArgs o(n); - for (int i = 0; i < n; i++) { - x0[i] = xwyho[2 * i + 0]; - w[i] = xwyho[2 * i + 1]; - x1[i] = expr(home, x0[i] + w[i]); - y0[i] = xwyho[2 * i + 0]; - h[i] = xwyho[2 * i + 1]; - y1[i] = expr(home, y0[i] + h[i]); - o[i] = expr(home, xwyho[2 * n + (i % 2)] > 0); - } - no_overlap(home, x0, w, x1, y0, h, y1, o); + return true; + } + /// Post constraint on \a xwyho + void + post(Gecode::Space& home, Gecode::IntVarArray& xwyho) override { + using namespace Gecode; + int n = (xwyho.size() - 2) / 2; + IntVarArgs x0(n), w(n), x1(n), y0(n), h(n), y1(n); + BoolVarArgs o(n); + for (int i = 0; i < n; i++) { + x0[i] = xwyho[2 * i + 0]; + w[i] = xwyho[2 * i + 1]; + x1[i] = expr(home, x0[i] + w[i]); + y0[i] = xwyho[2 * i + 0]; + h[i] = xwyho[2 * i + 1]; + y1[i] = expr(home, y0[i] + h[i]); + o[i] = expr(home, xwyho[2 * n + (i % 2)] > 0); } - }; - - /// %Test that every no-overlap overload posts nothing for zero boxes - class Empty : public Base { - private: - /// Space without variables - class Fixture : public Gecode::Space { - public: - Fixture(void) = default; - // NOLINTNEXTLINE(modernize-use-equals-default) - Fixture(Fixture& fixture) : Gecode::Space(fixture) {} - Gecode::Space* - copy(void) override { - return new Fixture(*this); - } - }; + no_overlap(home, x0, w, x1, y0, h, y1, o); + } + }; + /// %Test that every no-overlap overload posts nothing for zero boxes + class Empty : public Base { + private: + /// Space without variables + class Fixture : public Gecode::Space { public: - Empty(void) : Base("Int::NoOverlap::Empty") {} - bool - run(void) override { - using namespace Gecode; - IntVarArgs x; - IntArgs w; - BoolVarArgs m; - Fixture fix, fix_opt, var, var_opt; - no_overlap(fix, x, w, x, w); - no_overlap(fix_opt, x, w, x, w, m); - no_overlap(var, x, x, x, x, x, x); - no_overlap(var_opt, x, x, x, x, x, x, m); - return (fix.status() == SS_SOLVED) && (fix_opt.status() == SS_SOLVED) && (var.status() == SS_SOLVED) && - (var_opt.status() == SS_SOLVED); + Fixture() = default; + // NOLINTNEXTLINE(modernize-use-equals-default) + Fixture(Fixture& fixture) : Gecode::Space(fixture) {} + Gecode::Space* + copy() override { + return new Fixture(*this); } }; - Empty empty; + public: + Empty() : Base("Int::NoOverlap::Empty") {} + bool + run() override { + using namespace Gecode; + IntVarArgs x; + IntArgs w; + BoolVarArgs m; + Fixture fix, fix_opt, var, var_opt; + no_overlap(fix, x, w, x, w); + no_overlap(fix_opt, x, w, x, w, m); + no_overlap(var, x, x, x, x, x, x); + no_overlap(var_opt, x, x, x, x, x, x, m); + return (fix.status() == SS_SOLVED) && (fix_opt.status() == SS_SOLVED) && (var.status() == SS_SOLVED) && + (var_opt.status() == SS_SOLVED); + } + }; - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - using namespace Gecode; + Empty empty; - IntArgs s1({2, 1, 1}); - IntArgs s2({1, 2, 3, 4}); - IntArgs s3({4, 3, 2, 1}); - IntArgs s4({1, 1, 1, 1}); + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + using namespace Gecode; - for (int m = 2; m < 3; m++) { - (void)new Int2(TestTags::sweep(), m, s1, s1); - (void)new Int2(TestTags::sweep(), m, s2, s2); - (void)new Int2(TestTags::sweep(), m, s3, s3); - (void)new Int2(TestTags::sweep(), m, s2, s3); - (void)new Int2(TestTags::standard(), m, s4, s4); - (void)new Int2(TestTags::sweep(), m, s4, s2); - (void)new IntOpt2(m, s2, s3); - (void)new IntOpt2(m, s4, s3); - } + IntArgs s1({2, 1, 1}); + IntArgs s2({1, 2, 3, 4}); + IntArgs s3({4, 3, 2, 1}); + IntArgs s4({1, 1, 1, 1}); - (void)new Var2(2, 2); - (void)new Var2(3, 2); - (void)new Var2(1, 3); - (void)new VarOpt2(2, 2); - (void)new VarOpt2(3, 2); - (void)new VarOptShared2(2, 2); - (void)new VarOptShared2(3, 2); - (void)new VarOptShared2(4, 2); + for (int m = 2; m < 3; m++) { + (void)new Int2(TestTags::sweep(), m, s1, s1); + (void)new Int2(TestTags::sweep(), m, s2, s2); + (void)new Int2(TestTags::sweep(), m, s3, s3); + (void)new Int2(TestTags::sweep(), m, s2, s3); + (void)new Int2(TestTags::standard(), m, s4, s4); + (void)new Int2(TestTags::sweep(), m, s4, s2); + (void)new IntOpt2(m, s2, s3); + (void)new IntOpt2(m, s4, s3); } - }; - Create c; + (void)new Var2(2, 2); + (void)new Var2(3, 2); + (void)new Var2(1, 3); + (void)new VarOpt2(2, 2); + (void)new VarOpt2(3, 2); + (void)new VarOptShared2(2, 2); + (void)new VarOptShared2(3, 2); + (void)new VarOptShared2(4, 2); + } + }; - //@} + Create c; - } // namespace NoOverlap + //@} -}} // namespace Test::Int +} // namespace Test::Int::NoOverlap // STATISTICS: test-int diff --git a/test/int/nvalues.cpp b/test/int/nvalues.cpp index bd9f509c08..c24d2186e7 100644 --- a/test/int/nvalues.cpp +++ b/test/int/nvalues.cpp @@ -33,219 +33,212 @@ #include #include "test/int.hh" -namespace Test { namespace Int { +/// %Tests for number of values constraints +namespace Test::Int::NValues { - /// %Tests for number of values constraints - namespace NValues { + /** + * \defgroup TaskTestIntNValues Number of values constraints + * \ingroup TaskTestInt + */ + //@{ + /// %Test number of values of integer variables equal to integer + class IntInt : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + /// Number of values + int m; - /** - * \defgroup TaskTestIntNValues Number of values constraints - * \ingroup TaskTestInt - */ - //@{ - /// %Test number of values of integer variables equal to integer - class IntInt : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - /// Number of values - int m; - - public: - /// Create and register test - IntInt(TestTags tags, int n, int m0, Gecode::IntRelType irt0) - : Test(tags, "NValues::Int::Int::" + str(irt0) + "::" + str(n) + "::" + str(m0), n, 0, n), irt(irt0), - m(m0) { - test_fixpoint = false; - if (arity > 5) - test_search = false; - } - /// Create and register initial assignment - Assignment* - assignment(void) const override { - if (arity > 5) - return new RandomAssignment(arity, dom, 500, _rand); - else - return new CpltAssignment(arity, dom); - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size(); - bool* v = new bool[n + 1]; - for (int i = n + 1; i--;) - v[i] = false; - int k = 0; - for (int i = n; i--;) - if (!v[x[i]]) { - k++; - v[x[i]] = true; - } - delete[] v; - return cmp(k, irt, m); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::nvalues(home, x, irt, m); - } - }; + public: + /// Create and register test + IntInt(TestTags tags, int n, int m0, Gecode::IntRelType irt0) + : Test(tags, "NValues::Int::Int::" + str(irt0) + "::" + str(n) + "::" + str(m0), n, 0, n), irt(irt0), + m(m0) { + test_fixpoint = false; + if (arity > 5) + test_search = false; + } + /// Create and register initial assignment + Assignment* + assignment() const override { + if (arity > 5) + return new RandomAssignment(arity, dom, 500, _rand); + return new CpltAssignment(arity, dom); + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size(); + bool* v = new bool[n + 1]; + for (int i = n + 1; i--;) + v[i] = false; + int k = 0; + for (int i = n; i--;) + if (!v[x[i]]) { + k++; + v[x[i]] = true; + } + delete[] v; + return cmp(k, irt, m); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::nvalues(home, x, irt, m); + } + }; - /// %Test number of values of integer variables equal to integer variable - class IntVar : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; + /// %Test number of values of integer variables equal to integer variable + class IntVar : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; - public: - /// Create and register test - IntVar(TestTags tags, int n, Gecode::IntRelType irt0) - : Test(tags, "NValues::Int::Var::" + str(irt0) + "::" + str(n), n + 1, 0, n), irt(irt0) { - test_fixpoint = false; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() - 1; - bool* v = new bool[n + 1]; - for (int i = n + 1; i--;) - v[i] = false; - int k = 0; - for (int i = n; i--;) - if (!v[x[i]]) { - k++; - v[x[i]] = true; - } - delete[] v; - return cmp(k, irt, x[n]); - } - /// Post constraint on \a xy - void - post(Gecode::Space& home, Gecode::IntVarArray& xy) override { - int n = xy.size() - 1; - Gecode::IntVarArgs x(n); - for (int i = n; i--;) - x[i] = xy[i]; - Gecode::nvalues(home, x, irt, xy[n]); - } - }; + public: + /// Create and register test + IntVar(TestTags tags, int n, Gecode::IntRelType irt0) + : Test(tags, "NValues::Int::Var::" + str(irt0) + "::" + str(n), n + 1, 0, n), irt(irt0) { + test_fixpoint = false; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() - 1; + bool* v = new bool[n + 1]; + for (int i = n + 1; i--;) + v[i] = false; + int k = 0; + for (int i = n; i--;) + if (!v[x[i]]) { + k++; + v[x[i]] = true; + } + delete[] v; + return cmp(k, irt, x[n]); + } + /// Post constraint on \a xy + void + post(Gecode::Space& home, Gecode::IntVarArray& xy) override { + int n = xy.size() - 1; + Gecode::IntVarArgs x(n); + for (int i = n; i--;) + x[i] = xy[i]; + Gecode::nvalues(home, x, irt, xy[n]); + } + }; - /// %Test number of values of Boolean variables equal to integer - class BoolInt : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - /// Number of values - int m; + /// %Test number of values of Boolean variables equal to integer + class BoolInt : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + /// Number of values + int m; - public: - /// Create and register test - BoolInt(int n, int m0, Gecode::IntRelType irt0) - : Test("NValues::Bool::Int::" + str(irt0) + "::" + str(n) + "::" + str(m0), n, 0, 2), irt(irt0), m(m0) { - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size(); - for (int i = n; i--;) - if (x[i] > 1) - return false; - bool* v = new bool[n + 1]; - for (int i = n + 1; i--;) - v[i] = false; - int k = 0; - for (int i = n; i--;) - if (!v[x[i]]) { - k++; - v[x[i]] = true; - } - delete[] v; - return cmp(k, irt, m); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - BoolVarArgs y(x.size()); - for (int i = x.size(); i--;) - y[i] = channel(home, x[i]); - nvalues(home, y, irt, m); - } - }; + public: + /// Create and register test + BoolInt(int n, int m0, Gecode::IntRelType irt0) + : Test("NValues::Bool::Int::" + str(irt0) + "::" + str(n) + "::" + str(m0), n, 0, 2), irt(irt0), m(m0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size(); + for (int i = n; i--;) + if (x[i] > 1) + return false; + bool* v = new bool[n + 1]; + for (int i = n + 1; i--;) + v[i] = false; + int k = 0; + for (int i = n; i--;) + if (!v[x[i]]) { + k++; + v[x[i]] = true; + } + delete[] v; + return cmp(k, irt, m); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + BoolVarArgs y(x.size()); + for (int i = x.size(); i--;) + y[i] = channel(home, x[i]); + nvalues(home, y, irt, m); + } + }; - /// %Test number of values of Boolean variables equal to integer variable - class BoolVar : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; + /// %Test number of values of Boolean variables equal to integer variable + class BoolVar : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; - public: - /// Create and register test - BoolVar(int n, Gecode::IntRelType irt0) - : Test("NValues::Bool::Var::" + str(irt0) + "::" + str(n), n + 1, 0, 2), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() - 1; - for (int i = n; i--;) - if (x[i] > 1) - return false; - bool* v = new bool[n + 1]; - for (int i = n + 1; i--;) - v[i] = false; - int k = 0; - for (int i = n; i--;) - if (!v[x[i]]) { - k++; - v[x[i]] = true; - } - delete[] v; - return cmp(k, irt, x[n]); - } - /// Post constraint on \a xy - void - post(Gecode::Space& home, Gecode::IntVarArray& xy) override { - using namespace Gecode; - int n = xy.size() - 1; - BoolVarArgs x(n); - for (int i = n; i--;) - x[i] = channel(home, xy[i]); - nvalues(home, x, irt, xy[n]); - } - }; + public: + /// Create and register test + BoolVar(int n, Gecode::IntRelType irt0) + : Test("NValues::Bool::Var::" + str(irt0) + "::" + str(n), n + 1, 0, 2), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() - 1; + for (int i = n; i--;) + if (x[i] > 1) + return false; + bool* v = new bool[n + 1]; + for (int i = n + 1; i--;) + v[i] = false; + int k = 0; + for (int i = n; i--;) + if (!v[x[i]]) { + k++; + v[x[i]] = true; + } + delete[] v; + return cmp(k, irt, x[n]); + } + /// Post constraint on \a xy + void + post(Gecode::Space& home, Gecode::IntVarArray& xy) override { + using namespace Gecode; + int n = xy.size() - 1; + BoolVarArgs x(n); + for (int i = n; i--;) + x[i] = channel(home, xy[i]); + nvalues(home, x, irt, xy[n]); + } + }; - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - for (IntRelTypes irts; irts(); ++irts) { - for (int i = 1; i <= 7; i += 3) { - for (int m = 0; m <= 3; m++) - (void)new BoolInt(i, m, irts.irt()); - (void)new BoolVar(i, irts.irt()); + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + for (IntRelTypes irts; irts(); ++irts) { + for (int i = 1; i <= 7; i += 3) { + for (int m = 0; m <= 3; m++) + (void)new BoolInt(i, m, irts.irt()); + (void)new BoolVar(i, irts.irt()); + } + for (int i = 1; i <= 7; i += 2) { + for (int m = 0; m <= i + 1; m++) { + TestTags tags = ((i == 3) && (m == 2) && (irts.irt() == Gecode::IRT_EQ)) ? TestTags::standard() + : TestTags::sweep(); + (void)new IntInt(tags, i, m, irts.irt()); } - for (int i = 1; i <= 7; i += 2) { - for (int m = 0; m <= i + 1; m++) { - TestTags tags = ((i == 3) && (m == 2) && (irts.irt() == Gecode::IRT_EQ)) - ? TestTags::standard() - : TestTags::sweep(); - (void)new IntInt(tags, i, m, irts.irt()); - } - if (i <= 5) { - TestTags tags = - ((i == 3) && (irts.irt() == Gecode::IRT_EQ)) ? TestTags::standard() : TestTags::sweep(); - (void)new IntVar(tags, i, irts.irt()); - } + if (i <= 5) { + TestTags tags = + ((i == 3) && (irts.irt() == Gecode::IRT_EQ)) ? TestTags::standard() : TestTags::sweep(); + (void)new IntVar(tags, i, irts.irt()); } } } - }; - - Create c; - //@} + } + }; - } // namespace NValues -}} // namespace Test::Int + Create c; + //@} +} // namespace Test::Int::NValues // STATISTICS: test-int diff --git a/test/int/open-var-list.cpp b/test/int/open-var-list.cpp index 749773c867..16d324f16f 100644 --- a/test/int/open-var-list.cpp +++ b/test/int/open-var-list.cpp @@ -45,22 +45,23 @@ #include #include +#include -namespace Test { namespace Int { namespace OpenList { +namespace Test::Int::OpenList { /// Space used by open list materialization tests class OpenListSpace : public Gecode::Space { public: Gecode::OpenIntVarList list; - OpenListSpace(void) : list(*this, [](int i) { return Gecode::IntSet(i, i); }, 6) {} + OpenListSpace() : list(*this, [](int i) { return Gecode::IntSet(i, i); }, 6) {} OpenListSpace(OpenListSpace& s) : Gecode::Space(s) { list.update(*this, s.list); } Gecode::Space* - copy(void) override { + copy() override { return new OpenListSpace(*this); } }; @@ -68,10 +69,10 @@ namespace Test { namespace Int { namespace OpenList { /// Test automatic and explicit list materialization class OpenListMaterialize : public ::Test::Base { public: - OpenListMaterialize(void) : ::Test::Base("Int::OpenList::Materialize", TestTags::check()) {} + OpenListMaterialize() : ::Test::Base("Int::OpenList::Materialize", TestTags::check()) {} bool - run(void) override { + run() override { using namespace Gecode; OpenListSpace source; rel(source, source.list.length(), IRT_GQ, 3); @@ -120,7 +121,7 @@ namespace Test { namespace Int { namespace OpenList { } Gecode::Space* - copy(void) override { + copy() override { return new BranchOrderSpace(*this); } }; @@ -150,10 +151,10 @@ namespace Test { namespace Int { namespace OpenList { } public: - BranchOrder(void) : ::Test::Base("Int::OpenList::BranchOrder") {} + BranchOrder() : ::Test::Base("Int::OpenList::BranchOrder") {} bool - run(void) override { + run() override { using namespace Gecode; return check(BranchOrderSpace::Order::INCREMENTAL, 3) && check(BranchOrderSpace::Order::LENGTH_MIN, 1) && check(BranchOrderSpace::Order::LENGTH_MAX, 3); @@ -177,17 +178,17 @@ namespace Test { namespace Int { namespace OpenList { } Gecode::Space* - copy(void) override { + copy() override { return new SelectorSpace(*this); } }; class Selectors : public ::Test::Base { public: - Selectors(void) : ::Test::Base("Int::OpenList::Selectors") {} + Selectors() : ::Test::Base("Int::OpenList::Selectors") {} bool - run(void) override { + run() override { using namespace Gecode; const IntValBranch values[] = {INT_VAL_MIN(), INT_VAL_MAX(), @@ -229,10 +230,10 @@ namespace Test { namespace Int { namespace OpenList { class NoGoods : public ::Test::Base { public: - NoGoods(void) : ::Test::Base("Int::OpenList::NoGoods") {} + NoGoods() : ::Test::Base("Int::OpenList::NoGoods") {} bool - run(void) override { + run() override { using namespace Gecode; SelectorSpace root(INT_VAL_MIN()); root.list.materialize(root, 1); @@ -288,17 +289,17 @@ namespace Test { namespace Int { namespace OpenList { } Gecode::Space* - copy(void) override { + copy() override { return new SelectorChoiceSpace(*this); } }; class SelectorChoice : public ::Test::Base { public: - SelectorChoice(void) : ::Test::Base("Int::OpenList::SelectorChoice") {} + SelectorChoice() : ::Test::Base("Int::OpenList::SelectorChoice") {} bool - run(void) override { + run() override { using namespace Gecode; for (int multi = 0; multi < 2; multi++) { SelectorChoiceSpace source(multi ? INT_VALUES_MAX() : INT_VAL_MAX()); @@ -356,17 +357,17 @@ namespace Test { namespace Int { namespace OpenList { } Gecode::Space* - copy(void) override { + copy() override { return new BoolSpace(*this); } }; class BoolList : public ::Test::Base { public: - BoolList(void) : ::Test::Base("Int::OpenList::Bool", TestTags::check()) {} + BoolList() : ::Test::Base("Int::OpenList::Bool", TestTags::check()) {} bool - run(void) override { + run() override { using namespace Gecode; for (bool length_first : {false, true}) for (int recompute = 0; recompute < 2; recompute++) { @@ -402,14 +403,14 @@ namespace Test { namespace Int { namespace OpenList { public: Gecode::OpenVarList list; - AliasSpace(void) : list(*this, [](Gecode::Space& home, int) { return Var(home, 0, 1); }, 16) {} + AliasSpace() : list(*this, [](Gecode::Space& home, int) { return Var(home, 0, 1); }, 16) {} AliasSpace(AliasSpace& s) : Gecode::Space(s) { list.update(*this, s.list); } Gecode::Space* - copy(void) override { + copy() override { return new AliasSpace(*this); } @@ -429,7 +430,7 @@ namespace Test { namespace Int { namespace OpenList { protected: template static bool - check(void) { + check() { using namespace Gecode; AliasSpace source; Var assigned(source, 0, 0); @@ -455,10 +456,10 @@ namespace Test { namespace Int { namespace OpenList { } public: - Aliases(void) : ::Test::Base("Int::OpenList::Aliases", TestTags::check()) {} + Aliases() : ::Test::Base("Int::OpenList::Aliases", TestTags::check()) {} bool - run(void) override { + run() override { return check() && check(); } }; @@ -474,7 +475,7 @@ namespace Test { namespace Int { namespace OpenList { Gecode::OpenVarList floats; #endif - FactorySpace(void) { + FactorySpace() { using namespace Gecode; #ifdef GECODE_HAS_SET_VARS sets = OpenVarList( @@ -497,17 +498,17 @@ namespace Test { namespace Int { namespace OpenList { } Gecode::Space* - copy(void) override { + copy() override { return new FactorySpace(*this); } }; class Factory : public ::Test::Base { public: - Factory(void) : ::Test::Base("Int::OpenList::Factory", TestTags::check()) {} + Factory() : ::Test::Base("Int::OpenList::Factory", TestTags::check()) {} bool - run(void) override { + run() override { using namespace Gecode; FactorySpace source; if (source.status() == SS_FAILED) @@ -540,10 +541,10 @@ namespace Test { namespace Int { namespace OpenList { class FixedStatistics : public ::Test::Base { public: - FixedStatistics(void) : ::Test::Base("Int::OpenList::FixedStatistics") {} + FixedStatistics() : ::Test::Base("Int::OpenList::FixedStatistics") {} bool - run(void) override { + run() override { using namespace Gecode; for (int chb = 0; chb < 2; chb++) { SelectorSpace open(INT_VAL_MIN()); @@ -575,7 +576,7 @@ namespace Test { namespace Int { namespace OpenList { Gecode::OpenIntVarList ints; Gecode::OpenBoolVarList bools; - EmptyStatisticsSpace(void) : ints(*this, Gecode::IntSet(0, 1), 0), bools(*this, 0) {} + EmptyStatisticsSpace() : ints(*this, Gecode::IntSet(0, 1), 0), bools(*this, 0) {} EmptyStatisticsSpace(EmptyStatisticsSpace& s) : Gecode::Space(s) { ints.update(*this, s.ints); @@ -583,22 +584,22 @@ namespace Test { namespace Int { namespace OpenList { } unsigned int - propagators(void) { + propagators() { return Gecode::PropagatorGroup::all.size(*this); } Gecode::Space* - copy(void) override { + copy() override { return new EmptyStatisticsSpace(*this); } }; class EmptyStatistics : public ::Test::Base { public: - EmptyStatistics(void) : ::Test::Base("Int::OpenList::EmptyStatistics") {} + EmptyStatistics() : ::Test::Base("Int::OpenList::EmptyStatistics") {} bool - run(void) override { + run() override { using namespace Gecode; for (bool chb : {false, true}) { EmptyStatisticsSpace* root = new EmptyStatisticsSpace; @@ -635,7 +636,7 @@ namespace Test { namespace Int { namespace OpenList { public: Gecode::OpenIntVarList list; - TransitionSpace(void) + TransitionSpace() : list( *this, Gecode::IntSet(0, 4), [](Gecode::Space& home, Gecode::OpenIntVarList x, int i) { @@ -655,17 +656,17 @@ namespace Test { namespace Int { namespace OpenList { } Gecode::Space* - copy(void) override { + copy() override { return new TransitionSpace(*this); } }; class Transition : public ::Test::Base { public: - Transition(void) : ::Test::Base("Int::OpenList::Transition") {} + Transition() : ::Test::Base("Int::OpenList::Transition") {} bool - run(void) override { + run() override { using namespace Gecode; Search::Options options; options.threads = 1; @@ -698,7 +699,7 @@ namespace Test { namespace Int { namespace OpenList { Gecode::OpenViewList direct; Gecode::OpenViewList negative; - ViewSpace(void) : list(*this, Gecode::IntSet(0, 10), 5), direct(list), negative(list) {} + ViewSpace() : list(*this, Gecode::IntSet(0, 10), 5), direct(list), negative(list) {} ViewSpace(ViewSpace& s) : Gecode::Space(s) { list.update(*this, s.list); @@ -707,16 +708,16 @@ namespace Test { namespace Int { namespace OpenList { } Gecode::Space* - copy(void) override { + copy() override { return new ViewSpace(*this); } }; public: - Views(void) : ::Test::Base("Int::OpenList::Views", TestTags::check()) {} + Views() : ::Test::Base("Int::OpenList::Views", TestTags::check()) {} bool - run(void) override { + run() override { using namespace Gecode; ViewSpace source; Gecode::Int::IntView length = source.negative.length(); @@ -897,7 +898,7 @@ namespace Test { namespace Int { namespace OpenList { Gecode::IntVar minimum; Gecode::IntVar maximum; - BoundsSpace(void) : list(*this, Gecode::IntSet(0, 10), 5), minimum(*this, 0, 10), maximum(*this, 0, 10) { + BoundsSpace() : list(*this, Gecode::IntSet(0, 10), 5), minimum(*this, 0, 10), maximum(*this, 0, 10) { Gecode::min(*this, list, minimum); Gecode::max(*this, list, maximum); } @@ -907,16 +908,16 @@ namespace Test { namespace Int { namespace OpenList { maximum.update(*this, s.maximum); } Gecode::Space* - copy(void) override { + copy() override { return new BoundsSpace(*this); } }; public: - ExtremumBounds(void) : ::Test::Base("Int::OpenList::ExtremumBounds", TestTags::check()) {} + ExtremumBounds() : ::Test::Base("Int::OpenList::ExtremumBounds", TestTags::check()) {} bool - run(void) override { + run() override { using namespace Gecode; BoundsSpace source; source.list.materialize(source, 2); @@ -955,7 +956,7 @@ namespace Test { namespace Int { namespace OpenList { /// An empty list has no minimum class EmptyMinimum : public Test { public: - EmptyMinimum(void) : Test("OpenList::EmptyMinimum", 1, 0, 1) {} + EmptyMinimum() : Test("OpenList::EmptyMinimum", 1, 0, 1) {} bool solution(const Assignment&) const override { return false; @@ -970,10 +971,10 @@ namespace Test { namespace Int { namespace OpenList { class IncrementalConstraints : public ::Test::Base { public: - IncrementalConstraints(void) : ::Test::Base("Int::OpenList::IncrementalConstraints", TestTags::check()) {} + IncrementalConstraints() : ::Test::Base("Int::OpenList::IncrementalConstraints", TestTags::check()) {} bool - run(void) override { + run() override { using namespace Gecode; class IncrementalSpace : public Space { public: @@ -1015,7 +1016,7 @@ namespace Test { namespace Int { namespace OpenList { } Space* - copy(void) override { + copy() override { return new IncrementalSpace(*this); } }; @@ -1082,7 +1083,7 @@ namespace Test { namespace Int { namespace OpenList { } Gecode::Space* - copy(void) override { + copy() override { return new CallbackSpace(*this); } }; @@ -1093,18 +1094,18 @@ namespace Test { namespace Int { namespace OpenList { public: Gecode::Int::GrowableIntSet values; - SetSpace(void) = default; + SetSpace() = default; SetSpace(SetSpace& s) : Gecode::Space(s) { values.update(*this, s.values); } - ~SetSpace(void) override { + ~SetSpace() override { values.dispose(*this); } Gecode::Space* - copy(void) override { + copy() override { return new SetSpace(*this); } }; @@ -1140,10 +1141,10 @@ namespace Test { namespace Int { namespace OpenList { } public: - GrowableIntSet(void) : ::Test::Base("Int::OpenList::GrowableIntSet", TestTags::check()) {} + GrowableIntSet() : ::Test::Base("Int::OpenList::GrowableIntSet", TestTags::check()) {} bool - run(void) override { + run() override { using namespace Gecode; SetSpace source; std::set expected; @@ -1183,10 +1184,10 @@ namespace Test { namespace Int { namespace OpenList { /// Values assigned before list growth can trigger several pruning waves class DistinctWaves : public ::Test::Base { public: - DistinctWaves(void) : ::Test::Base("Int::OpenList::DistinctWaves", TestTags::check()) {} + DistinctWaves() : ::Test::Base("Int::OpenList::DistinctWaves", TestTags::check()) {} bool - run(void) override { + run() override { using namespace Gecode; CallbackSpace source([](int) { return IntSet(1, 4); }, [](Space&, OpenIntVarList, int) {}); distinct(source, source.list); @@ -1225,7 +1226,7 @@ namespace Test { namespace Int { namespace OpenList { } Gecode::Space* - copy(void) override { + copy() override { return new EmptyDistinctSpace(*this); } }; @@ -1233,10 +1234,10 @@ namespace Test { namespace Int { namespace OpenList { /// Distinct on a closed empty list posts nothing; an open one still grows class DistinctEmpty : public ::Test::Base { public: - DistinctEmpty(void) : ::Test::Base("Int::OpenList::DistinctEmpty") {} + DistinctEmpty() : ::Test::Base("Int::OpenList::DistinctEmpty") {} bool - run(void) override { + run() override { using namespace Gecode; for (IntPropLevel ipl : {IPL_DEF, IPL_DOM}) { EmptyDistinctSpace closed(0, ipl); @@ -1293,7 +1294,7 @@ namespace Test { namespace Int { namespace OpenList { } Gecode::Space* - copy(void) override { + copy() override { return new GroupSpace(*this); } }; @@ -1310,7 +1311,7 @@ namespace Test { namespace Int { namespace OpenList { kill(kill0) {} bool - run(void) override { + run() override { using namespace Gecode; for (int close = 0; close < 2; close++) { GroupSpace source(kind, close != 0); @@ -1344,13 +1345,13 @@ namespace Test { namespace Int { namespace OpenList { class Dispose : public ::Test::Base { public: - Dispose(void) : ::Test::Base("Int::OpenList::Dispose", TestTags::check()) {} + Dispose() : ::Test::Base("Int::OpenList::Dispose", TestTags::check()) {} bool - run(void) override { + run() override { using namespace Gecode; - std::shared_ptr domain(new int(0)); - std::shared_ptr transition(new int(0)); + std::shared_ptr domain = std::make_shared(0); + std::shared_ptr transition = std::make_shared(0); CallbackSpace* source = new CallbackSpace([domain](int) { return IntSet(0, 1); }, [transition](Space&, OpenIntVarList, int) {}); source->list.materialize(*source, 2); @@ -1370,10 +1371,10 @@ namespace Test { namespace Int { namespace OpenList { class CallbackLength : public ::Test::Base { public: - CallbackLength(void) : ::Test::Base("Int::OpenList::CallbackLength", TestTags::check()) {} + CallbackLength() : ::Test::Base("Int::OpenList::CallbackLength", TestTags::check()) {} bool - run(void) override { + run() override { using namespace Gecode; for (int assign = 0; assign < 2; assign++) for (int close = 0; close < 2; close++) { @@ -1414,10 +1415,10 @@ namespace Test { namespace Int { namespace OpenList { } public: - NoGPI(void) : ::Test::Base("Int::OpenList::NoGPI", TestTags::check()) {} + NoGPI() : ::Test::Base("Int::OpenList::NoGPI", TestTags::check()) {} bool - run(void) override { + run() override { using namespace Gecode; CallbackSpace home([](int) { return IntSet(0, 1); }, [](Space&, OpenIntVarList, int) {}); PropagatorGroup factory; @@ -1438,7 +1439,7 @@ namespace Test { namespace Int { namespace OpenList { [transition, selected](Space& home, OpenVarList list, int i) { post(home, transition); if (i == 3) - throw 1; + throw std::logic_error("Expected"); { Space::UseGPI use_gpi(home); post(home, selected); @@ -1467,7 +1468,7 @@ namespace Test { namespace Int { namespace OpenList { bool threw = false; try { list.append(home, IntVar(home, 0, 10)); - } catch (int) { + } catch (const std::logic_error&) { threw = true; } post(home, ordinary); @@ -1479,10 +1480,10 @@ namespace Test { namespace Int { namespace OpenList { class FailedGet : public ::Test::Base { public: - FailedGet(void) : ::Test::Base("Int::OpenList::FailedGet") {} + FailedGet() : ::Test::Base("Int::OpenList::FailedGet") {} bool - run(void) override { + run() override { using namespace Gecode; CallbackSpace source([](int) { return IntSet(0, 1); }, [](Space& home, OpenIntVarList, int) { home.fail(); }); @@ -1494,10 +1495,10 @@ namespace Test { namespace Int { namespace OpenList { /// A value commit must not construct positions required by pending propagation class ValueCommit : public ::Test::Base { public: - ValueCommit(void) : ::Test::Base("Int::OpenList::ValueCommit") {} + ValueCommit() : ::Test::Base("Int::OpenList::ValueCommit") {} bool - run(void) override { + run() override { using namespace Gecode; CallbackSpace source([](int) { return IntSet(0, 1); }, [](Space& home, OpenIntVarList, int i) { @@ -1527,10 +1528,10 @@ namespace Test { namespace Int { namespace OpenList { /// Replay value choices after propagation has extended the original list class ValueReplay : public ::Test::Base { public: - ValueReplay(void) : ::Test::Base("Int::OpenList::ValueReplay", TestTags::check()) {} + ValueReplay() : ::Test::Base("Int::OpenList::ValueReplay", TestTags::check()) {} bool - run(void) override { + run() override { using namespace Gecode; CallbackSpace source([](int) { return IntSet(0, 1); }, [](Space& home, OpenIntVarList list, int i) { @@ -1568,10 +1569,10 @@ namespace Test { namespace Int { namespace OpenList { /// Impossible window bounds still permit lists too short to contain a window class ImpossibleWindow : public ::Test::Base { public: - ImpossibleWindow(void) : ::Test::Base("Int::OpenList::ImpossibleWindow") {} + ImpossibleWindow() : ::Test::Base("Int::OpenList::ImpossibleWindow") {} bool - run(void) override { + run() override { using namespace Gecode; for (int sum = 0; sum < 2; sum++) for (int size = 0; size < 3; size++) { @@ -1609,7 +1610,7 @@ namespace Test { namespace Int { namespace OpenList { } Gecode::Space* - copy(void) override { + copy() override { return new PatternSpace(*this); } }; @@ -1617,10 +1618,10 @@ namespace Test { namespace Int { namespace OpenList { /// Compare complete solution sets with independently enumerated subsequences class PatternEnumeration : public ::Test::Base { public: - PatternEnumeration(void) : ::Test::Base("Int::OpenList::Pattern::Enumeration", TestTags::check()) {} + PatternEnumeration() : ::Test::Base("Int::OpenList::Pattern::Enumeration", TestTags::check()) {} bool - run(void) override { + run() override { using namespace Gecode; const PatternMining::Sequences inputs[] = { {{17, 1000000, 17}, {17, 1000000, 17}, {1000000, 17, 42}, {17, 42}}, {{1, 1}, {1, 2}, {2, 1}}}; @@ -1689,10 +1690,10 @@ namespace Test { namespace Int { namespace OpenList { /// Clones keep separate projections; later assignments wait for their prefix class PatternGrowth : public ::Test::Base { public: - PatternGrowth(void) : ::Test::Base("Int::OpenList::Pattern::Growth", TestTags::check()) {} + PatternGrowth() : ::Test::Base("Int::OpenList::Pattern::Growth", TestTags::check()) {} bool - run(void) override { + run() override { using namespace Gecode; const PatternMining::Database data({{1, 2, 1}, {1, 2, 2}, {1, 1, 2}}); PatternSpace source(data, 2); @@ -1743,10 +1744,10 @@ namespace Test { namespace Int { namespace OpenList { /// Input validation and exact rounding of percentage support class PatternInput : public ::Test::Base { public: - PatternInput(void) : ::Test::Base("Int::OpenList::Pattern::Input", TestTags::check()) {} + PatternInput() : ::Test::Base("Int::OpenList::Pattern::Input", TestTags::check()) {} bool - run(void) override { + run() override { using namespace PatternMining; std::istringstream rows("# comment\n17 -1 1000000 -1 -2\r\n" "17 -1 1000000 -1 -2\n"); @@ -1827,6 +1828,6 @@ namespace Test { namespace Int { namespace OpenList { EmptyMinimum empty_minimum; IncrementalConstraints incremental_constraints; -}}} // namespace Test::Int::OpenList +} // namespace Test::Int::OpenList // STATISTICS: test-int diff --git a/test/int/order.cpp b/test/int/order.cpp index efceb13cf2..a961d43fd7 100644 --- a/test/int/order.cpp +++ b/test/int/order.cpp @@ -33,55 +33,51 @@ #include #include "test/int.hh" -namespace Test { namespace Int { +/// %Tests for order constraint +namespace Test::Int::Order { - /// %Tests for order constraint - namespace Order { + /** + * \defgroup TaskTestIntOrder Order constraint + * \ingroup TaskTestInt + */ + //@{ + /// %Test order for integer variables + class Int : public Test { + protected: + /// Processing times + int p0, p1; - /** - * \defgroup TaskTestIntOrder Order constraint - * \ingroup TaskTestInt - */ - //@{ - /// %Test order for integer variables - class Int : public Test { - protected: - /// Processing times - int p0, p1; + public: + /// Create and register test + Int(int _p0, int _p1) : Test("Order::" + str(_p0) + "::" + str(_p1), 3, 0, 6), p0(_p0), p1(_p1) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int s0 = x[0], s1 = x[1], b = x[2]; + if (b > 1) + return false; + return ((s0 + p0 <= s1) && (b == 0)) || ((s1 + p1 <= s0) && (b == 1)); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + order(home, x[0], p0, x[1], p1, channel(home, x[2])); + } + }; + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + for (int i = 1; i <= 4; i++) + for (int j = 1; j <= 4; j++) + (void)new Int(i, j); + } + }; - public: - /// Create and register test - Int(int _p0, int _p1) : Test("Order::" + str(_p0) + "::" + str(_p1), 3, 0, 6), p0(_p0), p1(_p1) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int s0 = x[0], s1 = x[1], b = x[2]; - if (b > 1) - return false; - return ((s0 + p0 <= s1) && (b == 0)) || ((s1 + p1 <= s0) && (b == 1)); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - order(home, x[0], p0, x[1], p1, channel(home, x[2])); - } - }; - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - for (int i = 1; i <= 4; i++) - for (int j = 1; j <= 4; j++) - (void)new Int(i, j); - } - }; - - Create c; - //@} - - } // namespace Order -}} // namespace Test::Int + Create c; + //@} +} // namespace Test::Int::Order // STATISTICS: test-int diff --git a/test/int/precede.cpp b/test/int/precede.cpp index f55e6155e5..574929c047 100644 --- a/test/int/precede.cpp +++ b/test/int/precede.cpp @@ -36,78 +36,74 @@ #include "test/int.hh" -namespace Test { namespace Int { +/// %Tests for value precedence constraints +namespace Test::Int::Precede { - /// %Tests for value precedence constraints - namespace Precede { + /// %Test for single value precedence constraint + class Single : public Test { + private: + /// The values for precedence + int s, t; - /// %Test for single value precedence constraint - class Single : public Test { - private: - /// The values for precedence - int s, t; - - public: - /// Create and register test - Single(int s0, int t0) : Test("Precede::Single::" + str(s0) + "<" + str(t0), 8, 1, 4), s(s0), t(t0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size(); - for (int i = 0; i < n; i++) { - if (x[i] == t) - return false; - if (x[i] == s) - return true; - } - return true; + public: + /// Create and register test + Single(int s0, int t0) : Test("Precede::Single::" + str(s0) + "<" + str(t0), 8, 1, 4), s(s0), t(t0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size(); + for (int i = 0; i < n; i++) { + if (x[i] == t) + return false; + if (x[i] == s) + return true; } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::precede(home, x, s, t); - } - }; - - /// %Test for multiple value precedence constraint - class Multi : public Test { - private: - /// The values for precedence - Gecode::IntArgs c; + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::precede(home, x, s, t); + } + }; - public: - /// Create and register test - Multi(const Gecode::IntArgs& c0) : Test("Precede::Multi::" + str(c0), 6, 1, 5), c(c0) { - consistency_test_level = CTL_NONE; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - for (int j = 0; j < c.size() - 1; j++) - for (int i = 0; i < x.size(); i++) { - if (x[i] == c[j + 1]) - return false; - if (x[i] == c[j]) - break; - } - return true; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::precede(home, x, c); - } - }; + /// %Test for multiple value precedence constraint + class Multi : public Test { + private: + /// The values for precedence + Gecode::IntArgs c; - Single _a(2, 3); - Single _b(1, 4); + public: + /// Create and register test + Multi(const Gecode::IntArgs& c0) : Test("Precede::Multi::" + str(c0), 6, 1, 5), c(c0) { + consistency_test_level = CTL_NONE; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + for (int j = 0; j < c.size() - 1; j++) + for (int i = 0; i < x.size(); i++) { + if (x[i] == c[j + 1]) + return false; + if (x[i] == c[j]) + break; + } + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::precede(home, x, c); + } + }; - Multi _c(Gecode::IntArgs({1, 2, 3})); - Multi _d(Gecode::IntArgs({3, 2, 1})); - Multi _e(Gecode::IntArgs({4, 2, 3, 1})); + Single _a(2, 3); + Single _b(1, 4); - } // namespace Precede + Multi _c(Gecode::IntArgs({1, 2, 3})); + Multi _d(Gecode::IntArgs({3, 2, 1})); + Multi _e(Gecode::IntArgs({4, 2, 3, 1})); -}} // namespace Test::Int +} // namespace Test::Int::Precede // STATISTICS: test-int diff --git a/test/int/rel.cpp b/test/int/rel.cpp index 80243349ec..9295c86a22 100644 --- a/test/int/rel.cpp +++ b/test/int/rel.cpp @@ -34,628 +34,613 @@ #include -namespace Test { namespace Int { - - /// %Tests for relation constraints - namespace Rel { - - /** - * \defgroup TaskTestIntRel Relation constraints - * \ingroup TaskTestInt - */ - //@{ - /// %Test for simple relation involving integer variables - class IntVarXY : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - IntVarXY(Gecode::IntRelType irt0, int n, Gecode::IntPropLevel ipl) - : Test(TestTags::sweep(), "Rel::Int::Var::XY::" + str(irt0) + "::" + str(ipl) + "::" + str(n), n + 1, - -3, 3, n == 1, ipl), - irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - if (x.size() == 2) { - return cmp(x[0], irt, x[1]); - } else { - return cmp(x[0], irt, x[2]) && cmp(x[1], irt, x[2]); - } - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - if (x.size() == 2) { - rel(home, x[0], irt, x[1], ipl); - } else { - IntVarArgs y(2); - y[0] = x[0]; - y[1] = x[1]; - rel(home, y, irt, x[2], ipl); - } - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - assert(x.size() == 2); - Gecode::rel(home, x[0], irt, x[1], r, ipl); - } - }; - - /// %Test for simple relation involving shared integer variables - class IntVarXX : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - IntVarXX(Gecode::IntRelType irt0, Gecode::IntPropLevel ipl) - : Test(TestTags::sweep(), "Rel::Int::Var::XX::" + str(irt0) + "::" + str(ipl), 1, -3, 3, true, ipl), - irt(irt0) { - consistency_test_level = ((irt != Gecode::IRT_LT) && (irt != Gecode::IRT_GR) && (irt != Gecode::IRT_NQ)) - ? CTL_DOMAIN - : CTL_NONE; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return cmp(x[0], irt, x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::rel(home, x[0], irt, x[0], ipl); - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - Gecode::rel(home, x[0], irt, x[0], r, ipl); - } - }; - - /// %Test for simple relation involving Boolean variables - class BoolVarXY : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - BoolVarXY(Gecode::IntRelType irt0, int n) - : Test("Rel::Bool::Var::XY::" + str(irt0) + "::" + str(n), n + 1, 0, 1, n == 1), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - if (x.size() == 2) { - return cmp(x[0], irt, x[1]); - } else { - return cmp(x[0], irt, x[2]) && cmp(x[1], irt, x[2]); - } - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - if (x.size() == 2) { - rel(home, channel(home, x[0]), irt, channel(home, x[1])); - } else { - BoolVarArgs y(2); - y[0] = channel(home, x[0]); - y[1] = channel(home, x[1]); - rel(home, y, irt, channel(home, x[2])); - } - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - assert(x.size() == 2); - using namespace Gecode; - rel(home, channel(home, x[0]), irt, channel(home, x[1]), r); - } - }; - - /// %Test for simple relation involving shared Boolean variables - class BoolVarXX : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - BoolVarXX(Gecode::IntRelType irt0) : Test("Rel::Bool::Var::XX::" + str(irt0), 1, 0, 1), irt(irt0) { - consistency_test_level = ((irt != Gecode::IRT_LT) && (irt != Gecode::IRT_GR) && (irt != Gecode::IRT_NQ)) - ? CTL_DOMAIN - : CTL_NONE; - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return cmp(x[0], irt, x[0]); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::BoolVar b = Gecode::channel(home, x[0]); - Gecode::rel(home, b, irt, b); - } - }; - - /// %Test for simple relation involving integer variable and integer constant - class IntInt : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - /// Integer constant - int c; - - public: - /// Create and register test - IntInt(Gecode::IntRelType irt0, int n, int c0) - : Test(TestTags::sweep(), "Rel::Int::Int::" + str(irt0) + "::" + str(n) + "::" + str(c0), n, -3, 3, - n == 1), - irt(irt0), c(c0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - if (x.size() == 1) - return cmp(x[0], irt, c); - else - return cmp(x[0], irt, c) && cmp(x[1], irt, c); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - if (x.size() == 1) - rel(home, x[0], irt, c); - else - rel(home, x, irt, c); - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - assert(x.size() == 1); - Gecode::rel(home, x[0], irt, c, r); - } - }; - - /// %Test for simple relation involving Boolean variable and integer constant - class BoolInt : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - /// Integer constant - int c; - - public: - /// Create and register test - BoolInt(Gecode::IntRelType irt0, int n, int c0) - : Test("Rel::Bool::Int::" + str(irt0) + "::" + str(n) + "::" + str(c0), n, 0, 1, n == 1), irt(irt0), - c(c0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - if (x.size() == 1) - return cmp(x[0], irt, c); - else - return cmp(x[0], irt, c) && cmp(x[1], irt, c); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - if (x.size() == 1) { - rel(home, channel(home, x[0]), irt, c); - } else { - BoolVarArgs y(2); - y[0] = channel(home, x[0]); - y[1] = channel(home, x[1]); - rel(home, y, irt, c); - } - } - /// Post reified constraint on \a x for \a r - void - post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { - assert(x.size() == 1); - using namespace Gecode; - rel(home, channel(home, x[0]), irt, c, r); - } - }; - - /// %Test for sequence of relations between integer variables - class IntSeq : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - IntSeq(int n, Gecode::IntRelType irt0, Gecode::IntPropLevel ipl) - : Test(TestTags::sweep(), "Rel::Int::Seq::" + str(n) + "::" + str(irt0) + "::" + str(ipl), n, -3, 3, - false, ipl), - irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - if (irt == Gecode::IRT_NQ) { - if (x.size() < 2) - return false; - for (int i = 0; i < x.size() - 1; i++) - if (x[i] != x[i + 1]) - return true; +/// %Tests for relation constraints +namespace Test::Int::Rel { + + /** + * \defgroup TaskTestIntRel Relation constraints + * \ingroup TaskTestInt + */ + //@{ + /// %Test for simple relation involving integer variables + class IntVarXY : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + IntVarXY(Gecode::IntRelType irt0, int n, Gecode::IntPropLevel ipl) + : Test(TestTags::sweep(), "Rel::Int::Var::XY::" + str(irt0) + "::" + str(ipl) + "::" + str(n), n + 1, -3, 3, + n == 1, ipl), + irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + if (x.size() == 2) { + return cmp(x[0], irt, x[1]); + } + return cmp(x[0], irt, x[2]) && cmp(x[1], irt, x[2]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + if (x.size() == 2) { + rel(home, x[0], irt, x[1], ipl); + } else { + IntVarArgs y(2); + y[0] = x[0]; + y[1] = x[1]; + rel(home, y, irt, x[2], ipl); + } + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + assert(x.size() == 2); + Gecode::rel(home, x[0], irt, x[1], r, ipl); + } + }; + + /// %Test for simple relation involving shared integer variables + class IntVarXX : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + IntVarXX(Gecode::IntRelType irt0, Gecode::IntPropLevel ipl) + : Test(TestTags::sweep(), "Rel::Int::Var::XX::" + str(irt0) + "::" + str(ipl), 1, -3, 3, true, ipl), + irt(irt0) { + consistency_test_level = + ((irt != Gecode::IRT_LT) && (irt != Gecode::IRT_GR) && (irt != Gecode::IRT_NQ)) ? CTL_DOMAIN : CTL_NONE; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return cmp(x[0], irt, x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::rel(home, x[0], irt, x[0], ipl); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + Gecode::rel(home, x[0], irt, x[0], r, ipl); + } + }; + + /// %Test for simple relation involving Boolean variables + class BoolVarXY : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + BoolVarXY(Gecode::IntRelType irt0, int n) + : Test("Rel::Bool::Var::XY::" + str(irt0) + "::" + str(n), n + 1, 0, 1, n == 1), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + if (x.size() == 2) { + return cmp(x[0], irt, x[1]); + } + return cmp(x[0], irt, x[2]) && cmp(x[1], irt, x[2]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + if (x.size() == 2) { + rel(home, channel(home, x[0]), irt, channel(home, x[1])); + } else { + BoolVarArgs y(2); + y[0] = channel(home, x[0]); + y[1] = channel(home, x[1]); + rel(home, y, irt, channel(home, x[2])); + } + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + assert(x.size() == 2); + using namespace Gecode; + rel(home, channel(home, x[0]), irt, channel(home, x[1]), r); + } + }; + + /// %Test for simple relation involving shared Boolean variables + class BoolVarXX : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + BoolVarXX(Gecode::IntRelType irt0) : Test("Rel::Bool::Var::XX::" + str(irt0), 1, 0, 1), irt(irt0) { + consistency_test_level = + ((irt != Gecode::IRT_LT) && (irt != Gecode::IRT_GR) && (irt != Gecode::IRT_NQ)) ? CTL_DOMAIN : CTL_NONE; + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return cmp(x[0], irt, x[0]); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::BoolVar b = Gecode::channel(home, x[0]); + Gecode::rel(home, b, irt, b); + } + }; + + /// %Test for simple relation involving integer variable and integer constant + class IntInt : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + /// Integer constant + int c; + + public: + /// Create and register test + IntInt(Gecode::IntRelType irt0, int n, int c0) + : Test(TestTags::sweep(), "Rel::Int::Int::" + str(irt0) + "::" + str(n) + "::" + str(c0), n, -3, 3, n == 1), + irt(irt0), c(c0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + if (x.size() == 1) + return cmp(x[0], irt, c); + return cmp(x[0], irt, c) && cmp(x[1], irt, c); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + if (x.size() == 1) + rel(home, x[0], irt, c); + else + rel(home, x, irt, c); + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + assert(x.size() == 1); + Gecode::rel(home, x[0], irt, c, r); + } + }; + + /// %Test for simple relation involving Boolean variable and integer constant + class BoolInt : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + /// Integer constant + int c; + + public: + /// Create and register test + BoolInt(Gecode::IntRelType irt0, int n, int c0) + : Test("Rel::Bool::Int::" + str(irt0) + "::" + str(n) + "::" + str(c0), n, 0, 1, n == 1), irt(irt0), c(c0) { + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + if (x.size() == 1) + return cmp(x[0], irt, c); + return cmp(x[0], irt, c) && cmp(x[1], irt, c); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + if (x.size() == 1) { + rel(home, channel(home, x[0]), irt, c); + } else { + BoolVarArgs y(2); + y[0] = channel(home, x[0]); + y[1] = channel(home, x[1]); + rel(home, y, irt, c); + } + } + /// Post reified constraint on \a x for \a r + void + post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) override { + assert(x.size() == 1); + using namespace Gecode; + rel(home, channel(home, x[0]), irt, c, r); + } + }; + + /// %Test for sequence of relations between integer variables + class IntSeq : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + IntSeq(int n, Gecode::IntRelType irt0, Gecode::IntPropLevel ipl) + : Test(TestTags::sweep(), "Rel::Int::Seq::" + str(n) + "::" + str(irt0) + "::" + str(ipl), n, -3, 3, false, + ipl), + irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + if (irt == Gecode::IRT_NQ) { + if (x.size() < 2) return false; - } else { - for (int i = 0; i < x.size() - 1; i++) - if (!cmp(x[i], irt, x[i + 1])) - return false; - return true; - } - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::rel(home, x, irt, ipl); + for (int i = 0; i < x.size() - 1; i++) + if (x[i] != x[i + 1]) + return true; + return false; } - }; - - /// %Test for sequence of relations between shared integer variables - class IntSharedSeq : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - IntSharedSeq(int n, Gecode::IntRelType irt0, Gecode::IntPropLevel ipl) - : Test(TestTags::sweep(), "Rel::Int::Seq::Shared::" + str(n) + "::" + str(irt0) + "::" + str(ipl), n, - -3, 3, false, ipl), - irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - if (irt == Gecode::IRT_NQ) { - if (x.size() < 2) - return false; - for (int i = 0; i < x.size() - 1; i++) - if (x[i] != x[i + 1]) - return true; + for (int i = 0; i < x.size() - 1; i++) + if (!cmp(x[i], irt, x[i + 1])) return false; - } else { - int n = x.size(); - for (int i = 0; i < 2 * n - 1; i++) - if (!cmp(x[i % n], irt, x[(i + 1) % n])) - return false; - return true; - } - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - int n = x.size(); - IntVarArgs y(2 * n); - for (int i = n; i--;) - y[i] = y[n + i] = x[i]; - rel(home, y, irt, ipl); - } - }; - - /// %Test for sequence of relations between Boolean variables - class BoolSeq : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - BoolSeq(int n, Gecode::IntRelType irt0) - : Test("Rel::Bool::Seq::" + str(n) + "::" + str(irt0), n, 0, 1), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - if (irt == Gecode::IRT_NQ) { - if (x.size() < 2) - return false; - for (int i = 0; i < x.size() - 1; i++) - if (x[i] != x[i + 1]) - return true; + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::rel(home, x, irt, ipl); + } + }; + + /// %Test for sequence of relations between shared integer variables + class IntSharedSeq : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + IntSharedSeq(int n, Gecode::IntRelType irt0, Gecode::IntPropLevel ipl) + : Test(TestTags::sweep(), "Rel::Int::Seq::Shared::" + str(n) + "::" + str(irt0) + "::" + str(ipl), n, -3, 3, + false, ipl), + irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + if (irt == Gecode::IRT_NQ) { + if (x.size() < 2) return false; - } else { - for (int i = 0; i < x.size() - 1; i++) - if (!cmp(x[i], irt, x[i + 1])) - return false; - return true; - } - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - BoolVarArgs b(x.size()); - for (int i = x.size(); i--;) - b[i] = channel(home, x[i]); - rel(home, b, irt); + for (int i = 0; i < x.size() - 1; i++) + if (x[i] != x[i + 1]) + return true; + return false; } - }; - - /// %Test for sequence of relations between shared Boolean variables - class BoolSharedSeq : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - BoolSharedSeq(int n, Gecode::IntRelType irt0) - : Test("Rel::Bool::Seq::Shared::" + str(n) + "::" + str(irt0), n, 0, 1), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - if (irt == Gecode::IRT_NQ) { - if (x.size() < 2) - return false; - for (int i = 0; i < x.size() - 1; i++) - if (x[i] != x[i + 1]) - return true; + int n = x.size(); + for (int i = 0; i < 2 * n - 1; i++) + if (!cmp(x[i % n], irt, x[(i + 1) % n])) return false; - } else { - int n = x.size(); - for (int i = 0; i < 2 * n - 1; i++) - if (!cmp(x[i % n], irt, x[(i + 1) % n])) - return false; - return true; - } - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - int n = x.size(); - BoolVarArgs b(2 * n); - for (int i = n; i--;) - b[i] = b[n + i] = channel(home, x[i]); - rel(home, b, irt); - } - }; - - /// %Test for relation between same sized arrays of integer variables - class IntArrayVar : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - IntArrayVar(Gecode::IntRelType irt0) - : Test(TestTags::sweep(), "Rel::Int::Array::Var::" + str(irt0), 6, -2, 2), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() >> 1; - for (int i = 0; i < n; i++) - if (x[i] != x[n + i]) - return cmp(x[i], irt, x[n + i]); - return ((irt == Gecode::IRT_LQ) || (irt == Gecode::IRT_GQ) || (irt == Gecode::IRT_EQ)); - GECODE_NEVER; + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + int n = x.size(); + IntVarArgs y(2 * n); + for (int i = n; i--;) + y[i] = y[n + i] = x[i]; + rel(home, y, irt, ipl); + } + }; + + /// %Test for sequence of relations between Boolean variables + class BoolSeq : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + BoolSeq(int n, Gecode::IntRelType irt0) + : Test("Rel::Bool::Seq::" + str(n) + "::" + str(irt0), n, 0, 1), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + if (irt == Gecode::IRT_NQ) { + if (x.size() < 2) + return false; + for (int i = 0; i < x.size() - 1; i++) + if (x[i] != x[i + 1]) + return true; return false; } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - int n = x.size() >> 1; - IntVarArgs y(n); - IntVarArgs z(n); - for (int i = 0; i < n; i++) { - y[i] = x[i]; - z[i] = x[n + i]; - } - rel(home, y, irt, z); - } - }; - - /// %Test for relation between same sized arrays of integer variables and integers - class IntArrayInt : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - IntArrayInt(Gecode::IntRelType irt0) - : Test(TestTags::sweep(), "Rel::Int::Array::Int::" + str(irt0), 3, -2, 2), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - Gecode::IntArgs y({0, 0, 0}); - int n = x.size(); - for (int i = 0; i < n; i++) - if (x[i] != y[i]) - return cmp(x[i], irt, y[i]); - return ((irt == Gecode::IRT_LQ) || (irt == Gecode::IRT_GQ) || (irt == Gecode::IRT_EQ)); - GECODE_NEVER; + for (int i = 0; i < x.size() - 1; i++) + if (!cmp(x[i], irt, x[i + 1])) + return false; + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + BoolVarArgs b(x.size()); + for (int i = x.size(); i--;) + b[i] = channel(home, x[i]); + rel(home, b, irt); + } + }; + + /// %Test for sequence of relations between shared Boolean variables + class BoolSharedSeq : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + BoolSharedSeq(int n, Gecode::IntRelType irt0) + : Test("Rel::Bool::Seq::Shared::" + str(n) + "::" + str(irt0), n, 0, 1), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + if (irt == Gecode::IRT_NQ) { + if (x.size() < 2) + return false; + for (int i = 0; i < x.size() - 1; i++) + if (x[i] != x[i + 1]) + return true; return false; } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - IntArgs y({0, 0, 0}); - rel(home, x, irt, y); - } - }; - - /// %Test for relation between differently sized arrays of integer variables - class IntArrayDiff : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - /// How many variables in total - static const int n = 4; - /// How big is the first array - int n_fst; - - public: - /// Create and register test - IntArrayDiff(Gecode::IntRelType irt0, int m) - : Test((irt0 == Gecode::IRT_EQ) && (m == 0) ? TestTags::standard() : TestTags::sweep(), - "Rel::Int::Array::" + str(irt0) + "::" + str(m) + "::" + str(n - m), n, -2, 2), - irt(irt0), n_fst(m) { - assert(n_fst <= n); - } - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n_snd = n - n_fst; - for (int i = 0; i < std::min(n_fst, n_snd); i++) - if (x[i] != x[n_fst + i]) - return cmp(x[i], irt, x[n_fst + i]); - return cmp(n_fst, irt, n_snd); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - int n_snd = n - n_fst; - IntVarArgs y(n_fst); - IntVarArgs z(n_snd); - for (int i = 0; i < n_fst; i++) { - y[i] = x[i]; + int n = x.size(); + for (int i = 0; i < 2 * n - 1; i++) + if (!cmp(x[i % n], irt, x[(i + 1) % n])) + return false; + return true; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + int n = x.size(); + BoolVarArgs b(2 * n); + for (int i = n; i--;) + b[i] = b[n + i] = channel(home, x[i]); + rel(home, b, irt); + } + }; + + /// %Test for relation between same sized arrays of integer variables + class IntArrayVar : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + IntArrayVar(Gecode::IntRelType irt0) + : Test(TestTags::sweep(), "Rel::Int::Array::Var::" + str(irt0), 6, -2, 2), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() >> 1; + for (int i = 0; i < n; i++) + if (x[i] != x[n + i]) + return cmp(x[i], irt, x[n + i]); + return ((irt == Gecode::IRT_LQ) || (irt == Gecode::IRT_GQ) || (irt == Gecode::IRT_EQ)); + GECODE_NEVER; + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + int n = x.size() >> 1; + IntVarArgs y(n); + IntVarArgs z(n); + for (int i = 0; i < n; i++) { + y[i] = x[i]; + z[i] = x[n + i]; + } + rel(home, y, irt, z); + } + }; + + /// %Test for relation between same sized arrays of integer variables and integers + class IntArrayInt : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + IntArrayInt(Gecode::IntRelType irt0) + : Test(TestTags::sweep(), "Rel::Int::Array::Int::" + str(irt0), 3, -2, 2), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + Gecode::IntArgs y({0, 0, 0}); + int n = x.size(); + for (int i = 0; i < n; i++) + if (x[i] != y[i]) + return cmp(x[i], irt, y[i]); + return ((irt == Gecode::IRT_LQ) || (irt == Gecode::IRT_GQ) || (irt == Gecode::IRT_EQ)); + GECODE_NEVER; + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + IntArgs y({0, 0, 0}); + rel(home, x, irt, y); + } + }; + + /// %Test for relation between differently sized arrays of integer variables + class IntArrayDiff : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + /// How many variables in total + static const int n = 4; + /// How big is the first array + int n_fst; + + public: + /// Create and register test + IntArrayDiff(Gecode::IntRelType irt0, int m) + : Test((irt0 == Gecode::IRT_EQ) && (m == 0) ? TestTags::standard() : TestTags::sweep(), + "Rel::Int::Array::" + str(irt0) + "::" + str(m) + "::" + str(n - m), n, -2, 2), + irt(irt0), n_fst(m) { + assert(n_fst <= n); + } + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n_snd = n - n_fst; + for (int i = 0; i < std::min(n_fst, n_snd); i++) + if (x[i] != x[n_fst + i]) + return cmp(x[i], irt, x[n_fst + i]); + return cmp(n_fst, irt, n_snd); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + int n_snd = n - n_fst; + IntVarArgs y(n_fst); + IntVarArgs z(n_snd); + for (int i = 0; i < n_fst; i++) { + y[i] = x[i]; + } + for (int i = 0; i < n_snd; i++) { + z[i] = x[n_fst + i]; + } + rel(home, y, irt, z); + } + }; + + /// %Test for relation between arrays of Boolean variables + class BoolArrayVar : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + BoolArrayVar(Gecode::IntRelType irt0) : Test("Rel::Bool::Array::Var::" + str(irt0), 10, 0, 1), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + int n = x.size() >> 1; + for (int i = 0; i < n; i++) + if (x[i] != x[n + i]) + return cmp(x[i], irt, x[n + i]); + return ((irt == Gecode::IRT_LQ) || (irt == Gecode::IRT_GQ) || (irt == Gecode::IRT_EQ)); + GECODE_NEVER; + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + int n = x.size() >> 1; + BoolVarArgs y(n); + BoolVarArgs z(n); + for (int i = 0; i < n; i++) { + y[i] = channel(home, x[i]); + z[i] = channel(home, x[n + i]); + } + rel(home, y, irt, z); + } + }; + + /// %Test for relation between arrays of Boolean variables and integers + class BoolArrayInt : public Test { + protected: + /// Integer relation type to propagate + Gecode::IntRelType irt; + + public: + /// Create and register test + BoolArrayInt(Gecode::IntRelType irt0) : Test("Rel::Bool::Array::Int::" + str(irt0), 5, 0, 1), irt(irt0) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + Gecode::IntArgs y({0, 0, 1, 0, 0}); + for (int i = 0; i < 5; i++) + if (x[i] != y[i]) + return cmp(x[i], irt, y[i]); + return ((irt == Gecode::IRT_LQ) || (irt == Gecode::IRT_GQ) || (irt == Gecode::IRT_EQ)); + GECODE_NEVER; + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + Gecode::IntArgs z({0, 0, 1, 0, 0}); + int n = x.size(); + BoolVarArgs y(n); + for (int i = 0; i < n; i++) + y[i] = channel(home, x[i]); + rel(home, y, irt, z); + } + }; + + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + using namespace Gecode; + for (IntRelTypes irts; irts(); ++irts) { + for (IntPropLevels ipls; ipls(); ++ipls) { + (void)new IntVarXY(irts.irt(), 1, ipls.ipl()); + (void)new IntVarXY(irts.irt(), 2, ipls.ipl()); + (void)new IntVarXX(irts.irt(), ipls.ipl()); + (void)new IntSeq(1, irts.irt(), ipls.ipl()); + (void)new IntSeq(2, irts.irt(), ipls.ipl()); + (void)new IntSeq(3, irts.irt(), ipls.ipl()); + (void)new IntSeq(5, irts.irt(), ipls.ipl()); + (void)new IntSharedSeq(1, irts.irt(), ipls.ipl()); + (void)new IntSharedSeq(2, irts.irt(), ipls.ipl()); + (void)new IntSharedSeq(3, irts.irt(), ipls.ipl()); + (void)new IntSharedSeq(4, irts.irt(), ipls.ipl()); } - for (int i = 0; i < n_snd; i++) { - z[i] = x[n_fst + i]; + (void)new BoolVarXY(irts.irt(), 1); + (void)new BoolVarXY(irts.irt(), 2); + (void)new BoolVarXX(irts.irt()); + (void)new BoolSeq(1, irts.irt()); + (void)new BoolSeq(2, irts.irt()); + (void)new BoolSeq(3, irts.irt()); + (void)new BoolSeq(10, irts.irt()); + (void)new BoolSharedSeq(1, irts.irt()); + (void)new BoolSharedSeq(2, irts.irt()); + (void)new BoolSharedSeq(3, irts.irt()); + (void)new BoolSharedSeq(4, irts.irt()); + (void)new BoolSharedSeq(8, irts.irt()); + for (int c = -4; c <= 4; c++) { + (void)new IntInt(irts.irt(), 1, c); + (void)new IntInt(irts.irt(), 2, c); } - rel(home, y, irt, z); - } - }; - - /// %Test for relation between arrays of Boolean variables - class BoolArrayVar : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - BoolArrayVar(Gecode::IntRelType irt0) : Test("Rel::Bool::Array::Var::" + str(irt0), 10, 0, 1), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - int n = x.size() >> 1; - for (int i = 0; i < n; i++) - if (x[i] != x[n + i]) - return cmp(x[i], irt, x[n + i]); - return ((irt == Gecode::IRT_LQ) || (irt == Gecode::IRT_GQ) || (irt == Gecode::IRT_EQ)); - GECODE_NEVER; - return false; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - int n = x.size() >> 1; - BoolVarArgs y(n); - BoolVarArgs z(n); - for (int i = 0; i < n; i++) { - y[i] = channel(home, x[i]); - z[i] = channel(home, x[n + i]); + for (int c = 0; c <= 1; c++) { + (void)new BoolInt(irts.irt(), 1, c); + (void)new BoolInt(irts.irt(), 2, c); } - rel(home, y, irt, z); + (void)new IntArrayVar(irts.irt()); + (void)new IntArrayInt(irts.irt()); + for (int n_fst = 0; n_fst <= 4; n_fst++) + (void)new IntArrayDiff(irts.irt(), n_fst); + (void)new BoolArrayVar(irts.irt()); + (void)new BoolArrayInt(irts.irt()); } - }; - - /// %Test for relation between arrays of Boolean variables and integers - class BoolArrayInt : public Test { - protected: - /// Integer relation type to propagate - Gecode::IntRelType irt; - - public: - /// Create and register test - BoolArrayInt(Gecode::IntRelType irt0) : Test("Rel::Bool::Array::Int::" + str(irt0), 5, 0, 1), irt(irt0) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - Gecode::IntArgs y({0, 0, 1, 0, 0}); - for (int i = 0; i < 5; i++) - if (x[i] != y[i]) - return cmp(x[i], irt, y[i]); - return ((irt == Gecode::IRT_LQ) || (irt == Gecode::IRT_GQ) || (irt == Gecode::IRT_EQ)); - GECODE_NEVER; - return false; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - Gecode::IntArgs z({0, 0, 1, 0, 0}); - int n = x.size(); - BoolVarArgs y(n); - for (int i = 0; i < n; i++) - y[i] = channel(home, x[i]); - rel(home, y, irt, z); - } - }; - - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - using namespace Gecode; - for (IntRelTypes irts; irts(); ++irts) { - for (IntPropLevels ipls; ipls(); ++ipls) { - (void)new IntVarXY(irts.irt(), 1, ipls.ipl()); - (void)new IntVarXY(irts.irt(), 2, ipls.ipl()); - (void)new IntVarXX(irts.irt(), ipls.ipl()); - (void)new IntSeq(1, irts.irt(), ipls.ipl()); - (void)new IntSeq(2, irts.irt(), ipls.ipl()); - (void)new IntSeq(3, irts.irt(), ipls.ipl()); - (void)new IntSeq(5, irts.irt(), ipls.ipl()); - (void)new IntSharedSeq(1, irts.irt(), ipls.ipl()); - (void)new IntSharedSeq(2, irts.irt(), ipls.ipl()); - (void)new IntSharedSeq(3, irts.irt(), ipls.ipl()); - (void)new IntSharedSeq(4, irts.irt(), ipls.ipl()); - } - (void)new BoolVarXY(irts.irt(), 1); - (void)new BoolVarXY(irts.irt(), 2); - (void)new BoolVarXX(irts.irt()); - (void)new BoolSeq(1, irts.irt()); - (void)new BoolSeq(2, irts.irt()); - (void)new BoolSeq(3, irts.irt()); - (void)new BoolSeq(10, irts.irt()); - (void)new BoolSharedSeq(1, irts.irt()); - (void)new BoolSharedSeq(2, irts.irt()); - (void)new BoolSharedSeq(3, irts.irt()); - (void)new BoolSharedSeq(4, irts.irt()); - (void)new BoolSharedSeq(8, irts.irt()); - for (int c = -4; c <= 4; c++) { - (void)new IntInt(irts.irt(), 1, c); - (void)new IntInt(irts.irt(), 2, c); - } - for (int c = 0; c <= 1; c++) { - (void)new BoolInt(irts.irt(), 1, c); - (void)new BoolInt(irts.irt(), 2, c); - } - (void)new IntArrayVar(irts.irt()); - (void)new IntArrayInt(irts.irt()); - for (int n_fst = 0; n_fst <= 4; n_fst++) - (void)new IntArrayDiff(irts.irt(), n_fst); - (void)new BoolArrayVar(irts.irt()); - (void)new BoolArrayInt(irts.irt()); - } - } - }; - - Create c; - //@} + } + }; - } // namespace Rel -}} // namespace Test::Int + Create c; + //@} +} // namespace Test::Int::Rel // STATISTICS: test-int diff --git a/test/int/sequence.cpp b/test/int/sequence.cpp index aadfb2cfc9..8d47b414bf 100644 --- a/test/int/sequence.cpp +++ b/test/int/sequence.cpp @@ -39,120 +39,115 @@ #include #include -namespace Test { namespace Int { - - /// %Tests for sequence constraints - namespace Sequence { - - /** - * \defgroup TaskTestIntSequence Sequence constraints - * \ingroup TaskTestInt - */ - //@{ - /// %Base test for sequence - class SequenceTest : public Test { - protected: - Gecode::IntSet s; - int q, l, u; - - public: - /// Create and register test - SequenceTest(const std::string& s, const Gecode::IntSet& s0, int q0, int l0, int u0, int size, int min, - int max) - : Test("Sequence::" + s, size, min, max), s(s0), q(q0), l(l0), u(u0) {} - /// %Test whether \a x is solutionin - bool - solution(const Assignment& x) const override { - for (int i = 0; i < (x.size() - q + 1); i++) { - int total = 0; - for (int j = i; j < i + q; j++) { - if (s.in(x[j])) - total++; - if (total > u) - return false; - } - if (total < l) +/// %Tests for sequence constraints +namespace Test::Int::Sequence { + + /** + * \defgroup TaskTestIntSequence Sequence constraints + * \ingroup TaskTestInt + */ + //@{ + /// %Base test for sequence + class SequenceTest : public Test { + protected: + Gecode::IntSet s; + int q, l, u; + + public: + /// Create and register test + SequenceTest(const std::string& s, const Gecode::IntSet& s0, int q0, int l0, int u0, int size, int min, int max) + : Test("Sequence::" + s, size, min, max), s(s0), q(q0), l(l0), u(u0) {} + /// %Test whether \a x is solutionin + bool + solution(const Assignment& x) const override { + for (int i = 0; i < (x.size() - q + 1); i++) { + int total = 0; + for (int j = i; j < i + q; j++) { + if (s.in(x[j])) + total++; + if (total > u) return false; } - return true; + if (total < l) + return false; } - }; - - /// %Test for sequence with boolean variables - class SequenceBoolTest : public SequenceTest { - public: - /// Create and register test - SequenceBoolTest(const std::string& s, const Gecode::IntSet& s0, int q0, int l0, int u0, int size) - : SequenceTest("Bool::" + s, s0, q0, l0, u0, size, 0, 1) {} - - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::BoolVarArgs c(x.size()); - - for (int i = 0; i < x.size(); i++) { - c[i] = Gecode::channel(home, x[i]); - } - - Gecode::sequence(home, c, s, q, l, u); - } - }; - - /// %Test for sequence with boolean variables - class SequenceIntTest : public SequenceTest { - public: - /// Create and register test - SequenceIntTest(const std::string& s, const Gecode::IntSet& s0, int q0, int l0, int u0, int size, int min, - int max) - : SequenceTest("Int::" + s, s0, q0, l0, u0, size, min, max) {} - - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - Gecode::sequence(home, x, s, q, l, u); + return true; + } + }; + + /// %Test for sequence with boolean variables + class SequenceBoolTest : public SequenceTest { + public: + /// Create and register test + SequenceBoolTest(const std::string& s, const Gecode::IntSet& s0, int q0, int l0, int u0, int size) + : SequenceTest("Bool::" + s, s0, q0, l0, u0, size, 0, 1) {} + + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::BoolVarArgs c(x.size()); + + for (int i = 0; i < x.size(); i++) { + c[i] = Gecode::channel(home, x[i]); } - }; - - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - using namespace Gecode; - - IntSet a(0, 0); - IntSet b(1, 1); - IntSet c(2, 2); - IntSet d(0, 1); - IntArgs ie({0, 2}); - IntSet e(ie); - - (void)new SequenceBoolTest("A", a, 3, 2, 2, 6); - (void)new SequenceBoolTest("B", b, 3, 2, 2, 6); - (void)new SequenceBoolTest("C", b, 6, 2, 2, 6); - (void)new SequenceBoolTest("D", b, 6, 0, 0, 6); - (void)new SequenceBoolTest("E", b, 6, 6, 6, 6); - - (void)new SequenceIntTest("A", c, 3, 2, 2, 6, 2, 3); - (void)new SequenceIntTest("B", c, 3, 2, 2, 6, 2, 4); - (void)new SequenceIntTest("C", b, 3, 2, 2, 6, 1, 3); - (void)new SequenceIntTest("D", c, 3, 0, 0, 3, 1, 3); - (void)new SequenceIntTest("E", c, 3, 3, 3, 3, 1, 3); - (void)new SequenceIntTest("F", c, 3, 2, 2, 10, 2, 3); - - (void)new SequenceIntTest("G", d, 3, 2, 2, 6, 0, 3); - (void)new SequenceIntTest("H", d, 3, 2, 2, 6, 0, 4); - (void)new SequenceIntTest("I", d, 3, 2, 2, 6, 1, 3); - (void)new SequenceIntTest("J", e, 3, 0, 0, 6, 0, 3); - (void)new SequenceIntTest("K", e, 3, 3, 3, 6, 0, 3); - (void)new SequenceIntTest("L", e, 3, 2, 2, 6, 0, 3); - } - }; - - Create c; - //@} - - } // namespace Sequence -}} // namespace Test::Int + Gecode::sequence(home, c, s, q, l, u); + } + }; + + /// %Test for sequence with boolean variables + class SequenceIntTest : public SequenceTest { + public: + /// Create and register test + SequenceIntTest(const std::string& s, const Gecode::IntSet& s0, int q0, int l0, int u0, int size, int min, + int max) + : SequenceTest("Int::" + s, s0, q0, l0, u0, size, min, max) {} + + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + Gecode::sequence(home, x, s, q, l, u); + } + }; + + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + using namespace Gecode; + + IntSet a(0, 0); + IntSet b(1, 1); + IntSet c(2, 2); + IntSet d(0, 1); + IntArgs ie({0, 2}); + IntSet e(ie); + + (void)new SequenceBoolTest("A", a, 3, 2, 2, 6); + (void)new SequenceBoolTest("B", b, 3, 2, 2, 6); + (void)new SequenceBoolTest("C", b, 6, 2, 2, 6); + (void)new SequenceBoolTest("D", b, 6, 0, 0, 6); + (void)new SequenceBoolTest("E", b, 6, 6, 6, 6); + + (void)new SequenceIntTest("A", c, 3, 2, 2, 6, 2, 3); + (void)new SequenceIntTest("B", c, 3, 2, 2, 6, 2, 4); + (void)new SequenceIntTest("C", b, 3, 2, 2, 6, 1, 3); + (void)new SequenceIntTest("D", c, 3, 0, 0, 3, 1, 3); + (void)new SequenceIntTest("E", c, 3, 3, 3, 3, 1, 3); + (void)new SequenceIntTest("F", c, 3, 2, 2, 10, 2, 3); + + (void)new SequenceIntTest("G", d, 3, 2, 2, 6, 0, 3); + (void)new SequenceIntTest("H", d, 3, 2, 2, 6, 0, 4); + (void)new SequenceIntTest("I", d, 3, 2, 2, 6, 1, 3); + (void)new SequenceIntTest("J", e, 3, 0, 0, 6, 0, 3); + (void)new SequenceIntTest("K", e, 3, 3, 3, 6, 0, 3); + (void)new SequenceIntTest("L", e, 3, 2, 2, 6, 0, 3); + } + }; + + Create c; + //@} + +} // namespace Test::Int::Sequence // STATISTICS: test-int diff --git a/test/int/sorted.cpp b/test/int/sorted.cpp index 511675b6b5..d468e50d64 100644 --- a/test/int/sorted.cpp +++ b/test/int/sorted.cpp @@ -36,135 +36,131 @@ #include "test/int.hh" -namespace Test { namespace Int { - - /// %Tests for sorted constraints - namespace Sorted { - - /** - * \defgroup TaskTestIntSorted Sorted constraints - * \ingroup TaskTestInt - */ - //@{ - - /// Relation for sorting integers in increasing order - class SortIntMin { - public: - /// %Test whether \a x is less than \a y - bool - operator()(const int x, const int y) { - return x < y; +/// %Tests for sorted constraints +namespace Test::Int::Sorted { + + /** + * \defgroup TaskTestIntSorted Sorted constraints + * \ingroup TaskTestInt + */ + //@{ + + /// Relation for sorting integers in increasing order + class SortIntMin { + public: + /// %Test whether \a x is less than \a y + bool + operator()(const int x, const int y) { + return x < y; + } + }; + + /// %Test sorted without permutation variables + class NoVar : public Test { + protected: + /// Number of variables to be sorted + static const int n = 3; + + public: + /// Create and register test + NoVar() : Test("Sorted::NoVar", 2 * n, 0, 3) {} + /// %Test whether \a xy is solution + bool + solution(const Assignment& xy) const override { + int x[n], y[n]; + for (int i = 0; i < 3; i++) { + x[i] = xy[i]; + y[i] = xy[n + i]; } - }; - - /// %Test sorted without permutation variables - class NoVar : public Test { - protected: - /// Number of variables to be sorted - static const int n = 3; - - public: - /// Create and register test - NoVar(void) : Test("Sorted::NoVar", 2 * n, 0, 3) {} - /// %Test whether \a xy is solution - bool - solution(const Assignment& xy) const override { - int x[n], y[n]; - for (int i = 0; i < 3; i++) { - x[i] = xy[i]; - y[i] = xy[n + i]; - } - - for (int i = 0; i < n - 1; i++) - if (y[i] > y[i + 1]) - return false; - - SortIntMin sim; - Gecode::Support::quicksort(x, n, sim); - for (int i = 0; i < n; i++) - if (x[i] != y[i]) - return false; - return true; + for (int i = 0; i < n - 1; i++) + if (y[i] > y[i + 1]) + return false; + + SortIntMin sim; + Gecode::Support::quicksort(x, n, sim); + + for (int i = 0; i < n; i++) + if (x[i] != y[i]) + return false; + return true; + } + /// Post constraint on \a xy + void + post(Gecode::Space& home, Gecode::IntVarArray& xy) override { + Gecode::IntVarArgs x(n), y(n); + for (int i = 0; i < n; i++) { + x[i] = xy[i]; + y[i] = xy[n + i]; } - /// Post constraint on \a xy - void - post(Gecode::Space& home, Gecode::IntVarArray& xy) override { - Gecode::IntVarArgs x(n), y(n); - for (int i = 0; i < n; i++) { - x[i] = xy[i]; - y[i] = xy[n + i]; - } - Gecode::sorted(home, x, y); + Gecode::sorted(home, x, y); + } + }; + + /// %Test sorted with permutation variables + class PermVar : public Test { + protected: + /// Number of variables to be sorted + static const int n = 3; + + public: + /// Create and register test + PermVar() : Test("Sorted::PermVar", 3 * n, 0, 2) {} + /// %Test whether \a xyz is solution + bool + solution(const Assignment& xyz) const override { + int x[n], y[n], z[n]; + for (int i = 0; i < n; i++) { + x[i] = xyz[i]; + y[i] = xyz[n + i]; + z[i] = xyz[2 * n + i]; } - }; - - /// %Test sorted with permutation variables - class PermVar : public Test { - protected: - /// Number of variables to be sorted - static const int n = 3; - - public: - /// Create and register test - PermVar(void) : Test("Sorted::PermVar", 3 * n, 0, 2) {} - /// %Test whether \a xyz is solution - bool - solution(const Assignment& xyz) const override { - int x[n], y[n], z[n]; - for (int i = 0; i < n; i++) { - x[i] = xyz[i]; - y[i] = xyz[n + i]; - z[i] = xyz[2 * n + i]; - } - // check for permutation - for (int i = 0; i < n; i++) - for (int j = i + 1; j < n; j++) - if (z[i] == z[j]) - return false; - - // y must to be sorted - for (int i = 0; i < n - 1; i++) - if (y[i] > y[i + 1]) + // check for permutation + for (int i = 0; i < n; i++) + for (int j = i + 1; j < n; j++) + if (z[i] == z[j]) return false; - // check whether permutation is in range - for (int i = 0; i < n; i++) - if ((z[i] < 0) || (z[i] >= n)) - return false; - - // check whether permutation info is correct - for (int i = 0; i < n; i++) - if (x[i] != y[z[i]]) - return false; - - // check for sorting - SortIntMin sim; - Gecode::Support::quicksort(x, n, sim); - for (int i = 0; i < n; i++) - if (x[i] != y[i]) - return false; - - return true; + // y must to be sorted + for (int i = 0; i < n - 1; i++) + if (y[i] > y[i + 1]) + return false; + + // check whether permutation is in range + for (int zi : z) + if ((zi < 0) || (zi >= n)) + return false; + + // check whether permutation info is correct + for (int i = 0; i < n; i++) + if (x[i] != y[z[i]]) + return false; + + // check for sorting + SortIntMin sim; + Gecode::Support::quicksort(x, n, sim); + for (int i = 0; i < n; i++) + if (x[i] != y[i]) + return false; + + return true; + } + /// Post constraint on \a xyz + void + post(Gecode::Space& home, Gecode::IntVarArray& xyz) override { + Gecode::IntVarArgs x(n), y(n), z(n); + for (int i = 0; i < n; i++) { + x[i] = xyz[i]; + y[i] = xyz[n + i]; + z[i] = xyz[2 * n + i]; } - /// Post constraint on \a xyz - void - post(Gecode::Space& home, Gecode::IntVarArray& xyz) override { - Gecode::IntVarArgs x(n), y(n), z(n); - for (int i = 0; i < n; i++) { - x[i] = xyz[i]; - y[i] = xyz[n + i]; - z[i] = xyz[2 * n + i]; - } - Gecode::sorted(home, x, y, z); - } - }; - - NoVar novar; - PermVar permvar; - //@} + Gecode::sorted(home, x, y, z); + } + }; - } // namespace Sorted -}} // namespace Test::Int + NoVar novar; + PermVar permvar; + //@} +} // namespace Test::Int::Sorted // STATISTICS: test-int diff --git a/test/int/unary.cpp b/test/int/unary.cpp index 0b1858b765..6a85ad9783 100644 --- a/test/int/unary.cpp +++ b/test/int/unary.cpp @@ -34,13 +34,9 @@ #include -namespace Test { namespace Int { - /// %Tests for unary scheduling constraints - namespace Unary { - } -}} // namespace Test::Int +/// %Tests for unary scheduling constraints -namespace Test { namespace Int { namespace Unary { +namespace Test::Int::Unary { /** * \defgroup TaskTestIntUnary Unary scheduling constraints @@ -72,7 +68,7 @@ namespace Test { namespace Int { namespace Unary { } /// Create and register initial assignment Assignment* - assignment(void) const override { + assignment() const override { return new RandomAssignment(arity, dom, 500, _rand); } /// %Test whether \a x is solution @@ -118,7 +114,7 @@ namespace Test { namespace Int { namespace Unary { } /// Create and register initial assignment Assignment* - assignment(void) const override { + assignment() const override { return new RandomAssignment(arity, dom, 500, _rand); } /// %Test whether \a x is solution @@ -171,7 +167,7 @@ namespace Test { namespace Int { namespace Unary { } /// Create and register initial assignment Assignment* - assignment(void) const override { + assignment() const override { return new RandomMixAssignment(arity / 2, dom, arity / 2, Gecode::IntSet(_min_p, _max_p), 500, _rand); } /// %Test whether \a x is solution @@ -234,7 +230,7 @@ namespace Test { namespace Int { namespace Unary { } /// Create and register initial assignment Assignment* - assignment(void) const override { + assignment() const override { return new RandomMixAssignment(2 * (arity / 3), dom, arity / 3, Gecode::IntSet(_min_p, _max_p), 500, _rand); } /// %Test whether \a x is solution @@ -275,7 +271,7 @@ namespace Test { namespace Int { namespace Unary { class Create { public: /// Perform creation and registration - Create(void) { + Create() { using namespace Gecode; IntArgs p1({2, 2, 2, 2}); IntArgs p10({2, 2, 0, 2, 2}); @@ -348,6 +344,6 @@ namespace Test { namespace Int { namespace Unary { Create c; //@} -}}} // namespace Test::Int::Unary +} // namespace Test::Int::Unary // STATISTICS: test-int diff --git a/test/int/unshare.cpp b/test/int/unshare.cpp index f8fa09fcb4..250697dc15 100644 --- a/test/int/unshare.cpp +++ b/test/int/unshare.cpp @@ -34,100 +34,96 @@ #include -namespace Test { namespace Int { +/// %Tests for unsharing variables in arrays +namespace Test::Int::Unshare { - /// %Tests for unsharing variables in arrays - namespace Unshare { + /** + * \defgroup TaskTestIntUnshare Unsharing variables in arrays + * \ingroup TaskTestInt + */ + //@{ + /// %Test for unsharing integer variables + class Int : public Test { + public: + /// Create and register test + Int(Gecode::IntPropLevel ipl) : Test("Unshare::Int::" + str(ipl), 9, -1, 1, false, ipl) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return ((x[0] == x[3]) && (x[1] == x[4]) && (x[1] == x[6]) && (x[2] == x[5]) && (x[2] == x[7]) && + (x[2] == x[8])); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + IntVarArgs y(6); + y[0] = x[0]; + y[1] = y[3] = x[1]; + y[2] = y[4] = y[5] = x[2]; + unshare(home, y, ipl); + for (int i = 0; i < 6; i++) + rel(home, y[i], IRT_EQ, x[3 + i], IPL_DOM); + } + }; - /** - * \defgroup TaskTestIntUnshare Unsharing variables in arrays - * \ingroup TaskTestInt - */ - //@{ - /// %Test for unsharing integer variables - class Int : public Test { - public: - /// Create and register test - Int(Gecode::IntPropLevel ipl) : Test("Unshare::Int::" + str(ipl), 9, -1, 1, false, ipl) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return ((x[0] == x[3]) && (x[1] == x[4]) && (x[1] == x[6]) && (x[2] == x[5]) && (x[2] == x[7]) && - (x[2] == x[8])); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - IntVarArgs y(6); - y[0] = x[0]; - y[1] = y[3] = x[1]; - y[2] = y[4] = y[5] = x[2]; - unshare(home, y, ipl); - for (int i = 0; i < 6; i++) - rel(home, y[i], IRT_EQ, x[3 + i], IPL_DOM); - } - }; + /// %Test for unsharing Boolean variables + class Bool : public Test { + public: + /// Create and register test + Bool() : Test("Unshare::Bool", 9, 0, 1, false) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + return ((x[0] == x[3]) && (x[1] == x[4]) && (x[1] == x[6]) && (x[2] == x[5]) && (x[2] == x[7]) && + (x[2] == x[8])); + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + BoolVarArgs y(6); + y[0] = channel(home, x[0]); + y[1] = y[3] = channel(home, x[1]); + y[2] = y[4] = y[5] = channel(home, x[2]); + unshare(home, y); + for (int i = 0; i < 6; i++) + rel(home, y[i], IRT_EQ, channel(home, x[3 + i])); + } + }; - /// %Test for unsharing Boolean variables - class Bool : public Test { - public: - /// Create and register test - Bool(void) : Test("Unshare::Bool", 9, 0, 1, false) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - return ((x[0] == x[3]) && (x[1] == x[4]) && (x[1] == x[6]) && (x[2] == x[5]) && (x[2] == x[7]) && - (x[2] == x[8])); - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - BoolVarArgs y(6); - y[0] = channel(home, x[0]); - y[1] = y[3] = channel(home, x[1]); - y[2] = y[4] = y[5] = channel(home, x[2]); - unshare(home, y); - for (int i = 0; i < 6; i++) - rel(home, y[i], IRT_EQ, channel(home, x[3 + i])); - } - }; + /// %Test for unsharing in failed spaces + class Failed : public Test { + public: + /// Create and register test + Failed() : Test("Unshare::Failed", 1, -1, 1) {} + /// %Test whether \a x is solution + bool + solution(const Assignment& x) const override { + (void)x; + return false; + } + /// Post constraint on \a x + void + post(Gecode::Space& home, Gecode::IntVarArray& x) override { + using namespace Gecode; + home.fail(); + IntVarArgs y(2); + y[0] = x[0]; + y[1] = x[0]; + unshare(home, y); + REG r(1); + extensional(home, y, r); + } + }; - /// %Test for unsharing in failed spaces - class Failed : public Test { - public: - /// Create and register test - Failed(void) : Test("Unshare::Failed", 1, -1, 1) {} - /// %Test whether \a x is solution - bool - solution(const Assignment& x) const override { - (void)x; - return false; - } - /// Post constraint on \a x - void - post(Gecode::Space& home, Gecode::IntVarArray& x) override { - using namespace Gecode; - home.fail(); - IntVarArgs y(2); - y[0] = x[0]; - y[1] = x[0]; - unshare(home, y); - REG r(1); - extensional(home, y, r); - } - }; + Int i_bnd(Gecode::IPL_BND); + Int i_dom(Gecode::IPL_DOM); - Int i_bnd(Gecode::IPL_BND); - Int i_dom(Gecode::IPL_DOM); + Bool b; - Bool b; - - Failed f; - //@} - - } // namespace Unshare -}} // namespace Test::Int + Failed f; + //@} +} // namespace Test::Int::Unshare // STATISTICS: test-int diff --git a/test/ldsb.cpp b/test/ldsb.cpp index 251df711a6..572f43f6f4 100644 --- a/test/ldsb.cpp +++ b/test/ldsb.cpp @@ -38,7 +38,6 @@ #ifdef GECODE_HAS_SET_VARS #include #include -#include #endif #include @@ -52,13 +51,13 @@ * \namespace Test::LDSB * \brief Testing for LDSB */ -namespace Test { namespace LDSB { +namespace Test::LDSB { using namespace Gecode; /// Returns true iff a and b are equal (they have the same size and /// the same elements in the same positions). - bool + static bool equal(const IntArgs& a, const IntArgs& b) { if (a.size() != b.size()) return false; @@ -71,7 +70,7 @@ namespace Test { namespace LDSB { #ifdef GECODE_HAS_SET_VARS /// Returns true iff a and b are equal (they have the same size and /// the same elements in the same positions). - bool + static bool equal(const IntSetArgs& a, const IntSetArgs& b) { if (a.size() != b.size()) return false; @@ -103,7 +102,7 @@ namespace Test { namespace LDSB { * prints an explanation to standard error and returns false. */ template - bool + static bool check(DFS& e, std::vector expected) { int expected_count = expected.size(); for (int i = 0; i < expected_count; ++i) { @@ -153,12 +152,12 @@ namespace Test { namespace LDSB { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new OneArray(*this); } /// Return the solution as IntArgs IntArgs - solution(void) { + solution() { IntArgs a(xs.size()); for (int i = 0; i < a.size(); ++i) a[i] = xs[i].val(); @@ -166,7 +165,7 @@ namespace Test { namespace LDSB { } /// Expected solutions virtual IntArgs* - expected_solutions(void) { + expected_solutions() { return nullptr; } }; @@ -185,12 +184,12 @@ namespace Test { namespace LDSB { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new OneArraySet(*this); } /// Return the solution as IntSetArgs IntSetArgs - solution(void) { + solution() { IntSetArgs a(xs.size()); for (int i = 0; i < a.size(); ++i) { SetVarGlbRanges glbranges(xs[i]); @@ -200,7 +199,7 @@ namespace Test { namespace LDSB { } /// Expected solutions virtual IntSetArgs* - expected_solutions(void) { + expected_solutions() { return nullptr; } }; @@ -219,7 +218,7 @@ namespace Test { namespace LDSB { : Test::Base("LDSB::" + label), c_d(c), a_d(a) {} /// Perform actual tests bool - run(void) override { + run() override { OneArray* s = new OneArray(T::n, T::l, T::u); T::setup(*s, s->xs); Search::Options o = Search::Options::def; @@ -248,7 +247,7 @@ namespace Test { namespace LDSB { : Test::Base("LDSB::" + label), c_d(c), a_d(a) {} /// Perform actual tests bool - run(void) override { + run() override { OneArraySet* s = new OneArraySet(T::n, T::l, T::u); T::setup(*s, s->xs); Search::Options o = Search::Options::def; @@ -286,7 +285,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 1, 2, 3})); @@ -313,7 +312,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 1, 2, 3})); @@ -340,7 +339,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 0, 0, 0})); @@ -401,7 +400,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 1, 2, 3})); @@ -441,7 +440,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 1, 2})); @@ -475,7 +474,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 1, 2, 3})); @@ -507,7 +506,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 0, 0, 0, 0, 0})); @@ -559,7 +558,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 0, 0, 0, 0, 0})); @@ -622,7 +621,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 0, 0, 0, 0, 0})); @@ -668,7 +667,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 0, 0, 0})); @@ -712,7 +711,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 0, 3, 1, 0, 2, 2, 0, 1, 3, 0, 0})); @@ -783,7 +782,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 0, 3, 1, 0, 2, 2, 0, 1, 3, 0, 0})); @@ -815,7 +814,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 6})); @@ -859,7 +858,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 1, 5})); @@ -888,7 +887,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({3, 3})); @@ -919,7 +918,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { return SimIntValSym3::expected_solutions(); } }; @@ -944,7 +943,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 1, 2, 3})); @@ -971,7 +970,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 1, 2, 3})); @@ -998,7 +997,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({3, 2, 1, 0})); @@ -1025,7 +1024,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 0, 0, 0})); @@ -1065,7 +1064,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 0, 0, 0})); @@ -1107,7 +1106,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 1, 2, 3})); @@ -1146,7 +1145,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 1, 2})); @@ -1181,7 +1180,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 1, 2, 3})); @@ -1213,7 +1212,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 0, 0, 0})); @@ -1252,11 +1251,11 @@ namespace Test { namespace LDSB { xs.update(*this, s.xs); } Space* - copy(void) override { + copy() override { return new Latin(*this); } IntArgs - solution(void) { + solution() { IntArgs a(xs.size()); for (int i = 0; i < a.size(); ++i) a[i] = xs[i].val(); @@ -1265,7 +1264,7 @@ namespace Test { namespace LDSB { /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({1, 2, 3, 4, 2, 1, 4, 3, 3, 4, 1, 2, 4, 3, 2, 1})); @@ -1279,7 +1278,7 @@ namespace Test { namespace LDSB { LDSBLatin(const std::string& label) : Test::Base("LDSB::" + label) {} /// Perform actual tests bool - run(void) override { + run() override { Latin* s = new Latin(); DFS e(s); bool r = check(e, Latin::expected_solutions()); @@ -1340,7 +1339,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 0, 0, 0})); @@ -1366,7 +1365,7 @@ namespace Test { namespace LDSB { } }; - double + static double position(const Space& home, IntVar x, int i) { (void)home; (void)x; @@ -1402,7 +1401,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({3, 2, 0, 1})); @@ -1412,15 +1411,15 @@ namespace Test { namespace LDSB { #ifdef GECODE_HAS_SET_VARS /// Convenient way to make IntSetArgs - IntSetArgs - isa(int n, ...) { + template + static IntSetArgs + isa(int n, Values... values) { IntSetArgs sets; - va_list args; - va_start(args, n); int i = 0; IntArgs a; - while (i < n) { - int x = va_arg(args, int); + for (int x : {values...}) { + if (i == n) + break; if (x == -1) { i++; sets << IntSet(a); @@ -1429,7 +1428,6 @@ namespace Test { namespace LDSB { a << x; } } - va_end(args); return sets; } @@ -1451,7 +1449,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(isa(2, 0, 1, -1, 0, 1, -1)); @@ -1503,7 +1501,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(isa(2, 0, 1, -1, 0, 1, -1)); @@ -1546,7 +1544,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(isa(3, 1, -1, 1, -1, 1, -1)); @@ -1580,7 +1578,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(isa(4, 0, -1, 1, -1, 0, -1, 1, -1)); @@ -1610,7 +1608,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); @@ -1664,7 +1662,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 1, 2, 3, 4, 5})); @@ -1693,7 +1691,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 0})); @@ -1728,7 +1726,7 @@ namespace Test { namespace LDSB { } /// Compute list of expected solutions static std::vector - expected_solutions(void) { + expected_solutions() { static std::vector expected; expected.clear(); expected.push_back(IntArgs({0, 1, 2, 3})); @@ -1753,7 +1751,7 @@ namespace Test { namespace LDSB { } /// Copy during cloning Space* - copy(void) override { + copy() override { return new EmptyFixture(*this); } }; @@ -1767,7 +1765,7 @@ namespace Test { namespace LDSB { /// Return the symmetries described by \a spec for the variables \a x template - Symmetries + static Symmetries symmetries(SymmetrySpec spec, const VarArgs& x) { Symmetries s; if (spec == SymmetrySpec::NONE) @@ -1789,7 +1787,7 @@ namespace Test { namespace LDSB { /// Return the number of solutions of \a s and delete \a s template - int + static int count_solutions(T* s) { DFS e(s); delete s; @@ -1839,10 +1837,10 @@ namespace Test { namespace LDSB { public: /// Initialize test - EmptyInt(void) : Base("LDSB::EmptyInt") {} + EmptyInt() : Base("LDSB::EmptyInt") {} /// Perform actual tests bool - run(void) override { + run() override { for (bool tie : {false, true}) if ((solutions(0, SymmetrySpec::NONE, tie) != 1) || (solutions(0, SymmetrySpec::EMPTY, tie) != 1) || (solutions(2, SymmetrySpec::NONE, tie) != 4) || (solutions(2, SymmetrySpec::EMPTY, tie) != 4) || @@ -1872,10 +1870,10 @@ namespace Test { namespace LDSB { public: /// Initialize test - EmptyBool(void) : Base("LDSB::EmptyBool") {} + EmptyBool() : Base("LDSB::EmptyBool") {} /// Perform actual tests bool - run(void) override { + run() override { for (bool tie : {false, true}) if ((solutions(0, SymmetrySpec::NONE, tie) != 1) || (solutions(0, SymmetrySpec::EMPTY, tie) != 1) || (solutions(2, SymmetrySpec::NONE, tie) != 4) || (solutions(2, SymmetrySpec::EMPTY, tie) != 4) || @@ -1889,10 +1887,10 @@ namespace Test { namespace LDSB { class LiteralCompare : public Base { public: /// Initialize test - LiteralCompare(void) : Base("LDSB::Literal::Compare") {} + LiteralCompare() : Base("LDSB::Literal::Compare") {} /// Perform actual tests bool - run(void) override { + run() override { using Gecode::Int::LDSB::Literal; const Literal l(0, 1); const Literal l_copy(l); @@ -1923,10 +1921,10 @@ namespace Test { namespace LDSB { public: /// Initialize test - EmptySet(void) : Base("LDSB::EmptySet") {} + EmptySet() : Base("LDSB::EmptySet") {} /// Perform actual tests bool - run(void) override { + run() override { for (bool tie : {false, true}) if ((solutions(0, SymmetrySpec::NONE, tie) != 1) || (solutions(0, SymmetrySpec::EMPTY, tie) != 1) || (solutions(2, SymmetrySpec::NONE, tie) != 4) || (solutions(2, SymmetrySpec::EMPTY, tie) != 4) || @@ -1981,6 +1979,6 @@ namespace Test { namespace LDSB { LDSBSet setvarseqsym2("SetVarSeqSym2"); EmptySet empty_set; #endif -}} // namespace Test::LDSB +} // namespace Test::LDSB // STATISTICS: test-core diff --git a/test/nogoods.cpp b/test/nogoods.cpp index 08a5f6c7ec..2a8880b382 100644 --- a/test/nogoods.cpp +++ b/test/nogoods.cpp @@ -39,291 +39,287 @@ #include "test/test.hh" -namespace Test { +/// Tests for search using no-goods +namespace Test::NoGoods { - /// Tests for search using no-goods - namespace NoGoods { + using namespace Gecode; - using namespace Gecode; + /// A dummy function for branching + static void + dummy(Space&) {} - /// A dummy function for branching - void - dummy(Space&) {} - - /// Example for testing integer no-goods - class Queens : public Space { - public: - /// Number of queens (must be even) - const static int n = 18; - /// Position of queens on boards - IntVarArray q; - /// The actual problem - Queens(const IntValBranch& ivb, bool assign, bool null) : q(*this, n, 0, n - 1) { - distinct(*this, IntArgs::create(n, 0, 1), q, IPL_VAL); - distinct(*this, IntArgs::create(n, 0, -1), q, IPL_VAL); - distinct(*this, q, IPL_VAL); - if (assign) { - IntVar x(*this, 0, 1); - Gecode::assign(*this, x, INT_ASSIGN_MIN()); - } - { - IntVarArgs q1(n / 2), q2(n / 2); - for (int i = 0; i < n / 2; i++) { - q1[i] = q[i]; - q2[i] = q[n / 2 + i]; - } - branch(*this, q1, INT_VAR_NONE(), ivb); - if (null) - branch(*this, &dummy); - branch(*this, q2, INT_VAR_NONE(), ivb); - } - if (assign) { - IntVar x(*this, 0, 1); - Gecode::assign(*this, x, INT_ASSIGN_MIN()); - } - } - /// Constructor for cloning \a s - Queens(Queens& s) : Space(s) { - q.update(*this, s.q); + /// Example for testing integer no-goods + class Queens : public Space { + public: + /// Number of queens (must be even) + const static int n = 18; + /// Position of queens on boards + IntVarArray q; + /// The actual problem + Queens(const IntValBranch& ivb, bool assign, bool null) : q(*this, n, 0, n - 1) { + distinct(*this, IntArgs::create(n, 0, 1), q, IPL_VAL); + distinct(*this, IntArgs::create(n, 0, -1), q, IPL_VAL); + distinct(*this, q, IPL_VAL); + if (assign) { + IntVar x(*this, 0, 1); + Gecode::assign(*this, x, INT_ASSIGN_MIN()); } - /// Perform copying during cloning - Space* - copy(void) override { - return new Queens(*this); - } - /// Check whether two solutions are the same - bool - same(const Queens& s) const { - for (int i = 0; i < q.size(); i++) - if (q[i].val() != s.q[i].val()) - return false; - return true; - } - /// Return increment for node stop - static unsigned int - node_increment(void) { - return 500; + { + IntVarArgs q1(n / 2), q2(n / 2); + for (int i = 0; i < n / 2; i++) { + q1[i] = q[i]; + q2[i] = q[n / 2 + i]; + } + branch(*this, q1, INT_VAR_NONE(), ivb); + if (null) + branch(*this, &dummy); + branch(*this, q2, INT_VAR_NONE(), ivb); } - /// Return name - static std::string - name(void) { - return "Queens"; + if (assign) { + IntVar x(*this, 0, 1); + Gecode::assign(*this, x, INT_ASSIGN_MIN()); } - /// Return name for branching - static std::string - val(const IntValBranch& ivb) { - switch (ivb.select()) { - case IntValBranch::SEL_MIN: - return "INT_VAL_MIN"; - case IntValBranch::SEL_MAX: - return "INT_VAL_MAX"; - case IntValBranch::SEL_SPLIT_MIN: - return "INT_VAL_SPLIT_MIN"; - case IntValBranch::SEL_SPLIT_MAX: - return "INT_VAL_SPLIT_MAX"; - case IntValBranch::SEL_VALUES_MIN: - return "INT_VALUES_MIN"; - case IntValBranch::SEL_VALUES_MAX: - return "INT_VALUES_MAX"; - default: - GECODE_NEVER; - } - return ""; + } + /// Constructor for cloning \a s + Queens(Queens& s) : Space(s) { + q.update(*this, s.q); + } + /// Perform copying during cloning + Space* + copy() override { + return new Queens(*this); + } + /// Check whether two solutions are the same + bool + same(const Queens& s) const { + for (int i = 0; i < q.size(); i++) + if (q[i].val() != s.q[i].val()) + return false; + return true; + } + /// Return increment for node stop + static unsigned int + node_increment() { + return 500; + } + /// Return name + static std::string + name() { + return "Queens"; + } + /// Return name for branching + static std::string + val(const IntValBranch& ivb) { + switch (ivb.select()) { + case IntValBranch::SEL_MIN: + return "INT_VAL_MIN"; + case IntValBranch::SEL_MAX: + return "INT_VAL_MAX"; + case IntValBranch::SEL_SPLIT_MIN: + return "INT_VAL_SPLIT_MIN"; + case IntValBranch::SEL_SPLIT_MAX: + return "INT_VAL_SPLIT_MAX"; + case IntValBranch::SEL_VALUES_MIN: + return "INT_VALUES_MIN"; + case IntValBranch::SEL_VALUES_MAX: + return "INT_VALUES_MAX"; + default: + GECODE_NEVER; } - }; + return ""; + } + }; #ifdef GECODE_HAS_SET_VARS - /// Example for testing set no-goods - class Hamming : public Space { - private: - /// Number of symbols (must be even) - static const int size = 16; - /// Minimal Hamming-distance - static const int distance = 4; - /// Number of bits - static const int bits = 8; - /// The hamming code - SetVarArray x; + /// Example for testing set no-goods + class Hamming : public Space { + private: + /// Number of symbols (must be even) + static const int size = 16; + /// Minimal Hamming-distance + static const int distance = 4; + /// Number of bits + static const int bits = 8; + /// The hamming code + SetVarArray x; - public: - /// Actual model - Hamming(const SetValBranch& svb, bool assign, bool null) : x(*this, size, IntSet::empty, 1, bits) { - SetVarArgs cx(x.size()); - for (int i = x.size(); i--;) - cx[i] = expr(*this, -x[i]); + public: + /// Actual model + Hamming(const SetValBranch& svb, bool assign, bool null) : x(*this, size, IntSet::empty, 1, bits) { + SetVarArgs cx(x.size()); + for (int i = x.size(); i--;) + cx[i] = expr(*this, -x[i]); - for (int i = 0; i < x.size(); i++) - for (int j = i + 1; j < x.size(); j++) - rel(*this, cardinality(x[j] & cx[i]) + cardinality(x[i] & cx[j]) >= distance); + for (int i = 0; i < x.size(); i++) + for (int j = i + 1; j < x.size(); j++) + rel(*this, cardinality(x[j] & cx[i]) + cardinality(x[i] & cx[j]) >= distance); - if (assign) { - IntVar x(*this, 0, 1); - Gecode::assign(*this, x, INT_ASSIGN_MIN()); - } - { - SetVarArgs x1(size / 2), x2(size / 2); - for (int i = 0; i < size / 2; i++) { - x1[i] = x[i]; - x2[i] = x[size / 2 + i]; - } - branch(*this, x1, SET_VAR_NONE(), svb); - if (null) - branch(*this, &dummy); - branch(*this, x2, SET_VAR_NONE(), svb); - } - if (assign) { - IntVar x(*this, 0, 1); - Gecode::assign(*this, x, INT_ASSIGN_MIN()); - } - } - /// Constructor for copying \a s - Hamming(Hamming& s) : Space(s) { - x.update(*this, s.x); + if (assign) { + IntVar x(*this, 0, 1); + Gecode::assign(*this, x, INT_ASSIGN_MIN()); } - /// Copy during cloning - Space* - copy(void) override { - return new Hamming(*this); - } - /// Check whether two solutions are the same - bool - same(const Hamming& s) const { - for (int i = 0; i < x.size(); i++) { - SetVarGlbRanges a(x[i]), b(s.x[i]); - if (!Iter::Ranges::equal(a, b)) - return false; + { + SetVarArgs x1(size / 2), x2(size / 2); + for (int i = 0; i < size / 2; i++) { + x1[i] = x[i]; + x2[i] = x[size / 2 + i]; } - return true; + branch(*this, x1, SET_VAR_NONE(), svb); + if (null) + branch(*this, &dummy); + branch(*this, x2, SET_VAR_NONE(), svb); } - /// Return increment for node stop - static unsigned int - node_increment(void) { - return 35; + if (assign) { + IntVar x(*this, 0, 1); + Gecode::assign(*this, x, INT_ASSIGN_MIN()); } - /// Return name - static std::string - name(void) { - return "Hamming"; + } + /// Constructor for copying \a s + Hamming(Hamming& s) : Space(s) { + x.update(*this, s.x); + } + /// Copy during cloning + Space* + copy() override { + return new Hamming(*this); + } + /// Check whether two solutions are the same + bool + same(const Hamming& s) const { + for (int i = 0; i < x.size(); i++) { + SetVarGlbRanges a(x[i]), b(s.x[i]); + if (!Iter::Ranges::equal(a, b)) + return false; } - /// Return name for branching - static std::string - val(const SetValBranch& svb) { - switch (svb.select()) { - case SetValBranch::SEL_MIN_INC: - return "SET_VAL_MIN_INC"; - case SetValBranch::SEL_MAX_INC: - return "SET_VAL_MAX_INC"; - case SetValBranch::SEL_MIN_EXC: - return "SET_VAL_MIN_EXC"; - case SetValBranch::SEL_MAX_EXC: - return "SET_VAL_MAX_EXC"; - default: - GECODE_NEVER; - } - return ""; + return true; + } + /// Return increment for node stop + static unsigned int + node_increment() { + return 35; + } + /// Return name + static std::string + name() { + return "Hamming"; + } + /// Return name for branching + static std::string + val(const SetValBranch& svb) { + switch (svb.select()) { + case SetValBranch::SEL_MIN_INC: + return "SET_VAL_MIN_INC"; + case SetValBranch::SEL_MAX_INC: + return "SET_VAL_MAX_INC"; + case SetValBranch::SEL_MIN_EXC: + return "SET_VAL_MIN_EXC"; + case SetValBranch::SEL_MAX_EXC: + return "SET_VAL_MAX_EXC"; + default: + GECODE_NEVER; } - }; + return ""; + } + }; #endif - /// %Base class for no-good tests - template - class NoGoods : public Base { - protected: - /// How to branch - ValBranch vb; - /// Number of threads to use - unsigned int t; - /// Whether to also assign some variables - bool a; - /// Whether to also create branchers without no-good literals - bool n; + /// %Base class for no-good tests + template + class NoGoods : public Base { + protected: + /// How to branch + ValBranch vb; + /// Number of threads to use + unsigned int t; + /// Whether to also assign some variables + bool a; + /// Whether to also create branchers without no-good literals + bool n; - public: - /// Map unsigned integer to string - static std::string - str(unsigned int i) { - std::stringstream s; - s << i; - return s.str(); - } - /// Initialize test - NoGoods(TestTags tags, ValBranch vb0, unsigned int t0, bool a0, bool n0) - : Base("NoGoods::" + Model::name() + "::" + Model::val(vb0) + "::" + str(t0) + "::" + (a0 ? "+" : "-") + - "::" + (n0 ? "+" : "-"), - tags), - vb(std::move(vb0)), t(t0), a(a0), n(n0) {} - /// Run test - bool - run(void) override { - Model* m = new Model(vb, a, n); - // Solution without no-goods - Model* s_plain = dfs(m); - // Stop and re-start for a while to collect no-goods - { - Search::NodeStop ns(Model::node_increment()); - Search::Options o; - o.stop = &ns; - o.threads = t; - o.nogoods_limit = 256U; - Search::Engine* e = Search::make_dfs_engine(m, o); - while (true) { - Model* s = static_cast(e->next()); - delete s; - if (e->end_reason() != Search::EndReason::Limit) - break; - // Add no-goods - e->nogoods().post(*m); - ns.limit(ns.limit() + Model::node_increment()); - } - delete e; + public: + /// Map unsigned integer to string + static std::string + str(unsigned int i) { + std::stringstream s; + s << i; + return s.str(); + } + /// Initialize test + NoGoods(TestTags tags, ValBranch vb0, unsigned int t0, bool a0, bool n0) + : Base("NoGoods::" + Model::name() + "::" + Model::val(vb0) + "::" + str(t0) + "::" + (a0 ? "+" : "-") + + "::" + (n0 ? "+" : "-"), + tags), + vb(std::move(vb0)), t(t0), a(a0), n(n0) {} + /// Run test + bool + run() override { + Model* m = new Model(vb, a, n); + // Solution without no-goods + Model* s_plain = dfs(m); + // Stop and re-start for a while to collect no-goods + { + Search::NodeStop ns(Model::node_increment()); + Search::Options o; + o.stop = &ns; + o.threads = t; + o.nogoods_limit = 256U; + Search::Engine* e = Search::make_dfs_engine(m, o); + while (true) { + Model* s = static_cast(e->next()); + delete s; + if (e->end_reason() != Search::EndReason::Limit) + break; + // Add no-goods + e->nogoods().post(*m); + ns.limit(ns.limit() + Model::node_increment()); } - // Compare whether the a or the same solution is found with no-goods - Model* s_nogoods = dfs(m); + delete e; + } + // Compare whether the a or the same solution is found with no-goods + Model* s_nogoods = dfs(m); - bool ok = ((s_nogoods != nullptr) && ((t != 1) || s_plain->same(*s_nogoods))); + bool ok = ((s_nogoods != nullptr) && ((t != 1) || s_plain->same(*s_nogoods))); - delete m; - delete s_nogoods; - delete s_plain; + delete m; + delete s_nogoods; + delete s_plain; - return ok; - } - }; + return ok; + } + }; - /// Help class to create and register tests - class Create { - public: - /// Perform creation and registration - Create(void) { - bool a = false; + /// Help class to create and register tests + class Create { + public: + /// Perform creation and registration + Create() { + bool a = false; + do { + bool n = false; do { - bool n = false; - do { - for (unsigned int t = 1; t <= 4; t++) { - TestTags queens = TestTags::check(); - (void)new NoGoods(queens, INT_VAL_MIN(), t, a, n); - (void)new NoGoods(queens, INT_VAL_MAX(), t, a, n); - (void)new NoGoods(queens, INT_VAL_SPLIT_MIN(), t, a, n); - (void)new NoGoods(queens, INT_VAL_SPLIT_MAX(), t, a, n); - (void)new NoGoods(queens, INT_VALUES_MIN(), t, a, n); - (void)new NoGoods(queens, INT_VALUES_MAX(), t, a, n); + for (unsigned int t = 1; t <= 4; t++) { + TestTags queens = TestTags::check(); + (void)new NoGoods(queens, INT_VAL_MIN(), t, a, n); + (void)new NoGoods(queens, INT_VAL_MAX(), t, a, n); + (void)new NoGoods(queens, INT_VAL_SPLIT_MIN(), t, a, n); + (void)new NoGoods(queens, INT_VAL_SPLIT_MAX(), t, a, n); + (void)new NoGoods(queens, INT_VALUES_MIN(), t, a, n); + (void)new NoGoods(queens, INT_VALUES_MAX(), t, a, n); #ifdef GECODE_HAS_SET_VARS - (void)new NoGoods(TestTags::standard(), SET_VAL_MIN_INC(), t, a, n); - (void)new NoGoods(TestTags::standard(), SET_VAL_MIN_EXC(), t, a, n); - (void)new NoGoods(TestTags::standard(), SET_VAL_MAX_INC(), t, a, n); - (void)new NoGoods(TestTags::standard(), SET_VAL_MAX_EXC(), t, a, n); + (void)new NoGoods(TestTags::standard(), SET_VAL_MIN_INC(), t, a, n); + (void)new NoGoods(TestTags::standard(), SET_VAL_MIN_EXC(), t, a, n); + (void)new NoGoods(TestTags::standard(), SET_VAL_MAX_INC(), t, a, n); + (void)new NoGoods(TestTags::standard(), SET_VAL_MAX_EXC(), t, a, n); #endif - } - n = !n; - } while (n); - a = !a; - } while (a); - } - }; - - Create c; - } // namespace NoGoods + } + n = !n; + } while (n); + a = !a; + } while (a); + } + }; -} // namespace Test + Create c; +} // namespace Test::NoGoods // STATISTICS: test-search diff --git a/test/package/allocator/main.cpp b/test/package/allocator/main.cpp index 8239ae2bb6..cbfe23d3e2 100644 --- a/test/package/allocator/main.cpp +++ b/test/package/allocator/main.cpp @@ -13,7 +13,7 @@ #endif int -main(void) { +main() { void* p = Gecode::heap.ralloc(256); #ifdef CHECK_HOST_MIMALLOC void* host = mi_malloc(256); diff --git a/test/public-float-smoke.cpp b/test/public-float-smoke.cpp index d5c07290d6..f09f61dcc9 100644 --- a/test/public-float-smoke.cpp +++ b/test/public-float-smoke.cpp @@ -41,7 +41,7 @@ namespace { class FloatSmokeTest : public Test::Float::Test { public: - FloatSmokeTest(void) + FloatSmokeTest() : ::Test::Float::Test("Public::Smoke", 1, 0.0, 1.0, 1.0, ::Test::Float::COMPLETE_ASSIGNMENT, false) {} ::Test::Float::MaybeType diff --git a/test/public-int-smoke.cpp b/test/public-int-smoke.cpp index c397066a1c..57400bd0d1 100644 --- a/test/public-int-smoke.cpp +++ b/test/public-int-smoke.cpp @@ -41,7 +41,7 @@ namespace { class AbsSmokeTest : public Test::Int::Test { public: - AbsSmokeTest(void) : ::Test::Int::Test("Public::Smoke::Abs", 2, -2, 2) {} + AbsSmokeTest() : ::Test::Int::Test("Public::Smoke::Abs", 2, -2, 2) {} bool solution(const ::Test::Int::Assignment& x) const override { diff --git a/test/public-runner-smoke.cpp b/test/public-runner-smoke.cpp index 92201fc9bf..11188aa7c2 100644 --- a/test/public-runner-smoke.cpp +++ b/test/public-runner-smoke.cpp @@ -46,10 +46,10 @@ namespace { class PassingSmokeTest : public Test::Base { public: - PassingSmokeTest(void) : Test::Base("Smoke::A-Pass") {} + PassingSmokeTest() : Test::Base("Smoke::A-Pass") {} bool - run(void) override { + run() override { passing_runs++; return true; } @@ -57,10 +57,10 @@ namespace { class FailingSmokeTest : public Test::Base { public: - FailingSmokeTest(void) : Test::Base("Smoke::B-Fail", Test::TestTags::sweep()) {} + FailingSmokeTest() : Test::Base("Smoke::B-Fail", Test::TestTags::sweep()) {} bool - run(void) override { + run() override { failing_runs++; return false; } @@ -70,9 +70,9 @@ namespace { int replay_runs = 0; class ReplaySmokeTest : public Test::Base { public: - ReplaySmokeTest(void) : Test::Base("Smoke::Replay", Test::TestTags()) {} + ReplaySmokeTest() : Test::Base("Smoke::Replay", Test::TestTags()) {} bool - run(void) override { + run() override { if (++replay_runs == 1) { (void)_rand.next(); return true; @@ -111,7 +111,7 @@ namespace { } // namespace int -main(void) { +main() { std::string list_output; if (!require(run_and_capture({"public-runner-smoke", "-list"}, list_output) == EXIT_SUCCESS, "-list should succeed")) { @@ -139,12 +139,10 @@ main(void) { "-list-with-tags should succeed")) { return EXIT_FAILURE; } - if (!require(tagged_list_output.find(pass_name + " [standard]") != std::string::npos, - "default test should have the standard tag")) { + if (!require(tagged_list_output.contains(pass_name + " [standard]"), "default test should have the standard tag")) { return EXIT_FAILURE; } - if (!require(tagged_list_output.find("Smoke::B-Fail [sweep]") != std::string::npos, - "explicit test tag should be listed")) { + if (!require(tagged_list_output.contains("Smoke::B-Fail [sweep]"), "explicit test tag should be listed")) { return EXIT_FAILURE; } @@ -154,8 +152,7 @@ main(void) { "standard tag selection should succeed")) { return EXIT_FAILURE; } - if (!require(normal_output.find(pass_name) != std::string::npos && - normal_output.find(fail_name) == std::string::npos, + if (!require(normal_output.contains(pass_name) && !normal_output.contains(fail_name), "standard tag selection chose the wrong tests")) { return EXIT_FAILURE; } @@ -169,12 +166,10 @@ main(void) { "filtered passing run should succeed")) { return EXIT_FAILURE; } - if (!require(pass_output.find(pass_name) != std::string::npos, - "filtered passing run did not print the selected test")) { + if (!require(pass_output.contains(pass_name), "filtered passing run did not print the selected test")) { return EXIT_FAILURE; } - if (!require(pass_output.find(fail_name) == std::string::npos, - "filtered passing run executed an unselected test")) { + if (!require(!pass_output.contains(fail_name), "filtered passing run executed an unselected test")) { return EXIT_FAILURE; } if (!require(passing_runs == 2 && failing_runs == 0, "filtered passing run counts are wrong")) { @@ -187,15 +182,13 @@ main(void) { "filtered failing run should fail")) { return EXIT_FAILURE; } - if (!require(fail_output.find(fail_name) != std::string::npos, - "filtered failing run did not print the selected test")) { + if (!require(fail_output.contains(fail_name), "filtered failing run did not print the selected test")) { return EXIT_FAILURE; } - if (!require(fail_output.find("Options: -replay ") != std::string::npos, - "filtered failing run did not preserve seed diagnostics")) { + if (!require(fail_output.contains("Options: -replay "), "filtered failing run did not preserve seed diagnostics")) { return EXIT_FAILURE; } - if (!require(fail_output.find("-test 'Smoke::B-Fail'") != std::string::npos, + if (!require(fail_output.contains("-test 'Smoke::B-Fail'"), "filtered failing run did not preserve test diagnostics")) { return EXIT_FAILURE; } @@ -210,7 +203,7 @@ main(void) { "seed-sensitive test should fail on its second iteration")) return EXIT_FAILURE; const std::string state = observed_state; - if (!require(replay_output.find("Options: -replay " + state) != std::string::npos, + if (!require(replay_output.contains("Options: -replay " + state), "failure should report the iteration's initial random state")) return EXIT_FAILURE; if (!require(run_and_capture({"public-runner-smoke", "-test", "Smoke::Replay", "-replay", state.c_str()}, @@ -226,8 +219,7 @@ main(void) { "multiple tags should select their union")) { return EXIT_FAILURE; } - if (!require(combined_output.find(pass_name) != std::string::npos && - combined_output.find(fail_name) != std::string::npos, + if (!require(combined_output.contains(pass_name) && combined_output.contains(fail_name), "multiple tag selection did not run both tags")) { return EXIT_FAILURE; } diff --git a/test/public-set-smoke.cpp b/test/public-set-smoke.cpp index 76e189299b..01beb27dcb 100644 --- a/test/public-set-smoke.cpp +++ b/test/public-set-smoke.cpp @@ -42,7 +42,7 @@ namespace { class SetSmokeTest : public Test::Set::SetTest { public: - SetSmokeTest(void) : Test::Set::SetTest("Public::Smoke", 1, Gecode::IntSet(0, 1)) {} + SetSmokeTest() : Test::Set::SetTest("Public::Smoke", 1, Gecode::IntSet(0, 1)) {} bool solution(const Test::Set::SetAssignment&) const override { diff --git a/test/random.cpp b/test/random.cpp index 016e22a454..688a63da84 100644 --- a/test/random.cpp +++ b/test/random.cpp @@ -35,7 +35,7 @@ #include #include -namespace Test { namespace Random { +namespace Test::Random { using namespace Gecode::Support; // A user engine with extra state exercises the public engine contract. @@ -125,7 +125,7 @@ namespace Test { namespace Random { }; template - bool + static bool replay() { Gecode::Support::Random original(UINT64_MAX); Gecode::Support::Random restored; @@ -141,9 +141,7 @@ namespace Test { namespace Random { return false; } auto before = restored.state(); - if (restored(0) || restored(1) || restored(-1) || restored.state() != before) - return false; - return true; + return !(restored(0) || restored(1) || restored(-1) || (restored.state() != before)); } class Contract : public Base { @@ -178,9 +176,9 @@ namespace Test { namespace Random { // which no other parent reaches. const uint64_t g = UINT64_C(0x9e3779b97f4a7c15); Xorshift64Star zero_input; - zero_input.state({{uint64_t(0) - g}}); + zero_input.state({{UINT64_C(0) - g}}); Xorshift64Star other; - other.state({{(uint64_t(1) << 34) * g - 2 * g}}); + other.state({{(UINT64_C(1) << 34) * g - 2 * g}}); if ((zero_input.split(0).state()[0] == 0) || (zero_input.split(0).state() == zero_input.split(1).state()) || (zero_input.split(0).state() == other.split(0).state())) return false; @@ -207,6 +205,7 @@ namespace Test { namespace Random { (void)random_seed(invalid); return false; } catch (const std::invalid_argument&) { + // Expected } } const auto saved = r.state(); @@ -214,12 +213,13 @@ namespace Test { namespace Random { {"splitmix-v1:0000000000000000:0000000000000000", "splitmix-v1:0000000000000000:0000000000000002", "splitmix-v1:000000000000000g:9e3779b97f4a7c15", "splitmix-v1:0:9e3779b97f4a7c15", "other-v1:0000000000000000:9e3779b97f4a7c15"}) { + bool rejected = false; try { r.state(std::string(invalid)); - return false; } catch (const std::invalid_argument&) { + rejected = true; } - if (r.state() != saved) + if (!rejected || (r.state() != saved)) return false; } Gecode::Support::Random x(0); @@ -227,6 +227,7 @@ namespace Test { namespace Random { x.state(Xorshift64Star::State{{0}}); return false; } catch (const std::invalid_argument&) { + // Expected } for (uint64_t bound : {UINT64_C(2), UINT64_C(3), UINT64_C(0x8000000000000001), UINT64_MAX}) for (unsigned int i = 0; i < 100; ++i) @@ -284,7 +285,7 @@ namespace Test { namespace Random { } }; - bool + static bool same_archive(const Gecode::Choice& a, const Gecode::Choice& b) { Gecode::Archive x; Gecode::Archive y; @@ -300,19 +301,19 @@ namespace Test { namespace Random { /// Spaces without a model-owned generator have no owner state to compare. template - bool + static bool owners_agree(const Model&, const Model&) { return true; } template - bool + static bool owners_agree(const ReplaySpace& a, const ReplaySpace& b) { return a.own.state() == b.own.state(); } /// Committing an archived choice must match committing it directly. template - bool + static bool archive_replay(Model& root) { using namespace Gecode; while (root.status() == SS_BRANCH) { @@ -346,7 +347,7 @@ namespace Test { namespace Random { } template - std::vector + static std::vector solutions(const Random& source, unsigned int distance, bool different, bool multi, bool callback, unsigned int threads = 1) { using namespace Gecode; @@ -367,7 +368,7 @@ namespace Test { namespace Random { } template - bool + static bool branch_replay(const Random& source) { for (bool different : {false, true}) for (bool multi : {false, true}) @@ -420,7 +421,7 @@ namespace Test { namespace Random { } branch_replay_test; template - bool + static bool consumer_states(const Random& source, bool multi) { using namespace Gecode; ReplaySpace root(source, false, multi); @@ -541,7 +542,7 @@ namespace Test { namespace Random { }; template - std::vector + static std::vector first_solutions(Model& root, unsigned int distance) { using namespace Gecode; Search::Options options; @@ -558,7 +559,7 @@ namespace Test { namespace Random { return result; } - bool + static bool restarts_differ() { using namespace Gecode; Permutation root(Rnd(3)); @@ -578,7 +579,7 @@ namespace Test { namespace Random { } /// Return the context that a meta engine passes to the spoke of \a episode or \a asset - Gecode::SpokeContext + static Gecode::SpokeContext spoke_context(Gecode::MetaEngine engine, unsigned long int episode, unsigned int asset) { using namespace Gecode; static const Search::Statistics none; @@ -587,7 +588,7 @@ namespace Test { namespace Random { } /// Asset 1 must not repeat episode 1 of a restart engine - bool + static bool meta_streams_differ() { using namespace Gecode; Permutation root(Rnd(3)); @@ -601,7 +602,7 @@ namespace Test { namespace Random { } /// Nested portfolio spokes (0,1) and (1,0) must not share a stream - bool + static bool nested_streams_differ() { using namespace Gecode; Permutation root(Rnd(3)); @@ -617,7 +618,7 @@ namespace Test { namespace Random { } /// A model-owned generator split for a spoke differs per episode and engine - bool + static bool owned_streams_differ() { using namespace Gecode; const Rnd r(3); @@ -650,6 +651,6 @@ namespace Test { namespace Random { meta_streams_differ() && nested_streams_differ() && owned_streams_differ(); } } streams; -}} // namespace Test::Random +} // namespace Test::Random // STATISTICS: test-core diff --git a/test/region.cpp b/test/region.cpp index 305a10d001..2249cd06a1 100644 --- a/test/region.cpp +++ b/test/region.cpp @@ -49,10 +49,10 @@ namespace Test { public: /// Initialize test - Region(void) : Test::Base("Region") {} + Region() : Test::Base("Region") {} /// Perform actual tests bool - run(void) override { + run() override { for (int i = n_repeat; i--;) { Gecode::Region r; for (int j = n_blocks; j--;) @@ -68,13 +68,13 @@ namespace Test { class EmptySpace : public Gecode::Space { public: /// Initialize space - EmptySpace(void) = default; + EmptySpace() = default; /// Constructor for cloning \a s // NOLINTNEXTLINE(modernize-use-equals-default) EmptySpace(EmptySpace& s) : Gecode::Space(s) {} /// Copy space during cloning Gecode::Space* - copy(void) override { + copy() override { return new EmptySpace(*this); } }; @@ -83,10 +83,10 @@ namespace Test { class SpaceReallocEmpty : public Test::Base { public: /// Initialize test - SpaceReallocEmpty(void) : Test::Base("Space::Realloc::Empty") {} + SpaceReallocEmpty() : Test::Base("Space::Realloc::Empty") {} /// Perform actual tests bool - run(void) override { + run() override { EmptySpace home; int* p = home.realloc(static_cast(nullptr), 0, 4); for (int i = 0; i < 4; i++) @@ -103,10 +103,10 @@ namespace Test { class SpaceReallocPointers : public Test::Base { public: /// Initialize test - SpaceReallocPointers(void) : Test::Base("Space::Realloc::Pointers") {} + SpaceReallocPointers() : Test::Base("Space::Realloc::Pointers") {} /// Perform actual tests bool - run(void) override { + run() override { EmptySpace home; int values[2] = {0, 1}; int** p = home.alloc(2); @@ -129,7 +129,7 @@ namespace Test { /// Where to count destructions int* destroyed = nullptr; /// Count destruction - ~CountedObject(void) { + ~CountedObject() { if (destroyed != nullptr) (*destroyed)++; } @@ -137,7 +137,7 @@ namespace Test { /// Test whether shrinking in \a a destroys exactly the removed objects template - bool + static bool shrink_destroys_tail(Allocator& a) { int destroyed = 0; CountedObject* b = a.template alloc(4); @@ -153,14 +153,14 @@ namespace Test { class SpaceReallocShrink : public Test::Base { public: /// Initialize test - SpaceReallocShrink(void) : Test::Base("Space::Realloc::Shrink") {} + SpaceReallocShrink() : Test::Base("Space::Realloc::Shrink") {} /// Perform actual tests bool - run(void) override { + run() override { EmptySpace home; int* p = home.alloc(8); int* tail = p + 4; - p = home.realloc(p, 8, 4); + (void)home.realloc(p, 8, 4); return (home.fl_alloc<4 * sizeof(int)>() == tail) && shrink_destroys_tail(home); } }; @@ -171,10 +171,10 @@ namespace Test { class RegionReallocShrink : public Test::Base { public: /// Initialize test - RegionReallocShrink(void) : Test::Base("Region::Realloc::Shrink") {} + RegionReallocShrink() : Test::Base("Region::Realloc::Shrink") {} /// Perform actual tests bool - run(void) override { + run() override { Gecode::Region r; return shrink_destroys_tail(r); } @@ -186,10 +186,10 @@ namespace Test { class AllocatorCompare : public Test::Base { public: /// Initialize test - AllocatorCompare(void) : Test::Base("Allocator::Compare") {} + AllocatorCompare() : Test::Base("Allocator::Compare") {} /// Perform actual tests bool - run(void) override { + run() override { using namespace Gecode; EmptySpace home, other_home; const space_allocator space_alloc(home); @@ -210,10 +210,10 @@ namespace Test { class ArchiveEmpty : public Test::Base { public: /// Initialize test - ArchiveEmpty(void) : Test::Base("Archive::Empty") {} + ArchiveEmpty() : Test::Base("Archive::Empty") {} /// Perform actual tests bool - run(void) override { + run() override { Gecode::Archive empty; Gecode::Archive copy(empty); if (copy.size() != 0) diff --git a/test/search.cpp b/test/search.cpp index 8717de9c43..f120188a8f 100644 --- a/test/search.cpp +++ b/test/search.cpp @@ -55,4669 +55,4648 @@ #include #include -static_assert(std::is_copy_constructible::value, "NoGoods must remain copy constructible"); -static_assert(std::is_copy_assignable::value, "NoGoods must remain copy assignable"); -static_assert(std::is_copy_constructible::value, "NodeStop must remain copy constructible"); -static_assert(std::is_copy_assignable::value, "NodeStop must remain copy assignable"); -static_assert(std::is_copy_constructible::value, "FailStop must remain copy constructible"); -static_assert(std::is_copy_assignable::value, "FailStop must remain copy assignable"); -static_assert(std::is_copy_constructible::value, "TimeStop must remain copy constructible"); -static_assert(std::is_copy_assignable::value, "TimeStop must remain copy assignable"); -static_assert(std::is_copy_constructible::value, - "RestartStop must remain copy constructible"); -static_assert(std::is_copy_assignable::value, "RestartStop must remain copy assignable"); -static_assert(std::is_copy_constructible::value, +static_assert(std::is_copy_constructible_v, "NoGoods must remain copy constructible"); +static_assert(std::is_copy_assignable_v, "NoGoods must remain copy assignable"); +static_assert(std::is_copy_constructible_v, "NodeStop must remain copy constructible"); +static_assert(std::is_copy_assignable_v, "NodeStop must remain copy assignable"); +static_assert(std::is_copy_constructible_v, "FailStop must remain copy constructible"); +static_assert(std::is_copy_assignable_v, "FailStop must remain copy assignable"); +static_assert(std::is_copy_constructible_v, "TimeStop must remain copy constructible"); +static_assert(std::is_copy_assignable_v, "TimeStop must remain copy assignable"); +static_assert(std::is_copy_constructible_v, "RestartStop must remain copy constructible"); +static_assert(std::is_copy_assignable_v, "RestartStop must remain copy assignable"); +static_assert(std::is_copy_constructible_v, "WorkerControl must remain copy constructible"); -static_assert(std::is_copy_assignable::value, - "WorkerControl must remain copy assignable"); +static_assert(std::is_copy_assignable_v, "WorkerControl must remain copy assignable"); -namespace Test { +/// Tests for search engines +namespace Test::Search { - /// Tests for search engines - namespace Search { + using namespace Gecode; + using namespace Gecode::Int; - using namespace Gecode; - using namespace Gecode::Int; - - using Gecode::Search::EndReason; + using Gecode::Search::EndReason; #ifdef GECODE_HAS_EXPERIMENTAL - /// Explicit finite tree with prefix costs, admissible bounds, and ranks - class TreeSpace : public Space { - public: - /// Tree node - struct Node { - int cost, bound, rank, best; - std::vector children; - }; - typedef std::vector Graph; - std::shared_ptr graph; - bool maximize; - int vertex, ceiling; - /// Brancher choosing a child of the current node - class Decisions : public Brancher { - class Decision : public Choice { - public: - int vertex; - Decision(const Brancher& b, int v, unsigned int n) : Choice(b, n), vertex(v) {} - void - archive(Archive& e) const override { - Choice::archive(e); - e << vertex << alternatives(); - } - }; - + /// Explicit finite tree with prefix costs, admissible bounds, and ranks + class TreeSpace : public Space { + public: + /// Tree node + struct Node { + int cost, bound, rank, best; + std::vector children; + }; + using Graph = std::vector; + std::shared_ptr graph; + bool maximize; + int vertex, ceiling; + /// Brancher choosing a child of the current node + class Decisions : public Brancher { + class Decision : public Choice { public: - Decisions(Home home) : Brancher(home) {} - Decisions(Space& home, Decisions& b) : Brancher(home, b) {} - bool - status(const Space& s) const override { - return !static_cast(s).node().children.empty(); - } - const Choice* - choice(Space& s) override { - const TreeSpace& t = static_cast(s); - return new Decision(*this, t.vertex, static_cast(t.node().children.size())); - } - const Choice* - choice(const Space&, Archive& e) override { - int v; - unsigned int n; - e >> v >> n; - return new Decision(*this, v, n); - } - ExecStatus - commit(Space& s, const Choice& c, unsigned int a) override { - TreeSpace& t = static_cast(s); - t.vertex = (*t.graph)[static_cast(c).vertex].children[a]; - return t.node().cost >= t.ceiling ? ES_FAILED : ES_OK; - } - Actor* - copy(Space& home) override { - return new (home) Decisions(home, *this); - } - size_t - dispose(Space& home) override { - (void)Brancher::dispose(home); - return sizeof(*this); + int vertex; + Decision(const Brancher& b, int v, unsigned int n) : Choice(b, n), vertex(v) {} + void + archive(Archive& e) const override { + Choice::archive(e); + e << vertex << alternatives(); } }; - TreeSpace(std::shared_ptr g, bool max) - : graph(std::move(g)), maximize(max), vertex(0), ceiling(std::numeric_limits::max()) { - (void)new (*this) Decisions(*this); - } - // NOLINTNEXTLINE(modernize-use-equals-default) - TreeSpace(TreeSpace& s) - : Space(s), graph(s.graph), maximize(s.maximize), vertex(s.vertex), ceiling(s.ceiling) {} - Space* - copy(void) override { - return new TreeSpace(*this); - } - void - hub(HubContext&) override {} - const Node& - node(void) const { - return (*graph)[vertex]; - } - void - constrain(const Space& s) override { - ceiling = static_cast(s).node().cost; - if (node().cost >= ceiling) - fail(); - } - SpaceComparison - compare(const Space& s) const override { - int a = node().cost; - int b = static_cast(s).node().cost; - return (a < b) ? SpaceComparison::Better - : ((a > b) ? SpaceComparison::Worse : SpaceComparison::Equivalent); - } - /// Guidance minimizing cost, or maximizing negated cost - static Gecode::Search::HeuristicGuidance - guidance(bool max, bool ranked, bool dominance, bool keyed) { - using Gecode::Search::HeuristicGuidance; - HeuristicGuidance g(max ? Sense::Maximize : Sense::Minimize, [](const Space& s) -> std::int64_t { - const TreeSpace& t = static_cast(s); - return t.maximize ? -t.node().bound : t.node().bound; - }); - if (ranked) - g.rank = [](const Space& s) -> std::int64_t { - return static_cast(s).node().rank; - }; - if (dominance) - g.dominates = [](const Space& a, const Space& b) { - return static_cast(a).node().best <= - static_cast(b).node().best; - }; - if (keyed) - g.dominance_key = [](const Space& s) -> std::size_t { - return static_cast(static_cast(s).node().best % 3); - }; - return g; - } - /// Return a random tree where all nodes above depth \a d branch - static std::shared_ptr - random(Gecode::Support::RandomGenerator& r, int d = 1) { - Graph g; - g.push_back({0, 0, 0, 0, {}}); - grow(g, 0, 0, d, r); - return std::make_shared(std::move(g)); - } - - private: - static void - grow(Graph& g, int v, int depth, int d, Gecode::Support::RandomGenerator& r) { - if ((depth < d) || ((depth < 5) && (r(4U) != 0U))) { - unsigned int n = (depth < d ? 2U : 1U) + r(3U); - for (unsigned int i = 0; i < n; i++) { - int c = static_cast(g.size()); - g.push_back({g[v].cost + static_cast(r(5U)), 0, static_cast(r(10U)), 0, {}}); - g[v].children.push_back(c); - grow(g, c, depth + 1, d, r); - } - } - if (g[v].children.empty()) { - g[v].best = g[v].bound = g[v].cost; - } else { - g[v].best = std::numeric_limits::max(); - for (int c : g[v].children) - g[v].best = std::min(g[v].best, g[c].best); - g[v].bound = g[v].cost + static_cast(r(static_cast(g[v].best - g[v].cost + 1))); - } - } - }; - - /// Stop object raising its node limit on each stop - class Increasing : public Gecode::Search::Stop { - unsigned long long int limit, step; public: - unsigned int stops; - Increasing(unsigned long long int s) : limit(s), step(s), stops(0) {} + Decisions(Home home) : Brancher(home) {} + Decisions(Space& home, Decisions& b) : Brancher(home, b) {} bool - stop(const Gecode::Search::Statistics& s, const Gecode::Search::Options&) override { - if (s.node <= limit) - return false; - limit += step; - stops++; - return true; + status(const Space& s) const override { + return !static_cast(s).node().children.empty(); + } + const Choice* + choice(Space& s) override { + const TreeSpace& t = static_cast(s); + return new Decision(*this, t.vertex, static_cast(t.node().children.size())); + } + const Choice* + choice(const Space&, Archive& e) override { + int v; + unsigned int n; + e >> v >> n; + return new Decision(*this, v, n); + } + ExecStatus + commit(Space& s, const Choice& c, unsigned int a) override { + TreeSpace& t = static_cast(s); + t.vertex = (*t.graph)[static_cast(c).vertex].children[a]; + return t.node().cost >= t.ceiling ? ES_FAILED : ES_OK; + } + Actor* + copy(Space& home) override { + return new (home) Decisions(home, *this); + } + size_t + dispose(Space& home) override { + (void)Brancher::dispose(home); + return sizeof(*this); } }; + TreeSpace(std::shared_ptr g, bool max) + : graph(std::move(g)), maximize(max), vertex(0), ceiling(std::numeric_limits::max()) { + (void)new (*this) Decisions(*this); + } + // NOLINTNEXTLINE(modernize-use-equals-default) + TreeSpace(TreeSpace& s) + : Space(s), graph(s.graph), maximize(s.maximize), vertex(s.vertex), ceiling(s.ceiling) {} + Space* + copy() override { + return new TreeSpace(*this); + } + void + hub(HubContext&) override {} + const Node& + node() const { + return (*graph)[vertex]; + } + void + constrain(const Space& s) override { + ceiling = static_cast(s).node().cost; + if (node().cost >= ceiling) + fail(); + } + SpaceComparison + compare(const Space& s) const override { + int a = node().cost; + int b = static_cast(s).node().cost; + return (a < b) ? SpaceComparison::Better : ((a > b) ? SpaceComparison::Worse : SpaceComparison::Equivalent); + } + /// Guidance minimizing cost, or maximizing negated cost + static Gecode::Search::HeuristicGuidance + guidance(bool max, bool ranked, bool dominance, bool keyed) { + using Gecode::Search::HeuristicGuidance; + HeuristicGuidance g(max ? Sense::Maximize : Sense::Minimize, [](const Space& s) -> std::int64_t { + const TreeSpace& t = static_cast(s); + return t.maximize ? -t.node().bound : t.node().bound; + }); + if (ranked) + g.rank = [](const Space& s) -> std::int64_t { return static_cast(s).node().rank; }; + if (dominance) + g.dominates = [](const Space& a, const Space& b) { + return static_cast(a).node().best <= static_cast(b).node().best; + }; + if (keyed) + g.dominance_key = [](const Space& s) -> std::size_t { + return static_cast(static_cast(s).node().best % 3); + }; + return g; + } + /// Return a random tree where all nodes above depth \a d branch + static std::shared_ptr + random(Gecode::Support::RandomGenerator& r, int d = 1) { + Graph g; + g.push_back({0, 0, 0, 0, {}}); + grow(g, 0, 0, d, r); + return std::make_shared(std::move(g)); + } - /// Check that improving solutions reach the optimum unless search stops - template - static bool - improving(Engine& e, const TreeSpace& root, const Increasing* stop = nullptr) { - int last = std::numeric_limits::max(); - unsigned int stops = 0; - while (true) { - if (TreeSpace* s = e.next()) { - int cost = s->node().cost; - delete s; - if (cost >= last) - return false; - last = cost; - } else if ((stop != nullptr) && (stop->stops != stops)) { - // Resume after the stop object stopped search - stops = stop->stops; - } else { - break; + private: + static void + grow(Graph& g, int v, int depth, int d, Gecode::Support::RandomGenerator& r) { + if ((depth < d) || ((depth < 5) && (r(4U) != 0U))) { + unsigned int n = (depth < d ? 2U : 1U) + r(3U); + for (unsigned int i = 0; i < n; i++) { + int c = static_cast(g.size()); + g.push_back({g[v].cost + static_cast(r(5U)), 0, static_cast(r(10U)), 0, {}}); + g[v].children.push_back(c); + grow(g, c, depth + 1, d, r); } } - return (e.end_reason() != EndReason::Exhausted) || (last == (*root.graph)[0].best); - } - - /// Heuristic search engines on random trees - template