コード例 #1
0
static void handle_minus(StateType& state, typename StateType::clause_type clause, typename StateType::variable_type flip)
{
    if(state.num_true_literals(clause) == 1)
    {
        for(auto literal : clause)
            state.inc_makecount(literal.variable(), state.weight(clause));

        state.dec_breakcount(flip, state.weight(clause));
    }
    else if(state.num_true_literals(clause) == 2)
    {
        if(flip == state.watcher1(clause))
            state.watcher1(clause, state.watcher2(clause));

        state.inc_breakcount(state.watcher1(clause), state.weight(clause));
    }
    else
    {
        if(flip == state.watcher1(clause))
        {
            for(auto literal : clause)
                if(state.is_sat(literal) &&
                        literal.variable() != flip &&
                        literal.variable() != state.watcher2(clause))
                {
                    state.watcher1(clause, literal.variable());
                    break;
                }
        }
        else if(flip == state.watcher2(clause))
            for(auto literal : clause)
                if(state.is_sat(literal) &&
                        literal.variable() != flip &&
                        literal.variable() != state.watcher1(clause))
                {
                    state.watcher2(clause, literal.variable());
                    break;
                }
    }

    state.dec_num_true_literals(clause);
}
コード例 #2
0
    static void handle_plus(StateType& state, typename StateType::clause_type clause, typename StateType::variable_type flip)
    {
        if(state.num_true_literals(clause) == 0)
        {
            state.inc_breakcount(flip, state.weight(clause));
            state.watcher1(clause, flip);
        }
        else if(state.num_true_literals(clause) == 1)
        {
            state.dec_breakcount(state.watcher1(clause), state.weight(clause));
            state.watcher2(clause, flip);
        }

        state.inc_num_true_literals(clause);
    }