mirror of
https://github.com/Z3Prover/z3
synced 2025-04-28 19:35:50 +00:00
Add push/pop to box optimization
This commit is contained in:
parent
4aa9c742ab
commit
5ed8a48ac2
4 changed files with 29 additions and 9 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue