当前位置: 首页>>代码示例>>C++>>正文


C++ Interpretation::getFact方法代码示例

本文整理汇总了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();
	}


}
开发者ID:hexhex,项目名称:caspplugin,代码行数:47,代码来源:ConsistencyAtom.cpp


注:本文中的Interpretation::getFact方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。