I have an application in which I would like to use SOS II constraints to model a piecewise linear approximation to non-linear function. In particular I have a log(z) term in my objective which I would like to approximate with a piecewise linear function of z, over the interval [zl,zu].
I first specify a set of k breakpoints over [zl,zu]
k=10
zl=10
zu=1000
gridpoints=collect(linspace(log(zl),log(zu),k))
breakpoints=map(exp,gridpoints)
fpoints=map(log,breakpoints)
fpoints is the value of the log function evaluated at the breakpoints. Suppose I would like to maximize log(z). I can set up a model in jump as follows
model = Model(solver=GurobiSolver())
@variable(model, z)
@constraint(model, z<=zu)
@constraint(model, zl<=z)
@variable(model, x[1:k])
addSOS2(model,breakpoints.*x)
#addSOS2(model,x)
@constraint(model,sum(x[i] for i=1:k) == 1) #Convexity Row
@constraint(model, sum(breakpoints[i]*x[i] for i=1:k)==z) #Reference Row
@objective(model,Max,sum(fpoints[i]*x[i] for i=1:k)) #Function Row
solve(model)
getvalue(z)
My question is whether to use addSOS2(model,x) or addSOS2(model,breakpoints.*x)? It is true that x are the variables which need to specified as a specially ordered set of type II, but the documentation for jump specifies that it should be specified with unique weights. In the original paper by Beale and Tomlin the weights are used to determine the branching, and in the paper it says that the weights should be taken as the breakpoints in the reference row.
So which of addSOS2(model,x) or addSOS2(model,breakpoints.*x) is better?