diff --git a/gtsam_unstable/discrete/AllDiff.cpp b/gtsam_unstable/discrete/AllDiff.cpp index bff524bc2..cf598b3f4 100644 --- a/gtsam_unstable/discrete/AllDiff.cpp +++ b/gtsam_unstable/discrete/AllDiff.cpp @@ -10,6 +10,7 @@ #include #include +#include namespace gtsam { @@ -64,7 +65,7 @@ bool AllDiff::ensureArcConsistency(Key j, Domains* domains) const { // a value in domains->at(j) that does not occur in any other connected domain. // If found, we make this a singleton... // TODO: make a new constraint where this really is true - boost::optional maybeChanged = Dj.checkAllDiff(keys_, *domains); + std::optional maybeChanged = Dj.checkAllDiff(keys_, *domains); if (maybeChanged) { Dj = *maybeChanged; return true; diff --git a/gtsam_unstable/discrete/Domain.cpp b/gtsam_unstable/discrete/Domain.cpp index cf0da42e7..f2b7d9f95 100644 --- a/gtsam_unstable/discrete/Domain.cpp +++ b/gtsam_unstable/discrete/Domain.cpp @@ -61,7 +61,7 @@ bool Domain::ensureArcConsistency(Key j, Domains* domains) const { } /* ************************************************************************* */ -boost::optional Domain::checkAllDiff(const KeyVector keys, +std::optional Domain::checkAllDiff(const KeyVector keys, const Domains& domains) const { Key j = key(); // for all values in this domain @@ -74,7 +74,7 @@ boost::optional Domain::checkAllDiff(const KeyVector keys, return Domain(this->discreteKey(), value); found:; } - return boost::none; // we did not change it + return {}; // we did not change it } /* ************************************************************************* */ diff --git a/gtsam_unstable/discrete/Domain.h b/gtsam_unstable/discrete/Domain.h index 1047101c5..5d96f0dc9 100644 --- a/gtsam_unstable/discrete/Domain.h +++ b/gtsam_unstable/discrete/Domain.h @@ -9,6 +9,7 @@ #include #include +#include namespace gtsam { @@ -100,7 +101,7 @@ class GTSAM_UNSTABLE_EXPORT Domain : public Constraint { * @param keys connected domains through alldiff * @param keys other domains */ - boost::optional checkAllDiff(const KeyVector keys, + std::optional checkAllDiff(const KeyVector keys, const Domains& domains) const; /// Partially apply known values diff --git a/gtsam_unstable/discrete/Scheduler.cpp b/gtsam_unstable/discrete/Scheduler.cpp index b86df6c29..9543ab7cf 100644 --- a/gtsam_unstable/discrete/Scheduler.cpp +++ b/gtsam_unstable/discrete/Scheduler.cpp @@ -79,7 +79,7 @@ void Scheduler::addStudent(const string& studentName, const string& area1, /** get key for student and area, 0 is time slot itself */ const DiscreteKey& Scheduler::key(size_t s, - boost::optional area) const { + std::optional area) const { return area ? students_[s].keys_[*area] : students_[s].key_; } @@ -100,7 +100,7 @@ const string& Scheduler::studentArea(size_t i, size_t area) const { /** Add student-specific constraints to the graph */ void Scheduler::addStudentSpecificConstraints(size_t i, - boost::optional slot) { + std::optional slot) { bool debug = ISDEBUG("Scheduler::buildGraph"); assert(i < nrStudents()); diff --git a/gtsam_unstable/discrete/Scheduler.h b/gtsam_unstable/discrete/Scheduler.h index 8d269e81a..f7b45d54a 100644 --- a/gtsam_unstable/discrete/Scheduler.h +++ b/gtsam_unstable/discrete/Scheduler.h @@ -108,7 +108,7 @@ class GTSAM_UNSTABLE_EXPORT Scheduler : public CSP { /** get key for student and area, 0 is time slot itself */ const DiscreteKey& key(size_t s, - boost::optional area = boost::none) const; + std::optional area = {}) const; /** addStudent has to be called after adding slots and faculty */ void addStudent(const std::string& studentName, const std::string& area1, @@ -124,7 +124,7 @@ class GTSAM_UNSTABLE_EXPORT Scheduler : public CSP { /** Add student-specific constraints to the graph */ void addStudentSpecificConstraints( - size_t i, boost::optional slot = boost::none); + size_t i, std::optional slot = {}); /** Main routine that builds factor graph */ void buildGraph(size_t mutexBound = 7);