fix part of oscillation

This commit is contained in:
Leijurv 2018-09-01 11:19:42 -07:00
parent 791eb886c0
commit 3c25e2b685
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
1 changed files with 3 additions and 0 deletions

View File

@ -169,6 +169,9 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
for (int i = 0; i < bestSoFar.length; i++) {
double heuristic = neighbor.estimatedCostToGoal + neighbor.cost / COEFFICIENTS[i];
if (heuristic < bestHeuristicSoFar[i]) {
if (bestHeuristicSoFar[i] - heuristic < 0.01 && minimumImprovementRepropagation) {
continue;
}
bestHeuristicSoFar[i] = heuristic;
bestSoFar[i] = neighbor;
}