more debug info

This commit is contained in:
Leijurv 2018-08-28 16:15:24 -07:00
parent 340b1558e4
commit 23cbef102d
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 9 additions and 1 deletions

View File

@ -75,6 +75,7 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
long timeoutTime = startTime + (slowPath ? Baritone.settings().slowPathTimeoutMS : Baritone.settings().pathTimeoutMS).<Long>get(); long timeoutTime = startTime + (slowPath ? Baritone.settings().slowPathTimeoutMS : Baritone.settings().pathTimeoutMS).<Long>get();
long lastPrintout = 0; long lastPrintout = 0;
int numNodes = 0; int numNodes = 0;
int numMovementsConsidered = 0;
int numEmptyChunk = 0; int numEmptyChunk = 0;
boolean favoring = favoredPositions.isPresent(); boolean favoring = favoredPositions.isPresent();
int pathingMaxChunkBorderFetch = Baritone.settings().pathingMaxChunkBorderFetch.get(); // grab all settings beforehand so that changing settings during pathing doesn't cause a crash or unpredictable behavior int pathingMaxChunkBorderFetch = Baritone.settings().pathingMaxChunkBorderFetch.get(); // grab all settings beforehand so that changing settings during pathing doesn't cause a crash or unpredictable behavior
@ -125,6 +126,7 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
double actionCost = movementToGetToNeighbor.getCost(calcContext); double actionCost = movementToGetToNeighbor.getCost(calcContext);
//long costEnd = System.nanoTime(); //long costEnd = System.nanoTime();
//System.out.println(movementToGetToNeighbor.getClass() + "" + (costEnd - costStart)); //System.out.println(movementToGetToNeighbor.getClass() + "" + (costEnd - costStart));
numMovementsConsidered++;
if (actionCost >= ActionCosts.COST_INF) { if (actionCost >= ActionCosts.COST_INF) {
continue; continue;
} }
@ -173,6 +175,9 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
currentlyRunning = null; currentlyRunning = null;
return Optional.empty(); return Optional.empty();
} }
System.out.println(numMovementsConsidered + " movements considered");
System.out.println("Open set size: " + ((BinaryHeapOpenSet) openSet).size());
System.out.println((int) (numNodes * 1.0 / ((System.currentTimeMillis() - startTime) / 1000F)) + " nodes per second");
double bestDist = 0; double bestDist = 0;
for (int i = 0; i < bestSoFar.length; i++) { for (int i = 0; i < bestSoFar.length; i++) {
if (bestSoFar[i] == null) { if (bestSoFar[i] == null) {
@ -183,7 +188,6 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
bestDist = dist; bestDist = dist;
} }
if (dist > MIN_DIST_PATH * MIN_DIST_PATH) { // square the comparison since distFromStartSq is squared if (dist > MIN_DIST_PATH * MIN_DIST_PATH) { // square the comparison since distFromStartSq is squared
System.out.println((int) (numNodes * 1.0 / ((System.currentTimeMillis() - startTime) / 1000F)) + " nodes per second");
displayChatMessageRaw("Took " + (System.currentTimeMillis() - startTime) + "ms, A* cost coefficient " + COEFFICIENTS[i]); displayChatMessageRaw("Took " + (System.currentTimeMillis() - startTime) + "ms, A* cost coefficient " + COEFFICIENTS[i]);
if (COEFFICIENTS[i] >= 3) { if (COEFFICIENTS[i] >= 3) {
System.out.println("Warning: cost coefficient is greater than three! Probably means that"); System.out.println("Warning: cost coefficient is greater than three! Probably means that");

View File

@ -52,6 +52,10 @@ public class BinaryHeapOpenSet implements IOpenSet {
this.array = new PathNode[size]; this.array = new PathNode[size];
} }
public int size() {
return size;
}
@Override @Override
public final void insert(PathNode value) { public final void insert(PathNode value) {
if (size >= array.length - 1) { if (size >= array.length - 1) {