+static void set_best(double new_best) {
+ best = new_best;
+ /*
+ * When computing n_max_frags, we want to set a value that will skip
+ * anything that won't provide strictly better solutions. So we
+ * want
+ * frags < n / 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.
+ */
+ double near_best = best * 0.98 - 0.02;
+ n_max_frags = ceil(n / near_best) - 1;
+ m_max_frags = ceil(m / near_best) - 1;
+}
+