Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCIP reports OPTIMAL_INACCURATE solution, eventhough no solution has been found #2050

Closed
Old-Shatterhand opened this issue Feb 22, 2023 · 10 comments

Comments

@Old-Shatterhand
Copy link

Hi,

Describe the bug
I'm trying to solve some DQCPs with SCIP but I encounter some "unintuitive" behavior. SCIP reports having found an optimal_inaccurate solution, even though nothing has been found.

To Reproduce
This file contains the python code to produce the error. I had to rename it to .txt as .py is prohibited by github. To execute it, rename it to .py and run it in a python environment with cvxpy and numpy installed.

Expected behavior
In the following, I'm talking about the _solve method in scip_conif.py (link) and especially about lines 347 to 350.
The program is terminated due to reaching the maximal time, i.e., model.getStatus() is 'timelimit'. At the same time model.getNSols() and model.getNCountedSols() are both 0, i.e. no solution has been found at all. I expect the cvxpy to report accordingly and set solution["status"] to be some constant indicating that no solution has been found. I suggest setting solution["status"] = s.SOLVER_ERROR as the solver hasn't found a solution and we cannot know if the program is even feasible.

Output
This file contains the program output produced by the code linked above.

Version

  • OS: Windows 11 and Rocky Linux (error was produced on both systems)
  • CVXPY Version: 1.2.2
  • NumPy Version: 1.22.3

Additional context
Nothing.

Thank you in advance for your help.

Best, Roman

@Old-Shatterhand
Copy link
Author

A minor update: If I run the program with MOSEK instead of SCIP, I don't get the error. But because MOSEK is proprietary and SCIP is not, I really would like to stick to SCIP.

@phschiele
Copy link
Collaborator

@Old-Shatterhand I agree, for timelimit, the status should be mapped to s.OPTIMAL_INACCURATE only if at least one solution was found.

@Transurgeon
Copy link
Contributor

Hey @Old-Shatterhand, I was wondering if you help me reproduce the bug?
I am running into some blockers when installing SCIP. (pip install pyscipopt is not working... and I think it is because I haven't installed the SCIP optimisation suite).
I was wondering if you could help me install SCIP (I am not particularly familiar with CMake)?

Also I was wondering how the solver could report an s.OPTIMAL_INACCURATE status if model.getNCountedSols() is = 0?
This is the section I am referring to: (line 349-350)
if solution["status"] == s.SOLVER_ERROR and model.getNCountedSols() > 0:
solution["status"] = s.OPTIMAL_INACCURATE

@Old-Shatterhand
Copy link
Author

Hey @Transurgeon,

I didn't encounter that bug. Have you tried setting up a fresh, new, clean conda-environment and execute pip install pyscipopt?

Regarding your second comment: I don't understand what you mean.
HOW the solver reports optimal_inaccurate despite finding no solution: Well, you see the code, it is just done.
WHY it is done: I don't know, I didn't understand that decision as well, but in big projects that might happen. When I opened that issue, I suggested an improvement/bug fix which was approved by the developers (as you can see in the discussion on this issue).

I hope I could help you, if not, please let me know.

Best, Roman

@Transurgeon
Copy link
Contributor

Hello Roman,
I might be missing something obvious, but I was asking why does this line get called:
solution["status"] = s.OPTIMAL_INACCURATE
if the statement in the if (solution["status"] == s.SOLVER_ERROR and model.getNCountedSols() > 0) is clearly false, because of model.getNCountedSols() = 0?

@Old-Shatterhand
Copy link
Author

Hi @Transurgeon ,
Sorry, now I understand what you mean, it's been a while since I faced that issue. The actual problem ist, that in line 348 solution["status"] is Set to OPTIMAL_INACCURATE, (see line 46 for resolving the STATUS_MAP).

Could you solve your installation issue? Then, you can execute my example file and see it yourself.

Best, Roman

@Transurgeon
Copy link
Contributor

Hey @Old-Shatterhand, thanks for your fast reply. Now I understand what is the issue, I didn't know that the status was being set on line 46, I thought it was line 350 (looking through the snippet on first glance).
Would a simple if statement to check the number of solutions and time-limit has been exceeded do the job, what do you think?

I tried your method of using a new conda environment, but I am still running into some issues while trying to install pysciopt.. I'll get back to you if I am able to download SCIP.

@Old-Shatterhand
Copy link
Author

Hey @Transurgeon ,

I don't know how to properly fix this issue. Your suggestion is definitely a hot-fix. Either the statement in line 348 is the bug or a symptom of a bug.

Best, Roman

@SteveDiamond
Copy link
Collaborator

FYI we are going to fix the bug you have pointed out in the SCIP interface. Hopefully this week.

@SteveDiamond
Copy link
Collaborator

Fixed in master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants