Let's assume {self getForbiddenValues(I L)} returns a list of forbidden vales in
L given I. Then you might define:
%% AUXILIARY
proc {FdAsSet D M} % defines a singl set containing an FD
{FS.var.decl M}
{FS.card M 1}
{FS.include D M}
end
proc {BoolDotSet B S Result} % if B == 1 then S = Result else Result = Empty
{FS.var.decl Result}
{FS.subset Result S}
{FD.bool B}
B =<: {FS.reified.equal S Result}
({FS.card Result}\=:0) =<: B
end
%% Inside your class definition:
meth forbid(T N)
ElemSet = {FS.unionN {Record.map T FdAsSet}}
in
for Cur in 0..N do
CurIsIn = {FS.reified.include Cur ElemSet}
NoNos = {FS.value.make {self getForbiddenValues(Cur $)}}
CondNoNos = {BoolDotSet CurIsIn NoNos}
in
{FS.disjoint ElemSet CondNoNos}
end
end
That should yield good propagation. Cheers,
Jorge.
Quoting Kim BENNI <[EMAIL PROTECTED]>:
> Hello,
>
> Is it possible to translate in Oz in term of propagators this
> "tuple-self-reference" constraint ?
>
> Here it is :
>
> %C is a tuple of M integers between 0 and N
> {FD.tuple ProblemeDecoupage M 0#N C}
>
> %All values are pairwise distinct in that tuple
> {FD.distinct C}
>
> %If a value is present in the tuple (for example C.1 = 1) then values 2,
> 3 and 7 are forbidden in the rest of the tuple
> %I tried this but it doesn't worked :
>
>
> Variable = (C.J =: I) %First
> Contrainte = (C.J \=: {self getForbiddenValue(C.J)}) %Second
> {FD.impl Variable Contrainte 1} % I wonder if this really "bind" the
> second constraint to the first, as it is implied by the documentation's
> "->" sign ... Therefore, the second constraint should be implied only if
> the first is verified ?
>
> By the way, are there (undocumented ?) propagators able to work with an
> entire tuple at a time ? Being able to forbid a value IF another value
> is present in the tuple would be great.
>
> Any advise or help would be very appreciated !
>
> Thanks !
>
> Kim
>
_________________________________________________________________________________
> mozart-users mailing list
> [email protected]
> http://www.mozart-oz.org/mailman/listinfo/mozart-users
>
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users