scipopt / PySCIPOpt

Python interface for the SCIP Optimization Suite
https://pyscipopt.readthedocs.io/en/latest/
MIT License
808 stars 252 forks source link

Reformulating constraints to find a best solution #720

Closed trufak closed 1 year ago

trufak commented 1 year ago

Hello! I solve a minlp problem and get the following solution:

SCIP Status : problem is solved [optimal solution found] Solving Time (sec) : 63.00 Solving Nodes : 77 Primal Bound : +6.73426574433289e+08 (2 solutions) Dual Bound : +6.73426574433289e+08 Gap : 0.00 % [linear] : [C] (-9.99999869e-09) -1e+10[B] (-6.92558065e-09) -1e+10[B] (-1e-08) <= 1; ; violation: right hand side is violated by 168.255806437611 best solution is not feasible in original problem

SСIP did not find a solution in the original problem, but reformulated it and got the solution. This solution suits me. Is it possible to reformulate the constraints in the model so as not to waste time searching for a solution to an impossible problem?

Joao-Dionisio commented 1 year ago

Hello again, @trufak! From my experience, this happens when there are numerical issues in your problem. Looking at the constraint in question, it seems to have very different scales and extremely small numbers. e-09, e+10, e-09, e+10, e-08. Maybe I'm misreading the SCIP constraint, but if this is the case, then the precision has to be so high and the disparity between the scales is so big that SCIP won't ever be able to solve this exactly.

But again, I may be misreading the constraint. Can you please share the constraint in terms of the original variables?

trufak commented 1 year ago

I used Big-M relaxation and there was a large coefficient equal to 10**10 in the constraints. I replaced it with a smaller value without compromising the model and this solved the problem. Thanks!