![]() The task is to simply find an operator whose side effect upon the world state will bring the world state closer to the goal state. Each operator has a precondition list, and an add and delete lists which are merged with the world state list and subtracted from it respectively after the application of an operator. ![]() If you want to solve the problem in the way STRIPS does it (with operators etc.) it's simple. I think that the reason STRIPS is so popular is because it was one of the first planners to solve the frame problem (is that correct?).īesides, how am I supposed to move the blocks (take an action)and consequently change the status of my lists if Prolog doesn't permit variable assignments? It was specially written to solve problems like the blocks world (I think it originally controlled a real robot who moved blocks from room to room or something like that). STRIPS is the Stanford Research Institute Planning System. I heard about the term STRIPS, but don't know what that means. Finally represent by on(X, Y) the fact that X is positioned on top of Y.% Assignment 1% state(Coyote_location, Standing_on, Stonehenge_position, Holding_cannon, Shot_roadrunner)% Coyote_location: where is the coyote?% Standing_on: what is the coyote standing on (the stonehenge or the ground)?% Stonehenge_position: where is the stonehenge?% Holding_cannon: is the coyote holding the cannon?% Shot_roadrunner: has the coyote shot the roadrunner?% the coyote climbing off the stonehengetransform( state(Location, stonehenge, Location, X, Y), climb_down, state(Location, ground, Location, X, Y)).% the coyote shooting the roadrunner with the cannontransform( state(X, ground, Z, yes, _), shoot, state(X, ground, Z, yes, yes)).% the coyote getting the cannontransform( state(tree, stonehenge, tree, no, X), grab, state(tree, stonehenge, tree, yes, X)).% the coyote climbing onto the stonehengetransform( state(Location, ground, Location, X, Y), climb_up, state(Location, stonehenge, Location, X, Y)).% the coyote moving the boxtransform(state(Loc1, ground, Loc1, X, Y), move, state(Loc2, ground, Loc2, X, Y)).% the coyote running to a new positiontransform(state(Loc1, ground, Loc3, X, Y), run, state(Loc2, ground, Loc3, X, Y)).% achieve(StartState, Endstate)% True if EndState can be achieved from StartState% also prints Steps (in reverse order)achieve( InitialState, GoalState ) :- achieve( InitialState, GoalState, ).achieve( State, State, _ ).achieve( InitialState, GoalState, StateList ):- transform( InitialState, Step, NewState ), \ member( NewState, StateList ), achieve( NewState, GoalState, ), display( Step ), nl.query1 :- achieve(state(mountain, ground, river, no, no), state( _, _, _, _, yes)).% a predicate to display a list in reverse order (as it's faster and easier to prepend than append to the accumulated list of moves.)display_list().display_list( ) :- display_list(T), nl, display(H).% achieveb/2, a predicate to display moves in the correct order.achieveb( InitialState, GoalState ) :- achieveb( InitialState, GoalState,, ).% achieveb/3 a predicate used by achieveb/2 to display a list in the correct order.achieveb( State, State, DisplayList, _ ) :- display_list( DisplayList ).achieveb( InitialState, GoalState, DisplayList, StateList ):- transform( InitialState, Step, NewState), \ member( NewState, StateList ), achieveb( NewState, GoalState,, ).% query2, the same as query1, but using achieveb/2 instead of achieve/2query2 :- achieveb(state(mountain, ground, river, no, no), state( _, _, _, _, yes)).You can test it by either constructing your own queries, or using the predefined ones (query1. Furthermore, use the constant table to denote the table. A reasonable solution is to use a ternary functor state3 to represent the three positions of the table. The first step is to determine how to represent the state. Only blocks which are free (that is, with no other block on top of them) can be moved. The aim is to move the blocks from a given start-state to a goal-state. On the table are a number of blocks which may be stacked on top of each other. ![]() Also you may use the code segment for your work: tutorial/2 19.html Consider a table with three distinct positions (table(i) where i is 1,2,3). For a base, you should begin with a simple prolog code for simple blocks world at the end of this part. Transcribed image text: PART3 - Prolog - Blocks World. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |