There are some constraints such as x + y > 5 , x > 3 , y < 4, so the set of models x = 4 y= 3, which is given by z3. Dose z3 can give models incrementally, such as another set of models x=5,y = 2? Thanks. Regards
Asked
Active
Viewed 375 times
1
-
1possible duplicate of [Z3: finding all satisfying models](http://stackoverflow.com/questions/13395391/z3-finding-all-satisfying-models) – Taylor T. Johnson Jul 23 '13 at 13:05
-
1Here's your example using the method described at that question/answer: http://rise4fun.com/Z3Py/QfFt – Taylor T. Johnson Jul 23 '13 at 13:07
-
Can the method rewrite in C++? Thanks. – Why Jul 23 '13 at 13:14
1 Answers
0
Can you tell me please what happens with this:
x,y = Bools('x y')
s = Solver()
s.add(Or(x,y))
count = 0
while s.check() == sat and count <= 50:
print s.model()
s.add(Or(x != s.model()[x], y != s.model()[y]))
count = count + 1
print count
the output is:
[y = False, x = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
[y = True]
51
online here

Juan Ospina
- 1,317
- 1
- 7
- 15