我无法使用伪代码来解决布尔可满足性问题,只需将最小量的变量设置为true即可。
我有一个方法可满足的数字(H),我可以调用它来获得需要设置为true的最小数量的变量,以使布尔公式可以满足。
find-sat-min(f) {
if (not SAT(f)) return 0
L = {x | x is variable in f};
S = {};
int trueCount = 0;
for (x in L) {
if (SAT(f ^ x) && trueCount < satisfiable number(f)) {
S = S U {x};
f = f ^ x;
trueCount++;
}
else {
S = S U {NOT x};
f = f ^ NOT x;
}
}
return S;
}
这是我目前的逻辑。如果我走在正确的轨道上,请告诉我。