Hi everyone, I have two questions:
Many Thanks in advance, Paolo I am modelling a storage facility and need to maximise value from it. The decision maker can change the flows into and from the facility to get as much money as he can We have flows in and flows out, assessed at a different price (allowing for different price is particularly important) and cost. That suggest the use of two variables, one for inflows, the other for outflows. The obj function for 3 timeperiod problem would look like this:
IN and OUT variables are mutually exclusive, i.e. either you put things in or take things out, pxin is the price to buy gas at period x, pxout the price to sell gas. A number of people suggested modelling them like
The 1 in the variables refers to time period 1. Similar constraints can be used for other time periods. I also reckon that use could use as SOS1, although for the moment being I am happy with the formulation above. The problem is that MAXIN1 and MAXOUT1 are not constant but vary according to how much stuff I have got in my storage facility, i.e. inventory, in a nonlinear way. A number of you suggested modelling this based on SOS2. I had a look at this very helpful note http://lists.gnu.org/archive/html/helpglpk/200706/msg00005.html Suppose I want to linearise the relationship according to three knots which don’t change across time. In each time period x, my binaries for the inventory will need to satisfy
For each time period I have
In my case INVx is the sum of IN and OUT up to that point in time. In case of period 3
So I believe that the constraint above would become
This essentially would link my decision variable in the lhs to the linearisation of the x variable in the rhs. To me it makes sense.
Similarly for MAX_IN. There are other constraints which seem straightforward, once again expressed for period 3 0 <= S1,3 <= BINV1,3 0 <= S2,3 <= BINV2,3 Question 1: Is all of this correct? Have I misunderstood/ neglected anything? Question2: assuming that everything is fine (and it may be a big if!) I believe I ended up with a nonlinear constraints again!
Sorry but at this point I feel I have hit a bit of a deadend, as far my skills are concerned, and would appreciate any help, either in the reformulation of the problem above to avoid the nonlinearity or in any way to tackle it Many Thanks Paolo 
You may use SOS1 to linearize the term x2 * bx1, or use big M technique: x1 <= x2 x1 <= M*bx1 where M is at least the largest value x2 could attain. answered 25 May '11, 06:29 gabs Thanks for this  it makes a lot of sense. Thanks again for spending your time on my question Paolo
(26 May '11, 08:13)
RandomOR

Linearization of a product term where one variable is binary can be done by the addition of three sets of constraints and a real variable that denotes: x2*bx1 = z Where x2 is the real continuous variable, bx1 is the binary variable and z is the variable that denotes the product of x2 and bx1. z <= Ubx1 z <= x2 z >= x2  U(1bx1) Where U is the upper bound of x2. Hope this helps answered 26 May '11, 09:33 SandipMax 