Re: [eclipse-clp-users] Why minimize predicate does not provide solutions sorted after the value of the cost function.

From: Thorsten Winterer <thorsten_winterer_at_...126...>
Date: Mon, 15 Mar 2010 15:58:43 +0100
Am 15.03.2010 14:23, schrieb Bogdan Tanasa:
> Hello,
>
> I have a case when I am asking the eclipse solver to minimize the sum
> of some variables and the following situation occurs:
> solution1: cost 208508
> solution2: cost 208452
> solution3: cost 209180
>
> What could be the possible reasons for this behavior?
>
> PS: attached there is code for my problem.
>
> BR,
> Bogdan. 

minimize/2 minimizes the sum for you current settings. For the first
settings, as determined by fetchVal/3, minimize/2 computes a solution
with cost 208508.

When you ask for another solution, your program will backtrack into
fetchVal/3, changing the settings. When minimize/2 is then called again,
the first solution is actually forgotten. That the second solution is
lower that the first is incidental. Likewise for the third.

If you want to find the globally optimal solution, you need to put
fetchVal/3 (or even init/9, since that seems to be non-deterministic,
too) into the goal that is called inside minimize/2.

Cheers,
Thorsten
Received on Mon Mar 15 2010 - 15:12:47 CET

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST