Re: PAKCS, problem with module CLPFD

From: Michael Hanus <>
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

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
c=100 ? ;
No more solutions.

I hope that helps.

Best regards,

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

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