*
* Invoke as ./main n m
*
- * The algorithm is faster if the arguments are ordered so that n > m.
+ * The arguments must be ordered so that n > m:
+ * n is the number of (more, shorter) input matches of length m
+ * m is the number of (fewer, longer) output matches of length n
*/
/*
*
* We further winnow the set of possible adjacency matrices, by
* ensuring the same bit is not set in too many entries of adjmatrix
- * (ie, as above, only considering output sticks).
+ * (ie, as above, only considering output sticks); and by ensuring
+ * that it is not set in too few: each output stick must consist
+ * of at least two fragments since the output sticks are longer than
+ * the input ones.
*
* And, we want to do the search in order of increasing maximum
* hamming weight. This is because in practice optimal solutions tend
if (!ok)
goto out;
+ for (j=0; j<m; j++)
+ if (weight[j] < 2) {
+ PRINTF(" nominham");
+ goto out;
+ }
+
+
/*
* We formulate our problem as an LP problem as follows.
* In this file "n" and "m" are the matchstick numbers.
assert(argc==3);
n = atoi(argv[1]);
m = atoi(argv[2]);
+ assert(n > m);
prep();