#12833: Crashes and doctests problems with Gurobi
---------------------------------+------------------------------------------
Reporter: ncohen | Owner: ncohen
Type: defect | Status: needs_work
Priority: major | Milestone: sage-5.0
Component: misc | 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
* component: linear programming => misc
Old description:
> HEllooooooooo !!!
>
> Gurobi actually crashed Sage when
> MixedIntegerLinearProgram(solver="Gurobi") is run with no license
> installed (or an invalid one). This if fixed by a if var == NULL before
> free(var).
>
> I also noticed that the doctests of gurobi_backend were actually *all
> wrong* because of a solver="GUROBI" instead of solver="Gurobi".
>
> There was also a *scary* error in digraph.py : an inequality was actually
> REVERSED (a <= n had become a >= n) and it is really a wonder that the
> code did not break before `O_o`. Well, Gurobi did break on that, but the
> others were doing just fine.
>
> Before :
> {{{
> sage: g = DiGraph('IESK@XgAbCgH??KG??')
> sage: g.feedback_edge_set(value_only = True, constraint_generation =
> False)
> 7
> sage: g.feedback_edge_set(value_only = True, constraint_generation =
> False, solver = "GUROBI")
> 6
> }}}
>
> After :
> {{{
> sage: g = DiGraph('IESK@XgAbCgH??KG??')
> sage: g.feedback_edge_set(value_only = True, constraint_generation =
> False)
> 7
> sage: g.feedback_edge_set(value_only = True, constraint_generation =
> False, solver = "Gurobi")
> 7
> }}}
>
> Hopefully, the problem came from an optional algorithm, optional because
> slower than the other one.
>
> After this patch everything is uniform, and all tests pass in the graph/
> files with gubori as the default solver. All doctests do not pass in
> mip.pyx but that is only matters of default names for constraints, and
> stupid ways to store inequalities inside of Gurobi. For instance :
> {{{
> sage: p = MixedIntegerLinearProgram(solver = "Gurobi") # optional
> - Gurobi
> sage: p.add_constraint(p[0] - p[2], min = 1, max = 4) # optional
> - Gurobi
> sage: p.add_constraint(p[0] - 2*p[1], min = 1) # optional
> - Gurobi
> sage: p.show()
> Maximization:
>
> Constraints:
> R0: 4.0 <= x_0 -x_1 +RgR0 <= 4.0
> R1: 1.0 <= x_0 -2.0 x_3
> Variables:
> x_0 is a continuous variable (min=0.0, max=+oo)
> x_1 is a continuous variable (min=0.0, max=+oo)
> RgR0 is a continuous variable (min=0.0, max=3.0)
> x_3 is a continuous variable (min=0.0, max=+oo)
> }}}
>
> You always pay for the bad code you write `-_-`
>
> Nathann
New description:
HEllooooooooo !!!
Gurobi actually crashed Sage when
MixedIntegerLinearProgram(solver="Gurobi") is run with no license
installed (or an invalid one). This if fixed by a if var == NULL before
free(var).
I also noticed that the doctests of gurobi_backend were actually *all
wrong* because of a solver="GUROBI" instead of solver="Gurobi".
There was also a *scary* error in digraph.py : an inequality was actually
REVERSED (a <= n had become a >= n) and it is really a wonder that the
code did not break before `O_o`. Well, Gurobi did break on that, but the
others were doing just fine.
Before :
{{{
sage: g = DiGraph('IESK@XgAbCgH??KG??')
sage: g.feedback_edge_set(value_only = True, constraint_generation =
False)
7
sage: g.feedback_edge_set(value_only = True, constraint_generation =
False, solver = "GUROBI")
6
}}}
After :
{{{
sage: g = DiGraph('IESK@XgAbCgH??KG??')
sage: g.feedback_edge_set(value_only = True, constraint_generation =
False)
7
sage: g.feedback_edge_set(value_only = True, constraint_generation =
False, solver = "Gurobi")
7
}}}
Hopefully, the problem came from an optional algorithm, optional because
slower than the other one.
After this patch everything is uniform, and all tests pass in the graph/
files with gubori as the default solver. All doctests do not pass in
mip.pyx but that is only matters of default names for constraints, and
stupid ways to store inequalities inside of Gurobi. For instance :
{{{
sage: p = MixedIntegerLinearProgram(solver = "Gurobi") # optional -
Gurobi
sage: p.add_constraint(p[0] - p[2], min = 1, max = 4) # optional -
Gurobi
sage: p.add_constraint(p[0] - 2*p[1], min = 1) # optional -
Gurobi
sage: p.show()
Maximization:
Constraints:
R0: 4.0 <= x_0 -x_1 +RgR0 <= 4.0
R1: 1.0 <= x_0 -2.0 x_3
Variables:
x_0 is a continuous variable (min=0.0, max=+oo)
x_1 is a continuous variable (min=0.0, max=+oo)
RgR0 is a continuous variable (min=0.0, max=3.0)
x_3 is a continuous variable (min=0.0, max=+oo)
}}}
You always pay for the bad code you write `-_-`
Nathann
'''Apply:'''
* [attachment:trac_12833.patch]
* [attachment:trac_12833-docstrings.patch]
* [attachment:trac_12833_acronyms_are_evil.patch]
--
Comment:
Oh, you're '''really''' gonna hate me now. `:-)`
There's one miserable regression in `generic_backend.pyx`:
{{{
File "/atlas/sage-5.0.beta9/devel/sage-
main/sage/numerical/backends/generic_backend.pyx", line 841:
sage: default_mip_solver()
Expected:
'GLPK'
Got:
'Glpk'
}}}
You can either fix your patch, or give a positive review to the patch I'm
about to uploade. (All of one line! I'm an awesome code-producing
machine!)
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12833#comment:6>
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.