Skip to content
Snippets Groups Projects
Commit c1d890ec authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Add Edge::setShort

parent fba9c2a7
No related branches found
No related tags found
No related merge requests found
......@@ -116,6 +116,10 @@ namespace hpp {
/// \return The initialized projector.
ConstraintSetPtr_t configConstraint() const;
void setShort (bool isShort) {
isShort_ = isShort;
}
protected:
/// Initialization of the object.
void init (const EdgeWkPtr_t& weak, const GraphWkPtr_t& graph, const NodeWkPtr_t& from,
......@@ -136,6 +140,8 @@ namespace hpp {
/// Print the object in a stream.
virtual std::ostream& print (std::ostream& os) const;
bool isShort_;
private:
typedef Cache < ConstraintSetPtr_t > Constraint_t;
......
......@@ -34,7 +34,8 @@ namespace hpp {
namespace graph {
Edge::Edge (const std::string& name,
const core::SteeringMethodPtr_t& steeringMethod) :
GraphComponent (name), pathConstraints_ (new Constraint_t()),
GraphComponent (name), isShort_ (false),
pathConstraints_ (new Constraint_t()),
configConstraints_ (new Constraint_t()),
steeringMethod_ (steeringMethod->copy ())
{}
......@@ -275,10 +276,8 @@ namespace hpp {
ConstraintSetPtr_t c = configConstraint ();
ConfigProjectorPtr_t proj = c->configProjector ();
proj->rightHandSideFromConfig (qoffset);
if (c->apply (q)) {
return true;
}
assert (proj);
if (isShort_) q = qoffset;
if (c->apply (q)) return true;
::hpp::statistics::SuccessStatistics& ss = proj->statistics ();
if (ss.nbFailure () > ss.nbSuccess ()) {
hppDout (warning, c->name () << " fails often." << std::endl << ss);
......@@ -478,8 +477,8 @@ namespace hpp {
cp->updateRightHandSide ();
// Eventually, do the projection.
if (cs->apply (q))
return true;
if (isShort_) q = q_offset;
if (cs->apply (q)) return true;
::hpp::statistics::SuccessStatistics& ss = cp->statistics ();
if (ss.nbFailure () > ss.nbSuccess ()) {
hppDout (warning, cs->name () << " fails often." << std::endl << ss);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment