[gecode-users] question about mult propagator

Mikael Zayenz Lagerkvist zayenz at gmail.com
Wed Sep 13 08:21:42 CEST 2006


Hello Alejandro,

When I tried your program with Gecode 1.2.2 it worked as it should,
i.e., it printed
OK
A: 316 B: 120 tmp: 37920

What version of Gecode are you using? What platform are you using it on?

Cheers,
Mikael

On 9/13/06, Alejandro Arbelaez <a_le_jo55 at yahoo.com> wrote:
> Hi all,
>
> I don't understand why the following program fails,
>
> I only want to create a propagator for
> a*b=:tmp, where a=:316 and b=:120
> so after the propagation (status) tmp is going to be equal to 37920, and
> that is the value that tmp shows in the last line of the program, but the
> status of  A is failed ????
>
> #include "gecode/int.hh"
> #include "gecode/kernel.hh"
> #include <iostream>
>
> using namespace Gecode;
>
> class Alejo : public Space {
> public:
>   Alejo(void) {}
>   virtual Space* copy(bool share) {
>     return new Alejo(*this);
>   }
> };
>
> int main() {
>   Alejo A;
>   IntVar a(&A,0,100000);
>   IntVar b(&A,0,100000);
>   IntVar tmp(&A,Gecode::Limits::Int::int_min,
> Gecode::Limits::Int::int_max);
>   mult(&A,a,b,tmp);
>   eq(&A,a,316);
>   eq(&A,b,120);
>
>   unsigned long pp;
>   SpaceStatus estado = A.status(pp);
>
>   if(estado==SS_FAILED) std::cout<<"FAILED"<<std::endl;
>   if(estado==SS_SOLVED) std::cout<<"OK"<<std::endl;
>   std::cout<<"A: "<<a<<" B: "<<b<<" tmp: "<<tmp<<std::endl;
>   return 0;
> }
>
>
> Cheers
> Alejandro
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users
>
>
>


-- 
Mikael Zayenz Lagerkvist, http://www.ict.kth.se/~zayenz/




More information about the gecode-users mailing list