![]() ![]() Using one or the other depends on own liking. However, the two versions are equivalent to each other. Yes, of course! :) This way you say where each block is, instead with my version you know how the "towers" are builds. Yes, you have to recursively find actions that bring you closer to the goal state. ![]() In the previous thread I posted a more lengthy explanation for you, including some sample code.ĭo I have to make this recursively? Probably yes. 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. % 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. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |