[gecode-users] Constraining domain of variable to the index set of Boolean array?

Guido Tack guido.tack at monash.edu
Sat Feb 13 08:36:17 CET 2016


Hi,

you can use the element constraint:
http://www.gecode.org/doc-latest/reference/group__TaskModelIntElement.html#ga4d6854069f6e77baa1ac353f7cb46e47 <http://www.gecode.org/doc-latest/reference/group__TaskModelIntElement.html#ga4d6854069f6e77baa1ac353f7cb46e47>

So if you have BoolVarArray y and IntVar x, you can post

element(*this, y, x, true);

which simply states that y[x]=true.

Cheers,
Guido

-- 
GUIDO TACK                  
Senior Lecturer

Information Technology
Monash University
Level 6, Room 6.40, Building H, Caulfield Campus
900 Dandenong Road
Caulfield East VIC 3145
Australia

T: +61 3 9903 1214                      
E: guido.tack at monash.edu <mailto:guido.tack at monash.edu>
http://www.csse.monash.edu/~guidot/ <http://www.csse.monash.edu/~guidot/>


> On 13 Feb 2016, at 6:32 PM, Juan Carlos Hernandez <jchernandez.madrid at gmail.com> wrote:
> 
> I am wondering if there is any native support for the following constraint
> 
> x \in  { i such that y[i]=TRUE }
> 
> in Gecode. In other words, I would like to ensure that x is an index of a true variable in the vector y.
> 
> In the global constraint catalog, this looks like a domain_constraint, and there is a reference to "in" in Gecode, but I cannot find a matching definition of the "in" constraint.
> 
> Am I overlooking something?
> 
> Grateful for help,
> JC
> 
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20160213/0bb6b5e1/attachment.html>


More information about the users mailing list