Information Technology Reference
In-Depth Information
properties separately using a special predicate poss( a , s ) , which is interpreted as
saying that a is a possible action to perform in situation s .
Here are the clauses for poss in the monkey and bananas world:
poss(climb_off,S) :- on_box(S).
poss(go(_),S) :- \+ on_box(S).
poss(grab,S) :-
on_box(S), location(box,L,S), location(bananas,L,S).
poss(push(_),S) :- poss(climb_on,S).
poss(climb_on,S) :-
\+ on_box(S), location(box,L,S), location(monkey,L,S).
Clauses like these are called action precondition clauses . Note how they use the fluents
to state when it is possible to perform an action. For example, the monkey can climb
on the box only when it is located at the same place as the box and is not already on
it. A push action is only possible under the same conditions.
This completes the representation of the monkeys and bananas world using
situations and fluents.
9.4.2 Planning with situations and fluents
After all the initial state, successor state, and action precondition clauses for some
world have been written, the planning can begin. Recall that for the plan (or bplan )
predicate, one must provide three problem-specific predicates: initial_state ,
goal_state , and legal_move . With situations and fluents, this is very easy:
initial_state([]).
legal_move(S,A,[A|S]) :- poss(A,S).
goal_state(S) :- has_bananas(S).
The initial state is always the same for any problem: it is the initial situation, the
empty list. Similarly, the legal_move clause is always the same: one can move from
situation S to situation [A|S] for any action A for which poss holds. Only the goal
state varies from problem to problem; for the monkey and bananas, it is any situation
where the monkey has the bananas.
So if these three clauses are added to the characterization of the monkey and
bananas world in terms of situations and fluents, the plan predicate can be used
to find the four-step plan as before.
 
Search WWH ::




Custom Search