Solving the water jug problem

Posted by Amit on Stack Overflow See other posts from Stack Overflow or by Amit
Published on 2009-03-13T18:21:48Z Indexed on 2010/05/01 21:37 UTC
Read the original article Hit count: 324

Filed under:
|
|

While reading through some lecture notes on preliminary number theory, I came across the solution to water jug problem (with two jugs) which is summed as thus:

Using the property of the G.C.D of two numbers that GCD(a,b) is the smallest possible linear combination of a and b, and hence a certain quantity Q is only measurable by the 2 jugs, iff Q is a n*GCD(a,b), since Q=sA + tB, where:

n = a positive integer
A = capacity of jug A
B=  capacity of jug B

And, then the method to the solution is discussed

Another model of the solution is to model the various states as a state-space search problem as often resorted to in Artificial Intelligence.

My question is: What other known methods exist which models the solution, and how? Google didn't throw up much.

© Stack Overflow or respective owner

Related posts about computer-science

Related posts about math