Glpk-Sos2 02
Glpk-Sos2 02
GLPK GNU Linear Programming Kit A note on modeling piecewise linear functions in GLPK
t 1 , t 2 , , t n 0
t 1 t 2 t n = 1
only two adjacent variables,
ti
and potentially
t i1 , can be non-zero.
y = f x
specified by its
node points
x 1 , y 1, x2 , y2 , , x n , y n
as shown below.
(xn , yn )
x
The standard description using an SOS2 constraint is the following:
x = x 1 t 1 x2 t 2 xn t n
y = y1 t 1 y2 t 2 y n t n
SOS2:
{ t 1 , t 2 , , t n }
t 1 , t 2 , , t n
The implementation of SOS2 constraints within the simplex method assumes an additional rule to choose the variable to enter the basis. Namely, if t i is basic, only t i1 or t i1 can be basic, while all other SOS2 variables have to be non-basic (and therefore fixed at zero).
2
However, since the set of feasible solutions may be non-convex, such a version of the simplex method enables only a local optimum to be obtained. Modeling piecewise linear functions in GLPK: SOS2 constraints are not implemented in GLPK, but a piecewise linear function can be easily modeled using binary variables as follows. Let
z 1 , z 2 , , z n1
z i {0,1} , where:
si :
zi = 1
means that
xi x xi1
and
yi y yi1
then, with
s1 , s 2 , , s n 1
z 1 z 2z n1 = 1
0 si zi
for
i = 1, 2 , , n1
x = y =
x 1 z1 x2 z2 xi zi
x 2 x1 s1 x 3x 2 s 2 x i1 xi si
y n1 z n1 yn y n1 s n1
The main advantage of this description is that the MIP solver is always able to find a global optimum. Modeling SOS2 constraints in GLPK: if necessary, SOS2 constraints can be modeled independently when modeling a piecewise linear function thus, Let
z 1 z 2 z n1 = 1 0 si zi
for
i = 1, 2 , , n1
t1 t2 ti t n1 tn
= z1 s1 = z 2 s2 s 1 = z i si si1 = z n1 sn1 s n2 = s n1
means that only
where
potentially
_____
ti
and
Copyright : 2008 Robbie Morrison. All rights reserved. License : Unrestricted reuse in any form, for any purpose. Filename : glpk-sos2_02.odt|pdf Last mod : 23-Dec-2008