本文整理汇总了C++中Watched类的典型用法代码示例。如果您正苦于以下问题:C++ Watched类的具体用法?C++ Watched怎么用?C++ Watched使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Watched类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: str_and_sub_using_watch
void DistillerLongWithImpl::str_and_sub_using_watch(
Clause& cl
, const Lit lit
, const bool alsoStrengthen
) {
//Go through the watchlist
watch_subarray thisW = solver->watches[lit];
timeAvailable -= (long)thisW.size()*2 + 5;
for(Watched* wit = thisW.begin(), *wend = thisW.end()
; wit != wend
; wit++
) {
//Can't do anything with a clause
if (wit->isClause())
continue;
timeAvailable -= 5;
if (alsoStrengthen) {
strengthen_clause_with_watch(lit, wit);
}
const bool subsumed = subsume_clause_with_watch(lit, wit, cl);
if (subsumed)
return;
}
}
示例2: satisfied
bool ClauseCleaner::satisfied(const Watched& watched, Lit lit)
{
assert(watched.isBinary());
if (solver.value(lit) == l_True) return true;
if (solver.value(watched.getOtherLit()) == l_True) return true;
return false;
}
示例3: redundant_or_removed
bool CNF::redundant_or_removed(const Watched& ws) const
{
if (ws.isBin() || ws.isTri()) {
return ws.red();
}
assert(ws.isClause());
const Clause* cl = cl_alloc.ptr(ws.get_offset());
return cl->red() || cl->getRemoved();
}
示例4: redundant_or_removed
bool CNF::redundant_or_removed(const Watched& ws) const
{
if (ws.isBinary() || ws.isTri()) {
return ws.red();
}
assert(ws.isClause());
const Clause* cl = clAllocator.getPointer(ws.getOffset());
return cl->red() || cl->getRemoved();
}
示例5: TryConnecting
void PosixSelectorBase::TryConnecting()
{
for (Watched *toconnect = m_connecting.First(), *next; toconnect; toconnect = next)
{
next = toconnect->Suc();
TryConnecting(toconnect);
// "next" element can be detached during
// the "TryConnecting(toconnect)" call.
// If it happened - restart the loop.
if (next && !m_connecting.HasLink(next))
next = m_connecting.First();
}
}
示例6: SetMode
void PosixSelectorBase::SetMode(List<Watched>& from, const PosixSelectListener* listener, int fd, Type mode)
{
for (Watched *watched = from.First(); watched; watched = watched->Suc())
{
if (watched->m_listener == listener && (fd == -1 || fd == watched->m_fd))
{
if (watched->m_mode == mode)
continue;
Log(SPEW, "%010p: Adjusting %010p listener (file %d=%d) mode %d -> %d\n",
this, listener, fd, watched->m_fd, (int)watched->m_mode, (int)mode);
watched->m_mode = mode;
OpStatus::Ignore(SetModeInternal(watched, mode));
}
}
}
示例7: find_pair_for_and_gate_reduction
ClOffset GateFinder::find_pair_for_and_gate_reduction(
const Watched& ws
, const size_t minSize
, const size_t maxSize
, const cl_abst_type general_abst
, const OrGate& gate
, const bool only_irred
) {
//Only long clauses
if (!ws.isClause())
return CL_OFFSET_MAX;
const ClOffset this_cl_offs = ws.get_offset();
Clause& this_cl = *solver->cl_alloc.ptr(this_cl_offs);
if ((ws.getAbst() | general_abst) != general_abst
|| (this_cl.red() && only_irred)
|| (!this_cl.red() && gate.red)
|| this_cl.size() > solver->conf.maxGateBasedClReduceSize
|| this_cl.size() > maxSize //Size must be smaller or equal to maxSize
|| this_cl.size() < minSize //Size must be larger or equal than minsize
|| sizeSortedOcc[this_cl.size()].empty()) //this bracket for sizeSortedOcc must be non-empty
{
//cout << "Not even possible, this clause cannot match any other" << endl;
return CL_OFFSET_MAX;
}
if (!check_seen_and_gate_against_cl(this_cl, gate))
return CL_OFFSET_MAX;
const cl_abst_type this_cl_abst = calc_abst_and_set_seen(this_cl, gate);
const ClOffset other_cl_offs = findAndGateOtherCl(
sizeSortedOcc[this_cl.size()] //in this occur list that contains clauses of specific size
, ~(gate.lit2) //this is the LIT that is meant to be in the clause
, this_cl_abst //clause MUST match this abst
, gate.red
, only_irred
);
//Clear 'seen' from bits set
*(simplifier->limit_to_decrease) -= this_cl.size();
for (const Lit lit: this_cl) {
seen[lit.toInt()] = 0;
}
return other_cl_offs;
}
示例8: Log
void PosixSelectorBase::Detach(List<Watched>& from, const PosixSelectListener* listener, int fd)
{
for (Watched *watched = from.First(), *next; watched; watched = next)
{
next = watched->Suc();
if (watched->m_listener == listener && (fd == -1 || fd == watched->m_fd))
{
Log(VERBOSE, "%010p: Detach %010p listener (file %d=%d).\n",
this, listener, fd, watched->m_fd);
DetachInternal(watched);
watched->SetWatched(false);
/* Remove from list. If they are not referenced elsewhere (e.g. in
* the list of waiting poll events), it is deleted. */
watched->Out();
watched->Destroy();
}
}
}
示例9: cl_size
size_t CNF::cl_size(const Watched& ws) const
{
switch(ws.getType()) {
case watch_binary_t:
return 2;
case CMSat::watch_tertiary_t:
return 3;
case watch_clause_t: {
const Clause* cl = cl_alloc.ptr(ws.get_offset());
return cl->size();
}
default:
assert(false);
return 0;
}
}
示例10: propagate_binary_clause_occur
bool PropEngine::propagate_binary_clause_occur(const Watched& ws)
{
const lbool val = value(ws.lit2());
if (val == l_False) {
ok = false;
return false;
}
if (val == l_Undef) {
enqueue(ws.lit2());
#ifdef STATS_NEEDED
if (ws.red())
propStats.propsBinRed++;
else
propStats.propsBinIrred++;
#endif
}
return true;
}
示例11: cl_size
size_t CNF::cl_size(const Watched& ws) const
{
switch(ws.getType()) {
case watch_binary_t:
return 2;
break;
case CMSat::watch_tertiary_t:
return 3;
break;
case watch_clause_t: {
const Clause* cl = clAllocator.getPointer(ws.getOffset());
return cl->size();
break;
}
default:
assert(false);
return 0;
break;
}
}
示例12: redundant
bool CNF::redundant(const Watched& ws) const
{
return ( (ws.isBin() && ws.red())
|| (ws.isTri() && ws.red())
|| (ws.isClause()
&& cl_alloc.ptr(ws.get_offset())->red()
)
);
}
示例13: redundant
bool CNF::redundant(const Watched& ws) const
{
return ( (ws.isBinary() && ws.red())
|| (ws.isTri() && ws.red())
|| (ws.isClause()
&& clAllocator.getPointer(ws.getOffset())->red()
)
);
}
示例14: propagate_tri_clause_occur
bool PropEngine::propagate_tri_clause_occur(const Watched& ws)
{
const lbool val2 = value(ws.lit2());
const lbool val3 = value(ws.lit3());
if (val2 == l_True
|| val3 == l_True
) {
return true;
}
if (val2 == l_Undef
&& val3 == l_Undef
) {
return true;
}
if (val2 == l_False
&& val3 == l_False
) {
ok = false;
return false;
}
#ifdef STATS_NEEDED
if (ws.red())
propStats.propsTriRed++;
else
propStats.propsTriIrred++;
#endif
if (val2 == l_Undef) {
enqueue(ws.lit2());
} else {
enqueue(ws.lit3());
}
return true;
}
示例15: find_pair_for_and_gate_reduction_tri
bool GateFinder::find_pair_for_and_gate_reduction_tri(
const Watched& ws
, const OrGate& gate
, const bool only_irred
, Watched& found_pair
) {
//Only long clauses
if (!ws.isTri())
return false;
if (ws.red() && only_irred) {
//cout << "Not even possible, this clause cannot match any other" << endl;
return false;
}
//Check that we are not removing irred info based on learnt gate
if (!ws.red() && gate.red)
return false;
if (!check_seen_and_gate_against_lit(ws.lit2(), gate)
|| !check_seen_and_gate_against_lit(ws.lit3(), gate))
{
return false;
}
seen[ws.lit2().toInt()] = 1;
seen[ws.lit3().toInt()] = 1;
const bool ret = findAndGateOtherCl_tri(
solver->watches[~(gate.lit2)]
, gate.red
, only_irred
, found_pair
);
seen[ws.lit2().toInt()] = 0;
seen[ws.lit3().toInt()] = 0;
return ret;
}