本文整理汇总了C++中TNode类的典型用法代码示例。如果您正苦于以下问题:C++ TNode类的具体用法?C++ TNode怎么用?C++ TNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: BVDebug
bool EqualitySolver::NotifyClass::eqNotifyTriggerEquality(TNode equality, bool value) {
BVDebug("bitvector::equality") << "NotifyClass::eqNotifyTriggerEquality(" << equality << ", " << (value ? "true" : "false" )<< ")" << std::endl;
if (value) {
return d_solver.storePropagation(equality);
} else {
return d_solver.storePropagation(equality.notNode());
}
}
开发者ID:bobot,项目名称:CVC4.old-svn,代码行数:8,代码来源:bv_subtheory_eq.cpp
示例2: substituteArguments
Node AbstractionModule::substituteArguments(TNode signature, TNode apply, unsigned& index, TNodeTNodeMap& seen) {
if (seen.find(signature) != seen.end()) {
return seen[signature];
}
if (signature.getKind() == kind::SKOLEM) {
// return corresponding argument and increment counter
seen[signature] = apply[index];
return apply[index++];
}
if (signature.getNumChildren() == 0) {
Assert (signature.getKind() != kind::VARIABLE &&
signature.getKind() != kind::SKOLEM);
seen[signature] = signature;
return signature;
}
NodeBuilder<> builder(signature.getKind());
if (signature.getMetaKind() == kind::metakind::PARAMETERIZED) {
builder << signature.getOperator();
}
for (unsigned i = 0; i < signature.getNumChildren(); ++i) {
Node child = substituteArguments(signature[i], apply, index, seen);
builder << child;
}
Node result = builder;
seen[signature]= result;
return result;
}
开发者ID:jinala,项目名称:CVC4,代码行数:33,代码来源:abstraction.cpp
示例3: Debug
bool CoreSolver::decomposeFact(TNode fact) {
Debug("bv-slicer") << "CoreSolver::decomposeFact fact=" << fact << endl;
// FIXME: are this the right things to assert?
// assert decompositions since the equality engine does not know the semantics of
// concat:
// a == a_1 concat ... concat a_k
// b == b_1 concat ... concat b_k
TNode eq = fact.getKind() == kind::NOT? fact[0] : fact;
TNode a = eq[0];
TNode b = eq[1];
Node new_a = getBaseDecomposition(a);
Node new_b = getBaseDecomposition(b);
Assert (utils::getSize(new_a) == utils::getSize(new_b) &&
utils::getSize(new_a) == utils::getSize(a));
NodeManager* nm = NodeManager::currentNM();
Node a_eq_new_a = nm->mkNode(kind::EQUAL, a, new_a);
Node b_eq_new_b = nm->mkNode(kind::EQUAL, b, new_b);
bool ok = true;
ok = assertFactToEqualityEngine(a_eq_new_a, utils::mkTrue());
if (!ok) return false;
ok = assertFactToEqualityEngine(b_eq_new_b, utils::mkTrue());
if (!ok) return false;
ok = assertFactToEqualityEngine(fact, fact);
if (!ok) return false;
if (fact.getKind() == kind::EQUAL) {
// assert the individual equalities as well
// a_i == b_i
if (new_a.getKind() == kind::BITVECTOR_CONCAT &&
new_b.getKind() == kind::BITVECTOR_CONCAT) {
Assert (new_a.getNumChildren() == new_b.getNumChildren());
for (unsigned i = 0; i < new_a.getNumChildren(); ++i) {
Node eq_i = nm->mkNode(kind::EQUAL, new_a[i], new_b[i]);
ok = assertFactToEqualityEngine(eq_i, fact);
if (!ok) return false;
}
}
}
return true;
}
开发者ID:,项目名称:,代码行数:45,代码来源:
示例4: isInequalityOnly
bool InequalitySolver::isInequalityOnly(TNode node) {
if (d_ineqOnlyCache.find(node) != d_ineqOnlyCache.end()) {
return d_ineqOnlyCache[node];
}
if (node.getKind() == kind::NOT) {
node = node[0];
}
if (node.getKind() != kind::EQUAL &&
node.getKind() != kind::BITVECTOR_ULT &&
node.getKind() != kind::BITVECTOR_ULE &&
node.getKind() != kind::CONST_BITVECTOR &&
node.getKind() != kind::SELECT &&
node.getKind() != kind::STORE &&
node.getMetaKind() != kind::metakind::VARIABLE) {
return false;
}
bool res = true;
for (unsigned i = 0; i < node.getNumChildren(); ++i) {
res = res && isInequalityOnly(node[i]);
}
d_ineqOnlyCache[node] = res;
return res;
}
开发者ID:neuroo,项目名称:CVC4,代码行数:25,代码来源:bv_subtheory_inequality.cpp
示例5: CleanUp
void TDecisionTree::TNode::CopyNode(const TNode& Node) {
CleanUp();
CutFtrN = Node.CutFtrN;
CutFtrVal = Node.CutFtrVal;
NExamples = Node.NExamples;
ClassHist = Node.ClassHist;
FtrHist = Node.FtrHist;
if (Node.HasLeft()) {
Left = new TNode(Tree);
Left->CopyNode(*Node.Left);
}
if (Node.HasRight()) {
Right = new TNode(Tree);
Right->CopyNode(*Node.Right);
}
}
开发者ID:Bradeskojest,项目名称:qminer,代码行数:18,代码来源:classification.cpp
示例6: setJustified
void Relevancy::setJustified(TNode n)
{
Debug("decision") << " marking [" << n.getId() << "]"<< n << "as justified" << std::endl;
d_justified.insert(n);
if(options::decisionComputeRelevancy()) {
d_relevancy[n] = d_maxRelevancy[n];
updateRelevancy(n);
}
}
开发者ID:audemard,项目名称:CVC4,代码行数:9,代码来源:relevancy.cpp
示例7: preRegister
void InequalitySolver::preRegister(TNode node) {
Kind kind = node.getKind();
if (kind == kind::EQUAL ||
kind == kind::BITVECTOR_ULE ||
kind == kind::BITVECTOR_ULT) {
d_ineqTerms.insert(node[0]);
d_ineqTerms.insert(node[1]);
}
}
开发者ID:CVC4,项目名称:CVC4,代码行数:9,代码来源:bv_subtheory_inequality.cpp
示例8: preRegisterTerm
void TheoryQuantifiers::preRegisterTerm(TNode n) {
Debug("quantifiers-prereg") << "TheoryQuantifiers::preRegisterTerm() " << n << endl;
if( n.getKind()==FORALL ){
if( !options::cbqi() || options::recurseCbqi() || !TermUtil::hasInstConstAttr(n) ){
getQuantifiersEngine()->registerQuantifier( n );
Debug("quantifiers-prereg") << "TheoryQuantifiers::preRegisterTerm() done " << n << endl;
}
}
}
开发者ID:dddejan,项目名称:CVC4,代码行数:9,代码来源:theory_quantifiers.cpp
示例9: Assert
Node TheoryBuiltinRewriter::blastChain(TNode in) {
Assert(in.getKind() == kind::CHAIN);
Kind chainedOp = in.getOperator().getConst<Chain>().getOperator();
if(in.getNumChildren() == 2) {
// if this is the case exactly 1 pair will be generated so the
// AND is not required
return NodeManager::currentNM()->mkNode(chainedOp, in[0], in[1]);
} else {
NodeBuilder<> conj(kind::AND);
for(TNode::iterator i = in.begin(), j = i + 1; j != in.end(); ++i, ++j) {
conj << NodeManager::currentNM()->mkNode(chainedOp, *i, *j);
}
return conj;
}
}
开发者ID:Awesomeclaw,项目名称:CVC4,代码行数:18,代码来源:theory_builtin_rewriter.cpp
示例10: getSymbolsUsedBy
vector<string> QueryEvaluator::getSymbolsUsedBy(TNode * node) {
vector<string> results;
int size = node->getNumChildren();
for (int i=0; i<size; i++) {
TNode * child = node->getChildAtIndex(i);
if (child->getType()==QuerySymbol) {
results.push_back(child->getValue());
}
vector<string> sub_results = getSymbolsUsedBy(child);
for (size_t j=0; j<sub_results.size(); j++) {
if (find(results.begin(), results.end(), sub_results[j])==results.end())
results.push_back(sub_results[j]);
}
}
return results;
}
开发者ID:SeanNguyen,项目名称:cs3202-team-4-repo,代码行数:18,代码来源:QueryEvaluator.cpp
示例11: isConjunctionOfAtomsRec
bool AbstractionModule::isConjunctionOfAtomsRec(TNode node, TNodeSet& seen) {
if (seen.find(node)!= seen.end())
return true;
if (!node.getType().isBitVector()) {
return (node.getKind() == kind::AND || utils::isBVPredicate(node));
}
if (node.getNumChildren() == 0)
return true;
for (unsigned i = 0; i < node.getNumChildren(); ++i) {
if (!isConjunctionOfAtomsRec(node[i], seen))
return false;
}
seen.insert(node);
return true;
}
开发者ID:jinala,项目名称:CVC4,代码行数:18,代码来源:abstraction.cpp
示例12: isKnown
bool SharedTermsDatabase::isKnown(TNode literal) const {
bool polarity = literal.getKind() != kind::NOT;
TNode equality = polarity ? literal : literal[0];
if (polarity) {
return d_equalityEngine.areEqual(equality[0], equality[1]);
} else {
return d_equalityEngine.areDisequal(equality[0], equality[1], false);
}
}
开发者ID:CVC4,项目名称:CVC4,代码行数:9,代码来源:shared_terms_database.cpp
示例13: while
/**
* return value as the model suggested. The history state must be historified
* or the history's level should be 0. when level == 0 but idx != 0, the
* history is a psuedo unigram state used for this model to combine another
* bigram cache language model
*/
double
CThreadSlm::rawTransfer(TState history, unsigned int wid, TState& result)
{
unsigned int lvl = history.getLevel();
unsigned int pos = history.getIdx();
double cost = (m_UseLogPr)?0.0:1.0;
// NON_Word id must be dealed with special, let it transfer to root
// without any cost
if (ID_NOT_WORD == wid) {
result = 0;
return cost;
}
while (true) {
//for psuedo cache model unigram state
TNode* pn = ((TNode *)m_Levels[lvl]) + ((lvl)?pos:0);
unsigned int t = (pn+1)->ch();
if (lvl < m_N-1) {
TNode* pBase =(TNode*)m_Levels[lvl+1];
unsigned int idx = find_id(pBase, pn->ch(), t, wid);
if (idx != t) {
result.setIdx(idx);
result.setLevel(lvl+1);
double pr = m_prTable[pBase[idx].pr()];
return (m_UseLogPr)?(cost+pr):(cost*pr);
}
} else {
TLeaf* pBase =(TLeaf*)m_Levels[lvl+1];
unsigned int idx = find_id(pBase, pn->ch(), t, wid);
if (idx != t) {
result.setIdx(idx);
result.setLevel(lvl+1);
double pr = m_prTable[pBase[idx].pr()];
return (m_UseLogPr)?(cost+pr):(cost*pr);
}
}
if (m_UseLogPr)
cost += m_bowTable[pn->bow()];
else
cost *= m_bowTable[pn->bow()];
if (lvl == 0)
break;
lvl = pn->bol();
pos = pn->bon();
}
result.setLevel(0);
result.setIdx(0);
if (m_UseLogPr)
return cost + m_prTable[((TNode *)m_Levels[0])->pr()];
else
return cost * m_prTable[((TNode *)m_Levels[0])->pr()];
}
开发者ID:XueWei,项目名称:sunpinyin,代码行数:65,代码来源:slm.cpp
示例14: ppRewrite
Node TheoryUF::ppRewrite(TNode node) {
if (node.getKind() != kind::APPLY_UF) {
return node;
}
// perform the callbacks requested by TheoryUF::registerPpRewrite()
RegisterPpRewrites::iterator c = d_registeredPpRewrites.find(node.getOperator());
if (c == d_registeredPpRewrites.end()) {
return node;
} else {
Node res = c->second->ppRewrite(node);
if (res != node) {
return ppRewrite(res);
} else {
return res;
}
}
}
开发者ID:Awesomeclaw,项目名称:CVC4,代码行数:19,代码来源:theory_uf.cpp
示例15: isConvertibleBvTerm
bool BvToBoolPreprocessor::isConvertibleBvTerm(TNode node) {
if (!node.getType().isBitVector() ||
node.getType().getBitVectorSize() != 1)
return false;
Kind kind = node.getKind();
if (kind == kind::CONST_BITVECTOR ||
kind == kind::ITE ||
kind == kind::BITVECTOR_AND ||
kind == kind::BITVECTOR_OR ||
kind == kind::BITVECTOR_NOT ||
kind == kind::BITVECTOR_XOR ||
kind == kind::BITVECTOR_COMP) {
return true;
}
return false;
}
开发者ID:lianah,项目名称:CVC4,代码行数:19,代码来源:bv_to_bool.cpp
示例16: isConvertibleBvAtom
bool BvToBoolPreprocessor::isConvertibleBvAtom(TNode node) {
Kind kind = node.getKind();
return (kind == kind::EQUAL &&
node[0].getType().isBitVector() &&
node[0].getType().getBitVectorSize() == 1 &&
node[1].getType().isBitVector() &&
node[1].getType().getBitVectorSize() == 1 &&
node[0].getKind() != kind::BITVECTOR_EXTRACT &&
node[1].getKind() != kind::BITVECTOR_EXTRACT);
}
开发者ID:lianah,项目名称:CVC4,代码行数:10,代码来源:bv_to_bool.cpp
示例17: preRewrite
// static
RewriteResponse TheorySetsRewriter::preRewrite(TNode node) {
NodeManager* nm = NodeManager::currentNM();
// do nothing
if(node.getKind() == kind::EQUAL && node[0] == node[1])
return RewriteResponse(REWRITE_DONE, nm->mkConst(true));
// Further optimization, if constants but differing ones
return RewriteResponse(REWRITE_DONE, node);
}
开发者ID:Awesomeclaw,项目名称:CVC4,代码行数:11,代码来源:theory_sets_rewriter.cpp
示例18: preRegister
void EqualitySolver::preRegister(TNode node) {
if (!d_useEqualityEngine)
return;
if (node.getKind() == kind::EQUAL) {
d_equalityEngine.addTriggerEquality(node);
} else {
d_equalityEngine.addTerm(node);
}
}
开发者ID:bobot,项目名称:CVC4.old-svn,代码行数:10,代码来源:bv_subtheory_eq.cpp
示例19: addAssertion
bool BVQuickCheck::addAssertion(TNode assertion) {
Assert (assertion.getType().isBoolean());
d_bitblaster->bbAtom(assertion);
// assert to sat solver and run bcp to detect easy conflicts
bool ok = d_bitblaster->assertToSat(assertion, true);
if (!ok) {
setConflict();
}
return ok;
}
开发者ID:jinala,项目名称:CVC4,代码行数:10,代码来源:bv_quick_check.cpp
示例20: storeExtract
void ExtractSkolemizer::storeExtract(TNode var, unsigned high, unsigned low) {
Assert (var.getMetaKind() == kind::metakind::VARIABLE);
if (d_varToExtract.find(var) == d_varToExtract.end()) {
d_varToExtract[var] = ExtractList(utils::getSize(var));
}
VarExtractMap::iterator it = d_varToExtract.find(var);
ExtractList& el = it->second;
Extract e(high, low);
el.addExtract(e);
}
开发者ID:jinala,项目名称:CVC4,代码行数:10,代码来源:bv_subtheory_algebraic.cpp
注:本文中的TNode类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论