From: Simon Tatham Date: Wed, 12 Mar 2014 20:51:41 +0000 (+0000) Subject: Report the bounds along with the search results. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=7c7be2daeba3ddf21d23f4459ee5fc955408d246;p=matchsticks-search.git Report the bounds along with the search results. --- 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):