[gecode-users] Problem extensional between BoolVars and IntVar
Christian Schulte
cschulte at kth.se
Wed Oct 9 11:26:17 CEST 2013
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.alone at gmail.com]
Sent: Wednesday, October 09, 2013 11:04 AM
To: cschulte at kth.se
Cc: users at 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 <cschulte at 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-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Mohamed Rezgui
Sent: Wednesday, October 09, 2013 10:53 AM
To: users at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20131009/36ce5f2c/attachment-0001.html>
More information about the users
mailing list