#20461: Fixes for copying a MIP and its variables
-----------------------------+------------------------
Reporter: mkoeppe | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-7.2
Component: numerical | Resolution:
Keywords: lp | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
-----------------------------+------------------------
Comment (by nbruin):
{{{
sage: p = MixedIntegerLinearProgram()
sage: x = p.new_variable(nonnegative=True)
sage: x[0]
x_0
sage: x[1]
x_1
sage: p[0] #I don't understand this
x_2
sage: p[1]
x_3
}}}
But if we actually use the "generator" interface things seem OK:
{{{
sage: [p.gen(i) for i in [0..3]]
[x_0, x_1, x_2, x_3]
}}}
so I would suggest to just make sure that `p.gen(...)` works properly and
indeed gives a variable of the appropriate MIP object. Then there IS an
interface to get access to its variables (and really, it seems to be
largely in place already) and then simply that can be used.
It looks like a variable on p is uniquely determined by its index
(certainly its print name is), and `p.new_variable` seems just a funny way
of obtaining such indices.
The rest of the variable data is all hanging off internal tables, and via
the "is_variable_*" methods you can obtain the type of the variables.
I think you first need to make sure that all of that is accessible (and
copied appropriately, but I guess that's taken care of now) and then you
can think about what to do with this "new_variable" business.
--
Ticket URL: <http://trac.sagemath.org/ticket/20461#comment:4>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.