[ library(conjunto) | Reference Manual | Alphabetic Index ]
sum_weight(?Svar, ?Var)
Svar is a weighted set domain variable or a weighted ground set and Var a
free variable or a domain variable or an integer which represents the
weight of Svar.
- ?Svar
- A weighted set domain variable or a weighted ground set.
- ?Var
- Term unifying with a domain variable or an integer.
Description
   Svar is a weighted set domain variable or ground set.  Var is the weight
   of Svar.  If Var is a free variable, this constraint is a mean to access
   a set weight and attach it to Var.  If not, the weight of Svar is
   constrained to be equal to Var.  The constraint is delayed and activated
   each time a modification occurs in the domain of Svar or Var.
   Convenient when dealing with packing problems.
Fail Conditions
   Fails if Svar is not a weighted set term or if Var can not represent the
   weight of Svar.
Resatisfiable
   No.
Examples
[eclipse 4]: S `:: {e(a,10), e(b,15)} ..{e(a,10), e(b,15),
                    e(c,20)}, sum_weight(S, W).
S = S{{e(a, 10), e(b, 15)} .. {e(a, 10), e(b, 15), e(c, 20)}}
W = W{[25..45]}
Delayed goals:
        weight_s(S{{e(a, 10), e(b, 15)} .. {e(a, 10),
                   e(b, 15), e(c, 20)}}, W{[25..45]})
yes.
See Also
`:: / 2