refactor addCost->computeCost

This commit is contained in:
v4hn 2020-07-16 16:14:51 +02:00
parent d2bd0a0037
commit 1f8feaaf0a
2 changed files with 6 additions and 6 deletions

View File

@ -158,7 +158,7 @@ public:
* *
* @return true if solution remains feasible (is no failure) * @return true if solution remains feasible (is no failure)
*/ */
bool addCost(SolutionBase& solution); bool computeCost(SolutionBase& solution);
protected: protected:
// associated/owning Stage instance // associated/owning Stage instance

View File

@ -156,7 +156,7 @@ void StagePrivate::sendForward(const InterfaceState& from, InterfaceState&& to,
solution->setStartState(from); solution->setStartState(from);
solution->setEndState(*to_it); solution->setEndState(*to_it);
if (!solution->isFailure() && addCost(*solution)) { if (!solution->isFailure() && computeCost(*solution)) {
nextStarts()->add(*to_it); nextStarts()->add(*to_it);
} }
@ -174,7 +174,7 @@ void StagePrivate::sendBackward(InterfaceState&& from, const InterfaceState& to,
solution->setStartState(*from_it); solution->setStartState(*from_it);
solution->setEndState(to); solution->setEndState(to);
if (!solution->isFailure() && addCost(*solution)) if (!solution->isFailure() && computeCost(*solution))
prevEnds()->add(*from_it); prevEnds()->add(*from_it);
newSolution(solution); newSolution(solution);
@ -191,7 +191,7 @@ void StagePrivate::spawn(InterfaceState&& state, const SolutionBasePtr& solution
solution->setStartState(*from); solution->setStartState(*from);
solution->setEndState(*to); solution->setEndState(*to);
if (!solution->isFailure() && addCost(*solution)) { if (!solution->isFailure() && computeCost(*solution)) {
prevEnds()->add(*from); prevEnds()->add(*from);
nextStarts()->add(*to); nextStarts()->add(*to);
} }
@ -207,7 +207,7 @@ void StagePrivate::connect(const InterfaceState& from, const InterfaceState& to,
solution->setEndState(to); solution->setEndState(to);
if (!solution->isFailure()) if (!solution->isFailure())
addCost(*solution); computeCost(*solution);
newSolution(solution); newSolution(solution);
} }
@ -221,7 +221,7 @@ void StagePrivate::newSolution(const SolutionBasePtr& solution) {
parent()->onNewSolution(*solution); parent()->onNewSolution(*solution);
} }
bool StagePrivate::addCost(SolutionBase& solution) { bool StagePrivate::computeCost(SolutionBase& solution) {
double cost{ 0.0 }; double cost{ 0.0 };
auto* trajectory{ dynamic_cast<const SubTrajectory*>(&solution) }; auto* trajectory{ dynamic_cast<const SubTrajectory*>(&solution) };