Oz and Mozart Hackers Mailing List

Re: FD.choose


From: Christian Schulte (schulte@imit.kth.se)
Date: Mon Jun 03 2002 - 12:21:16 CEST


Can you please send the diff?

Thanks
Christian

"Luis Quesada" <luque@info.ucl.ac.be> wrote in message
news:<3CF79A8A.62D6E9C7@info.ucl.ac.be>...
> Dear hackers:
>
> There is a bug in FD.choose. The following piece of code reproduces
> the
> bug:
>
> {Space.new
> proc {$ Root}
> Root=[{FD.decl}]
> E S
> in
> {FD.choose ff Root E S}
> {Browse E#S}
> end _}
> %********************** error in application ********************
> %**
> %** Application of non-procedure and non-object
> %**
> %** In statement: {size '#'(_{0#134217726}) _<optimized>}
> %**
> %** Call Stack:
> %** procedure 'FdChoose' in file
> "/pirates/staff1/luque/Oz/mozart/source/mozart/share/lib/cp/FD.oz",
line 550, column 6, PC = 5551288
> %**--------------------------------------------------------------
>
> Note that the following example (even though it is equivalent) does
> not have that problem.
>
> {Space.new
> proc {$ Root}
> Root=[{FD.decl}]
> E S
> in
> {FD.choose generic(procedure:proc {$} skip end) Root E S}
> {Browse E#S}
> end _}
>
> After having a look at FD.oz, I realized that the problem is because
> of the following lines (FdChoose, lines 555 556):
>
> V={SelVar {MakeDistrTuple Vec}}
> D={SelVal V}
>
> Both Selvar and SelVal are used as procedures, but they are atoms.
>
> To correct the situation (in my local version) I modified FdChoose in
> this way:
>
>
> proc {FdChoose RawSpec Vec ?V ?D}
> {Space.waitStable}
> try
> case {PreProcessSpec RawSpec}
> of opt(value:Value order:Order) then
> case {Filter {VectorToList Vec} GenSelFil.undet} of nil
then
> raise ~1 end
> [] X|Xr then
> V={Choose Xr X GenSelVar.Order}
> D={SelVal.Value V}
> end
> [] gen(value: SelVal
> order: Order
> select: Select
> filter: Fil
> procedure: _)
> then
> case {Filter {VectorToList Vec} Fil} of nil then
> raise ~1 end
> [] X|Xr then
> V={Select {Choose Xr X Order}}
> D={SelVal V}
> end
> end
> catch ~1 then
> {Exception.raiseError
> fd(noChoice 'FD.choose' [RawSpec Vec V D] 2
> 'Vector must contain non-determined elements.')}
> end
> end
>
> Is that ok?
>
> Luis
>
> --
> Catholic University of Louvain
> Department of Computing Science and Engineering
> Place Sainte Barbe, 2
> B-1348 Louvain-la-Neuve, Belgium
> Phone: (++32) (10) 47 90 13
> Fax: (++32) (10) 45 03 45
> Web: http://www.info.ucl.ac.be/~luque
>
>
>
> -
> Please send submissions to hackers@mozart-oz.org
> and administriva mail to hackers-request@mozart-oz.org.
> The Mozart Oz web site is at http://www.mozart-oz.org/.

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



This archive was generated by hypermail 2b29.