本文整理汇总了C++中Enode::setDeduced方法的典型用法代码示例。如果您正苦于以下问题:C++ Enode::setDeduced方法的具体用法?C++ Enode::setDeduced怎么用?C++ Enode::setDeduced使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enode
的用法示例。
在下文中一共展示了Enode::setDeduced方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: propagate
/*_________________________________________________________________________________________________
|
| propagate : [void] -> [Clause*]
|
| Description:
| Propagates all enqueued facts. If a conflict arises, the conflicting clause is returned,
| otherwise NULL.
|
| Post-conditions:
| * the propagation queue is empty, even if there was a conflict.
|_________________________________[email protected]*/
Clause* MiniSATP::propagate(const bool deduce)
{
Clause* confl = NULL;
int num_props = 0;
while (qhead < trail.size()){
Lit p = trail[qhead++]; // 'p' is enqueued fact to propagate.
vec<Clause*>& ws = watches[toInt(p)];
Clause **i, **j, **end;
num_props++;
for (i = j = (Clause**)ws, end = i + ws.size(); i != end;){
Clause& c = **i++;
// Make sure the false literal is data[1]:
Lit false_lit = ~p;
if (c[0] == false_lit)
c[0] = c[1], c[1] = false_lit;
assert(c[1] == false_lit);
// If 0th watch is true, then clause is already satisfied.
Lit first = c[0];
if (value(first) == l_True){
*j++ = &c;
}else{
// Look for new watch:
for (int k = 2; k < c.size(); k++)
if (value(c[k]) != l_False){
c[1] = c[k]; c[k] = false_lit;
watches[toInt(~c[1])].push(&c);
goto FoundWatch; }
// Did not find watch -- clause is unit under assignment:
*j++ = &c;
if (value(first) == l_False){
confl = &c;
qhead = trail.size();
// Copy the remaining watches:
while (i < end)
*j++ = *i++;
}
else
{
uncheckedEnqueue(first, &c);
//=================================================================================================
// Added Code
assert( (int)var_to_enode.size( ) > var( first ) );
if ( deduce && var_to_enode[ var( first ) ] != NULL )
{
Enode * e = var_to_enode[ var( first ) ];
if ( !e->hasPolarity( ) && !e->isDeduced( ) )
{
e->setDeduced( sign( first ), solver_id );
deductions.push_back( e );
}
}
// Added Code
//=================================================================================================
}
}
FoundWatch:;
}
ws.shrink(i - j);
}
propagations += num_props;
simpDB_props -= num_props;
return confl;
}