scipopt / PySCIPOpt

Python interface for the SCIP Optimization Suite
https://scipopt.github.io/PySCIPOpt
MIT License
779 stars 250 forks source link

Solve MINLP with SCIP #775

Closed uvutna closed 6 months ago

uvutna commented 6 months ago

Describe the bug I'm using CVXPY with solver SCIP to solve mixed integer nonlinear programming problems (MINLPs). I have a problem with a constraint that contains log function.

My constraint is as below:

for k in range(A):
   temp1 = 0
   for b in range(B):
       temp2 = 0
       for i in range(C): 
           temp2 += p[i,k,b]*z[(i,k,b)]
       temp1 += W*(cp.log(1+ temp2))
   constraint.append(temp1 >= R * x)

Expected behavior If I comment that constraint, it can compile, solve my problem and show status whether it is feasible or not 30ed4b7a5146fa18a357

If I keep it, CVXPY doesn't compile my problem and shows non_feasible immediately

971e716d6e51c50f9c40

I also test with another solver and it is feasible

System

Joao-Dionisio commented 6 months ago

Good morning, @uvutna!

Have you imported the log function from pyscipopt? Usually you would have something like this in your file:

from pyscipopt import Model, log

Just be careful that this is the natural logarithm, and you might need to do some basis change.

I've never done constraints the way you are doing (with constraint.append), so I'm unsure whether that might also be a problem.

EDIT: Oh, my bad, I misread your issue, you aren't actually using pyscipopt. I think this is more of a SCIP issue than a PySCIPOPt issue. I recommend sending an e-mail here: http://listserv.zib.de/mailman/listinfo/scip/

If you could, maybe attaching your problem in the e-mail would definitely be helpful. Without knowing more about it, maybe it's a problem with floating point arithmetic? Sorry for not being able to help out more, but the SCIP guys definitely will be able to.

Opt-Mucca commented 6 months ago

I don't think this is a PySCIPopt issue. @uvutna should raise this as an issue with cvxpy.

If I've understood the output correctly, then SCIP has not even been called at at the time of failure. The failure may also be because the instance is simply infeasible.