From ecbd95483ba77740160e89aa258964e503944132 Mon Sep 17 00:00:00 2001 From: adrian_gonzalez Date: Sun, 31 Mar 2013 22:25:02 +0200 Subject: [PATCH] Fixed #16 and fixed #17 --- .../citius/lab/hipster/algorithm/ADStarIterator.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/es/usc/citius/lab/hipster/algorithm/ADStarIterator.java b/src/main/java/es/usc/citius/lab/hipster/algorithm/ADStarIterator.java index cc5efc3..a6cf405 100644 --- a/src/main/java/es/usc/citius/lab/hipster/algorithm/ADStarIterator.java +++ b/src/main/java/es/usc/citius/lab/hipster/algorithm/ADStarIterator.java @@ -7,8 +7,10 @@ import es.usc.citius.lab.hipster.node.ComparableNode; import es.usc.citius.lab.hipster.node.NodeBuilder; import es.usc.citius.lab.hipster.node.Transition; +import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import java.util.PriorityQueue; import java.util.Queue; /** @@ -35,13 +37,17 @@ public class ADStarIterator implements Iterator> { private Double epsilon = 1.0; public ADStarIterator(S begin, S goal, TransitionFunction predecessors, TransitionFunction successors, CostFunction costFunction, HeuristicFunction heuristic, NodeBuilder> builder) { - this.beginNode = this.nodeBuilder.node(null, new Transition(null, begin)); - this.goalNode = this.nodeBuilder.node(null, new Transition(null, goal)); + this.nodeBuilder = builder; this.predecessorFunction = predecessors; this.successorFunction = successors; this.costFunction = costFunction; this.heuristicFunction = heuristic; - this.nodeBuilder = builder; + this.open = new HashMap>(); + this.closed = new HashMap>(); + this.incons = new HashMap>(); + this.queue = new PriorityQueue>(); + this.beginNode = this.nodeBuilder.node(null, new Transition(null, begin)); + this.goalNode = this.nodeBuilder.node(null, new Transition(null, goal)); /*Initialization step*/ this.beginNode.setG(0);