- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]

From: Michael Hanus <mh_at_informatik.uni-kiel.de>

Date: Fri, 08 Feb 2008 18:28:04 +0100

Steffen Mazanek wrote:

*> I am not sure whether I have understood module CLPFD correctly.
*

*> Consider the following session:
*

*>
*

*> Prelude> :l CLPFD
*

*> Parsing 'CLPFD.curry'...
*

*> CLPFD> domain [x,y,z] 0 100 & labeling [Minimize x, Maximize y,
*

*> Minimize z] [x,y,z]
*

*> Free variables in goal: x, y, z
*

*> Result: success
*

*> Bindings:
*

*> x=0
*

*> y=0
*

*> z=0 ? ;
*

*> No more solutions.
*

*>
*

*> Why is y not bound to 100? Is this a bug or due to wrong usage?
*

*> How can I minimize particular variables and maximize others at the
*

*> same time?
*

Sorry for the insufficient explanation, but PAKCS does not

provide any specific implementation for FD constraints

but just reuses the implementation which is available

in SICStus Prolog. So, look at the documention at

http://www.sics.se/sicstus/docs/latest3/html/sicstus.html/Enumeration-Predicates.html

for more details. As far as I understand, it is not possible

to minimize and maximize several variables at the same time

since the labeling function commits to one solution if

maximize/minimize is used. A solution to your problem is

to define a single variable that represents the overall cost

which should be maximized. For instance, you can define

c=y-x-z and maximize c:

CLPFD> domain [x,y,z] 0 100 & c =# y -# x -# z & labeling [Maximize c] [x,y,z]

Free variables in goal: x, y, z, c

Result: success

Bindings:

x=0

y=100

z=0

c=100 ? ;

No more solutions.

I hope that helps.

Best regards,

Michael

_______________________________________________

curry mailing list

curry_at_lists.RWTH-Aachen.DE

http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry

Received on Fr Feb 08 2008 - 18:58:48 CET

Date: Fri, 08 Feb 2008 18:28:04 +0100

Steffen Mazanek wrote:

Sorry for the insufficient explanation, but PAKCS does not

provide any specific implementation for FD constraints

but just reuses the implementation which is available

in SICStus Prolog. So, look at the documention at

http://www.sics.se/sicstus/docs/latest3/html/sicstus.html/Enumeration-Predicates.html

for more details. As far as I understand, it is not possible

to minimize and maximize several variables at the same time

since the labeling function commits to one solution if

maximize/minimize is used. A solution to your problem is

to define a single variable that represents the overall cost

which should be maximized. For instance, you can define

c=y-x-z and maximize c:

CLPFD> domain [x,y,z] 0 100 & c =# y -# x -# z & labeling [Maximize c] [x,y,z]

Free variables in goal: x, y, z, c

Result: success

Bindings:

x=0

y=100

z=0

c=100 ? ;

No more solutions.

I hope that helps.

Best regards,

Michael

_______________________________________________

curry mailing list

curry_at_lists.RWTH-Aachen.DE

http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry

Received on Fr Feb 08 2008 - 18:58:48 CET

*
This archive was generated by hypermail 2.3.0
: Fr Jan 24 2020 - 07:15:06 CET
*