Professional Documents
Culture Documents
Heuristic
Heuristic
Heuristic
H(n) = 0
H(n) <= a(n) Were aiming for this one admissibility. (Where you always underestimate
things.)
A* search is if youre always underestimating, you will always get an optimal solution.
The difference with having a heuristic inside search class and heuristic outside of your search class is that
the encapsulated one is better design.
E in the assignment is flights.
Search state {
Node: C
parentHistory [1,b]
cost: 10
}
We dont have a list of nodes, we have a list of search states.
Graph contains a bunch of node classes.
class DGNode<E> {
public DGNode(E a) {
this.node = a;
}
public void addChild(E a) {
this.children.add(a);
}
private E node;
private List<E> connections;
}
BFS has:
toVisit (priority queue containing places to visit)
visited (list containing visited places)