Gurobi does not support dividing by variables. However, one can model the expression \(\frac{1}{x}\) by introducing a continuous variable \( z \) and adding the constraint

$$x \cdot z = 1.$$

By the above constraint, \(z = \frac{1}{x}\). Wherever the expression \( \frac{1}{x} \) would appear in the model, the variable \( z \) can be used instead.

In order for the above formulation to work properly and avoid division by \( 0 \), one must provide appropriate bounds for both \(x\) and \(z\). For \(x \in [x^L, x^U]\) with \(x^L>0\), the lower and upper bounds for \(z\) should be \(\frac{1}{x^U}\) and \(\frac{1}{x^L}\), respectively.

Additionally, for Gurobi to solve this reformulation, the NonConvex parameter must be set to 2.

### Further information:

## Comments

0 comments

Article is closed for comments.