1
from z3 import *

a = Int('a')

s = Solver()
s.add(a > 0)
set_option('smt.arith.random_initial_value', True)
set_option('auto_config', False)
set_option('smt.phase_selection', 5)
set_option('smt.random_seed', 1)

while s.check() == sat:
    m = s.model()
    print m[a]
    s.add(a != m[a])

The result is

1
2
3
4
5
...

How can I make the random work? Please provide an example in Python using z3py... I already know how to do this in smt... But I am having a real hard time figuring it out how to translate the smt script to python.

Jack Feng
  • 895
  • 2
  • 9
  • 24
  • Does this answer your question? [Z3py, random different solution generation](https://stackoverflow.com/questions/60033332/z3py-random-different-solution-generation) – JohanC Feb 03 '20 at 21:45

1 Answers1

2

This seems to be a duplicate of Z3py, random different solution generation

Are you trying to ask a different question? Please modify the question if so, if not you can delete it.

alias
  • 28,120
  • 2
  • 23
  • 40