You to gain expertise in using intelligent search in a domain well suited to it. ![]() We’ll get back to talking about it for that One in AI, often used as a model domain for planning. Of stacked blocks on a table, which must be rearranged into some other stacks, In blocks world, you are presented with a set The “ordinary” version of it, like that used in Ch.11. The problems are always shown with two arrangements of the Using a single mechanical arm, as pictured in Fig. There is a single, magical, mechanical arm Same blocks on a table, one called the Start State and the other the Goal State! Assume you are actually given the blocks inĪnd what you need to do is move them into the Goal State. Which can lift up the blocks and move them, one at a time. Go through a sequence of other states, trying to convert the Start State In making progress on the problem, you will Each block startsĪnd ends either on the table or else exactly on top of another block. An “optimal” solution to a blocks world problem takes you through the Next can be described in the following rather concise way to the magical, The blocks given in each state are of course always the same, as shownįor simplicity, assume that all moves from one state to the Minimal number of such intermediate states. Here is the answer from prolog: 24 ?- plan().Legalities in the domain: It is not legal to move blocks out from under other blocks, or to insert For example, a legal move from the Start State Where the block ID is one of those pictured in the problem,Īnd the positions are either “On Table” or “On “ some other block. In this way we get unified G when dealing with goal_state. That means instead of generating all possible goal_states, we first try every reachable positions and then check if they are goal states. with plan(L) :- initial_state(I), reachable(I,L,G), goal_state(G). Initial State: the state of the world at the start of problem. I solve the problem by replacing plan(L) :- initial_state(I), goal_state(G), reachable(I,L,G). For example, we can shoot the gun, unless. ![]() Plan(L) :- initial_state(I), goal_state(G), reachable(I,L,G).
block(Block).
block(b).
Poss(move(A,B),S) :- member(A,),member(B,),Ĭlear(A,S) :- member(A,), \ located_on(_,A,S). Our world has three blocks: a, b, c, and three places on the table: p, q, r. The whole program is like this: %Initial states Is there any way that can help me get rid of the infinite loop? The first element here are aways move(a,b) since the program get infinite loop in satisfying move(d, area2). test :- write ('How many blocks '), read (X), Max is 96 X, numlist (97, Max, L), maplist (getcar, L, L1), maplist (set, L1). For example, in the Blocks World these would include structures like (block. set (B) :- format ('On which object is the block w ', B), read (X), assert (on (B, X)). ![]() X = īut when I have more than one goals, say goal_state(S):- located_on(a,b,S),located_on(d,area2,S)., the fluents I get get stuck in one of its goals: ?- goal_state(X). because their syntax is similar to the Horn clauses used in Prolog and. The problem is that, when I have only one goal, say goal_state(S):- located_on(a,b,S), I can get all possible fluents S: ?- goal_state(X). We can know where each blocks are according to fluents(their action history). After each action, we add the action into the third parameter fluent.įor example, if we move a to b, then move b to c, then move c to d, the fluent would be. The fluent starts at empty list which means no action has been done yet. The third parameter of located_on is situations(fluents), which indicates the action history. The goal_state is where we want the blocks to be. The predicate located_on tells us the locations of blocks according to the fluents. Start off with the canonical world state, all blocks are on the table, with none stacked: on (a, table), on (b, table), clear (a), clear (b. We will represent a state in the blocks world as a list of terms on(X, Y). Your operators each have an add and delete list which modifies the world state list via the apply predicate when they are applied. This notebook explores STRIPS Stanford Research Institute Problem Solver. This is a block world problem which is going to move the blocks where we want them to be. Basically, your world state is kept in a Prolog list.
0 Comments
Leave a Reply. |