In the following, each CLP(B) predicate is described in more detail.
We recommend the following link to refer to this manual:
http://eu.swi-prolog.org/man/clpb.html
A common form of invocation is sat_count(+[1|Vs], Count)
:
This counts the number of admissible assignments to Vs
without imposing any further constraints.
Examples:
?- sat(A =< B), Vs = [A,B], sat_count(+[1|Vs], Count). Vs = [A, B], Count = 3, sat(A=:=A*B). ?- length(Vs, 120), sat_count(+Vs, CountOr), sat_count(*(Vs), CountAnd). Vs = [...], CountOr = 1329227995784915872903807060280344575, CountAnd = 1.
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.