diff --git a/changelog.in b/changelog.in index c6aa06e70c..5f17658e21 100644 --- a/changelog.in +++ b/changelog.in @@ -76,6 +76,96 @@ Date: unreleased This release contains breaking changes. See the entries below for the changes downstream code needs. +[ENTRY] +Module: other +What: change +Rank: major +[DESCRIPTION] +Give abbreviated constants descriptive names, and remove the old spellings +without compatibility aliases. Values and semantics are unchanged, as are the +command-line option values and the "AOE" that StdSearchTracer prints. +[MORE] +The public renames are: +RestartMode: RM_NONE, RM_CONSTANT, RM_LINEAR, RM_LUBY, and RM_GEOMETRIC to +RESTART_NONE, RESTART_CONSTANT, RESTART_LINEAR, RESTART_LUBY, and +RESTART_GEOMETRIC, because ReifyMode also uses the prefix RM_. +ReifyMode: RM_PMI to RM_RIMP. +TaskType: TT_FIXP, TT_FIXS, and TT_FIXE to TT_FIXED_PROCESSING, TT_FIXED_START, +and TT_FIXED_END. +SetRelType: SRT_DISJ and SRT_CMPL to SRT_DISJOINT and SRT_COMPLEMENT. +SetOpType: SOT_DUNION and SOT_INTER to SOT_DISJOINT_UNION and SOT_INTERSECTION. +ScriptMode: SM_STAT to SM_STATISTICS. +MetaInfo::RestartReason: RR_NO, RR_SOL, RR_CMPL, and RR_LIM to RR_NONE, +RR_SOLUTION, RR_COMPLETE, and RR_LIMIT. +SearchTracer::EngineType: AOE to OTHER. +The test component renames are: +Test::Float::AssignmentType: CPLT_ASSIGNMENT to COMPLETE_ASSIGNMENT. +Test::MatchType: MT_ANY, MT_NOT, and MT_FIRST to MATCH_ANY, MATCH_NOT, and +MATCH_FIRST. +The internal renames are: +Int::GCC::Edge::EdgeFlag: EF_MRKLB, EF_MRKUB, EF_LM, EF_UM, and EF_DEL to +EF_MARKED_LBC, EF_MARKED_UBC, EF_MATCHED_LBC, EF_MATCHED_UBC, and EF_DELETED. +Int::NValues::RangeEventType: RET_FST and RET_LST to RET_START and RET_FINISH. +Support::IntType: IT_SHRT to IT_SHORT. +Int::BoolTest: BT_COMP to BT_COMPLEMENT. +Int::Cumulatives::EventType: EVENT_CHCK and EVENT_PRUN to EVENT_CHECK and +EVENT_PRUNE. + +[ENTRY] +Module: other +What: change +Rank: major +[DESCRIPTION] +Make 68 enums enum class, with using enum at their scope or, in class templates, +static constexpr aliases, so existing spellings such as IRT_EQ, +Gecode::SS_FAILED, and IntVarBranch::SEL_RND still compile. Their values stop converting to int and stop mixing with other enums. +Code that stores such a value in an int, does arithmetic or bitwise operations +on it, streams it, uses it as an array index or a bit position such as +1 << RM_EQV, or compares it with an integer no longer compiles. Convert +explicitly with std::to_underlying or static_cast. Installed headers now use +std::to_underlying, so code that does not build through the exported CMake +targets needs C++23 as well. +[MORE] +The scoped enums are: +Kernel: ExecStatus, SpaceStatus, ActorProperty, PropCost::ActualCost, +PropCost::Mod, ViewTraceInfo::What, PropagateTraceInfo::Status, +PostTraceInfo::Status, NGL::Status, MetaInfo::Type, MetaInfo::RestartReason, +TFE::NodeType. +Search: SearchTracer::EngineType, SearchTracer::NodeType, +Search::HeuristicGuidance::Sense, Search::Beam::Offer, +Search::Seq::ExpansionStep::State, Search::Par::Engine::Cmd, +CPProfiler::NodeStatus, CPProfiler::MessageMarshalling::Field. +Integer: ReifyMode, IntRelType, BoolOpType, IntPropLevel, TaskType, +TupleSet::Data::State, IntVarBranch::Select, BoolVarBranch::Select, +IntValBranch::Select, BoolValBranch::Select, IntAssign::Select, +BoolAssign::Select, Int::Cumulatives::EventType (formerly the typedef ev_t), +Int::Extensional::CompactStatus::StatusType, Int::GCC::BC, +Int::NValues::RangeEventType, Int::Sequence::TakesStatus, Int::SortTaskOrder, +Int::Event::Type, Int::RelTest, Int::BoolTest. +Set: SetRelType, SetOpType, SetVarBranch::Select, SetValBranch::Select, +SetAssign::Select. +Float: FloatRelType, FloatVarBranch::Select, FloatValBranch::Select, +FloatAssign::Select, Float::RelTest. +MiniModel: LinIntExpr::NodeType, LinFloatExpr::NodeType, SetExpr::NodeType, +BoolExpr::NodeType. +Driver: ScriptMode, RestartMode. +FlatZinc: FlatZinc::FlatZincSpace::Meth, FlatZinc::IntBoolVarBranch::Select, +FlatZinc::SymbolType. +Gist, support, and iterators: Gist::NodeStatus, Support::BitSetStatus, +Support::IntType, Iter::Ranges::CompareStatus. +Test component: Test::MatchType, Test::Int::ConTestLevel, +Test::Float::MaybeType, Test::Float::AssignmentType. + +[ENTRY] +Module: int +What: change +Rank: major +[DESCRIPTION] +IntPropLevel is enum class with underlying type unsigned int and gains +operator|, operator&, and operator|=, so levels combine without casts. Test a +bit with (ipl & IPL_BASIC) != IPL_DEF, since the result no longer converts to +bool. Remove IPL_BITS_, which was a bit-field width rather than a level. + [ENTRY] Module: kernel What: change diff --git a/docs/code-style.md b/docs/code-style.md index 8b42664503..0e07d14a44 100644 --- a/docs/code-style.md +++ b/docs/code-style.md @@ -58,6 +58,21 @@ Representative API changes include: | Previous spelling | Current spelling | |---|---| | `IRT_LE`, `FRT_LE`, `SRT_LE` | `IRT_LT`, `FRT_LT`, `SRT_LT` | +| `RM_NONE`, `RM_CONSTANT`, `RM_LINEAR`, `RM_LUBY`, `RM_GEOMETRIC` | `RESTART_NONE`, `RESTART_CONSTANT`, `RESTART_LINEAR`, `RESTART_LUBY`, `RESTART_GEOMETRIC` | +| `RM_PMI` | `RM_RIMP` | +| `TT_FIXP`, `TT_FIXS`, `TT_FIXE` | `TT_FIXED_PROCESSING`, `TT_FIXED_START`, `TT_FIXED_END` | +| `SRT_DISJ`, `SRT_CMPL` | `SRT_DISJOINT`, `SRT_COMPLEMENT` | +| `SOT_DUNION`, `SOT_INTER` | `SOT_DISJOINT_UNION`, `SOT_INTERSECTION` | +| `SM_STAT` | `SM_STATISTICS` | +| `RR_NO`, `RR_SOL`, `RR_CMPL`, `RR_LIM` | `RR_NONE`, `RR_SOLUTION`, `RR_COMPLETE`, `RR_LIMIT` | +| `SearchTracer::AOE` | `SearchTracer::OTHER` | +| `CPLT_ASSIGNMENT` | `COMPLETE_ASSIGNMENT` | +| `MT_ANY`, `MT_NOT`, `MT_FIRST` | `MATCH_ANY`, `MATCH_NOT`, `MATCH_FIRST` | +| `EF_MRKLB`, `EF_MRKUB`, `EF_LM`, `EF_UM`, `EF_DEL` | `EF_MARKED_LBC`, `EF_MARKED_UBC`, `EF_MATCHED_LBC`, `EF_MATCHED_UBC`, `EF_DELETED` | +| `RET_FST`, `RET_LST` | `RET_START`, `RET_FINISH` | +| `IT_SHRT` | `IT_SHORT` | +| `BT_COMP` | `BT_COMPLEMENT` | +| `EVENT_CHCK`, `EVENT_PRUN` | `EVENT_CHECK`, `EVENT_PRUNE` | | `nooverlap(...)` | `no_overlap(...)` | | `binpacking(...)` | `bin_packing(...)` | | `modeventdelta(...)` | `modification_event_delta(...)` | @@ -66,11 +81,44 @@ Representative API changes include: | `arg2intvarargs(...)` | `arg_to_int_var_args(...)` | Strict-less relation constants use `_LT`; `_LQ` continues to mean less-or-equal. -The former `_LE` names have no compatibility aliases. +The former `_LE` names have no compatibility aliases, and neither do the other +former constant spellings in the table. Qt overrides and other external interfaces retain the spellings their APIs require. Parser tokens and protocol strings remain unchanged. +## Enums + +New enums are `enum class`. Use a plain `enum` only where an existing API +requires it, or where the values are bits or bit positions held in an `int`, +as with `TraceEvent`. + +A public enum converted from a plain enum keeps its `UPPER_CASE` constants +usable without qualification through `using enum`, on the line after the enum +and at the same scope: + +```cpp +enum class IntRelType { IRT_EQ, IRT_NQ, ... }; +using enum IntRelType; +``` + +`using enum` cannot name a dependent type, so an enum in a class template +declares one `static constexpr` alias per constant instead, as +`CompactStatus::StatusType` does. + +A new enum names its constants in `PascalCase` and is always used qualified, +as in `MetaEvent::Solution`, so it has no `using enum`. + +Give an enum operators only if its values form a real bit set. `IntPropLevel` +is the one such enum, with `operator|`, `operator&`, and `operator|=`. Test a +bit with `(ipl & IPL_BASIC) != IPL_DEF`. Its underlying type is unsigned +because `IntPropLevels` stores levels in bit-fields, where a signed type would +change their values. + +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. + ## Checking changes Put LLVM 22 tools on `PATH`, or set `CLANG_FORMAT` and `CLANG_TIDY` to their diff --git a/examples/sudoku-advanced.cpp b/examples/sudoku-advanced.cpp index ed1c525ea8..2e6f3e5fa5 100644 --- a/examples/sudoku-advanced.cpp +++ b/examples/sudoku-advanced.cpp @@ -205,8 +205,8 @@ class SudokuInt : virtual public Sudoku { void same(Space& home, int nn, const IntVarArgs& a, const IntVarArgs& b) { SetVar u(home, IntSet::empty, 1, nn); - rel(home, SOT_DUNION, a, u); - rel(home, SOT_DUNION, b, u); + rel(home, SOT_DISJOINT_UNION, a, u); + rel(home, SOT_DISJOINT_UNION, b, u); } /// The fields of column \a c outside box row \a j @@ -303,18 +303,18 @@ class SudokuSet : virtual public Sudoku { IntSet full(1, nn * nn); // All x must be pairwise disjoint and partition the field indices - rel(*this, SOT_DUNION, y, SetVar(*this, full, full)); + rel(*this, SOT_DISJOINT_UNION, y, SetVar(*this, full, full)); // The x must intersect in exactly one element with each // row, column, and block for (int i = 0; i < nn; i++) for (int j = 0; j < nn; j++) { SetVar inter_row(*this, IntSet::empty, full, 1U, 1U); - rel(*this, y[i], SOT_INTER, row[j], SRT_EQ, inter_row); + rel(*this, y[i], SOT_INTERSECTION, row[j], SRT_EQ, inter_row); SetVar inter_col(*this, IntSet::empty, full, 1U, 1U); - rel(*this, y[i], SOT_INTER, col[j], SRT_EQ, inter_col); + rel(*this, y[i], SOT_INTERSECTION, col[j], SRT_EQ, inter_col); SetVar inter_block(*this, IntSet::empty, full, 1U, 1U); - rel(*this, y[i], SOT_INTER, block[j], SRT_EQ, inter_block); + rel(*this, y[i], SOT_INTERSECTION, block[j], SRT_EQ, inter_block); } // Fill-in predefined fields diff --git a/gecode/driver.hh b/gecode/driver.hh index b631ba7a2a..7e9774187f 100644 --- a/gecode/driver.hh +++ b/gecode/driver.hh @@ -85,24 +85,26 @@ namespace Gecode { * \brief Different modes for executing scripts * \ingroup TaskDriverCmd */ - enum ScriptMode { - SM_SOLUTION, ///< Print solution and some statistics - SM_TIME, ///< Measure average runtime - SM_STAT, ///< Print statistics for script - SM_GIST, ///< Run script in Gist + enum class ScriptMode { + SM_SOLUTION, ///< Print solution and some statistics + SM_TIME, ///< Measure average runtime + SM_STATISTICS, ///< Print statistics for script + SM_GIST, ///< Run script in Gist }; + using enum ScriptMode; /** * \brief Different modes for restart-based search * \ingroup TaskDriverCmd */ - enum RestartMode { - RM_NONE, ///< No restarts - RM_CONSTANT, ///< Restart with constant sequence - RM_LINEAR, ///< Restart with linear sequence - RM_LUBY, ///< Restart with Luby sequence - RM_GEOMETRIC ///< Restart with geometric sequence + enum class RestartMode { + RESTART_NONE, ///< No restarts + RESTART_CONSTANT, ///< Restart with constant sequence + RESTART_LINEAR, ///< Restart with linear sequence + RESTART_LUBY, ///< Restart with Luby sequence + RESTART_GEOMETRIC ///< Restart with geometric sequence }; + using enum RestartMode; class BaseOptions; diff --git a/gecode/driver/options.cpp b/gecode/driver/options.cpp index b5c948307b..0e05adf8d3 100644 --- a/gecode/driver/options.cpp +++ b/gecode/driver/options.cpp @@ -380,8 +380,8 @@ namespace Gecode { int IplOption::parse(int argc, char* argv[]) { if (char* a = argument(argc, argv)) { - int b = IPL_DEF; - int m = IPL_DEF; + IntPropLevel b = IPL_DEF; + IntPropLevel m = IPL_DEF; do { // Search for a comma char* c = a; @@ -415,7 +415,7 @@ namespace Gecode { } while (*a != 0); - cur = static_cast(b | m); + cur = b | m; return 2; } return 0; @@ -444,9 +444,9 @@ namespace Gecode { if ((cur & IPL_FULL) == IPL_FULL) cerr << ",full"; else { - if (cur & IPL_BASIC) + if ((cur & IPL_BASIC) != IPL_DEF) cerr << ",basic"; - if (cur & IPL_ADVANCED) + if ((cur & IPL_ADVANCED) != IPL_DEF) cerr << ",advanced"; } cerr << '\n' << "\t\t" << exp << '\n' << std::flush; @@ -730,7 +730,7 @@ namespace Gecode { _time("time", "time (in ms) cutoff (0 = none, solution mode)"), _assets("assets", "#portfolio assets (#engines)", 0), _slice("slice", "portfolio slice (in #failures)", Search::Config::slice), - _restart("restart", "restart sequence type", RM_NONE), + _restart("restart", "restart sequence type", static_cast(RESTART_NONE)), _r_base("restart-base", "base for geometric restart sequence", Search::Config::base), _r_scale("restart-scale", "scale factor for restart sequence", Search::Config::slice), _r_limit("restart-limit", "restart cutoff (0 = none, solution mode)"), @@ -742,7 +742,8 @@ namespace Gecode { #ifdef GECODE_HAS_EXPERIMENTAL _guidance(nullptr), #endif - _mode("mode", "how to execute script", SM_SOLUTION), _samples("samples", "how many samples (time mode)", 1), + _mode("mode", "how to execute script", static_cast(SM_SOLUTION)), + _samples("samples", "how many samples (time mode)", 1), _iterations("iterations", "iterations per sample (time mode)", 1), _print_last("print-last", "whether to only print the last solution (solution mode)", false), _out_file("file-sol", @@ -761,16 +762,16 @@ namespace Gecode { #endif { - _mode.add(SM_SOLUTION, "solution"); - _mode.add(SM_TIME, "time"); - _mode.add(SM_STAT, "stat"); - _mode.add(SM_GIST, "gist"); + _mode.add(static_cast(SM_SOLUTION), "solution"); + _mode.add(static_cast(SM_TIME), "time"); + _mode.add(static_cast(SM_STATISTICS), "stat"); + _mode.add(static_cast(SM_GIST), "gist"); - _restart.add(RM_NONE, "none"); - _restart.add(RM_CONSTANT, "constant"); - _restart.add(RM_LINEAR, "linear"); - _restart.add(RM_LUBY, "luby"); - _restart.add(RM_GEOMETRIC, "geometric"); + _restart.add(static_cast(RESTART_NONE), "none"); + _restart.add(static_cast(RESTART_CONSTANT), "constant"); + _restart.add(static_cast(RESTART_LINEAR), "linear"); + _restart.add(static_cast(RESTART_LUBY), "luby"); + _restart.add(static_cast(RESTART_GEOMETRIC), "geometric"); add(_model); add(_symmetry); diff --git a/gecode/driver/options.hpp b/gecode/driver/options.hpp index 20473b1c33..81494b30b9 100644 --- a/gecode/driver/options.hpp +++ b/gecode/driver/options.hpp @@ -415,7 +415,7 @@ namespace Gecode { inline void Options::restart(RestartMode rm) { - _restart.value(rm); + _restart.value(static_cast(rm)); } inline RestartMode Options::restart(void) const { @@ -491,7 +491,7 @@ namespace Gecode { */ inline void Options::mode(ScriptMode sm) { - _mode.value(sm); + _mode.value(static_cast(sm)); } inline ScriptMode Options::mode(void) const { diff --git a/gecode/driver/script.hpp b/gecode/driver/script.hpp index 34864be482..252fd62041 100644 --- a/gecode/driver/script.hpp +++ b/gecode/driver/script.hpp @@ -156,15 +156,15 @@ namespace Gecode { namespace Driver { inline Search::Cutoff* create_cutoff(const Options& o) { switch (o.restart()) { - case RM_NONE: + case RESTART_NONE: return nullptr; - case RM_CONSTANT: + case RESTART_CONSTANT: return Search::Cutoff::constant(o.restart_scale()); - case RM_LINEAR: + case RESTART_LINEAR: return Search::Cutoff::linear(o.restart_scale()); - case RM_LUBY: + case RESTART_LUBY: return Search::Cutoff::luby(o.restart_scale()); - case RM_GEOMETRIC: + case RESTART_GEOMETRIC: return Search::Cutoff::geometric(o.restart_scale(), o.restart_base()); default: GECODE_NEVER; @@ -291,11 +291,11 @@ namespace Gecode { namespace Driver { template class Engine, class Options> void ScriptBase::run(const Options& o, Script* s) { - if ((o.restart() != RM_NONE) && (o.assets() > 0)) { + if ((o.restart() != RESTART_NONE) && (o.assets() > 0)) { std::cerr << "Cannot use restarts and portfolio..." << '\n' << std::flush; exit(EXIT_FAILURE); } - if (o.restart() != RM_NONE) { + if (o.restart() != RESTART_NONE) { run_meta(o, s); } else if (o.assets() > 0) { run_meta(o, s); @@ -460,7 +460,7 @@ namespace Gecode { namespace Driver { delete so.stop; delete so.tracer; } break; - case SM_STAT: { + case SM_STATISTICS: { l_out << o.name() << '\n' << std::flush; Support::Timer t; unsigned long long int s_l = (o.solutions() == 0) ? ULLONG_MAX : o.solutions(); diff --git a/gecode/flatzinc.hh b/gecode/flatzinc.hh index 4c2021bd59..2eca4c6977 100644 --- a/gecode/flatzinc.hh +++ b/gecode/flatzinc.hh @@ -261,7 +261,7 @@ namespace Gecode { namespace FlatZinc { _fail("fail", "failure cutoff (0 = none, solution mode)"), _time("time", "time (in ms) cutoff (0 = none, solution mode)"), _time_limit("t", "time (in ms) cutoff (0 = none, solution mode)"), _seed("r", "random seed", 0), - _restart("restart", "restart sequence type", RM_NONE), + _restart("restart", "restart sequence type", static_cast(RESTART_NONE)), _r_base("restart-base", "base for geometric restart sequence", 1.5), _r_scale("restart-scale", "scale factor for restart sequence", 250), _r_limit("restart-limit", "restart cutoff (0 = none, solution mode)"), @@ -269,22 +269,22 @@ namespace Gecode { namespace FlatZinc { _nogoods_limit("nogoods-limit", "depth limit for no-good extraction", Search::Config::nogoods_limit), _interrupt("interrupt", "whether to catch Ctrl-C (true) or not (false)", true), _step("step", "step distance for float optimization", 0.0), - _mode("mode", "how to execute script", Gecode::SM_SOLUTION), _stat("s", "emit statistics"), - _output("o", "file to send output to") + _mode("mode", "how to execute script", static_cast(Gecode::SM_SOLUTION)), + _stat("s", "emit statistics"), _output("o", "file to send output to") #ifdef GECODE_HAS_CPPROFILER , _profiler("cp-profiler", "use this execution id and port (comma separated) with CP-profiler") #endif { - _mode.add(Gecode::SM_SOLUTION, "solution"); - _mode.add(Gecode::SM_STAT, "stat"); - _mode.add(Gecode::SM_GIST, "gist"); - _restart.add(RM_NONE, "none"); - _restart.add(RM_CONSTANT, "constant"); - _restart.add(RM_LINEAR, "linear"); - _restart.add(RM_LUBY, "luby"); - _restart.add(RM_GEOMETRIC, "geometric"); + _mode.add(static_cast(Gecode::SM_SOLUTION), "solution"); + _mode.add(static_cast(Gecode::SM_STATISTICS), "stat"); + _mode.add(static_cast(Gecode::SM_GIST), "gist"); + _restart.add(static_cast(RESTART_NONE), "none"); + _restart.add(static_cast(RESTART_CONSTANT), "constant"); + _restart.add(static_cast(RESTART_LINEAR), "linear"); + _restart.add(static_cast(RESTART_LUBY), "luby"); + _restart.add(static_cast(RESTART_GEOMETRIC), "geometric"); add(_solutions); add(_threads); @@ -323,8 +323,8 @@ namespace Gecode { namespace FlatZinc { if (_time_limit.value()) { _time.value(_time_limit.value()); } - if (_stat.value() && (_mode.value() == Gecode::SM_SOLUTION)) - _mode.value(Gecode::SM_STAT); + if (_stat.value() && (mode() == Gecode::SM_SOLUTION)) + _mode.value(static_cast(Gecode::SM_STATISTICS)); } void @@ -400,7 +400,7 @@ namespace Gecode { namespace FlatZinc { } void restart(RestartMode rm) { - _restart.value(rm); + _restart.value(static_cast(rm)); } double restart_base(void) const { @@ -491,11 +491,12 @@ namespace Gecode { namespace FlatZinc { */ class GECODE_FLATZINC_EXPORT FlatZincSpace : public Space { public: - enum Meth { + enum class Meth { SAT, //< Solve as satisfaction problem MIN, //< Solve as minimization problem MAX //< Solve as maximization problem }; + using enum Meth; protected: /// Initialisation data (only used for posting constraints) diff --git a/gecode/flatzinc/branch.hh b/gecode/flatzinc/branch.hh index bff6d7e307..3b5a4d07c3 100644 --- a/gecode/flatzinc/branch.hh +++ b/gecode/flatzinc/branch.hh @@ -43,7 +43,7 @@ namespace Gecode { namespace FlatZinc { class IntBoolVarBranch : public VarBranch { public: /// Which variable selection - enum Select { + enum class Select { SEL_AFC_MAX, ///< With largest accumulated failure count SEL_ACTION_MAX, ///< With highest action SEL_CHB_MAX, ///< With highest CHB Q-score @@ -51,6 +51,7 @@ namespace Gecode { namespace FlatZinc { SEL_ACTION_SIZE_MAX, ///< With largest action divided by domain size SEL_CHB_SIZE_MAX ///< With largest CHB Q-score divided by domain size }; + using enum Select; protected: /// Which variable to select diff --git a/gecode/flatzinc/flatzinc.cpp b/gecode/flatzinc/flatzinc.cpp index c797bb5ef2..88496d52fb 100644 --- a/gecode/flatzinc/flatzinc.cpp +++ b/gecode/flatzinc/flatzinc.cpp @@ -1144,24 +1144,24 @@ namespace Gecode { namespace FlatZinc { 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"); - opt.restart(RM_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"); - opt.restart(RM_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"); - opt.restart(RM_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"); - opt.restart(RM_CONSTANT); + opt.restart(RESTART_CONSTANT); opt.restart_scale(call->args->get_int()); } else if (flat_ann[i]->is_call("restart_none")) { - opt.restart(RM_NONE); + opt.restart(RESTART_NONE); } else if (flat_ann[i]->is_call("relax_and_reconstruct")) { if (_lns != 0) throw FlatZinc::Error("FlatZinc", "Only one relax_and_reconstruct annotation allowed"); @@ -1782,7 +1782,7 @@ namespace Gecode { namespace FlatZinc { void FlatZincSpace::run_engine(std::ostream& out, const Printer& p, const FlatZincOptions& opt, Support::Timer& t_total) { - if (opt.restart() == RM_NONE) { + if (opt.restart() == RESTART_NONE) { run_meta(out, p, opt, t_total); } else { run_meta(out, p, opt, t_total); @@ -1922,7 +1922,7 @@ namespace Gecode { namespace FlatZinc { o.threads = opt.threads(); o.nogoods_limit = opt.nogoods() ? opt.nogoods_limit() : 0; - if (opt.restart() != RM_NONE) + if (opt.restart() != RESTART_NONE) o.cutoff = new Search::CutoffAppend(new Search::CutoffConstant(0), 1, Driver::create_cutoff(opt)); int no_of_solutions = opt.solutions(); if (no_of_solutions == -1) { @@ -1954,7 +1954,7 @@ namespace Gecode { namespace FlatZinc { } } proof = se.end_reason() == Search::EndReason::Exhausted; - if (opt.mode() == SM_STAT) { + if (opt.mode() == SM_STATISTICS) { stat = se.statistics(); } } @@ -1977,7 +1977,7 @@ namespace Gecode { namespace FlatZinc { out << "=====UNKNOWN=====" << '\n' << std::flush; } } - if (opt.mode() == SM_STAT) { + if (opt.mode() == SM_STATISTICS) { double total_time = (t_total.stop() / 1000.0); double solve_time = (t_solve.stop() / 1000.0); double init_time = total_time - solve_time; @@ -2680,7 +2680,7 @@ namespace Gecode { namespace FlatZinc { #endif IntPropLevel FlatZincSpace::annotation_to_int_prop_level(AST::Node* ann) { - int ipl = IPL_DEF; + IntPropLevel ipl = IPL_DEF; if (ann) { if (ann->has_atom("val") || ann->has_atom("value_propagation")) ipl = IPL_VAL; @@ -2698,7 +2698,7 @@ namespace Gecode { namespace FlatZinc { ipl |= IPL_ADVANCED; } } - return static_cast(ipl); + return ipl; } DFA diff --git a/gecode/flatzinc/parser.hh b/gecode/flatzinc/parser.hh index 7102c5fdac..13d9a66123 100644 --- a/gecode/flatzinc/parser.hh +++ b/gecode/flatzinc/parser.hh @@ -80,7 +80,7 @@ namespace Gecode { namespace FlatZinc { }; /// Types of symbols - enum SymbolType { + enum class SymbolType { ST_INTVAR, //< Integer variable ST_BOOLVAR, //< Boolean variable ST_FLOATVAR, //< Float variable @@ -98,6 +98,7 @@ namespace Gecode { namespace FlatZinc { ST_SET, //< Set ST_FLOAT //< Float }; + using enum SymbolType; /// Entries in the symbol table class SymbolEntry { diff --git a/gecode/flatzinc/registry-set.cpp b/gecode/flatzinc/registry-set.cpp index dafad029a9..f7e893810e 100644 --- a/gecode/flatzinc/registry-set.cpp +++ b/gecode/flatzinc/registry-set.cpp @@ -54,7 +54,7 @@ namespace Gecode { namespace FlatZinc { } void p_set_intersect(FlatZincSpace& s, const ConExpr& ce, AST::Node* ann) { - p_set_op(s, SOT_INTER, ce, ann); + p_set_op(s, SOT_INTERSECTION, ce, ann); } void p_set_diff(FlatZincSpace& s, const ConExpr& ce, AST::Node* ann) { @@ -90,7 +90,7 @@ namespace Gecode { namespace FlatZinc { } void p_array_set_partition(FlatZincSpace& s, const ConExpr& ce, AST::Node* ann) { - p_array_set_op(s, SOT_DUNION, ce, ann); + p_array_set_op(s, SOT_DISJOINT_UNION, ce, ann); } void @@ -213,7 +213,7 @@ namespace Gecode { namespace FlatZinc { } void p_set_disjoint(FlatZincSpace& s, const ConExpr& ce, AST::Node*) { - rel(s, s.arg_to_set_var(ce[0]), SRT_DISJ, s.arg_to_set_var(ce[1])); + rel(s, s.arg_to_set_var(ce[0]), SRT_DISJOINT, s.arg_to_set_var(ce[1])); } void @@ -260,7 +260,7 @@ namespace Gecode { namespace FlatZinc { } } SetVar selector = s.arg_to_set_var(ce[0]); - dom(s, selector, SRT_DISJ, 0); + dom(s, selector, SRT_DISJOINT, 0); if (is_constant) { IntSetArgs sv = s.arg_to_int_set_args(ce[1], 1); element(s, op, sv, selector, s.arg_to_set_var(ce[2]), universe); @@ -277,18 +277,18 @@ namespace Gecode { namespace FlatZinc { void p_array_set_element_intersect(FlatZincSpace& s, const ConExpr& ce, AST::Node* ann) { - p_array_set_element_op(s, ce, ann, SOT_INTER); + p_array_set_element_op(s, ce, ann, SOT_INTERSECTION); } void p_array_set_element_intersect_in(FlatZincSpace& s, const ConExpr& ce, AST::Node* ann) { IntSet d = s.arg_to_int_set(ce[3]); - p_array_set_element_op(s, ce, ann, SOT_INTER, d); + p_array_set_element_op(s, ce, ann, SOT_INTERSECTION, d); } void p_array_set_element_partition(FlatZincSpace& s, const ConExpr& ce, AST::Node* ann) { - p_array_set_element_op(s, ce, ann, SOT_DUNION); + p_array_set_element_op(s, ce, ann, SOT_DISJOINT_UNION); } void @@ -374,9 +374,9 @@ namespace Gecode { namespace FlatZinc { case 4: return SRT_SUP; case 5: - return SRT_DISJ; + return SRT_DISJOINT; case 6: - return SRT_CMPL; + return SRT_COMPLEMENT; case 7: return SRT_LQ; case 8: @@ -418,7 +418,7 @@ namespace Gecode { namespace FlatZinc { } void p_array_set_intersect(FlatZincSpace& s, const ConExpr& ce, AST::Node*) { - rel(s, SOT_INTER, s.arg_to_set_var_args(ce[0]), s.arg_to_set_var(ce[1])); + rel(s, SOT_INTERSECTION, s.arg_to_set_var_args(ce[0]), s.arg_to_set_var(ce[1])); } void p_set_element2d(FlatZincSpace& s, const ConExpr& ce, AST::Node*) { diff --git a/gecode/float.hh b/gecode/float.hh index 26087a6b9a..a8e029013f 100644 --- a/gecode/float.hh +++ b/gecode/float.hh @@ -1149,7 +1149,7 @@ namespace Gecode { * \brief Relation types for floats * \ingroup TaskModelFloat */ - enum FloatRelType { + enum class FloatRelType { FRT_EQ, ///< Equality (\f$=\f$) FRT_NQ, ///< Disequality (\f$\neq\f$) FRT_LQ, ///< Less or equal (\f$\leq\f$) @@ -1157,6 +1157,7 @@ namespace Gecode { FRT_GQ, ///< Greater or equal (\f$\geq\f$) FRT_GR ///< Greater (\f$>\f$) }; + using enum FloatRelType; /** * \defgroup TaskModelFloatDomain Domain constraints @@ -1687,7 +1688,7 @@ namespace Gecode { class FloatVarBranch : public VarBranch { public: /// Which variable selection - enum Select { + enum class Select { SEL_NONE = 0, ///< First unassigned SEL_RND, ///< Random (uniform, for tie breaking) SEL_MERIT_MIN, ///< With least merit @@ -1715,6 +1716,7 @@ namespace Gecode { SEL_CHB_SIZE_MIN, ///< With smallest CHB Q-score divided by domain size SEL_CHB_SIZE_MAX ///< With largest CHB Q-score divided by domain size }; + using enum Select; protected: /// Which variable to select @@ -1840,12 +1842,13 @@ namespace Gecode { class FloatValBranch : public ValBranch { public: /// Which value selection - enum Select { + enum class Select { SEL_SPLIT_MIN, ///< Select values not greater than mean of smallest and largest value SEL_SPLIT_MAX, ///< Select values greater than mean of smallest and largest value SEL_SPLIT_RND, ///< Select values randomly which are not greater or not smaller than mean of largest and smallest value SEL_VAL_COMMIT ///< Select value according to user-defined functions }; + using enum Select; protected: /// Which value to select @@ -1896,12 +1899,13 @@ namespace Gecode { class FloatAssign : public ValBranch { public: /// Which value selection - enum Select { + enum class Select { SEL_MIN, ///< Select median value of the lower part SEL_MAX, ///< Select median value of the upper part SEL_RND, ///< Select median value of a randomly chosen part SEL_VAL_COMMIT ///< Select value according to user-defined functions }; + using enum Select; protected: /// Which value to select diff --git a/gecode/float/dom.cpp b/gecode/float/dom.cpp index c5177724c6..56711e072f 100644 --- a/gecode/float/dom.cpp +++ b/gecode/float/dom.cpp @@ -90,8 +90,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Rel::ReEqFloat::post(home, x, n, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Rel::ReEqFloat::post(home, x, n, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Rel::ReEqFloat::post(home, x, n, r.var()))); break; default: throw Int::UnknownReifyMode("Float::dom"); @@ -108,7 +108,7 @@ namespace Gecode { case RM_IMP: GECODE_ME_FAIL(b.zero(home)); break; - case RM_PMI: + case RM_RIMP: break; default: throw Int::UnknownReifyMode("Float::dom"); diff --git a/gecode/float/rel.cpp b/gecode/float/rel.cpp index ba8a5230c5..6b04bd4f0b 100644 --- a/gecode/float/rel.cpp +++ b/gecode/float/rel.cpp @@ -109,8 +109,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Rel::ReEq::post(home, x0, x1, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Rel::ReEq::post(home, x0, x1, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Rel::ReEq::post(home, x0, x1, r.var()))); break; default: throw Int::UnknownReifyMode("Float::rel"); @@ -123,9 +123,9 @@ namespace Gecode { GECODE_ES_FAIL((Rel::ReEq::post(home, x0, x1, n))); break; case RM_IMP: - GECODE_ES_FAIL((Rel::ReEq::post(home, x0, x1, n))); + GECODE_ES_FAIL((Rel::ReEq::post(home, x0, x1, n))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((Rel::ReEq::post(home, x0, x1, n))); break; default: @@ -143,8 +143,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Rel::ReLq::post(home, x0, x1, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Rel::ReLq::post(home, x0, x1, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Rel::ReLq::post(home, x0, x1, r.var()))); break; default: throw Int::UnknownReifyMode("Float::rel"); @@ -159,9 +159,9 @@ namespace Gecode { GECODE_ES_FAIL((Rel::ReLq::post(home, x0, x1, n))); break; case RM_IMP: - GECODE_ES_FAIL((Rel::ReLq::post(home, x0, x1, n))); + GECODE_ES_FAIL((Rel::ReLq::post(home, x0, x1, n))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((Rel::ReLq::post(home, x0, x1, n))); break; default: @@ -188,8 +188,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Rel::ReEqFloat::post(home, x, n, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Rel::ReEqFloat::post(home, x, n, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Rel::ReEqFloat::post(home, x, n, r.var()))); break; default: throw Int::UnknownReifyMode("Float::rel"); @@ -202,9 +202,9 @@ namespace Gecode { GECODE_ES_FAIL((Rel::ReEqFloat::post(home, x, n, nb))); break; case RM_IMP: - GECODE_ES_FAIL((Rel::ReEqFloat::post(home, x, n, nb))); + GECODE_ES_FAIL((Rel::ReEqFloat::post(home, x, n, nb))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((Rel::ReEqFloat::post(home, x, n, nb))); break; default: @@ -220,8 +220,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Rel::ReLqFloat::post(home, x, n, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Rel::ReLqFloat::post(home, x, n, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Rel::ReLqFloat::post(home, x, n, r.var()))); break; default: throw Int::UnknownReifyMode("Float::rel"); @@ -235,8 +235,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Rel::ReLeFloat::post(home, x, n, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Rel::ReLeFloat::post(home, x, n, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Rel::ReLeFloat::post(home, x, n, r.var()))); break; default: throw Int::UnknownReifyMode("Float::rel"); @@ -249,9 +249,9 @@ namespace Gecode { GECODE_ES_FAIL((Rel::ReLeFloat::post(home, x, n, nb))); break; case RM_IMP: - GECODE_ES_FAIL((Rel::ReLeFloat::post(home, x, n, nb))); + GECODE_ES_FAIL((Rel::ReLeFloat::post(home, x, n, nb))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((Rel::ReLeFloat::post(home, x, n, nb))); break; default: @@ -266,9 +266,9 @@ namespace Gecode { GECODE_ES_FAIL((Rel::ReLqFloat::post(home, x, n, nb))); break; case RM_IMP: - GECODE_ES_FAIL((Rel::ReLqFloat::post(home, x, n, nb))); + GECODE_ES_FAIL((Rel::ReLqFloat::post(home, x, n, nb))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((Rel::ReLqFloat::post(home, x, n, nb))); break; default: diff --git a/gecode/float/rel/eq.hpp b/gecode/float/rel/eq.hpp index 3ac6127659..517b4e7089 100644 --- a/gecode/float/rel/eq.hpp +++ b/gecode/float/rel/eq.hpp @@ -204,7 +204,7 @@ namespace Gecode { namespace Float { namespace Rel { ExecStatus ReEq::post(Home home, View x0, View x1, CtrlView b) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return ES_OK; return Eq::post(home, x0, x1); } @@ -236,7 +236,7 @@ namespace Gecode { namespace Float { namespace Rel { ExecStatus ReEq::propagate(Space& home, const ModEventDelta&) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return home.ES_SUBSUMED(*this); GECODE_REWRITE(*this, (Eq::post(home(*this), x0, x1))); } @@ -251,7 +251,7 @@ namespace Gecode { namespace Float { namespace Rel { GECODE_ME_CHECK(b.one_none(home)); break; case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); break; case RT_MAYBE: @@ -276,14 +276,14 @@ namespace Gecode { namespace Float { namespace Rel { ExecStatus ReEqFloat::post(Home home, View x, const FloatVal& c, CtrlView b) { if (b.one()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(x.eq(home, c)); } else if (x.assigned()) { if (overlap(x.val(), c)) { if (rm != RM_IMP) GECODE_ME_CHECK(b.one(home)); } else { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); } } else { @@ -307,7 +307,7 @@ namespace Gecode { namespace Float { namespace Rel { ExecStatus ReEqFloat::propagate(Space& home, const ModEventDelta&) { if (b.one()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(x0.eq(home, c)); } else { switch (rtest_eq(x0, c)) { @@ -316,7 +316,7 @@ namespace Gecode { namespace Float { namespace Rel { GECODE_ME_CHECK(b.one(home)); break; case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); break; case RT_MAYBE: diff --git a/gecode/float/rel/lq-le.hpp b/gecode/float/rel/lq-le.hpp index 5fcc1e5a1e..5bc0142bfb 100644 --- a/gecode/float/rel/lq-le.hpp +++ b/gecode/float/rel/lq-le.hpp @@ -135,7 +135,7 @@ namespace Gecode { namespace Float { namespace Rel { ExecStatus ReLq::post(Home home, View x0, View x1, CtrlView b) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return ES_OK; return Lq::post(home, x0, x1); } @@ -151,7 +151,7 @@ namespace Gecode { namespace Float { namespace Rel { GECODE_ME_CHECK(b.one_none(home)); break; case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); break; case RT_MAYBE: @@ -186,7 +186,7 @@ namespace Gecode { namespace Float { namespace Rel { ExecStatus ReLq::propagate(Space& home, const ModEventDelta&) { if (b.one()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_REWRITE(*this, Lq::post(home(*this), x0, x1)); } else if (b.zero()) { if (rm != RM_IMP) @@ -198,7 +198,7 @@ namespace Gecode { namespace Float { namespace Rel { GECODE_ME_CHECK(b.one_none(home)); break; case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); break; case RT_MAYBE: @@ -230,7 +230,7 @@ namespace Gecode { namespace Float { namespace Rel { ExecStatus ReLqFloat::post(Home home, View x, const FloatVal& c, CtrlView b) { if (b.one()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(x.lq(home, c.max())); } if (b.zero()) { @@ -247,7 +247,7 @@ namespace Gecode { namespace Float { namespace Rel { GECODE_ME_CHECK(b.one(home)); break; case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); break; case RT_MAYBE: @@ -275,7 +275,7 @@ namespace Gecode { namespace Float { namespace Rel { ExecStatus ReLqFloat::propagate(Space& home, const ModEventDelta&) { if (b.one()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(x0.lq(home, c.max())); } else if (b.zero()) { if (rm != RM_IMP) { @@ -291,7 +291,7 @@ namespace Gecode { namespace Float { namespace Rel { GECODE_ME_CHECK(b.one(home)); break; case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); break; case RT_MAYBE: @@ -317,7 +317,7 @@ namespace Gecode { namespace Float { namespace Rel { ExecStatus ReLeFloat::post(Home home, View x, const FloatVal& c, CtrlView b) { if (b.one()) { - if (rm != RM_PMI) { + if (rm != RM_RIMP) { GECODE_ME_CHECK(x.lq(home, c.max())); if (x.assigned() && (x.max() >= c.min())) return ES_FAILED; @@ -333,7 +333,7 @@ namespace Gecode { namespace Float { namespace Rel { GECODE_ME_CHECK(b.one(home)); break; case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); break; case RT_MAYBE: @@ -361,7 +361,7 @@ namespace Gecode { namespace Float { namespace Rel { ExecStatus ReLeFloat::propagate(Space& home, const ModEventDelta&) { if (b.one()) { - if (rm != RM_PMI) { + if (rm != RM_RIMP) { GECODE_ME_CHECK(x0.lq(home, c.max())); if (x0.assigned()) { return (x0.max() >= c.min()) ? ES_FAILED : home.ES_SUBSUMED(*this); @@ -377,7 +377,7 @@ namespace Gecode { namespace Float { namespace Rel { GECODE_ME_CHECK(b.one(home)); break; case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); break; case RT_MAYBE: diff --git a/gecode/float/view.hpp b/gecode/float/view.hpp index e20b19464e..72f01edea3 100644 --- a/gecode/float/view.hpp +++ b/gecode/float/view.hpp @@ -518,11 +518,12 @@ namespace Gecode { namespace Float { //@{ /// Result of testing relation - enum RelTest { + enum class RelTest { RT_FALSE = 0, ///< Relation does not hold RT_MAYBE = 1, ///< Relation may hold or not RT_TRUE = 2 ///< Relation does hold }; + using enum RelTest; /// Test whether views \a x and \a y are equal template diff --git a/gecode/gist/spacenode.hh b/gecode/gist/spacenode.hh index a5d157b0cc..fffc3f6733 100644 --- a/gecode/gist/spacenode.hh +++ b/gecode/gist/spacenode.hh @@ -40,7 +40,7 @@ namespace Gecode { namespace Gist { /** \brief Status of nodes in the search tree */ - enum NodeStatus { + enum class NodeStatus { SOLVED, ///< Node representing a solution FAILED, ///< Node representing failure BRANCH, ///< Node representing a branch @@ -48,6 +48,7 @@ namespace Gecode { namespace Gist { STOP, ///< Node representing stop point UNSTOP, ///< Node representing ignored stop point }; + using enum NodeStatus; static const unsigned int first_bit = 24; //< First free bit in status word static const unsigned int status_mask = 7 << 20; //< Mask for accessing status diff --git a/gecode/gist/spacenode.hpp b/gecode/gist/spacenode.hpp index 41e8f635e2..6e8be34ee4 100644 --- a/gecode/gist/spacenode.hpp +++ b/gecode/gist/spacenode.hpp @@ -63,7 +63,7 @@ namespace Gecode { namespace Gist { forceinline void SpaceNode::set_status(NodeStatus s) { status_bits &= ~(status_mask); - status_bits |= s << 20; + status_bits |= std::to_underlying(s) << 20; } forceinline NodeStatus diff --git a/gecode/int.hh b/gecode/int.hh index 37ac8b8223..7bfc318254 100644 --- a/gecode/int.hh +++ b/gecode/int.hh @@ -1137,7 +1137,7 @@ namespace Gecode { * \brief Mode for reification * \ingroup TaskModelInt */ - enum ReifyMode { + enum class ReifyMode { /** * \brief Equivalence for reification (default) * @@ -1158,8 +1158,9 @@ namespace Gecode { * For a constraint \f$c\f$ and a Boolean control variable \f$b\f$ * defines that \f$c\Rightarrow b=1\f$ is propagated. */ - RM_PMI + RM_RIMP }; + using enum ReifyMode; /** * \brief Reification specification @@ -1215,7 +1216,7 @@ namespace Gecode { * \brief Relation types for integers * \ingroup TaskModelInt */ - enum IntRelType { + enum class IntRelType { IRT_EQ, ///< Equality (\f$=\f$) IRT_NQ, ///< Disequality (\f$\neq\f$) IRT_LQ, ///< Less or equal (\f$\leq\f$) @@ -1223,6 +1224,7 @@ namespace Gecode { IRT_GQ, ///< Greater or equal (\f$\geq\f$) IRT_GR ///< Greater (\f$>\f$) }; + using enum IntRelType; /// Return swapped relation type of \a irt IntRelType swap(IntRelType irt); @@ -1240,13 +1242,14 @@ namespace Gecode { * \brief Operation types for Booleans * \ingroup TaskModelInt */ - enum BoolOpType { + enum class BoolOpType { BOT_AND, ///< Conjunction BOT_OR, ///< Disjunction BOT_IMP, ///< Implication BOT_EQV, ///< Equivalence BOT_XOR ///< Exclusive or }; + using enum BoolOpType; /** * \brief Propagation levels for integer propagators @@ -1264,7 +1267,7 @@ namespace Gecode { * * \ingroup TaskModelInt */ - enum IntPropLevel { + enum class IntPropLevel : unsigned int { /// Simple propagation levels IPL_DEF = 0, ///< Default level of propagation IPL_VAL = 1, ///< Value propagation @@ -1274,9 +1277,27 @@ namespace Gecode { IPL_BASIC = 4, ///< Use basic propagation algorithm IPL_ADVANCED = 8, ///< Use advanced propagation algorithm IPL_BASIC_ADVANCED = IPL_BASIC | IPL_ADVANCED, ///< Use both - IPL_FULL = IPL_BASIC_ADVANCED, ///< Use full propagation - IPL_BITS_ = 4 ///< Number of bits required (internal) + IPL_FULL = IPL_BASIC_ADVANCED ///< Use full propagation }; + using enum IntPropLevel; + + /// Combine propagation levels \a a and \a b + constexpr IntPropLevel + operator|(IntPropLevel a, IntPropLevel b) noexcept { + return static_cast(std::to_underlying(a) | std::to_underlying(b)); + } + + /// Intersect propagation levels \a a and \a b + constexpr IntPropLevel + operator&(IntPropLevel a, IntPropLevel b) noexcept { + return static_cast(std::to_underlying(a) & std::to_underlying(b)); + } + + /// Add propagation level \a b to \a a + constexpr IntPropLevel& + operator|=(IntPropLevel& a, IntPropLevel b) noexcept { + return a = a | b; + } /// Extract value, bounds, or domain propagation from propagation level IntPropLevel vbd(IntPropLevel ipl); @@ -1295,11 +1316,12 @@ namespace Gecode { * * \ingroup TaskModelInt */ - enum TaskType { - TT_FIXP, //< Task with fixed processing time - TT_FIXS, //< Task with fixed start time - TT_FIXE //< Task with fixed end time + enum class TaskType { + TT_FIXED_PROCESSING, //< Task with fixed processing time + TT_FIXED_START, //< Task with fixed start time + TT_FIXED_END //< Task with fixed end time }; + using enum TaskType; /** * \brief Argument arrays for passing task type arguments @@ -2689,7 +2711,8 @@ namespace Gecode { public: /// Tuple set lifecycle state and finalized representation - enum State { TS_BUILDING, TS_FAILED, TS_DENSE, TS_SPARSE, TS_DENSE_COMPRESSED }; + enum class State { TS_BUILDING, TS_FAILED, TS_DENSE, TS_SPARSE, TS_DENSE_COMPRESSED }; + using enum State; public: /// Arity @@ -4047,13 +4070,13 @@ namespace Gecode { * Schedule tasks with flexible times \a flex and fixed times \a fix * on a unary resource. For each * task, it depends on \a t how the flexible and fix times are interpreted: - * - If t[i] is TT_FIXP, then + * - If t[i] is TT_FIXED_PROCESSING, then * flex[i] is the start time and fix[i] is the * processing time. - * - If t[i] is TT_FIXS, then + * - If t[i] is TT_FIXED_START, then * flex[i] is the end time and fix[i] is the * start time. - * - If t[i] is TT_FIXE, then + * - If t[i] is TT_FIXED_END, then * flex[i] is the start time and fix[i] is the * end time. * @@ -4075,8 +4098,8 @@ namespace Gecode { * - Throws an exception of type Int::ArgumentSizeMismatch, if \a s * and \a p are of different size. * - Throws an exception of type Int::OutOfLimits, if \a p contains - * an integer that is negative for a task with type TT_FIXP - * or that could generate an overflow. + * an integer that is negative for a task with type + * TT_FIXED_PROCESSING or that could generate an overflow. */ GECODE_INT_EXPORT void unary(Home home, const TaskTypeArgs& t, const IntVarArgs& flex, const IntArgs& fix, IntPropLevel ipl = IPL_DEF); @@ -4087,13 +4110,13 @@ namespace Gecode { * and whether a task is mandatory \a m (a task is mandatory if the * Boolean variable is 1) on a unary resource. For each * task, it depends on \a t how the flexible and fix times are interpreted: - * - If t[i] is TT_FIXP, then + * - If t[i] is TT_FIXED_PROCESSING, then * flex[i] is the start time and fix[i] is the * processing time. - * - If t[i] is TT_FIXS, then + * - If t[i] is TT_FIXED_START, then * flex[i] is the end time and fix[i] is the * start time. - * - If t[i] is TT_FIXE, then + * - If t[i] is TT_FIXED_END, then * flex[i] is the start time and fix[i] is the * end time. * @@ -4116,8 +4139,8 @@ namespace Gecode { * - Throws an exception of type Int::ArgumentSizeMismatch, if \a s, * \a p, or \a m are of different size. * - Throws an exception of type Int::OutOfLimits, if \a p contains - * an integer that is negative for a task with type TT_FIXP - * or that could generate an overflow. + * an integer that is negative for a task with type + * TT_FIXED_PROCESSING or that could generate an overflow. */ GECODE_INT_EXPORT void unary(Home home, const TaskTypeArgs& t, const IntVarArgs& flex, const IntArgs& fix, const BoolVarArgs& m, IntPropLevel ipl = IPL_DEF); @@ -4187,13 +4210,13 @@ namespace Gecode { * Schedule tasks with flexible times \a flex, fixed times \a fix, and * use capacity \a u on a cumulative resource with capacity \a c. For each * task, it depends on \a t how the flexible and fix times are interpreted: - * - If t[i] is TT_FIXP, then + * - If t[i] is TT_FIXED_PROCESSING, then * flex[i] is the start time and fix[i] is the * processing time. - * - If t[i] is TT_FIXS, then + * - If t[i] is TT_FIXED_START, then * flex[i] is the end time and fix[i] is the * start time. - * - If t[i] is TT_FIXE, then + * - If t[i] is TT_FIXED_END, then * flex[i] is the start time and fix[i] is the * end time. * @@ -4253,13 +4276,13 @@ namespace Gecode { * mandatory if the Boolean variable is 1) on a cumulative resource with * capacity \a c. For each * task, it depends on \a t how the flexible and fix times are interpreted: - * - If t[i] is TT_FIXP, then + * - If t[i] is TT_FIXED_PROCESSING, then * flex[i] is the start time and fix[i] is the * processing time. - * - If t[i] is TT_FIXS, then + * - If t[i] is TT_FIXED_START, then * flex[i] is the end time and fix[i] is the * start time. - * - If t[i] is TT_FIXE, then + * - If t[i] is TT_FIXED_END, then * flex[i] is the start time and fix[i] is the * end time. * @@ -5224,7 +5247,7 @@ namespace Gecode { class IntVarBranch : public VarBranch { public: /// Which variable selection - enum Select { + enum class Select { SEL_NONE = 0, ///< First unassigned SEL_RND, ///< Random (uniform, for tie breaking) SEL_MERIT_MIN, ///< With least merit @@ -5276,6 +5299,7 @@ namespace Gecode { */ SEL_REGRET_MAX_MAX }; + using enum Select; protected: /// Which variable to select @@ -5312,7 +5336,7 @@ namespace Gecode { class BoolVarBranch : public VarBranch { public: /// Which variable selection - enum Select { + enum class Select { SEL_NONE = 0, ///< First unassigned SEL_RND, ///< Random (uniform, for tie breaking) SEL_MERIT_MIN, ///< With least merit @@ -5326,6 +5350,7 @@ namespace Gecode { SEL_CHB_MIN, ///< With lowest CHB SEL_CHB_MAX ///< With highest CHB }; + using enum Select; protected: /// Which variable to select @@ -5512,7 +5537,7 @@ namespace Gecode { class IntValBranch : public ValBranch { public: /// Which value selection - enum Select { + enum class Select { SEL_MIN, ///< Select smallest value SEL_MED, ///< Select greatest value not greater than the median SEL_MAX, ///< Select largest value @@ -5525,6 +5550,7 @@ namespace Gecode { SEL_VALUES_MIN, ///< Select all values starting from smallest SEL_VALUES_MAX ///< Select all values starting from largest }; + using enum Select; protected: /// Which value to select @@ -5549,12 +5575,13 @@ namespace Gecode { class BoolValBranch : public ValBranch { public: /// Which value selection - enum Select { + enum class Select { SEL_MIN, ///< Select smallest value SEL_MAX, ///< Select largest value SEL_RND, ///< Select random value SEL_VAL_COMMIT ///< Select value according to user-defined functions }; + using enum Select; protected: /// Which value to select @@ -5633,13 +5660,14 @@ namespace Gecode { class IntAssign : public ValBranch { public: /// Which value selection - enum Select { + enum class Select { SEL_MIN, ///< Select smallest value SEL_MED, ///< Select greatest value not greater than the median SEL_MAX, ///< Select largest value SEL_RND, ///< Select random value SEL_VAL_COMMIT ///< Select value according to user-defined functions }; + using enum Select; protected: /// Which value to select @@ -5664,12 +5692,13 @@ namespace Gecode { class BoolAssign : public ValBranch { public: /// Which value selection - enum Select { + enum class Select { SEL_MIN, ///< Select smallest value SEL_MAX, ///< Select largest value SEL_RND, ///< Select random value SEL_VAL_COMMIT ///< Select value according to user-defined functions }; + using enum Select; protected: /// Which value to select diff --git a/gecode/int/arithmetic.cpp b/gecode/int/arithmetic.cpp index 5d7a0b4802..5aa226e2de 100644 --- a/gecode/int/arithmetic.cpp +++ b/gecode/int/arithmetic.cpp @@ -326,8 +326,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Arithmetic::ReGcd::post(home, x0, x1, x2, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Arithmetic::ReGcd::post(home, x0, x1, x2, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Arithmetic::ReGcd::post(home, x0, x1, x2, r.var()))); break; default: GECODE_NEVER; @@ -345,8 +345,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Arithmetic::ReDivides::post(home, divisor, dividend, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Arithmetic::ReDivides::post(home, divisor, dividend, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Arithmetic::ReDivides::post(home, divisor, dividend, r.var()))); break; default: GECODE_NEVER; @@ -373,8 +373,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Arithmetic::ReProduct::post(home, xv, y, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Arithmetic::ReProduct::post(home, xv, y, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Arithmetic::ReProduct::post(home, xv, y, r.var()))); break; default: GECODE_NEVER; @@ -405,8 +405,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Arithmetic::ReProductMod::post(home, xv, m, yv, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Arithmetic::ReProductMod::post(home, xv, m, yv, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Arithmetic::ReProductMod::post(home, xv, m, yv, r.var()))); break; default: GECODE_NEVER; @@ -433,8 +433,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Arithmetic::ReProductModVar::post(home, xv, m, y, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Arithmetic::ReProductModVar::post(home, xv, m, y, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Arithmetic::ReProductModVar::post(home, xv, m, y, r.var()))); break; default: GECODE_NEVER; diff --git a/gecode/int/arithmetic/divides.hpp b/gecode/int/arithmetic/divides.hpp index a4fa188197..fd88b2ef38 100644 --- a/gecode/int/arithmetic/divides.hpp +++ b/gecode/int/arithmetic/divides.hpp @@ -109,7 +109,7 @@ namespace Gecode { namespace Int { namespace Arithmetic { template inline ExecStatus ReDivides::post(Home home, IntView x0, IntView x1, BoolView b) { - if (b.one() && (rm == RM_PMI)) + if (b.one() && (rm == RM_RIMP)) return ES_OK; if (b.zero() && (rm == RM_IMP)) return ES_OK; @@ -120,7 +120,7 @@ namespace Gecode { namespace Int { namespace Arithmetic { return ES_OK; } if (rt == RT_FALSE) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); return ES_OK; } @@ -149,7 +149,7 @@ namespace Gecode { namespace Int { namespace Arithmetic { inline ExecStatus ReDivides::propagate(Space& home, const ModEventDelta&) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return home.ES_SUBSUMED(*this); const unsigned int s0 = x0.size(); const unsigned int s1 = x1.size(); @@ -183,7 +183,7 @@ namespace Gecode { namespace Int { namespace Arithmetic { GECODE_ME_CHECK(b.one_none(home)); break; case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); break; case RT_MAYBE: diff --git a/gecode/int/arithmetic/gcd.hpp b/gecode/int/arithmetic/gcd.hpp index d94f58dcfe..cbadce559c 100644 --- a/gecode/int/arithmetic/gcd.hpp +++ b/gecode/int/arithmetic/gcd.hpp @@ -329,7 +329,7 @@ namespace Gecode { namespace Int { namespace Arithmetic { inline ExecStatus ReGcd::post(Home home, IntView x0, IntView x1, IntView x2, BoolView b) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return ES_OK; return Gcd::post(home, x0, x1, x2); } @@ -374,7 +374,7 @@ namespace Gecode { namespace Int { namespace Arithmetic { inline ExecStatus ReGcd::propagate(Space& home, const ModEventDelta&) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return home.ES_SUBSUMED(*this); GECODE_REWRITE(*this, Gcd::post(home(*this), x0, x1, x2)); } @@ -391,7 +391,7 @@ namespace Gecode { namespace Int { namespace Arithmetic { switch (gcd_status(x0, x1, x2)) { case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); return home.ES_SUBSUMED(*this); case RT_TRUE: diff --git a/gecode/int/arithmetic/product-mod.hpp b/gecode/int/arithmetic/product-mod.hpp index 159c963717..35e02fa735 100644 --- a/gecode/int/arithmetic/product-mod.hpp +++ b/gecode/int/arithmetic/product-mod.hpp @@ -705,7 +705,7 @@ namespace Gecode { namespace Int { namespace Arithmetic { inline ExecStatus ReProductModVar::post(Home home, ViewArray& x, IntView m, IntView y, BoolView b) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return ES_OK; return ProductModVar::post(home, x, m, y); } @@ -750,7 +750,7 @@ namespace Gecode { namespace Int { namespace Arithmetic { inline ExecStatus ReProductModVar::propagate(Space& home, const ModEventDelta&) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return home.ES_SUBSUMED(*this); GECODE_REWRITE(*this, ProductModVar::post(home(*this), x, m, y)); } @@ -772,7 +772,7 @@ namespace Gecode { namespace Int { namespace Arithmetic { GECODE_ME_CHECK(b.one_none(home)); return home.ES_SUBSUMED(*this); case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); return home.ES_SUBSUMED(*this); case RT_MAYBE: @@ -807,7 +807,7 @@ namespace Gecode { namespace Int { namespace Arithmetic { template inline ExecStatus ReProductMod::post(Home home, ViewArray& x, int m, IntView y, BoolView b) { - if (b.one() && (rm == RM_PMI)) + if (b.one() && (rm == RM_RIMP)) return ES_OK; if (b.zero() && (rm == RM_IMP)) return ES_OK; @@ -819,7 +819,7 @@ namespace Gecode { namespace Int { namespace Arithmetic { GECODE_ME_CHECK(b.one(home)); return ES_OK; case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); return ES_OK; case RT_MAYBE: @@ -864,7 +864,7 @@ namespace Gecode { namespace Int { namespace Arithmetic { inline ExecStatus ReProductMod::propagate(Space& home, const ModEventDelta&) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return home.ES_SUBSUMED(*this); GECODE_REWRITE(*this, ProductMod::post(home(*this), x, m, y)); } @@ -888,7 +888,7 @@ namespace Gecode { namespace Int { namespace Arithmetic { GECODE_ME_CHECK(b.one_none(home)); return home.ES_SUBSUMED(*this); case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); return home.ES_SUBSUMED(*this); case RT_MAYBE: diff --git a/gecode/int/arithmetic/product.hpp b/gecode/int/arithmetic/product.hpp index 6ff1252c02..5ef15b9dde 100644 --- a/gecode/int/arithmetic/product.hpp +++ b/gecode/int/arithmetic/product.hpp @@ -541,7 +541,7 @@ namespace Gecode { namespace Int { namespace Arithmetic { template inline ExecStatus ReProduct::post(Home home, ViewArray& x, IntView y, BoolView b) { - if (b.one() && (rm == RM_PMI)) + if (b.one() && (rm == RM_RIMP)) return ES_OK; if (b.zero() && (rm == RM_IMP)) return ES_OK; @@ -587,7 +587,7 @@ namespace Gecode { namespace Int { namespace Arithmetic { inline ExecStatus ReProduct::propagate(Space& home, const ModEventDelta&) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return home.ES_SUBSUMED(*this); GECODE_REWRITE(*this, Product::post(home(*this), x, y)); } @@ -611,7 +611,7 @@ namespace Gecode { namespace Int { namespace Arithmetic { GECODE_ME_CHECK(b.one_none(home)); return home.ES_SUBSUMED(*this); case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); return home.ES_SUBSUMED(*this); case RT_MAYBE: diff --git a/gecode/int/bool.cpp b/gecode/int/bool.cpp index 0784c47202..551a0cb837 100644 --- a/gecode/int/bool.cpp +++ b/gecode/int/bool.cpp @@ -123,8 +123,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Rel::ReEqBnd::post(home, x0, x1, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Rel::ReEqBnd::post(home, x0, x1, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Rel::ReEqBnd::post(home, x0, x1, r.var()))); break; default: throw UnknownReifyMode("Int::rel"); @@ -137,9 +137,9 @@ namespace Gecode { GECODE_ES_FAIL((Bool::Eqv::post(home, x0, x1, nr))); break; case RM_IMP: - GECODE_ES_FAIL((Rel::ReEqBnd::post(home, x0, x1, nr))); + GECODE_ES_FAIL((Rel::ReEqBnd::post(home, x0, x1, nr))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((Rel::ReEqBnd::post(home, x0, x1, nr))); break; default: @@ -157,8 +157,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Rel::ReLq::post(home, x0, x1, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Rel::ReLq::post(home, x0, x1, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Rel::ReLq::post(home, x0, x1, r.var()))); break; default: throw UnknownReifyMode("Int::rel"); @@ -174,9 +174,9 @@ namespace Gecode { GECODE_ES_FAIL((Bool::Or::post(home, n0, x1, nr))); } break; case RM_IMP: - GECODE_ES_FAIL((Rel::ReLq::post(home, x0, x1, nr))); + GECODE_ES_FAIL((Rel::ReLq::post(home, x0, x1, nr))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((Rel::ReLq::post(home, x0, x1, nr))); break; default: @@ -208,7 +208,7 @@ namespace Gecode { NegBoolView ny(y); GECODE_ES_FAIL((Bool::BinOrTrue::post(home, nx, ny))); } break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((Bool::BinOrTrue::post(home, x, y))); break; default: @@ -225,7 +225,7 @@ namespace Gecode { NegBoolView ny(y); GECODE_ES_FAIL((Bool::BinOrTrue::post(home, x, ny))); } break; - case RM_PMI: { + case RM_RIMP: { NegBoolView nx(x); GECODE_ES_FAIL((Bool::BinOrTrue::post(home, nx, y))); } break; @@ -239,7 +239,7 @@ namespace Gecode { case RM_IMP: GECODE_ME_FAIL(y.zero(home)); break; - case RM_PMI: + case RM_RIMP: break; default: throw UnknownReifyMode("Int::rel"); @@ -248,7 +248,7 @@ namespace Gecode { case IRT_GQ: switch (r.mode()) { case RM_EQV: - case RM_PMI: + case RM_RIMP: GECODE_ME_FAIL(y.one(home)); break; case RM_IMP: @@ -274,7 +274,7 @@ namespace Gecode { NegBoolView ny(y); GECODE_ES_FAIL((Bool::BinOrTrue::post(home, nx, ny))); } break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((Bool::BinOrTrue::post(home, x, y))); break; default: @@ -291,7 +291,7 @@ namespace Gecode { NegBoolView ny(y); GECODE_ES_FAIL((Bool::BinOrTrue::post(home, x, ny))); } break; - case RM_PMI: { + case RM_RIMP: { NegBoolView nx(x); GECODE_ES_FAIL((Bool::BinOrTrue::post(home, nx, y))); } break; @@ -305,7 +305,7 @@ namespace Gecode { case RM_IMP: GECODE_ME_FAIL(y.zero(home)); break; - case RM_PMI: + case RM_RIMP: break; default: throw UnknownReifyMode("Int::rel"); @@ -314,7 +314,7 @@ namespace Gecode { case IRT_LQ: switch (r.mode()) { case RM_EQV: - case RM_PMI: + case RM_RIMP: GECODE_ME_FAIL(y.one(home)); break; case RM_IMP: diff --git a/gecode/int/bool/eq.hpp b/gecode/int/bool/eq.hpp index d7178fe18a..36ad49705d 100644 --- a/gecode/int/bool/eq.hpp +++ b/gecode/int/bool/eq.hpp @@ -59,7 +59,7 @@ namespace Gecode { namespace Int { namespace Bool { switch (bool_test(b0, b1)) { case BT_SAME: return ES_OK; - case BT_COMP: + case BT_COMPLEMENT: return ES_FAILED; case BT_NONE: if (b0.zero()) { diff --git a/gecode/int/bool/eqv.hpp b/gecode/int/bool/eqv.hpp index 7bf702308d..30159d981a 100644 --- a/gecode/int/bool/eqv.hpp +++ b/gecode/int/bool/eqv.hpp @@ -49,7 +49,7 @@ namespace Gecode { namespace Int { namespace Bool { case BT_SAME: GECODE_ME_CHECK(b2.one(home)); break; - case BT_COMP: + case BT_COMPLEMENT: GECODE_ME_CHECK(b2.zero(home)); break; case BT_NONE: diff --git a/gecode/int/bool/or.hpp b/gecode/int/bool/or.hpp index e2e3058206..9b6f58cd99 100644 --- a/gecode/int/bool/or.hpp +++ b/gecode/int/bool/or.hpp @@ -121,7 +121,7 @@ namespace Gecode { namespace Int { namespace Bool { case BT_SAME: GECODE_ME_CHECK(b0.one(home)); break; - case BT_COMP: + case BT_COMPLEMENT: break; case BT_NONE: if (b0.zero()) { @@ -507,7 +507,7 @@ namespace Gecode { namespace Int { namespace Bool { switch (bool_test(b0, b1)) { case BT_SAME: return Eq::post(home, b0, b2); - case BT_COMP: + case BT_COMPLEMENT: GECODE_ME_CHECK(b2.one(home)); break; case BT_NONE: @@ -547,7 +547,7 @@ namespace Gecode { namespace Int { namespace Bool { switch (bool_test(x0, x2)) { case BT_SAME: return home.ES_SUBSUMED(*this); - case BT_COMP: + case BT_COMPLEMENT: return ES_FAILED; case BT_NONE: return ES_FIX; @@ -572,7 +572,7 @@ namespace Gecode { namespace Int { namespace Bool { switch (bool_test(x1, x2)) { case BT_SAME: return home.ES_SUBSUMED(*this); - case BT_COMP: + case BT_COMPLEMENT: return ES_FAILED; case BT_NONE: return ES_FIX; diff --git a/gecode/int/cumulative.cpp b/gecode/int/cumulative.cpp index ec9bac15dd..b5fd9d0cb2 100644 --- a/gecode/int/cumulative.cpp +++ b/gecode/int/cumulative.cpp @@ -74,7 +74,7 @@ namespace Gecode { namespace Int { namespace Cumulative { } else { bool fixp = true; for (int i = 0; i < t.size(); i++) - if (t[i] != TT_FIXP) { + if (t[i] != TT_FIXED_PROCESSING) { fixp = false; break; } @@ -133,7 +133,7 @@ namespace Gecode { namespace Int { namespace Cumulative { } else { bool fixp = true; for (int i = 0; i < t.size(); i++) - if (t[i] != TT_FIXP) { + if (t[i] != TT_FIXED_PROCESSING) { fixp = false; break; } diff --git a/gecode/int/cumulatives/val.hpp b/gecode/int/cumulatives/val.hpp index d99f9ee49d..3397f6f72b 100644 --- a/gecode/int/cumulatives/val.hpp +++ b/gecode/int/cumulatives/val.hpp @@ -115,12 +115,13 @@ namespace Gecode { namespace Int { namespace Cumulatives { } /// Types of events for the sweep-line - typedef enum { EVENT_CHCK, EVENT_PROF, EVENT_PRUN } ev_t; + enum class EventType { EVENT_CHECK, EVENT_PROF, EVENT_PRUNE }; + using enum EventType; /// An event collects the information for one event for the sweep-line class Event { public: /// The type of the event - ev_t e; + EventType e; /// The task this event refers to int task; /// The date of this event @@ -128,7 +129,7 @@ namespace Gecode { namespace Int { namespace Cumulatives { /// The quantity changed by this event (if any) int inc; /// Simple constructor - Event(ev_t _e, int _task, int _date, int _inc = 0) : e(_e), task(_task), date(_date), inc(_inc) {} + Event(EventType _e, int _task, int _date, int _inc = 0) : e(_e), task(_task), date(_date), inc(_inc) {} // Default constructor for region-allocated memory // NOLINTNEXTLINE(modernize-use-equals-default) @@ -140,7 +141,7 @@ namespace Gecode { namespace Int { namespace Cumulatives { if (date == ev.date) { if (e == EVENT_PROF && ev.e != EVENT_PROF) return true; - if (e == EVENT_CHCK && ev.e == EVENT_PRUN) + if (e == EVENT_CHECK && ev.e == EVENT_PRUNE) return true; return false; } @@ -258,8 +259,8 @@ namespace Gecode { namespace Int { namespace Cumulatives { for (int t = s.size(); t--;) { if (m[t].assigned() && m[t].val() == r && s[t].max() < e[t].min()) { if (at_most ? u[t].min() > std::min(0, c[r]) : u[t].max() < std::max(0, c[r])) { - GECODE_PUSH_EVENTS(Event(EVENT_CHCK, t, s[t].max(), 1)); - GECODE_PUSH_EVENTS(Event(EVENT_CHCK, t, e[t].min(), -1)); + GECODE_PUSH_EVENTS(Event(EVENT_CHECK, t, s[t].max(), 1)); + GECODE_PUSH_EVENTS(Event(EVENT_CHECK, t, e[t].min(), -1)); } if (at_most ? u[t].min() > 0 : u[t].max() < 0) { GECODE_PUSH_EVENTS(Event(EVENT_PROF, t, s[t].max(), at_most ? u[t].min() : u[t].max())); @@ -273,7 +274,7 @@ namespace Gecode { namespace Int { namespace Cumulatives { GECODE_PUSH_EVENTS(Event(EVENT_PROF, t, e[t].max(), at_most ? -u[t].min() : -u[t].max())); } if (!(m[t].assigned() && u[t].assigned() && s[t].assigned() && e[t].assigned())) { - GECODE_PUSH_EVENTS(Event(EVENT_PRUN, t, s[t].min())); + GECODE_PUSH_EVENTS(Event(EVENT_PRUNE, t, s[t].min())); } } } @@ -300,19 +301,19 @@ namespace Gecode { namespace Int { namespace Cumulatives { d = events[ei].date; while (ei < events_size) { - if (events[ei].e != EVENT_PRUN) { + if (events[ei].e != EVENT_PRUNE) { if (d != events[ei].date) { GECODE_ES_CHECK(prune(home, d, events[ei].date - 1, r, ntask, su, contribution, prune_tasks, prune_tasks_size)); d = events[ei].date; } - if (events[ei].e == EVENT_CHCK) { + if (events[ei].e == EVENT_CHECK) { ntask += events[ei].inc; } else /* if (events[ei].e == EVENT_PROF) */ { su += events[ei].inc; contribution[events[ei].task] += events[ei].inc; } - } else /* if (events[ei].e == EVENT_PRUN) */ { + } else /* if (events[ei].e == EVENT_PRUNE) */ { assert(prune_tasks_size < s.size()); prune_tasks[prune_tasks_size++] = events[ei].task; } diff --git a/gecode/int/dom.cpp b/gecode/int/dom.cpp index bffe1d5d14..37bd92534a 100644 --- a/gecode/int/dom.cpp +++ b/gecode/int/dom.cpp @@ -115,8 +115,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Rel::ReEqDomInt::post(home, x, n, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Rel::ReEqDomInt::post(home, x, n, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Rel::ReEqDomInt::post(home, x, n, r.var()))); break; default: throw UnknownReifyMode("Int::dom"); @@ -136,8 +136,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Dom::ReRange::post(home, x, min, max, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Dom::ReRange::post(home, x, min, max, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Dom::ReRange::post(home, x, min, max, r.var()))); break; default: throw UnknownReifyMode("Int::dom"); @@ -157,8 +157,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Dom::ReIntSet::post(home, x, is, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Dom::ReIntSet::post(home, x, is, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Dom::ReIntSet::post(home, x, is, r.var()))); break; default: throw UnknownReifyMode("Int::dom"); diff --git a/gecode/int/dom/range.hpp b/gecode/int/dom/range.hpp index fb6cca50ba..c51232b262 100644 --- a/gecode/int/dom/range.hpp +++ b/gecode/int/dom/range.hpp @@ -45,7 +45,7 @@ namespace Gecode { namespace Int { namespace Dom { if (min == max) { return Rel::ReEqDomInt::post(home, x, min, b); } else if ((min > max) || (max < x.min()) || (min > x.max())) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return ES_OK; GECODE_ME_CHECK(b.zero(home)); } else if ((min <= x.min()) && (x.max() <= max)) { @@ -53,7 +53,7 @@ namespace Gecode { namespace Int { namespace Dom { return ES_OK; GECODE_ME_CHECK(b.one(home)); } else if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return ES_OK; GECODE_ME_CHECK(x.gq(home, min)); GECODE_ME_CHECK(x.lq(home, max)); @@ -83,7 +83,7 @@ namespace Gecode { namespace Int { namespace Dom { ExecStatus ReRange::propagate(Space& home, const ModEventDelta&) { if (b.one()) { - if (rm != RM_PMI) { + if (rm != RM_RIMP) { GECODE_ME_CHECK(x0.gq(home, min)); GECODE_ME_CHECK(x0.lq(home, max)); } @@ -99,7 +99,7 @@ namespace Gecode { namespace Int { namespace Dom { GECODE_ME_CHECK(b.one_none(home)); return home.ES_SUBSUMED(*this); } else if ((x0.max() < min) || (x0.min() > max)) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); return home.ES_SUBSUMED(*this); } else if (!x0.range()) { @@ -112,7 +112,7 @@ namespace Gecode { namespace Int { namespace Dom { GECODE_ME_CHECK(b.one_none(home)); return home.ES_SUBSUMED(*this); case Iter::Ranges::CS_DISJOINT: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); return home.ES_SUBSUMED(*this); case Iter::Ranges::CS_NONE: diff --git a/gecode/int/dom/set.hpp b/gecode/int/dom/set.hpp index a9e979b2b1..c81af35798 100644 --- a/gecode/int/dom/set.hpp +++ b/gecode/int/dom/set.hpp @@ -52,13 +52,13 @@ namespace Gecode { namespace Int { namespace Dom { ExecStatus ReIntSet::post(Home home, View x, const IntSet& s, BoolView b) { if (s.ranges() == 0) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return ES_OK; GECODE_ME_CHECK(b.zero(home)); } else if (s.ranges() == 1) { return ReRange::post(home, x, s.min(), s.max(), b); } else if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return ES_OK; IntSetRanges i_is(s); GECODE_ME_CHECK(x.inter_r(home, i_is, false)); @@ -89,7 +89,7 @@ namespace Gecode { namespace Int { namespace Dom { ReIntSet::propagate(Space& home, const ModEventDelta&) { IntSetRanges i_is(is); if (b.one()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(x0.inter_r(home, i_is, false)); return home.ES_SUBSUMED(*this); } @@ -108,7 +108,7 @@ namespace Gecode { namespace Int { namespace Dom { GECODE_ME_CHECK(b.one_none(home)); return home.ES_SUBSUMED(*this); case Iter::Ranges::CS_DISJOINT: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); return home.ES_SUBSUMED(*this); case Iter::Ranges::CS_NONE: diff --git a/gecode/int/element/int.hpp b/gecode/int/element/int.hpp index 6270423ee5..5b42003cc8 100644 --- a/gecode/int/element/int.hpp +++ b/gecode/int/element/int.hpp @@ -416,16 +416,16 @@ namespace Gecode { namespace Int { namespace Element { switch (val_type) { case Support::IT_CHAR: return Int::post(home, c, x0, x1); - case Support::IT_SHRT: + case Support::IT_SHORT: return Int::post(home, c, x0, x1); default: break; } break; - case Support::IT_SHRT: + case Support::IT_SHORT: switch (val_type) { case Support::IT_CHAR: - case Support::IT_SHRT: + case Support::IT_SHORT: return Int::post(home, c, x0, x1); default: break; diff --git a/gecode/int/extensional-tuple-set.cpp b/gecode/int/extensional-tuple-set.cpp index 13957db4f2..35b44ec2b1 100644 --- a/gecode/int/extensional-tuple-set.cpp +++ b/gecode/int/extensional-tuple-set.cpp @@ -762,7 +762,7 @@ namespace Gecode { namespace Int { namespace Extensional { static ExecStatus post(Home home, ViewArray& x, const TupleSet& ts, CtrlView b) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return ES_OK; return SparseInc::post(home, x, ts); } @@ -804,7 +804,7 @@ namespace Gecode { namespace Int { namespace Extensional { ExecStatus propagate(Space& home, const ModEventDelta&) override { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return home.ES_SUBSUMED(*this); TupleSet keep(ts); GECODE_REWRITE(*this, post_pos(home(*this), x, keep)); @@ -817,7 +817,7 @@ namespace Gecode { namespace Int { namespace Extensional { } if (active_limit == 0U) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); return home.ES_SUBSUMED(*this); } @@ -876,8 +876,8 @@ namespace Gecode { namespace Int { namespace Extensional { case RM_EQV: return RM_EQV; case RM_IMP: - return RM_PMI; - case RM_PMI: + return RM_RIMP; + case RM_RIMP: return RM_IMP; default: GECODE_NEVER; @@ -893,8 +893,8 @@ namespace Gecode { namespace Int { namespace Extensional { return SparseReifInc::post(home, x, t, b); case RM_IMP: return SparseReifInc::post(home, x, t, b); - case RM_PMI: - return SparseReifInc::post(home, x, t, b); + case RM_RIMP: + return SparseReifInc::post(home, x, t, b); default: throw UnknownReifyMode("Int::extensional"); } @@ -908,8 +908,8 @@ namespace Gecode { namespace Int { namespace Extensional { return post_reified_compact(home, x, t, b); case RM_IMP: return post_reified_compact(home, x, t, b); - case RM_PMI: - return post_reified_compact(home, x, t, b); + case RM_RIMP: + return post_reified_compact(home, x, t, b); default: throw UnknownReifyMode("Int::extensional"); } @@ -923,8 +923,8 @@ namespace Gecode { namespace Int { namespace Extensional { return post_reified_compact_compressed(home, x, t, b); case RM_IMP: return post_reified_compact_compressed(home, x, t, b); - case RM_PMI: - return post_reified_compact_compressed(home, x, t, b); + case RM_RIMP: + return post_reified_compact_compressed(home, x, t, b); default: throw UnknownReifyMode("Int::extensional"); } @@ -960,7 +960,7 @@ namespace Gecode { namespace Int { namespace Extensional { if (!value) GECODE_ME_CHECK(b.zero(home)); break; - case RM_PMI: + case RM_RIMP: if (value) GECODE_ME_CHECK(b.one(home)); break; diff --git a/gecode/int/extensional.hh b/gecode/int/extensional.hh index fbc63a131d..7d719b0c84 100644 --- a/gecode/int/extensional.hh +++ b/gecode/int/extensional.hh @@ -474,12 +474,20 @@ namespace Gecode { namespace Int { namespace Extensional { public: /// Type of status - enum StatusType { + enum class StatusType { SINGLE = 0, ///< A single view has been touched MULTIPLE = 1, ///< Multiple views have been touched NONE = 2, ///< No view has been touched PROPAGATING = 3 ///< The propagator is currently running }; + /// A single view has been touched + static constexpr StatusType SINGLE = StatusType::SINGLE; + /// Multiple views have been touched + static constexpr StatusType MULTIPLE = StatusType::MULTIPLE; + /// No view has been touched + static constexpr StatusType NONE = StatusType::NONE; + /// The propagator is currently running + static constexpr StatusType PROPAGATING = StatusType::PROPAGATING; /// Initialize with status \a t CompactStatus(StatusType t); /// Copy constructor diff --git a/gecode/int/extensional/compact.hpp b/gecode/int/extensional/compact.hpp index 5a86cfa0c7..097475059d 100644 --- a/gecode/int/extensional/compact.hpp +++ b/gecode/int/extensional/compact.hpp @@ -138,7 +138,7 @@ namespace Gecode { namespace Int { namespace Extensional { template forceinline CompactStatus::CompactStatus(StatusType t) - : s(t) {} + : s(std::to_underlying(t)) {} template forceinline typename CompactStatus::StatusType @@ -157,22 +157,22 @@ namespace Gecode { namespace Int { namespace Extensional { CompactStatus::touched(Advisor& a) { if (type() == NONE) { s = reinterpret_cast(&a); - assert((s & 0b11) == SINGLE); + assert((s & 0b11) == std::to_underlying(SINGLE)); } else if ((type() == SINGLE) && !single(a)) { - s = MULTIPLE; + s = std::to_underlying(MULTIPLE); } } template forceinline void CompactStatus::none(void) { - s = NONE; + s = std::to_underlying(NONE); } template forceinline void CompactStatus::propagating(void) { - s = PROPAGATING; + s = std::to_underlying(PROPAGATING); } /* @@ -235,7 +235,7 @@ namespace Gecode { namespace Int { namespace Extensional { switch (Gecode::Support::u_type(width)) { case Gecode::Support::IT_CHAR: return Factory::template copy>(home, source); - case Gecode::Support::IT_SHRT: + case Gecode::Support::IT_SHORT: return Factory::template copy>(home, source); case Gecode::Support::IT_INT: if (std::is_same>::value) @@ -876,7 +876,7 @@ namespace Gecode { namespace Int { namespace Extensional { static ExecStatus propagate(Actor& actor, Space& home) { if (actor.b.one()) { - if (Actor::mode == RM_PMI) + if (Actor::mode == RM_RIMP) return home.ES_SUBSUMED(actor); TupleSet keep(actor.ts); GECODE_REWRITE(actor, Actor::post_pos(home(actor), actor.y, keep)); @@ -889,7 +889,7 @@ namespace Gecode { namespace Int { namespace Extensional { } if (actor.table.empty()) { - if (Actor::mode != RM_PMI) + if (Actor::mode != RM_RIMP) GECODE_ME_CHECK(actor.b.zero_none(home)); return home.ES_SUBSUMED(actor); } @@ -1029,7 +1029,7 @@ namespace Gecode { namespace Int { namespace Extensional { switch (Gecode::Support::u_type(ts.words())) { case Gecode::Support::IT_CHAR: return PosCompact>::post(home, x, ts); - case Gecode::Support::IT_SHRT: + case Gecode::Support::IT_SHORT: return PosCompact>::post(home, x, ts); case Gecode::Support::IT_INT: return PosCompact>::post(home, x, ts); @@ -1131,7 +1131,7 @@ namespace Gecode { namespace Int { namespace Extensional { switch (Gecode::Support::u_type(ts.words())) { case Gecode::Support::IT_CHAR: return NegCompact>::post(home, x, ts); - case Gecode::Support::IT_SHRT: + case Gecode::Support::IT_SHORT: return NegCompact>::post(home, x, ts); case Gecode::Support::IT_INT: return NegCompact>::post(home, x, ts); @@ -1175,7 +1175,7 @@ namespace Gecode { namespace Int { namespace Extensional { forceinline ExecStatus ReCompact::post(Home home, ViewArray& x, const TupleSet& ts, CtrlView b) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return ES_OK; return post_positive_compact(home, x, ts); } @@ -1235,7 +1235,7 @@ namespace Gecode { namespace Int { namespace Extensional { // Enforce invariant that there is at least one tuple... if (ts.tuples() == 0) { if (x.size() != 0) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); } else { if (rm != RM_IMP) @@ -1248,7 +1248,7 @@ namespace Gecode { namespace Int { namespace Extensional { TupleSet::Ranges rs(ts, i); ViewRanges rx(x[i]); if (Iter::Ranges::disjoint(rs, rx)) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); return ES_OK; } @@ -1270,7 +1270,7 @@ namespace Gecode { namespace Int { namespace Extensional { switch (Gecode::Support::u_type(ts.words())) { case Gecode::Support::IT_CHAR: return ReCompact, CtrlView, rm>::post(home, x, ts, b); - case Gecode::Support::IT_SHRT: + case Gecode::Support::IT_SHORT: return ReCompact, CtrlView, rm>::post(home, x, ts, b); case Gecode::Support::IT_INT: return ReCompact, CtrlView, rm>::post(home, x, ts, b); @@ -1589,7 +1589,7 @@ namespace Gecode { namespace Int { namespace Extensional { switch (Gecode::Support::u_type(ts.words())) { case Gecode::Support::IT_CHAR: return PosCompactCompressed>::post(home, x, ts); - case Gecode::Support::IT_SHRT: + case Gecode::Support::IT_SHORT: return PosCompactCompressed>::post(home, x, ts); case Gecode::Support::IT_INT: return PosCompactCompressed>::post(home, x, ts); @@ -1691,7 +1691,7 @@ namespace Gecode { namespace Int { namespace Extensional { switch (Gecode::Support::u_type(ts.words())) { case Gecode::Support::IT_CHAR: return NegCompactCompressed>::post(home, x, ts); - case Gecode::Support::IT_SHRT: + case Gecode::Support::IT_SHORT: return NegCompactCompressed>::post(home, x, ts); case Gecode::Support::IT_INT: return NegCompactCompressed>::post(home, x, ts); @@ -1745,7 +1745,7 @@ namespace Gecode { namespace Int { namespace Extensional { static ExecStatus post(Home home, ViewArray& x, const TupleSet& ts, CtrlView b) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return ES_OK; return post_positive_compact_compressed(home, x, ts); } @@ -1796,7 +1796,7 @@ namespace Gecode { namespace Int { namespace Extensional { post_reified_compact_compressed(Home home, ViewArray& x, const TupleSet& ts, CtrlView b) { if (ts.tuples() == 0) { if (x.size() != 0) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); } else { if (rm != RM_IMP) @@ -1808,7 +1808,7 @@ namespace Gecode { namespace Int { namespace Extensional { TupleSet::Ranges rs(ts, i); ViewRanges rx(x[i]); if (Iter::Ranges::disjoint(rs, rx)) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); return ES_OK; } @@ -1830,7 +1830,7 @@ namespace Gecode { namespace Int { namespace Extensional { switch (Gecode::Support::u_type(ts.words())) { case Gecode::Support::IT_CHAR: return ReCompactCompressed, CtrlView, rm>::post(home, x, ts, b); - case Gecode::Support::IT_SHRT: + case Gecode::Support::IT_SHORT: return ReCompactCompressed, CtrlView, rm>::post(home, x, ts, b); case Gecode::Support::IT_INT: return ReCompactCompressed, CtrlView, rm>::post(home, x, ts, b); diff --git a/gecode/int/extensional/layered-graph.hpp b/gecode/int/extensional/layered-graph.hpp index 4232166d54..57d1855392 100644 --- a/gecode/int/extensional/layered-graph.hpp +++ b/gecode/int/extensional/layered-graph.hpp @@ -863,14 +863,14 @@ namespace Gecode { namespace Int { namespace Extensional { switch (t_val) { case Gecode::Support::IT_CHAR: // fall through - case Gecode::Support::IT_SHRT: + case Gecode::Support::IT_SHORT: switch (t_state_idx) { case Gecode::Support::IT_CHAR: switch (t_degree) { case Gecode::Support::IT_CHAR: return Extensional::LayeredGraph::View, short int, unsigned char, unsigned char>::post(home, x, dfa); - case Gecode::Support::IT_SHRT: + case Gecode::Support::IT_SHORT: return Extensional::LayeredGraph::View, short int, unsigned short int, unsigned char>::post(home, x, dfa); case Gecode::Support::IT_INT: @@ -880,12 +880,12 @@ namespace Gecode { namespace Int { namespace Extensional { GECODE_NEVER; } break; - case Gecode::Support::IT_SHRT: + case Gecode::Support::IT_SHORT: switch (t_degree) { case Gecode::Support::IT_CHAR: return Extensional::LayeredGraph::View, short int, unsigned char, unsigned short int>::post(home, x, dfa); - case Gecode::Support::IT_SHRT: + case Gecode::Support::IT_SHORT: return Extensional::LayeredGraph::View, short int, unsigned short int, unsigned short int>::post(home, x, dfa); case Gecode::Support::IT_INT: @@ -900,7 +900,7 @@ namespace Gecode { namespace Int { namespace Extensional { case Gecode::Support::IT_CHAR: return Extensional::LayeredGraph::View, short int, unsigned char, unsigned int>::post(home, x, dfa); - case Gecode::Support::IT_SHRT: + case Gecode::Support::IT_SHORT: return Extensional::LayeredGraph::View, short int, unsigned short int, unsigned int>::post(home, x, dfa); case Gecode::Support::IT_INT: @@ -921,7 +921,7 @@ namespace Gecode { namespace Int { namespace Extensional { case Gecode::Support::IT_CHAR: return Extensional::LayeredGraph::View, int, unsigned char, unsigned char>::post(home, x, dfa); - case Gecode::Support::IT_SHRT: + case Gecode::Support::IT_SHORT: return Extensional::LayeredGraph::View, int, unsigned short int, unsigned char>::post(home, x, dfa); case Gecode::Support::IT_INT: @@ -931,12 +931,12 @@ namespace Gecode { namespace Int { namespace Extensional { GECODE_NEVER; } break; - case Gecode::Support::IT_SHRT: + case Gecode::Support::IT_SHORT: switch (t_degree) { case Gecode::Support::IT_CHAR: return Extensional::LayeredGraph::View, int, unsigned char, unsigned short int>::post(home, x, dfa); - case Gecode::Support::IT_SHRT: + case Gecode::Support::IT_SHORT: return Extensional::LayeredGraph::View, int, unsigned short int, unsigned short int>::post(home, x, dfa); case Gecode::Support::IT_INT: @@ -951,7 +951,7 @@ namespace Gecode { namespace Int { namespace Extensional { case Gecode::Support::IT_CHAR: return Extensional::LayeredGraph::View, int, unsigned char, unsigned int>::post(home, x, dfa); - case Gecode::Support::IT_SHRT: + case Gecode::Support::IT_SHORT: return Extensional::LayeredGraph::View, int, unsigned short int, unsigned int>::post(home, x, dfa); case Gecode::Support::IT_INT: diff --git a/gecode/int/gcc/dom-sup.hpp b/gecode/int/gcc/dom-sup.hpp index c214f5418a..3a4e8bc15c 100644 --- a/gecode/int/gcc/dom-sup.hpp +++ b/gecode/int/gcc/dom-sup.hpp @@ -44,7 +44,8 @@ namespace Gecode { namespace Int { namespace GCC { * If BC = UBC, then we argue about the Upper Bounds Constraint * else we use the functions for the Lower Bounds Constraint */ - enum BC { UBC = 1, LBC = 0 }; + enum class BC { UBC = 1, LBC = 0 }; + using enum BC; class Edge; /// Base class for nodes in the variable-value-graph @@ -282,15 +283,15 @@ namespace Gecode { namespace Int { namespace GCC { /// No flags set EF_NONE = 0, /// Whether edge is used in LBC - EF_MRKLB = 1 << 0, + EF_MARKED_LBC = 1 << 0, /// Whether edge is used in UBC - EF_MRKUB = 1 << 1, + EF_MARKED_UBC = 1 << 1, /// Whether edge is matched in LBC - EF_LM = 1 << 2, + EF_MATCHED_LBC = 1 << 2, /// Whether edge is matched in UBC - EF_UM = 1 << 3, + EF_MATCHED_UBC = 1 << 3, /// Whether edge has been deleted - EF_DEL = 1 << 4 + EF_DELETED = 1 << 4 }; /// Flags for edges unsigned char ef; @@ -830,23 +831,23 @@ namespace Gecode { namespace Int { namespace GCC { forceinline void Edge::use(BC bc) { if (bc == UBC) - ef |= EF_MRKUB; + ef |= EF_MARKED_UBC; else - ef |= EF_MRKLB; + ef |= EF_MARKED_LBC; } forceinline void Edge::free(BC bc) { if (bc == UBC) - ef &= ~EF_MRKUB; + ef &= ~EF_MARKED_UBC; else - ef &= ~EF_MRKLB; + ef &= ~EF_MARKED_LBC; } forceinline bool Edge::used(BC bc) const { if (bc == UBC) - return (ef & EF_MRKUB) != 0; + return (ef & EF_MARKED_UBC) != 0; else - return (ef & EF_MRKLB) != 0; + return (ef & EF_MARKED_LBC) != 0; } forceinline Edge* Edge::next(void) const { @@ -912,9 +913,9 @@ namespace Gecode { namespace Int { namespace GCC { forceinline void Edge::unmatch(BC bc) { if (bc == UBC) - ef &= ~EF_UM; + ef &= ~EF_MATCHED_UBC; else - ef &= ~EF_LM; + ef &= ~EF_MATCHED_LBC; x->unmatch(bc); v->unmatch(bc); } @@ -922,9 +923,9 @@ namespace Gecode { namespace Int { namespace GCC { forceinline void Edge::unmatch(BC bc, bool node) { if (bc == UBC) - ef &= ~EF_UM; + ef &= ~EF_MATCHED_UBC; else - ef &= ~EF_LM; + ef &= ~EF_MATCHED_LBC; if (node) v->unmatch(bc); else @@ -940,9 +941,9 @@ namespace Gecode { namespace Int { namespace GCC { forceinline void Edge::match(BC bc) { if (bc == UBC) - ef |= EF_UM; + ef |= EF_MATCHED_UBC; else - ef |= EF_LM; + ef |= EF_MATCHED_LBC; x->match(bc); x->set_match(bc, this); v->match(bc); @@ -951,24 +952,24 @@ namespace Gecode { namespace Int { namespace GCC { forceinline bool Edge::matched(BC bc) const { if (bc == UBC) - return (ef & EF_UM) != 0; + return (ef & EF_MATCHED_UBC) != 0; else - return (ef & EF_LM) != 0; + return (ef & EF_MATCHED_LBC) != 0; } forceinline void Edge::del_edge(void) { - ef |= EF_DEL; + ef |= EF_DELETED; } forceinline void Edge::insert_edge(void) { - ef &= ~EF_DEL; + ef &= ~EF_DELETED; } forceinline bool Edge::deleted(void) const { - return (ef & EF_DEL) != 0; + return (ef & EF_DELETED) != 0; } forceinline void* diff --git a/gecode/int/ipl.hpp b/gecode/int/ipl.hpp index 636ec10a61..c8d606c210 100644 --- a/gecode/int/ipl.hpp +++ b/gecode/int/ipl.hpp @@ -34,12 +34,12 @@ namespace Gecode { forceinline IntPropLevel vbd(IntPropLevel ipl) { - return static_cast(ipl & (IPL_DEF | IPL_VAL | IPL_BND | IPL_DOM)); + return ipl & (IPL_DEF | IPL_VAL | IPL_BND | IPL_DOM); } forceinline IntPropLevel ba(IntPropLevel ipl) { - return static_cast(ipl & IPL_BASIC_ADVANCED); + return ipl & IPL_BASIC_ADVANCED; } } // namespace Gecode diff --git a/gecode/int/linear/bool-int.hpp b/gecode/int/linear/bool-int.hpp index 9ba72f3024..629b6f586b 100644 --- a/gecode/int/linear/bool-int.hpp +++ b/gecode/int/linear/bool-int.hpp @@ -621,13 +621,13 @@ namespace Gecode { namespace Int { namespace Linear { if (rm != RM_IMP) GECODE_ME_CHECK(b.one_none(home)); } else { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); } } else { normalize(); if (b.one()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_REWRITE(*this, (GqBoolInt::post(home(*this), x, c))); } else { if (rm != RM_IMP) { @@ -659,7 +659,7 @@ namespace Gecode { namespace Int { namespace Linear { x.size(n_x); if (n_x < c) { // RHS too large - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); } else if (c <= 0) { // Whatever the x[i] take for values, the inequality is subsumed @@ -730,13 +730,13 @@ namespace Gecode { namespace Int { namespace Linear { if (rm != RM_IMP) GECODE_ME_CHECK(b.one_none(home)); } else { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); } } else { normalize(); if (b.one()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_REWRITE(*this, (EqBoolInt::post(home(*this), x, c))); } else { if (rm != RM_IMP) @@ -763,7 +763,7 @@ namespace Gecode { namespace Int { namespace Linear { x.size(n_x); if ((n_x < c) || (c < 0)) { // RHS too large - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); } else if ((c == 0) && (n_x == 0)) { // all variables set, and c == 0: equality diff --git a/gecode/int/linear/bool-post.cpp b/gecode/int/linear/bool-post.cpp index aadc61abba..24b9051490 100644 --- a/gecode/int/linear/bool-post.cpp +++ b/gecode/int/linear/bool-post.cpp @@ -151,8 +151,8 @@ namespace Gecode { namespace Int { namespace Linear { case RM_IMP: GECODE_ES_FAIL((ReEqBoolInt::post(home, x, c, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((ReEqBoolInt::post(home, x, c, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((ReEqBoolInt::post(home, x, c, r.var()))); break; default: GECODE_NEVER; @@ -168,9 +168,9 @@ namespace Gecode { namespace Int { namespace Linear { GECODE_ES_FAIL((ReEqBoolInt::post(home, x, c, nb))); break; case RM_IMP: - GECODE_ES_FAIL((ReEqBoolInt::post(home, x, c, nb))); + GECODE_ES_FAIL((ReEqBoolInt::post(home, x, c, nb))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((ReEqBoolInt::post(home, x, c, nb))); break; default: @@ -188,8 +188,8 @@ namespace Gecode { namespace Int { namespace Linear { case RM_IMP: GECODE_ES_FAIL((ReGqBoolInt::post(home, x, c, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((ReGqBoolInt::post(home, x, c, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((ReGqBoolInt::post(home, x, c, r.var()))); break; default: GECODE_NEVER; @@ -206,8 +206,8 @@ namespace Gecode { namespace Int { namespace Linear { case RM_IMP: GECODE_ES_FAIL((ReGqBoolInt::post(home, x, n_p - c, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((ReGqBoolInt::post(home, x, n_p - c, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((ReGqBoolInt::post(home, x, n_p - c, r.var()))); break; default: GECODE_NEVER; @@ -299,8 +299,8 @@ namespace Gecode { namespace Int { namespace Linear { case RM_IMP: GECODE_ES_FAIL((ReEqBoolInt::post(home, x, -c, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((ReEqBoolInt::post(home, x, -c, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((ReEqBoolInt::post(home, x, -c, r.var()))); break; default: GECODE_NEVER; @@ -316,9 +316,9 @@ namespace Gecode { namespace Int { namespace Linear { GECODE_ES_FAIL((ReEqBoolInt::post(home, x, -c, nb))); break; case RM_IMP: - GECODE_ES_FAIL((ReEqBoolInt::post(home, x, -c, nb))); + GECODE_ES_FAIL((ReEqBoolInt::post(home, x, -c, nb))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((ReEqBoolInt::post(home, x, -c, nb))); break; default: @@ -336,8 +336,8 @@ namespace Gecode { namespace Int { namespace Linear { case RM_IMP: GECODE_ES_FAIL((ReGqBoolInt::post(home, x, n_n + c, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((ReGqBoolInt::post(home, x, n_n + c, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((ReGqBoolInt::post(home, x, n_n + c, r.var()))); break; default: GECODE_NEVER; @@ -354,8 +354,8 @@ namespace Gecode { namespace Int { namespace Linear { case RM_IMP: GECODE_ES_FAIL((ReGqBoolInt::post(home, x, -c, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((ReGqBoolInt::post(home, x, -c, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((ReGqBoolInt::post(home, x, -c, r.var()))); break; default: GECODE_NEVER; @@ -528,7 +528,7 @@ namespace Gecode { namespace Int { namespace Linear { post(Home home, Term* t, int n, IntRelType irt, int c, Reify r, IntPropLevel ipl) { if (r.var().one()) { - if (r.mode() != RM_PMI) + if (r.mode() != RM_RIMP) post(home, t, n, irt, c, ipl); return; } @@ -555,7 +555,7 @@ namespace Gecode { namespace Int { namespace Linear { switch (irt) { case IRT_EQ: if ((d % gcd) != 0) { - if (r.mode() != RM_PMI) + if (r.mode() != RM_RIMP) GECODE_ME_FAIL(BoolView(r.var()).zero(home)); return; } @@ -601,7 +601,7 @@ namespace Gecode { namespace Int { namespace Linear { GECODE_NEVER; } if (fail) { - if (r.mode() != RM_PMI) + if (r.mode() != RM_RIMP) GECODE_ME_FAIL(BoolView(r.var()).zero(home)); } else { if (r.mode() != RM_IMP) diff --git a/gecode/int/linear/int-bin.hpp b/gecode/int/linear/int-bin.hpp index dde13cfe0a..612e435ef9 100644 --- a/gecode/int/linear/int-bin.hpp +++ b/gecode/int/linear/int-bin.hpp @@ -232,12 +232,12 @@ namespace Gecode { namespace Int { namespace Linear { GECODE_REWRITE(*this, (NqBin::post(home(*this), x0, x1, c))); } if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return home.ES_SUBSUMED(*this); GECODE_REWRITE(*this, (EqBin::post(home(*this), x0, x1, c))); } if ((x0.min() + x1.min() > c) || (x0.max() + x1.max() < c)) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); return home.ES_SUBSUMED(*this); } @@ -414,7 +414,7 @@ namespace Gecode { namespace Int { namespace Linear { ExecStatus ReLqBin::propagate(Space& home, const ModEventDelta&) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return home.ES_SUBSUMED(*this); GECODE_REWRITE(*this, (LqBin::post(home(*this), x0, x1, c))); } @@ -429,7 +429,7 @@ namespace Gecode { namespace Int { namespace Linear { return home.ES_SUBSUMED(*this); } if (x0.min() + x1.min() > c) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); return home.ES_SUBSUMED(*this); } diff --git a/gecode/int/linear/int-nary.hpp b/gecode/int/linear/int-nary.hpp index cd8fdf2f95..f1e19739e6 100644 --- a/gecode/int/linear/int-nary.hpp +++ b/gecode/int/linear/int-nary.hpp @@ -430,7 +430,7 @@ namespace Gecode { namespace Int { namespace Linear { GECODE_REWRITE(*this, (Nq::post(home(*this), x, y, c))); } if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return home.ES_SUBSUMED(*this); GECODE_REWRITE(*this, (Eq::post(home(*this), x, y, c))); } @@ -447,7 +447,7 @@ namespace Gecode { namespace Int { namespace Linear { return home.ES_SUBSUMED(*this); } if ((-sl > c) || (-su < c)) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); return home.ES_SUBSUMED(*this); } @@ -813,7 +813,7 @@ namespace Gecode { namespace Int { namespace Linear { GECODE_REWRITE(*this, (Lq::post(home(*this), y, x, -c - 1))); } if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return home.ES_SUBSUMED(*this); GECODE_REWRITE(*this, (Lq::post(home(*this), x, y, c))); } @@ -826,7 +826,7 @@ namespace Gecode { namespace Int { namespace Linear { bounds_n(med, y, c, sl, su); if (-sl > c) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); return home.ES_SUBSUMED(*this); } diff --git a/gecode/int/linear/int-post.cpp b/gecode/int/linear/int-post.cpp index 2b985c291f..1a68b7901e 100644 --- a/gecode/int/linear/int-post.cpp +++ b/gecode/int/linear/int-post.cpp @@ -441,8 +441,8 @@ namespace Gecode { namespace Int { namespace Linear { case RM_IMP: GECODE_ES_FAIL((ReEq::post(home, x, y, c, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((ReEq::post(home, x, y, c, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((ReEq::post(home, x, y, c, r.var()))); break; default: GECODE_NEVER; @@ -455,9 +455,9 @@ namespace Gecode { namespace Int { namespace Linear { GECODE_ES_FAIL((ReEq::post(home, x, y, c, n))); break; case RM_IMP: - GECODE_ES_FAIL((ReEq::post(home, x, y, c, n))); + GECODE_ES_FAIL((ReEq::post(home, x, y, c, n))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((ReEq::post(home, x, y, c, n))); break; default: @@ -472,8 +472,8 @@ namespace Gecode { namespace Int { namespace Linear { case RM_IMP: GECODE_ES_FAIL((ReLq::post(home, x, y, c, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((ReLq::post(home, x, y, c, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((ReLq::post(home, x, y, c, r.var()))); break; default: GECODE_NEVER; @@ -495,8 +495,8 @@ namespace Gecode { namespace Int { namespace Linear { case RM_IMP: GECODE_ES_FAIL((Rel::ReEqDomInt::post(home, x, c, b))); break; - case RM_PMI: - GECODE_ES_FAIL((Rel::ReEqDomInt::post(home, x, c, b))); + case RM_RIMP: + GECODE_ES_FAIL((Rel::ReEqDomInt::post(home, x, c, b))); break; default: GECODE_NEVER; @@ -509,8 +509,8 @@ namespace Gecode { namespace Int { namespace Linear { case RM_IMP: GECODE_ES_FAIL((Rel::ReEqBndInt::post(home, x, c, b))); break; - case RM_PMI: - GECODE_ES_FAIL((Rel::ReEqBndInt::post(home, x, c, b))); + case RM_RIMP: + GECODE_ES_FAIL((Rel::ReEqBndInt::post(home, x, c, b))); break; default: GECODE_NEVER; @@ -536,7 +536,7 @@ namespace Gecode { namespace Int { namespace Linear { switch (irt) { case IRT_EQ: if ((d % gcd) != 0) { - if (r.mode() != RM_PMI) + if (r.mode() != RM_RIMP) GECODE_ME_FAIL(BoolView(r.var()).zero(home)); return; } @@ -574,7 +574,7 @@ namespace Gecode { namespace Int { namespace Linear { GECODE_NEVER; } if (fail) { - if (r.mode() != RM_PMI) + if (r.mode() != RM_RIMP) GECODE_ME_FAIL(BoolView(r.var()).zero(home)); } else { if (r.mode() != RM_IMP) @@ -601,9 +601,9 @@ namespace Gecode { namespace Int { namespace Linear { ReifyMode rm = r.mode(); switch (rm) { case RM_IMP: - rm = RM_PMI; + rm = RM_RIMP; break; - case RM_PMI: + case RM_RIMP: rm = RM_IMP; break; default:; @@ -623,8 +623,9 @@ namespace Gecode { namespace Int { namespace Linear { case RM_IMP: GECODE_ES_FAIL((Rel::ReLqInt::post(home, t_p[0].x, c, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Rel::ReLqInt::post(home, t_p[0].x, c, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL( + (Rel::ReLqInt::post(home, t_p[0].x, c, r.var()))); break; default: GECODE_NEVER; @@ -638,9 +639,9 @@ namespace Gecode { namespace Int { namespace Linear { break; case RM_IMP: GECODE_ES_FAIL( - (Rel::ReLqInt::post(home, t_n[0].x, -c - 1, nb))); + (Rel::ReLqInt::post(home, t_n[0].x, -c - 1, nb))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL( (Rel::ReLqInt::post(home, t_n[0].x, -c - 1, nb))); break; @@ -666,8 +667,8 @@ namespace Gecode { namespace Int { namespace Linear { GECODE_ES_FAIL((ReEqBin::post( home, t_p[0].x, t_p[1].x, c, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((ReEqBin::post( + case RM_RIMP: + GECODE_ES_FAIL((ReEqBin::post( home, t_p[0].x, t_p[1].x, c, r.var()))); break; default: @@ -684,8 +685,8 @@ namespace Gecode { namespace Int { namespace Linear { GECODE_ES_FAIL((ReEqBin::post( home, t_p[0].x, MinusView(t_n[0].x), c, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((ReEqBin::post( + case RM_RIMP: + GECODE_ES_FAIL((ReEqBin::post( home, t_p[0].x, MinusView(t_n[0].x), c, r.var()))); break; default: @@ -702,8 +703,8 @@ namespace Gecode { namespace Int { namespace Linear { GECODE_ES_FAIL((ReEqBin::post( home, t_n[0].x, t_n[1].x, -c, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((ReEqBin::post( + case RM_RIMP: + GECODE_ES_FAIL((ReEqBin::post( home, t_n[0].x, t_n[1].x, -c, r.var()))); break; default: @@ -724,10 +725,10 @@ namespace Gecode { namespace Int { namespace Linear { home, t_p[0].x, t_p[1].x, c, nb))); break; case RM_IMP: - GECODE_ES_FAIL((ReEqBin::post( + GECODE_ES_FAIL((ReEqBin::post( home, t_p[0].x, t_p[1].x, c, nb))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((ReEqBin::post( home, t_p[0].x, t_p[1].x, c, nb))); break; @@ -742,10 +743,10 @@ namespace Gecode { namespace Int { namespace Linear { home, t_p[0].x, MinusView(t_n[0].x), c, nb))); break; case RM_IMP: - GECODE_ES_FAIL((ReEqBin::post( + GECODE_ES_FAIL((ReEqBin::post( home, t_p[0].x, MinusView(t_n[0].x), c, nb))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((ReEqBin::post( home, t_p[0].x, MinusView(t_n[0].x), c, nb))); break; @@ -760,10 +761,10 @@ namespace Gecode { namespace Int { namespace Linear { home, t_p[0].x, t_p[1].x, -c, nb))); break; case RM_IMP: - GECODE_ES_FAIL((ReEqBin::post( + GECODE_ES_FAIL((ReEqBin::post( home, t_p[0].x, t_p[1].x, -c, nb))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((ReEqBin::post( home, t_p[0].x, t_p[1].x, -c, nb))); break; @@ -787,9 +788,9 @@ namespace Gecode { namespace Int { namespace Linear { GECODE_ES_FAIL( (ReLqBin::post(home, t_p[0].x, t_p[1].x, c, r.var()))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL( - (ReLqBin::post(home, t_p[0].x, t_p[1].x, c, r.var()))); + (ReLqBin::post(home, t_p[0].x, t_p[1].x, c, r.var()))); break; default: GECODE_NEVER; @@ -805,8 +806,8 @@ namespace Gecode { namespace Int { namespace Linear { GECODE_ES_FAIL((ReLqBin::post( home, t_p[0].x, MinusView(t_n[0].x), c, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((ReLqBin::post( + case RM_RIMP: + GECODE_ES_FAIL((ReLqBin::post( home, t_p[0].x, MinusView(t_n[0].x), c, r.var()))); break; default: @@ -823,8 +824,8 @@ namespace Gecode { namespace Int { namespace Linear { GECODE_ES_FAIL((ReLqBin::post( home, MinusView(t_n[0].x), MinusView(t_n[1].x), c, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((ReLqBin::post( + case RM_RIMP: + GECODE_ES_FAIL((ReLqBin::post( home, MinusView(t_n[0].x), MinusView(t_n[1].x), c, r.var()))); break; default: diff --git a/gecode/int/member.cpp b/gecode/int/member.cpp index a288b81448..9df51880f5 100644 --- a/gecode/int/member.cpp +++ b/gecode/int/member.cpp @@ -66,8 +66,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Member::ReProp::post(home, xv, y, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Member::ReProp::post(home, xv, y, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Member::ReProp::post(home, xv, y, r.var()))); break; default: throw UnknownReifyMode("Int::member"); @@ -88,8 +88,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Member::ReProp::post(home, xv, y, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Member::ReProp::post(home, xv, y, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Member::ReProp::post(home, xv, y, r.var()))); break; default: throw UnknownReifyMode("Int::member"); diff --git a/gecode/int/member/re-prop.hpp b/gecode/int/member/re-prop.hpp index 38341d306e..a667a13329 100644 --- a/gecode/int/member/re-prop.hpp +++ b/gecode/int/member/re-prop.hpp @@ -45,7 +45,7 @@ namespace Gecode { namespace Int { namespace Member { inline ExecStatus ReProp::post(Home home, ViewArray& x, View y, BoolView b) { if (x.size() == 0) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); return ES_OK; } @@ -72,7 +72,7 @@ namespace Gecode { namespace Int { namespace Member { return ES_OK; case Iter::Ranges::CS_DISJOINT: if (x.size() == 0) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); return ES_OK; } @@ -116,7 +116,7 @@ namespace Gecode { namespace Int { namespace Member { add(home, vs, x); if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return home.ES_SUBSUMED(*this); ValSet vsc(vs); vs.flush(); @@ -143,7 +143,7 @@ namespace Gecode { namespace Int { namespace Member { return home.ES_SUBSUMED(*this); case Iter::Ranges::CS_DISJOINT: if (x.size() == 0) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); return home.ES_SUBSUMED(*this); } @@ -169,7 +169,7 @@ namespace Gecode { namespace Int { namespace Member { ViewRanges yr(y); if (Iter::Ranges::disjoint(u, yr)) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); return home.ES_SUBSUMED(*this); } diff --git a/gecode/int/nvalues.hh b/gecode/int/nvalues.hh index 009482c72e..4811f68b94 100644 --- a/gecode/int/nvalues.hh +++ b/gecode/int/nvalues.hh @@ -44,14 +44,15 @@ namespace Gecode { namespace Int { namespace NValues { /// Event type for range-based overlap analysis - enum RangeEventType { + enum class RangeEventType { /// A range starts - RET_FST = 0, + RET_START = 0, /// A range ends - RET_LST = 1, + RET_FINISH = 1, /// No further events RET_END = 2 }; + using enum RangeEventType; /// Event for range-based overlap analysis class RangeEvent { diff --git a/gecode/int/nvalues/int-base.hpp b/gecode/int/nvalues/int-base.hpp index dd6c65e844..6088528088 100644 --- a/gecode/int/nvalues/int-base.hpp +++ b/gecode/int/nvalues/int-base.hpp @@ -194,12 +194,12 @@ namespace Gecode { namespace Int { namespace NValues { for (int i = n_dis; i--;) for (ViewRanges rx(x[dis[i]]); rx(); ++rx) { // Event when a range starts - re[j].ret = RET_FST; + re[j].ret = RET_START; re[j].val = rx.min(); re[j].view = dis[i]; j++; // Event when a range ends - re[j].ret = RET_LST; + re[j].ret = RET_FINISH; re[j].val = rx.max(); re[j].view = dis[i]; j++; @@ -217,7 +217,7 @@ namespace Gecode { namespace Int { namespace NValues { // Process all events for (int i = 0; true; i++) switch (re[i].ret) { - case RET_FST: + case RET_START: // Process all overlapping views for (Iter::Values::BitSet> j(cur); j(); ++j) { int di = re[i].view, dj = j.val(); @@ -229,7 +229,7 @@ namespace Gecode { namespace Int { namespace NValues { } cur.set(static_cast(re[i].view)); break; - case RET_LST: + case RET_FINISH: cur.clear(static_cast(re[i].view)); break; case RET_END: diff --git a/gecode/int/reify.hpp b/gecode/int/reify.hpp index e6e12f8f89..97fa7a10da 100644 --- a/gecode/int/reify.hpp +++ b/gecode/int/reify.hpp @@ -74,7 +74,7 @@ namespace Gecode { } forceinline Reify pmi(BoolVar x) { - return Reify(x, RM_PMI); + return Reify(x, RM_RIMP); } } // namespace Gecode diff --git a/gecode/int/rel.cpp b/gecode/int/rel.cpp index adddb92bb8..29062595b1 100644 --- a/gecode/int/rel.cpp +++ b/gecode/int/rel.cpp @@ -204,8 +204,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Rel::ReEqDom::post(home, x0, x1, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Rel::ReEqDom::post(home, x0, x1, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Rel::ReEqDom::post(home, x0, x1, r.var()))); break; default: throw UnknownReifyMode("Int::rel"); @@ -218,8 +218,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Rel::ReEqBnd::post(home, x0, x1, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Rel::ReEqBnd::post(home, x0, x1, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Rel::ReEqBnd::post(home, x0, x1, r.var()))); break; default: throw UnknownReifyMode("Int::rel"); @@ -234,9 +234,9 @@ namespace Gecode { GECODE_ES_FAIL((Rel::ReEqBnd::post(home, x0, x1, n))); break; case RM_IMP: - GECODE_ES_FAIL((Rel::ReEqBnd::post(home, x0, x1, n))); + GECODE_ES_FAIL((Rel::ReEqBnd::post(home, x0, x1, n))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((Rel::ReEqBnd::post(home, x0, x1, n))); break; default: @@ -248,9 +248,9 @@ namespace Gecode { GECODE_ES_FAIL((Rel::ReEqDom::post(home, x0, x1, n))); break; case RM_IMP: - GECODE_ES_FAIL((Rel::ReEqDom::post(home, x0, x1, n))); + GECODE_ES_FAIL((Rel::ReEqDom::post(home, x0, x1, n))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((Rel::ReEqDom::post(home, x0, x1, n))); break; default: @@ -268,8 +268,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Rel::ReLq::post(home, x0, x1, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Rel::ReLq::post(home, x0, x1, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Rel::ReLq::post(home, x0, x1, r.var()))); break; default: throw UnknownReifyMode("Int::rel"); @@ -284,9 +284,9 @@ namespace Gecode { GECODE_ES_FAIL((Rel::ReLq::post(home, x0, x1, n))); break; case RM_IMP: - GECODE_ES_FAIL((Rel::ReLq::post(home, x0, x1, n))); + GECODE_ES_FAIL((Rel::ReLq::post(home, x0, x1, n))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((Rel::ReLq::post(home, x0, x1, n))); break; default: @@ -313,8 +313,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Rel::ReEqDomInt::post(home, x, n, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Rel::ReEqDomInt::post(home, x, n, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Rel::ReEqDomInt::post(home, x, n, r.var()))); break; default: throw UnknownReifyMode("Int::rel"); @@ -327,8 +327,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Rel::ReEqBndInt::post(home, x, n, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Rel::ReEqBndInt::post(home, x, n, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Rel::ReEqBndInt::post(home, x, n, r.var()))); break; default: throw UnknownReifyMode("Int::rel"); @@ -343,9 +343,9 @@ namespace Gecode { GECODE_ES_FAIL((Rel::ReEqBndInt::post(home, x, n, nb))); break; case RM_IMP: - GECODE_ES_FAIL((Rel::ReEqBndInt::post(home, x, n, nb))); + GECODE_ES_FAIL((Rel::ReEqBndInt::post(home, x, n, nb))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((Rel::ReEqBndInt::post(home, x, n, nb))); break; default: @@ -357,9 +357,9 @@ namespace Gecode { GECODE_ES_FAIL((Rel::ReEqDomInt::post(home, x, n, nb))); break; case RM_IMP: - GECODE_ES_FAIL((Rel::ReEqDomInt::post(home, x, n, nb))); + GECODE_ES_FAIL((Rel::ReEqDomInt::post(home, x, n, nb))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((Rel::ReEqDomInt::post(home, x, n, nb))); break; default: @@ -377,8 +377,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Rel::ReLqInt::post(home, x, n, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Rel::ReLqInt::post(home, x, n, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Rel::ReLqInt::post(home, x, n, r.var()))); break; default: throw UnknownReifyMode("Int::rel"); @@ -393,9 +393,9 @@ namespace Gecode { GECODE_ES_FAIL((Rel::ReLqInt::post(home, x, n, nb))); break; case RM_IMP: - GECODE_ES_FAIL((Rel::ReLqInt::post(home, x, n, nb))); + GECODE_ES_FAIL((Rel::ReLqInt::post(home, x, n, nb))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((Rel::ReLqInt::post(home, x, n, nb))); break; default: diff --git a/gecode/int/rel/eq.hpp b/gecode/int/rel/eq.hpp index 6500b7faf4..74605bc6b3 100644 --- a/gecode/int/rel/eq.hpp +++ b/gecode/int/rel/eq.hpp @@ -477,7 +477,7 @@ namespace Gecode { namespace Int { namespace Rel { ExecStatus ReEqDom::post(Home home, View x0, View x1, CtrlView b) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return ES_OK; return EqDom::post(home, x0, x1); } @@ -509,7 +509,7 @@ namespace Gecode { namespace Int { namespace Rel { ExecStatus ReEqDom::propagate(Space& home, const ModEventDelta&) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return home.ES_SUBSUMED(*this); GECODE_REWRITE(*this, (EqDom::post(home(*this), x0, x1))); } @@ -524,7 +524,7 @@ namespace Gecode { namespace Int { namespace Rel { GECODE_ME_CHECK(b.one_none(home)); break; case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); break; case RT_MAYBE: @@ -549,7 +549,7 @@ namespace Gecode { namespace Int { namespace Rel { ExecStatus ReEqBnd::post(Home home, View x0, View x1, CtrlView b) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return ES_OK; return EqBnd::post(home, x0, x1); } @@ -581,7 +581,7 @@ namespace Gecode { namespace Int { namespace Rel { ExecStatus ReEqBnd::propagate(Space& home, const ModEventDelta&) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return home.ES_SUBSUMED(*this); GECODE_REWRITE(*this, (EqBnd::post(home(*this), x0, x1))); } @@ -596,7 +596,7 @@ namespace Gecode { namespace Int { namespace Rel { GECODE_ME_CHECK(b.one_none(home)); break; case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); break; case RT_MAYBE: @@ -621,7 +621,7 @@ namespace Gecode { namespace Int { namespace Rel { ExecStatus ReEqDomInt::post(Home home, View x, int c, CtrlView b) { if (b.one()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(x.eq(home, c)); } else if (b.zero()) { if (rm != RM_IMP) @@ -632,7 +632,7 @@ namespace Gecode { namespace Int { namespace Rel { if (rm != RM_IMP) GECODE_ME_CHECK(b.one_none(home)); } else { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); } } else { @@ -656,7 +656,7 @@ namespace Gecode { namespace Int { namespace Rel { ExecStatus ReEqDomInt::propagate(Space& home, const ModEventDelta&) { if (b.one()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(x0.eq(home, c)); } else if (b.zero()) { if (rm != RM_IMP) @@ -668,7 +668,7 @@ namespace Gecode { namespace Int { namespace Rel { GECODE_ME_CHECK(b.one_none(home)); break; case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); break; case RT_MAYBE: @@ -694,7 +694,7 @@ namespace Gecode { namespace Int { namespace Rel { ExecStatus ReEqBndInt::post(Home home, View x, int c, CtrlView b) { if (b.one()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(x.eq(home, c)); } else if (b.zero()) { if (rm != RM_IMP) @@ -705,7 +705,7 @@ namespace Gecode { namespace Int { namespace Rel { if (rm != RM_IMP) GECODE_ME_CHECK(b.one_none(home)); } else { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); } } else { @@ -729,7 +729,7 @@ namespace Gecode { namespace Int { namespace Rel { ExecStatus ReEqBndInt::propagate(Space& home, const ModEventDelta&) { if (b.one()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(x0.eq(home, c)); } else if (b.zero()) { if (rm != RM_IMP) @@ -741,7 +741,7 @@ namespace Gecode { namespace Int { namespace Rel { GECODE_ME_CHECK(b.one_none(home)); break; case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); break; case RT_MAYBE: diff --git a/gecode/int/rel/lq-le.hpp b/gecode/int/rel/lq-le.hpp index 8790b97772..fc80a0fca7 100644 --- a/gecode/int/rel/lq-le.hpp +++ b/gecode/int/rel/lq-le.hpp @@ -404,7 +404,7 @@ namespace Gecode { namespace Int { namespace Rel { ExecStatus ReLq::post(Home home, View x0, View x1, CtrlView b) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return ES_OK; return Lq::post(home, x0, x1); } @@ -420,7 +420,7 @@ namespace Gecode { namespace Int { namespace Rel { GECODE_ME_CHECK(b.one_none(home)); break; case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); break; case RT_MAYBE: @@ -450,7 +450,7 @@ namespace Gecode { namespace Int { namespace Rel { ExecStatus ReLq::propagate(Space& home, const ModEventDelta&) { if (b.one()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_REWRITE(*this, (Lq::post(home(*this), x0, x1))); } else if (b.zero()) { if (rm != RM_IMP) @@ -462,7 +462,7 @@ namespace Gecode { namespace Int { namespace Rel { GECODE_ME_CHECK(b.one_none(home)); break; case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); break; case RT_MAYBE: @@ -488,7 +488,7 @@ namespace Gecode { namespace Int { namespace Rel { ExecStatus ReLqInt::post(Home home, View x, int c, CtrlView b) { if (b.one()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(x.lq(home, c)); } else if (b.zero()) { if (rm != RM_IMP) @@ -500,7 +500,7 @@ namespace Gecode { namespace Int { namespace Rel { GECODE_ME_CHECK(b.one_none(home)); break; case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); break; case RT_MAYBE: @@ -528,7 +528,7 @@ namespace Gecode { namespace Int { namespace Rel { ExecStatus ReLqInt::propagate(Space& home, const ModEventDelta&) { if (b.one()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(x0.lq(home, c)); } else if (b.zero()) { if (rm != RM_IMP) @@ -540,7 +540,7 @@ namespace Gecode { namespace Int { namespace Rel { GECODE_ME_CHECK(b.one_none(home)); break; case RT_FALSE: - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); break; case RT_MAYBE: diff --git a/gecode/int/sequence/open.hpp b/gecode/int/sequence/open.hpp index 1963a6e7de..9955502c52 100644 --- a/gecode/int/sequence/open.hpp +++ b/gecode/int/sequence/open.hpp @@ -264,7 +264,7 @@ namespace Gecode { namespace Int { namespace Sequence { // eliminates assigned terms. Delayed posting then has the same // propagation strength as posting before those assignments. if (vbd(ipl) == IPL_DEF) - ipl = static_cast(ipl | ((width <= 2) ? IPL_DOM : IPL_BND)); + ipl |= (width <= 2) ? IPL_DOM : IPL_BND; } OpenSlidingSumEq(Space& home, OpenSlidingSumEq& p) diff --git a/gecode/int/sequence/set-op.hpp b/gecode/int/sequence/set-op.hpp index 03f662d84f..dffbb090c6 100644 --- a/gecode/int/sequence/set-op.hpp +++ b/gecode/int/sequence/set-op.hpp @@ -33,11 +33,12 @@ namespace Gecode { namespace Int { namespace Sequence { /// Status of whether a view takes a value from a set - enum TakesStatus { + enum class TakesStatus { TS_NO, ///< Definitely not TS_YES, ///< Definitely yes TS_MAYBE ///< Maybe or maybe not }; + using enum TakesStatus; /// Return whether view \a x takes value \a s template diff --git a/gecode/int/task.hh b/gecode/int/task.hh index 22d940a769..36a6ed12ea 100644 --- a/gecode/int/task.hh +++ b/gecode/int/task.hh @@ -277,12 +277,13 @@ namespace Gecode { namespace Int { namespace Gecode { namespace Int { /// How to sort tasks - enum SortTaskOrder { + enum class SortTaskOrder { STO_EST, ///< Sort by earliest start times STO_ECT, ///< Sort by earliest completion times STO_LST, ///< Sort by latest start times STO_LCT ///< Sort by latest completion times }; + using enum SortTaskOrder; /// Sort task view array \a t according to \a sto and \a inc (increasing or decreasing) template @@ -494,7 +495,7 @@ namespace Gecode { namespace Int { class Event { public: /// Event type for task with order in which they are processed - enum Type { + enum class Type { LRT = 0, ///< Latest required time of task LCT = 1, ///< Latest completion time of task EST = 2, ///< Earliest start time of task @@ -502,6 +503,7 @@ namespace Gecode { namespace Int { ERT = 4, ///< Earliest required time of task END = 5 ///< End marker }; + using enum Type; protected: /// Combines type and number of task diff --git a/gecode/int/task/event.hpp b/gecode/int/task/event.hpp index 574fa57129..b42b013d02 100644 --- a/gecode/int/task/event.hpp +++ b/gecode/int/task/event.hpp @@ -34,7 +34,7 @@ namespace Gecode { namespace Int { forceinline void Event::init(Event::Type e0, int t0, int i0) { - ei = static_cast(e0 | (i0 << 3)); + ei = static_cast(std::to_underlying(e0) | (i0 << 3)); t = t0; } diff --git a/gecode/int/unary.cpp b/gecode/int/unary.cpp index ef62e89325..3f1c8ec9b6 100644 --- a/gecode/int/unary.cpp +++ b/gecode/int/unary.cpp @@ -88,7 +88,7 @@ namespace Gecode { if ((n_tasks != fix.size()) || (n_tasks != t.size())) throw Int::ArgumentSizeMismatch("Int::unary"); for (int i = 0; i < fix.size(); i++) { - if (t[i] == TT_FIXP) + if (t[i] == TT_FIXED_PROCESSING) Int::Limits::nonnegative(fix[i], "Int::unary"); else Int::Limits::check(fix[i], "Int::unary"); @@ -97,7 +97,7 @@ namespace Gecode { GECODE_POST; bool fixp = true; for (int i = 0; i < t.size(); i++) - if (t[i] != TT_FIXP) { + if (t[i] != TT_FIXED_PROCESSING) { fixp = false; break; } @@ -152,7 +152,7 @@ namespace Gecode { throw Int::ArgumentSizeMismatch("Int::unary"); bool fixp = true; for (int i = 0; i < fix.size(); i++) { - if (t[i] == TT_FIXP) { + if (t[i] == TT_FIXED_PROCESSING) { Int::Limits::nonnegative(fix[i], "Int::unary"); } else { fixp = false; diff --git a/gecode/int/unary.hh b/gecode/int/unary.hh index 080d8bd96f..4e2b66f220 100644 --- a/gecode/int/unary.hh +++ b/gecode/int/unary.hh @@ -156,7 +156,7 @@ namespace Gecode { namespace Int { namespace Unary { /** * \brief Initialize task * - * Depending on \a t, \a s is either the end time (if \a t is TT_FIXS) + * Depending on \a t, \a s is either the end time (if \a t is TT_FIXED_START) * or the start time of the task, and \a p is the fixed parameter. */ ManFixPSETask(TaskType t, IntVar s, int p); diff --git a/gecode/int/unary/task.hpp b/gecode/int/unary/task.hpp index e5af995744..a849ab02a7 100644 --- a/gecode/int/unary/task.hpp +++ b/gecode/int/unary/task.hpp @@ -202,16 +202,16 @@ namespace Gecode { namespace Int { namespace Unary { forceinline int ManFixPSETask::est(void) const { - return (_t == TT_FIXS) ? _p : _s.min(); + return (_t == TT_FIXED_START) ? _p : _s.min(); } forceinline int ManFixPSETask::ect(void) const { switch (_t) { - case TT_FIXP: + case TT_FIXED_PROCESSING: return _s.min() + _p; - case TT_FIXS: + case TT_FIXED_START: return _s.min(); - case TT_FIXE: + case TT_FIXED_END: return _p; default: GECODE_NEVER; @@ -220,16 +220,16 @@ namespace Gecode { namespace Int { namespace Unary { } forceinline int ManFixPSETask::lst(void) const { - return (_t == TT_FIXS) ? _p : _s.max(); + return (_t == TT_FIXED_START) ? _p : _s.max(); } forceinline int ManFixPSETask::lct(void) const { switch (_t) { - case TT_FIXP: + case TT_FIXED_PROCESSING: return _s.max() + _p; - case TT_FIXS: + case TT_FIXED_START: return _s.max(); - case TT_FIXE: + case TT_FIXED_END: return _p; default: GECODE_NEVER; @@ -239,11 +239,11 @@ namespace Gecode { namespace Int { namespace Unary { forceinline int ManFixPSETask::pmin(void) const { switch (_t) { - case TT_FIXP: + case TT_FIXED_PROCESSING: return _p; - case TT_FIXS: + case TT_FIXED_START: return _s.min() - _p; - case TT_FIXE: + case TT_FIXED_END: return _p - _s.max(); default: GECODE_NEVER; @@ -253,11 +253,11 @@ namespace Gecode { namespace Int { namespace Unary { forceinline int ManFixPSETask::pmax(void) const { switch (_t) { - case TT_FIXP: + case TT_FIXED_PROCESSING: return _p; - case TT_FIXS: + case TT_FIXED_START: return _s.max() - _p; - case TT_FIXE: + case TT_FIXED_END: return _p - _s.min(); default: GECODE_NEVER; @@ -268,10 +268,10 @@ namespace Gecode { namespace Int { namespace Unary { forceinline ModEvent ManFixPSETask::est(Space& home, int n) { switch (_t) { - case TT_FIXE: // fall through - case TT_FIXP: + case TT_FIXED_END: // fall through + case TT_FIXED_PROCESSING: return _s.gq(home, n); - case TT_FIXS: + case TT_FIXED_START: return (n <= _p) ? ME_INT_NONE : ME_INT_FAILED; default: GECODE_NEVER; @@ -281,11 +281,11 @@ namespace Gecode { namespace Int { namespace Unary { forceinline ModEvent ManFixPSETask::ect(Space& home, int n) { switch (_t) { - case TT_FIXE: + case TT_FIXED_END: return (n <= _p) ? ME_INT_NONE : ME_INT_FAILED; - case TT_FIXP: + case TT_FIXED_PROCESSING: return _s.gq(home, n - _p); - case TT_FIXS: + case TT_FIXED_START: return _s.gq(home, n); default: GECODE_NEVER; @@ -295,10 +295,10 @@ namespace Gecode { namespace Int { namespace Unary { forceinline ModEvent ManFixPSETask::lst(Space& home, int n) { switch (_t) { - case TT_FIXE: // fall through - case TT_FIXP: + case TT_FIXED_END: // fall through + case TT_FIXED_PROCESSING: return _s.lq(home, n); - case TT_FIXS: + case TT_FIXED_START: return (n >= _p) ? ME_INT_NONE : ME_INT_FAILED; default: GECODE_NEVER; @@ -308,11 +308,11 @@ namespace Gecode { namespace Int { namespace Unary { forceinline ModEvent ManFixPSETask::lct(Space& home, int n) { switch (_t) { - case TT_FIXE: + case TT_FIXED_END: return (n >= _p) ? ME_INT_NONE : ME_INT_FAILED; - case TT_FIXP: + case TT_FIXED_PROCESSING: return _s.lq(home, n - _p); - case TT_FIXS: + case TT_FIXED_START: return _s.lq(home, n); default: GECODE_NEVER; @@ -323,15 +323,15 @@ namespace Gecode { namespace Int { namespace Unary { ManFixPSETask::norun(Space& home, int e, int l) { if (e <= l) { switch (_t) { - case TT_FIXP: { + case TT_FIXED_PROCESSING: { Iter::Ranges::Singleton r(norun_bound(static_cast(e) - _p + 1), l); return _s.minus_r(home, r, false); } - case TT_FIXE: + case TT_FIXED_END: if (e <= _p) return _s.gr(home, l); break; - case TT_FIXS: + case TT_FIXED_START: if (l >= _p) return _s.lq(home, e); break; diff --git a/gecode/int/view.hpp b/gecode/int/view.hpp index c1f56d2ffb..0ccdf94ade 100644 --- a/gecode/int/view.hpp +++ b/gecode/int/view.hpp @@ -1701,11 +1701,12 @@ namespace Gecode { namespace Int { //@{ /// Result of testing relation - enum RelTest { + enum class RelTest { RT_FALSE = 0, ///< Relation does not hold RT_MAYBE = 1, ///< Relation may hold or not RT_TRUE = 2 ///< Relation does hold }; + using enum RelTest; /// Test whether views \a x and \a y are equal (use bounds information) template @@ -1766,11 +1767,12 @@ namespace Gecode { namespace Int { * \brief Boolean tests * */ - enum BoolTest { - BT_NONE, ///< No sharing - BT_SAME, ///< Same variable - BT_COMP ///< Same variable but complement + enum class BoolTest { + BT_NONE, ///< No sharing + BT_SAME, ///< Same variable + BT_COMPLEMENT ///< Same variable but complement }; + using enum BoolTest; /** * \name Test sharing between Boolean and negated Boolean views diff --git a/gecode/int/view/bool-test.hpp b/gecode/int/view/bool-test.hpp index d3eaff7187..88059d8d9f 100644 --- a/gecode/int/view/bool-test.hpp +++ b/gecode/int/view/bool-test.hpp @@ -42,11 +42,11 @@ namespace Gecode { namespace Int { } forceinline BoolTest bool_test(const BoolView& b0, const NegBoolView& b1) { - return (b0 == b1.base()) ? BT_COMP : BT_NONE; + return (b0 == b1.base()) ? BT_COMPLEMENT : BT_NONE; } forceinline BoolTest bool_test(const NegBoolView& b0, const BoolView& b1) { - return (b0.base() == b1) ? BT_COMP : BT_NONE; + return (b0.base() == b1) ? BT_COMPLEMENT : BT_NONE; } forceinline BoolTest bool_test(const NegBoolView& b0, const NegBoolView& b1) { diff --git a/gecode/iter/ranges-operations.hpp b/gecode/iter/ranges-operations.hpp index 591d43b90e..e54840d0a3 100644 --- a/gecode/iter/ranges-operations.hpp +++ b/gecode/iter/ranges-operations.hpp @@ -56,11 +56,12 @@ namespace Gecode { namespace Iter { namespace Ranges { bool disjoint(I& i, J& j); /// Compare two iterators with each other - enum CompareStatus { + enum class CompareStatus { CS_SUBSET, ///< First is subset of second iterator CS_DISJOINT, ///< Intersection is empty CS_NONE ///< Neither of the above }; + using enum CompareStatus; /// Check whether range iterator \a i is a subset of \a j, or whether they are disjoint template diff --git a/gecode/kernel.hh b/gecode/kernel.hh index 08b22624e5..0d523b3b15 100644 --- a/gecode/kernel.hh +++ b/gecode/kernel.hh @@ -45,6 +45,7 @@ #include #include +#include #include diff --git a/gecode/kernel/core.cpp b/gecode/kernel/core.cpp index 06b5c27bca..40ee09ce38 100644 --- a/gecode/kernel/core.cpp +++ b/gecode/kernel/core.cpp @@ -129,7 +129,7 @@ namespace Gecode { // Initialize space as stable but not failed pc.p.active = &pc.p.queue[0] - 1; // Initialize propagator queues - for (int i = 0; i <= PropCost::AC_MAX; i++) + for (int i = 0; i <= std::to_underlying(PropCost::AC_MAX); i++) pc.p.queue[i].init(); pc.p.bid_sc = (reserved_bid + 1) << sc_bits; pc.p.n_sub = 0; @@ -274,7 +274,7 @@ namespace Gecode { // Check whether space is failed if (failed()) return SS_FAILED; - assert(pc.p.active <= &pc.p.queue[PropCost::AC_MAX + 1]); + assert(pc.p.active <= &pc.p.queue[std::to_underlying(PropCost::AC_MAX) + 1]); Propagator* p; // Check whether space is stable but not failed if (pc.p.active >= &pc.p.queue[0]) { @@ -539,7 +539,7 @@ namespace Gecode { // Mark as failed fail(); // Propagate top priority propagators - ActorLink* e = &pc.p.queue[PropCost::AC_RECORD]; + ActorLink* e = &pc.p.queue[std::to_underlying(PropCost::AC_RECORD)]; for (ActorLink* a = e->next(); a != e; a = a->next()) { Propagator* top = Propagator::cast(a); // Keep old modification event delta @@ -893,7 +893,7 @@ namespace Gecode { // Initialize propagator queue c->pc.p.active = &c->pc.p.queue[0] - 1; - for (int i = 0; i <= PropCost::AC_MAX; i++) + for (int i = 0; i <= std::to_underlying(PropCost::AC_MAX); i++) c->pc.p.queue[i].init(); // Copy propagation only data c->pc.p.n_sub = pc.p.n_sub; diff --git a/gecode/kernel/core.hpp b/gecode/kernel/core.hpp index 5c0aa9f982..a58538f056 100644 --- a/gecode/kernel/core.hpp +++ b/gecode/kernel/core.hpp @@ -501,7 +501,7 @@ namespace Gecode { * * \ingroup TaskActor */ - enum ExecStatus { + enum class ExecStatus { ES_SUBSUMED_ = -2, ///< Internal: propagator is subsumed, do not use ES_FAILED = -1, ///< Execution has resulted in failure ES_NOFIX = 0, ///< Propagation has not computed fixpoint @@ -510,6 +510,7 @@ namespace Gecode { ES_NOFIX_FORCE = 2, ///< Advisor forces rescheduling of propagator ES_PARTIAL_ = 2 ///< Internal: propagator has computed partial fixpoint, do not use }; + using enum ExecStatus; /** * \brief Propagation cost @@ -520,7 +521,7 @@ namespace Gecode { public: /// The actual cost values that are used - enum ActualCost { + enum class ActualCost { AC_RECORD = 0, ///< Reserved for recording information AC_CRAZY_LO = 1, ///< Exponential complexity, cheap AC_CRAZY_HI = 1, ///< Exponential complexity, expensive @@ -538,15 +539,17 @@ namespace Gecode { AC_UNARY_HI = 6, ///< Only single variable, expensive AC_MAX = 6 ///< Maximal cost value }; + using enum ActualCost; /// Actual cost ActualCost ac; public: /// Propagation cost modifier - enum Mod { + enum class Mod { LO, ///< Cheap HI ///< Expensive }; + using enum Mod; private: /// Compute dynamic cost for cost \a lo, expensive cost \a hi, and size measure \a n @@ -585,7 +588,7 @@ namespace Gecode { * \brief Actor properties * \ingroup TaskActor */ - enum ActorProperty { + enum class ActorProperty { /** * \brief Actor must always be disposed * @@ -612,6 +615,7 @@ namespace Gecode { */ AP_TRACE = (1 << 3) }; + using enum ActorProperty; /** * \brief Double-linked list for actors @@ -949,7 +953,7 @@ namespace Gecode { public: /// What is currently executing - enum What { + enum class What { /// A propagator is currently executing PROPAGATOR = 0, /// A brancher is executing @@ -959,6 +963,7 @@ namespace Gecode { /// Unknown OTHER = 3 }; + using enum What; protected: /// Encoding a tagged pointer or a tagged group id @@ -1014,12 +1019,13 @@ namespace Gecode { public: /// Propagator status - enum Status { + enum class Status { FIX, ///< Propagator computed fixpoint NOFIX, ///< Propagator did not compute fixpoint FAILED, ///< Propagator failed SUBSUMED ///< Propagator is subsumed }; + using enum Status; protected: /// Propagator id @@ -1082,11 +1088,12 @@ namespace Gecode { public: /// Post status - enum Status { + enum class Status { POSTED, ///< Propagator was posted FAILED, ///< Posting failed SUBSUMED ///< Propagator not posted as already subsumed }; + using enum Status; protected: /// Propagator group @@ -1411,11 +1418,12 @@ namespace Gecode { public: /// The status of a no-good literal - enum Status { + enum class Status { FAILED, ///< The literal is failed SUBSUMED, ///< The literal is subsumed NONE ///< The literal is neither failed nor subsumed }; + using enum Status; /// Constructor for creation NGL(void); /// Constructor for creation @@ -1964,11 +1972,12 @@ namespace Gecode { * \brief %Space status * \ingroup TaskSearch */ - enum SpaceStatus { + enum class SpaceStatus { SS_FAILED, ///< %Space is failed SS_SOLVED, ///< %Space is solved (no brancher left) SS_BRANCH ///< %Space must be branched (at least one brancher left) }; + using enum SpaceStatus; /** * \brief %Statistics for execution of status @@ -2120,7 +2129,7 @@ namespace Gecode { */ ActorLink* active; /// Scheduled propagators according to cost - ActorLink queue[PropCost::AC_MAX + 1]; + ActorLink queue[std::to_underlying(PropCost::AC_MAX) + 1]; /** * \brief Id of next brancher to be created plus status control * @@ -3828,19 +3837,19 @@ namespace Gecode { */ forceinline void ViewTraceInfo::propagator(Propagator& p) { - who = reinterpret_cast(&p) | PROPAGATOR; + who = reinterpret_cast(&p) | std::to_underlying(PROPAGATOR); } forceinline void ViewTraceInfo::brancher(Brancher& b) { - who = reinterpret_cast(&b) | BRANCHER; + who = reinterpret_cast(&b) | std::to_underlying(BRANCHER); } forceinline void ViewTraceInfo::post(PropagatorGroup g) { - who = (static_cast(g.id()) << 2) | POST; + who = (static_cast(g.id()) << 2) | std::to_underlying(POST); } forceinline void ViewTraceInfo::other(void) { - who = OTHER; + who = std::to_underlying(OTHER); } forceinline ViewTraceInfo::What ViewTraceInfo::what(void) const { @@ -4567,7 +4576,7 @@ namespace Gecode { forceinline void Space::enqueue(Propagator* p) { ActorLink::cast(p)->unlink(); - ActorLink* c = &pc.p.queue[p->cost(*this, p->u.med).ac]; + 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; @@ -4575,7 +4584,7 @@ namespace Gecode { forceinline void Space::fail(void) { - pc.p.active = &pc.p.queue[PropCost::AC_MAX + 1] + 1; + 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 * enqueuing a propagator in a failed space keeps the space @@ -4589,7 +4598,7 @@ namespace Gecode { forceinline bool Space::failed(void) const { - return pc.p.active > &pc.p.queue[PropCost::AC_MAX + 1]; + return pc.p.active > &pc.p.queue[std::to_underlying(PropCost::AC_MAX) + 1]; } forceinline bool Home::failed(void) const { @@ -4598,22 +4607,23 @@ namespace Gecode { forceinline bool Space::stable(void) const { - return ((pc.p.active < &pc.p.queue[0]) || (pc.p.active > &pc.p.queue[PropCost::AC_MAX + 1])); + return ((pc.p.active < &pc.p.queue[0]) || + (pc.p.active > &pc.p.queue[std::to_underlying(PropCost::AC_MAX) + 1])); } forceinline void Space::notice(Actor& a, ActorProperty p, bool d) { - if (p & AP_DISPOSE) { + if (p == AP_DISPOSE) { ap_notice_dispose(&a, d); } - if (p & AP_VIEW_TRACE) { + if (p == AP_VIEW_TRACE) { pc.p.bid_sc |= sc_trace; } - if (p & AP_TRACE) { + if (p == AP_TRACE) { pc.p.bid_sc |= sc_trace; } // Currently unused - if (p & AP_WEAKLY) { + if (p == AP_WEAKLY) { // Nothing to do } } @@ -4622,16 +4632,16 @@ namespace Gecode { Space::ignore(Actor& a, ActorProperty p, bool d) { // Check whether array has already been discarded as space // deletion is already in progress - if ((p & AP_DISPOSE) && (d_fst != nullptr)) + if ((p == AP_DISPOSE) && (d_fst != nullptr)) ap_ignore_dispose(&a, d); - if (p & AP_VIEW_TRACE) { + if (p == AP_VIEW_TRACE) { // Nothing to do } - if (p & AP_TRACE) { + if (p == AP_TRACE) { // Nothing to do } // Currently unused - if (p & AP_WEAKLY) { + if (p == AP_WEAKLY) { // Nothing to do } } diff --git a/gecode/kernel/trace/filter.cpp b/gecode/kernel/trace/filter.cpp index a1d00c079c..33026f01e3 100644 --- a/gecode/kernel/trace/filter.cpp +++ b/gecode/kernel/trace/filter.cpp @@ -70,17 +70,17 @@ namespace Gecode { } TFE::TFE(PropagatorGroup g) { - init(g, (1 << ViewTraceInfo::PROPAGATOR) | (1 << ViewTraceInfo::POST)); + init(g, (1 << std::to_underlying(ViewTraceInfo::PROPAGATOR)) | (1 << std::to_underlying(ViewTraceInfo::POST))); } TFE::TFE(BrancherGroup g) { - init(g, (1 << ViewTraceInfo::BRANCHER)); + init(g, (1 << std::to_underlying(ViewTraceInfo::BRANCHER))); } TFE TFE::other(void) { TFE e; - e.init(Group::all, (1 << ViewTraceInfo::OTHER)); + e.init(Group::all, (1 << std::to_underlying(ViewTraceInfo::OTHER))); return e; } @@ -129,14 +129,14 @@ namespace Gecode { TFE propagator(PropagatorGroup g) { TFE e; - e.init(g, (1 << ViewTraceInfo::PROPAGATOR)); + e.init(g, (1 << std::to_underlying(ViewTraceInfo::PROPAGATOR))); return e; } TFE post(PropagatorGroup g) { TFE e; - e.init(g, (1 << ViewTraceInfo::POST)); + e.init(g, (1 << std::to_underlying(ViewTraceInfo::POST))); return e; } diff --git a/gecode/kernel/trace/filter.hpp b/gecode/kernel/trace/filter.hpp index a44e86b8c2..1785c26804 100644 --- a/gecode/kernel/trace/filter.hpp +++ b/gecode/kernel/trace/filter.hpp @@ -46,11 +46,12 @@ namespace Gecode { protected: /// Type of trace filter expression - enum NodeType { + enum class NodeType { NT_GROUP, ///< Propagator or brancher group NT_NEGATE, ///< Negation of expression NT_ADD ///< More than one expression }; + using enum NodeType; /// Node for trace filter expression class Node : public HeapAllocated { public: @@ -260,7 +261,7 @@ namespace Gecode { f = heap.alloc(1); f[0].g = g; f[0].neg = false; - f[0].what = 1 << ViewTraceInfo::PROPAGATOR; + f[0].what = 1 << std::to_underlying(ViewTraceInfo::PROPAGATOR); } forceinline TraceFilter::TFO::TFO(BrancherGroup g) @@ -268,14 +269,14 @@ namespace Gecode { f = heap.alloc(1); f[0].g = g; f[0].neg = false; - f[0].what = 1 << ViewTraceInfo::BRANCHER; + f[0].what = 1 << std::to_underlying(ViewTraceInfo::BRANCHER); } forceinline bool TraceFilter::TFO::operator()(const ViewTraceInfo& vti) const { if (n == 0) return true; for (int i = 0; i < n; i++) - if (f[i].what & (1 << vti.what())) { + if (f[i].what & (1 << std::to_underlying(vti.what()))) { // Group is of the right type switch (vti.what()) { case ViewTraceInfo::PROPAGATOR: @@ -309,7 +310,7 @@ namespace Gecode { if (n == 0) return true; for (int i = 0; i < n; i++) - if ((f[i].what & (1 << ViewTraceInfo::PROPAGATOR)) && (f[i].g.in(pg) != f[i].neg)) + if ((f[i].what & (1 << std::to_underlying(ViewTraceInfo::PROPAGATOR))) && (f[i].g.in(pg) != f[i].neg)) return true; return false; } @@ -324,7 +325,7 @@ namespace Gecode { if (n == 0) return true; for (int i = 0; i < n; i++) - if ((f[i].what & (1 << ViewTraceInfo::BRANCHER)) && (f[i].g.in(bg) != f[i].neg)) + if ((f[i].what & (1 << std::to_underlying(ViewTraceInfo::BRANCHER))) && (f[i].g.in(bg) != f[i].neg)) return true; return false; } diff --git a/gecode/minimodel.hh b/gecode/minimodel.hh index 4b2721af39..91dc495abe 100644 --- a/gecode/minimodel.hh +++ b/gecode/minimodel.hh @@ -58,8 +58,10 @@ #include #endif +#include #include #include +#include /* * Support for DLLs under Windows @@ -101,23 +103,27 @@ namespace Gecode { /// Class for specifying integer propagation levels used by minimodel class IntPropLevels { + private: + /// Bits needed to store any propagation level + static constexpr int level_bits = std::bit_width(std::to_underlying(IPL_DOM | IPL_FULL)); + protected: - IntPropLevel _linear2 : IPL_BITS_; ///< For binary linear - IntPropLevel _linear : IPL_BITS_; ///< For n-ary linear - IntPropLevel _abs : IPL_BITS_; ///< For absolute value - IntPropLevel _max2 : IPL_BITS_; ///< For binary maximum - IntPropLevel _max : IPL_BITS_; ///< For n-ary maximum - IntPropLevel _min2 : IPL_BITS_; ///< For binary minimum - IntPropLevel _min : IPL_BITS_; ///< For minimum - IntPropLevel _mult : IPL_BITS_; ///< For multiplication - IntPropLevel _div : IPL_BITS_; ///< For division - IntPropLevel _mod : IPL_BITS_; ///< For modulo - IntPropLevel _sqr : IPL_BITS_; ///< For square - IntPropLevel _sqrt : IPL_BITS_; ///< For square root - IntPropLevel _pow : IPL_BITS_; ///< For power - IntPropLevel _nroot : IPL_BITS_; ///< For root - IntPropLevel _element : IPL_BITS_; ///< For element - IntPropLevel _ite : IPL_BITS_; ///< For if-then-else + IntPropLevel _linear2 : level_bits; ///< For binary linear + IntPropLevel _linear : level_bits; ///< For n-ary linear + IntPropLevel _abs : level_bits; ///< For absolute value + IntPropLevel _max2 : level_bits; ///< For binary maximum + IntPropLevel _max : level_bits; ///< For n-ary maximum + IntPropLevel _min2 : level_bits; ///< For binary minimum + IntPropLevel _min : level_bits; ///< For minimum + IntPropLevel _mult : level_bits; ///< For multiplication + IntPropLevel _div : level_bits; ///< For division + IntPropLevel _mod : level_bits; ///< For modulo + IntPropLevel _sqr : level_bits; ///< For square + IntPropLevel _sqrt : level_bits; ///< For square root + IntPropLevel _pow : level_bits; ///< For power + IntPropLevel _nroot : level_bits; ///< For root + IntPropLevel _element : level_bits; ///< For element + IntPropLevel _ite : level_bits; ///< For if-then-else public: /// Initialize with default propagation level IntPropLevels(IntPropLevel ipl = IPL_DEF); @@ -256,7 +262,7 @@ namespace Gecode { #endif public: /// Type of linear expression - enum NodeType { + enum class NodeType { NT_CONST, ///< Integer constant NT_VAR_INT, ///< Linear term with integer variable NT_VAR_BOOL, ///< Linear term with Boolean variable @@ -267,6 +273,7 @@ namespace Gecode { NT_SUB, ///< Subtraction of linear terms NT_MUL ///< Multiplication by coefficient }; + using enum NodeType; private: /// Tag for internal expression slots without a public zero node @@ -705,7 +712,7 @@ namespace Gecode { public: /// Type of linear expression - enum NodeType { + enum class NodeType { NT_CONST, ///< Float value constant NT_VAR, ///< Linear term with variable NT_NONLIN, ///< Non-linear expression @@ -714,6 +721,7 @@ namespace Gecode { NT_SUB, ///< Subtraction of linear terms NT_MUL ///< Multiplication by coefficient }; + using enum NodeType; private: /// Nodes for linear expressions @@ -978,7 +986,7 @@ namespace Gecode { class SetExpr { public: /// Type of set expression - enum NodeType { + enum class NodeType { NT_VAR, ///< Variable NT_CONST, ///< Constant NT_LEXP, ///< Linear expression @@ -987,6 +995,7 @@ namespace Gecode { NT_UNION, ///< Union NT_DUNION ///< Disjoint union }; + using enum NodeType; /// %Node for set expression class Node; @@ -1126,7 +1135,7 @@ namespace Gecode { class BoolExpr { public: /// Type of Boolean expression - enum NodeType { + enum class NodeType { NT_VAR, ///< Variable NT_NOT, ///< Negation NT_AND, ///< Conjunction @@ -1138,6 +1147,7 @@ namespace Gecode { NT_MISC, ///< Other Boolean expression NT_CONST ///< Boolean constant }; + using enum NodeType; /// Miscealloneous Boolean expressions class GECODE_VTABLE_EXPORT Misc : public HeapAllocated { public: diff --git a/gecode/minimodel/set-expr.cpp b/gecode/minimodel/set-expr.cpp index 4e974aa331..38c0ad547b 100644 --- a/gecode/minimodel/set-expr.cpp +++ b/gecode/minimodel/set-expr.cpp @@ -173,14 +173,14 @@ namespace Gecode { if (neg) { switch (srt) { case SRT_EQ: - rel(home, u.a.x->x, SRT_CMPL, s); + rel(home, u.a.x->x, SRT_COMPLEMENT, s); break; - case SRT_CMPL: + case SRT_COMPLEMENT: rel(home, u.a.x->x, SRT_EQ, s); break; default: SetVar bc(home, IntSet::empty, IntSet(Set::Limits::min, Set::Limits::max)); - rel(home, s, SRT_CMPL, bc); + rel(home, s, SRT_COMPLEMENT, bc); rel(home, u.a.x->x, srt, bc); break; } @@ -212,7 +212,7 @@ namespace Gecode { IntVar iv = u.a.x->e.post(home, IntPropLevels::def); if (neg) { SetVar ic(home, IntSet::empty, IntSet(Set::Limits::min, Set::Limits::max)); - rel(home, iv, SRT_CMPL, ic); + rel(home, iv, SRT_COMPLEMENT, ic); rel(home, ic, srt, s); } else { rel(home, iv, srt, s); @@ -223,13 +223,13 @@ namespace Gecode { int i = 0; post(home, SetExpr::NT_INTER, bs, i); if (i == 2) { - rel(home, bs[0], SOT_INTER, bs[1], srt, s); + rel(home, bs[0], SOT_INTERSECTION, bs[1], srt, s); } else { if (srt == SRT_EQ) - rel(home, SOT_INTER, bs, s); + rel(home, SOT_INTERSECTION, bs, s); else { SetVar bc(home, IntSet::empty, IntSet(Set::Limits::min, Set::Limits::max)); - rel(home, SOT_INTER, bs, bc); + rel(home, SOT_INTERSECTION, bs, bc); rel(home, bc, srt, s); } } @@ -257,37 +257,37 @@ namespace Gecode { if (i == 2) { if (neg) { - if (srt == SRT_CMPL) { - rel(home, bs[0], SOT_DUNION, bs[1], srt, s); + if (srt == SRT_COMPLEMENT) { + rel(home, bs[0], SOT_DISJOINT_UNION, bs[1], srt, s); } else { SetVar bc(home, IntSet::empty, IntSet(Set::Limits::min, Set::Limits::max)); - rel(home, s, SRT_CMPL, bc); - rel(home, bs[0], SOT_DUNION, bs[1], srt, bc); + rel(home, s, SRT_COMPLEMENT, bc); + rel(home, bs[0], SOT_DISJOINT_UNION, bs[1], srt, bc); } } else { - rel(home, bs[0], SOT_DUNION, bs[1], srt, s); + rel(home, bs[0], SOT_DISJOINT_UNION, bs[1], srt, s); } } else { if (neg) { - if (srt == SRT_CMPL) { - rel(home, SOT_DUNION, bs, s); + if (srt == SRT_COMPLEMENT) { + rel(home, SOT_DISJOINT_UNION, bs, s); } else { SetVar br(home, IntSet::empty, IntSet(Set::Limits::min, Set::Limits::max)); - rel(home, SOT_DUNION, bs, br); + rel(home, SOT_DISJOINT_UNION, bs, br); if (srt == SRT_EQ) - rel(home, br, SRT_CMPL, s); + rel(home, br, SRT_COMPLEMENT, s); else { SetVar bc(home, IntSet::empty, IntSet(Set::Limits::min, Set::Limits::max)); rel(home, br, srt, bc); - rel(home, bc, SRT_CMPL, s); + rel(home, bc, SRT_COMPLEMENT, s); } } } else { if (srt == SRT_EQ) - rel(home, SOT_DUNION, bs, s); + rel(home, SOT_DISJOINT_UNION, bs, s); else { SetVar br(home, IntSet::empty, IntSet(Set::Limits::min, Set::Limits::max)); - rel(home, SOT_DUNION, bs, br); + rel(home, SOT_DISJOINT_UNION, bs, br); rel(home, br, srt, s); } } @@ -305,14 +305,14 @@ namespace Gecode { if (neg) { switch (srt) { case SRT_EQ: - rel(home, u.a.x->x, SRT_CMPL, s, b); + rel(home, u.a.x->x, SRT_COMPLEMENT, s, b); break; - case SRT_CMPL: + case SRT_COMPLEMENT: rel(home, u.a.x->x, SRT_EQ, s, b); break; default: SetVar bc(home, IntSet::empty, IntSet(Set::Limits::min, Set::Limits::max)); - rel(home, s, SRT_CMPL, bc); + rel(home, s, SRT_COMPLEMENT, bc); rel(home, u.a.x->x, srt, bc, b); break; } @@ -350,8 +350,8 @@ namespace Gecode { break; case SRT_EQ: case SRT_NQ: - case SRT_DISJ: - case SRT_CMPL: + case SRT_DISJOINT: + case SRT_COMPLEMENT: invsrt = srt; break; default: @@ -364,7 +364,7 @@ namespace Gecode { IntVar iv = u.a.x->e.post(home, IntPropLevels::def); if (neg) { SetVar ic(home, IntSet::empty, IntSet(Set::Limits::min, Set::Limits::max)); - rel(home, iv, SRT_CMPL, ic); + rel(home, iv, SRT_COMPLEMENT, ic); rel(home, ic, srt, s, b); } else { rel(home, iv, srt, s, b); @@ -375,7 +375,7 @@ namespace Gecode { int i = 0; post(home, SetExpr::NT_INTER, bs, i); SetVar br(home, IntSet::empty, IntSet(Set::Limits::min, Set::Limits::max)); - rel(home, SOT_INTER, bs, br); + rel(home, SOT_INTERSECTION, bs, br); rel(home, br, srt, s, b); } break; case SetExpr::NT_UNION: { @@ -393,19 +393,19 @@ namespace Gecode { if (neg) { SetVar br(home, IntSet::empty, IntSet(Set::Limits::min, Set::Limits::max)); - rel(home, SOT_DUNION, bs, br); - if (srt == SRT_CMPL) + rel(home, SOT_DISJOINT_UNION, bs, br); + if (srt == SRT_COMPLEMENT) rel(home, br, SRT_EQ, s, b); else if (srt == SRT_EQ) - rel(home, br, SRT_CMPL, s, b); + rel(home, br, SRT_COMPLEMENT, s, b); else { SetVar bc(home, IntSet::empty, IntSet(Set::Limits::min, Set::Limits::max)); rel(home, br, srt, bc); - rel(home, bc, SRT_CMPL, s, b); + rel(home, bc, SRT_COMPLEMENT, s, b); } } else { SetVar br(home, IntSet::empty, IntSet(Set::Limits::min, Set::Limits::max)); - rel(home, SOT_DUNION, bs, br); + rel(home, SOT_DISJOINT_UNION, bs, br); rel(home, br, srt, s, b); } } break; @@ -421,7 +421,7 @@ namespace Gecode { case SetExpr::NT_VAR: if (neg) { SetVar xc(home, IntSet::empty, IntSet(Set::Limits::min, Set::Limits::max)); - rel(home, xc, SRT_CMPL, u.a.x->x); + rel(home, xc, SRT_COMPLEMENT, u.a.x->x); b[i++] = xc; } else { b[i++] = u.a.x->x; diff --git a/gecode/minimodel/set-rel.cpp b/gecode/minimodel/set-rel.cpp index 0a70f66e54..a30142ffd8 100644 --- a/gecode/minimodel/set-rel.cpp +++ b/gecode/minimodel/set-rel.cpp @@ -68,7 +68,7 @@ namespace Gecode { } SetRel operator||(const SetExpr& e0, const SetExpr& e1) { - return SetRel(e0, SRT_DISJ, e1); + return SetRel(e0, SRT_DISJOINT, e1); } namespace { diff --git a/gecode/search.hh b/gecode/search.hh index 10a63add88..6fb6c57813 100644 --- a/gecode/search.hh +++ b/gecode/search.hh @@ -194,14 +194,15 @@ namespace Gecode { public: /// Which type of engine - enum EngineType { - DFS = 0, ///< Engine is a DFS engine - BAB = 1, ///< Engine is a BAB engine - LDS = 2, ///< Engine is a LDS engine - RBS = 3, ///< Engine is a RBS engine - PBS = 4, ///< Engine is a PBS engine - AOE = 5 ///< Unspecified engine (any other engine) + enum class EngineType { + DFS = 0, ///< Engine is a DFS engine + BAB = 1, ///< Engine is a BAB engine + LDS = 2, ///< Engine is a LDS engine + RBS = 3, ///< Engine is a RBS engine + PBS = 4, ///< Engine is a PBS engine + OTHER = 5 ///< Unspecified engine (any other engine) }; + using enum EngineType; /// Information about an engine class EngineInfo { protected: @@ -278,11 +279,12 @@ namespace Gecode { std::string string(void) const; }; /// Node type - enum NodeType { + enum class NodeType { SOLVED = 0, /// A solution node FAILED = 1, /// A failed node BRANCH = 2 /// A branch node }; + using enum NodeType; /// Node information class NodeInfo { protected: @@ -378,7 +380,7 @@ namespace Gecode { /// Output stream to use std::ostream& os; /// Map engine type to string - static const char* t2s[EngineType::AOE + 1]; + static const char* t2s[std::to_underlying(EngineType::OTHER) + 1]; public: /// Initialize with output stream \a os diff --git a/gecode/search/cpprofiler/message.hpp b/gecode/search/cpprofiler/message.hpp index 20cedeb2a8..ff360b3722 100644 --- a/gecode/search/cpprofiler/message.hpp +++ b/gecode/search/cpprofiler/message.hpp @@ -47,12 +47,13 @@ namespace Gecode { namespace CPProfiler { static const int32_t PROFILER_PROTOCOL_VERSION = 3; /// Types of nodes for CP Profiler - enum NodeStatus { + enum class NodeStatus { SOLVED = 0, ///< Node representing a solution FAILED = 1, ///< Node representing failure BRANCH = 2, ///< Node representing a branch SKIPPED = 3 ///< Node skipped by backjumping }; + using enum NodeStatus; /// Types of messages for CP Profiler enum class MsgType { NODE = 0, DONE = 1, START = 2, RESTART = 3 }; @@ -286,7 +287,8 @@ namespace Gecode { namespace CPProfiler { class MessageMarshalling { private: /// Only optional fields are listed here, if node (no need for field id) - enum Field { LABEL = 0, NOGOOD = 1, INFO = 2, VERSION = 3 }; + enum class Field { LABEL = 0, NOGOOD = 1, INFO = 2, VERSION = 3 }; + using enum Field; Message msg; diff --git a/gecode/search/heuristic.hh b/gecode/search/heuristic.hh index 11e12d740e..e737102400 100644 --- a/gecode/search/heuristic.hh +++ b/gecode/search/heuristic.hh @@ -199,10 +199,11 @@ namespace Gecode { namespace Search { class Beam { public: /// Result of offering an entry - enum Offer { + enum class Offer { TAKEN, ///< The entry has been added or deleted FULL ///< The entry needs a new slot but there is no room }; + using enum Offer; private: /// Slot of an entry diff --git a/gecode/search/par/engine.hh b/gecode/search/par/engine.hh index a8471fe717..b9213f966f 100644 --- a/gecode/search/par/engine.hh +++ b/gecode/search/par/engine.hh @@ -160,12 +160,20 @@ namespace Gecode { namespace Search { namespace Par { /// \name Commands from engine to workers and wait management //@{ /// Commands from engine to workers - enum Cmd { + enum class Cmd { C_WORK, ///< Perform work C_WAIT, ///< Run into wait lock C_RESET, ///< Perform reset operation C_TERMINATE ///< Terminate }; + /// Perform work + static constexpr Cmd C_WORK = Cmd::C_WORK; + /// Run into wait lock + static constexpr Cmd C_WAIT = Cmd::C_WAIT; + /// Perform reset operation + static constexpr Cmd C_RESET = Cmd::C_RESET; + /// Terminate + static constexpr Cmd C_TERMINATE = Cmd::C_TERMINATE; protected: /// The current command diff --git a/gecode/search/seq/choice-expansion.hh b/gecode/search/seq/choice-expansion.hh index bce9e2b97f..c6479924ed 100644 --- a/gecode/search/seq/choice-expansion.hh +++ b/gecode/search/seq/choice-expansion.hh @@ -44,11 +44,12 @@ namespace Gecode { namespace Search { namespace Seq { class ExpansionStep { public: /// What the step produced - enum State { + enum class State { CHILD, ///< A propagated child TERMINAL, ///< The node itself, as it does not branch EXHAUSTED ///< Nothing, all alternatives have been expanded }; + using enum State; /// The state State state; /// The child or node diff --git a/gecode/search/seq/dead.cpp b/gecode/search/seq/dead.cpp index bd3784b853..8647ad255c 100644 --- a/gecode/search/seq/dead.cpp +++ b/gecode/search/seq/dead.cpp @@ -63,7 +63,7 @@ namespace Gecode { namespace Search { namespace Seq { template Dead::Dead(const Options& o, const Statistics& stat0, EndReason r) : tracer(o.tracer), stat(stat0), reason(r), end(EndReason::NotEnded) { - tracer.engine(SearchTracer::EngineType::AOE, 1U); + tracer.engine(SearchTracer::EngineType::OTHER, 1U); tracer.worker(); } diff --git a/gecode/search/tracer.cpp b/gecode/search/tracer.cpp index bd31c6bc6d..16a8194af0 100644 --- a/gecode/search/tracer.cpp +++ b/gecode/search/tracer.cpp @@ -34,7 +34,8 @@ namespace Gecode { - const char* StdSearchTracer::t2s[SearchTracer::EngineType::AOE + 1] = {"DFS", "BAB", "LDS", "RBS", "PBS", "AOE"}; + const char* StdSearchTracer::t2s[std::to_underlying(SearchTracer::EngineType::OTHER) + 1] = {"DFS", "BAB", "LDS", + "RBS", "PBS", "AOE"}; StdSearchTracer::StdSearchTracer(std::ostream& os0) : os(os0) {} @@ -42,7 +43,7 @@ namespace Gecode { StdSearchTracer::init(void) { os << "trace::init()" << '\n' << std::flush; for (unsigned int e = 0U; e < engines(); e++) { - os << "\t" << e << ": " << t2s[engine(e).type()]; + os << "\t" << e << ": " << t2s[std::to_underlying(engine(e).type())]; if (engine(e).meta()) { os << ", engines: {"; for (unsigned int i = engine(e).efst(); i < engine(e).elst(); i++) { diff --git a/gecode/search/tracer.hpp b/gecode/search/tracer.hpp index f8d89f8be6..9443de60fd 100644 --- a/gecode/search/tracer.hpp +++ b/gecode/search/tracer.hpp @@ -59,14 +59,14 @@ namespace Gecode { forceinline unsigned int SearchTracer::EngineInfo::wfst(void) const { assert((type() == EngineType::DFS) || (type() == EngineType::BAB) || (type() == EngineType::LDS) || - (type() == EngineType::AOE)); + (type() == EngineType::OTHER)); return _fst; } forceinline unsigned int SearchTracer::EngineInfo::wlst(void) const { assert((type() == EngineType::DFS) || (type() == EngineType::BAB) || (type() == EngineType::LDS) || - (type() == EngineType::AOE)); + (type() == EngineType::OTHER)); return _lst; } @@ -229,7 +229,7 @@ namespace Gecode { case EngineType::DFS: case EngineType::BAB: case EngineType::LDS: - case EngineType::AOE: + case EngineType::OTHER: es[n_e] = EngineInfo(t, n_w, n_w + n); break; default: diff --git a/gecode/set.hh b/gecode/set.hh index b248925bae..3484ab23db 100644 --- a/gecode/set.hh +++ b/gecode/set.hh @@ -627,29 +627,31 @@ namespace Gecode { * * \ingroup TaskModelSet */ - enum SetRelType { - SRT_EQ, ///< Equality (\f$=\f$) - SRT_NQ, ///< Disequality (\f$\neq\f$) - SRT_SUB, ///< Subset (\f$\subseteq\f$) - SRT_SUP, ///< Superset (\f$\supseteq\f$) - SRT_DISJ, ///< Disjoint (\f$\parallel\f$) - SRT_CMPL, ///< Complement - SRT_LQ, ///< Less or equal (\f$\leq\f$) - SRT_LT, ///< Strictly less (\f$<\f$) - SRT_GQ, ///< Greater or equal (\f$\geq\f$) - SRT_GR ///< Greater (\f$>\f$) + enum class SetRelType { + SRT_EQ, ///< Equality (\f$=\f$) + SRT_NQ, ///< Disequality (\f$\neq\f$) + SRT_SUB, ///< Subset (\f$\subseteq\f$) + SRT_SUP, ///< Superset (\f$\supseteq\f$) + SRT_DISJOINT, ///< Disjoint (\f$\parallel\f$) + SRT_COMPLEMENT, ///< Complement + SRT_LQ, ///< Less or equal (\f$\leq\f$) + SRT_LT, ///< Strictly less (\f$<\f$) + SRT_GQ, ///< Greater or equal (\f$\geq\f$) + SRT_GR ///< Greater (\f$>\f$) }; + using enum SetRelType; /** * \brief Common operations for sets * \ingroup TaskModelSet */ - enum SetOpType { - SOT_UNION, ///< Union - SOT_DUNION, ///< Disjoint union - SOT_INTER, ///< %Intersection - SOT_MINUS ///< Difference + enum class SetOpType { + SOT_UNION, ///< Union + SOT_DISJOINT_UNION, ///< Disjoint union + SOT_INTERSECTION, ///< %Intersection + SOT_MINUS ///< Difference }; + using enum SetOpType; /** * \defgroup TaskModelSetDom Domain constraints @@ -1210,7 +1212,7 @@ namespace Gecode { class SetVarBranch : public VarBranch { public: /// Which variable selection - enum Select { + enum class Select { SEL_NONE = 0, ///< First unassigned SEL_RND, ///< Random (uniform, for tie breaking) SEL_MERIT_MIN, ///< With least merit @@ -1238,6 +1240,7 @@ namespace Gecode { SEL_CHB_SIZE_MIN, ///< With smallest CHB Q-score divided by domain size SEL_CHB_SIZE_MAX ///< With largest CHB Q-score divided by domain size }; + using enum Select; protected: /// Which variable to select @@ -1363,7 +1366,7 @@ namespace Gecode { class SetValBranch : public ValBranch { public: /// Which value selection - enum Select { + enum class Select { SEL_MIN_INC, ///< Include smallest element SEL_MIN_EXC, ///< Exclude smallest element SEL_MED_INC, ///< Include median element (rounding downwards) @@ -1374,6 +1377,7 @@ namespace Gecode { SEL_RND_EXC, ///< Exclude random element SEL_VAL_COMMIT ///< Select value according to user-defined functions }; + using enum Select; protected: /// Which value to select @@ -1435,7 +1439,7 @@ namespace Gecode { class SetAssign : public ValBranch { public: /// Which value selection - enum Select { + enum class Select { SEL_MIN_INC, ///< Include smallest element SEL_MIN_EXC, ///< Exclude smallest element SEL_MED_INC, ///< Include median element (rounding downwards) @@ -1446,6 +1450,7 @@ namespace Gecode { SEL_RND_EXC, ///< Exclude random element SEL_VAL_COMMIT ///< Select value according to user-defined functions }; + using enum Select; protected: /// Which value to select diff --git a/gecode/set/dom.cpp b/gecode/set/dom.cpp index e2a085ba4a..da797cf129 100644 --- a/gecode/set/dom.cpp +++ b/gecode/set/dom.cpp @@ -103,7 +103,7 @@ namespace Gecode { Set::ConstSetView cv(home, is); GECODE_ES_FAIL((Set::Rel::Lq::post(home, cv, s))); } break; - case SRT_DISJ: { + case SRT_DISJOINT: { if (is.ranges() == 1) { GECODE_ME_FAIL(_s.exclude(home, is.min(), is.max())); } else { @@ -131,7 +131,7 @@ namespace Gecode { GECODE_ME_FAIL(_s.include_i(home, rd)); } } break; - case SRT_CMPL: { + case SRT_COMPLEMENT: { if (is.ranges() == 1) { GECODE_ME_FAIL(_s.exclude(home, is.min(), is.max())); GECODE_ME_FAIL(_s.include(home, Set::Limits::min, is.min() - 1)); @@ -201,7 +201,7 @@ namespace Gecode { GECODE_ES_FAIL((Set::Rel::Lq::post(home, cv, _s))); } } break; - case SRT_DISJ: { + case SRT_DISJOINT: { if (is.ranges() == 1) { for (int i = s.size(); i--;) { Set::SetView _s(s[i]); @@ -250,7 +250,7 @@ namespace Gecode { } } } break; - case SRT_CMPL: { + case SRT_COMPLEMENT: { if (is.ranges() == 1) { for (int i = s.size(); i--;) { Set::SetView _s(s[i]); @@ -306,8 +306,8 @@ namespace Gecode { GECODE_ES_FAIL((Set::Rel::ReEq::post( home, s, cv, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Set::Rel::ReEq::post( + case RM_RIMP: + GECODE_ES_FAIL((Set::Rel::ReEq::post( home, s, cv, r.var()))); break; default: @@ -325,9 +325,9 @@ namespace Gecode { GECODE_ES_FAIL( (Set::Rel::ReLq::post(home, s, cv, r.var()))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL( - (Set::Rel::ReLq::post(home, s, cv, r.var()))); + (Set::Rel::ReLq::post(home, s, cv, r.var()))); break; default: throw Gecode::Int::UnknownReifyMode("Set::dom"); @@ -344,9 +344,9 @@ namespace Gecode { GECODE_ES_FAIL( (Set::Rel::ReLq::post(home, s, cv, r.var()))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL( - (Set::Rel::ReLq::post(home, s, cv, r.var()))); + (Set::Rel::ReLq::post(home, s, cv, r.var()))); break; default: throw Gecode::Int::UnknownReifyMode("Set::dom"); @@ -363,9 +363,9 @@ namespace Gecode { GECODE_ES_FAIL( (Set::Rel::ReLq::post(home, cv, s, r.var()))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL( - (Set::Rel::ReLq::post(home, cv, s, r.var()))); + (Set::Rel::ReLq::post(home, cv, s, r.var()))); break; default: throw Gecode::Int::UnknownReifyMode("Set::dom"); @@ -382,9 +382,9 @@ namespace Gecode { GECODE_ES_FAIL( (Set::Rel::ReLq::post(home, cv, s, r.var()))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL( - (Set::Rel::ReLq::post(home, cv, s, r.var()))); + (Set::Rel::ReLq::post(home, cv, s, r.var()))); break; default: throw Gecode::Int::UnknownReifyMode("Set::dom"); @@ -399,10 +399,11 @@ namespace Gecode { home, s, cv, notb))); break; case RM_IMP: - GECODE_ES_FAIL((Set::Rel::ReEq::post( - home, s, cv, notb))); + GECODE_ES_FAIL( + (Set::Rel::ReEq::post( + home, s, cv, notb))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((Set::Rel::ReEq::post( home, s, cv, notb))); break; @@ -423,9 +424,9 @@ namespace Gecode { (Set::Rel::ReSubset::post( home, s, cv, r.var()))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL( - (Set::Rel::ReSubset::post( + (Set::Rel::ReSubset::post( home, s, cv, r.var()))); break; default: @@ -445,16 +446,16 @@ namespace Gecode { (Set::Rel::ReSubset::post( home, cv, s, r.var()))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL( - (Set::Rel::ReSubset::post( + (Set::Rel::ReSubset::post( home, cv, s, r.var()))); break; default: throw Gecode::Int::UnknownReifyMode("Set::dom"); } } break; - case SRT_DISJ: { + case SRT_DISJOINT: { // x||y <=> b is equivalent to // ( y <= complement(x) and x<=complement(y) ) <=> b @@ -474,16 +475,16 @@ namespace Gecode { (Set::Rel::ReSubset::post( home, s, complement_view, r.var()))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL( - (Set::Rel::ReSubset::post( + (Set::Rel::ReSubset::post( home, s, complement_view, r.var()))); break; default: throw Gecode::Int::UnknownReifyMode("Set::dom"); } } break; - case SRT_CMPL: { + case SRT_COMPLEMENT: { Set::SetView sv(s); IntSetRanges dr1(is); @@ -500,8 +501,8 @@ namespace Gecode { GECODE_ES_FAIL((Set::Rel::ReEq::post( home, s, complement_view, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Set::Rel::ReEq::post( + case RM_RIMP: + GECODE_ES_FAIL((Set::Rel::ReEq::post( home, s, complement_view, r.var()))); break; default: diff --git a/gecode/set/element.cpp b/gecode/set/element.cpp index ef149860b3..72df6a1997 100644 --- a/gecode/set/element.cpp +++ b/gecode/set/element.cpp @@ -52,7 +52,7 @@ namespace Gecode { GECODE_POST; switch (op) { - case SOT_DUNION: { + case SOT_DISJOINT_UNION: { Set::Element::ElementDisjoint::IdxViewArray iv(home, x); GECODE_ES_FAIL((Element::ElementDisjoint::post(home, iv, y))); } @@ -61,7 +61,7 @@ namespace Gecode { Set::Element::ElementUnion::IdxViewArray iv(home, x); GECODE_ES_FAIL((Element::ElementUnion::post(home, iv, y, z))); } break; - case SOT_INTER: { + case SOT_INTERSECTION: { Set::Element::ElementIntersection::IdxViewArray iv(home, x); GECODE_ES_FAIL((Element::ElementIntersection::post(home, iv, y, z, universe))); } break; @@ -78,7 +78,7 @@ namespace Gecode { GECODE_POST; switch (op) { - case SOT_DUNION: { + case SOT_DISJOINT_UNION: { Set::Element::ElementDisjoint::IdxViewArray iv(home, x); GECODE_ES_FAIL((Element::ElementDisjoint::post(home, iv, y))); } @@ -87,7 +87,7 @@ namespace Gecode { Set::Element::ElementUnion::IdxViewArray iv(home, x); GECODE_ES_FAIL((Element::ElementUnion::post(home, iv, y, z))); } break; - case SOT_INTER: { + case SOT_INTERSECTION: { Set::Element::ElementIntersection::IdxViewArray iv(home, x); GECODE_ES_FAIL( (Element::ElementIntersection::post(home, iv, y, z, universe))); @@ -106,7 +106,7 @@ namespace Gecode { GECODE_POST; switch (op) { - case SOT_DUNION: { + case SOT_DISJOINT_UNION: { Set::Element::ElementDisjoint::IdxViewArray iv(home, n); for (int i = n; i--;) { iv[i].idx = i; @@ -118,7 +118,7 @@ namespace Gecode { case SOT_UNION: { GECODE_ES_FAIL((Element::ElementUnionConst::post(home, z, x, y))); } break; - case SOT_INTER: { + case SOT_INTERSECTION: { Set::Element::ElementIntersection::IdxViewArray iv(home, n); for (int i = n; i--;) { iv[i].idx = i; diff --git a/gecode/set/int.cpp b/gecode/set/int.cpp index 32cac20135..d97015f3d9 100644 --- a/gecode/set/int.cpp +++ b/gecode/set/int.cpp @@ -94,7 +94,7 @@ namespace Gecode { namespace Set { namespace Int { // Whether set is not empty BoolVar ne(home, 0, 1); rel(home, c, IRT_GR, 0, ne); - if (r.mode() != RM_PMI) + if (r.mode() != RM_RIMP) rel(home, r.var(), BOT_IMP, ne, 1); min(home, s, m, ne); } @@ -107,7 +107,7 @@ namespace Gecode { namespace Set { namespace Int { // Whether set is not empty BoolVar ne(home, 0, 1); rel(home, c, IRT_GR, 0, ne); - if (r.mode() != RM_PMI) + if (r.mode() != RM_RIMP) rel(home, r.var(), BOT_IMP, ne, 1); max(home, s, m, ne); } @@ -132,8 +132,8 @@ namespace Gecode { GECODE_ES_FAIL((Set::Rel::ReEq::post( home, s, xs, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Set::Rel::ReEq::post( + case RM_RIMP: + GECODE_ES_FAIL((Set::Rel::ReEq::post( home, s, xs, r.var()))); break; default: @@ -158,7 +158,7 @@ namespace Gecode { b = BoolVar(home, 0, 1); rel(home, r.var(), BOT_IMP, b, 1); break; - case RM_PMI: + case RM_RIMP: b = BoolVar(home, 0, 1); rel(home, b, BOT_IMP, r.var(), 1); break; @@ -218,8 +218,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Set::Int::ReMinElement::post(home, s, x, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Set::Int::ReMinElement::post(home, s, x, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Set::Int::ReMinElement::post(home, s, x, r.var()))); break; default: throw Gecode::Int::UnknownReifyMode("Set::min"); @@ -248,8 +248,8 @@ namespace Gecode { case RM_IMP: GECODE_ES_FAIL((Set::Int::ReMaxElement::post(home, s, x, r.var()))); break; - case RM_PMI: - GECODE_ES_FAIL((Set::Int::ReMaxElement::post(home, s, x, r.var()))); + case RM_RIMP: + GECODE_ES_FAIL((Set::Int::ReMaxElement::post(home, s, x, r.var()))); break; default: throw Gecode::Int::UnknownReifyMode("Set::max"); diff --git a/gecode/set/int/minmax.hpp b/gecode/set/int/minmax.hpp index ea339d76cf..adf39a7e1c 100644 --- a/gecode/set/int/minmax.hpp +++ b/gecode/set/int/minmax.hpp @@ -277,7 +277,7 @@ namespace Gecode { namespace Set { namespace Int { ReMinElement::propagate(Space& home, const ModEventDelta&) { // check if b is determined if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return home.ES_SUBSUMED(*this); GECODE_REWRITE(*this, (MinElement::post(home(*this), x0, x1))); } @@ -292,7 +292,7 @@ namespace Gecode { namespace Set { namespace Int { // if min(x0.glb) < min(x1), then b=0 and entailed if ((x0.card_max() == 0) || ((x1.max() < x0.lub_min()) || (x1.min() > x0.lub_max())) || ((x0.glb_size() > 0) && (x0.glb_min() < x1.min()))) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); return home.ES_SUBSUMED(*this); } @@ -304,14 +304,14 @@ namespace Gecode { namespace Set { namespace Int { if (rm != RM_IMP) GECODE_ME_CHECK(b.one(home)); } else { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); } 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 (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); return home.ES_SUBSUMED(*this); } @@ -547,7 +547,7 @@ namespace Gecode { namespace Set { namespace Int { ReMaxElement::propagate(Space& home, const ModEventDelta&) { // check if b is determined if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return home.ES_SUBSUMED(*this); GECODE_REWRITE(*this, (MaxElement::post(home(*this), x0, x1))); } @@ -562,7 +562,7 @@ namespace Gecode { namespace Set { namespace Int { // if max(x0.glb) > max(x1), then b=0 and entailed if ((x0.card_max() == 0) || ((x1.max() < x0.lub_min()) || (x1.min() > x0.lub_max())) || ((x0.glb_size() > 0) && (x0.glb_max() > x1.max()))) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); return home.ES_SUBSUMED(*this); } @@ -574,14 +574,14 @@ namespace Gecode { namespace Set { namespace Int { if (rm != RM_IMP) GECODE_ME_CHECK(b.one(home)); } else { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); } 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 (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); return home.ES_SUBSUMED(*this); } @@ -592,7 +592,7 @@ namespace Gecode { namespace Set { namespace Int { Gecode::Int::ViewRanges d(x1); Gecode::Iter::Ranges::Inter, Gecode::Int::ViewRanges> ir(ub, d); if (!ir()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); return home.ES_SUBSUMED(*this); } @@ -614,7 +614,7 @@ namespace Gecode { namespace Set { namespace Int { } // if x1.max < nth_smallest, then entailed if (x1.max() < nth_smallest) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero(home)); return home.ES_SUBSUMED(*this); } diff --git a/gecode/set/rel-op-const-cvc.cpp b/gecode/set/rel-op-const-cvc.cpp index db86ab1a4f..3f87bd33e7 100644 --- a/gecode/set/rel-op-const-cvc.cpp +++ b/gecode/set/rel-op-const-cvc.cpp @@ -48,7 +48,7 @@ namespace Gecode { Set::Limits::check(z, "Set::rel"); ConstSetView xv(home, x); ConstSetView zv(home, z); - if (r == SRT_CMPL) { + if (r == SRT_COMPLEMENT) { post_compl(home, xv, op, y, zv); } else { post_nocompl(home, xv, op, y, r, zv); diff --git a/gecode/set/rel-op-const-cvv.cpp b/gecode/set/rel-op-const-cvv.cpp index d187dc600d..c1f12034a8 100644 --- a/gecode/set/rel-op-const-cvv.cpp +++ b/gecode/set/rel-op-const-cvv.cpp @@ -47,7 +47,7 @@ namespace Gecode { Set::Limits::check(x, "Set::rel"); ConstSetView xv(home, x); GECODE_POST; - if (r == SRT_CMPL) { + if (r == SRT_COMPLEMENT) { post_compl(home, xv, op, y, z); } else { post_nocompl(home, xv, op, y, r, z); diff --git a/gecode/set/rel-op-const-vcc.cpp b/gecode/set/rel-op-const-vcc.cpp index 5005f3bf13..8a8a0112bf 100644 --- a/gecode/set/rel-op-const-vcc.cpp +++ b/gecode/set/rel-op-const-vcc.cpp @@ -99,7 +99,7 @@ namespace Gecode { GECODE_ES_FAIL((Intersection::post(home, cy, xv, tmp))); } break; - case SRT_DISJ: { + case SRT_DISJOINT: { SetVar tmp(home); SetView tmpv(tmp); IntSetRanges zi(z); @@ -111,7 +111,7 @@ namespace Gecode { ConstSetView cy(home, yc); GECODE_ES_FAIL((Intersection::post(home, cy, x, tmp))); } break; - case SRT_CMPL: { + case SRT_COMPLEMENT: { SetView xv(x); ComplementView cx(xv); GECODE_ES_FAIL((Union, ConstSetView>::post(home, yv, cx, zv))); diff --git a/gecode/set/rel-op-const-vcv.cpp b/gecode/set/rel-op-const-vcv.cpp index 682d745cd3..6bf22ba89e 100644 --- a/gecode/set/rel-op-const-vcv.cpp +++ b/gecode/set/rel-op-const-vcv.cpp @@ -97,7 +97,7 @@ namespace Gecode { SetView xv(x); GECODE_ES_FAIL((Intersection::post(home, cy, xv, tmp))); } break; - case SRT_DISJ: { + case SRT_DISJOINT: { SetVar tmp(home); EmptyView emptyset; GECODE_ES_FAIL((SuperOfInter::post(home, z, tmp, emptyset))); @@ -108,7 +108,7 @@ namespace Gecode { ConstSetView cy(home, yc); GECODE_ES_FAIL((Intersection::post(home, cy, x, tmp))); } break; - case SRT_CMPL: { + case SRT_COMPLEMENT: { SetView xv(x); ComplementView cx(xv); GECODE_ES_FAIL((Union, SetView>::post(home, yv, cx, z))); diff --git a/gecode/set/rel-op-const-vvc.cpp b/gecode/set/rel-op-const-vvc.cpp index effee7fb1c..f86f701f19 100644 --- a/gecode/set/rel-op-const-vvc.cpp +++ b/gecode/set/rel-op-const-vvc.cpp @@ -46,7 +46,7 @@ namespace Gecode { rel(Home home, SetVar x, SetOpType op, SetVar y, SetRelType r, const IntSet& z) { Set::Limits::check(z, "Set::rel"); ConstSetView zv(home, z); - if (r == SRT_CMPL) { + if (r == SRT_COMPLEMENT) { post_compl(home, x, op, y, zv); } else { post_nocompl(home, x, op, y, r, zv); diff --git a/gecode/set/rel-op-singleton.cpp b/gecode/set/rel-op-singleton.cpp index e50646df34..c734253e79 100644 --- a/gecode/set/rel-op-singleton.cpp +++ b/gecode/set/rel-op-singleton.cpp @@ -54,10 +54,10 @@ namespace Gecode { case SOT_UNION: GECODE_ES_FAIL((RelOp::UnionN::post(home, xa, y))); break; - case SOT_DUNION: + case SOT_DISJOINT_UNION: GECODE_ES_FAIL((RelOp::PartitionN::post(home, xa, y))); break; - case SOT_INTER: + case SOT_INTERSECTION: GECODE_ES_FAIL((RelOp::IntersectionN::post(home, xa, y))); break; case SOT_MINUS: @@ -83,10 +83,10 @@ namespace Gecode { case SOT_UNION: GECODE_ES_FAIL((RelOp::UnionN::post(home, xa, z, y))); break; - case SOT_DUNION: + case SOT_DISJOINT_UNION: GECODE_ES_FAIL((RelOp::PartitionN::post(home, xa, z, y))); break; - case SOT_INTER: + case SOT_INTERSECTION: GECODE_ES_FAIL((RelOp::IntersectionN::post(home, xa, z, y))); break; case SOT_MINUS: diff --git a/gecode/set/rel-op-ternary.cpp b/gecode/set/rel-op-ternary.cpp index 1f6eb38b14..bdceda3209 100644 --- a/gecode/set/rel-op-ternary.cpp +++ b/gecode/set/rel-op-ternary.cpp @@ -43,7 +43,7 @@ namespace Gecode { void rel(Home home, SetVar x, SetOpType op, SetVar y, SetRelType r, SetVar z) { GECODE_POST; - if (r == SRT_CMPL) { + if (r == SRT_COMPLEMENT) { post_compl(home, x, op, y, z); } else { post_nocompl(home, x, op, y, r, z); diff --git a/gecode/set/rel-op.cpp b/gecode/set/rel-op.cpp index c5921b1965..a1e34eabeb 100644 --- a/gecode/set/rel-op.cpp +++ b/gecode/set/rel-op.cpp @@ -48,10 +48,10 @@ namespace Gecode { case SOT_UNION: GECODE_ES_FAIL((RelOp::UnionN::post(home, xa, y))); break; - case SOT_DUNION: + case SOT_DISJOINT_UNION: GECODE_ES_FAIL((RelOp::PartitionN::post(home, xa, y))); break; - case SOT_INTER: { + case SOT_INTERSECTION: { GECODE_ES_FAIL((RelOp::IntersectionN::post(home, xa, y))); } break; case SOT_MINUS: @@ -71,10 +71,10 @@ namespace Gecode { case SOT_UNION: GECODE_ES_FAIL((RelOp::UnionN::post(home, xa, z, y))); break; - case SOT_DUNION: + case SOT_DISJOINT_UNION: GECODE_ES_FAIL((RelOp::PartitionN::post(home, xa, z, y))); break; - case SOT_INTER: { + case SOT_INTERSECTION: { GECODE_ES_FAIL((RelOp::IntersectionN::post(home, xa, z, y))); } break; case SOT_MINUS: diff --git a/gecode/set/rel-op/post.hpp b/gecode/set/rel-op/post.hpp index 45c2bfefe2..be68e7a8ae 100644 --- a/gecode/set/rel-op/post.hpp +++ b/gecode/set/rel-op/post.hpp @@ -43,7 +43,7 @@ namespace Gecode { namespace Set { namespace RelOp { forceinline void rel_eq(Home home, View0 x0, SetOpType op, View1 x1, Res x2) { switch (op) { - case SOT_DUNION: { + case SOT_DISJOINT_UNION: { EmptyView emptyset; GECODE_ES_FAIL((SuperOfInter::post(home, x0, x1, emptyset))); } @@ -51,7 +51,7 @@ namespace Gecode { namespace Set { namespace RelOp { case SOT_UNION: { GECODE_ES_FAIL((Union::post(home, x0, x1, x2))); } break; - case SOT_INTER: { + case SOT_INTERSECTION: { GECODE_ES_FAIL((Intersection::post(home, x0, x1, x2))); } break; case SOT_MINUS: { @@ -65,7 +65,7 @@ namespace Gecode { namespace Set { namespace RelOp { forceinline void rel_sub(Home home, View0 x0, SetOpType op, View1 x1, View2 x2) { switch (op) { - case SOT_DUNION: { + case SOT_DISJOINT_UNION: { EmptyView emptyset; GECODE_ES_FAIL((SuperOfInter::post(home, x0, x1, emptyset))); } @@ -76,7 +76,7 @@ namespace Gecode { namespace Set { namespace RelOp { GECODE_ES_FAIL((Union::post(home, x0, x1, tmp))); } break; - case SOT_INTER: { + case SOT_INTERSECTION: { GECODE_ES_FAIL((SuperOfInter::post(home, x0, x1, x2))); } break; case SOT_MINUS: { @@ -90,7 +90,7 @@ namespace Gecode { namespace Set { namespace RelOp { forceinline void rel_sup(Home home, View0 x0, SetOpType op, View1 x1, View2 x2) { switch (op) { - case SOT_DUNION: { + case SOT_DISJOINT_UNION: { EmptyView emptyset; GECODE_ES_FAIL((SuperOfInter::post(home, x0, x1, emptyset))); } @@ -98,7 +98,7 @@ namespace Gecode { namespace Set { namespace RelOp { case SOT_UNION: { GECODE_ES_FAIL((SubOfUnion::post(home, x0, x1, x2))); } break; - case SOT_INTER: { + case SOT_INTERSECTION: { SetVar tmp(home); GECODE_ES_FAIL((Rel::Subset::post(home, x2, tmp))); @@ -163,7 +163,7 @@ namespace Gecode { namespace Set { namespace RelOp { case SRT_SUP: rel_sup(home, x, op, y, z); break; - case SRT_DISJ: { + case SRT_DISJOINT: { SetVar tmp(home); EmptyView emptyset; GECODE_ES_FAIL((SuperOfInter::post(home, z, tmp, emptyset))); diff --git a/gecode/set/rel.cpp b/gecode/set/rel.cpp index 1e453cb1b9..ab88d804d4 100644 --- a/gecode/set/rel.cpp +++ b/gecode/set/rel.cpp @@ -58,11 +58,11 @@ namespace Gecode { namespace Set { case SRT_SUP: GECODE_ES_FAIL((Subset::post(home, x1, x0))); break; - case SRT_DISJ: { + case SRT_DISJOINT: { EmptyView emptyset; GECODE_ES_FAIL((SuperOfInter::post(home, x0, x1, emptyset))); } break; - case SRT_CMPL: { + case SRT_COMPLEMENT: { ComplementView cx0(x0); GECODE_ES_FAIL((Eq, View1>::post(home, cx0, x1))); } break; @@ -100,9 +100,9 @@ namespace Gecode { namespace Set { GECODE_ES_FAIL((ReEq::post(home, x, y, notb))); break; case RM_IMP: - GECODE_ES_FAIL((ReEq::post(home, x, y, notb))); + GECODE_ES_FAIL((ReEq::post(home, x, y, notb))); break; - case RM_PMI: + case RM_RIMP: GECODE_ES_FAIL((ReEq::post(home, x, y, notb))); break; default: @@ -115,14 +115,14 @@ namespace Gecode { namespace Set { case SRT_SUP: GECODE_ES_FAIL((ReSubset::post(home, y, x, b))); break; - case SRT_DISJ: { + case SRT_DISJOINT: { // x||y <=> b is equivalent to // ( y <= complement(x) ) <=> b ComplementView xc(x); GECODE_ES_FAIL((ReSubset, Gecode::Int::BoolView, rm>::post(home, y, xc, b))); } break; - case SRT_CMPL: { + case SRT_COMPLEMENT: { ComplementView xc(x); GECODE_ES_FAIL((ReEq, View1, Gecode::Int::BoolView, rm>::post(home, xc, y, b))); } break; @@ -186,8 +186,8 @@ namespace Gecode { case RM_IMP: rel_re(home, x, rt, y, r.var()); break; - case RM_PMI: - rel_re(home, x, rt, y, r.var()); + case RM_RIMP: + rel_re(home, x, rt, y, r.var()); break; default: throw Gecode::Int::UnknownReifyMode("Set::rel"); @@ -206,8 +206,8 @@ namespace Gecode { case RM_IMP: rel_re(home, s, rt, x_singleton, r.var()); break; - case RM_PMI: - rel_re(home, s, rt, x_singleton, r.var()); + case RM_RIMP: + rel_re(home, s, rt, x_singleton, r.var()); break; default: throw Gecode::Int::UnknownReifyMode("Set::rel"); diff --git a/gecode/set/rel/re-eq.hpp b/gecode/set/rel/re-eq.hpp index 2a29e80aaf..45cfaaa2c7 100644 --- a/gecode/set/rel/re-eq.hpp +++ b/gecode/set/rel/re-eq.hpp @@ -100,7 +100,7 @@ namespace Gecode { namespace Set { namespace Rel { ExecStatus ReEq::propagate(Space& home, const ModEventDelta&) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return home.ES_SUBSUMED(*this); GECODE_REWRITE(*this, (Eq::post(home(*this), x0, x1))); } @@ -126,7 +126,7 @@ namespace Gecode { namespace Set { namespace Rel { GECODE_ME_CHECK(b.one_none(home)); return home.ES_SUBSUMED(*this); } else { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); return home.ES_SUBSUMED(*this); } @@ -134,7 +134,7 @@ namespace Gecode { namespace Set { namespace Rel { // check whether cardinalities still allow equality if (x0.card_min() > x1.card_max() || x1.card_min() > x0.card_max()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); return home.ES_SUBSUMED(*this); } @@ -144,7 +144,7 @@ namespace Gecode { namespace Set { namespace Rel { LubRanges x1ub(x1); Iter::Ranges::Diff, LubRanges> diff1(x0lb, x1ub); if (diff1()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); return home.ES_SUBSUMED(*this); } @@ -154,7 +154,7 @@ namespace Gecode { namespace Set { namespace Rel { LubRanges x0ub(x0); Iter::Ranges::Diff, LubRanges> diff2(x1lb, x0ub); if (diff2()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); return home.ES_SUBSUMED(*this); } diff --git a/gecode/set/rel/re-lq.hpp b/gecode/set/rel/re-lq.hpp index 52bb2073f9..08b94dd673 100644 --- a/gecode/set/rel/re-lq.hpp +++ b/gecode/set/rel/re-lq.hpp @@ -81,7 +81,7 @@ namespace Gecode { namespace Set { namespace Rel { (void)new (home) ReLq(home, x0, x1, b); } else { if (strict) { - if (rm != RM_PMI) { + if (rm != RM_RIMP) { GECODE_ME_CHECK(b.zero(home)); } } else { @@ -103,7 +103,7 @@ namespace Gecode { namespace Set { namespace Rel { ExecStatus ReLq::propagate(Space& home, const ModEventDelta&) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return home.ES_SUBSUMED(*this); GECODE_REWRITE(*this, (Lq::post(home(*this), x0, x1))); } @@ -119,7 +119,7 @@ namespace Gecode { namespace Set { namespace Rel { return home.ES_SUBSUMED(*this); } if (strict && x1.card_max() == 0) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); return home.ES_SUBSUMED(*this); } @@ -139,7 +139,7 @@ namespace Gecode { namespace Set { namespace Rel { GECODE_ME_CHECK(b.one_none(home)); } else { // subset - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); } return home.ES_SUBSUMED(*this); @@ -154,7 +154,7 @@ namespace Gecode { namespace Set { namespace Rel { if (!d()) { if (strict && x0.card_max() == x1.card_max()) { // equal - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); } else { // subset @@ -171,7 +171,7 @@ namespace Gecode { namespace Set { namespace Rel { if (rm != RM_IMP) GECODE_ME_CHECK(b.one_none(home)); } else { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); } return home.ES_SUBSUMED(*this); @@ -184,7 +184,7 @@ namespace Gecode { namespace Set { namespace Rel { int x1umin = x1u.min(); Iter::Ranges::Diff, LubRanges> d(x0l, x1u); if (d() && d.min() < x1umin) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); return home.ES_SUBSUMED(*this); } diff --git a/gecode/set/rel/re-subset.hpp b/gecode/set/rel/re-subset.hpp index ccaa3f55aa..9a399a1e2b 100644 --- a/gecode/set/rel/re-subset.hpp +++ b/gecode/set/rel/re-subset.hpp @@ -97,7 +97,7 @@ namespace Gecode { namespace Set { namespace Rel { ExecStatus ReSubset::propagate(Space& home, const ModEventDelta&) { if (b.one()) { - if (rm == RM_PMI) + if (rm == RM_RIMP) return home.ES_SUBSUMED(*this); GECODE_REWRITE(*this, (Subset::post(home(*this), x0, x1))); } @@ -109,7 +109,7 @@ namespace Gecode { namespace Set { namespace Rel { // check whether cardinalities still allow subset if (x0.card_min() > x1.card_max()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); return home.ES_SUBSUMED(*this); } @@ -132,7 +132,7 @@ namespace Gecode { namespace Set { namespace Rel { LubRanges x1ub(x1); Iter::Ranges::Diff, LubRanges> d(x0lb, x1ub); if (d()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); return home.ES_SUBSUMED(*this); } else if (x0.assigned() && x1.assigned()) { @@ -147,7 +147,7 @@ namespace Gecode { namespace Set { namespace Rel { LubRanges x1ub(x1); Iter::Ranges::Inter, LubRanges> i(x0ub, x1ub); if (!i()) { - if (rm != RM_PMI) + if (rm != RM_RIMP) GECODE_ME_CHECK(b.zero_none(home)); return home.ES_SUBSUMED(*this); } diff --git a/gecode/support/bitset-base.hpp b/gecode/support/bitset-base.hpp index 117e0e6c1c..a610c8a19a 100644 --- a/gecode/support/bitset-base.hpp +++ b/gecode/support/bitset-base.hpp @@ -108,11 +108,12 @@ namespace Gecode { namespace Support { }; /// Status of a bitset - enum BitSetStatus { + enum class BitSetStatus { BSS_NONE, ///< No bits set BSS_ALL, ///< All bits set BSS_SOME ///< Some but not all bits set }; + using enum BitSetStatus; /// Basic bitset support (without stored size information) class RawBitSetBase { diff --git a/gecode/support/int-type.hpp b/gecode/support/int-type.hpp index f3c6624cac..0c728af96b 100644 --- a/gecode/support/int-type.hpp +++ b/gecode/support/int-type.hpp @@ -55,11 +55,12 @@ namespace Gecode { namespace Support { #endif /// Description of integer types - enum IntType { - IT_CHAR = 0, ///< char integer type - IT_SHRT = 1, ///< short integer type - IT_INT = 2 ///< integer type + enum class IntType { + IT_CHAR = 0, ///< char integer type + IT_SHORT = 1, ///< short integer type + IT_INT = 2 ///< integer type }; + using enum IntType; /// Return type required to represent \a n IntType u_type(unsigned int n); @@ -113,7 +114,7 @@ namespace Gecode { namespace Support { /// Maximal value static const signed short int max = SHRT_MAX; /// Description of type - static const IntType description = IT_SHRT; + static const IntType description = IT_SHORT; }; /// Traits for unsigned short int template <> @@ -128,7 +129,7 @@ namespace Gecode { namespace Support { /// Maximal value static const unsigned short int max = USHRT_MAX; /// Description of type - static const IntType description = IT_SHRT; + static const IntType description = IT_SHORT; }; /// Traits for signed integer template <> @@ -166,7 +167,7 @@ namespace Gecode { namespace Support { if (n < UCHAR_MAX) return IT_CHAR; else if (n < USHRT_MAX) - return IT_SHRT; + return IT_SHORT; else return IT_INT; } @@ -176,7 +177,7 @@ namespace Gecode { namespace Support { if ((n > SCHAR_MIN) && (n < SCHAR_MAX)) return IT_CHAR; else if ((n > SHRT_MIN) && (n < SHRT_MAX)) - return IT_SHRT; + return IT_SHORT; else return IT_INT; } diff --git a/test/array.cpp b/test/array.cpp index 22058860c1..7c570c2700 100644 --- a/test/array.cpp +++ b/test/array.cpp @@ -109,6 +109,12 @@ namespace Test { static_assert(std::is_trivially_copyable_v); #endif + // Scoped public enums do not convert to int. + static_assert(!std::is_convertible_v); + + // IntPropLevels keeps levels in bit-fields, so the type must be unsigned. + static_assert(std::is_unsigned_v>); + /* * A home never changes its space, and a space is copied only by * cloning, so neither is assignable. diff --git a/test/assign/set.cpp b/test/assign/set.cpp index c00532d6f0..74481d39a8 100644 --- a/test/assign/set.cpp +++ b/test/assign/set.cpp @@ -75,7 +75,7 @@ namespace Test { namespace Assign { /// Initialize test space SetOrderSpace(void) : 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_DUNION, x, zero); + Gecode::rel(*this, Gecode::SOT_DISJOINT_UNION, x, zero); } /// Constructor for cloning \a s SetOrderSpace(SetOrderSpace& s) : Gecode::Space(s) { diff --git a/test/branch/set.cpp b/test/branch/set.cpp index 80726814f1..9bd1707767 100644 --- a/test/branch/set.cpp +++ b/test/branch/set.cpp @@ -47,7 +47,7 @@ namespace Test { namespace Branch { Gecode::SetVarArgs xx(x.size() - 1); for (int i = x.size() - 1; i--;) xx[i] = x[i]; - Gecode::rel(home, Gecode::SOT_DUNION, xx, x[x.size() - 1]); + Gecode::rel(home, Gecode::SOT_DISJOINT_UNION, xx, x[x.size() - 1]); } }; diff --git a/test/flatzinc.cpp b/test/flatzinc.cpp index 5e6ccd36ec..8e70f88554 100644 --- a/test/flatzinc.cpp +++ b/test/flatzinc.cpp @@ -271,7 +271,7 @@ namespace Test { namespace FlatZinc { bool run(void) override { - return (mode({"-s"}) == Gecode::SM_STAT) && (mode({"-mode", "gist", "-s"}) == Gecode::SM_GIST) && + return (mode({"-s"}) == Gecode::SM_STATISTICS) && (mode({"-mode", "gist", "-s"}) == Gecode::SM_GIST) && (mode({"-s", "-mode", "gist"}) == Gecode::SM_GIST); } }; diff --git a/test/float.cpp b/test/float.cpp index 5c896a34af..1d1e37bce8 100644 --- a/test/float.cpp +++ b/test/float.cpp @@ -411,7 +411,7 @@ namespace Test { namespace Float { Assignment* Test::assignment(void) const { switch (assignment_type) { - case CPLT_ASSIGNMENT: + case COMPLETE_ASSIGNMENT: return new CpltAssignment(arity, dom, step); case RANDOM_ASSIGNMENT: return new RandomAssignment(arity, dom, step, _rand); @@ -656,7 +656,7 @@ namespace Test { namespace Float { } if (pmi()) { START_TEST("Assignment reified (rewrite after post, <=)"); - TestSpace* s = new TestSpace(arity, dom, step, this, RM_PMI); + TestSpace* s = new TestSpace(arity, dom, step, this, RM_RIMP); s->post(); s->rel(sol == MT_TRUE); s->assign(a, sol, false, _rand); @@ -686,7 +686,7 @@ namespace Test { namespace Float { } if (pmi()) { START_TEST("Assignment reified (immediate rewrite, <=)"); - TestSpace* s = new TestSpace(arity, dom, step, this, RM_PMI); + TestSpace* s = new TestSpace(arity, dom, step, this, RM_RIMP); s->rel(sol == MT_TRUE); s->post(); s->assign(a, sol, false, _rand); @@ -726,7 +726,7 @@ namespace Test { namespace Float { } if (pmi()) { START_TEST("Assignment reified (before posting, <=)"); - TestSpace* s = new TestSpace(arity, dom, step, this, RM_PMI); + TestSpace* s = new TestSpace(arity, dom, step, this, RM_RIMP); s->assign(a, sol, false, _rand); s->post(); CHECK_TEST(!s->failed(), "Failed"); @@ -772,7 +772,7 @@ namespace Test { namespace Float { } if (pmi()) { START_TEST("Assignment reified (after posting, <=)"); - TestSpace* s = new TestSpace(arity, dom, step, this, RM_PMI); + TestSpace* s = new TestSpace(arity, dom, step, this, RM_RIMP); s->post(); s->assign(a, sol, false, _rand); CHECK_TEST(!s->failed(), "Failed"); @@ -829,7 +829,7 @@ namespace Test { namespace Float { } if (pmi()) { START_TEST("Prune reified, <="); - TestSpace* s = new TestSpace(arity, dom, step, this, RM_PMI); + TestSpace* s = new TestSpace(arity, dom, step, this, RM_RIMP); s->post(); while (!s->failed() && !s->match_assignment(a) && (!s->assigned() || ((sol == MT_TRUE) && !s->r.var().assigned()))) diff --git a/test/float.hh b/test/float.hh index 423924d950..a9bace8420 100644 --- a/test/float.hh +++ b/test/float.hh @@ -60,17 +60,19 @@ namespace Test { namespace Float { /// Type for comparisons and solutions - enum MaybeType { + 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); /// Assignment possible types - enum AssignmentType { CPLT_ASSIGNMENT = 0, RANDOM_ASSIGNMENT, EXTEND_ASSIGNMENT }; + enum class AssignmentType { COMPLETE_ASSIGNMENT = 0, RANDOM_ASSIGNMENT, EXTEND_ASSIGNMENT }; + using enum AssignmentType; class GECODE_TESTFLOAT_EXPORT Test; diff --git a/test/float.hpp b/test/float.hpp index 1ec35200ac..816ab4c74b 100644 --- a/test/float.hpp +++ b/test/float.hpp @@ -138,21 +138,22 @@ namespace Test { namespace Float { */ forceinline bool Test::eqv(void) const { - return reified && ((rms & (1 << Gecode::RM_EQV)) != 0); + return reified && ((rms & (1 << std::to_underlying(Gecode::RM_EQV))) != 0); } forceinline bool Test::imp(void) const { - return reified && ((rms & (1 << Gecode::RM_IMP)) != 0); + return reified && ((rms & (1 << std::to_underlying(Gecode::RM_IMP))) != 0); } forceinline bool Test::pmi(void) const { - return reified && ((rms & (1 << Gecode::RM_PMI)) != 0); + 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, AssignmentType at, bool r) : Base("Float::" + s, tags), arity(a), dom(d), step(st), assignment_type(at), reified(r), - rms((1 << Gecode::RM_EQV) | (1 << Gecode::RM_IMP) | (1 << Gecode::RM_PMI)), test_search(true), - test_fixpoint(true), test_subsumption(true) {} + rms((1 << std::to_underlying(Gecode::RM_EQV)) | (1 << std::to_underlying(Gecode::RM_IMP)) | + (1 << std::to_underlying(Gecode::RM_RIMP))), + test_search(true), test_fixpoint(true), test_subsumption(true) {} inline Test::Test(const std::string& s, int a, const Gecode::FloatVal& d, Gecode::FloatNum st, AssignmentType at, bool r) @@ -161,8 +162,9 @@ namespace Test { namespace Float { inline Test::Test(TestTags tags, const std::string& s, int a, Gecode::FloatNum min, Gecode::FloatNum max, Gecode::FloatNum st, AssignmentType at, bool r) : Base("Float::" + s, tags), arity(a), dom(min, max), step(st), assignment_type(at), reified(r), - rms((1 << Gecode::RM_EQV) | (1 << Gecode::RM_IMP) | (1 << Gecode::RM_PMI)), test_search(true), - test_fixpoint(true), test_subsumption(true) {} + rms((1 << std::to_underlying(Gecode::RM_EQV)) | (1 << std::to_underlying(Gecode::RM_IMP)) | + (1 << std::to_underlying(Gecode::RM_RIMP))), + test_search(true), test_fixpoint(true), test_subsumption(true) {} inline Test::Test(const std::string& s, int a, Gecode::FloatNum min, Gecode::FloatNum max, Gecode::FloatNum st, AssignmentType at, bool r) diff --git a/test/float/arithmetic.cpp b/test/float/arithmetic.cpp index 09310c53f2..90907df7fb 100644 --- a/test/float/arithmetic.cpp +++ b/test/float/arithmetic.cpp @@ -854,7 +854,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -904,7 +904,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -951,7 +951,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -969,7 +969,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -987,7 +987,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -1005,7 +1005,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : Test(tags, "Arithmetic::Div::" + s, 3, d, st, COMPLETE_ASSIGNMENT, false) {} /// %Test whether \a x is solution MaybeType solution(const Assignment& x) const override { @@ -1055,7 +1055,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -1105,7 +1105,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -1123,7 +1123,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -1187,7 +1187,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -1214,8 +1214,8 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, - false), + : 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 @@ -1272,8 +1272,8 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, - false), + : 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 @@ -1294,8 +1294,8 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, - false), + : 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 @@ -1359,8 +1359,8 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, - false), + : 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 @@ -1381,7 +1381,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -1402,7 +1402,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -1420,7 +1420,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -1441,7 +1441,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -1459,7 +1459,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -1477,7 +1477,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -1495,7 +1495,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -1513,7 +1513,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -1534,7 +1534,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -1552,7 +1552,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -1570,7 +1570,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -1588,7 +1588,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -1605,7 +1605,8 @@ namespace Test { namespace Float { class MinNary : public Test { public: /// Create and register test - MinNary(void) : Test(TestTags::sweep(), "Arithmetic::Min::Nary", 4, -4, 4, 0.5, CPLT_ASSIGNMENT, false) {} + 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 { @@ -1630,7 +1631,7 @@ namespace Test { namespace Float { public: /// Create and register test MinNaryShared(void) - : Test(TestTags::sweep(), "Arithmetic::Min::Nary::Shared", 3, -4, 4, 0.5, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -1651,7 +1652,8 @@ namespace Test { namespace Float { class MaxNary : public Test { public: /// Create and register test - MaxNary(void) : Test(TestTags::sweep(), "Arithmetic::Max::Nary", 4, -4, 4, 0.5, CPLT_ASSIGNMENT, false) {} + 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 { @@ -1676,7 +1678,7 @@ namespace Test { namespace Float { public: /// Create and register test MaxNaryShared(void) - : Test(TestTags::sweep(), "Arithmetic::Max::Nary::Shared", 3, -4, 4, 0.5, CPLT_ASSIGNMENT, false) {} + : 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 { diff --git a/test/float/basic.cpp b/test/float/basic.cpp index 174735079b..84aa06e3e4 100644 --- a/test/float/basic.cpp +++ b/test/float/basic.cpp @@ -54,9 +54,9 @@ namespace Test { namespace Float { class Basic : public Test { public: /// Initialize test - Basic(Gecode::FloatNum n, Gecode::FloatNum s) : Test("Basic", 3, -n, n, s, CPLT_ASSIGNMENT, false) {} + 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, CPLT_ASSIGNMENT, false) {} + 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 { diff --git a/test/float/channel.cpp b/test/float/channel.cpp index 991c37475b..dbec42b2b3 100644 --- a/test/float/channel.cpp +++ b/test/float/channel.cpp @@ -45,7 +45,7 @@ namespace Test { namespace Float { class Int : public Test { public: /// Construct and register test - Int(Gecode::FloatNum st) : Test("Channel::Int", 2, -1, 2, st, CPLT_ASSIGNMENT, false) {} + 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 { @@ -67,7 +67,7 @@ namespace Test { namespace Float { class Bool : public Test { public: /// Construct and register test - Bool(Gecode::FloatNum st) : Test("Channel::Bool", 2, 0, 1, st, CPLT_ASSIGNMENT, false) {} + 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 { diff --git a/test/float/dom.cpp b/test/float/dom.cpp index f74c0e2188..c4beb3cdca 100644 --- a/test/float/dom.cpp +++ b/test/float/dom.cpp @@ -55,7 +55,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, n == 1), c(c0) { + : 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 @@ -93,7 +93,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, + : Test("Dom::Num::" + str(n) + "::" + str(min0) + "::" + str(max0), n, -3, 3, st, COMPLETE_ASSIGNMENT, n == 1), min(min0), max(max0) { test_subsumption = false; diff --git a/test/float/linear.cpp b/test/float/linear.cpp index 77b48521b5..865d6b2306 100644 --- a/test/float/linear.cpp +++ b/test/float/linear.cpp @@ -70,7 +70,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, true), + a0.size(), d, st, COMPLETE_ASSIGNMENT, true), a(a0), frt(frt0), c(c0) { using namespace Gecode; test_fixpoint = false; @@ -132,7 +132,7 @@ namespace Test { namespace Float { 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, - CPLT_ASSIGNMENT, true), + COMPLETE_ASSIGNMENT, true), a(a0), frt(frt0) { using namespace Gecode; test_fixpoint = false; @@ -231,7 +231,7 @@ namespace Test { namespace Float { 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_PMI)); + 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); } diff --git a/test/float/rel.cpp b/test/float/rel.cpp index cdb375e37b..bb194701d9 100644 --- a/test/float/rel.cpp +++ b/test/float/rel.cpp @@ -55,7 +55,8 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, n == 1), + : Test("Rel::Float::Var::XY::" + str(frt0) + "::" + str(n), n + 1, -3, 3, st, COMPLETE_ASSIGNMENT, + n == 1), frt(frt0) { test_subsumption = false; } @@ -105,7 +106,7 @@ namespace Test { namespace Float { public: /// Create and register test FloatVarXX(Gecode::FloatRelType frt0, Gecode::FloatNum st) - : Test("Rel::Float::Var::XX::" + str(frt0), 1, -3, 3, st, CPLT_ASSIGNMENT, true), frt(frt0) { + : 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 @@ -137,7 +138,7 @@ namespace Test { namespace Float { /// 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, - CPLT_ASSIGNMENT, n == 1), + COMPLETE_ASSIGNMENT, n == 1), frt(frt0), c(c0) { test_subsumption = false; } diff --git a/test/float/transcendental.cpp b/test/float/transcendental.cpp index a384c2ec15..ef93349704 100644 --- a/test/float/transcendental.cpp +++ b/test/float/transcendental.cpp @@ -60,7 +60,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false), + 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; } @@ -110,7 +110,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -160,7 +160,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -178,7 +178,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -234,7 +234,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -257,7 +257,7 @@ namespace Test { namespace Float { /// 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, - CPLT_ASSIGNMENT, false), + COMPLETE_ASSIGNMENT, false), base(_base) {} /// %Test whether \a x is solution MaybeType @@ -318,7 +318,7 @@ namespace Test { namespace Float { /// 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, - CPLT_ASSIGNMENT, false), + COMPLETE_ASSIGNMENT, false), base(_base) {} /// %Test whether \a x is solution MaybeType @@ -342,7 +342,7 @@ namespace Test { namespace Float { /// 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, - CPLT_ASSIGNMENT, false), + COMPLETE_ASSIGNMENT, false), base(_base) {} /// %Test whether \a x is solution MaybeType @@ -403,7 +403,8 @@ namespace Test { namespace Float { /// 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, CPLT_ASSIGNMENT, false), + : Test(tags, "Transcendental::Pow::N::" + str(_base) + "::XX::" + s, 1, d, st, COMPLETE_ASSIGNMENT, + false), base(_base) {} /// %Test whether \a x is solution MaybeType diff --git a/test/float/trigonometric.cpp b/test/float/trigonometric.cpp index 0c8b55cb05..27b00900b9 100644 --- a/test/float/trigonometric.cpp +++ b/test/float/trigonometric.cpp @@ -50,7 +50,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -100,7 +100,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -118,7 +118,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -168,7 +168,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -186,7 +186,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -236,7 +236,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -254,7 +254,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -310,7 +310,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -330,7 +330,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -386,7 +386,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -406,7 +406,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { @@ -456,7 +456,7 @@ namespace Test { namespace Float { 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, CPLT_ASSIGNMENT, false) {} + : 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 { diff --git a/test/int.cpp b/test/int.cpp index f36d9ac34d..4c9a6306db 100644 --- a/test/int.cpp +++ b/test/int.cpp @@ -930,7 +930,7 @@ namespace Test { namespace Int { if (pmi()) { { START_TEST("Assignment reified (rewrite after post, <=)"); - TestSpace* s = new TestSpace(arity, dom, this, RM_PMI); + TestSpace* s = new TestSpace(arity, dom, this, RM_RIMP); s->post(); s->rel(sol); s->assign(a, false, _rand); @@ -940,7 +940,7 @@ namespace Test { namespace Int { } { START_TEST("Assignment reified (rewrite failure, <=)"); - TestSpace* s = new TestSpace(arity, dom, this, RM_PMI); + TestSpace* s = new TestSpace(arity, dom, this, RM_RIMP); s->post(); s->rel(!sol); s->assign(a, false, _rand); @@ -954,7 +954,7 @@ namespace Test { namespace Int { } { START_TEST("Assignment reified (immediate rewrite, <=)"); - TestSpace* s = new TestSpace(arity, dom, this, RM_PMI); + TestSpace* s = new TestSpace(arity, dom, this, RM_RIMP); s->rel(sol); s->post(); s->assign(a, false, _rand); @@ -964,7 +964,7 @@ namespace Test { namespace Int { } { START_TEST("Assignment reified (immediate failure, <=)"); - TestSpace* s = new TestSpace(arity, dom, this, RM_PMI); + TestSpace* s = new TestSpace(arity, dom, this, RM_RIMP); s->rel(!sol); s->post(); s->assign(a, false, _rand); @@ -978,7 +978,7 @@ namespace Test { namespace Int { } { START_TEST("Assignment reified (before posting, <=)"); - TestSpace* s = new TestSpace(arity, dom, this, RM_PMI); + TestSpace* s = new TestSpace(arity, dom, this, RM_RIMP); s->assign(a, false, _rand); s->post(); CHECK_TEST(!s->failed(), "Failed"); @@ -993,7 +993,7 @@ namespace Test { namespace Int { } { START_TEST("Assignment reified (after posting, <=)"); - TestSpace* s = new TestSpace(arity, dom, this, RM_PMI); + TestSpace* s = new TestSpace(arity, dom, this, RM_RIMP); s->post(); s->assign(a, false, _rand); CHECK_TEST(!s->failed(), "Failed"); @@ -1008,7 +1008,7 @@ namespace Test { namespace Int { } { START_TEST("Assignment reified (after posting, <=, disable)"); - TestSpace* s = new TestSpace(arity, dom, this, RM_PMI); + TestSpace* s = new TestSpace(arity, dom, this, RM_RIMP); s->post(); s->disable(); s->assign(a, false, _rand); @@ -1025,7 +1025,7 @@ namespace Test { namespace Int { } { START_TEST("Prune reified, <="); - TestSpace* s = new TestSpace(arity, dom, this, RM_PMI); + TestSpace* s = new TestSpace(arity, dom, this, RM_RIMP); s->post(); while (!s->failed() && (!s->assigned() || (sol && !s->r.var().assigned()))) if (!s->prune(a, test_fixpoint, _rand)) { @@ -1045,7 +1045,7 @@ namespace Test { namespace Int { } { START_TEST("Prune reified, <=, disable"); - TestSpace* s = new TestSpace(arity, dom, this, RM_PMI); + TestSpace* s = new TestSpace(arity, dom, this, RM_RIMP); TestSpace* c = static_cast(s->clone()); s->post(); c->post(); diff --git a/test/int.hh b/test/int.hh index f2b75b43a2..19fd31ca6b 100644 --- a/test/int.hh +++ b/test/int.hh @@ -150,12 +150,13 @@ namespace Test { }; /// Level of consistency to test for - enum ConTestLevel { + 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; diff --git a/test/int.hpp b/test/int.hpp index 8a80863572..cb057b3d54 100644 --- a/test/int.hpp +++ b/test/int.hpp @@ -139,21 +139,22 @@ namespace Test { namespace Int { */ forceinline bool Test::eqv(void) const { - return reified && ((rms & (1 << Gecode::RM_EQV)) != 0); + return reified && ((rms & (1 << std::to_underlying(Gecode::RM_EQV))) != 0); } forceinline bool Test::imp(void) const { - return reified && ((rms & (1 << Gecode::RM_IMP)) != 0); + return reified && ((rms & (1 << std::to_underlying(Gecode::RM_IMP))) != 0); } forceinline bool Test::pmi(void) const { - return reified && ((rms & (1 << Gecode::RM_PMI)) != 0); + 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, Gecode::IntPropLevel i) : Base(p + s, tags), arity(a), dom(d), reified(r), - rms((1 << Gecode::RM_EQV) | (1 << Gecode::RM_IMP) | (1 << Gecode::RM_PMI)), ipl(i), - consistency_test_level(ipl == Gecode::IPL_DOM ? CTL_DOMAIN : CTL_NONE), test_search(true), + rms((1 << std::to_underlying(Gecode::RM_EQV)) | (1 << std::to_underlying(Gecode::RM_IMP)) | + (1 << std::to_underlying(Gecode::RM_RIMP))), + ipl(i), consistency_test_level(ipl == Gecode::IPL_DOM ? CTL_DOMAIN : CTL_NONE), test_search(true), test_fixpoint(true) {} inline Test::Test(const std::string& p, const std::string& s, int a, const Gecode::IntSet& d, bool r, @@ -163,8 +164,9 @@ namespace Test { namespace Int { inline Test::Test(TestTags tags, const std::string& s, int a, const Gecode::IntSet& d, bool r, Gecode::IntPropLevel i) : Base("Int::" + s, tags), arity(a), dom(d), reified(r), - rms((1 << Gecode::RM_EQV) | (1 << Gecode::RM_IMP) | (1 << Gecode::RM_PMI)), ipl(i), - consistency_test_level(ipl == Gecode::IPL_DOM ? CTL_DOMAIN : CTL_NONE), test_search(true), + rms((1 << std::to_underlying(Gecode::RM_EQV)) | (1 << std::to_underlying(Gecode::RM_IMP)) | + (1 << std::to_underlying(Gecode::RM_RIMP))), + ipl(i), consistency_test_level(ipl == Gecode::IPL_DOM ? CTL_DOMAIN : CTL_NONE), test_search(true), test_fixpoint(true) {} inline Test::Test(const std::string& s, int a, const Gecode::IntSet& d, bool r, Gecode::IntPropLevel i) @@ -173,8 +175,9 @@ namespace Test { namespace Int { inline Test::Test(TestTags tags, const std::string& p, const std::string& s, int a, int min, int max, bool r, Gecode::IntPropLevel i) : Base(p + s, tags), arity(a), dom(min, max), reified(r), - rms((1 << Gecode::RM_EQV) | (1 << Gecode::RM_IMP) | (1 << Gecode::RM_PMI)), ipl(i), - consistency_test_level(ipl == Gecode::IPL_DOM ? CTL_DOMAIN : CTL_NONE), test_search(true), + rms((1 << std::to_underlying(Gecode::RM_EQV)) | (1 << std::to_underlying(Gecode::RM_IMP)) | + (1 << std::to_underlying(Gecode::RM_RIMP))), + ipl(i), consistency_test_level(ipl == Gecode::IPL_DOM ? CTL_DOMAIN : CTL_NONE), test_search(true), test_fixpoint(true) {} inline Test::Test(const std::string& p, const std::string& s, int a, int min, int max, bool r, @@ -183,8 +186,9 @@ namespace Test { namespace Int { inline Test::Test(TestTags tags, const std::string& s, int a, int min, int max, bool r, Gecode::IntPropLevel i) : Base("Int::" + s, tags), arity(a), dom(min, max), reified(r), - rms((1 << Gecode::RM_EQV) | (1 << Gecode::RM_IMP) | (1 << Gecode::RM_PMI)), ipl(i), - consistency_test_level(ipl == Gecode::IPL_DOM ? CTL_DOMAIN : CTL_NONE), test_search(true), + rms((1 << std::to_underlying(Gecode::RM_EQV)) | (1 << std::to_underlying(Gecode::RM_IMP)) | + (1 << std::to_underlying(Gecode::RM_RIMP))), + ipl(i), consistency_test_level(ipl == Gecode::IPL_DOM ? CTL_DOMAIN : CTL_NONE), test_search(true), test_fixpoint(true) {} inline Test::Test(const std::string& s, int a, int min, int max, bool r, Gecode::IntPropLevel i) @@ -208,9 +212,9 @@ namespace Test { namespace Int { s << "Def"; break; } - if (ipl & IPL_BASIC) + if ((ipl & IPL_BASIC) != IPL_DEF) s << "+B"; - if (ipl & IPL_ADVANCED) + if ((ipl & IPL_ADVANCED) != IPL_DEF) s << "+A"; return s.str(); } diff --git a/test/int/arithmetic.cpp b/test/int/arithmetic.cpp index f65cb322a0..771372100d 100644 --- a/test/int/arithmetic.cpp +++ b/test/int/arithmetic.cpp @@ -474,7 +474,7 @@ namespace Test { namespace Int { bool run(void) override { using namespace Gecode; - for (ReifyMode rm : {RM_EQV, RM_IMP, RM_PMI}) + for (ReifyMode rm : {RM_EQV, RM_IMP, RM_RIMP}) for (int kind = 0; kind < 4; kind++) { TestSpace home; IntVar x(home, -7, 7); @@ -1929,7 +1929,7 @@ namespace Test { namespace Int { 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_PMI)); + product_mod(home, IntVarArgs({x[0], x[0]}), x[1], x[2], Reify(b, mode == 0 ? RM_IMP : RM_RIMP)); } }; diff --git a/test/int/cumulative.cpp b/test/int/cumulative.cpp index fcce063494..bdf86c6649 100644 --- a/test/int/cumulative.cpp +++ b/test/int/cumulative.cpp @@ -521,7 +521,7 @@ namespace Test { namespace Int { Gecode::TaskTypeArgs types(4); for (int i = 0; i < 4; i++) { Gecode::dom(home, x[i], 0, ends[i] - 1); - types[i] = Gecode::TT_FIXE; + types[i] = Gecode::TT_FIXED_END; } Gecode::cumulative(home, 4, types, x, ends, Gecode::IntArgs({2, 2, 2, 2}), ipl); } diff --git a/test/int/dom.cpp b/test/int/dom.cpp index 8f942e5efa..40141f9fa4 100644 --- a/test/int/dom.cpp +++ b/test/int/dom.cpp @@ -79,7 +79,7 @@ namespace Test { namespace Int { case Gecode::RM_IMP: Gecode::rel(home, Gecode::dom(x[0], -2) << r.var()); break; - case Gecode::RM_PMI: + case Gecode::RM_RIMP: Gecode::rel(home, Gecode::dom(x[0], -2) >> r.var()); break; default: @@ -124,7 +124,7 @@ namespace Test { namespace Int { case Gecode::RM_IMP: Gecode::rel(home, Gecode::dom(x[0], -2, 2) << r.var()); break; - case Gecode::RM_PMI: + case Gecode::RM_RIMP: Gecode::rel(home, Gecode::dom(x[0], -2, 2) >> r.var()); break; default: @@ -228,7 +228,7 @@ namespace Test { namespace Int { case Gecode::RM_IMP: Gecode::rel(home, Gecode::dom(x[0], d) << r.var()); break; - case Gecode::RM_PMI: + case Gecode::RM_RIMP: Gecode::rel(home, Gecode::dom(x[0], d) >> r.var()); break; default: diff --git a/test/int/inter-distance.cpp b/test/int/inter-distance.cpp index a4d925df5f..91c0aa4027 100644 --- a/test/int/inter-distance.cpp +++ b/test/int/inter-distance.cpp @@ -390,7 +390,7 @@ namespace Test { namespace Int { namespace InterDistance { (void)new Variable(1, Gecode::IPL_DEF); for (Gecode::IntPropLevel ipl : {Gecode::IPL_BASIC, Gecode::IPL_ADVANCED, Gecode::IPL_BASIC_ADVANCED}) (void)new Distance(3, 2, -3, 3, ipl); - (void)new Distance(3, 2, -3, 3, static_cast(Gecode::IPL_BND | Gecode::IPL_BASIC)); + (void)new Distance(3, 2, -3, 3, Gecode::IPL_BND | Gecode::IPL_BASIC); } } create; Posting posting; diff --git a/test/int/linear.cpp b/test/int/linear.cpp index 8735485527..31c1a7a30d 100644 --- a/test/int/linear.cpp +++ b/test/int/linear.cpp @@ -309,7 +309,7 @@ namespace Test { namespace Int { 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_PMI)); + 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); diff --git a/test/int/mm-lin.cpp b/test/int/mm-lin.cpp index c20f0ac614..cb7f01a389 100644 --- a/test/int/mm-lin.cpp +++ b/test/int/mm-lin.cpp @@ -237,7 +237,7 @@ namespace Test { namespace Int { : 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 << Gecode::RM_EQV); + rms = (1 << std::to_underlying(Gecode::RM_EQV)); } /// %Test whether \a x is solution bool @@ -329,7 +329,7 @@ namespace Test { namespace Int { : 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 << Gecode::RM_EQV); + rms = (1 << std::to_underlying(Gecode::RM_EQV)); } /// %Test whether \a x is solution bool @@ -429,7 +429,7 @@ namespace Test { namespace Int { : 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 << Gecode::RM_EQV); + rms = (1 << std::to_underlying(Gecode::RM_EQV)); } /// %Test whether \a x is solution bool diff --git a/test/ldsb.cpp b/test/ldsb.cpp index f2d7464955..251df711a6 100644 --- a/test/ldsb.cpp +++ b/test/ldsb.cpp @@ -1572,8 +1572,8 @@ namespace Test { namespace LDSB { setup(Home home, SetVarArray& xs) { Symmetries syms; syms << variable_sequence_symmetry(xs, 2); - rel(home, xs[0], SOT_INTER, xs[1], SRT_EQ, IntSet::empty); - rel(home, xs[2], SOT_INTER, xs[3], SRT_EQ, IntSet::empty); + rel(home, xs[0], SOT_INTERSECTION, xs[1], SRT_EQ, IntSet::empty); + rel(home, xs[2], SOT_INTERSECTION, xs[3], SRT_EQ, IntSet::empty); for (int i = 0; i < 4; i++) cardinality(home, xs[i], 1, 1); branch(home, xs, SET_VAR_NONE(), SET_VAL_MIN_INC(), syms); diff --git a/test/package/public-test-component/consumer-smoke.cpp b/test/package/public-test-component/consumer-smoke.cpp index c9e5bf368a..0177c41e9d 100644 --- a/test/package/public-test-component/consumer-smoke.cpp +++ b/test/package/public-test-component/consumer-smoke.cpp @@ -57,7 +57,7 @@ namespace { class FloatEqualityTest final : public ::Test::Float::Test { public: FloatEqualityTest() - : ::Test::Float::Test("Package::Equality", 2, 0.0, 1.0, 1.0, ::Test::Float::CPLT_ASSIGNMENT, false) {} + : ::Test::Float::Test("Package::Equality", 2, 0.0, 1.0, 1.0, ::Test::Float::COMPLETE_ASSIGNMENT, false) {} ::Test::Float::MaybeType solution(const ::Test::Float::Assignment& assignment) const override { diff --git a/test/public-float-smoke.cpp b/test/public-float-smoke.cpp index 5739368934..d5c07290d6 100644 --- a/test/public-float-smoke.cpp +++ b/test/public-float-smoke.cpp @@ -42,7 +42,7 @@ namespace { class FloatSmokeTest : public Test::Float::Test { public: FloatSmokeTest(void) - : ::Test::Float::Test("Public::Smoke", 1, 0.0, 1.0, 1.0, ::Test::Float::CPLT_ASSIGNMENT, false) {} + : ::Test::Float::Test("Public::Smoke", 1, 0.0, 1.0, 1.0, ::Test::Float::COMPLETE_ASSIGNMENT, false) {} ::Test::Float::MaybeType solution(const ::Test::Float::Assignment&) const override { diff --git a/test/set.cpp b/test/set.cpp index 39a9b0f7e0..881790fc89 100644 --- a/test/set.cpp +++ b/test/set.cpp @@ -219,10 +219,10 @@ namespace Test { namespace Set { case Gecode::SRT_SUP: olog << "sup"; break; - case Gecode::SRT_DISJ: + case Gecode::SRT_DISJOINT: olog << "||"; break; - case Gecode::SRT_CMPL: + case Gecode::SRT_COMPLEMENT: olog << "^-1 = "; break; } @@ -314,7 +314,7 @@ namespace Test { namespace Set { diff_v(diff); for (int j = 0; j < v; j++, ++diff_v) { } - rel(i, Gecode::SRT_DISJ, Gecode::IntSet(diff_v.val(), diff_v.val())); + rel(i, Gecode::SRT_DISJOINT, Gecode::IntSet(diff_v.val(), diff_v.val())); } void @@ -327,8 +327,8 @@ namespace Test { namespace Set { diff_v(diff); for (int j = 0; j < v; j++, ++diff_v) { } - rel(i, Gecode::SRT_DISJ, Gecode::IntSet(diff_v.val(), diff_v.val())); - c.rel(i, Gecode::SRT_DISJ, Gecode::IntSet(diff_v.val(), diff_v.val())); + rel(i, Gecode::SRT_DISJOINT, Gecode::IntSet(diff_v.val(), diff_v.val())); + c.rel(i, Gecode::SRT_DISJOINT, Gecode::IntSet(diff_v.val(), diff_v.val())); } void @@ -870,7 +870,7 @@ namespace Test { namespace Set { } START_TEST("Assignment reified (rewrite after post, <=)"); { - SetTestSpace* s = new SetTestSpace(arity, lub, with_int, this, RM_PMI); + SetTestSpace* s = new SetTestSpace(arity, lub, with_int, this, RM_RIMP); s->post(); s->rel(is_sol); s->assign(a, _rand); @@ -903,7 +903,7 @@ namespace Test { namespace Set { } { START_TEST("Assignment reified (rewrite failure, <=)"); - SetTestSpace* s = new SetTestSpace(arity, lub, with_int, this, RM_PMI); + SetTestSpace* s = new SetTestSpace(arity, lub, with_int, this, RM_RIMP); s->post(); s->rel(!is_sol); s->assign(a, _rand); @@ -937,7 +937,7 @@ namespace Test { namespace Set { } START_TEST("Assignment reified (immediate rewrite, <=)"); { - SetTestSpace* s = new SetTestSpace(arity, lub, with_int, this, RM_PMI); + SetTestSpace* s = new SetTestSpace(arity, lub, with_int, this, RM_RIMP); s->rel(is_sol); s->post(); s->assign(a, _rand); @@ -970,7 +970,7 @@ namespace Test { namespace Set { } START_TEST("Assignment reified (immediate failure, <=)"); { - SetTestSpace* s = new SetTestSpace(arity, lub, with_int, this, RM_PMI); + SetTestSpace* s = new SetTestSpace(arity, lub, with_int, this, RM_RIMP); s->rel(!is_sol); s->post(); s->assign(a, _rand); @@ -1014,7 +1014,7 @@ namespace Test { namespace Set { } START_TEST("Assignment reified (before posting, <=)"); { - SetTestSpace* s = new SetTestSpace(arity, lub, with_int, this, RM_PMI); + SetTestSpace* s = new SetTestSpace(arity, lub, with_int, this, RM_RIMP); s->assign(a, _rand); s->post(); CHECK_TEST(!s->failed(), "Failed"); @@ -1059,7 +1059,7 @@ namespace Test { namespace Set { } START_TEST("Assignment reified (after posting, <=)"); { - SetTestSpace* s = new SetTestSpace(arity, lub, with_int, this, RM_PMI); + SetTestSpace* s = new SetTestSpace(arity, lub, with_int, this, RM_RIMP); s->post(); s->assign(a, _rand); CHECK_TEST(!s->failed(), "Failed"); @@ -1108,7 +1108,7 @@ namespace Test { namespace Set { } START_TEST("Assignment reified (after posting, <=, disable)"); { - SetTestSpace* s = new SetTestSpace(arity, lub, with_int, this, RM_PMI); + SetTestSpace* s = new SetTestSpace(arity, lub, with_int, this, RM_RIMP); s->post(); s->disable(); s->assign(a, _rand); @@ -1166,7 +1166,7 @@ namespace Test { namespace Set { } START_TEST("Prune reified, <="); { - SetTestSpace* s = new SetTestSpace(arity, lub, with_int, this, RM_PMI); + SetTestSpace* s = new SetTestSpace(arity, lub, with_int, this, RM_RIMP); s->post(); while (!s->failed() && (!s->assigned() || (is_sol && !s->r.var().assigned()))) if (!s->prune(a, _rand)) { @@ -1201,11 +1201,11 @@ namespace Test { namespace Set { return false; } - const Gecode::SetRelType SetRelTypes::srts[] = {Gecode::SRT_EQ, Gecode::SRT_NQ, Gecode::SRT_SUB, - Gecode::SRT_SUP, Gecode::SRT_DISJ, Gecode::SRT_CMPL}; + const Gecode::SetRelType SetRelTypes::srts[] = {Gecode::SRT_EQ, Gecode::SRT_NQ, Gecode::SRT_SUB, + Gecode::SRT_SUP, Gecode::SRT_DISJOINT, Gecode::SRT_COMPLEMENT}; - const Gecode::SetOpType SetOpTypes::sots[] = {Gecode::SOT_UNION, Gecode::SOT_DUNION, Gecode::SOT_INTER, - Gecode::SOT_MINUS}; + const Gecode::SetOpType SetOpTypes::sots[] = {Gecode::SOT_UNION, Gecode::SOT_DISJOINT_UNION, + Gecode::SOT_INTERSECTION, Gecode::SOT_MINUS}; }} // namespace Test::Set diff --git a/test/set.hpp b/test/set.hpp index c3f305aa7a..c3027382cf 100644 --- a/test/set.hpp +++ b/test/set.hpp @@ -58,9 +58,9 @@ namespace Test { namespace Set { return "Sub"; case Gecode::SRT_SUP: return "Sup"; - case Gecode::SRT_DISJ: + case Gecode::SRT_DISJOINT: return "Disj"; - case Gecode::SRT_CMPL: + case Gecode::SRT_COMPLEMENT: return "Cmpl"; } return ""; @@ -71,9 +71,9 @@ namespace Test { namespace Set { switch (sot) { case Gecode::SOT_UNION: return "Union"; - case Gecode::SOT_DUNION: + case Gecode::SOT_DISJOINT_UNION: return "DUnion"; - case Gecode::SOT_INTER: + case Gecode::SOT_INTERSECTION: return "Inter"; case Gecode::SOT_MINUS: return "Minus"; diff --git a/test/set/distinct.cpp b/test/set/distinct.cpp index 8246291859..c330d670ea 100644 --- a/test/set/distinct.cpp +++ b/test/set/distinct.cpp @@ -90,11 +90,11 @@ namespace Test { namespace Set { void post(Space& home, SetVarArray& x, IntVarArray&) override { SetVar s1(home, IntSet::empty, -2, 2, 0U, 1U); - Gecode::rel(home, x[0], SOT_INTER, x[1], SRT_EQ, s1); + Gecode::rel(home, x[0], SOT_INTERSECTION, x[1], SRT_EQ, s1); SetVar s2(home, IntSet::empty, -2, 2, 0U, 1U); - Gecode::rel(home, x[0], SOT_INTER, x[2], SRT_EQ, s2); + Gecode::rel(home, x[0], SOT_INTERSECTION, x[2], SRT_EQ, s2); SetVar s3(home, IntSet::empty, -2, 2, 0U, 1U); - Gecode::rel(home, x[1], SOT_INTER, x[2], SRT_EQ, s3); + Gecode::rel(home, x[1], SOT_INTERSECTION, x[2], SRT_EQ, s3); Gecode::atmost_one(home, x, 3); } }; diff --git a/test/set/dom.cpp b/test/set/dom.cpp index 743e21461c..ec569cd22a 100644 --- a/test/set/dom.cpp +++ b/test/set/dom.cpp @@ -93,7 +93,7 @@ namespace Test { namespace Set { /// Create and register test DomRange(SetRelType srt0, int n) : SetTest(TestTags::sweep(), "Dom::Range::" + str(srt0) + "::" + str(n), n, ds_33, (n == 1)), srt(srt0), - is(srt == Gecode::SRT_CMPL ? ds_33c : ds_33) {} + is(srt == Gecode::SRT_COMPLEMENT ? ds_33c : ds_33) {} /// %Test whether \a x is solution bool solution(const SetAssignment& x) const override { @@ -133,12 +133,12 @@ namespace Test { namespace Set { if (!Iter::Ranges::subset(dr, xr)) return false; break; - case SRT_DISJ: { + case SRT_DISJOINT: { Gecode::Iter::Ranges::Inter inter(xr, dr); if (inter()) return false; } break; - case SRT_CMPL: { + case SRT_COMPLEMENT: { Gecode::Set::RangesCompl drc(dr); if (!Iter::Ranges::equal(xr, drc)) return false; @@ -171,7 +171,7 @@ namespace Test { namespace Set { case Gecode::RM_IMP: Gecode::rel(home, Gecode::dom(x[0], srt, is) << r.var()); break; - case Gecode::RM_PMI: + case Gecode::RM_RIMP: Gecode::rel(home, Gecode::dom(x[0], srt, is) >> r.var()); break; default: @@ -231,12 +231,12 @@ namespace Test { namespace Set { if (!(Iter::Ranges::subset(dr, xr))) return false; break; - case SRT_DISJ: { + case SRT_DISJOINT: { Gecode::Iter::Ranges::Inter inter(xr, dr); if (inter()) return false; } break; - case SRT_CMPL: { + case SRT_COMPLEMENT: { Gecode::Set::RangesCompl drc(dr); if (!Iter::Ranges::equal(xr, drc)) return false; @@ -269,7 +269,7 @@ namespace Test { namespace Set { case Gecode::RM_IMP: Gecode::rel(home, Gecode::dom(x[0], srt, -3, -1) << r.var()); break; - case Gecode::RM_PMI: + case Gecode::RM_RIMP: Gecode::rel(home, Gecode::dom(x[0], srt, -3, -1) >> r.var()); break; default: @@ -328,14 +328,14 @@ namespace Test { namespace Set { if (!(Iter::Ranges::subset(dr, xr))) return false; break; - case SRT_DISJ: { + case SRT_DISJOINT: { Gecode::Iter::Ranges::Inter inter(xr, dr); if (inter()) return false; break; } - case SRT_CMPL: { + case SRT_COMPLEMENT: { Gecode::Set::RangesCompl drc(dr); if (!Iter::Ranges::equal(xr, drc)) @@ -370,7 +370,7 @@ namespace Test { namespace Set { case Gecode::RM_IMP: Gecode::rel(home, Gecode::dom(x[0], srt, -3) << r.var()); break; - case Gecode::RM_PMI: + case Gecode::RM_RIMP: Gecode::rel(home, Gecode::dom(x[0], srt, -3) >> r.var()); break; default: @@ -391,7 +391,7 @@ namespace Test { namespace Set { DomDom(Gecode::SetRelType srt0, int n) : SetTest(srt0 == Gecode::SRT_GR ? TestTags::check() : TestTags(TestTags::sweep()), "Dom::Dom::" + str(srt0) + "::" + str(n), n, d1, (n == 1)), - srt(srt0), is(srt == Gecode::SRT_CMPL ? d1c : d1) {} + srt(srt0), is(srt == Gecode::SRT_COMPLEMENT ? d1c : d1) {} /// %Test whether \a x is solution bool solution(const SetAssignment& x) const override { @@ -431,12 +431,12 @@ namespace Test { namespace Set { if (!Iter::Ranges::subset(dr, xr)) return false; break; - case SRT_DISJ: { + case SRT_DISJOINT: { Gecode::Iter::Ranges::Inter inter(xr, dr); if (inter()) return false; } break; - case SRT_CMPL: { + case SRT_COMPLEMENT: { Gecode::Set::RangesCompl drc(dr); if (!Iter::Ranges::equal(xr, drc)) return false; @@ -497,8 +497,8 @@ namespace Test { namespace Set { DomRange _domrange_nq1(SRT_NQ, 1); DomRange _domrange_sub1(SRT_SUB, 1); DomRange _domrange_sup1(SRT_SUP, 1); - DomRange _domrange_disj1(SRT_DISJ, 1); - DomRange _domrange_cmpl1(SRT_CMPL, 1); + DomRange _domrange_disj1(SRT_DISJOINT, 1); + DomRange _domrange_cmpl1(SRT_COMPLEMENT, 1); DomRange _domrange_eq2(SRT_EQ, 2); DomRange _domrange_lq2(SRT_LQ, 2); DomRange _domrange_lt2(SRT_LT, 2); @@ -507,8 +507,8 @@ namespace Test { namespace Set { DomRange _domrange_nq2(SRT_NQ, 2); DomRange _domrange_sub2(SRT_SUB, 2); DomRange _domrange_sup2(SRT_SUP, 2); - DomRange _domrange_disj2(SRT_DISJ, 2); - DomRange _domrange_cmpl2(SRT_CMPL, 2); + DomRange _domrange_disj2(SRT_DISJOINT, 2); + DomRange _domrange_cmpl2(SRT_COMPLEMENT, 2); DomIntRange _domintrange_eq1(SRT_EQ, 1); DomIntRange _domintrange_lq1(SRT_LQ, 1); @@ -518,8 +518,8 @@ namespace Test { namespace Set { DomIntRange _domintrange_nq1(SRT_NQ, 1); DomIntRange _domintrange_sub1(SRT_SUB, 1); DomIntRange _domintrange_sup1(SRT_SUP, 1); - DomIntRange _domintrange_disj1(SRT_DISJ, 1); - DomIntRange _domintrange_cmpl1(SRT_CMPL, 1); + DomIntRange _domintrange_disj1(SRT_DISJOINT, 1); + DomIntRange _domintrange_cmpl1(SRT_COMPLEMENT, 1); DomIntRange _domintrange_eq2(SRT_EQ, 2); DomIntRange _domintrange_lq2(SRT_LQ, 2); DomIntRange _domintrange_lt2(SRT_LT, 2); @@ -528,8 +528,8 @@ namespace Test { namespace Set { DomIntRange _domintrange_nq2(SRT_NQ, 2); DomIntRange _domintrange_sub2(SRT_SUB, 2); DomIntRange _domintrange_sup2(SRT_SUP, 2); - DomIntRange _domintrange_disj2(SRT_DISJ, 2); - DomIntRange _domintrange_cmpl2(SRT_CMPL, 2); + DomIntRange _domintrange_disj2(SRT_DISJOINT, 2); + DomIntRange _domintrange_cmpl2(SRT_COMPLEMENT, 2); DomInt _domint_eq1(SRT_EQ, 1); DomInt _domint_lq1(SRT_LQ, 1); @@ -539,8 +539,8 @@ namespace Test { namespace Set { DomInt _domint_nq1(SRT_NQ, 1); DomInt _domint_sub1(SRT_SUB, 1); DomInt _domint_sup1(SRT_SUP, 1); - DomInt _domint_disj1(SRT_DISJ, 1); - DomInt _domint_cmpl1(SRT_CMPL, 1); + DomInt _domint_disj1(SRT_DISJOINT, 1); + DomInt _domint_cmpl1(SRT_COMPLEMENT, 1); DomInt _domint_eq2(SRT_EQ, 2); DomInt _domint_lq2(SRT_LQ, 2); DomInt _domint_lt2(SRT_LT, 2); @@ -549,8 +549,8 @@ namespace Test { namespace Set { DomInt _domint_nq2(SRT_NQ, 2); DomInt _domint_sub2(SRT_SUB, 2); DomInt _domint_sup2(SRT_SUP, 2); - DomInt _domint_disj2(SRT_DISJ, 2); - DomInt _domint_cmpl2(SRT_CMPL, 2); + DomInt _domint_disj2(SRT_DISJOINT, 2); + DomInt _domint_cmpl2(SRT_COMPLEMENT, 2); DomDom _domdom_eq1(SRT_EQ, 1); DomDom _domdom_lq1(SRT_LQ, 1); @@ -560,8 +560,8 @@ namespace Test { namespace Set { DomDom _domdom_nq1(SRT_NQ, 1); DomDom _domdom_sub1(SRT_SUB, 1); DomDom _domdom_sup1(SRT_SUP, 1); - DomDom _domdom_disj1(SRT_DISJ, 1); - DomDom _domdom_cmpl1(SRT_CMPL, 1); + DomDom _domdom_disj1(SRT_DISJOINT, 1); + DomDom _domdom_cmpl1(SRT_COMPLEMENT, 1); DomDom _domdom_eq2(SRT_EQ, 2); DomDom _domdom_lq2(SRT_LQ, 2); DomDom _domdom_lt2(SRT_LT, 2); @@ -570,8 +570,8 @@ namespace Test { namespace Set { DomDom _domdom_nq2(SRT_NQ, 2); DomDom _domdom_sub2(SRT_SUB, 2); DomDom _domdom_sup2(SRT_SUP, 2); - DomDom _domdom_disj2(SRT_DISJ, 2); - DomDom _domdom_cmpl2(SRT_CMPL, 2); + DomDom _domdom_disj2(SRT_DISJOINT, 2); + DomDom _domdom_cmpl2(SRT_COMPLEMENT, 2); CardRange _cr1(1); CardRange _cr2(2); diff --git a/test/set/element.cpp b/test/set/element.cpp index 5663c2b2c4..f5ba46183d 100644 --- a/test/set/element.cpp +++ b/test/set/element.cpp @@ -190,7 +190,7 @@ namespace Test { namespace Set { SetVarArgs xs(x.size() - 2); for (int i = x.size() - 2; i--;) xs[i] = x[i]; - Gecode::element(home, SOT_INTER, xs, x[x.size() - 2], x[x.size() - 1]); + Gecode::element(home, SOT_INTERSECTION, xs, x[x.size() - 2], x[x.size() - 1]); } }; ElementInter _elementinter("Element::Inter"); @@ -235,7 +235,7 @@ namespace Test { namespace Set { SetVarArgs xs(x.size() - 2); for (int i = x.size() - 2; i--;) xs[i] = x[i]; - Gecode::element(home, SOT_INTER, xs, x[x.size() - 2], x[x.size() - 1], ds_12); + Gecode::element(home, SOT_INTERSECTION, xs, x[x.size() - 2], x[x.size() - 1], ds_12); } }; ElementInterIn _elementinterin("Element::InterIn"); @@ -287,7 +287,7 @@ namespace Test { namespace Set { SetVarArgs xs(x.size() - 2); for (int i = x.size() - 2; i--;) xs[i] = x[i]; - Gecode::element(home, SOT_DUNION, xs, x[x.size() - 2], x[x.size() - 1]); + Gecode::element(home, SOT_DISJOINT_UNION, xs, x[x.size() - 2], x[x.size() - 1]); } }; ElementDisjoint _elementdisjoint("Element::Disjoint"); @@ -393,15 +393,15 @@ namespace Test { namespace Set { IntSet universe(0, 3); EmptyFixture union_x, dunion_x, inter_x; element(union_x, SOT_UNION, x, union_x.y, union_x.z); - element(dunion_x, SOT_DUNION, x, dunion_x.y, dunion_x.z); - element(inter_x, SOT_INTER, x, inter_x.y, inter_x.z, universe); + element(dunion_x, SOT_DISJOINT_UNION, x, dunion_x.y, dunion_x.z); + element(inter_x, SOT_INTERSECTION, x, inter_x.y, inter_x.z, universe); bool decided = union_x.is_solved(IntSet::empty) && dunion_x.is_solved(IntSet::empty) && inter_x.is_solved(universe); // No index can be selected, and the default universe does not fit into z EmptyFixture selected(IntSet(0, 0)), inter_default; element(selected, SOT_UNION, x, selected.y, selected.z); - element(inter_default, SOT_INTER, x, inter_default.y, inter_default.z); + element(inter_default, SOT_INTERSECTION, x, inter_default.y, inter_default.z); return decided && (selected.status() == SS_FAILED) && (inter_default.status() == SS_FAILED); } diff --git a/test/set/int.cpp b/test/set/int.cpp index cb7e368e94..0ca61c0b44 100644 --- a/test/set/int.cpp +++ b/test/set/int.cpp @@ -215,7 +215,7 @@ namespace Test { namespace Set { /// Post constraint on \a x void post(Space& home, SetVarArray& x, IntVarArray& y) override { - Gecode::rel(home, x[0], SRT_DISJ, y[0]); + Gecode::rel(home, x[0], SRT_DISJOINT, y[0]); } }; NoElem _noelem("Int::NoElem"); @@ -260,11 +260,11 @@ namespace Test { namespace Set { return Iter::Ranges::subset(xr, dr); case SRT_SUP: return Iter::Ranges::subset(dr, xr); - case SRT_DISJ: { + case SRT_DISJOINT: { Gecode::Iter::Ranges::Inter inter(xr, dr); return !inter(); } - case SRT_CMPL: { + case SRT_COMPLEMENT: { Gecode::Set::RangesCompl drc(dr); return Iter::Ranges::equal(xr, drc); } @@ -294,14 +294,14 @@ namespace Test { namespace Set { Rel _rel_nq(Gecode::SRT_NQ, false); Rel _rel_sub(Gecode::SRT_SUB, false); Rel _rel_sup(Gecode::SRT_SUP, false); - Rel _rel_disj(Gecode::SRT_DISJ, false); - Rel _rel_cmpl(Gecode::SRT_CMPL, false); + Rel _rel_disj(Gecode::SRT_DISJOINT, false); + Rel _rel_cmpl(Gecode::SRT_COMPLEMENT, false); Rel _rel_eqs(Gecode::SRT_EQ, true); Rel _rel_nqs(Gecode::SRT_NQ, true); Rel _rel_subs(Gecode::SRT_SUB, true); Rel _rel_sups(Gecode::SRT_SUP, true); - Rel _rel_disjs(Gecode::SRT_DISJ, true); - Rel _rel_cmpls(Gecode::SRT_CMPL, true); + Rel _rel_disjs(Gecode::SRT_DISJOINT, true); + Rel _rel_cmpls(Gecode::SRT_COMPLEMENT, true); /// %Test for integer relation constraint class IntRel : public SetTest { diff --git a/test/set/mm-set.cpp b/test/set/mm-set.cpp index dc3ef72756..c6a588b056 100644 --- a/test/set/mm-set.cpp +++ b/test/set/mm-set.cpp @@ -169,9 +169,9 @@ namespace Test { namespace Int { return ret <= c; case Gecode::SRT_SUP: return ret >= c; - case Gecode::SRT_DISJ: + case Gecode::SRT_DISJOINT: return ret + c != 2; - case Gecode::SRT_CMPL: + case Gecode::SRT_COMPLEMENT: return ret != c; default: GECODE_NEVER; @@ -203,10 +203,10 @@ namespace Test { namespace Int { case Gecode::SRT_SUP: Gecode::rel(home, e >= res); break; - case Gecode::SRT_DISJ: + case Gecode::SRT_DISJOINT: Gecode::rel(home, e || res); break; - case Gecode::SRT_CMPL: + case Gecode::SRT_COMPLEMENT: Gecode::rel(home, e == -res); break; default: @@ -239,10 +239,10 @@ namespace Test { namespace Int { case Gecode::SRT_SUP: irel = (e >= res); break; - case Gecode::SRT_DISJ: + case Gecode::SRT_DISJOINT: irel = (e || res); break; - case Gecode::SRT_CMPL: + case Gecode::SRT_COMPLEMENT: irel = (e == -res); break; default: @@ -255,7 +255,7 @@ namespace Test { namespace Int { case Gecode::RM_IMP: Gecode::rel(home, r.var() >> irel); break; - case Gecode::RM_PMI: + case Gecode::RM_RIMP: Gecode::rel(home, r.var() << irel); break; } @@ -304,9 +304,9 @@ namespace Test { namespace Int { return ret0 <= ret1; case Gecode::SRT_SUP: return ret0 >= ret1; - case Gecode::SRT_DISJ: + case Gecode::SRT_DISJOINT: return ret0 + ret1 != 2; - case Gecode::SRT_CMPL: + case Gecode::SRT_COMPLEMENT: return ret0 != ret1; default: GECODE_NEVER; @@ -348,10 +348,10 @@ namespace Test { namespace Int { case Gecode::SRT_SUP: Gecode::rel(home, e0 >= e1); break; - case Gecode::SRT_DISJ: + case Gecode::SRT_DISJOINT: Gecode::rel(home, e0 || e1); break; - case Gecode::SRT_CMPL: + case Gecode::SRT_COMPLEMENT: Gecode::rel(home, e0 == -e1); break; default: @@ -393,10 +393,10 @@ namespace Test { namespace Int { case Gecode::SRT_SUP: srel = (e0 >= e1); break; - case Gecode::SRT_DISJ: + case Gecode::SRT_DISJOINT: srel = (e0 || e1); break; - case Gecode::SRT_CMPL: + case Gecode::SRT_COMPLEMENT: srel = (e0 == -e1); break; default: @@ -409,7 +409,7 @@ namespace Test { namespace Int { case Gecode::RM_IMP: Gecode::rel(home, r.var() >> srel); break; - case Gecode::RM_PMI: + case Gecode::RM_RIMP: Gecode::rel(home, r.var() << srel); break; } @@ -1919,8 +1919,8 @@ namespace Test { namespace Int { (void)new SetExprConst(TestTags::sweep(), si[i], s, Gecode::SRT_SUB, 1); (void)new SetExprConst(TestTags::sweep(), si[i], s, Gecode::SRT_SUP, 0); (void)new SetExprConst(TestTags::sweep(), si[i], s, Gecode::SRT_SUP, 1); - (void)new SetExprConst(TestTags::sweep(), si[i], s, Gecode::SRT_DISJ, 0); - (void)new SetExprConst(TestTags::sweep(), si[i], s, Gecode::SRT_DISJ, 1); + (void)new SetExprConst(TestTags::sweep(), si[i], s, Gecode::SRT_DISJOINT, 0); + (void)new SetExprConst(TestTags::sweep(), si[i], s, Gecode::SRT_DISJOINT, 1); if ((i % 31) == 0) { @@ -1940,7 +1940,7 @@ namespace Test { namespace Int { (void)new SetExprExpr(TestTags::sweep(), si[i], si[j], ss, Gecode::SRT_NQ); (void)new SetExprExpr(TestTags::sweep(), si[i], si[j], ss, Gecode::SRT_SUB); (void)new SetExprExpr(TestTags::sweep(), si[i], si[j], ss, Gecode::SRT_SUP); - (void)new SetExprExpr(TestTags::sweep(), si[i], si[j], ss, Gecode::SRT_DISJ); + (void)new SetExprExpr(TestTags::sweep(), si[i], si[j], ss, Gecode::SRT_DISJOINT); } } } diff --git a/test/set/rel-op-const.cpp b/test/set/rel-op-const.cpp index 809d1909fb..6f8bb4eff7 100644 --- a/test/set/rel-op-const.cpp +++ b/test/set/rel-op-const.cpp @@ -71,11 +71,11 @@ namespace Test { namespace Set { return Iter::Ranges::subset(i, j); case SRT_SUP: return Iter::Ranges::subset(j, i); - case SRT_DISJ: { + case SRT_DISJOINT: { Gecode::Iter::Ranges::Inter inter(i, j); return !inter(); } - case SRT_CMPL: { + case SRT_COMPLEMENT: { Gecode::Set::RangesCompl jc(j); return Iter::Ranges::equal(i, jc); } @@ -104,14 +104,14 @@ namespace Test { namespace Set { Iter::Ranges::Union u(isr, xr0); return sol(u, xr1); } break; - case SOT_DUNION: { + case SOT_DISJOINT_UNION: { Iter::Ranges::Inter inter(isr, xr0); if (inter()) return false; Iter::Ranges::Union u(isr, xr0); return sol(u, xr1); } break; - case SOT_INTER: { + case SOT_INTERSECTION: { Iter::Ranges::Inter u(isr, xr0); return sol(u, xr1); } break; @@ -159,11 +159,11 @@ namespace Test { namespace Set { return Iter::Ranges::subset(i, j); case SRT_SUP: return Iter::Ranges::subset(j, i); - case SRT_DISJ: { + case SRT_DISJOINT: { Gecode::Iter::Ranges::Inter inter(i, j); return !inter(); } - case SRT_CMPL: { + case SRT_COMPLEMENT: { Gecode::Set::RangesCompl jc(j); return Iter::Ranges::equal(i, jc); } @@ -191,14 +191,14 @@ namespace Test { namespace Set { Iter::Ranges::Union u(xr0, xr1); return sol(u, isr); } break; - case SOT_DUNION: { + case SOT_DISJOINT_UNION: { Iter::Ranges::Inter inter(xr0, xr1); if (inter()) return false; Iter::Ranges::Union u(xr0, xr1); return sol(u, isr); } break; - case SOT_INTER: { + case SOT_INTERSECTION: { Iter::Ranges::Inter u(xr0, xr1); return sol(u, isr); } break; @@ -240,11 +240,11 @@ namespace Test { namespace Set { return Iter::Ranges::subset(i, j); case SRT_SUP: return Iter::Ranges::subset(j, i); - case SRT_DISJ: { + case SRT_DISJOINT: { Gecode::Iter::Ranges::Inter inter(i, j); return !inter(); } - case SRT_CMPL: { + case SRT_COMPLEMENT: { Gecode::Set::RangesCompl jc(j); return Iter::Ranges::equal(i, jc); } @@ -258,7 +258,7 @@ namespace Test { namespace Set { public: /// Create and register test RelISI(Gecode::SetOpType sot0, Gecode::SetRelType srt0, int int_set0, int int_set1, bool inverse0) - : SetTest((sot0 == Gecode::SOT_DUNION) && (srt0 == Gecode::SRT_CMPL) && (int_set0 == 0) && + : SetTest((sot0 == Gecode::SOT_DISJOINT_UNION) && (srt0 == Gecode::SRT_COMPLEMENT) && (int_set0 == 0) && (int_set1 == 0) ? TestTags::standard() : TestTags::sweep(), @@ -277,14 +277,14 @@ namespace Test { namespace Set { Iter::Ranges::Union u(isr0, xr0); return sol(u, isr1); } break; - case SOT_DUNION: { + case SOT_DISJOINT_UNION: { Iter::Ranges::Inter inter(isr0, xr0); if (inter()) return false; Iter::Ranges::Union u(isr0, xr0); return sol(u, isr1); } break; - case SOT_INTER: { + case SOT_INTERSECTION: { Iter::Ranges::Inter u(isr0, xr0); return sol(u, isr1); } break; @@ -360,7 +360,7 @@ namespace Test { namespace Set { /// Perform test bool run(void) override { - for (SetOpType op : {SOT_UNION, SOT_DUNION, SOT_INTER}) { + for (SetOpType op : {SOT_UNION, SOT_DISJOINT_UNION, SOT_INTERSECTION}) { if (!is_result_constant(op) || !is_result_constant(op)) return false; } diff --git a/test/set/rel-op.cpp b/test/set/rel-op.cpp index 7b03b8acc8..b009d8bab9 100644 --- a/test/set/rel-op.cpp +++ b/test/set/rel-op.cpp @@ -67,11 +67,11 @@ namespace Test { namespace Set { return Iter::Ranges::subset(i, j); case SRT_SUP: return Iter::Ranges::subset(j, i); - case SRT_DISJ: { + case SRT_DISJOINT: { Gecode::Iter::Ranges::Inter inter(i, j); return !inter(); } - case SRT_CMPL: { + case SRT_COMPLEMENT: { Gecode::Set::RangesCompl jc(j); return Iter::Ranges::equal(i, jc); } @@ -126,14 +126,14 @@ namespace Test { namespace Set { Iter::Ranges::Union u(xr0, xr1); return sol(u, xr2); } break; - case SOT_DUNION: { + case SOT_DISJOINT_UNION: { Iter::Ranges::Inter inter(xr0, xr1); if (inter()) return false; Iter::Ranges::Union u(xr0, xr1); return sol(u, xr2); } break; - case SOT_INTER: { + case SOT_INTERSECTION: { Iter::Ranges::Inter u(xr0, xr1); return sol(u, xr2); } break; @@ -252,7 +252,7 @@ namespace Test { namespace Set { CountableSetRanges xnr(x.lub, x[result]); switch (sot) { - case SOT_DUNION: { + case SOT_DISJOINT_UNION: { if (shared == 1 && (isrs[0]() || isrs[1]())) { delete[] isrs; return false; @@ -296,7 +296,7 @@ namespace Test { namespace Set { delete[] isrs; return eq; } - case SOT_INTER: { + case SOT_INTERSECTION: { if (with_const) { bool eq; { @@ -380,13 +380,13 @@ namespace Test { namespace Set { for (int wc = 0; wc <= 1; wc++) { for (int i = 0; i <= 3; i++) { (void)new RelN(Gecode::SOT_UNION, i, 0, wc); - (void)new RelN(Gecode::SOT_DUNION, i, 0, wc); - (void)new RelN(Gecode::SOT_INTER, i, 0, wc); + (void)new RelN(Gecode::SOT_DISJOINT_UNION, i, 0, wc); + (void)new RelN(Gecode::SOT_INTERSECTION, i, 0, wc); if (i > 0) { (void)new RelN(Gecode::SOT_UNION, 0, i, wc); - (void)new RelN(Gecode::SOT_DUNION, 0, i, wc); - (void)new RelN(Gecode::SOT_INTER, 0, i, wc); + (void)new RelN(Gecode::SOT_DISJOINT_UNION, 0, i, wc); + (void)new RelN(Gecode::SOT_INTERSECTION, 0, i, wc); } } } @@ -422,7 +422,7 @@ namespace Test { namespace Set { CountableSetRanges xnr(x.lub, x[0]); switch (sot) { - case SOT_DUNION: { + case SOT_DISJOINT_UNION: { IntSetRanges issr(iss); unsigned int card_sum = Iter::Ranges::size(issr); if (card_sum != static_cast(n)) { @@ -453,7 +453,7 @@ namespace Test { namespace Set { return Iter::Ranges::equal(issr, xnr); } } - case SOT_INTER: { + case SOT_INTERSECTION: { bool all_equal = true; for (int i = 1; i < n; i++) { if (isrs[i] != isrs[0]) { @@ -518,8 +518,8 @@ namespace Test { namespace Set { for (int wc = 0; wc <= 1; wc++) { for (int i = 0; i <= 3; i++) { (void)new RelIntN(Gecode::SOT_UNION, i, wc); - (void)new RelIntN(Gecode::SOT_DUNION, i, wc); - (void)new RelIntN(Gecode::SOT_INTER, i, wc); + (void)new RelIntN(Gecode::SOT_DISJOINT_UNION, i, wc); + (void)new RelIntN(Gecode::SOT_INTERSECTION, i, wc); } } } diff --git a/test/set/rel.cpp b/test/set/rel.cpp index e66afd2f0e..a577c063cc 100644 --- a/test/set/rel.cpp +++ b/test/set/rel.cpp @@ -59,7 +59,7 @@ namespace Test { namespace Set { public: /// Create and register test RelBin(Gecode::SetRelType srt0, bool shared0) - : SetTest((srt0 == Gecode::SRT_CMPL) && !shared0 ? TestTags::standard() : TestTags::sweep(), + : SetTest((srt0 == Gecode::SRT_COMPLEMENT) && !shared0 ? TestTags::standard() : TestTags::sweep(), "Rel::Bin::" + str(srt0) + "::S" + (shared0 ? "1" : "0"), shared0 ? 1 : 2, ds_33, true), srt(srt0), shared(shared0) {} int @@ -107,11 +107,11 @@ namespace Test { namespace Set { return Iter::Ranges::subset(xr0, xr1); case SRT_SUP: return Iter::Ranges::subset(xr1, xr0); - case SRT_DISJ: { + case SRT_DISJOINT: { Iter::Ranges::Inter inter(xr0, xr1); return !inter(); } - case SRT_CMPL: { + case SRT_COMPLEMENT: { Gecode::Set::RangesCompl rc(xr0); return Iter::Ranges::equal(rc, xr1); } @@ -174,8 +174,8 @@ namespace Test { namespace Set { RelBin _relbin_nq(Gecode::SRT_NQ, false); RelBin _relbin_sub(Gecode::SRT_SUB, false); RelBin _relbin_sup(Gecode::SRT_SUP, false); - RelBin _relbin_disj(Gecode::SRT_DISJ, false); - RelBin _relbin_cmpl(Gecode::SRT_CMPL, false); + RelBin _relbin_disj(Gecode::SRT_DISJOINT, false); + RelBin _relbin_cmpl(Gecode::SRT_COMPLEMENT, false); RelBin _relbin_shared_eq(Gecode::SRT_EQ, true); RelBin _relbin_shared_lq(Gecode::SRT_LQ, true); RelBin _relbin_shared_lt(Gecode::SRT_LT, true); @@ -184,8 +184,8 @@ namespace Test { namespace Set { RelBin _relbin_shared_nq(Gecode::SRT_NQ, true); RelBin _relbin_shared_sub(Gecode::SRT_SUB, true); RelBin _relbin_shared_sup(Gecode::SRT_SUP, true); - RelBin _relbin_shared_disj(Gecode::SRT_DISJ, true); - RelBin _relbin_shared_cmpl(Gecode::SRT_CMPL, true); + RelBin _relbin_shared_disj(Gecode::SRT_DISJOINT, true); + RelBin _relbin_shared_cmpl(Gecode::SRT_COMPLEMENT, true); ITE _ite; //@} diff --git a/test/test.cpp b/test/test.cpp index 420699a4e6..9126db86b8 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -269,11 +269,11 @@ namespace Test { if (++i == argc) goto missing; if (argv[i][0] == '^') - test_patterns.emplace_back(MT_FIRST, argv[i] + 1); + test_patterns.emplace_back(MATCH_FIRST, argv[i] + 1); else if (argv[i][0] == '-') - test_patterns.emplace_back(MT_NOT, argv[i] + 1); + test_patterns.emplace_back(MATCH_NOT, argv[i] + 1); else - test_patterns.emplace_back(MT_ANY, argv[i]); + test_patterns.emplace_back(MATCH_ANY, argv[i]); } else if (!strcmp(argv[i], "-tag")) { if (++i == argc) goto missing; @@ -310,7 +310,7 @@ namespace Test { } if (!replay.empty()) { - if (test_patterns.size() != 1 || test_patterns[0].first != MT_ANY || start_from != nullptr) { + if (test_patterns.size() != 1 || test_patterns[0].first != MATCH_ANY || start_from != nullptr) { std::cerr << "-replay requires one exact -test name." << '\n' << std::flush; exit(EXIT_FAILURE); } @@ -341,7 +341,7 @@ namespace Test { for (const auto& type_pattern : test_patterns) { const auto& type = type_pattern.first; const auto& pattern = type_pattern.second; - if (type == MT_NOT) { // Negative pattern + if (type == MATCH_NOT) { // Negative pattern if (test_name.find(pattern) != std::string::npos) { // Test matches a negative pattern, should not run return false; @@ -351,8 +351,8 @@ namespace Test { positive_patterns = true; if (!match_found) { // No match found yet, test with current pattern - if (((type == MT_ANY) && (test_name.find(pattern) != std::string::npos)) || - ((type == MT_FIRST) && (test_name.find(pattern) == 0))) + if (((type == MATCH_ANY) && (test_name.find(pattern) != std::string::npos)) || + ((type == MATCH_FIRST) && (test_name.find(pattern) == 0))) match_found = true; } } diff --git a/test/test.hh b/test/test.hh index aded89b89f..849cd4234b 100644 --- a/test/test.hh +++ b/test/test.hh @@ -86,11 +86,12 @@ namespace Test { }; /// How to match - enum MatchType { - MT_ANY, //< Positive match anywhere in string - MT_NOT, //< Negative match - MT_FIRST //< Positive match at beginning + enum class MatchType { + MATCH_ANY, //< Positive match anywhere in string + MATCH_NOT, //< Negative match + MATCH_FIRST //< Positive match at beginning }; + using enum MatchType; /// Tags for test selection enum class TestTag : unsigned int {