Formulation help
AnsweredI have a midsized stochastic program that's experience longer runtimes than I'd like. I'm simplifying some notation, but the crux of my problem is: I have a known entity, d, and nonnegative variables, x and l. I have some simple constraints x <=d and x<= l, and then x = min(l, d). The minimum is there to keep things consistent across scenarios in my model, so it's needed. In effect what it does is when x << d, it sets l = x. I was toying around with using a quadratic constraint to approximate this as follows: l <= x + 1/(d-x) or equivalently (l-x)(d-x) <= 1, so when x << d the constraint relaxes and allows l > x. Arguably, we could replace the 1 with an arbitrary constant for tuning. Unfortunately, this is nonconvex. I was wondering if your team might have a suggestion on something else to try.
-
Hi Nick,
Using a quadratic expression is likely a step in the wrong direction. You could use Gurobi's "MIN" function - in gurobipy this is addGenConstrMin, or you could introduce a binary variable y and use the following set of constraints
x <= l
x <= d # better as an upper bound, rather than constraint
x >= d*y
x >= l - y*l.ubwhere l.ub is an upper bound on l.
Note that if your objective function naturally causes the x variable to want to be as large as possible then you will only need the first two of these constraints.
- Riley
0
Please sign in to leave a comment.
Comments
1 comment