Skip to content

Conversation

ed359
Copy link
Contributor

@ed359 ed359 commented Jun 14, 2023

📚 Description

The GLPK/exact linear programming (LP) backend isn't exact because rationals are converted to doubles to be passed to the backend. This means that, despite solving LPs exactly over the rationals, the solver can silently solve a rounded version of your LP. For example, coefficients of 1/3 are handled incorrectly as they are rounded to some 0.3333333ish number that fits in a double-precision float.

This PR simply expands the relevant documentation to explain more carefully that this can lead to problems. Fixes #35727.

The modified files lie in the src/ subdirectory, are changes required to files with the same relative path under such as /build/pkgs/sagemath_environment/..., build/pkgs/sagemath_repl/..., and pkgs/sagemath-repl/...?

📝 Checklist

  • The title is concise, informative, and self-explanatory.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation accordingly.

⌛ Dependencies

@ed359 ed359 force-pushed the docfix-GLPK-exact branch from eeee40b to cc95b9e Compare June 14, 2023 19:51
@mkoeppe
Copy link
Contributor

mkoeppe commented Jun 14, 2023

re changes required to files with the same relative path under such as /build/pkgs/sagemath_environment/..., build/pkgs/sagemath_repl/..., and pkgs/sagemath-repl/...?

No, these are just symlinks that eventually lead to src/sage

The only access to data is via double-precision floats, however. It
reconstructs rationals from doubles and also provides results
as doubles.
The only access to data is via double-precision floats, which
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the extra indent? maybe you want a .. note::?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A simple mistake, fixed and force-pushed.

@ed359 ed359 force-pushed the docfix-GLPK-exact branch from cc95b9e to 7b4046c Compare June 14, 2023 20:22
@github-actions
Copy link

Documentation preview for this PR (built with commit 7b4046c) is ready! 🎉

Copy link
Contributor

@mkoeppe mkoeppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This is a nice improvement.

@vbraun vbraun merged commit 8f46a63 into sagemath:develop Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GLPK/exact isn't exact on simple, rational LPs
3 participants