#11588: copying a linear program crashes SAGE
----------------------------------+-----------------------------------------
Reporter: john_perry | Owner: ncohen
Type: defect | Status: needs_work
Priority: major | Milestone: sage-4.7.2
Component: linear programming | Keywords: MixedIntegerLinearProgram,
copy
Work_issues: | Upstream: N/A
Reviewer: | Author: Nathann Cohen
Merged: | Dependencies:
----------------------------------+-----------------------------------------
Changes (by john_perry):
* status: needs_review => needs_work
Comment:
Copying works only if there are no constraints... that's said, it's not
clear to me where the error here lies.
{{{
sage: lp = MixedIntegerLinearProgram()
sage: lp.add_constraint(lp[0]-lp[1],min=1)
sage: lp.add_constraint(2*lp[1] - lp[0] - lp[2],min=1)
sage: np = copy(lp)
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
/atlas/perry/<ipython console> in <module>()
/usr/local/share/sage-4.7-linux-32bit-
ubuntu_10.04_lts-i686-Linux/local/lib/python/copy.pyc in copy(x)
77 copier = getattr(cls, "__copy__", None)
78 if copier:
---> 79 return copier(x)
80
81 reductor = dispatch_table.get(cls)
/usr/local/share/sage-4.7-linux-32bit-
ubuntu_10.04_lts-i686-Linux/local/lib/python2.6/site-
packages/sage/numerical/mip.so in
sage.numerical.mip.MixedIntegerLinearProgram.__copy__
(sage/numerical/mip.c:1859)()
/usr/local/share/sage-4.7-linux-32bit-
ubuntu_10.04_lts-i686-Linux/local/lib/python/copy.pyc in copy(x)
93 raise Error("un(shallow)copyable object of type
%s" % cls)
94
---> 95 return _reconstruct(x, rv, 0)
96
97
/usr/local/share/sage-4.7-linux-32bit-
ubuntu_10.04_lts-i686-Linux/local/lib/python/copy.pyc in _reconstruct(x,
info, deep, memo)
321 if deep:
322 args = deepcopy(args, memo)
--> 323 y = callable(*args)
324 memo[id(x)] = y
325 if listiter is not None:
/usr/local/share/sage-4.7-linux-32bit-
ubuntu_10.04_lts-i686-Linux/local/lib/python/copy_reg.pyc in
__newobj__(cls, *args)
91
92 def __newobj__(cls, *args):
---> 93 return cls.__new__(cls, *args)
94
95 def _slotnames(cls):
/usr/local/share/sage-4.7-linux-32bit-
ubuntu_10.04_lts-i686-Linux/local/lib/python2.6/site-
packages/sage/numerical/mip.so in sage.numerical.mip.MIPVariable.__cinit__
(sage/numerical/mip.c:6626)()
TypeError: __cinit__() takes at least 2 positional arguments (0 given)
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11588#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.