Restructured 033
@@ -10,12 +10,7 @@ import sys
from cpmpy import *
import numpy as np
-
-if __name__ == "__main__":
-
- n = 112
- print(f"Attempting to find at most {n} words")
-
+def word_design(n=112):
A, C, G, T = 1, 2, 3, 4
# words[i,j] is the j'th letter of the i'th word
@@ -42,11 +37,22 @@ if __name__ == "__main__":
((words[r] < words[r + 1]) | b[1:] == 1))
model += b[-1] == 0
+ return model, (words,)
+
+if __name__ == "__main__":
+
+ n = 64
+ if len(sys.argv) > 1:
+ n = int(sys.argv[1])
+
+ print(f"Attempting to find at most {n} words")
+
+ model, (words,) = word_design(n)
+
if model.solve():
map = np.array(["A","C","G","T"])
for word in words.value():
if np.any(word != 0):
print("".join(map[word-1]))
-
else:
print("Model is unsatisfiable")
\ No newline at end of file
