[gecode-users] question about mult propagator
Alejandro Arbelaez
a_le_jo55 at yahoo.com
Wed Sep 13 01:28:36 CEST 2006
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20060912/879ed1f0/attachment.htm>
More information about the gecode-users
mailing list