small open set change
This commit is contained in:
parent
cebdd76ca7
commit
95cda79ef1
@ -21,7 +21,6 @@ import baritone.Baritone;
|
|||||||
import baritone.chunk.CachedWorld;
|
import baritone.chunk.CachedWorld;
|
||||||
import baritone.chunk.WorldProvider;
|
import baritone.chunk.WorldProvider;
|
||||||
import baritone.pathing.calc.openset.BinaryHeapOpenSet;
|
import baritone.pathing.calc.openset.BinaryHeapOpenSet;
|
||||||
import baritone.pathing.calc.openset.IOpenSet;
|
|
||||||
import baritone.pathing.goals.Goal;
|
import baritone.pathing.goals.Goal;
|
||||||
import baritone.pathing.movement.ActionCosts;
|
import baritone.pathing.movement.ActionCosts;
|
||||||
import baritone.pathing.movement.CalculationContext;
|
import baritone.pathing.movement.CalculationContext;
|
||||||
@ -60,7 +59,7 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
|
|||||||
startNode = getNodeAtPosition(start);
|
startNode = getNodeAtPosition(start);
|
||||||
startNode.cost = 0;
|
startNode.cost = 0;
|
||||||
startNode.combinedCost = startNode.estimatedCostToGoal;
|
startNode.combinedCost = startNode.estimatedCostToGoal;
|
||||||
IOpenSet openSet = new BinaryHeapOpenSet();
|
BinaryHeapOpenSet openSet = new BinaryHeapOpenSet();
|
||||||
openSet.insert(startNode);
|
openSet.insert(startNode);
|
||||||
startNode.isOpen = true;
|
startNode.isOpen = true;
|
||||||
bestSoFar = new PathNode[COEFFICIENTS.length];//keep track of the best node by the metric of (estimatedCostToGoal + cost / COEFFICIENTS[i])
|
bestSoFar = new PathNode[COEFFICIENTS.length];//keep track of the best node by the metric of (estimatedCostToGoal + cost / COEFFICIENTS[i])
|
||||||
@ -182,7 +181,7 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
|
|||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
System.out.println(numMovementsConsidered + " movements considered");
|
System.out.println(numMovementsConsidered + " movements considered");
|
||||||
System.out.println("Open set size: " + ((BinaryHeapOpenSet) openSet).size());
|
System.out.println("Open set size: " + openSet.size());
|
||||||
System.out.println((int) (numNodes * 1.0 / ((System.currentTimeMillis() - startTime) / 1000F)) + " nodes per second");
|
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++) {
|
||||||
|
@ -26,7 +26,7 @@ import java.util.Arrays;
|
|||||||
*
|
*
|
||||||
* @author leijurv
|
* @author leijurv
|
||||||
*/
|
*/
|
||||||
public class BinaryHeapOpenSet implements IOpenSet {
|
public final class BinaryHeapOpenSet implements IOpenSet {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The initial capacity of the heap (2^10)
|
* The initial capacity of the heap (2^10)
|
||||||
|
@ -22,10 +22,11 @@ import baritone.pathing.calc.PathNode;
|
|||||||
/**
|
/**
|
||||||
* A linked list implementation of an open set. This is the original implementation from MineBot.
|
* A linked list implementation of an open set. This is the original implementation from MineBot.
|
||||||
* It has incredibly fast insert performance, at the cost of O(n) removeLowest.
|
* It has incredibly fast insert performance, at the cost of O(n) removeLowest.
|
||||||
|
* It sucks. BinaryHeapOpenSet results in more than 10x more nodes considered in 4 seconds.
|
||||||
*
|
*
|
||||||
* @author leijurv
|
* @author leijurv
|
||||||
*/
|
*/
|
||||||
public class LinkedListOpenSet implements IOpenSet {
|
class LinkedListOpenSet implements IOpenSet {
|
||||||
private Node first = null;
|
private Node first = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user