From 1308bcff6d57a514091e9924bb7e37298b404b77 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 9 Mar 2014 18:20:26 +0000 Subject: [PATCH] fudge the {n,m}_max_frags to deal with rounding errors in glpk results --- main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 -----*/ -- 2.30.2