-
Notifications
You must be signed in to change notification settings - Fork 261
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
getSols returns empty array #838
Comments
Hello, @cjrodriguez98! Can you please share a minimal reproducible example, something small-ish that yields this error, so that we can try to fix it? |
This comment was marked as outdated.
This comment was marked as outdated.
I could not append the model.cip file, put I paste its content in here. Let me know if you can reproduce it with that. To provide more context I am then performing count on this problem and while I obtain a solCount of 7 the solutions array is empty. |
For counting solutions: Have you simply tried Edit: After talking to a colleague: If you enable the |
Hey @cjrodriguez98! What's normally done to share I see that you have many indicator constraints. After looking at the |
Okay, many thanks @Joao-Dionisio |
Hey @cjrodriguez98! Sorry for taking a while to answer. I cannot reproduce your problem, I'm able to get the solution: Can you tell me which version of pyscipopt you are using? (There is the |
Hello @Joao-Dionisio! Thank you! Yes, I can optimize() and get the solution. But I cannot get the solution array when using count(). I am using pyscipopt 5.0.0 from pyscipopt import Model m = Model() m.count() Thanks in advance! |
Ohh sorry, I didn't read your problem properly :) Yeah, I agree that something is strange. But can you elaborate on what you want to do? I'd never seen the count method, it might be quite old. Can you not achieve what you want with the Looking at the documentation, I'm not even sure why we have the |
No worries! From my understanding the count method it is the equivalent of populate in other commercial solvers. My problem requires that when a solution is found a restriction is added to remove that solution from the solution space so it cannot be part of a larger solution. To explain it breifly we try to find a set of solutions that must be minimal, so we are not interested in bigger sets if they contain the minimal solution therefore the added constraint. But as we add more constraints the problem becomes harder and harder. So with the count method we could encounter all the solutions of certain length at once, instead of finding them one by one. (I do not know if I explained myself) In my expirience scip is doing a fenomenal job finding the correct number of solutions (7) but I cannot get the solutions. Let me know if I could help you in any way or provide more context. Thanks! |
Ah okay, I think I understand what you're trying to do @cjrodriguez98. There would be alternatives if finding solutions 1 by 1 were a possibility (using event handlers, or setting the solution limit to 1 and then looping), but if you want access to all the vertices, then it seems like you do need the I don't think I'll be able to help out much, maybe @Opt-Mucca has some more insights, given your context. |
Hello, @cjrodriguez98! Did you take a look at this page? It says what one needs to do to get the solutions. It also says it only looks at the active variables. However, when disabling presolve with your problem, I get these errors: I don't know what might be causing them. I know this doesn't fix anything, just trying to give you more information :) |
Hey @Joao-Dionisio, Yes, we have risen thin issue, (ELEAVE56) in another page of scip. But yeah, I see that scip is calculating the number of solutions correctly but not returning the solution array. Thanks anyway :) |
Hey @cjrodriguez98! Did you end up getting an answer from that other page of SCIP? |
I'm closing the issue because it's stale, but feel free to reopen if you believe it makes sense! Talking with Mark, it seems that the way the |
Describe the bug
I am trying to use the count feature. I correctly get the number of solutions but when I try to get the solutions an empty array is returned. I know this has previously been addressed in #248 and #549, I can see the merged changes in my sources thats why I am opening this issue.
To Reproduce
The parameters I am ussing.
model.setHeuristics(3)
model.setBoolParam("constraints/countsols/collect", True)
model.hideOutput()
Expected behavior
Retrive an array of solutions.
System
pyscipopt
? Conda installThe text was updated successfully, but these errors were encountered: