0
54kviews
Explain Water Jug problem with State Space Search method.
1 Answer
2
7.9kviews

The operators to be used to solve the problem can be describes as shown below. They are represented as rules whose left side are matched against the currnent state and whose right side describes the new state that results from applying the rules.

We have two jugs a 4 gallon and a 3 gallon.

Consider the following Rule set:

  1. (x,y)->(4,y) fill the 4 gallon jug

If x<4.

  1. (x,y)->(x,3) fill the 3 gallon jug

If x<3

  1. (x,y)->(x-d,y) pour some water out of the 4-gallon jug.

If x>0

  1. (x,y)->(x-d,y) pour some water out of the 3-gallon jug.

If y>0

  1. (x,y)->(0,y) empty the 4-gallon jug on the ground

If x>0

  1. (x,y)->(x,0) empty the 3-gallon jug on the ground

If y>0

  1. (x,y)->(4,y-(4-x)) pour water from the 3-gallon jug into the 4-gallon

If x+y>=4 and y>0 jug until the 4-gallon jug is full

  1. (x,y)->(x-(3-y),3)) pour water from the 4-gallon jug into the 3-gallon

If x+y>=3 and x>0 jug until the 3-gallon jug is full.

  1. (x,y)->(x+y,0) pour all the water from the 3-gallon jug into

If x+y<=4 and y>0 the 3-gallon jug.

  1. (x,y)->(0,x+y) pour all the water from the 4-gallon jug into

If x+y<=3 and x>0 the 3-gallon jug.

  1. (0,2)->(2,0) pour the 2-gallon from the 3-gallon jug into the 4-gallon jug.

  2. (2,y)->(0,x) empty the 2 gallon in the 4 gallon on the ground.

Production of the water jug problem:

enter image description here

enter image description here

Please log in to add an answer.