Just do something like this: assume that you have n Boolean vars stored in an array x and m integer vars stored in an array y. Then do:
IntVarArgs xy(n+m); for (int i=0; i<n; i++) { BoolVar b(home,0,1); xy[i]=b; channel(home, x[i], xy[i]); } for (int i=0; i<m; i++) xy[n+i]=y[i]; That's just C++ Christian -- Christian Schulte, Professor of Computer Science, KTH, www.ict.kth.se/~cschulte/ From: Mohamed Rezgui [mailto:kyo.al...@gmail.com] Sent: Wednesday, October 09, 2013 11:04 AM To: cschu...@kth.se Cc: users@gecode.org Subject: Re: [gecode-users] Problem extensional between BoolVars and IntVar OK, thank you Christian and if I have n BoolVars and m IntVars, how can I generalize that ? Best Regards, Mohammed REZGUI 2013/10/9 Christian Schulte <cschu...@kth.se> Dear Mohamed, I only have an inefficient solution here: you can introduce IntVars y1 and y2 and use the channel constraint: channel(home, x1, y1); channel(home, x2, y2); and then you can use y1 and y2 together with x3 and x4 and the extensional constraint. Best Christian -- Christian Schulte, Professor of Computer Science, KTH, www.ict.kth.se/~cschulte/ From: users-boun...@gecode.org [mailto:users-boun...@gecode.org] On Behalf Of Mohamed Rezgui Sent: Wednesday, October 09, 2013 10:53 AM To: users@gecode.org Subject: [gecode-users] Problem extensional between BoolVars and IntVar Dear Sir, I would like to know how can I use Gecode with extensional between BoolVar and IntVar I show you my problem : I have boolvars : x1 x2 and intvars x3 x4 I have some valid tuples : 0 1 3 4 0 0 6 6 1 1 7 3 How can I use constraint Gecode::extensional to use BoolVar and IntVar together ? This is not the case with Gecode 4.2.0 Maybe do I use a clause constraint to express the constraint extensional for BooVar and the constraint extensional for IntVar ? -- Best Regards, Mohamed REZGUI -- Cordialement, Mohamed REZGUI
_______________________________________________ Gecode users mailing list users@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users