We can use the following code to solve the Dog,Cat,Mouse puzzle in the tutorial.
dog, cat, mouse = Ints('dog cat mouse')
s = Solver();
s.add(dog>=1)
s.add(cat>=1)
s.add(mouse>=1)
s.add(dog+cat+mouse==100)
s.add(1500 * dog + 100 * cat + 25 * mouse == 10000)
print s.check()
print s.model()
Well, I know I can use
m=s.model
for d in m.decls():
print "%s = %s" % (d.name(), m[d])
to get the names and values of the variables. For example, cat = 41. I wonder can I create a new assertion from the names and values such as cat != 41. I used
s.add(d.name != m[d])
s.add("%s != %s" % (d.name(), m[d]))
But, none of them can work. Any one knows how to add a new assertion from reading the names and values of the model? Many thanks.