[gecode-users] Creating a boolvar and testing if one condition at least is true

Guido Tack tack at ps.uni-sb.de
Wed Oct 8 13:06:14 CEST 2008


Sébastien Laigre wrote:
> I'm starting with gecode, and it's a bit difficult for me.
> I have 3 conditions, one of them must be true. So i want to put them
> in an BoolArray. But I do not know how to do that.
> For example, I would like to do
> array[0] = x < y;
> array[1] = a < b;
> array[2] = c < d;
> and that one (at least) condition of the array is true.


You'd have to use something like the following:
BoolVarArray b(this, 3, 0, 1);
rel(this, x, IRT_LE, y, b[0]);
rel(this, a, IRT_LE, b, b[1]);
rel(this, c, IRT_LE, d, b[2]);
rel(this, BOT_OR, b, 1);

(this isn't tested, but you should get the idea)

Cheers,
	Guido

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2436 bytes
Desc: not available
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20081008/1a79b44c/attachment.bin>


More information about the gecode-users mailing list