|
From: Thorsten W. <tho...@we...> - 2009-02-16 15:51:02
|
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
|