mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
Add command to set initial value hints for solver in various components
This commit is contained in:
parent
1c163dbad2
commit
a3f35b6830
17 changed files with 82 additions and 8 deletions
|
@ -1789,6 +1789,26 @@ namespace smt {
|
|||
return false;
|
||||
}
|
||||
|
||||
void theory_bv::initialize_value(expr* var, expr* value) {
|
||||
rational val;
|
||||
unsigned sz;
|
||||
if (!m_util.is_numeral(value, val, sz)) {
|
||||
IF_VERBOSE(5, verbose_stream() << "value should be a bit-vector " << mk_pp(value, m) << "\n");
|
||||
return;
|
||||
}
|
||||
if (!is_app(var))
|
||||
return;
|
||||
enode* n = mk_enode(to_app(var));
|
||||
auto v = get_var(n);
|
||||
unsigned idx = 0;
|
||||
for (auto lit : m_bits[v]) {
|
||||
auto & b = ctx.get_bdata(lit.var());
|
||||
b.m_phase_available = true;
|
||||
b.m_phase = val.get_bit(idx);
|
||||
++idx;
|
||||
}
|
||||
}
|
||||
|
||||
void theory_bv::init_model(model_generator & mg) {
|
||||
m_factory = alloc(bv_factory, m);
|
||||
mg.register_factory(m_factory);
|
||||
|
|
|
@ -251,6 +251,7 @@ namespace smt {
|
|||
bool merge_zero_one_bits(theory_var r1, theory_var r2);
|
||||
bool can_propagate() override { return m_prop_diseqs_qhead < m_prop_diseqs.size(); }
|
||||
void propagate() override;
|
||||
void initialize_value(expr* var, expr* value) override;
|
||||
|
||||
// -----------------------------------
|
||||
//
|
||||
|
|
|
@ -154,7 +154,6 @@ class theory_lra::imp {
|
|||
svector<delayed_atom> m_asserted_atoms;
|
||||
ptr_vector<expr> m_not_handled;
|
||||
ptr_vector<app> m_underspecified;
|
||||
vector<std::pair<lpvar, rational>> m_values;
|
||||
vector<ptr_vector<api_bound> > m_use_list; // bounds where variables are used.
|
||||
|
||||
// attributes for incremental version:
|
||||
|
@ -998,8 +997,7 @@ public:
|
|||
IF_VERBOSE(5, verbose_stream() << "numeric constant expected in initialization " << mk_pp(var, m) << " := " << mk_pp(value, m) << "\n");
|
||||
return;
|
||||
}
|
||||
ctx().push_trail(push_back_vector(m_values));
|
||||
m_values.push_back({get_lpvar(var), r});
|
||||
lp().move_lpvar_to_value(get_lpvar(var), r);
|
||||
}
|
||||
|
||||
void new_eq_eh(theory_var v1, theory_var v2) {
|
||||
|
@ -1420,8 +1418,6 @@ public:
|
|||
void init_search_eh() {
|
||||
m_arith_eq_adapter.init_search_eh();
|
||||
m_num_conflicts = 0;
|
||||
for (auto const& [v, r] : m_values)
|
||||
lp().move_lpvar_to_value(v, r);
|
||||
}
|
||||
|
||||
bool can_get_value(theory_var v) const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue