From: Ian Jackson Date: Sun, 9 Mar 2014 18:20:26 +0000 (+0000) Subject: fudge the {n,m}_max_frags to deal with rounding errors in glpk results X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=matchsticks-search.git;a=commitdiff_plain;h=1308bcff6d57a514091e9924bb7e37298b404b77;ds=sidebyside fudge the {n,m}_max_frags to deal with rounding errors in glpk results --- diff --git a/main.c b/main.c index c5a4991..f0bb84f 100644 --- a/main.c +++ b/main.c @@ -138,9 +138,13 @@ static void set_best(double new_best) { * <=> frags < | n / best | * _ _ * <=> frags <= | n / best | - 1 + * + * But best values from glpk are slightly approximate, so we + * subtract a fudge factor from our target. */ - n_max_frags = ceil(n / best) - 1; - m_max_frags = ceil(m / best) - 1; + double near_best = best * 0.98 - 0.02; + n_max_frags = ceil(n / near_best) - 1; + m_max_frags = ceil(m / near_best) - 1; } /*----- multicore support -----*/