# Ticket #7012: trac_7012-flattened.patch

File trac_7012-flattened.patch, 59.3 KB (added by mvngu, 11 years ago)

flattened patch; include rebased patch and reviewer patch

• ## doc/en/reference/numerical.rst

```# HG changeset patch
# User Nathann Cohen <nathann.cohen@gmail.com>
# Date 1254129856 25200
# Node ID 98c624cabaf9c396055c57688d658de97661b850
# Parent  e334f15125a3faecdecfefc6079a7ba4536955e8
trac 7012: Numerical.mip Class : functions renamed, typos, several docstring fixes, bugfixes; reviewer patch Minh Van Nguyen <nguyenminh2@gmail.com>

diff -r e334f15125a3 -r 98c624cabaf9 doc/en/reference/numerical.rst```
 a :maxdepth: 2 sage/numerical/knapsack sage/numerical/mip sage/numerical/optimize
• ## sage/numerical/knapsack.py

`diff -r e334f15125a3 -r 98c624cabaf9 sage/numerical/knapsack.py`
 a 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)
• ## sage/numerical/mip.pyx

`diff -r e334f15125a3 -r 98c624cabaf9 sage/numerical/mip.pyx`