# Gurobi C++ - how to divide variables

How do I divide a variable by another variable?

For example, if I have a variable max, and a variable $$\sum\sum X_{ij}$$, what I want to do is max divided by $$\sum\sum X_{ij}$$.

But the question is that Gurobi does not have "division" system. What can I do in this situation?

• First, I suggest not using "max" as a variable name in the question. It will likely cause some confusion. Second, the answer will depend on whether any of the variables are binary (or perhaps integer) as opposed to continuous.
– prubin
May 27 at 14:48

If your objective function is $$\max \frac{x}{z}$$, you can add a constraint $$x = zy$$, then set the objective function to $$\max y$$.