[gecode-users] Add value in IntVarArray

Guido Tack guido.tack at monash.edu
Mon Nov 9 09:55:55 CET 2015


Hi,

you're trying to add values to a domain of an IntVar, and that's not
possible. You need to initialise the domain with the right values (see the
constructors that take an IntSet) or initialise it with a superset (eg
{0,1,2,3} in your case) and then remove the elements you don't want, eg
using a dom constraint.

Cheers,
Guido

-- 
Guido Tack

On 9 Nov 2015, at 19:50, mehdi m <medistif at hotmail.fr> wrote:

Hi everyone,

In my model i have an IntVarArray X with size 3 = [X1, X2, X3]
The domains must be :
D(X1) = {1,2,3}
D(X2) = {0,2,3}
D(X3) = {0,3}

For this, i do :
X1 :
X[1] = IntVar(*this, 1, 3);

X2..X3 :
for (int i = 2; i <= 3; i++){
    X[i] = IntVar(*this, i, 3);
}

So for X2 and X3 i need to add the value 0, and i saw in mpg that only
IntVarArgs can grow dynamically by adding value with "<<" operator, so is
there any way to add a value in IntVarArray ? especially that the
IntVarArray in my model can be large.

Thanks

_______________________________________________
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/20151109/f977cade/attachment.html>


More information about the users mailing list