X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=matchsticks-search.git;a=blobdiff_plain;f=print.py;h=f7015c73e4d09d7f41d554c671c67ae15cf1dbba;hp=d59c5e2f90f9c00831527d06c7652761283d7648;hb=7c7be2daeba3ddf21d23f4459ee5fc955408d246;hpb=a0e19749b5c7edccf558fc336fff917d837fa103 diff --git a/print.py b/print.py index d59c5e2..f7015c7 100755 --- a/print.py +++ b/print.py @@ -3,6 +3,8 @@ import sys, re, fractions from fractions import Fraction +import bounds + results = {} def got(n, m, minfrag, matrix): @@ -74,6 +76,16 @@ def report(): for count, col in sorted(colout, reverse=True): print " %d x (%s)" % (count, " + ".join(map(str,col))) + # See what our upper bound techniques have to say about this. + bound, reason = bounds.upper_bound(n, m) + assert bound >= minfrag, \ + "(%d,%d) solution %s exceeds upper bound %s" % ( + n, m, minfrag, bound) + if bound == minfrag: + print " Proved optimal by", reason + else: + print " Best upper bound proof (%s) gives %s" % (reason, bound) + heading_re = re.compile(r'^(\d+) into (\d+): min fragment ([\d\.]+)') def read_file(f):