I am currently doing regression testing so I need the fixed results rather than random ones. I have tried all the methods including setting the random seed to 0, set_option('smt.arith.random_initial_value',False) and others. But nothing changes. The float solutions still seem random. Here is the simple example:
from z3 import *
set_option('smt.arith.random_initial_value',False)
set_option('smt.random_seed', 0)
def test_short_expont():
float_type = Float32()
solver = Solver()
solver.set("randomize",False)
fp_5 = FP('fp_5',float_type)
fp_10 = FP('fp_10',float_type)
solver.add( fpEQ(fpAdd(RNE(), fp_5, fp_5),fp_10) )
#solver.add( fpEQ(fpMul(RNE(), fp_5, fp_10),fp_5) )
if solver.check() == sat:
model = solver.model()
return model
else:
return
I expects the solutions maintain same but every time I run there comes different results.
[fp_10 = 1.3322999477386474609375*(2**-112),
fp_5 = 1.3322999477386474609375*(2**-113)]
[fp_10 = -1.66065156459808349609375*(2**1),
fp_5 = -1.66065156459808349609375]
[fp_10 = 1.2059905529022216796875*(2**-126),
fp_5 = 0.60299527645111083984375*(2**-126)]
It seems that fixing the random seed is effective for the int solutions, but don't have influence on the float solutions.
Is there any method to make the float solution not random?