Optimization nuZ:使用带有权重和ID的软断言

Optimization nuZ:使用带有权重和ID的软断言,optimization,z3,Optimization,Z3,在与nuZ玩耍时,我偶然发现: (declare-fun x () Int) (declare-fun y () Int) (assert-soft (= x 1) :weight 1 :id first) (assert-soft (= y 4) :weight 3 :id first) (assert-soft (= x 2) :weight 1 :id second) (assert-soft (= y 5) :weight 3 :id second) (assert-soft (=

在与nuZ玩耍时,我偶然发现:

(declare-fun x () Int)
(declare-fun y () Int)

(assert-soft (= x 1) :weight 1 :id first)
(assert-soft (= y 4) :weight 3 :id first)

(assert-soft (= x 2) :weight 1 :id second)
(assert-soft (= y 5) :weight 3 :id second)

(assert-soft (= x 3) :weight 1 :id third)
(assert-soft (= y 6) :weight 3 :id third)

(maximize (+ x y))

(check-sat)
(get-model)
给我这个结果(使用Z3不稳定分支4.4.0):

我真的不理解输出。我知道重量在第一步就被最大化了

当权重相等时,nuZ不应该最大化目标(+xy)

问候,,
John

默认情况下,Z3一次解决一个目标,并找到词典编纂的最佳解决方案。首先,它试图满足来自“First”的尽可能多的软约束。与软约束关联的权重是不满足约束的惩罚。也就是说,它不是一个奖励,因此最大惩罚是4(=1+3),并且可以满足这两个约束,因此惩罚是0。 这是其他max sat解算器和格式中使用的约定。 这可能会让人困惑,因为它暗示要最小化处罚

由于目标一次解决一个,很明显其他软约束都不能满足,因此nuz返回“第二个”和“第三个”的最大惩罚

对于(最大化(+x y))目标,来自“first”的等式限制了x和y的值

first |-> 0
second |-> 4
third |-> 4
(+ x y) |-> 5
sat
(model
  (define-fun x () Int
    1)
  (define-fun y () Int
    4)
)