Model is infeasible in Gurobi although it has a feasible solution
AnsweredI am attempting to solve a non-convex quadratic optimization problem using Gurobi, but I have encountered an issue. Specifically, I have a specific objective function; however, I am only interested in finding a feasible solution. To do this, I tried two ways:
1- set my specific objective function as the model objective and set the parameter "SolutionLimit" to 1. This works fine, and Gurobi gives me a feasible solution.
2- give Gurobi no objective function (or set the objective to some arbitrary number like 0). In this case, Gurobi returns no feasible solution. The log it prints says:
Optimal solution found (tolerance 1.00e-04)
Warning: max constraint violation (1.5757e+01) exceeds tolerance
(model may be infeasible or unbounded - try turning presolve off)
Best objective -0.000000000000e+00, best bound -0.000000000000e+00, gap 0.0000%
I checked the solution it returned, and it is infeasible. I want the second method to work too. I have attempted to modify the solver parameters (such as "m.ModelSense = GRB.MAXIMIZE," "m.params.MIPFocus = 3," "m.params.NoRelHeurTime = 200," "m.params.DualReductions = 0," "m.params.Presolve = 2," and "m.params.Crossover = 0") in an effort to resolve this issue but have been unsuccessful. Are there any other parameters that I can adjust in order to successfully solve this problem?
-
For the second approach, you get a Warning stating that the solution found is actually infeasible.
Warning: max constraint violation (1.5757e+01) exceeds tolerance
(model may be infeasible or unbounded - try turning presolve off)This can happen for numerically shaky models. As stated in the warning you should try turning off Presolve. Additionally, you could try experimenting with the NumericFocus parameter.
It is possible that your model has some numerical issues. In this case, I would recommend having a look at our Guidelines for Numerical Issues.
Note that often giving a meaningful objective function works better than just solving a feasibility problem for numerically questionable models because the objective function may "lead" the solution process into a direction where numerical issues are not (or less) present.
Best regards,
Jaromił0 -
By adjusting the parameters
m.params.Presolve
to0
andm.params.NumericFocus
to1
,2
, or3
, I was able to alleviate the issue to a certain degree. For less complex instances, these parameter settings may result in a successful solution; however, for more complex instances, the solver is still unable to find a feasible solution, despite the existence of one.
Best,
Samira0 -
Hi Samira,
Since adjusting the specific parameters seems to help, it is very likely that your model has some numerical issues. Please have a look at our Guidelines for Numerical Issues to check whether your model indeed may suffer from any numerical issues.
Please note that for complex models (independent whether they have or have not any numerical issues), finding feasible points most often gets harder when the model size increases. You might want to have a look at the Most important parameters for MIPs to improve the performance. In particular, you might want to experiment with the NoRelHeurTime parameter.
Best regards,
Jaromił0 -
Thank you for your suggestion. I have attempted to implement it by setting the value of "m.params.NoRelHeurTime" to 300 and 600, respectively; however, it did not yield the desired results.
0 -
Then, the only option left is to try to improve the numerical properties of your model. Please follow the instructions in our Guidelines for Numerical Issues.
1
Please sign in to leave a comment.
Comments
5 comments