#7012: [with patch, needs review] clean up sage/numerical/mip.pyx
-----------------------+----------------------------------------------------
Reporter: mvngu | Owner: jkantor
Type: defect | Status: new
Priority: major | Milestone: sage-4.1.2
Component: numerical | Keywords:
Reviewer: | Author:
Merged: |
-----------------------+----------------------------------------------------
Comment(by mvngu):
Applying the patch `trac_7012.patch` results in a hunk failure:
{{{
[mv...@sage sage-main]$ hg qimport http://trac.sagemath.org/sage_trac/raw-
attachment/ticket/7012/trac_7012.patch && hg qpush
adding trac_7012.patch to series file
applying trac_7012.patch
patching file sage/numerical/knapsack.py
Hunk #1 FAILED at 640
1 out of 1 hunks FAILED -- saving rejects to file
sage/numerical/knapsack.py.rej
patch failed, unable to continue (try -v)
patch failed, rejects left in working dir
Errors during apply, please fix and refresh trac_7012.patch
}}}
The hunk in question is:
{{{
[mv...@sage sage-main]$ cat sage/numerical/knapsack.py.rej
--- knapsack.py
+++ knapsack.py
@@ -641,16 +641,16 @@
if reals:
seq=[(x,1) for x in seq]
- from sage.numerical.mip import MIP
- p=MIP(sense=1)
- present=p.newvar()
- p.setobj(sum([present[i]*seq[i][1] for i in range(len(seq))]))
- p.addconstraint(sum([present[i]*seq[i][0] for i in
range(len(seq))]),max=max)
+ from sage.numerical.mip import MixedIntegerLinearProgram
+ p=MixedIntegerLinearProgram(sense=1)
+ present=p.new_variable()
+ p.set_objective(sum([present[i]*seq[i][1] for i in range(len(seq))]))
+ p.add_constraint(sum([present[i]*seq[i][0] for i in
range(len(seq))]),max=max)
if binary:
- p.setbinary(present)
+ p.set_binary(present)
else:
- p.setinteger(present)
+ p.set_integer(present)
if value_only:
return p.solve(objective_only=True)
}}}
I have rebased the patch against Sage 4.1.2.rc0; see
`trac_7012-rebased.patch`.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7012#comment:8>
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
-~----------~----~----~----~------~----~------~--~---