9/13/2023 0 Comments Blocksworld beginning coding![]() ![]() Because we don’t need to touch “A” any longer. Obviously, getting “A” in place first is better than getting “B” in place first then dealing with “A”. That is to say, number of moves if we move all blocks above current position (exclusive) and target position (inclusive) to other position, and then move current block to the target position.įurthermore, to improve the heuristic function, we may consider adding weight parameter to each block. The heuristic function valus is number of moves that taking all blocks above the current block (inclusive) away, and filling blocks back until reaching target position, then putting current block back.įor other stacks, the distance is actually the summation of the number of blocks above the target position in the first stack and the number of blocks above the current position in the current stack, plus one. The other is current block is under the target position. The measurement is number of moves that we takes all blocks above the target position(inclusive) away and put the current blocks. One is the current block is above the target position. At other states, for the first stack, there are actually two case. My heuristic function is basically the summation of the number of moves to move single block to its target position for all blocks.Īt the target state, all blocks will be in order in the first stack. ![]() Success! depth = 6, total_goal_tests = 12, max_queue_size = 69 Iter = 12, queueSize = 68, f = 6, depth = 6 Iter = 11, queueSize = 64, f = 6, depth = 3 Iter = 10, queueSize = 59, f = 6, depth = 5 Iter = 9, queueSize = 55, f = 6, depth = 5 Iter = 8, queueSize = 54, f = 6, depth = 5 Iter = 7, queueSize = 50, f = 6, depth = 5 Iter = 6, queueSize = 45, f = 6, depth = 5 Iter = 5, queueSize = 37, f = 6, depth = 4 ![]() Iter = 4, queueSize = 32, f = 5, depth = 4 Iter = 3, queueSize = 27, f = 6, depth = 3 Iter = 2, queueSize = 19, f = 7, depth = 2 Iter = 1, queueSize = 11, f = 8, depth = 1 Iter = 0, queueSize = 0, f = -1, depth = 0 no_iter: maximum number of iterations allowed.no_blocks: number of blocks in this case.To run the program, execute following command with the arguments of your own choice. javac com/tangshijin/blocksWorld/*.java.However, we can always compile and run it in command line. Since I am using maven, the easiest way to compile and run it is using IDE (I use IDEA). The goal state this program wants to achieve is that all blocks are in the first stack and in alphabetical order. The blocksWorld is a well-known problem in AI searching area. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |