• Gurobi Staff

Hi Ye,

Gurobi variables cannot be directly used in arbitrary math functions, you have to use general constraints to deal with non-linear/non-quadratic terms. You might need to re-formulate your function and/or introduce helper variables to be able to use the general constraints.
Note that complex function constraints are approximated by piecewise linear functions.

Best regards,
Mario

Did you know by any chance the approximation of normal distribution? I have been looking it up and found all of them involve division. Since Gurobi cannot divide decision variables, I guess there is no way to formulate the model..

Also, did you know if Gurobi can control the number of violated constraints? For example, I have 100 constraints, I want to optimize as long as any 99 of the constraints are satisfied.

Thanks,

Ye

• Gurobi Staff

Hi Ye,

Sorry, I am not too much into the theory of normal distributions.

Regarding modeling divisions: Sometimes, the divisions can be reformulated such that they can be handled in Gurobi. For example, by introducing an artificial variable z and an according equation: a / b = z. This can be reformulated to a = z * b.

What you could do is to use the feasibility relaxation, but it is not obvious how to control the number of violated constraints with this. Alternatively, you can model this manually, e.g., by introducing a slack variable for each of the constraints modeling the amount of violation. Then, you create an SOS1 constraint with those slack variables, stating that at most 1 of those variables is allowed to be non-zero.

Best regards,
Mario