-
Notifications
You must be signed in to change notification settings - Fork 258
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
Add method to evaluate SCIP expressions without variables #771
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #771 +/- ##
==========================================
+ Coverage 61.68% 61.77% +0.08%
==========================================
Files 16 16
Lines 3255 3262 +7
==========================================
+ Hits 2008 2015 +7
Misses 1247 1247 ☔ View full report in Codecov by Sentry. |
@Joao-Dionisio What was the context where you needed to evaluate a constant expression? I think these scenarios would be exceedingly rare and should probably be done with other packages. Thoughts @mmghannam ? I'd also recommend changing the name of the function. Something like |
Hey @Opt-Mucca! Yes, the use cases would be very limited. I defined a lambda expression that had pyscipopt's Maybe people doing stuff with numerics, or just trying to check their results by hand would also benefit. Having But for my own work I can just write a function, if you think it doesn't make much sense to add this, we can close the PR :) |
I'm not against it being added if the name is changed. If you have an actual use case for it then it's likely someone else might end up in the same situation. Just find it to be an interesting scenario. |
I'd have to agree with @Opt-Mucca here. The method is not particularly related to SCIP. It also doesn't call the underlying SCIP instance or interact with it in any way. @Joao-Dionisio I just want to understand what did you want to pass to |
@mmghannam I just ended up writing a function that does the same thing, I agree that it doesn't need to be a PySCIPOpt method. As for additional context, I have this But yeah, I think this PR can be closed, as a standalone function does the same thing and the usage is so limited. |
This came up in my work, I don't know if there's a better way to do this.
model.getVal()
doesn't work, and Python'seval()
can't deal with SCIP's log/exp, etc, so that's why I require a string and useeval()
afterward.It's possible that I made a mistake with the parenthesis, but it seems to be working.
EDIT: What do you think of this, Mo?