Ticket #9392: trac_9392-first_reviewer.patch

File trac_9392-first_reviewer.patch, 1.4 KB (added by leif, 11 years ago)

Fixes non-optional doctesting. Apply on top of Nathann's patch.

• sage/numerical/optimize.py

```# HG changeset patch
# User Leif Leonhardy <not.really@online.de>
# Date 1278274007 -7200
# Node ID f33ad853b0a78286c9b35b8172d6631081776dd9
# Parent  415efe09065e11cb108eec6034845dbd44b0077f
#9392 broken doctest due to different (valid) solutions from binpacking - first reviewer patch

Fixes: Modified doctest fails on "normal" (non-optional) testing because of undefined variables.
Apply on top of Nathann Cohen's patch.

diff -r 415efe09065e -r f33ad853b0a7 sage/numerical/optimize.py```
 a sage: from sage.numerical.optimize import binpacking sage: values = [1/5, 1/3, 2/3, 3/4, 5/7] sage: bins = binpacking(values) # optional - GLPK, CBC sage: len(bins) sage: len(bins) # optional - GLPK, CBC 3 Checking the bins are of correct size :: sage: all([ sum(b)<= 1 for b in bins ]) sage: all([ sum(b)<= 1 for b in bins ]) # optional - GLPK, CBC True Checking every item is in a bin :: sage: b1, b2, b3 = bins sage: all([ (v in b1 or v in b2 or v in b3) for v in values ]) sage: b1, b2, b3 = bins # optional - GLPK, CBC sage: all([ (v in b1 or v in b2 or v in b3) for v in values ]) # optional - GLPK, CBC True One way to use only three boxes (which is best possible) is to put