:- use_module(library(clpb)).
sum(Weight_i*V_i)
over
all admissible assignments. On backtracking, all admissible assignments
that attain the optimum are generated.
This predicate can also be used to minimize a linear Boolean program, since negative integers can appear in Weights.
Example:
?- sat(A#B), weighted_maximum([1,2,1], [A,B,C], Maximum). A = 0, B = 1, C = 1, Maximum = 3.