[gecode-users] sqrt function

Jaroslav Mlejnek mum.jmlejnek at post.cz
Thu Apr 3 19:49:30 CEST 2008


Hi!

I am using C++ Gecode Library in my school project and I am very satisfied with it. But I would like to use an arithmetic function "sqrt" and I think it doesn't work well. In code:
 
 
defining CSP (x is class global, y is constructor local):
 
IntVar x (this, 0, Int::Limits::max), y (this, 0, Int::Limits::max);
rel(this, y, IRT_EQ, 25);
rel(this, x, IRT_EQ, Gecode::sqrt(this, y));
 
 
printing solution (like Gecode examples):
cout << x.val() << endl;
 
 
There is in printing solution method an assert (debug) error instead of solution number 5. But when I use "similar" function "sqr", it works fine (or as I expect), so the solution is 625.
 
Is this bug in sqrt function or sqrt function has some special way how to use it? I am using Gecode since version 1.1.0, my current version is the newest  2.1.1.
 
Thanks a lot for your answer,
 
Jaroslav Mlejnek
Faculty of Mathematics and Physics
Charles University, Prague
Czech Republic
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20080403/badab527/attachment.htm>


More information about the gecode-users mailing list