本文整理汇总了C++中Predicate::getTermTypeAsInt方法的典型用法代码示例。如果您正苦于以下问题:C++ Predicate::getTermTypeAsInt方法的具体用法?C++ Predicate::getTermTypeAsInt怎么用?C++ Predicate::getTermTypeAsInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Predicate
的用法示例。
在下文中一共展示了Predicate::getTermTypeAsInt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getNonEvidenceAtom
/*
* Caller is responsible for deleting returned Predicate* if necessary
*/
Predicate* Domain::getNonEvidenceAtom(const int& index) const
{
int predId = -1;
int numAtomsPerPred;
int numAtoms = 0;
for (int i = 0; i < getNumPredicates(); i++)
{
numAtomsPerPred = (*numNonEvidAtomsPerPred_)[i];
if (numAtoms + numAtomsPerPred >= index + 1)
{
predId = i;
break;
}
numAtoms += numAtomsPerPred;
}
assert(predId >= 0);
// Get the newIndex-th grounding of f.o. pred with id predId
Predicate* pred = createPredicate(predId, false);
// Not all groundings of pred are non-evidence, so we need the while loop
bool foundNE = false;
while(!foundNE)
{
for (int i = 0; i < pred->getNumTerms(); i++)
{
int termType = pred->getTermTypeAsInt(i);
const Array<int>* constantsByType = getConstantsByType(termType);
int constIdx = random() % constantsByType->size();
pred->setTermToConstant(i, (*constantsByType)[constIdx]);
}
assert(pred->isGrounded());
if (!db_->getEvidenceStatus(pred)) foundNE = true;
}
return pred;
}