sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.38k stars 469 forks source link

Gurobi breaks lots of doctests in make ptestlong #25258

Closed seblabbe closed 6 years ago

seblabbe commented 6 years ago

After installing Gurobi 8.0, make ptestlong gives:

----------------------------------------------------------------------
sage -t --long --warn-long 78.4 src/sage/graphs/generic_graph.py  # 79 doctests failed
sage -t --long --warn-long 78.4 src/sage/geometry/polyhedron/base.py  # 2 doctests failed
sage -t --long --warn-long 78.4 src/sage/geometry/cone.py  # 3 doctests failed
sage -t --long --warn-long 78.4 src/sage/graphs/generators/smallgraphs.py  # 21 doctests failed
sage -t --long --warn-long 78.4 src/sage/graphs/generators/families.py  # 4 doctests failed
sage -t --long --warn-long 78.4 src/sage/graphs/graph.py  # 49 doctests failed
sage -t --long --warn-long 78.4 src/sage/combinat/designs/database.py  # 1 doctest failed
sage -t --long --warn-long 78.4 src/sage/combinat/posets/posets.py  # 3 doctests failed
sage -t --long --warn-long 78.4 src/sage/graphs/generators/basic.py  # 1 doctest failed
sage -t --long --warn-long 78.4 src/sage/homology/simplicial_complex.py  # 6 doctests failed
sage -t --long --warn-long 78.4 src/sage/combinat/designs/orthogonal_arrays_build_recursive.py  # 11 doctests failed
sage -t --long --warn-long 78.4 src/sage/graphs/graph_decompositions/vertex_separation.pyx  # 7 doctests failed
sage -t --long --warn-long 78.4 src/sage/combinat/posets/poset_examples.py  # 1 doctest failed
sage -t --long --warn-long 78.4 src/sage/knots/link.py  # 9 doctests failed
sage -t --long --warn-long 78.4 src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx  # 1 doctest failed
sage -t --long --warn-long 78.4 src/sage/combinat/designs/bibd.py  # 5 doctests failed
sage -t --long --warn-long 78.4 src/sage/graphs/graph_coloring.py  # 10 doctests failed
sage -t --long --warn-long 78.4 src/sage/graphs/digraph.py  # 9 doctests failed
sage -t --long --warn-long 78.4 src/sage/matroids/matroid.pyx  # 1 doctest failed
sage -t --long --warn-long 78.4 src/sage/numerical/mip.pyx  # 3 doctests failed
sage -t --long --warn-long 78.4 src/sage/combinat/designs/orthogonal_arrays.py  # 4 doctests failed
sage -t --long --warn-long 78.4 src/sage/schemes/toric/toric_subscheme.py  # 10 doctests failed
sage -t --long --warn-long 78.4 src/sage/schemes/toric/points.py  # 1 doctest failed
sage -t --long --warn-long 78.4 src/sage/game_theory/normal_form_game.py  # 1 doctest failed
sage -t --long --warn-long 78.4 src/sage/graphs/comparability.pyx  # 6 doctests failed
sage -t --long --warn-long 78.4 src/sage/combinat/designs/incidence_structures.py  # 5 doctests failed
sage -t --long --warn-long 78.4 src/sage/numerical/optimize.py  # 1 doctest failed
sage -t --long --warn-long 78.4 src/sage/combinat/integer_vector.py  # 3 doctests failed
sage -t --long --warn-long 78.4 src/sage/graphs/bipartite_graph.py  # 2 doctests failed
sage -t --long --warn-long 78.4 src/sage/graphs/generators/degree_sequence.py  # 2 doctests failed
sage -t --long --warn-long 78.4 src/sage/graphs/generators/chessboard.py  # 1 doctest failed
sage -t --long --warn-long 78.4 src/sage/cpython/wrapperdescr.pyx  # 1 doctest failed
sage -t --long --warn-long 78.4 src/sage/matroids/graphic_matroid.py  # 7 doctests failed
sage -t --long --warn-long 78.4 src/sage/numerical/backends/generic_backend.pyx  # 2 doctests failed
sage -t --long --warn-long 78.4 src/sage/numerical/linear_functions.pyx  # 50 doctests failed
sage -t --long --warn-long 78.4 src/sage/graphs/graph_decompositions/cutwidth.pyx  # 3 doctests failed
sage -t --long --warn-long 78.4 src/sage/numerical/linear_tensor_element.pyx  # 9 doctests failed
sage -t --long --warn-long 78.4 src/doc/en/reference/sat/index.rst  # 1 doctest failed
sage -t --long --warn-long 78.4 src/doc/en/thematic_tutorials/linear_programming.rst  # 5 doctests failed
sage -t --long --warn-long 78.4 src/sage/graphs/hypergraph_generators.py  # 1 doctest failed
sage -t --long --warn-long 78.4 src/sage/sat/solvers/sat_lp.py  # 7 doctests failed
sage -t --long --warn-long 78.4 src/sage/numerical/backends/cvxopt_backend.pyx  # 1 doctest failed
sage -t --long --warn-long 78.4 src/sage/graphs/convexity_properties.pyx  # 3 doctests failed
sage -t --long --warn-long 78.4 src/sage/numerical/linear_tensor.py  # 12 doctests failed
sage -t --long --warn-long 78.4 src/sage/numerical/backends/gurobi_backend.pyx  # 1 doctest failed
sage -t --long --warn-long 78.4 src/sage/numerical/linear_tensor_constraints.py  # 15 doctests failed
sage -t --long --warn-long 78.4 src/sage/numerical/knapsack.py  # 5 doctests failed
sage -t --long --warn-long 78.4 src/sage/sat/solvers/satsolver.pyx  # 1 doctest failed
----------------------------------------------------------------------

