X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=main.c;h=f0bb84f497f12d91f9a1f4416643d80aee002c09;hb=1308bcff6d57a514091e9924bb7e37298b404b77;hp=c5a49918869d9c8c1b07d865353cb856ece2c61f;hpb=f1fe55395ca28b57e40dda10de668f2332e6977a;p=matchsticks-search.git 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 -----*/