Midterm 1

Midterm 1 - Midterm1 sample solution (CSCI561) Spring 2008...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Midterm1 sample solution (CSCI561) Spring 2008 1. The Water Jug Problem is a puzzle with N water jugs of various sizes, but with no measuring marks on them. You have the ability to fill any individual water jug from a tap, to pour the water from any jar into another, and to empty any jug on the ground. The goal is generally to get a specific amount of water into one of the jugs. For example, consider the problem where you have two empty jugs that hold 3 gallons and 4 gallons, respectively, and the goal is to have exactly two gallons of water in the 4 gallon jug. 1a. Define the state space in terms of what features will be in the states and what the operators will be. We can represent the state of the specific 2 water jugs problem with a pair of non- negative integers: <x 1 ,x 2 >, where x 1 and x 2, respectively, show the amount of water in the 3 and 4 gallon jugs (0 x 1 3 and 0 x 2 4). Given a state <x 1 ,x 2 >, If x 1 > 0 then there exists an empty action e 1 that takes <x 1 ,x2> to <0,x 2 > If x 2 > 0 then there exists an empty action e 2 that takes <x 1 ,x2> to <x 1 ,0> If x 1 < 3 then there exists a fill action f 1 which takes <x 1 ,x 2 > to <3,x 2 > If x 2 < 4 then there exists a fill action f 2 which takes <x 1 ,x 2 > to <x 1 ,4> If 0 < x 1 and x 2 < 4 then the pour action p 12 is available, which takes <x 1 ,x2> to <x 1 -4+x 2 ,4> if x
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/05/2010 for the course CS 561 taught by Professor Moradi during the Spring '09 term at USC.

Page1 / 4

Midterm 1 - Midterm1 sample solution (CSCI561) Spring 2008...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online