Opened 3 years ago

Closed 2 years ago

#20876 closed defect (fixed)

GLPK: glp_exact ignores verbosity level

Reported by: mkoeppe Owned by:
Priority: major Milestone: sage-8.1
Component: packages: standard Keywords: glpk
Cc: fbissey, jdemeyer, dimpase, vdelecroix Merged in:
Authors: Jeroen Demeyer Reviewers: Matthias Koeppe
Report Upstream: Fixed upstream, but not in a stable release. Work issues:
Branch: 4f4fa2c (Commits) Commit: 4f4fa2c11f1d3fed1132f0972bef7262577a6bec
Dependencies: #23596 Stopgaps:

Description (last modified by jdemeyer)

The GLPK exact solver ignores msg_lev and prints a lot of things on the screen while solving (see tests in #20424).

sage: p = MixedIntegerLinearProgram(solver="GLPK/exact")
sage: p.get_backend().set_verbosity(0)
sage: TestSuite(p.get_backend()).run(skip="_test_pickling")
glp_exact: 5 rows, 1 columns, 4 non-zeros
GNU MP bignum library is being used
...

Reported upstream:

  1. http://lists.gnu.org/archive/html/help-glpk/2011-10/msg00037.html
  1. http://lists.gnu.org/archive/html/bug-glpk/2017-08/msg00013.html

Change History (18)

comment:1 Changed 3 years ago by mkoeppe

  • Cc vdelecroix added

comment:2 Changed 3 years ago by fbissey

I am ok with patching but I prefer stuff that is also submitted upstream so we have hope that the functionality will eventually be there (cross fingers).

comment:3 Changed 2 years ago by mkoeppe

  • Description modified (diff)
  • Milestone changed from sage-7.3 to sage-8.0

comment:4 Changed 2 years ago by dcoudert

another example.

sage: p = MixedIntegerLinearProgram(solver="GLPK/exact")
sage: b = p.new_variable(nonnegative=True)
sage: p.add_constraint(b[0]+b[1] == 1)
sage: p.solve(log=0)
glp_exact: 1 rows, 2 columns, 2 non-zeros
GNU MP bignum library is being used
      0:   infsum =                      1   (0)
      1:   infsum =                      0   (0)
*     1:   objval =                      0   (0)
*     1:   objval =                      0   (0)
OPTIMAL SOLUTION FOUND
0.0

However, it's not the only issue with this solver:

sage: for solver in ['Cplex', 'Gurobi', 'Coin', 'PPL', 'GLPK']:
....:     p = MixedIntegerLinearProgram(solver=solver)
....:     _ = p.solve()
....:     
sage: p = MixedIntegerLinearProgram(solver="GLPK/exact")
sage: p.solve()
glp_exact: problem has no rows/columns
---------------------------------------------------------------------------
MIPSolverException                        Traceback (most recent call last)
...
MIPSolverException: GLPK: Solver failure

We also have this with another solver...

sage: p = MixedIntegerLinearProgram(solver="CVXOPT")
sage: p.solve()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
...
TypeError: 'c' must be a dense column matrix

comment:5 follow-ups: Changed 2 years ago by fbissey

Re-reading the summary, is this a deliberate behavior from upstream? If not, ignoring the verbosity level sounds like an upstream bug. In that case I have no problem with going forward with a fix.

comment:6 Changed 2 years ago by dcoudert

I had a look at the code of the backends, but I'm not confident with inheritance. The backend of GLPK/exact inherits from the backend of GLPK and has no specific method modifying the verbosity level. So I don't understand what's going on. However, the doc of the backend suggests that the default behavior is verbose (see after cdef class GLPKExactBackend(GLPKBackend)).

comment:7 in reply to: ↑ 5 Changed 2 years ago by mkoeppe

Replying to fbissey:

Re-reading the summary, is this a deliberate behavior from upstream? If not, ignoring the verbosity level sounds like an upstream bug. In that case I have no problem with going forward with a fix.

I think it is an upstream bug that should be fixed.

Replying to dcoudert: The problem is not in our sage code.

comment:8 in reply to: ↑ 5 Changed 2 years ago by jdemeyer

Replying to fbissey:

Re-reading the summary, is this a deliberate behavior from upstream? If not, ignoring the verbosity level sounds like an upstream bug. In that case I have no problem with going forward with a fix.

+1 to adding a patch in Sage and submitting that patch upstream.

comment:9 Changed 2 years ago by jdemeyer

  • Description modified (diff)
  • Report Upstream changed from N/A to Reported upstream. Developers acknowledge bug.

comment:10 Changed 2 years ago by jdemeyer

  • Authors set to Jeroen Demeyer
  • Dependencies set to #23596
  • Milestone changed from sage-8.0 to sage-8.1

comment:11 Changed 2 years ago by jdemeyer

  • Branch set to u/jdemeyer/glpk__glp_exact_ignores_verbosity_level

comment:12 Changed 2 years ago by jdemeyer

  • Commit set to cc13c4b9fd129cbceb97d937b91f5e51f12690e7
  • Status changed from new to needs_review

New commits:

23102feversion bump. Slight improvement on skg-src. Fix broken doctest.
a72d1afMerge branch 'develop' into glpk4.63
30c496fRemove old libraries before installing. This potential enable downrade in the future.
cc13c4bUse verbosity level in glp_exact

comment:13 Changed 2 years ago by jdemeyer

  • Description modified (diff)

comment:14 Changed 2 years ago by jdemeyer

  • Report Upstream changed from Reported upstream. Developers acknowledge bug. to Fixed upstream, but not in a stable release.

comment:15 Changed 2 years ago by mkoeppe

  • Reviewers set to Matthias Koeppe
  • Status changed from needs_review to positive_review

comment:16 Changed 2 years ago by git

  • Commit changed from cc13c4b9fd129cbceb97d937b91f5e51f12690e7 to 4f4fa2c11f1d3fed1132f0972bef7262577a6bec
  • Status changed from positive_review to needs_review

Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. This was a forced push. New commits:

fecaf01version bump. Slight improvement on skg-src. Fix broken doctest.
baacd6cRemove old libraries before installing
4f4fa2cUse verbosity level in glp_exact

comment:17 Changed 2 years ago by jdemeyer

  • Status changed from needs_review to positive_review

Rebased on new version of #23596.

comment:18 Changed 2 years ago by vbraun

  • Branch changed from u/jdemeyer/glpk__glp_exact_ignores_verbosity_level to 4f4fa2c11f1d3fed1132f0972bef7262577a6bec
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.