本文整理汇总了C++中Interpretation::getFact方法的典型用法代码示例。如果您正苦于以下问题:C++ Interpretation::getFact方法的具体用法?C++ Interpretation::getFact怎么用?C++ Interpretation::getFact使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Interpretation
的用法示例。
在下文中一共展示了Interpretation::getFact方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: anticipateLearning
void ConsistencyAtom::anticipateLearning(RegistryPtr& registry,const InterpretationConstPtr& assigned,NogoodContainerPtr& nogoods,
vector<string>& expressions,vector<ID>& atomIds,vector<OrdinaryAtom> &sumData,int domainMinValue,int domainMaxValue,string& globalConstraintName,string& globalConstraintValue,Interpretation& toCheck)
{
pm.updateMask();
Interpretation::TrueBitIterator it, it_end;
boost::tie(it, it_end) = pm.mask()->trueBits();
//iterate over all Ordinary ground atom (expr and not_expr)
for(;it!=it_end;it++)
{
//if the atom is not assigned, add atom to lists in order to check consistency
if(assigned->getFact(*it))
{
continue;
}
const OrdinaryAtom& atom=pm.mask()->getAtomToBit(it);
if (atom.tuple[0]==exprAuxID && (!cspGraphLearning || !cpVariables.getFact(*it) || toCheck.getFact(*it))) {
expressions.push_back(getExpressionFromID(registry,atom,false));
atomIds.push_back(registry->ogatoms.getIDByTuple(atom.tuple));
}
else if (atom.tuple[0]==not_exprAuxID && (!cspGraphLearning ||!cpVariables.getFact(*it) || toCheck.getFact(*it))) {
expressions.push_back(getExpressionFromID(registry,atom,true));
atomIds.push_back(registry->ogatoms.getIDByTuple(atom.tuple));
}
GecodeSolver* solver = new GecodeSolver(registry,sumData,domainMinValue, domainMaxValue, globalConstraintName, globalConstraintValue, simpleParser);
solver->propagate(expressions);
Gecode::Search::Options opt;
Gecode::BAB<GecodeSolver> solutions(solver,opt);
//if the solution is not consistent try to learn nogoods
if (solutions.next()==NULL)
{
GecodeSolver* otherSolver = new GecodeSolver(registry,sumData, domainMinValue,domainMaxValue, globalConstraintName, globalConstraintValue, simpleParser);
//try to learn no goods
backwardlearningProcessor->learnNogoods(nogoods,expressions,atomIds,otherSolver);
delete otherSolver;
}
delete solver;
expressions.pop_back();
atomIds.pop_back();
}
}