コード例 #1
0
ファイル: Reasoner.cpp プロジェクト: dgu123/factplusplus
bool
DlSatTester :: addToDoEntry ( DlCompletionTree* node, const ConceptWDep& C, const char* reason )
{
	if ( C == bpTOP )	// simplest things first
		return false;
	if ( C == bpBOTTOM )
	{
		setClashSet(C.getDep());
		if ( LLM.isWritable(llGTA) )
			logClash ( node, C );
		return true;
	}

	const DLVertex& v = DLHeap[C];
	DagTag tag = v.Type();

	// try to add a concept to a node label
	switch ( tryAddConcept ( node->label().getLabel(tag), C.bp(), C.getDep() ) )
	{
	case acrClash:	// clash -- return
		if ( LLM.isWritable(llGTA) )
			logClash ( node, C );
		return true;
	case acrExist:	// already exists -- nothing new
		return false;
	case acrDone:	// try was done
		return insertToDoEntry ( node, C, tag, reason );
	default:	// safety check
		fpp_unreachable();
	}
}
コード例 #2
0
// check if IR for the node contains C
bool DlCompletionTree :: inIRwithC ( const ConceptWDep& C, DepSet& dep ) const
{
	if ( IR.empty() )
		return false;

	for ( IRInfo::const_iterator p = IR.begin(); p != IR.end(); ++p )
		if ( p->bp() == C.bp() )
		{
			dep += p->getDep();
			dep += C.getDep();
			return true;
		}

	return false;
}
コード例 #3
0
// check if IR for the node contains C
bool DlCompletionTree :: inIRwithC ( const ConceptWDep& C, DepSet& dep ) const
{
    if ( IR.empty() )
        return false;

    for ( const auto& cwd: IR )
        if ( cwd.bp() == C.bp() )
        {
            dep += cwd.getDep();
            dep += C.getDep();
            return true;
        }

    return false;
}
コード例 #4
0
ファイル: Reasoner.cpp プロジェクト: dgu123/factplusplus
/// insert P to the label of N; do necessary updates; may return Clash in case of data node N
bool
DlSatTester :: insertToDoEntry ( DlCompletionTree* node, const ConceptWDep& C,
								 DagTag tag, const char* reason = NULL )
{
	// we will change current Node => save it if necessary
	updateLevel ( node, C.getDep() );
	CGraph.addConceptToNode ( node, C, tag );

	setUsed(C.bp());

	if ( node->isCached() )
		return correctCachedEntry(node);

	// add new info in TODO list
	TODO.addEntry ( node, tag, C );

	if ( node->isDataNode() )	// data concept -- run data center for it
		return checkDataNode ? checkDataClash(node) : false;
	else if ( LLM.isWritable(llGTA) )	// inform about it
		logEntry ( node, C, reason );

	return false;
}