diff --git a/include/hpp/manipulation/graph/graph.hh b/include/hpp/manipulation/graph/graph.hh index 8bd7099df6d33b6044596f3d70fa1569937c153d..730b654560e30662e01a281176431f2fc74e33c3 100644 --- a/include/hpp/manipulation/graph/graph.hh +++ b/include/hpp/manipulation/graph/graph.hh @@ -81,6 +81,10 @@ namespace hpp { /// Select randomly outgoing edge of the given node. EdgePtr_t chooseEdge(RoadmapNodePtr_t node) const; + /// Clear the vector of constraints and complements + /// \sa registerConstraints + void clearConstraintsAndComplement(); + /// Register a triple of constraints to be inserted in nodes and edges /// \param constraint a constraint (grasp of placement) /// \param complement the complement constraint diff --git a/src/graph/graph.cc b/src/graph/graph.cc index e98c0a6b368f512e1f06d2df8d5fdbee09936350..8500e9aaf8b42cd4966fd82de8b6707a8ee879a4 100644 --- a/src/graph/graph.cc +++ b/src/graph/graph.cc @@ -56,7 +56,6 @@ namespace hpp { assert(components_.size() >= 1 && components_[0].lock() == wkPtr_.lock()); for (std::size_t i = 1; i < components_.size(); ++i) components_[i].lock()->initialize(); - constraintsAndComplements_.clear (); isInit_ = true; } @@ -153,6 +152,11 @@ namespace hpp { return stateSelector_->chooseEdge (from); } + void Graph::clearConstraintsAndComplement() + { + constraintsAndComplements_.clear(); + } + void Graph::registerConstraints (const ImplicitPtr_t& constraint, const ImplicitPtr_t& complement, diff --git a/src/problem-solver.cc b/src/problem-solver.cc index 5007cadb94bb38e14c721afaefcb69f405dae186..3f0ebbef5f51e300a6817e46bc27feafe0a742e5 100644 --- a/src/problem-solver.cc +++ b/src/problem-solver.cc @@ -221,6 +221,7 @@ namespace hpp { if (!constraintGraph_) throw std::runtime_error ("The graph is not defined."); initSteeringMethod(); + constraintGraph_->clearConstraintsAndComplement(); for (std::size_t i = 0; i < constraintsAndComplements.size(); ++i) { const ConstraintAndComplement_t& c = constraintsAndComplements[i]; constraintGraph ()->registerConstraints (c.constraint, c.complement, c.both);