All of the failing tests looking like:

sage -t --long --warn-long 78.4 src/sage/sat/solvers/sat_lp.py
**********************************************************************
File "src/sage/sat/solvers/sat_lp.py", line 31, in sage.sat.solvers.sat_lp.SatLP.__init__
Failed example:
    S=SAT(solver="LP"); S
Expected:
    an ILP-based SAT Solver
Got:
    Academic license - for non-commercial use only
    an ILP-based SAT Solver
**********************************************************************

Or sometimes:

**********************************************************************
File "src/sage/schemes/toric/toric_subscheme.py", line 652, in sage.schemes.toric.toric_subscheme.AlgebraicScheme_subscheme_toric.is_nondegenerate
Failed example:
    Y.is_nondegenerate()
Expected:
    False
Got:
    Academic license - for non-commercial use only
    Academic license - for non-commercial use only
    Academic license - for non-commercial use only
    Academic license - for non-commercial use only
    Academic license - for non-commercial use only
    Academic license - for non-commercial use only
    Academic license - for non-commercial use only
    Academic license - for non-commercial use only
    Academic license - for non-commercial use only
    Academic license - for non-commercial use only
    Academic license - for non-commercial use only
    Academic license - for non-commercial use only
    Academic license - for non-commercial use only
    Academic license - for non-commercial use only
    Academic license - for non-commercial use only
    Academic license - for non-commercial use only
    Academic license - for non-commercial use only
    Academic license - for non-commercial use only
    False
**********************************************************************

Component: linear programming

Author: David Coudert

Branch/Commit: 9042687

Reviewer: Sébastien Labbé

Issue created by migration from https://trac.sagemath.org/ticket/25258

seblabbe commented 6 years ago
comment:1

This post on Gurobi list seems to propose a solution for silencing the output when using their Python interface, but it seems we use our own interface. So we need to find the solution.

seblabbe commented 6 years ago
comment:2

The print occurs with line 63 in the __init__:

        # Initializing the master Environment. This one is kept to be
        # deallocated on __dealloc__
        error = GRBloadenv(&self.env_master, NULL)

And self.set_verbosity(0) arrives too late some lines below. This goes beyond my knowledge: how to set the GRB_INT_PAR_OUTPUTFLAG or OutputFlag (see gurubi_backend.pxd) to 0 before the initialization of the master environment?

seblabbe commented 6 years ago
comment:3

shorter is better

dcoudert commented 6 years ago
comment:4

I checked but it's also beyond my knowledge.

dcoudert commented 6 years ago

Branch: u/dcoudert/25258_gurobi

dcoudert commented 6 years ago

Author: David Coudert

dcoudert commented 6 years ago
comment:5

I have a fix !

The solution is to use GRBemptyenv to get empty environment, then set verbose mode and finally start environment, instead of directly calling GRBloadenv.


New commits:

9042687trac #25258: silent initialization
dcoudert commented 6 years ago

Commit: 9042687

seblabbe commented 6 years ago
comment:6

Replying to @dcoudert:

I have a fix !

Great!

seblabbe commented 6 years ago

Reviewer: Sébastien Labbé

vbraun commented 6 years ago

Changed branch from u/dcoudert/25258_gurobi to 9042687