Monkey and Bananas Exercise - PowerPoint PPT Presentation

About This Presentation
Title:

Monkey and Bananas Exercise

Description:

Monkey and Bananas Exercise. Notes on Exercise 3.10 of Bratko. For CSCE 580 Sp03. Marco ... Definition continues on the next . UNIVERSITY OF SOUTH CAROLINA ... – PowerPoint PPT presentation

Number of Views:546
Avg rating:3.0/5.0
Slides: 7
Provided by: cse9
Learn more at: https://cse.sc.edu
Category:

less

Transcript and Presenter's Notes

Title: Monkey and Bananas Exercise


1
Monkey and Bananas Exercise
  • Notes on Exercise 3.10 of Bratko
  • For CSCE 580 Sp03
  • Marco Valtorta

2
Bratkos Solution
  • let canget(State,Actions) be the relation that
    holds if the monkey can get from State to a state
    in which it has the bananas by carrying out the
    moves described in the list Actions.
  • If the monkey already has the bananas, there is
    nothing that it needs to do.
  • canget( state(_,_,_,has), ).
  • Definition continues on the next slide

3
Bratkos Solution (ctd.)
  • The monkey can get from State to a state in which
    it has the bananas by doing Action followed by
    Actions if
  • (a) the monkey can move from State to NewState by
    doing Action, and
  • (b) the monkey can move from NewState to a state
    in which it has the bananas by doing Actions.
  • canget( State, ActionActions) -
  • move( State, Action, NewState),
  • canget( NewState, Actions).

4
Alternate Solution
  • canget1(State, Actions, Path) if the monkey can
    get the bananas from State by doing the actions
    in the difference list Path Actions
  • If the monkey is already in a state in which it
    can get the bananas, then there is nothing that
    it needs to do
  • canget1( state(_,_,_,has), Actions, Actions).
  • Definition continues on the next slide

5
Alternate Solution (Ctd.)
  • The monkey can get the bananas from State1 by
    doing the Actions in Path - Actions if
  • (a) the monkey can move to State2 by doing Move,
    and
  • (b) the monkey can get the bananas from State2 by
    doing the actions in Path - (Actions Move)
  • canget1( State1, Actions, Path) -
  • move( State1, Move, State2),
  • canget1( State2, Move Actions, Path).

6
Alternate Solution (Ctd.)
  • There is a procedural reading to the alternate
    solution accumulate the solution path into the
    Actions list going down the goal tree, then save
    it at the bottom of the goal tree
  • The solution Path is built backwards! We need
  • canget( State, Actions) -
  • canget1( State, , ReverseActions),
  • rev(Actions, ReverseActions).
  • Actions can be thought of as an accumulator.
  • Accumulators and difference lists are good for
    efficiency, but in this exercise the simpler
    solution is faster too!
Write a Comment
User Comments (0)
About PowerShow.com