> I'm looking for a function that count number of objects that belong to a
> specific cluster but I dont know if such function exists.
>
> For example I'm trying to count number of objects in variable Z[i] but
> with Cardinal function I get an error tha says "invalid preceding
> operator == " what does it mean?
> s.t. Proporcion{k in 1..card(CATEGORIAS)}: card({i in ITEMS: k in
> Z[i]}) <= noitems*Porcentaje[k];
You cannot write 'k in Z[i]', because Z[i] is not a set.
Assuming that Z models an indicator function (does it?) of a subset of
some predefined set, which (subset) needs to be found, and Z[i] is a
binary variable, the cardinality of that subset can be expressed as
'sum{i in ...} Z[i]', so you could write your constraint as follows:
s.t. Proporcion{k in 1..card(CATEGORIAS)}:
sum{i in ITEMS: k in ...} noitems * Porcentaje[k] * Z[i];
_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk