mirror of
https://github.com/Z3Prover/z3
synced 2025-04-29 11:55:51 +00:00
Added function to select the next variable to split on (User-Propagator) (#6096)
* Added function to select the next variable to split on * Fixed typo * Small fixes * uint -> int
This commit is contained in:
parent
f08e3d70a9
commit
2fa60aa43c
17 changed files with 255 additions and 104 deletions
|
@ -56,6 +56,18 @@ namespace user_solver {
|
|||
void solver::register_cb(expr* e) {
|
||||
add_expr(e);
|
||||
}
|
||||
|
||||
void solver::next_split_cb(expr* e, unsigned idx, lbool phase) {
|
||||
if (e == nullptr) {
|
||||
m_next_split_expr = nullptr;
|
||||
return;
|
||||
}
|
||||
force_push();
|
||||
ctx.internalize(e, false);
|
||||
m_next_split_expr = e;
|
||||
m_next_split_idx = idx;
|
||||
m_next_split_phase = phase;
|
||||
}
|
||||
|
||||
sat::check_result solver::check() {
|
||||
if (!(bool)m_final_eh)
|
||||
|
@ -72,6 +84,41 @@ namespace user_solver {
|
|||
m_id2justification.setx(v, sat::literal_vector(num_lits, jlits), sat::literal_vector());
|
||||
m_fixed_eh(m_user_context, this, var2expr(v), value);
|
||||
}
|
||||
|
||||
bool solver::decide(sat::bool_var& var, lbool& phase) {
|
||||
|
||||
if (!m_decide_eh)
|
||||
return false;
|
||||
|
||||
euf::enode* original_enode = bool_var2enode(var);
|
||||
|
||||
if (!is_attached_to_var(original_enode))
|
||||
return false;
|
||||
|
||||
unsigned new_bit = 0; // ignored; currently no bv-support
|
||||
expr* e = bool_var2expr(var);
|
||||
|
||||
m_decide_eh(m_user_context, this, &e, &new_bit, &phase);
|
||||
|
||||
euf::enode* new_enode = ctx.get_enode(e);
|
||||
|
||||
if (original_enode == new_enode)
|
||||
return false;
|
||||
|
||||
var = new_enode->bool_var();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool solver::get_case_split(sat::bool_var& var, lbool &phase){
|
||||
if (!m_next_split_expr)
|
||||
return false;
|
||||
|
||||
euf::enode* n = ctx.get_enode(m_next_split_expr);
|
||||
var = n->bool_var();
|
||||
phase = m_next_split_phase;
|
||||
m_next_split_expr = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
void solver::asserted(sat::literal lit) {
|
||||
if (!m_fixed_eh)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue