3
以下腳本http://rise4fun.com/Z3Py/Cbl有什麼問題? 添加最後兩行給了我下面的錯誤'instancemethod' object is not #subscriptable
Z3Py代碼中的錯誤
x,t,t1,t2,x_next=Reals ('x t t1 t2 x_next')
location,location_next=Bools('location location_next')
x=0
location=BoolVal(False)
k=20
for i in range(k):
s=Solver()
s.add(Or(And(x_next-x>=2*t,x_next-x<=3*t,x_next<=12,t>0,Not(location)),
And(x_next-x>=-2*t,x_next-x<=-t,x_next>=0,t>0,location)),location_next==If(And(Not(location),x_next>=12),True,If(And(location,x_next<=0),False,location)))
print s.check()
print s.model()
m=s.model
#x=m[x_next]
#location=m[location_next]
@Leonardo德莫拉:感謝您的錯字修復。 – 2012-08-08 18:23:22
@Hafiz ul Asad thanx – 2012-08-08 18:25:03