是否可以检查NuZ已经放弃了哪个问题的软断言?
让我们看看这个例子:
(declare-fun x () Int)
(declare-fun y () Int)
(assert-soft (=> (= x 2) (= y 1)) :weight 1)
(assert-soft (=> (= x 3) (= y 2)) :weight 1)
(assert-soft (=> (= x 4) (= y 2)) :weight 1)
(assert-soft (=> (= x 4) (= y 3)) :weight 1)
;(assert (= x 1))
;(assert (= x 2))
;(assert (= x 3))
(assert (= x 4))
;(assert (not (= y 3)))
(check-sat)
(get-model)
结果显示为:
|-> 1
sat
(model
(define-fun y () Int
3)
(define-fun x () Int
4)
)
费用是1.但是哪些规则已经放弃了?
当然,在这个简单的例子中,可以很容易地推断出这一点。在更复杂的情况下,它可能有点困难甚至不可能。
答案 0 :(得分:0)
一层间接就可以解决问题:
{if $page_name == 'order'}
...
{/if}
此代码产生:
(declare-fun A1 () Bool)
(declare-fun A2 () Bool)
(declare-fun B1 () Bool)
(declare-fun x () Int)
(declare-fun y () Int)
(assert-soft (= A1 true) :weight 1)
(assert-soft (= A2 true) :weight 2)
(assert-soft (= B1 true) :weight 2)
(assert (=> A1 (=> (and (<= 2 x) (<= x 7)) (= y 1))))
(assert (=> A2 (=> (and (<= 3 x) (<= x 6)) (= y 2))))
(assert (=> B1 (=> (and (<= 4 x) (<= x 9)) (= y 3))))
(assert (= x 4))
(check-sat)
(get-model)
使用A1,A2和B1,您可以确切地知道使用哪些规则以及放弃哪些规则。