chiark
/
gitweb
/
~ianmdlvl
/
matchsticks-search.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f1fe553
)
fudge the {n,m}_max_frags to deal with rounding errors in glpk results
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sun, 9 Mar 2014 18:20:26 +0000
(18:20 +0000)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sun, 9 Mar 2014 18:20:26 +0000
(18:20 +0000)
main.c
patch
|
blob
|
history
diff --git
a/main.c
b/main.c
index c5a49918869d9c8c1b07d865353cb856ece2c61f..f0bb84f497f12d91f9a1f4416643d80aee002c09 100644
(file)
--- 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 -----*/