在为 Haskell运行Data.SBV 库中的优化函数示例时:
problem :: Goal
problem = optimize Lexicographic $ do [x1, x2] <- mapM sReal ["x1", "x2"]
constrain $ x1 + x2 .<= 10
constrain $ x1 - x2 .>= 3
constrain $ 5*x1 + 4*x2 .<= 35
constrain $ x1 .>= 0
constrain $ x2 .>= 0
maximize "goal" $ 5 * x1 + 6 * x2
main = optimize Lexicographic problem
我收到以下错误:
*** Exception:
*** Data.SBV: Unexpected response from the solver.
*** Context : set-option
*** Sent : (set-option :pp.decimal false)
*** Expected: success
*** Received: unsupported
*** success
CallStack (from HasCallStack):
error, called at ./Data/SBV/Control/Utils.hs:590:9 in sbv-7.3-35rX062AGHeFmuyHxSBaTE:Data.SBV.Control.Utils
类似下面的代码:
test = optimize Lexicographic $ do
x <- sInteger "x"
y <- sInteger "y"
maximize "goal" $ x + 2 * y
产生错误:
*** Exception:
*** Data.SBV: Unexpected response from the solver.
*** Context : getModel
*** Sent : (get-value (s0))
*** Expected: a value binding for kind: SInteger
*** Received: unsupported
*** ((s0 0))
CallStack (from HasCallStack):
error, called at ./Data/SBV/Control/Utils.hs:590:9 in sbv-7.3-35rX062AGHeFmuyHxSBaTE:Data.SBV.Control.Utils
minimize
组合子作为最后一个表达式时也会发生此错误。
我使用 GHC 版本 8.0.2 和堆栈版本 1.5 和 SBV 版本 7.3 我使用 Z3 作为我的求解器,它是在 MacOS 上运行的 4.5.1 64 位版本。
打电话sat
和prove
按预期工作。有任何想法吗?谢谢!