I am a little confused with Hill Climbing algorithm. I want to \"run\" the algorithm until i found the first solution in that tree ( \"a\" is initial and h and k are final state
Here is the solution:
A -> F, with the least possible cost F -> G with cost 3 but there is no path.
Restart from the least possible cost other than G, well it's E because E was already inserted in the queue/stack/priority queue or whatever data structure you use.
Thus E -> I but I has higher cost than E thus you are stuck :S
Restart from the least cost other than F E & G, thus we pick J because J has lower cost than B with difference of 2 i.e. J = 8 B = 10
J->K with cost 0 thus K is the goal
NOTE: The proposed variation of hill-climbing to pick a point randomly, but picking the least cost other than the already visited nodes is better than picking randomly.
ANOTHER NOTE: is that when node E didn't visit I because I has higher value than E, the algorithm already inserted it in the data structure, thus picking the least cost other than the already visited would create a new path from I because I was never visited and thus it has lower value than J, this is the only path that i've skipped.