[gecode-users] Slight modification of examples/money.cc that reveals a bug
Olof Sivertsson
osivertsson at gmail.com
Tue Feb 28 16:15:42 CET 2006
Hello,
I think I've stumbled across a bug that is quite easy to reproduce by doing
a slight modification of examples/money.cc.
Without modification running examples/money will print:
9 5 6 7 1 0 8 2
which is the values of the letters in the array [s,e,n,d,m,o,r,y].
Now let's force s = 9 by adding the following to Money(const Options& opt)
post(this, s == 9);
Recompile & rerun:
> make compileexamples
> examples/money
...
9 5 6 7 1 0 8 2
No change - it works like it should. But now let's do a small change, and
instead post the following constraint:
post(this, 9 == s);
If we recompile and rerun it now we get no solution, so somethings broken. I
bet it's a sign error since if we change it to:
post(this, -9 == s);
it works!
Hopefully this will lead you straight to the bug and a trivial fix.
Cheers,
Olof
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20060228/59250226/attachment.htm>
More information about the gecode-users
mailing list