Oz and Mozart Users Mailing List

RE: how to create a disjonctive constraint with a variable number of litterals


From: Jorge M. Pelizzoni (jorgemp@icmc.usp.br)
Date: Mon Oct 06 2003 - 16:40:56 CEST


But your best bet should always be to resort to FD and FS propagators.
Remember: combinators don't do propagation in the parent space and are
usually costly, creating subspaces.

As you can easily verify in a host of examples in the documentation and
also in http://www.mozart-oz.org/papers/abstracts/oznlp.html
(specifically that chapter on Dependency Grammars) you should encode
your literals as integers and post constraints such as:

        {FS.include Value SetOfPossibleValues}

The whole process can be easily automated. Just take a look at that link
above, it is really worth it.

Cheers,

Jorge.

> -----Original Message-----
> From: owner-oz-users@ps.uni-sb.de [mailto:owner-oz-users@ps.uni-sb.de]
On
> Behalf Of Luis QUESADA
> Sent: Sunday, October 05, 2003 4:32 PM
> To: users@mozart-oz.org
> Subject: Re: how to create a disjonctive constraint with a variable
number
> of litterals
>
>
>
> Arbi Amel wrote:
> > Hello,
> >
> > I am a student in computer science, my search domain is the
constraint
> > programming, and I am working with the OZ Language, ,
> >
> > I would know how to create a disjonctive constraint with a variable
> > number of litterals
> >
> > Example: (x1=value1)or(x2=value2)ou....ou(xn=valueN)
> >
> > %in this case the number of litterals is N.
> >
>
> I think you can use Combinator.'or'
> (http://www.mozart-
> oz.org/documentation/system/node44.html#chapter.combinator)
> for implementing the procedure that you need. A possible
implementation
> of this procedure could be:
>
> proc {DisConstraint Variables Values}
> fun {MakeProcs Variables Values L1#L2}
> case Variables of nil then L2=nil L1
> [] X|Xs then
> V|Vs=Values L3 in
> L2=proc {$} X=V end | L3
> {MakeProcs Xs Vs L1#L3}
> end
> end
> L
> in
> thread
> {Combinator.'or' {List.toTuple '#' {MakeProcs Variables Values
> L#L}}}
> end
> end
>
> The following is an example that shows how to use the procedure.
>
> local
> X={FD.decl} Y={FD.decl} Z={FD.decl}
> in
> {DisConstraint [X Y Z] [1 2 3]}
> X\=:1 Z\=:3
> {Browse Y}
> end
>
> Luis
>
> -
> Please send submissions to users@mozart-oz.org
> and administriva mail to users-request@mozart-oz.org.
> The Mozart Oz web site is at http://www.mozart-oz.org/.
> Please send bug reports to bugs@mozart-oz.org.

-
Please send submissions to users@mozart-oz.org
and administriva mail to users-request@mozart-oz.org.
The Mozart Oz web site is at http://www.mozart-oz.org/.
Please send bug reports to bugs@mozart-oz.org.



This archive was generated by hypermail 2b29.