[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-glpk] minimising after maximising
From: |
Nick Farrell |
Subject: |
[Help-glpk] minimising after maximising |
Date: |
Sun, 5 Jun 2011 12:14:33 +1000 |
I'm pretty new to linear programming and would like a quick tip.
In the script below, what I *want* to happen is that I first choose the worst (ie: max) of x[p] and 3, and then solve for the minimum sum of these values.
ie: I would like z to look like: {1, 2, 3, 3, 3} and then to minimise on the sum of these.
In this artificial example given below, I know I could use the max() preprocessor operator on x[], prior to solving. However, in 'real life' x[] will depend on a collection of variables, and so that won't be available to me. The solver will be moving through the solution space, and at a given point, I want to ensure that z[p] is either x[p] or (say) 3, whatever is greater, but then the overall solution is based on minimising sum z[p]
Thanks for any help.
Nick.
set x := {1, 2, 3, 4, 5};
var z{p in x} >= 0;
s.t. m1z{p in x}: z[p] <= p;
s.t. m2z{p in x}: z[p] <= 3;
maximize zeach{p in x}:
z[p] ;
minimize zmin:
sum{p in x} z[p]; # substituting zeach[p] for z[p] gives a compiler error
solve;
- [Help-glpk] minimising after maximising,
Nick Farrell <=