Created
March 6, 2016 22:17
-
-
Save hellman/90c1476553b3f2552a90 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from z3.z3 import * | |
s = Solver() | |
V = 683 | |
vs = [] | |
for v in range(1, V + 1): | |
vs.append(Int("v%03d" % v)) | |
s.add(vs[-1] >= 1) | |
s.add(vs[-1] <= 3) | |
for line in open("graph.txt"): | |
if not line.strip(): | |
continue | |
a, b = map(int, line.strip().split()) | |
s.add(vs[a] != vs[b]) | |
s.check() | |
model = s.model() | |
for v in sorted(model): | |
print "v[%s] = %s" % (str(v)[1:], model[v]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment