Modeling variable multiplication and/or divisions
回答済みHi,
My optimization model contains constraints with variable multiplications and divisions. For example, I want to add constraints like below:
mdl.addConstr(x/y >= (1/z) + epsilon)
mdl.addConstr(x/(2x-y) >= z + epsilon)
Here x, y, z all are continuous variables. How do I model constraints like this?
-
The Knowledge Base article How do I divide by a variable in Gurobi? discusses the implementation of division of two optimization variables.
Gurobi natively supports the multiplication of two optimization variables.
For the particular two constraints you have shown, as long as \(z>0, y > 0\), and \(2x -y > 0\), you can formulate your constraints as
\[\begin{align*}
x\cdot z &\geq y + \epsilon \cdot y \cdot z\\
x &\geq 2\cdot x \cdot z - y \cdot z + 2\cdot \epsilon \cdot x - \epsilon \cdot y
\end{align*}\]If one of the variables is negative, you would have to adjust the sense of the constraints.
Note that it is crucial that \(z \neq 0, y\neq 0\), and \(2x -y \neq 0\) for all values of \(z,x,y\) to avoid singularities.
Moreover, it is strongly recommended to provide tight bounds for all variables participating in a nonlinear term. This is because, the relaxation of nonlinear terms depends on variable bounds. For more details, I recommend having a look at our Non-Convex Quadratic Optimization webinar and Non-Convex Tech Talk.
0
サインインしてコメントを残してください。
コメント
1件のコメント