Opened 6 years ago
Last modified 6 years ago
#18764 closed enhancement
Add glp_exact to Sage's GLPK bindings — at Version 4
Reported by:  mkoeppe  Owned by:  

Priority:  minor  Milestone:  sage6.8 
Component:  numerical  Keywords:  lp 
Cc:  yzh, dimpase, ncohen  Merged in:  
Authors:  Reviewers:  
Report Upstream:  N/A  Work issues:  
Branch:  u/mkoeppe/add_glp_exact_to_sage_s_glpk_bindings (Commits, GitHub, GitLab)  Commit:  1ec429b9715686740a905465a7d1f6a0def5f899 
Dependencies:  Stopgaps: 
Description (last modified by )
The function glp_exact provides access to an implementation of the simplex method in exact rational arithmetic (using GMP).
The only access to data is via doubleprecision floats, however. It reconstructs rationals from doubles and provides results as doubles using the standard API functions of GLPK.
On the Sage side, since the combinatorial basis information is available via get_col_stat, get_row_stat, one could then reconstruct the rational solution. See #18735.
(Direct access, using GMP rationals, would be possible through the header file glpssx.h; see ticket #18765.)
Change History (4)
comment:1 followup: ↓ 2 Changed 6 years ago by
comment:2 in reply to: ↑ 1 Changed 6 years ago by
Hi Dima,
Replying to dimpase:
copying from a comment on another ticket:
I don't think using nonpublic nondocumented features is a good idea. Next version would break them, and we'd be stuck with maintaining a fork... Perhaps we have to find a way first to make GLPK folks finally address the public need of making these things public?
I share your concern about the nonpublic functions, which is valid for the other ticket (#18765), but *not* for this ticket.
glp_exact is a documented API function.
There's just no way to feed the problem using exact data, or to retrieve the solution using exact data. However, if the problem can be expressed using small integers (<= 53 bits) that are represented exactly by double floats, then the rational reconstruction that GLPK does should be exact. The Sage code could refuse, or warn, if this is violated.
And we can access the combinatorial information about the basis on the Sage side and compute the basic solution using exact arithmetic.
comment:3 Changed 6 years ago by
 Branch set to u/mkoeppe/add_glp_exact_to_sage_s_glpk_bindings
comment:4 Changed 6 years ago by
 Commit set to 1ec429b9715686740a905465a7d1f6a0def5f899
 Description modified (diff)
 Status changed from new to needs_review
Needs review.
New commits:
1ec429b  Have solve call glp_exact if requested by solver parameter simplex_or_intopt

copying from a comment on another ticket:
I don't think using nonpublic nondocumented features is a good idea. Next version would break them, and we'd be stuck with maintaining a fork... Perhaps we have to find a way first to make GLPK folks finally address the public need of making these things public?