diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 3ae14de7877..b0045f80d07 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -7358,6 +7358,22 @@ def edge_disjoint_spanning_trees(self, k, algorithm=None, root=None, solver=None p.add_constraint(pos[root, c] + BFS[u] <= pos[u, c]) # We now solve this program and extract the solution + + from sage.numerical.backends.glpk_backend import GLPKBackend + if isinstance(p.get_backend(), GLPKBackend): + # The MIP approach with GLPK is prone to compiler and + # optimization-level weirdness on some hardware: + # + # * https://github.com/sagemath/sage/issues/34575 + # * https://github.com/sagemath/sage/issues/38831 + # + # Disabling the presolver manages to perturb reality just + # enough in the one scenario that we doctest explicitly to + # "fix" the problem. It's also limited enough in scope + # that it probably hasn't badly broken some other use + # case. + p.solver_parameter("presolve_intopt", False) + try: p.solve(log=verbose) except MIPSolverException: