[gecode-users] If then type constraints

Christian Schulte cschulte at kth.se
Thu Mar 6 06:15:01 CET 2008


Use reification, that's clumsy but works. So, with minimodeling support it
should be something like (~ reifies a linear relation, && is conjunction,
imp is implication, and tt means that the statement must be true):
	post(home, tt(imp(~(v1 == 2),~(v2 != 1) && ~(v3 != 3)));
or directly:
	BoolVar b1(home,0,1), b2(home,0,1), b3(home,0,1), b23(home,0,1);
	rel(home, v1, IRT_EQ, 2, b1);
	rel(home, v2, IRT_NQ, 1, b2);
	rel(home, v3, IRT_NQ, 3, b3);
      rel(home, b2, BOT_AND, b3, b23);
	rel(home, b1, BOT_IMP, b23, 1);

Or check whether extensional constraints work for you.

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 Debdeep Banerjee
Sent: Thursday, March 06, 2008 3:03 PM
To: users at gecode.org
Cc: users at gecode.org
Subject: [gecode-users] If then type constraints

Hi,
How do I model if-then style constraints ? What I want to do is post 
constraints if a variable is assigned a particular value. For example 
say  I have variable set V { v1, v2, v3} and each of them has the domain 
{1,2,3}. what I want to achieve is
    if  v1== 2  then
         v2 !=1  /\  v3 !=3

I know I can do this using a custom propagator, but is there any other way ?

With regards
Debdeep

-- 
Debdeep Banerjee
PhD Candidate
CSL/RSISE/NICTA
Australian National University
Email: debdeep.banerjee at rsise.anu.edu.au
Web:http://rsise.anu.edu.au/~banerjed



_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users





More information about the gecode-users mailing list