[gecode-users] How to write with Gecode a constraint similar to distinct but with absolute value of values : distinct ( |variables|).
Guido Tack
tack at gecode.org
Sun Oct 26 00:02:52 CEST 2014
Hi,
to model this kind of constraint in Gecode you need to decompose it, i.e., you create an auxiliary matrix M' and post the constraints M'[i,j] = abs(M[i,j]), and then post the distinct constraints on M'.
Views, as suggested by Vijay, can't be used for modelling in Gecode, only for implementing your own propagator.
Cheers,
Guido
> On 25 Oct 2014, at 8:25 pm, Bouchene Sabrina <genius_linda1987 at yahoo.fr> wrote:
>
> Hi,
>
> I want to use "alldifferent" constraint or a "distinct" constraint but in my case, i have a matrix M and i would that the elements (values) of the row of a matrix be different, but the variables of the row can have positive and negative values, so i would have a constraint that for example:
>
> if row = 1 then the absolute values of M[1, j] could be all different, that means, if i have M[1,1]=(-3), i should not get M[1,j] =(+3) for j =1 to n. so in the same row or in the same column if i have (val) i must not have (-val) or if i have (-val) i mast not have (val).
>
> alldifferent (|M[i, j]|).
>
> My question is how to write this constraint in Gecode ?.
> I hope my question was clear.
>
> Best regards. Sabrina
>
> _______________________________________________
> 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/20141026/81a35083/attachment.html>
More information about the users
mailing list