3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 01:25:31 +00:00

fix APIs, add python API

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2014-03-23 21:28:11 -07:00
parent 0181f0f9df
commit ff1543d700
12 changed files with 193 additions and 35 deletions

View file

@ -210,9 +210,10 @@ namespace opt {
}
smt::theory_var opt_solver::add_objective(app* term) {
m_objective_vars.push_back(get_optimizer().add_objective(term));
smt::theory_var v = get_optimizer().add_objective(term);
m_objective_vars.push_back(v);
m_objective_values.push_back(inf_eps(rational(-1), inf_rational()));
return m_objective_vars.back();
return v;
}
vector<inf_eps> const& opt_solver::get_objective_values() {

View file

@ -219,7 +219,13 @@ namespace opt {
}
for (unsigned i = 0; i < m_objs.size(); ++i) {
m_vars.push_back(solver.add_objective(m_objs[i].get()));
smt::theory_var v = solver.add_objective(m_objs[i].get());
if (v == smt::null_theory_var) {
std::ostringstream out;
out << "Objective function '" << mk_pp(m_objs[i].get(), m) << "' is not supported";
throw default_exception(out.str());
}
m_vars.push_back(v);
}
}