how to create a disjonctive constraint with a variable number of litterals
Arbi Amel
arbiamel at yahoo.fr
Tue Nov 4 15:06:06 CET 2003
Hello,
The disjonctive constraint will be injected in an already existing space S.
We have the list of possible variables and their possible values and we want to impose that at least one of the possible value of variable in the list is present in the Root variable of the space S (witch contain the solution).
Example: The list of variable and value:
1 5 : with 1 the number of variable and 5 the value of var 1
2 6
5 10...
The constraint imposes that:
(Root.1=5) or (Root.2=6) or (Root.5=10) or
...
Is it possible to do that with 'combinator.or'?
Cheers,
Amel.
"Jorge M. Pelizzoni" <jorgemp at icmc.usp.br> wrote:
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 at ps.uni-sb.de [mailto:owner-oz-users at ps.uni-sb.de]
On
> Behalf Of Luis QUESADA
> Sent: Sunday, October 05, 2003 4:32 PM
> To: users at 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 at mozart-oz.org
> and administriva mail to users-request at mozart-oz.org.
> The Mozart Oz web site is at http://www.mozart-oz.org/.
> Please send bug reports to bugs at mozart-oz.org.
-
Please send submissions to users at mozart-oz.org
and administriva mail to users-request at mozart-oz.org.
The Mozart Oz web site is at http://www.mozart-oz.org/.
Please send bug reports to bugs at mozart-oz.org.
---------------------------------
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Testez le nouveau Yahoo! Mail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.gforge.info.ucl.ac.be/pipermail/mozart-users/attachments/20031104/88694fda/attachment.html
More information about the mozart-users
mailing list