#12833: Crashes and doctests problems with Gurobi
--------------------------------------+-------------------------------------
Reporter: ncohen | Owner: ncohen
Type: defect | Status: needs_review
Priority: major | Milestone: sage-5.0
Component: linear programming | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Nathann Cohen | Merged in:
Dependencies: | Stopgaps:
--------------------------------------+-------------------------------------
Changes (by ncohen):
* cc: dcoudert (added)
* status: new => needs_review
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 were actually *all wrong* because of a
> solver="GUROBI" instead of solver="Gurobi".
>
> There was also a broken doctest in digraph.py.
>
> After this patch everything is uniform, and all tests pass in the graph/
> files with gubori as the default solver.
>
> 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")
7
}}}
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
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12833#comment:1>
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.