Commit b9f435ad authored by florent's avatar florent Committed by florent
Browse files

Finish ChppProblem::solve() reimplemetation.

	* src/hppProblem.cpp: The function has been split into
	smaller functions. If the user has requested that path
	with only one direct path should be optimized, they will
	now be optimized.
parent 2fae7321
......@@ -450,8 +450,18 @@ ktStatus ChppProblem::solve()
double penetration = roadmapBuilder()->penetration();
/*
Optimize if
- there is a path optimizer and
- the path has more than one direct path or the user has requested
that optimization is always performed.
*/
bool shouldOptimize =
pathOptimizer() && (attAlwaysOptimize ||
solutionPath->countDirectPaths() > 1);
// optimizer for the path
if (pathOptimizer()) {
if (shouldOptimize) {
if (pathOptimizer()->optimizePath(solutionPath, penetration)
== KD_OK) {
......@@ -460,20 +470,21 @@ ktStatus ChppProblem::solve()
}
else {
ODEBUG1(":solve: path optimization failed.");
return KD_ERROR;
}
} else {
ODEBUG1(":solve: no Optimizer Defined ");
ODEBUG2(":solve: no optimization performed ");
return KD_OK;
}
if (solutionPath) {
ODEBUG2(":solve: number of direct path: "
<< solutionPath->countDirectPaths());
// Add the path to vector of paths of the problem.
addPath(KIT_DYNAMIC_PTR_CAST(CkwsPath, solutionPath->clone()));
addPath(solutionPath);
}
return KD_OK ;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment