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

GAMS eps isn't the same as Numpy EPS #39

Open
jebob opened this issue Aug 2, 2018 · 5 comments
Open

GAMS eps isn't the same as Numpy EPS #39

jebob opened this issue Aug 2, 2018 · 5 comments
Labels

Comments

@jebob
Copy link

jebob commented Aug 2, 2018

GAMS eps is a special value for an arbitrarily a small number [sic] and has all the logic of an infintesimal,

  • eps * 100 == eps
  • eps + 1e-100 == 1e-100

An eps in a GDX is currently converted to np.finfo(float).eps, defined as "The smallest representable positive number such that 1.0 + eps != 1.0." which is about 2.220446049250313e-16 on my machine. This is in line with the python definition but doesn't have the infitesimal properties.

  • np.finfo(float).eps + 1e-100 == np.finfo(float).eps returns True due to floating point error

I propose changing all references to np.finfo(float).eps to np.finfo(float).tiny, which is about 2.2250738585072014e-308 on my machine.

@jebob
Copy link
Author

jebob commented Aug 2, 2018

@jebob
Copy link
Author

jebob commented Jan 1, 2019

Actually, in GAMS eps eq 0, so maybe it should map to zero?

@jebob
Copy link
Author

jebob commented May 13, 2019

The documentation for the embedded code feature shows they map EPS to 0 (default) or 4.94066E-324.

@elainethale
Copy link
Member

@jebob - I think it makes sense to follow what GAMS does and either map to ~1E-300 or 0. I lean toward the former (or explicitly providing the option), because in my experience part of the point of preserving eps values in GDX is to indicate that something is there/something has been calculated rather than is missing. That is, if the default maps eps to 0, that information (an actual rather than a missing value in the GDX file) may get lost.

@jebob
Copy link
Author

jebob commented Sep 10, 2020

Makes sense to me, I lean towards 1e-300 as well.

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

No branches or pull requests

2 participants