我正在尝试运行一个非常大的 Z3 python 程序,如以下示例:
S, (cl_3,cl_39,cl_11, me_32,m_59,m_81 …………) = EnumSort('S',['cl_3','cl_39','cl_11','me_32','me_59','me_81', …………..])
#########################################
def fun(h1 , h2):
conds = [
(cl_3, me_32),
(cl_39, me_59),
(cl_11, me_81),
...
]
and_conds = (And(h1==a, h2==b) for a,b in conds)
return Or(*and_conds)
#######################################
def fun2(m1 , m2):
conds = [
(cl_3, me_32),
(cl_39, me_59),
(cl_11, me_81),
...
]
and_conds = (And(m1==a, m2==b) for a,b in conds)
return Or(*and_conds)
#######################################
def fun3(y1 , y2):
conds = [
(cl_3, me_32),
(cl_39, me_59),
(cl_11, me_81),
...
]
and_conds = (And(y1==a, y2==b) for a,b in conds)
return Or(*and_conds)
我使用了一个集合约束来检索匹配的模型;将根据函数参数检索匹配的模型,如下所示:
s = Solver()
x1 = Const('x1', S)
x2 = Const('x2', S)
x3 = Const('x3', S)
s.add(fun(x1,x2))
s.add(fun2(x2,x3)
.
.
.
s.add(fun3(x3,x1)
print s.check()
print s.model()
但是,我收到以下错误
ValueError: need more than 2123 values to unpack