[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Can't use variable within abs()?
From: |
glpkuser |
Subject: |
Re: [Help-glpk] Can't use variable within abs()? |
Date: |
Mon, 27 Aug 2007 17:56:29 -0700 (PDT) |
Andrew Makhorin wrote:
>
>> 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];
>
>
Thank you for your help. I'm a beginner with linear programming and O.R.;
could you point me to a reference where I can find more info on piecewise
linearity and convex-ness with respect to re-formulating or fixing
non-linear models? For example, would the Winston book on Operations
Research have it?
--
View this message in context:
http://www.nabble.com/Can%27t-use-variable-within-abs%28%29--tf4338967.html#a12360372
Sent from the Gnu - GLPK - Help mailing list archive at Nabble.com.