Re: Random labeling options for CLPFD

From: Michael Hanus <mh_at_informatik.uni-kiel.de>
Date: Wed, 04 Nov 2015 16:48:32 +0100

Hi Alex,

it is no problem to add this extension to the next release of PAKCS.
There is the disadvantage that this does not work with SICStus Prolog,
but at least you get a reasonable error message from the Prolog system.

Best regards,

Michael

On 11/03/2015 03:54 PM, lausgans_at_gmail.com wrote:
> Hello, Michael.
>
> SWI-Prolog has random_variable(Seed) option which labels variables with=
 random integer values. Unfortunately it is undocumented, but is present =
in swipl code: https://github.com/SWI-Prolog/swipl-devel/blob/master/libr=
ary/clp/clpfd.pl and it was also mentioned in some places, for example: h=
ttps://groups.google.com/forum/#!topic/swi-prolog/BS4EuWwsYpk
>
> I've quickly modified PAKCS like this:
>
> --- curry2prolog/lib_src/prim_clpfd.pl.orig 2015-11-03 17:15:01.00000=
0000 +0300
> +++ curry2prolog/lib_src/prim_clpfd.pl 2015-11-03 17:15:22.00000=
0000 +0300
> _at_@ -63,6 +63,7 @@ translateLabelingOption('CLPFD.All',all)
> translateLabelingOption('CLPFD.Minimize'(DomVar),minimize(DomVar)) :- =
sicsLabel.
> translateLabelingOption('CLPFD.Maximize'(DomVar),maximize(DomVar)) :- =
sicsLabel.
> translateLabelingOption('CLPFD.Assumptions'(Var),assumptions(Var)) :- =
sicsLabel.
> +translateLabelingOption('CLPFD.RandomVariable'(Seed),random_variable(S=
eed)).
>
> sicsLabel :- checkSICStusAndWarn('CLPFD.labeling: labeling options').
> --- lib/CLPFD.curry.orig 2015-11-03 17:16:46.000000000 +0300
> +++ lib/CLPFD.curry 2015-11-03 17:17:10.000000000 +0300
> _at_@ -314,6 +314,7 @@ data LabelingOption = LeftMost
> | Minimize Int
> | Maximize Int
> | Assumptions Int
> + | RandomVariable Int
>
> Seems to work correctly in simple test program. (Not yet tried a new CL=
P.FD library)
> Any chance to see it added to PAKCS? Don't know whether SICStus provide=
s something like this, an error should be generated in case if not.
>
> BTW, same for random_value(Seed) labeling option which defines random d=
omain exploration.
>
> Thank you!
> Alex
> _______________________________________________
> curry mailing list
> curry_at_lists.RWTH-Aachen.DE
> http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
>






_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry



Received on Mi Nov 04 2015 - 16:49:55 CET

This archive was generated by hypermail 2.3.0 : Do Jun 20 2024 - 07:15:13 CEST