Hill climbing algorithm simple example

前端 未结 7 1200
无人共我
无人共我 2021-02-05 11:39

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

相关标签:
7条回答
  • 2021-02-05 12:04

    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.

    0 讨论(0)
提交回复
热议问题