src/hyperengine.cpp
/**
hop backwards from thisAncestor until:
1) we reach ancestor of 'conflict' -- at this point, we return TRUE
2) we reach an invalid point. Either root, or an invalid hop. We return FALSE.
*/
hop backwards from thisAncestor until:
1) we reach ancestor of 'conflict' -- at this point, we return TRUE
2) we reach an invalid point. Either root, or an invalid hop. We return FALSE.
hop backwards from thisAncestor until : 1 ) we reach ancestor of ' conflict ' -- at this point we return TRUE 2 ) we reach an invalid point . Either root or an invalid hop . We return FALSE .
bool HyperEngine::is_ancestor_of(
    const Lit conflict
    , Lit thisAncestor
    , const bool thisStepRed
    , const bool onlyIrred
    , const Lit lookingForAncestor
) {
    propStats.otfHyperTime += 1;
    #ifdef VERBOSE_DEBUG_FULLPROP
    cout << "is_ancestor_of."
    << "conflict: " << conflict
    << " thisAncestor: " << thisAncestor
    << " thisStepRed: " << thisStepRed
    << " onlyIrred: " << onlyIrred
    << " lookingForAncestor: " << lookingForAncestor << endl;
    #endif
    if (lookingForAncestor == lit_Undef)
        return false;
    if (lookingForAncestor == thisAncestor) {
        #ifdef VERBOSE_DEBUG_FULLPROP
        cout << "Last position inside prop queue is not saved during propFull" << endl
        << "This may be the same exact binary clause -- not removing" << endl;
        #endif
        return false;
    }
    #ifdef VERBOSE_DEBUG_FULLPROP
    cout << "Looking for ancestor of " << conflict << " : " << lookingForAncestor << endl;
    cout << "This step based on redundant cl? " << (thisStepRed ? "yes" : "false") << endl;
    cout << "Only irred is acceptable?" << (onlyIrred ? "yes" : "no") << endl;
    cout << "This step would be based on redundant cl?" << (thisStepRed ? "yes" : "no") << endl;
    #endif
    if (onlyIrred && thisStepRed) {
        #ifdef VERBOSE_DEBUG_FULLPROP
        cout << "This step doesn't work -- is redundant but needs irred" << endl;
        #endif
        return false;
    }
    const size_t bottom = depth[lookingForAncestor.var()];
    while(thisAncestor != lit_Undef
        && (!use_depth_trick || bottom <= depth[thisAncestor.var()])
    ) {
        #ifdef VERBOSE_DEBUG_FULLPROP
        cout << "Current acestor: " << thisAncestor
        << " redundant step? " << varData[thisAncestor.var()].reason.isRedStep()
        << endl;
        #endif
        if (thisAncestor == conflict) {
            #ifdef VERBOSE_DEBUG_FULLPROP
            cout << "We are trying to step over the conflict."
            << " That would create a loop." << endl;
            #endif
            return false;
        }
        if (thisAncestor == lookingForAncestor) {
            #ifdef VERBOSE_DEBUG_FULLPROP
            cout << "Ancestor found" << endl;
            #endif
            return true;
        }
        const PropBy& data = varData[thisAncestor.var()].reason;
        if ((onlyIrred && data.isRedStep())
            || data.getHyperbinNotAdded()
        ) {
            #ifdef VERBOSE_DEBUG_FULLPROP
            cout << "Wrong kind of hop would be needed" << endl;
            #endif
            return false;  
        }
        thisAncestor = data.getAncestor();
        propStats.otfHyperTime += 1;
    }
    #ifdef VERBOSE_DEBUG_FULLPROP
    cout << "Exit, reached root" << endl;
    #endif
    return false;
}
bool HyperEngine :: is_ancestor_of ( const Lit conflict , Lit thisAncestor , const bool thisStepRed , const bool onlyIrred , const Lit lookingForAncestor ) { propStats . otfHyperTime += 1 ; #ifdef VERBOSE_DEBUG_FULLPROP cout << " " << " " << conflict << " " << thisAncestor << " " << thisStepRed << " " << onlyIrred << " " << lookingForAncestor << endl ; #endif if ( lookingForAncestor == lit_Undef ) return false ; if ( lookingForAncestor == thisAncestor ) { #ifdef VERBOSE_DEBUG_FULLPROP cout << " " << endl << " " << endl ; #endif return false ; } #ifdef VERBOSE_DEBUG_FULLPROP cout << " " << conflict << " " << lookingForAncestor << endl ; cout << " " << ( thisStepRed ? " " : " " ) << endl ; cout << " " << ( onlyIrred ? " " : " " ) << endl ; cout << " " << ( thisStepRed ? " " : " " ) << endl ; #endif if ( onlyIrred && thisStepRed ) { #ifdef VERBOSE_DEBUG_FULLPROP cout << " " << endl ; #endif return false ; } const size_t bottom = depth [ lookingForAncestor . var ( ) ] ; while ( thisAncestor != lit_Undef && ( ! use_depth_trick || bottom <= depth [ thisAncestor . var ( ) ] ) ) { #ifdef VERBOSE_DEBUG_FULLPROP cout << " " << thisAncestor << " " << varData [ thisAncestor . var ( ) ] . reason . isRedStep ( ) << endl ; #endif if ( thisAncestor == conflict ) { #ifdef VERBOSE_DEBUG_FULLPROP cout << " " << " " << endl ; #endif return false ; } if ( thisAncestor == lookingForAncestor ) { #ifdef VERBOSE_DEBUG_FULLPROP cout << " " << endl ; #endif return true ; } const PropBy & data = varData [ thisAncestor . var ( ) ] . reason ; if ( ( onlyIrred && data . isRedStep ( ) ) || data . getHyperbinNotAdded ( ) ) { #ifdef VERBOSE_DEBUG_FULLPROP cout << " " << endl ; #endif return false ; } thisAncestor = data . getAncestor ( ) ; propStats . otfHyperTime += 1 ; } #ifdef VERBOSE_DEBUG_FULLPROP cout << " " << endl ; #endif return false ; }
hop backwards from thisAncestor until:
1) we reach ancestor of 'conflict' -- at this point, we return TRUE
2) we reach an invalid point.
hop backwards from thisAncestor until : 1 ) we reach ancestor of ' conflict ' -- at this point we return TRUE 2 ) we reach an invalid point .
//Was propagated at level 0 -- clauseCleaner will remove the clause //This is as low as we should search -- we cannot find what we are searchig for lower than this //reached would-be redundant hop (but this is irred)