3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-06 14:13:23 +00:00

renaming to optsmt

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2013-11-08 12:41:05 -08:00
parent 33be06c6dc
commit 29cc9025cb
3 changed files with 17 additions and 17 deletions

View file

@ -27,7 +27,7 @@ Notes:
#include "ast.h" #include "ast.h"
#include "solver.h" #include "solver.h"
#include "optimize_objectives.h" #include "optsmt.h"
#include "opt_maxsmt.h" #include "opt_maxsmt.h"
namespace opt { namespace opt {
@ -39,7 +39,7 @@ namespace opt {
expr_ref_vector m_hard_constraints; expr_ref_vector m_hard_constraints;
ref<solver> m_solver; ref<solver> m_solver;
params_ref m_params; params_ref m_params;
optimize_objectives m_optsmt; optsmt m_optsmt;
maxsmt m_maxsmt; maxsmt m_maxsmt;
public: public:
context(ast_manager& m); context(ast_manager& m);

View file

@ -3,7 +3,7 @@ Copyright (c) 2013 Microsoft Corporation
Module Name: Module Name:
optimize_objectives.cpp optsmt.cpp
Abstract: Abstract:
@ -40,7 +40,7 @@ Notes:
#ifndef _OPT_OBJECTIVE_H_ #ifndef _OPT_OBJECTIVE_H_
#define _OPT_OBJECTIVE_H_ #define _OPT_OBJECTIVE_H_
#include "optimize_objectives.h" #include "optsmt.h"
#include "opt_solver.h" #include "opt_solver.h"
#include "arith_decl_plugin.h" #include "arith_decl_plugin.h"
#include "theory_arith.h" #include "theory_arith.h"
@ -51,11 +51,11 @@ Notes:
namespace opt { namespace opt {
void optimize_objectives::set_cancel(bool f) { void optsmt::set_cancel(bool f) {
m_cancel = true; m_cancel = true;
} }
void optimize_objectives::set_max(vector<inf_eps>& dst, vector<inf_eps> const& src) { void optsmt::set_max(vector<inf_eps>& dst, vector<inf_eps> const& src) {
for (unsigned i = 0; i < src.size(); ++i) { for (unsigned i = 0; i < src.size(); ++i) {
if (src[i] > dst[i]) { if (src[i] > dst[i]) {
dst[i] = src[i]; dst[i] = src[i];
@ -66,7 +66,7 @@ namespace opt {
/* /*
Enumerate locally optimal assignments until fixedpoint. Enumerate locally optimal assignments until fixedpoint.
*/ */
lbool optimize_objectives::basic_opt() { lbool optsmt::basic_opt() {
opt_solver::toggle_objective _t(*s, true); opt_solver::toggle_objective _t(*s, true);
lbool is_sat = l_true; lbool is_sat = l_true;
@ -86,7 +86,7 @@ namespace opt {
/* /*
Enumerate locally optimal assignments until fixedpoint. Enumerate locally optimal assignments until fixedpoint.
*/ */
lbool optimize_objectives::farkas_opt() { lbool optsmt::farkas_opt() {
smt::theory_opt& opt = s->get_optimizer(); smt::theory_opt& opt = s->get_optimizer();
IF_VERBOSE(1, verbose_stream() << typeid(opt).name() << "\n";); IF_VERBOSE(1, verbose_stream() << typeid(opt).name() << "\n";);
@ -107,7 +107,7 @@ namespace opt {
return l_true; return l_true;
} }
void optimize_objectives::update_lower() { void optsmt::update_lower() {
model_ref md; model_ref md;
s->get_model(md); s->get_model(md);
set_max(m_lower, s->get_objective_values()); set_max(m_lower, s->get_objective_values());
@ -129,7 +129,7 @@ namespace opt {
s->assert_expr(constraint); s->assert_expr(constraint);
} }
lbool optimize_objectives::update_upper() { lbool optsmt::update_upper() {
smt::theory_opt& opt = s->get_optimizer(); smt::theory_opt& opt = s->get_optimizer();
SASSERT(typeid(smt::theory_inf_arith) == typeid(opt)); SASSERT(typeid(smt::theory_inf_arith) == typeid(opt));
@ -205,7 +205,7 @@ namespace opt {
Takes solver with hard constraints added. Takes solver with hard constraints added.
Returns an optimal assignment to objective functions. Returns an optimal assignment to objective functions.
*/ */
lbool optimize_objectives::operator()(opt_solver& solver) { lbool optsmt::operator()(opt_solver& solver) {
s = &solver; s = &solver;
s->reset_objectives(); s->reset_objectives();
m_lower.reset(); m_lower.reset();
@ -245,7 +245,7 @@ namespace opt {
return is_sat; return is_sat;
} }
inf_eps optimize_objectives::get_value(bool as_positive, unsigned index) const { inf_eps optsmt::get_value(bool as_positive, unsigned index) const {
if (as_positive) { if (as_positive) {
return m_lower[index]; return m_lower[index];
} }
@ -254,7 +254,7 @@ namespace opt {
} }
} }
void optimize_objectives::display(std::ostream& out) const { void optsmt::display(std::ostream& out) const {
unsigned sz = m_objs.size(); unsigned sz = m_objs.size();
for (unsigned i = 0; i < sz; ++i) { for (unsigned i = 0; i < sz; ++i) {
bool is_max = m_is_max[i]; bool is_max = m_is_max[i];
@ -270,7 +270,7 @@ namespace opt {
} }
} }
void optimize_objectives::add(app* t, bool is_max) { void optsmt::add(app* t, bool is_max) {
expr_ref t1(t, m), t2(m); expr_ref t1(t, m), t2(m);
th_rewriter rw(m); th_rewriter rw(m);
if (!is_max) { if (!is_max) {

View file

@ -3,7 +3,7 @@ Copyright (c) 2013 Microsoft Corporation
Module Name: Module Name:
optimize_objectives.h optsmt.h
Abstract: Abstract:
@ -27,7 +27,7 @@ namespace opt {
Returns an optimal assignment to objective functions. Returns an optimal assignment to objective functions.
*/ */
class optimize_objectives { class optsmt {
ast_manager& m; ast_manager& m;
opt_solver* s; opt_solver* s;
volatile bool m_cancel; volatile bool m_cancel;
@ -38,7 +38,7 @@ namespace opt {
svector<smt::theory_var> m_vars; svector<smt::theory_var> m_vars;
symbol m_engine; symbol m_engine;
public: public:
optimize_objectives(ast_manager& m): m(m), s(0), m_cancel(false), m_objs(m) {} optsmt(ast_manager& m): m(m), s(0), m_cancel(false), m_objs(m) {}
lbool operator()(opt_solver& s); lbool operator()(opt_solver& s);