questions regarding the use of A* with the 15-square puzzle

前端 未结 8 1934
无人共我
无人共我 2021-02-07 12:41

I\'m trying to build an A* solver for a 15-square puzzle.

The goal is to re-arrange the tiles so that they appear in their natural positions. You can only sli

8条回答
  •  逝去的感伤
    2021-02-07 12:59

    What I learned

    • apparently this is well-known, but it wasn't to me: the A* convergence is very sensitive to the heuristic function.
    • if I write a heuristic that weights the top 2 rows more heavily than other rows, it converges much more quickly, but the path is generally much longer.
    • I found the diagonal H(x) function shown here to converge much more quickly than the Manhattan distance, for the 15-square puzzle.
    • even with the heuristic function that encourages speedier convergence, there is wide variance in the run time. Sometimes it finds the path in 10 seconds. Sometimes 10 minutes. Sometimes longer.
    • The number of moves required in the paths found, using the diagonal heuristic, ranges from 30-ish to 110.

提交回复
热议问题