Skip to content

Commit bb59d16

Browse files
[Edge] In method build, do not throw
if starting configuration slightly violates the constraint. Return false instead.
1 parent c294a5d commit bb59d16

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/graph/edge.cc

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -358,12 +358,20 @@ namespace hpp {
358358
return false;
359359
}
360360
} else {
361-
std::ostringstream oss;
362-
oss << "The initial configuration " << displayConfig (q1)
363-
<< " does not satisfy the constraints of"
364-
" edge " << name () << "." << std::endl;
365-
oss << "The graph is probably malformed";
366-
throw std::runtime_error (oss.str ().c_str ());
361+
value_type th(constraints->configProjector()->errorThreshold());
362+
if (!constraints->configProjector()->isSatisfied
363+
(q1, 2*th))
364+
{
365+
std::ostringstream oss;
366+
oss << "The initial configuration " << displayConfig (q1)
367+
<< " does not satisfy the constraints of"
368+
" edge " << name () << "." << std::endl;
369+
oss << "The graph is probably malformed";
370+
throw std::runtime_error (oss.str ().c_str ());
371+
}
372+
// q1 may slightly violate the edge constraint eventhough the graph
373+
// is well constructed.
374+
return false;
367375
}
368376
}
369377

0 commit comments

Comments
 (0)