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

Do not add the full valid part path when path is only partially valid.

parent 578f59bd
Branches
Tags
No related merge requests found
...@@ -209,18 +209,29 @@ namespace hpp { ...@@ -209,18 +209,29 @@ namespace hpp {
} else projPath = path; } else projPath = path;
GraphPathValidationPtr_t pathValidation (problem_.pathValidation ()); GraphPathValidationPtr_t pathValidation (problem_.pathValidation ());
PathValidationReportPtr_t report; PathValidationReportPtr_t report;
core::PathPtr_t fullValidPath;
HPP_START_TIMECOUNTER (validatePath); HPP_START_TIMECOUNTER (validatePath);
bool fullyValid = false;
try { try {
pathValidation->validate (projPath, false, validPath, report); fullyValid = pathValidation->validate
(projPath, false, fullValidPath, report);
} catch (const core::projection_error& e) { } catch (const core::projection_error& e) {
hppDout (error, e.what ()); hppDout (error, e.what ());
addFailure (PATH_VALIDATION, edge); addFailure (PATH_VALIDATION, edge);
return false; return false;
} }
HPP_STOP_TIMECOUNTER (validatePath); HPP_STOP_TIMECOUNTER (validatePath);
if (validPath->length () == 0) if (fullValidPath->length () == 0) {
addFailure (PATH_VALIDATION, edge); addFailure (PATH_VALIDATION, edge);
else { validPath = fullValidPath;
} else {
if (fullyValid) validPath = fullValidPath;
else {
const value_type& length = fullValidPath->length();
const value_type& t_init = fullValidPath->timeRange ().first;
validPath = fullValidPath->extract
(core::interval_t(t_init, t_init + length * 0.5));
}
extendStatistics_.addSuccess (); extendStatistics_.addSuccess ();
hppDout (info, "Extension:" << std::endl hppDout (info, "Extension:" << std::endl
<< extendStatistics_); << extendStatistics_);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment