Removed boost headers in DecisionTree-inl.h that are no longer needed.

release/4.3a0
Frank Dellaert 2023-01-07 10:19:52 -08:00
parent 2fe4c83680
commit c4fb764299
4 changed files with 7 additions and 16 deletions

View File

@ -22,14 +22,10 @@
#include <gtsam/discrete/DecisionTree.h> #include <gtsam/discrete/DecisionTree.h>
#include <algorithm> #include <algorithm>
#include <boost/assign/std/vector.hpp>
#include <boost/format.hpp> #include <boost/format.hpp>
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
#include <boost/noncopyable.hpp>
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/type_traits/has_dereference.hpp>
#include <boost/unordered_set.hpp>
#include <cmath> #include <cmath>
#include <fstream> #include <fstream>
#include <list> #include <list>
@ -41,8 +37,6 @@
namespace gtsam { namespace gtsam {
using boost::assign::operator+=;
/****************************************************************************/ /****************************************************************************/
// Node // Node
/****************************************************************************/ /****************************************************************************/
@ -535,8 +529,7 @@ namespace gtsam {
template<typename L, typename Y> template<typename L, typename Y>
DecisionTree<L, Y>::DecisionTree(const L& label, DecisionTree<L, Y>::DecisionTree(const L& label,
const DecisionTree& f0, const DecisionTree& f1) { const DecisionTree& f0, const DecisionTree& f1) {
std::vector<DecisionTree> functions; const std::vector<DecisionTree> functions{f0, f1};
functions += f0, f1;
root_ = compose(functions.begin(), functions.end(), label); root_ = compose(functions.begin(), functions.end(), label);
} }

View File

@ -37,8 +37,7 @@ double Domain::operator()(const DiscreteValues& values) const {
/* ************************************************************************* */ /* ************************************************************************* */
DecisionTreeFactor Domain::toDecisionTreeFactor() const { DecisionTreeFactor Domain::toDecisionTreeFactor() const {
DiscreteKeys keys; const DiscreteKeys keys{DiscreteKey(key(), cardinality_)};
keys += DiscreteKey(key(), cardinality_);
vector<double> table; vector<double> table;
for (size_t i1 = 0; i1 < cardinality_; ++i1) table.push_back(contains(i1)); for (size_t i1 = 0; i1 < cardinality_; ++i1) table.push_back(contains(i1));
DecisionTreeFactor converted(keys, table); DecisionTreeFactor converted(keys, table);

View File

@ -29,8 +29,7 @@ double SingleValue::operator()(const DiscreteValues& values) const {
/* ************************************************************************* */ /* ************************************************************************* */
DecisionTreeFactor SingleValue::toDecisionTreeFactor() const { DecisionTreeFactor SingleValue::toDecisionTreeFactor() const {
DiscreteKeys keys; const DiscreteKeys keys{DiscreteKey(keys_[0], cardinality_)};
keys += DiscreteKey(keys_[0], cardinality_);
vector<double> table; vector<double> table;
for (size_t i1 = 0; i1 < cardinality_; i1++) table.push_back(i1 == value_); for (size_t i1 = 0; i1 < cardinality_; i1++) table.push_back(i1 == value_);
DecisionTreeFactor converted(keys, table); DecisionTreeFactor converted(keys, table);

View File

@ -58,14 +58,14 @@ class Sudoku : public CSP {
// add row constraints // add row constraints
for (size_t i = 0; i < n; i++) { for (size_t i = 0; i < n; i++) {
DiscreteKeys dkeys; DiscreteKeys dkeys;
for (size_t j = 0; j < n; j++) dkeys += dkey(i, j); for (size_t j = 0; j < n; j++) dkeys.push_back(dkey(i, j));
addAllDiff(dkeys); addAllDiff(dkeys);
} }
// add col constraints // add col constraints
for (size_t j = 0; j < n; j++) { for (size_t j = 0; j < n; j++) {
DiscreteKeys dkeys; DiscreteKeys dkeys;
for (size_t i = 0; i < n; i++) dkeys += dkey(i, j); for (size_t i = 0; i < n; i++) dkeys.push_back(dkey(i, j));
addAllDiff(dkeys); addAllDiff(dkeys);
} }
@ -77,7 +77,7 @@ class Sudoku : public CSP {
// Box I,J // Box I,J
DiscreteKeys dkeys; DiscreteKeys dkeys;
for (size_t i = i0; i < i0 + N; i++) for (size_t i = i0; i < i0 + N; i++)
for (size_t j = j0; j < j0 + N; j++) dkeys += dkey(i, j); for (size_t j = j0; j < j0 + N; j++) dkeys.push_back(dkey(i, j));
addAllDiff(dkeys); addAllDiff(dkeys);
j0 += N; j0 += N;
} }