Skip to content

Commit

Permalink
Fix doctests for GLPK verbose output
Browse files Browse the repository at this point in the history
  • Loading branch information
jdemeyer committed Oct 8, 2016
1 parent 3e8450b commit fd7afa8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/sage/numerical/backends/glpk_backend.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,11 @@ cdef class GLPKBackend(GenericBackend):
sage: lp.solver_parameter("simplex_or_intopt", "exact_simplex_only") # use exact simplex only
sage: lp.solve()
glp_exact: 3 rows, 2 columns, 6 non-zeros
GNU MP bignum library is being used
* 2: objval = 2 (0)
* 2: objval = 2 (0)
OPTIMAL SOLUTION FOUND
2.0
sage: lp.get_values([x, y])
[1.5, 0.5]
Expand Down Expand Up @@ -942,6 +947,11 @@ cdef class GLPKBackend(GenericBackend):
sage: lp.add_constraint(x <= test)
sage: lp.set_objective(x)
sage: lp.solve() == test # yes, we want an exact comparison here
glp_exact: 1 rows, 1 columns, 1 non-zeros
GNU MP bignum library is being used
* 0: objval = 0 (0)
* 1: objval = 9.00719925474095e+15 (0)
OPTIMAL SOLUTION FOUND
True
sage: lp.get_values(x) == test # yes, we want an exact comparison here
True
Expand Down Expand Up @@ -1576,6 +1586,8 @@ cdef class GLPKBackend(GenericBackend):
sage: p.add_linear_constraint([[0, 1], [1, 2]], None, 3)
sage: p.set_objective([2, 5])
sage: p.write_lp(os.path.join(SAGE_TMP, "lp_problem.lp"))
Writing problem data to ...
9 lines were written
"""
glp_write_lp(self.lp, NULL, filename)

Expand All @@ -1596,6 +1608,8 @@ cdef class GLPKBackend(GenericBackend):
sage: p.add_linear_constraint([[0, 1], [1, 2]], None, 3)
sage: p.set_objective([2, 5])
sage: p.write_mps(os.path.join(SAGE_TMP, "lp_problem.mps"), 2)
Writing problem data to ...
17 records were written
"""
glp_write_mps(self.lp, modern, NULL, filename)

Expand Down Expand Up @@ -2226,10 +2240,12 @@ cdef class GLPKBackend(GenericBackend):
sage: import sage.numerical.backends.glpk_backend as backend
sage: p.solver_parameter(backend.glp_simplex_or_intopt, backend.glp_simplex_only)
sage: p.print_ranges()
glp_print_ranges: optimal basic solution required
1
sage: p.solve()
0
sage: p.print_ranges()
Write sensitivity analysis report to ...
GLPK ... - SENSITIVITY ANALYSIS REPORT Page 1
<BLANKLINE>
Problem:
Expand Down

0 comments on commit fd7afa8

Please sign in to comment.