#11606: simplify constraints in linear programs
----------------------------------+-----------------------------------------
Reporter: john_perry | Owner: ncohen
Type: enhancement | Status: needs_info
Priority: major | Milestone: sage-4.7.2
Component: linear programming | Keywords: sd32
Work_issues: | Upstream: N/A
Reviewer: | Author: john_perry
Merged: | Dependencies:
----------------------------------+-----------------------------------------
Comment(by ncohen):
> but Cython defied me, claiming that generators weren't acceptable.
Oops, that's right. The current version of Cython doesn't like generators,
this feature should be included in the next Cython release, and I assure
you that we have been waiting for generators in Cython for a loooooooong
time here. There are patches I haven't written yet \
waiting for that, others that contain as a comment "Change this as soon as
we have iterators".. Sigh :-)
> Should we move that documentation out of __init__?
Well, the current documentation of the __init__ method of the
MixedIntegerLinearProgram class also appears just before, in the section's
documentation (and that appears in the doc). But you are right : it's
probably best to remove it just to avoid later mistakes.
Actually, it should just contain the line "Constructor" and the doctests.
The command
{{{
sage -coverage file.pyx
}}}
is a statistic telling you whether all the functions have documentation
and tests. It's nice to have around, but that's also why this __init__
function should have a minimal set of doctests -- so that the output of
this software doesn't report that some doc is missing :-)
> This strikes me as a matter best left to the client: the normalization
shouldn't choose the type of the coefficients of the constraints
You are right in general, though in this special situation the answer has
been taken from us. When a constraint is added, it is forwarded to the
solver backend which is the only place where it is saved. Now, all of
CPLEX/GLPK/Coin only accept floats as data. As mip.pyx is\
a Cython file, the best is probably to deal with float variables. By the
way, why do you create so many lists ? Instead of
{{{
i = min_function([v for (v,coeff) in f.iteritems() if coeff != 0])
c = f[i]
}}}
What about
{{{
cdef int i = 0
cdef float c
for i, c in f.iteritems():
if c!= 0:
break
}}}
Sorry about the delay again. I'm getting back to the point where I can
deal with tasks on-the-fly, and not with the ones that should have been
settled the week before :-)
Nathann
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11606#comment:22>
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.