[gecode-users] IntVarArray
Christian Schulte
cschulte at kth.se
Mon Mar 12 10:31:51 CET 2012
Element works with arrays of integers and the index variable are the
variables toto1 and toto2. Please read carefully.
Christian
--
Christian Schulte, www.ict.kth.se/~cschulte/
From: Alexis Cothenet [mailto:alexis.cothenet at gmail.com]
Sent: Monday, March 12, 2012 10:17 AM
To: cschulte at kth.se
Cc: users at gecode.org
Subject: Re: [gecode-users] IntVarArray
Hi,
Thank you for your answer.
I have seen this constraint but i don't understand how it could help me
since, in my example, Array is not a variable array.
If i understand well, what you suggested me if to use something like
element (Array, toto1, glob[0])
element (Array, toto2, glob[1])
distinct (glob);
But in my case Array is a simple relationship (a mapping) between values...
Alexis
2012/3/12 Christian Schulte <cschulte at kth.se>
The constraint you are looking for is called "element" in Gecode
(implementing arrays access with variables).
For a general idea on how to model with Gecode, please check the
documentation.
Christian
--
Christian Schulte, www.ict.kth.se/~cschulte/
<http://www.ict.kth.se/%7Ecschulte/>
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Alexis Cothenet
Sent: Monday, March 12, 2012 9:49 AM
To: users at gecode.org
Subject: [gecode-users] IntVarArray
Hi all,
I'm trying to model something with Gecode:
I'm used with ILOG to add constraints like this:
I have 2 variables for example :
IntVar toto1 ([0,1,2])
IntVar toto2 ([0,2]).
I have a relationship with the preceding domain values :
Array [0] = 8
Array [1] = 9
Array [2] = 8
I have an intVarArray:
IntVarArray glob;
glob << Array [toto1] (domain = [8,9])
glob << Array [toto2] (domain = [8])
And add constraint:
distinct (glob);
So that it constrains glob[0] ->[9] and so it constrains toto1->[1]
Could you explain me how i could model it with Gecode ?
Thank you.
Best regards,
Alexis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20120312/41ce374e/attachment-0001.htm>
More information about the users
mailing list