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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Dhananjay Thiruvady
Sent: Tuesday, March 18, 2008 2:03 AM
To: [EMAIL PROTECTED]
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
[EMAIL PROTECTED]
https://www.gecode.org/mailman/listinfo/gecode-users


_______________________________________________
Gecode users mailing list
[EMAIL PROTECTED]
https://www.gecode.org/mailman/listinfo/gecode-users

Reply via email to