in reply to Re: Challenge: N Jugs Problem
in thread Challenge: N Jugs Problem
It tracks water usage, if you want to optimize a solution that way, but that's commented out right now. I suspect that the shortest path solution is always the least water used solution.I think you are wrong. I wrote my own solution (which I won't post, as several have now been posted) and found that for jugs with sizes 3 and 7, and target 11, there's a solution that requires 5 moves (fill Y, pour Y in X, pour Y in Z, fill Y, pour Y in Z), but that uses 14 water. There's a solution that requires just 11 water, but that requires 6 moves (fill Y, pour Y in X, pour Y in Z, pour X in Y, fill Y, pour Y in Z).
Of course, my program may be wrong, and I might have missed a 5 move solution that uses just 11 water.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Challenge: N Jugs Problem
by ikegami (Patriarch) on Apr 14, 2009 at 22:47 UTC | |
Re^3: Challenge: N Jugs Problem
by BrowserUk (Patriarch) on Apr 14, 2009 at 22:12 UTC | |
by ikegami (Patriarch) on Apr 14, 2009 at 23:07 UTC | |
by JavaFan (Canon) on Apr 14, 2009 at 23:03 UTC | |
Re^3: Challenge: N Jugs Problem
by kyle (Abbot) on Apr 15, 2009 at 15:05 UTC | |
by ikegami (Patriarch) on Apr 15, 2009 at 15:32 UTC | |
by kyle (Abbot) on Apr 15, 2009 at 15:57 UTC | |
by ikegami (Patriarch) on Apr 15, 2009 at 16:09 UTC | |
by JavaFan (Canon) on Apr 19, 2009 at 19:18 UTC |