Skip to content

Commit f592087

Browse files
committed
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. Closes sagemath#34575 Closes sagemath#38831
1 parent 7726cd9 commit f592087

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
@@ -7358,6 +7358,22 @@ def edge_disjoint_spanning_trees(self, k, algorithm=None, root=None, solver=None
73587358
p.add_constraint(pos[root, c] + BFS[u] <= pos[u, c])
73597359

73607360
# We now solve this program and extract the solution
7361+
7362+
from sage.numerical.backends.glpk_backend import GLPKBackend
7363+
if isinstance(p.get_backend(), GLPKBackend):
7364+
# The MIP approach with GLPK is prone to compiler and
7365+
# optimization-level weirdness on some hardware:
7366+
#
7367+
# * https://github.com/sagemath/sage/issues/34575
7368+
# * https://github.com/sagemath/sage/issues/38831
7369+
#
7370+
# Disabling the presolver manages to perturb reality just
7371+
# enough in the one scenario that we doctest explicitly to
7372+
# "fix" the problem. It's also limited enough in scope
7373+
# that it probably hasn't badly broken some other use
7374+
# case.
7375+
p.solver_parameter("presolve_intopt", False)
7376+
73617377
try:
73627378
p.solve(log=verbose)
73637379
except MIPSolverException:

0 commit comments

Comments
 (0)