I have the following python code:
from z3 import *
import time
s = Solver()
p = Array("p", BitVecSort(11), BitVecSort(8))
for m in range(200):
start_time = time.time()
for i in range(20):
s.add(Or([p[m*20 + i] % 72 == BitVecVal(x, 8) for x in [k * 6 for k in [0,2,4,5,7,9,11]]]))
s.check()
model = s.model()
pre_push = time.time()
s.push()
push_time = time.time() - pre_push
if m % 5 == 0:
print((m, (time.time() - start_time - push_time)))
As can be seen from the code, during every cycle m I put constraints on values m*20 to m*20+19 of my array. Therefore, there is never an added constraint which involves a variable from a previous valuation of m. However, even disregarding the time it takes to do ``s.push’’, z3 still slows enormously most rounds:
Output:
(0, 0.23836421966552734)
(5, 1.3699274063110352)
(10, 4.132023096084595)
(15, 3.884359836578369)
(20, 4.81259298324585)
(25, 7.442332029342651)
(30, 12.25448989868164)
(35, 15.96577787399292)
(40, 16.90854024887085)
(45, 22.725850105285645)
(50, 29.525628328323364)
(55, 23.494187355041504)
(60, 31.887953996658325)
My intuition would be that push would save the values of the previous model, and each model has the same number of constraints added to previously unconstrained variables, so besides the time It takes to push the time for each cycle should be relatively similar. Why am I getting so much slowdown?