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

Filter small coefficients and handle numerical precision #104

Open
DillonJ opened this issue Jun 1, 2023 · 0 comments
Open

Filter small coefficients and handle numerical precision #104

DillonJ opened this issue Jun 1, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@DillonJ
Copy link
Contributor

DillonJ commented Jun 1, 2023

Sometimes models can have small coefficients that may as well be zero but aren't quite. An almost-zero coefficient might have negligible impact on a model solution but might impact run time significantly. There is value in eliminating these as solvers make use of sparse matrix methods extensively.

Additionally, in printed outputs from Julia, I am constrantly seeing things like this: 0.050000000000000003. The value specified was 0.05 but somewhere, numerical precision issues are resulting in this value being slightly imprecise. We have seen this happen with zeroes/non-zeroes too... a value that should be zero somehow ends up being very small instead.

Here is another related issue: spine-tools/SpineOpt.jl#585

In summary, I think we should filter and/or round coefficients before they are sent to the solver to make maximum use of zeroes.

Perhaps two arguments could be specified in the "using_spine_db" function. One would be the lowest absolute value and any float (whether scalar or in a timeseries or map) with an absolute value of less, is treated as zero. The second argument could be a global precision argument that rounds all floats to that level of precision.

Thoughts @manuelma? I would at least like to test this as I suspect it could have a big impact on some models.

@DillonJ DillonJ added the enhancement New feature or request label Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant