Skip to content

Commit d106141

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 #34575 Closes #38831
1 parent 7726cd9 commit d106141

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+
try:
7362+
# The MIP approach with GLPK is prone to compiler and
7363+
# optimization-level weirdness on some hardware:
7364+
#
7365+
# * https://github.com/sagemath/sage/issues/34575
7366+
# * https://github.com/sagemath/sage/issues/38831
7367+
#
7368+
# Disabling the presolver manages to perturb reality just
7369+
# enough in the one scenario that we doctest explicitly to
7370+
# "fix" the problem. It's also limited enough in scope
7371+
# that it probably hasn't badly broken some other use
7372+
# case.
7373+
p.solver_parameter("presolve_intopt", False)
7374+
except KeyError:
7375+
# Must not be using GLPK...
7376+
pass
73617377
try:
73627378
p.solve(log=verbose)
73637379
except MIPSolverException:

0 commit comments

Comments
 (0)