1

Mathsat 支持该命令check-allsat,Z3 不支持。请考虑以下示例:

(declare-fun m () Bool)
(declare-fun p () Bool)
(declare-fun b () Bool)
(declare-fun c () Bool)
(declare-fun r () Bool)
(declare-fun al () Bool)
(declare-fun all () Bool)
(declare-fun la () Bool)
(declare-fun lal () Bool)
(declare-fun g () Bool)
(declare-fun a () Bool)
(define-fun conjecture () Bool
(and (= (and (not r) c) m) (= p m) (= b m) (= c (not g)) (= (and (not al) (not all)) r)
(=(and la b) al) 
(= (and al la lal) all) (= (and (not g) p a) la) (= (and (not g) (or la a)) lal)))
(assert conjecture)
(check-allsat (m p b c r al all la lal g a))

使用 mathsat 执行此代码会获得所有一致的分配。问题是如何使用 Mathsat 确定此类一致作业的数量?

4

1 回答 1

3

我不知道有任何命令来计算解决方案的数量。但这可以使用 MathSAT 的 API 轻松完成。创建一个计数器,并在每次 MathSAT 通知时增加它。

static int counter = 0;
static int my_callback(msat_term *model, int size, void *user_data)
{
   counter++; return 1;
}
...
msat_all_sat(env, important, 4, my_callback, &data);
于 2013-11-18T23:11:37.650 回答