Optimization Z3最大化和冲突
我有以下Z3问题。当这里的代码被执行时,我们将如何期望或如何定义冲突的优化目标将执行Optimization Z3最大化和冲突,optimization,z3,maximization,Optimization,Z3,Maximization,我有以下Z3问题。当这里的代码被执行时,我们将如何期望或如何定义冲突的优化目标将执行 (declare-const x Bool) (declare-const y Bool) (declare-const z Bool) (maximize( + (ite (= y false) 1 0) (ite (= z false) 1 0) ) ) (maximize( + (ite (= x true) 1 0) (ite (= y true
(declare-const x Bool)
(declare-const y Bool)
(declare-const z Bool)
(maximize(
+
(ite (= y false) 1 0)
(ite (= z false) 1 0)
)
)
(maximize(
+
(ite (= x true) 1 0)
(ite (= y true) 1 0)
(ite (= z true) 1 0)
)
)
(check-sat)
(get-model)
目前,结果如下:
(+ (ite (= y false) 1 0) (ite (= z false) 1 0)) |-> 2
(+ (ite (= x true) 1 0) (ite (= y true) 1 0) (ite (= z true) 1 0)) |-> 1
sat
(model
(define-fun y () Bool
false)
(define-fun z () Bool
false)
(define-fun x () Bool
true)
)
默认情况下,Z3一次解决一个优化目标。它提交一个解决方案,并在解决下一个目标时使用提交的解决方案。我称之为“弱词典”排序,因为提交的解决方案可能会过度约束问题。 您还可以配置Z3以独立地或使用帕累托前沿解决目标。 命令行包括:
(set-option :opt.priority pareto) ; find pareto fronts
(set-option :opt.priority lex) ; weak lexicographic
(set-option :opt.priority box) ; independent
感谢Nikolaj,我刚才也注意到了
(assert soft…
功能,它也与这种情况有关。