[gecode-users] Domain values
Christian Schulte
cschulte at kth.se
Tue Mar 18 05:39:17 CET 2008
Hi,
this program has quite some flaws. Let me go through it:
- posting distinct for x creates a propagator for the variables that are
currently stored in the array,
changing the array later has no effect whatsoever.
- x[0]=x1 in post is not what you mean, this is C++ assignment.
So what you might want to do is:
distinct(this, x, ICL_DOM)
rel(this, x[0], IRT_EQ, 0); // Constrain x[0] to be zero
status();
which you can also write as:
distinct(this, x, ICL_DOM);
post(this, x[0] == 0);
status();
Cheers
Christian
--
Christian Schulte, www.ict.kth.se/~cschulte/
-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Dhananjay Thiruvady
Sent: Tuesday, March 18, 2008 2:03 AM
To: users at gecode.org
Subject: [gecode-users] Domain values
Hi All,
I have a problem with checking the domain values of variables after posting
constraints. This is an example of the code I have:
IntVarArray x(this,5,0,4);
distinct(this, x, ICL_DOM);
IntVar x1(this,0,0);
x[0]=x1;
post(this,x[0]=x1);
unsigned long int p;
(void) status(p); // should update the domains?
I would expect x[0] = 0, x[1]=x[2]=x[3]=x[4]= 1...4, but I get x[1]=...=
0...4. So the domains don't seem to be pruned but this should happen,
correct?
Regards,
Dhananjay
_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users
More information about the gecode-users
mailing list