Optimize Result - Expected or Not? #6604
-
Hi all, I am working on a problem, and was receiving some unexpected results with a model that I was trying to generate in ctx = z3.Context()
solver = z3.Optimize(ctx)
length = 5
timeline = [z3.Int('t{0}'.format(i),ctx) for i in range(length)]
for i in range(length-1):
solver.add(timeline[i+1] > timeline[i])
solver.add(timeline[0] >= 0)
print(solver.check())
solver.minimize(timeline[length-1])
print(solver.reason_unknown())
print(solver.model())
On the other hand, the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Ah, nevermind - looks like I needed to run |
Beta Was this translation helpful? Give feedback.
Ah, nevermind - looks like I needed to run
check
before theminimize
function. Swapping the two produces the expected output.