-
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
Precision errors when converting python floats to SCIP_REALs #794
Comments
The number |
Hey @leoneifler, thanks for looking into this! That is true, but at least in Python the precision is much higher: In this PR we reverted manual variable typing, which seems to be the cause for this. See here: Me and Mo discussed this yesterday, we have a feeling it might be due to calls to I have encountered this behavior in other circumstances as well, that's why I haven't created a PR. Does this all seem reasonable, Leon? What do you think? |
Just for interest, I would like to ask what the actual reason for this was. It looks like a reversion is considered as a fix. Maybe it makes sense to try |
Oh, hey @DominikKamp! Yeah this was pretty old, and I couldn't reproduce it anymore, I think the "fix" was just what you described. And thanks for the tip, SCIP_Real is definitely possible to use in PySCIPOpt. I'll test this out over the coming days. |
Did it work? |
Hey @DominikKamp! Yeah, I forgot about this. Just added a bunch of types and the tests pass and the above example also works, but it's difficult to know whether some other thing might go wrong. I'll also add some types to the inputs, these shouldn't be controversial, I suppose. I'll create a PR by the end of this morning. |
It is not urgent, I just thought some easy performance would be nice for the next release, but maybe it is more involved. |
The performance gain should be quite small, as it only affects model creation for most people (and then some stuff on the callbacks, but again somewhat minimal gain). But yeah, I think it makes sense to do this, even if just to justify my inclusion in the release report :D |
Conversion of Python types to C types sometimes yields precision errors. It's not clear to me when and why this happens.
The values stay correct right up the call to
SCIPchgVarObj
in L1347Interestingly, if we set the objective at variable creation, the same doesn't happen.
System
pyscipopt
? SourceThe text was updated successfully, but these errors were encountered: