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

Regression when passing assumptions that cause trivial conflicts #72

Closed
rkaminsk opened this issue Sep 28, 2021 · 2 comments
Closed

Regression when passing assumptions that cause trivial conflicts #72

rkaminsk opened this issue Sep 28, 2021 · 2 comments

Comments

@rkaminsk
Copy link
Member

A clingo user discovered a regression when passing assumptions in potassco/clingo#336.

The following program outputs model { a } even though a is assumed to be false:

#include <clingo.hh>

class SEH : public Clingo::SolveEventHandler {
public:
    bool on_model(Clingo::Model &m) override {
        std::cerr << "model: " << m << std::endl;
        return true;
    }
};

Clingo::SolveHandle iterate(Clingo::SolveHandle &&hnd) {
    for (auto const &m : hnd) { }
    return std::move(hnd);
}

int main() {
    Clingo::Control ctl;
    ctl.add("base", {}, "a.");
    ctl.ground({{"base", {}}});
    SEH seh;
    auto atom_a = ctl.symbolic_atoms().find(Clingo::Function("a", {}))->literal();
    std::cerr << "Solving iteratively..." << std::endl;
    iterate(ctl.solve(Clingo::LiteralSpan{-atom_a}, &seh, false, true)).get();
    std::cerr << "Solving iteratively and asynchronously..." << std::endl;
    iterate(ctl.solve(Clingo::LiteralSpan{-atom_a}, &seh, true, true)).get();
    std::cerr << "Solving asynchronously..." << std::endl;
    ctl.solve(Clingo::LiteralSpan{-atom_a}, &seh, true, false).get();
    std::cerr << "Solving..." << std::endl;
    ctl.solve(Clingo::LiteralSpan{-atom_a}, &seh, false, false).get();
}

The bug is only triggered if iterative solving but not asynchronous solving is enabled.

BenKaufmann added a commit that referenced this issue Oct 2, 2021
* Fix regression in iterative (sequential) solving where UNSAT detected
  in start() no longer terminated the algorithm in the following call
  to next().
@BenKaufmann
Copy link
Contributor

Oh, sorry for that! Hopefully fixed again in dev.

@rkaminsk
Copy link
Member Author

rkaminsk commented Oct 2, 2021

Thanks. My small program works now.

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

2 participants