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:
41013cb
)
rename {n,m}_over_best to {n,m}_max_frags to reflect way used in most of the code
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sun, 9 Mar 2014 11:29:12 +0000
(11:29 +0000)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sun, 9 Mar 2014 11:29:12 +0000
(11:29 +0000)
main.c
patch
|
blob
|
history
diff --git
a/main.c
b/main.c
index 69f56d1a30e8bba421e9e7a7231019a45f08b09d..de880e9c356936fa2e847cce8d166ffa9941f6eb 100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-101,7
+101,7
@@
static double best;
static glp_prob *best_prob;
static AdjWord *best_adjmatrix;
static glp_prob *best_prob;
static AdjWord *best_adjmatrix;
-static int n_
over_best, m_over_best
;
+static int n_
max_frags, m_max_frags
;
static int *weight;
static unsigned printcounter;
static int *weight;
static unsigned printcounter;
@@
-119,8
+119,8
@@
static void progress_eol(void) {
static void set_best(double new_best) {
best = new_best;
static void set_best(double new_best) {
best = new_best;
- n_
over_best
= floor(n / best);
- m_
over_best
= floor(m / best);
+ n_
max_frags
= floor(n / best);
+ m_
max_frags
= floor(m / best);
}
/*----- multicore support -----*/
}
/*----- multicore support -----*/
@@
-356,8
+356,8
@@
static void prep(void) {
glp_term_out(GLP_OFF);
setlinebuf(stderr);
weight = calloc(sizeof(*weight), m); assert(weight);
glp_term_out(GLP_OFF);
setlinebuf(stderr);
weight = calloc(sizeof(*weight), m); assert(weight);
- n_
over_best
= INT_MAX;
- m_
over_best
= INT_MAX;
+ n_
max_frags
= INT_MAX;
+ m_
max_frags
= INT_MAX;
}
#if 0
}
#if 0
@@
-379,7
+379,7
@@
static int count_set_adj_bits(AdjWord w) {
static int totalfrags;
static bool maxhamweight_ok(void) {
static int totalfrags;
static bool maxhamweight_ok(void) {
- return maxhamweight <= m_
over_best
;
+ return maxhamweight <= m_
max_frags
;
}
static bool preconsider_ok(int nwords, bool doprint) {
}
static bool preconsider_ok(int nwords, bool doprint) {
@@
-391,7
+391,7
@@
static bool preconsider_ok(int nwords, bool doprint) {
for (i=0, totalfrags=0; i<nwords; i++) {
int frags = count_set_adj_bits(adjmatrix[i]);
PRINTF("%"PRADJ" ", adjmatrix[i]);
for (i=0, totalfrags=0; i<nwords; i++) {
int frags = count_set_adj_bits(adjmatrix[i]);
PRINTF("%"PRADJ" ", adjmatrix[i]);
- if (frags > m_
over_best
) {
+ if (frags > m_
max_frags
) {
PRINTF(" too fine");
goto out;
}
PRINTF(" too fine");
goto out;
}
@@
-628,7
+628,7
@@
static void iterate_recurse(int i, AdjWord min) {
if (adjmatrix[i] & jbit)
weight[j]++;
for (int j = 0; j < m; j++)
if (adjmatrix[i] & jbit)
weight[j]++;
for (int j = 0; j < m; j++)
- if (weight[j] >= n_
over_best
)
+ if (weight[j] >= n_
max_frags
)
goto takeout;
iterate_recurse(i+1, adjmatrix[i]);
goto takeout;
iterate_recurse(i+1, adjmatrix[i]);