mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
fix APIs, add python API
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
0181f0f9df
commit
ff1543d700
12 changed files with 193 additions and 35 deletions
|
@ -1061,6 +1061,9 @@ namespace smt {
|
|||
TRACE("opt", tout << mk_pp(term, get_manager()) << " |-> v" << v << "\n";);
|
||||
TRACE("opt", tout << "data-size: " << m_data.size() << "\n";);
|
||||
SASSERT(!is_quasi_base(v));
|
||||
if (!is_linear(get_manager(), term)) {
|
||||
v = null_theory_var;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
|
@ -1000,7 +1000,10 @@ namespace smt {
|
|||
theory_var result = m_objectives.size();
|
||||
rational q(1), r(0);
|
||||
expr_ref_vector vr(get_manager());
|
||||
if (internalize_objective(term, q, r, objective)) {
|
||||
if (!is_linear(get_manager(), term)) {
|
||||
result = null_theory_var;
|
||||
}
|
||||
else if (internalize_objective(term, q, r, objective)) {
|
||||
m_objectives.push_back(objective);
|
||||
m_objective_consts.push_back(r);
|
||||
m_objective_assignments.push_back(vr);
|
||||
|
|
|
@ -1173,7 +1173,10 @@ theory_var theory_diff_logic<Ext>::add_objective(app* term) {
|
|||
theory_var result = m_objectives.size();
|
||||
rational q(1), r(0);
|
||||
expr_ref_vector vr(get_manager());
|
||||
if (internalize_objective(term, q, r, objective)) {
|
||||
if (!is_linear(get_manager(), term)) {
|
||||
result = null_theory_var;
|
||||
}
|
||||
else if (internalize_objective(term, q, r, objective)) {
|
||||
m_objectives.push_back(objective);
|
||||
m_objective_consts.push_back(r);
|
||||
m_objective_assignments.push_back(vr);
|
||||
|
|
|
@ -20,6 +20,7 @@ Notes:
|
|||
|
||||
#include "inf_rational.h"
|
||||
#include "inf_eps_rational.h"
|
||||
#include "arith_decl_plugin.h"
|
||||
|
||||
#ifndef _THEORY_OPT_H_
|
||||
#define _THEORY_OPT_H_
|
||||
|
@ -29,9 +30,11 @@ namespace smt {
|
|||
class theory_opt {
|
||||
public:
|
||||
typedef inf_eps_rational<inf_rational> inf_eps;
|
||||
virtual inf_eps maximize(theory_var v, expr_ref& blocker) = 0; // { UNREACHABLE(); return inf_eps::infinity(); }
|
||||
virtual theory_var add_objective(app* term) { UNREACHABLE(); return null_theory_var; }
|
||||
virtual inf_eps maximize(theory_var v, expr_ref& blocker) = 0;
|
||||
virtual theory_var add_objective(app* term) = 0;
|
||||
virtual expr* mk_ge(filter_model_converter& fm, theory_var v, inf_eps const& val) { UNREACHABLE(); return 0; }
|
||||
bool is_linear(ast_manager& m, expr* term);
|
||||
bool is_numeral(arith_util& a, expr* term);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue