[gecode-users] Symbolic Constraints - fd_relation contraint in Gecode?
Denys Duchier
denys.duchier at univ-orleans.fr
Sat Jun 13 14:10:33 CEST 2009
Pedro Salgueiro <pds at di.uevora.pt> writes:
> Translating the large domain to a smaller one is a good idea, the
> problem is that besides I need to use the extensional constraint to make
> sure that the values belong to some matrix,
use extensional on the translated domains
> I also have to apply
> constraints to some of the values individual values of the tuple, based
> on the values of the large domain. So, if I translate the domain to a
> smaller one, then I have no way to apply such constraints.
yes you do: apply the constraint on de-translated versions of the vars
> For instance, let's suppose I have the following matrix:
>
> matrix={{9900, 1234, 2349}
> {9901, 2345, 5678}}
>
> wich will be translated to:
>
> translated_matrix={{0,1,2,3}
> {4,5,6,7}}
let's say:
translated_matrix={{0,1,2}
{3,4,5}}
so that the number of values actually correspond ;-)
> Then I will apply an extensional constraint to make sure that the
> variables C={X1,X2,X3} and C1={Y1,Y2,Y3} belongs to translated_matrix.
you use extensional on the translated matrix.
> Then I need to apply constraints that relate individual values on each
> of the tuple, such as
>
> Y1 - X1 < 10
I write A=<B1,B2,...,Bn>[I] for the element constraint.
Constrain 2 new variables XX1 and YY1 as follows:
XX1 = <9900,1234,2349,9901,2345,5678>[X1]
YY1 = <9900,1234,2349,9901,2345,5678>[Y1]
XX1 and YY1 are the de-translated versions of X1 and Y1, and you can
pose the constraint:
YY1 - XX1 < 10
> About the element constraint, I didn't got that one.
I hope the above example clears it up for you.
Cheers,
--Denys
More information about the gecode-users
mailing list