if( this.frontier.size()==0 ) {
throw new EncogError("Frontier is empty, cannot find solution.");
}
BasicPath path = this.frontier.pop();
if (this.goal.isGoalMet(path)) {
this.solution = path;
return;
}
BasicNode state = path.getDestinationNode();
this.explored.add(state);
for (BasicEdge connection : state.getConnections()) {
if( !this.explored.contains(connection.getTo()) &&
!this.frontier.containsDestination(connection.getTo())) {
BasicPath path2 = new BasicPath(path, connection.getTo());
this.frontier.add(path2);
}
}
}
}