|
From: Marco G. <mar...@un...> - 2009-02-17 09:05:59
|
Marcin Krol wrote:
>> So, your predicate should end like the following:
>>
>> ...
>> S #= sum(X),
>> bb_min(labeling(X),S).
>
> 1st problem:
>
> Thanks to everyone for answers and explanations, but the above generates:
>
> calling an undefined procedure _730 #= sum([_431, _449, _467, _485,
> _503, _521]) in module eclipse
The complete program does work:
:- lib(ic).
:- lib(branch_and_bound).
minsum(X, Range) :-
X = [A,B,C,D,E,F],
X :: 1 .. Range,
integers(X),
alldifferent(X),
S #= sum(X),
bb_min(labeling(X),S,_).
[eclipse 2]: minsum(X,7).
lists.eco loaded traceable 0 bytes in 0.02 seconds
Found a solution with cost 21
Found no solution with cost 6.0 .. 20.0
X = [1, 2, 3, 4, 5, 6]
Yes (0.05s cpu)
Cheers,
Marco
--
Marco Gavanelli, Ph.D. in Computer Science
Dept of Engineering
University of Ferrara
Via Saragat 1 - 44100 Ferrara (Italy)
Tel +39-0532-97-4833
Fax +39-0532-97-4870
http://www.ing.unife.it/docenti/MarcoGavanelli/
|