本文整理汇总了C++中BodyNode::extended方法的典型用法代码示例。如果您正苦于以下问题:C++ BodyNode::extended方法的具体用法?C++ BodyNode::extended怎么用?C++ BodyNode::extended使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BodyNode
的用法示例。
在下文中一共展示了BodyNode::extended方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addBody
uint32 SharedDependencyGraph::addBody(SharedContext& ctx, PrgBodyNode* b, const AtomList& prgAtoms) {
if (b->visited()) { // first time we see this body -
b->setVisited(false); // mark as visited and create node
b->setUfsNode( (NodeId)bodies_.size(), false );
bodies_.push_back(BodyNode(b));
BodyNode* bn = &bodies_.back();
// Init node
VarVec preds, succs;
if (bn->scc != PrgNode::noScc) {
const bool weights = b->type() == PrgBodyNode::SUM_BODY;
for (uint32 p = 0; p != b->posSize(); ++p) {
PrgAtomNode* pred = prgAtoms[b->pos(p)];
if (relevantPrgAtom(*ctx.master(), pred) && pred->scc() == bn->scc) {
preds.push_back( pred->ufsNode() );
if (weights) {
preds.push_back( b->weight(p, true) );
}
}
}
preds.push_back(idMax);
if (bn->extended()) {
for (uint32 n = 0; n != b->size(); ++n) {
PrgAtomNode* pred = prgAtoms[b->goal(n).var()];
Literal lit = b->goal(n).sign() ? ~pred->literal() : pred->literal();
if ( (b->goal(n).sign() || pred->scc() != bn->scc) && !ctx.master()->isFalse(lit) ) {
preds.push_back(lit.asUint());
if (weights) {
preds.push_back(b->weight(n));
}
}
}
preds.push_back(idMax);
}
}
for (HeadVec::const_iterator it = b->heads_begin(), end = b->heads_end(); it != end; ++it) {
PrgAtomNode* a = prgAtoms[it->node()];
if (relevantPrgAtom(*ctx.master(), a)) {
NodeId id = a->ufsNode();
VarVec::iterator insPos = bn->scc == a->scc() ? succs.begin() : succs.end();
succs.insert(insPos, id);
}
}
bn->adj_ = new NodeId[succs.size() + bn->extended() + preds.size()];
if (bn->extended()) {
*bn->adj_= b->bound();
}
bn->sep_ = std::copy(succs.begin(), succs.end(), bn->adj_ + bn->extended());
std::copy(preds.begin(), preds.end(), bn->sep_);
ctx.setFrozen(b->var(), true);
}
return b->ufsNode();
}