Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asymmetric branching skips clauses #26

Open
mishun opened this issue Feb 3, 2016 · 1 comment
Open

Asymmetric branching skips clauses #26

mishun opened this issue Feb 3, 2016 · 1 comment

Comments

@mishun
Copy link

mishun commented Feb 3, 2016

Lets look at asymmetric branching code:

bool SimpSolver::asymmVar(Var v)
{
    assert(use_simplification);

    const vec<CRef>& cls = occurs.lookup(v);

    if (value(v) != l_Undef || cls.size() == 0)
        return true;

    for (int i = 0; i < cls.size(); i++)
        if (!asymm(v, cls[i]))
            return false;

    return backwardSubsumptionCheck();
}

Note that it calls asymm, wich in turn may call strengthenClause. strengthenClause removes clause from occurs, so in code above clause being at cls[i + 1] ends up at cls[i] and we skip it.
It can be tested by taking a copy of occurs.lookup(v) instead of reference --- there is a good chance of changing solver's output for almost any relatively complex sat problem (don't forget to enable asymetric branching).

@mishun
Copy link
Author

mishun commented Feb 3, 2016

Actually there is workaround against the similar problem in backwardSubsumptionCheck:

if (!strengthenClause(cs[j], ~l))
    return false;

// Did current candidate get deleted from cs? Then check candidate at index j again:
if (var(l) == best)
    j--;

that works incorrectly if clause contains 2 literals (in that case strengthenClause deletes from occurs lazily).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant