例如,我有一个约束 set departure to value of XML element "JourneyDateTime" of item i of poster as text
set AppleScript's text item delimiters to "T"
set depTime to text item 2 of departure
tell me to display dialog time of date (depTime as string)
set AppleScript's text item delimiters to ""
。我不希望z3将x + y > 100
的值设为1或2,我也不希望z3将x
的值也设为1或2。
因此,x和y可以是除1或2之外的任何数字。
我们可以对z3强制执行此类限制吗?
谢谢!
答案 0 :(得分:1)
当然..简单断言x > 2 AND y > 2
。这是z3py:
from z3 import *
x = Int('x')
y = Int('y')
s = Solver()
s.add (x > 2)
s.add (y > 2)
s.add (x+y > 100)
s.check()
print s.model()
Z3打印:
$ python a.py
[y = 3, x = 98]