Re: [eclipse-clp-users] basic problem

From: Thorsten Winterer <thorsten_winterer_at_...126...>
Date: Mon, 16 Feb 2009 16:32:36 +0100
Marcin Krol schrieb:
> Wit Jakuczun wrote:
>   
>>    I am afraid but there is no bb_min/2 defined.
>> The min arity is 3. Try to run your code
>> with bb_min(sum(X,S), S, bb_options{strategy:continue}).
>>     
>
> Thanks for answer, I figured that out a moment after I sent that mail, 
> but now I have a different problem:
>
> instantiation fault in +(0, _431{1 .. 9}, _839)
>
>
> (     bb_min(sum(X,S),S,bb_options{strategy:continue}), )
>   

sum/2 sums up the (ground) expressions in list X. What you want is the
*constraint* sumlist/2.

Also, bb_min searches for a minimal solution in a search tree, as
defined by a search goal.
sum(X,S) is not a search goal. Neither would be sumlist(X,S).
labeling(X) is a search goal.

So your code should read:

    [...]
    sumlist(X, S),
    bb_min(labeling(X), S, bb_options{strategy:continue}).


Cf. bb_min/3 help:

bb_min(+Goal, ?Cost, ?Options)

   Find a minimal solution using the branch-and-bound method

Arguments
   Goal                The (nondeterministic) search goal
   Cost                A (usually numeric domain) variable representing
the cost
   Options             A bb_options structure or variable


Cheers,
Thorsten
Received on Mon Feb 16 2009 - 15:51:02 CET

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