mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 01:25:31 +00:00
add has_value utility to retrieve value from solver state
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
593a6e5139
commit
b6054b8406
3 changed files with 25 additions and 2 deletions
|
@ -2606,8 +2606,11 @@ public:
|
|||
|
||||
bool get_value(enode* n, expr_ref& r) {
|
||||
theory_var v = n->get_th_var(get_id());
|
||||
if (can_get_value(v)) {
|
||||
r = a.mk_numeral(get_value(v), is_int(n));
|
||||
if (!can_get_bound(v)) return false;
|
||||
lp::var_index vi = m_theory_var2var_index[v];
|
||||
rational val;
|
||||
if (m_solver->has_value(vi, val)) {
|
||||
r = a.mk_numeral(val, is_int(n));
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue