How to print z3 solver results print(s.model()) in order?
问题 Suppose I have a list of 10 variables v = [Real('v_%s' % (i+1)) for i in range(10)] and I want to add a simple constraint like this s = Solver() for i in range(10): s.add(v[i] == i) if s.check() == sat: print(s.model()) So a satisfying model is v_1 = 0, v_2 = 1 .... v_10 = 9 . However the output of print(s.model()) is totoally unordered which makes me confused when I have lots of variables in a bigger model. For this example, the output of my computer is v_5, v_7, v_4, v_2, v_1, v_3, v_6, v_8