SOS2 piecewise approximation of u*l in DistFlow: convexity, adjacency, and recommended formulation
AnsweredGood morning everyone,
I'm modeling a DistFlow-type constraint P^2+Q^2=u*l (or in SOC form P^2+Q^2<=u*l), where "u" and “l” are continuous variables (e.g., u is V^2 at the line “from” end and l is I^2). To avoid the bilinear product u*l, I introduce an auxiliary variable w intended to represent that product, i.e., w≈u*l. In my model, w is built via a 2D piecewise approximation on a grid of breakpoints for “u” and for “l” using weight variables nu[i,j] that sum to 1: I enforce u = sum_{i,j} nu[i,j]u_i, l = sum_{i,j} nu[i,j]l_j, and w = sum_{i,j} nu[i,j](u_il_j). To enforce grid adjacency, I use a “linked SOS2 sets” approach: I define xi[i]=sum_j nu[i,j] and eta[j]=sum_i nu[i,j], then I declare SOS2 on xi (with "u" breakpoints) and SOS2 on eta (with “l” breakpoints).
My question is: once I replace the product by w, should the quadratic constraint be written as P^2+Q^2<=w to preserve convexity, or is it valid to enforce P^2+Q^2=w even though w comes from this SOS2 approximation? Also, for this type of nonlinearity (the product u*l and the quadratic constraint), what is the recommended modeling approach in Gurobi in terms of formulation and performance? Finally, is declaring SOS2 in this way sufficient to guarantee the intended adjacency on the grid, and is there any official Gurobi documentation example showing a typical SOS2-based piecewise-linear model and the recommended implementation details? Thank you in advance for your help.
Thank you in advance for your help.
Jorge
-
Hi Jorge,
To avoid the bilinear product u*l, I introduce an auxiliary variable w intended to represent that product, i.e., w≈u*l. In my model, w is built via a 2D piecewise approximation on a grid of breakpoints for “u” and for “l” using weight variables
P^2+Q^2<=u*lis a rotated SOC (RSOC) constraint, butP^2+Q^2<=wis neither SOC or RSOC. You could useP^2+Q^2<=w^2andw^2<=u*lbut now you have a SOC and a RSOC. I don't quite understand the motivation to avoid the bilinear product or introducewhere.once I replace the product by w, should the quadratic constraint be written as P^2+Q^2<=w to preserve convexity, or is it valid to enforce P^2+Q^2=w even though w comes from this SOS2 approximation?
It's valid, but it won't be convex (it defines a circle of radius sqrt(w)) - quadratic equalities are always non-convex and this is independent on what other constraints (PWL or otherwise) that it participates in.
is declaring SOS2 in this way sufficient to guarantee the intended adjacency on the grid, and is there any official Gurobi documentation example showing a typical SOS2-based piecewise-linear model and the recommended implementation details?
I haven't got into the details of your implementation, because I'm currently erring on the side of “it's not needed”, but if you were wanting to use a PWL then we would recommend using our own PWL API rather than defining it from scratch with SOS2, e.g Model.addGenConstrPWL. You can see our section on Piecewise Linear Objectives in the reference manual for a discussion on how we implement it (the same ideas will apply to PWL constraints) and compare to your own approach.
- Riley
0
Please sign in to leave a comment.
Comments
1 comment