mirror of
https://github.com/Z3Prover/z3
synced 2025-06-27 08:28:44 +00:00
reorganizing input
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
51704b7b95
commit
18815e3e53
8 changed files with 192 additions and 539 deletions
|
@ -29,7 +29,6 @@ Notes:
|
|||
#include "opt_solver.h"
|
||||
#include "optsmt.h"
|
||||
#include "maxsmt.h"
|
||||
#include "objective_decl_plugin.h"
|
||||
|
||||
namespace opt {
|
||||
|
||||
|
@ -37,24 +36,40 @@ namespace opt {
|
|||
|
||||
class context {
|
||||
typedef map<symbol, maxsmt*, symbol_hash_proc, symbol_eq_proc> map_t;
|
||||
enum objective_t {
|
||||
O_MAXIMIZE,
|
||||
O_MINIMIZE,
|
||||
O_MAXSMT
|
||||
};
|
||||
struct objective {
|
||||
objective_t m_type;
|
||||
app_ref m_term; // for maximize, minimize
|
||||
symbol m_id; // for maxsmt
|
||||
objective(bool is_max, app_ref& t):
|
||||
m_type(is_max?O_MAXIMIZE:O_MINIMIZE),
|
||||
m_term(t),
|
||||
m_id()
|
||||
{}
|
||||
objective(ast_manager& m, symbol id):
|
||||
m_type(O_MAXSMT),
|
||||
m_term(m),
|
||||
m_id(id)
|
||||
{}
|
||||
};
|
||||
ast_manager& m;
|
||||
expr_ref_vector m_hard_constraints;
|
||||
ref<opt_solver> m_solver;
|
||||
params_ref m_params;
|
||||
optsmt m_optsmt;
|
||||
optsmt m_optsmt;
|
||||
map_t m_maxsmts;
|
||||
expr_ref_vector m_objs;
|
||||
svector<bool> m_ismaxs;
|
||||
objective_util m_obj_util;
|
||||
vector<objective> m_objectives;
|
||||
public:
|
||||
context(ast_manager& m);
|
||||
~context();
|
||||
void add_soft_constraint(expr* f, rational const& w, symbol const& id);
|
||||
void add_objective(app* t, bool is_max) { m_objs.push_back(t); m_ismaxs.push_back(is_max); }
|
||||
void add_objective(app* t, bool is_max);
|
||||
void add_hard_constraint(expr* f) { m_hard_constraints.push_back(f); }
|
||||
|
||||
|
||||
lbool optimize(expr* objective);
|
||||
lbool optimize();
|
||||
|
||||
void set_cancel(bool f);
|
||||
|
@ -68,12 +83,12 @@ namespace opt {
|
|||
private:
|
||||
void validate_feasibility(maxsmt& ms);
|
||||
|
||||
lbool execute(expr* obj, bool committed);
|
||||
lbool execute(objective const& obj, bool committed);
|
||||
lbool execute_min_max(app* obj, bool committed, bool is_max);
|
||||
lbool execute_maxsat(app* obj, bool committed);
|
||||
lbool execute_lex(app* obj);
|
||||
lbool execute_box(app* obj);
|
||||
lbool execute_pareto(app* obj);
|
||||
lbool execute_maxsat(symbol const& s, bool committed);
|
||||
lbool execute_lex();
|
||||
lbool execute_box();
|
||||
lbool execute_pareto();
|
||||
|
||||
void push();
|
||||
void pop(unsigned sz);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue