3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

bugfixes, adding plugin solver

This commit is contained in:
Nikolaj Bjorner 2024-02-21 14:11:11 -08:00
parent 659e384ee7
commit cf72a916f8
7 changed files with 146 additions and 14 deletions

View file

@ -46,6 +46,7 @@ z3_add_component(sat_smt
q_solver.cpp
recfun_solver.cpp
sat_th.cpp
sls_solver.cpp
specrel_solver.cpp
tseitin_theory_checker.cpp
user_solver.cpp

View file

@ -0,0 +1,74 @@
/*++
Copyright (c) 2020 Microsoft Corporation
Module Name:
sls_solver
Abstract:
Interface to Concurrent SLS solver
Author:
Nikolaj Bjorner (nbjorner) 2024-02-21
--*/
#include "sat/smt/sls_solver.h"
#include "sat/smt/euf_solver.h"
#include "ast/sls/bv_sls.h"
namespace sls {
solver::solver(euf::solver& ctx):
th_euf_solver(ctx, symbol("sls"), ctx.get_manager().mk_family_id("sls")) {}
solver::~solver() {
if (m_rlimit) {
m_rlimit->cancel();
m_thread.join();
}
}
void solver::push_core() {
if (s().scope_lvl() == s().search_lvl() + 1)
init_local_search();
}
void solver::pop_core(unsigned n) {
if (s().scope_lvl() - n <= s().search_lvl())
sample_local_search();
}
void solver::simplify() {
}
void solver::init_local_search() {
if (m_rlimit) {
m_rlimit->cancel();
m_thread.join();
}
// set up state for local search solver here
auto* bvsls = alloc(bv::sls, m);
// walk clauses, add them
// walk trail stack until search level, add units
// encapsulate bvsls within the arguments of run-local-search.
// ensure bvsls does not touch ast-manager.
m_thread = std::thread([this]() { run_local_search(*this); });
m_rlimit = alloc(reslimit);
m_rlimit->push_child(&s().rlimit());
}
void solver::sample_local_search() {
}
void solver::run_local_search(solver& s) {
}
}

59
src/sat/smt/sls_solver.h Normal file
View file

@ -0,0 +1,59 @@
/*++
Copyright (c) 2020 Microsoft Corporation
Module Name:
sls_solver
Abstract:
Interface to Concurrent SLS solver
Author:
Nikolaj Bjorner (nbjorner) 2024-02-21
--*/
#pragma once
#include "sat/smt/sat_th.h"
#include "util/rlimit.h"
namespace euf {
class solver;
}
namespace sls {
class solver : public euf::th_euf_solver {
std::atomic<lbool> m_result;
std::atomic<bool> m_completed;
std::thread m_thread;
scoped_ptr<reslimit> m_rlimit;
void run_local_search(solver& s);
void init_local_search();
void sample_local_search();
public:
solver(euf::solver& ctx);
~solver();
void push_core() override;
void pop_core(unsigned n) override;
void simplify() override;
sat::literal internalize(expr* e, bool sign, bool root) override { UNREACHABLE(); return sat::null_literal; }
void internalize(expr* e) override { UNREACHABLE(); }
th_solver* clone(euf::solver& ctx) override { return alloc(solver, ctx); }
bool unit_propagate() override { return false; }
void get_antecedents(sat::literal l, sat::ext_justification_idx idx, sat::literal_vector & r, bool probing) override { UNREACHABLE(); }
sat::check_result check() override { return sat::check_result::CR_DONE; }
std::ostream & display(std::ostream & out) const override { return out; }
std::ostream & display_justification(std::ostream & out, sat::ext_justification_idx idx) const override { UNREACHABLE(); return out; }
std::ostream & display_constraint(std::ostream & out, sat::ext_constraint_idx idx) const override { UNREACHABLE(); return out; }
};
}