diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 3ae14de7877..99d05471e99 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -7358,6 +7358,24 @@ 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 + try: + # 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) + except KeyError, NotImplementedError, ValueError: + # Must not be using GLPK. The specific exception raised + # depends on the backend; note that several of them live + # outside of the main sagelib repository. + pass try: p.solve(log=verbose) except MIPSolverException: