Try to fix another warning
parent
5714c56bab
commit
9d7caa77fe
|
@ -462,15 +462,17 @@ namespace gtsam {
|
|||
// cannot just create a root Choice node on the label: if the label is not the
|
||||
// highest label, we need to do a complicated and expensive recursive call.
|
||||
template<typename L, typename Y> template<typename Iterator>
|
||||
typename DecisionTree<L, Y>::NodePtr DecisionTree<L, Y>::compose(
|
||||
Iterator begin, Iterator end, const L& label) const {
|
||||
typename DecisionTree<L, Y>::NodePtr DecisionTree<L, Y>::compose(Iterator begin,
|
||||
Iterator end, const L& label) const {
|
||||
|
||||
// find highest label among branches
|
||||
boost::optional<L> highestLabel;
|
||||
boost::optional<size_t> nrChoices;
|
||||
for (Iterator it = begin; it != end; it++) {
|
||||
if (it->root_->isLeaf()) continue;
|
||||
boost::shared_ptr<const Choice> c = boost::dynamic_pointer_cast<const Choice> (it->root_);
|
||||
if (it->root_->isLeaf())
|
||||
continue;
|
||||
boost::shared_ptr<const Choice> c =
|
||||
boost::dynamic_pointer_cast<const Choice>(it->root_);
|
||||
if (!highestLabel || c->label() > *highestLabel) {
|
||||
highestLabel.reset(c->label());
|
||||
nrChoices.reset(c->nrChoices());
|
||||
|
@ -483,10 +485,10 @@ namespace gtsam {
|
|||
for (Iterator it = begin; it != end; it++)
|
||||
choiceOnLabel->push_back(it->root_);
|
||||
return Choice::Unique(choiceOnLabel);
|
||||
}
|
||||
|
||||
} else {
|
||||
// Set up a new choice on the highest label
|
||||
boost::shared_ptr<Choice> choiceOnHighestLabel(new Choice(*highestLabel, *nrChoices));
|
||||
boost::shared_ptr<Choice> choiceOnHighestLabel(
|
||||
new Choice(*highestLabel, *nrChoices));
|
||||
// now, for all possible values of highestLabel
|
||||
for (size_t index = 0; index < *nrChoices; index++) {
|
||||
// make a new set of functions for composing by iterating over the given
|
||||
|
@ -503,6 +505,7 @@ namespace gtsam {
|
|||
}
|
||||
return Choice::Unique(choiceOnHighestLabel);
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************************/
|
||||
// "create" is a bit of a complicated thing, but very useful.
|
||||
|
@ -667,8 +670,9 @@ namespace gtsam {
|
|||
void DecisionTree<L, Y>::dot(const std::string& name, bool showZero) const {
|
||||
std::ofstream os((name + ".dot").c_str());
|
||||
dot(os, showZero);
|
||||
system(
|
||||
int result = system(
|
||||
("dot -Tpdf " + name + ".dot -o " + name + ".pdf >& /dev/null").c_str());
|
||||
if (result==-1) throw std::runtime_error("DecisionTree::dot system call failed");
|
||||
}
|
||||
|
||||
/*********************************************************************************/
|
||||
|
|
Loading…
Reference in New Issue