[gecode-users] element constraint

Christian Schulte cschulte at kth.se
Fri Oct 30 17:08:45 CET 2009


Element is just array access where the index and result are variables.

 

However, I think you got deceived by IntArgs: The first argument tells how
many values are to come. That is, when you write

                IntArgs cf(4, 7,4,9,11);

It will create an integer argument array with four elements which are
{7,4,9,11}.

 

;-)

Christian

 

--

Christian Schulte, www.ict.kth.se/~cschulte/

 

From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of frank lemoine
Sent: Friday, October 30, 2009 4:48 PM
To: gecode gecode
Subject: [gecode-users] element constraint

 

hi every one,
 
i just begin in gecode, i use the element constraint for matching two sets,
i read carefully "modeling with gecode" and i run this command: 
 
IntArgs cf(4,13,4,25,16,29,8);
for(int i=0;i<7;i++)
{
element(*this, cf, xb[i], yb[i]);
}  
 
xb and yb are IntVarArray (*this,8,0,30) i get this: {4,13,16,25} 7 times
and the last is [0...30]
 
if i try with this set cf(3,13,4,25,16,29,8) i get {4,13,25} 7 times and the
last is [0...30]
 
i haven't understand how this constraint work. can some one explain me ? 
 
what i want to do is: first set i have this {0,1,2,3,4,5} the second set
containt a variable Intvar x with diffrent domain 0....10, 2..6, 4......44
 
i have to check if x is in the first set when x is egal to one of this
domain.

  _____  

Achetez un nouveau PC et bénéficiez de Windows 7 dès sa sortie ! En savoir
plus <http://www.portable-windows.com/> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20091030/b322552d/attachment.htm>


More information about the gecode-users mailing list