Skip to content

Commit ce4a78d

Browse files
author
Release Manager
committed
sagemathgh-38851: src/sage/graphs/generic_graph.py: work around doctest hang One doctest in this file is "hanging" on ARM64 and RISC-V as GLPK tries courageously to solve a MIP. A tweak to the solver options allows this problem to be solved on those two architectures without affecting any others. This is unlikely to solve the general problem, but it may buy us some time. URL: sagemath#38851 Reported by: Michael Orlitzky Reviewer(s): David Coudert
2 parents 5b5b42f + f592087 commit ce4a78d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/sage/graphs/generic_graph.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7543,6 +7543,22 @@ def edge_disjoint_spanning_trees(self, k, algorithm=None, root=None, solver=None
75437543
p.add_constraint(pos[root, c] + BFS[u] <= pos[u, c])
75447544

75457545
# We now solve this program and extract the solution
7546+
7547+
from sage.numerical.backends.glpk_backend import GLPKBackend
7548+
if isinstance(p.get_backend(), GLPKBackend):
7549+
# The MIP approach with GLPK is prone to compiler and
7550+
# optimization-level weirdness on some hardware:
7551+
#
7552+
# * https://github.com/sagemath/sage/issues/34575
7553+
# * https://github.com/sagemath/sage/issues/38831
7554+
#
7555+
# Disabling the presolver manages to perturb reality just
7556+
# enough in the one scenario that we doctest explicitly to
7557+
# "fix" the problem. It's also limited enough in scope
7558+
# that it probably hasn't badly broken some other use
7559+
# case.
7560+
p.solver_parameter("presolve_intopt", False)
7561+
75467562
try:
75477563
p.solve(log=verbose)
75487564
except MIPSolverException:

0 commit comments

Comments
 (0)