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

Add push/pop to box optimization

This commit is contained in:
Anh-Dung Phan 2013-11-26 14:16:59 -08:00
parent 4aa9c742ab
commit 5ed8a48ac2
4 changed files with 29 additions and 9 deletions

View file

@ -249,8 +249,8 @@ private:
};
static expr* sexpr2expr(cmd_context & ctx, sexpr * s) {
NOT_IMPLEMENTED_YET();
return 0;
NOT_IMPLEMENTED_YET();
return ctx.m().mk_true();
}
static opt::objective* sexpr2objective(cmd_context & ctx, sexpr * s) {

View file

@ -90,20 +90,24 @@ namespace opt {
lbool context::execute_lex(compound_objective & obj) {
ptr_vector<objective> children(obj.num_children(), obj.children());
lbool result = l_true;
for (unsigned i = 0; i < children.size(); ++i) {
lbool result = execute(*children[i], true);
if (result != l_true) return result;
result = execute(*children[i], true);
if (result != l_true) break;
}
return l_true;
}
return result;
}
lbool context::execute_box(compound_objective & obj) {
ptr_vector<objective> children(obj.num_children(), obj.children());
lbool result = l_true;
for (unsigned i = 0; i < children.size(); ++i) {
lbool result = execute(*children[i], false);
if (result != l_true) return result;
push();
result = execute(*children[i], false);
pop(1);
if (result != l_true) break;
}
return l_true;
return result;
}
lbool context::execute_pareto(compound_objective & obj) {
@ -111,6 +115,16 @@ namespace opt {
return execute_lex(obj);
}
void context::push() {
opt_solver& s = *m_solver.get();
s.push();
}
void context::pop(unsigned sz) {
opt_solver& s = *m_solver.get();
s.pop(sz);
}
lbool context::optimize(objective & objective) {
opt_solver& s = *m_solver.get();
solver::scoped_push _sp(s);

View file

@ -59,6 +59,9 @@ namespace opt {
lbool execute_box(compound_objective & obj);
lbool execute_pareto(compound_objective & obj);
void push();
void pop(unsigned sz);
lbool optimize(objective & objective);
lbool optimize();