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

fixing lex optimization

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2013-12-13 23:36:42 +01:00
parent df5c2adc4e
commit 8c85ee6b7c
13 changed files with 219 additions and 125 deletions

View file

@ -3937,6 +3937,11 @@ namespace smt {
return th->get_value(n, value);
}
void context::update_model() {
mk_proto_model(l_true);
m_model = m_proto_model->mk_model();
}
void context::mk_proto_model(lbool r) {
TRACE("get_model",
display(tout);

View file

@ -1390,6 +1390,8 @@ namespace smt {
void get_model(model_ref & m) const;
void update_model();
void get_proto_model(proto_model_ref & m) const;
unsigned get_num_asserted_formulas() const { return m_asserted_formulas.get_num_formulas(); }

View file

@ -1000,7 +1000,7 @@ namespace smt {
virtual inf_eps_rational<inf_rational> maximize(theory_var v);
virtual theory_var add_objective(app* term);
virtual expr* mk_gt(theory_var v, inf_rational const& val);
virtual expr* mk_ge(theory_var v, inf_numeral const& val);
virtual expr* mk_ge(filter_model_converter& fm, theory_var v, inf_numeral const& val);
void enable_record_conflict(expr* bound);
void record_conflict(unsigned num_lits, literal const * lits,
unsigned num_eqs, enode_pair const * eqs,

View file

@ -23,6 +23,7 @@ Revision History:
#include"theory_arith.h"
#include"smt_farkas_util.h"
#include"th_rewriter.h"
#include"filter_model_converter.h"
namespace smt {
@ -1085,14 +1086,15 @@ namespace smt {
This allows to handle inequalities with non-standard numbers.
*/
template<typename Ext>
expr* theory_arith<Ext>::mk_ge(theory_var v, inf_numeral const& val) {
expr* theory_arith<Ext>::mk_ge(filter_model_converter& fm, theory_var v, inf_numeral const& val) {
SASSERT(m_objective_theory_vars.contains(v));
ast_manager& m = get_manager();
context& ctx = get_context();
std::ostringstream strm;
strm << val << " <= v" << v;
expr* b = m.mk_const(symbol(strm.str().c_str()), m.mk_bool_sort());
strm << val << " <= " << mk_pp(get_enode(v)->get_owner(), get_manager());
app* b = m.mk_const(symbol(strm.str().c_str()), m.mk_bool_sort());
if (!ctx.b_internalized(b)) {
fm.insert(b->get_decl());
bool_var bv = ctx.mk_bool_var(b);
ctx.set_var_theory(bv, get_id());
// ctx.set_enode_flag(bv, true);

View file

@ -24,6 +24,7 @@ Notes:
#ifndef _THEORY_OPT_H_
#define _THEORY_OPT_H_
class filter_model_converter;
namespace smt {
class theory_opt {
public:
@ -31,7 +32,7 @@ namespace smt {
virtual inf_eps maximize(theory_var v) { UNREACHABLE(); return inf_eps::infinity(); }
virtual theory_var add_objective(app* term) { UNREACHABLE(); return null_theory_var; }
virtual expr* mk_gt(theory_var v, inf_rational const& val) { UNREACHABLE(); return 0; }
virtual expr* mk_ge(theory_var v, inf_eps const& val) { UNREACHABLE(); return 0; }
virtual expr* mk_ge(filter_model_converter& fm, theory_var v, inf_eps const& val) { UNREACHABLE(); return 0; }
};
}