> I'm getting an error saying that "argument for abs has invalid type".
> I'm trying to model a load-balancing scenario where 10 weighted
> items are distributed across 3 buckets. I want to minimise the
> difference between each bucket's total weight and the average weight
> of all buckets, so I'm trying to do the following, which is not
> working:
> minimize z: sum{b in BUCKETS} abs(BucketWeight[b] - AveBucketWeight);
You cannot use variables in abs(), because this leads to non-linear
objective not allowed in glpk.
However, in your case the objective is piecewise linear and convex,
so it can be easily reformulated as follows:
var u{b in BUCKETS}; /* auxiliary variable */
s.t. aaa{b in BUCKETS}: u[b] >= BucketWeight[b] - AveBucketWeight;
s.t. bbb{b in BUCKETS}: u[b] >= AveBucketWeight - BucketWeight[b];
minimize z: sum{b in BUCKETS} u[b];
_______________________________________________
Help-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-glpk