Beispiel #1
0
inline bool PropEngine::propTriClauseAnyOrder(
    watch_subarray_const::const_iterator i
    , const Lit lit1
    , PropBy& confl
) {
    const Lit lit2 = i->lit2();
    lbool val2 = value(lit2);

    //literal is already satisfied, nothing to do
    if (val2 == l_True)
        return true;

    const Lit lit3 = i->lit3();
    lbool val3 = value(lit3);

    //literal is already satisfied, nothing to do
    if (val3 == l_True)
        return true;

    if (val2 == l_False && val3 == l_False) {
        #ifdef VERBOSE_DEBUG_FULLPROP
        cout << "Conflict from "
            << lit1 << " , "
            << i->lit2() << " , "
            << i->lit3() << endl;
        #endif //VERBOSE_DEBUG_FULLPROP
        confl = PropBy(~lit1, i->lit3(), i->red());

        //Update stats
        if (i->red())
            lastConflictCausedBy = ConflCausedBy::trired;
        else
            lastConflictCausedBy = ConflCausedBy::triirred;

        failBinLit = i->lit2();
        qhead = trail.size();
        return false;
    }
    if (val2 == l_Undef && val3 == l_False) {
        propTriHelperAnyOrder<update_bogoprops>(
            lit1
            , lit2
            , lit3
            , i->red()
        );
        return true;
    }

    if (val3 == l_Undef && val2 == l_False) {
        propTriHelperAnyOrder<update_bogoprops>(
            lit1
            , lit3
            , lit2
            , i->red()
        );
        return true;
    }

    return true;
}
inline bool SolutionExtender::propTriClause(
    watch_subarray_const::const_iterator i
    , const Lit p
) {
    const Lit lit2 = i->lit2();
    lbool val2 = value(lit2);

    //literal is already satisfied, nothing to do
    if (val2 == l_True)
        return true;

    const Lit lit3 = i->lit3();
    lbool val3 = value(lit3);

    //literal is already satisfied, nothing to do
    if (val3 == l_True)
        return true;

    if (val2 == l_False && val3 == l_False) {
        return false;
    }
    if (val2 == l_Undef && val3 == l_False) {
        #ifdef VERBOSE_DEBUG_RECONSTRUCT
        cout
        << "c Due to cl "
        << ~p << ", "
        << i->lit2() << ", "
        << i->lit3()
        << " propagate enqueueing "
        << lit2 << endl;
        #endif
        enqueue(lit2);
        return true;
    }

    if (val3 == l_Undef && val2 == l_False) {
        #ifdef VERBOSE_DEBUG_RECONSTRUCT
        cout
        << "c Due to cl "
        << ~p << ", "
        << i->lit2() << ", "
        << i->lit3()
        << " propagate enqueueing "
        << lit3 << endl;
        #endif
        enqueue(lit3);
        return true;
    }

    return true;
}
Beispiel #3
0
PropResult HyperEngine::prop_tri_clause_with_acestor_info(
    watch_subarray_const::const_iterator i
    , const Lit lit1
    , PropBy& confl
) {
    const Lit lit2 = i->lit2();
    lbool val2 = value(lit2);

    //literal is already satisfied, nothing to do
    if (val2 == l_True)
        return PROP_NOTHING;

    const Lit lit3 = i->lit3();
    lbool val3 = value(lit3);

    //literal is already satisfied, nothing to do
    if (val3 == l_True)
        return PROP_NOTHING;

    if (val2 == l_False && val3 == l_False) {
        return handle_prop_tri_fail(i, lit1, confl);
    }

    if (val2 == l_Undef && val3 == l_False) {
        return propTriHelperComplex(lit2, ~lit1, lit3, i->red());
    }

    if (val3 == l_Undef && val2 == l_False) {
        return propTriHelperComplex(lit3, ~lit1,  lit2, i->red());
    }

    return PROP_NOTHING;
}
Beispiel #4
0
PropResult PropEngine::handle_prop_tri_fail(
    watch_subarray_const::const_iterator i
    , Lit lit1
    , PropBy& confl
) {
    #ifdef VERBOSE_DEBUG_FULLPROP
    cout << "Conflict from "
        << lit1 << " , "
        << i->lit2() << " , "
        << i->lit3() << endl;
    #endif //VERBOSE_DEBUG_FULLPROP
    confl = PropBy(~lit1, i->lit3(), i->red());

    //Update stats
    if (i->red())
        lastConflictCausedBy = ConflCausedBy::trired;
    else
        lastConflictCausedBy = ConflCausedBy::triirred;

    failBinLit = i->lit2();
    qhead = trail.size();
    return PROP_FAIL;
}