本文整理汇总了C++中XorClause::xor_clause_inverted方法的典型用法代码示例。如果您正苦于以下问题:C++ XorClause::xor_clause_inverted方法的具体用法?C++ XorClause::xor_clause_inverted怎么用?C++ XorClause::xor_clause_inverted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XorClause
的用法示例。
在下文中一共展示了XorClause::xor_clause_inverted方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findSubsumed
// Will put NULL in 'cs' if clause removed.
void XorSubsumer::subsume0(XorClauseSimp ps)
{
#ifdef VERBOSE_DEBUGSUBSUME0
cout << "subsume0 orig clause:";
ps.clause->plainPrint();
#endif
vec<Lit> unmatchedPart;
vec<XorClauseSimp> subs;
findSubsumed(*ps.clause, subs);
for (uint32_t i = 0; i < subs.size(); i++){
XorClause* tmp = subs[i].clause;
findUnMatched(*ps.clause, *tmp, unmatchedPart);
if (unmatchedPart.size() == 0) {
#ifdef VERBOSE_DEBUGSUBSUME0
cout << "subsume0 removing:";
subs[i].clause->plainPrint();
#endif
clauses_subsumed++;
assert(tmp->size() == ps.clause->size());
if (ps.clause->xor_clause_inverted() == tmp->xor_clause_inverted()) {
unlinkClause(subs[i]);
solver.clauseAllocator.clauseFree(tmp);
} else {
solver.ok = false;
return;
}
} else {
assert(unmatchedPart.size() > 0);
clauses_cut++;
#ifdef VERBOSE_DEBUG
std::cout << "Cutting xor-clause:";
subs[i].clause->plainPrint();
#endif //VERBOSE_DEBUG
XorClause *c = solver.addXorClauseInt(unmatchedPart, tmp->xor_clause_inverted() ^ !ps.clause->xor_clause_inverted(), tmp->getGroup());
if (c != NULL)
linkInClause(*c);
unlinkClause(subs[i]);
if (!solver.ok) return;
}
unmatchedPart.clear();
}
}
示例2: cleanClause
inline bool ClauseCleaner::cleanClause(XorClause& c)
{
Lit* i, *j, *end;
Var origVar1 = c[0].var();
Var origVar2 = c[1].var();
uint32_t origSize = c.size();
for (i = j = c.getData(), end = i + c.size(); i != end; i++)
{
const lbool& val = solver.assigns[i->var()];
if (val.isUndef())
{
*j = *i;
j++;
}
else
c.invert(val.getBool());
}
c.shrink(i - j);
assert(c.size() != 1);
switch (c.size())
{
case 0:
{
solver.detachModifiedClause(origVar1, origVar2, origSize, &c);
return true;
}
case 2:
{
c[0] = c[0].unsign();
c[1] = c[1].unsign();
solver.varReplacer->replace(c, c.xor_clause_inverted(), c.getGroup());
solver.detachModifiedClause(origVar1, origVar2, origSize, &c);
return true;
}
default:
{
if (i - j > 0)
{
c.setStrenghtened();
solver.clauses_literals -= i - j;
}
return false;
}
}
assert(false);
return false;
}
示例3: assert
void XorFinder::addXorAsNormal3(XorClause& c)
{
assert(c.size() == 3);
Clause *tmp;
vec<Var> vars;
vec<Lit> vars2(c.size());
const bool inverted = c.xor_clause_inverted();
for (uint32_t i = 0; i < c.size(); i++) {
vars.push(c[i].var());
}
vars2[0] = Lit(vars[0], false ^ inverted);
vars2[1] = Lit(vars[1], false ^ inverted);
vars2[2] = Lit(vars[2], false ^ inverted);
tmp = solver.addClauseInt(vars2, c.getGroup());
if (tmp) solver.clauses.push(tmp);
vars2[0] = Lit(vars[0], true ^ inverted);
vars2[1] = Lit(vars[1], true ^ inverted);
vars2[2] = Lit(vars[2], false ^ inverted);
tmp = solver.addClauseInt(vars2, c.getGroup());
if (tmp) solver.clauses.push(tmp);
vars2[0] = Lit(vars[0], true ^ inverted);
vars2[1] = Lit(vars[1], false ^ inverted);
vars2[2] = Lit(vars[2], true ^ inverted);
tmp = solver.addClauseInt(vars2, c.getGroup());
if (tmp) solver.clauses.push(tmp);
vars2[0] = Lit(vars[0], false ^ inverted);
vars2[1] = Lit(vars[1], true ^ inverted);
vars2[2] = Lit(vars[2], true ^ inverted);
tmp = solver.addClauseInt(vars2, c.getGroup());
if (tmp) solver.clauses.push(tmp);
}