#12833: Crashes and doctests problems with Gurobi
--------------------------------------+-------------------------------------
       Reporter:  ncohen              |         Owner:  ncohen    
           Type:  defect              |        Status:  needs_work
       Priority:  major               |     Milestone:  sage-5.0  
      Component:  linear programming  |    Resolution:            
       Keywords:                      |   Work issues:            
Report Upstream:  N/A                 |     Reviewers:  John Perry
        Authors:  Nathann Cohen       |     Merged in:            
   Dependencies:                      |      Stopgaps:            
--------------------------------------+-------------------------------------
Changes (by john_perry):

  * status:  needs_review => needs_work
  * reviewer:  => John Perry


Comment:

 You're gonna hate me.

   1. The docs for `MixedIntegerLinearProgram` state,

 >   * "solver" -- 3 solvers should be available through this class:

   Only 3? `;-)`

   2. The docs for `MixedIntegerLinearProgram` advise the user to get the
 Gurobi solver using `solver="GUROBI"`. The ticket description, on the
 other hand, states
 > I also noticed that the doctests of gurobi_backend were actually *all
 wrong* because of a solver="GUROBI" instead of solver="Gurobi".

   So here's what I tried:
 {{{
 sage: p = MixedIntegerLinearProgram(solver='GUROBI')
 ---------------------------------------------------------------------------
 ValueError                                Traceback (most recent call
 last)
 ...
 ValueError: 'solver' should be set to 'GLPK', 'Coin', 'CPLEX', 'Gurobi' or
 None (in which case the default one is used).
 }}}
   The documentation should change.

   2. The tests for `mip.pyx` fail with Gurobi installed, '''with or
 without this patch.''' I've attached a file that summarizes the output,
 but here are some representative samples:
 {{{
 File "/atlas/sage-5.0.beta9/devel/sage-main/sage/numerical/mip.pyx", line
 564:
     sage: p.show()
 Expected:
     Maximization:
       x_0 +x_1
     Constraints:
       -3.0 x_0 +2.0 x_1 <= 2.0
     Variables:
       x_0 is a continuous variable (min=0.0, max=+oo)
       x_1 is a continuous variable (min=0.0, max=+oo)
 Got:
     Maximization:
       x_0 +x_1
     Constraints:
       R0: -3.0 x_0 +2.0 x_1 <= 2.0
     Variables:
       x_0 is a continuous variable (min=0.0, max=+oo)
       x_1 is a continuous variable (min=0.0, max=+oo)
 }}}

   (Notice the `R0:`.)

   {{{
 File "/atlas/sage-5.0.beta9/devel/sage-main/sage/numerical/mip.pyx", line
 837:
     sage: p.solve()
 Expected:
     0.0
 Got:
     -0.0
 ...
 File "/atlas/sage-5.0.beta9/devel/sage-main/sage/numerical/mip.pyx", line
 500:
     sage: sorted(map(reorder_constraint,p.constraints()))
 Expected:
     [(1.0, ([0, 1], [1.0, -1.0]), 4.0), (1.0, ([0, 2], [1.0, -2.0]),
 None)]
 Got:
     [(1.0, ([0, 3], [1.0, -2.0]), None), (4.0, ([0, 1, 2], [1.0, -1.0,
 1.0]), 4.0)]
 }}}

   If I remove the links to Gurobi files, the same tests pass. If I put the
 links to Gurobi back in, the tests fail again.

   I guess this is because Gurobi becomes the default solver once it is
 installed: the `default_mip_solver()` method has this code:

   {{{
             for s in ["CPLEX", "GUROBI", "Coin", "GLPK"]:
                 try:
                     default_mip_solver(s)
                     return s
                 except ValueError:
                     pass
 }}}

   I don't have CPLEX installed, so MIP goes with GUROBI. (And it is
 supposed to be GUROBI or Gurobi? LOL) This may reflect some bugs (I'll let
 you decide that) but perhaps the best way to fix this is for MIP to ask
 for GLPK as the default backend in its doctests. After all, this isn't an
 MIP bug; at worst, it's a bug in our Gurobi backend.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12833#comment:3>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to