解决8拼图A *算法 [英] Solving The 8 Puzzle With A* Algorithm

查看:1199
本文介绍了解决8拼图A *算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想解决/实现使用A *算法在Java中8拼图问题。我问,如果有人能帮助我,向我解释我的步骤必须遵循的解决这个问题。我看了网上如何A *的作品,但我不知道如何开始在Java中的实现。

I would like to solve/implement the 8 puzzle problem using the A* algorithm in Java. Am asking if someone can help me by explaining to me the steps i must follow to solve it. I have read on the net how the A* works but i don't know how to begin the implementation in Java.

我会很感激,如果你们能帮助我,给我的指引,这样我就可以在Java中实现它自己。我真的想这样做,才能够了解它,所以我只需要指引启动。

I will be very grateful if you guys can help me and give me the guidelines so that i can implement it myself in Java. I really want to do it to be able to understand it, so i just need the guidelines to start.

我将使用优先级队列,并将读取它看起来像例如这个文本文件的初始配置:

I will use priority queues and will read the initial configuration from a text file which looks like for example this:

4  3  6
1  2  5
7  8  

指向其他网站的详细解释/教程是值得欢迎的。

Pointers to other sites for more explanation/tutorials are welcome.

推荐答案

我开始决定要如何重新present游戏板状态, 然后实现运营商(如移动(空白)平铺起来,移动(空白)平铺下来,...)。 通常情况下,你将有一个数据结构来重新present开放清单(即这些国家 发现但尚未未开发的(即与目标状态相比),另一个用于 封闭列表(即这些国家发现和探索和发现不是目标状态)。 您种子开放清单的起始状态,并多次以下一个状态 从开放列表探索,应用运营商将其产生新的可能状态 等等...

I'd begin with deciding how you want to represent the game board states, then implement the operators (eg. move (blank) tile up, move (blank) tile down, ...). Typically you will have a data structure to represent the open list (ie. those states discovered but as yet unexplored (ie. compared with goal state) and another for the closed list (ie. those states discovered and explored and found not to be the goal state). You seed the open list with the starting state, and repeatedly take the "next" state to be explored from the open list, apply the operators to it to generate new possible states and so on ...

有一个教程,我$ P $在ppared很多年前:

There is a tutorial I prepared many years ago at:

http://www.cs.rmit.edu.au/AI-Search/

这是远远状态空间搜索虽然确切的话,那简直就是为那些全新的理念的教育工具。

It is far from the definitive word on state space searching though, it is simply an educational tool for those brand new to the concept.

这篇关于解决8拼图A *算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