mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
bypass simplifier if (m_is_clausal) {
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
9d75babcda
commit
301f441801
10 changed files with 39 additions and 23 deletions
|
@ -81,8 +81,8 @@ public:
|
|||
simp2_p.set_bool("hoist_mul", false); // required by som
|
||||
m_preprocess =
|
||||
and_then(mk_card2bv_tactic(m, m_params),
|
||||
mk_simplify_tactic(m),
|
||||
mk_propagate_values_tactic(m),
|
||||
//mk_simplify_tactic(m),
|
||||
//mk_propagate_values_tactic(m),
|
||||
using_params(mk_simplify_tactic(m), simp2_p),
|
||||
mk_max_bv_sharing_tactic(m),
|
||||
mk_bit_blaster_tactic(m),
|
||||
|
|
|
@ -88,6 +88,7 @@ private:
|
|||
rational m_max_upper;
|
||||
bool m_found_feasible_optimum;
|
||||
bool m_hill_climb; // prefer large weight soft clauses for cores
|
||||
unsigned m_last_index; // last index used during hill-climbing
|
||||
bool m_add_upper_bound_block; // restrict upper bound with constraint
|
||||
unsigned m_max_num_cores; // max number of cores per round.
|
||||
unsigned m_max_core_size; // max core size per round.
|
||||
|
@ -110,6 +111,7 @@ public:
|
|||
m_st(st),
|
||||
m_found_feasible_optimum(false),
|
||||
m_hill_climb(true),
|
||||
m_last_index(0),
|
||||
m_add_upper_bound_block(false),
|
||||
m_max_num_cores(UINT_MAX),
|
||||
m_max_core_size(3),
|
||||
|
@ -352,16 +354,21 @@ public:
|
|||
/**
|
||||
Give preference to cores that have large minmal values.
|
||||
*/
|
||||
sort_assumptions(asms);
|
||||
unsigned index = 0;
|
||||
unsigned last_index = 0;
|
||||
sort_assumptions(asms);
|
||||
|
||||
m_last_index = std::min(m_last_index, asms.size()-1);
|
||||
m_last_index = 0;
|
||||
unsigned index = m_last_index>0?m_last_index-1:0;
|
||||
m_last_index = 0;
|
||||
bool first = index > 0;
|
||||
SASSERT(index < asms.size() || asms.empty());
|
||||
while (index < asms.size() && is_sat == l_true) {
|
||||
while (asms.size() > 20*(index - last_index) && index < asms.size()) {
|
||||
while (!first && asms.size() > 20*(index - m_last_index) && index < asms.size()) {
|
||||
index = next_index(asms, index);
|
||||
//break;
|
||||
}
|
||||
IF_VERBOSE(3, verbose_stream() << "weight: " << get_weight(asms[0].get()) << " " << get_weight(asms[index-1].get()) << "\n";);
|
||||
last_index = index;
|
||||
first = false;
|
||||
IF_VERBOSE(3, verbose_stream() << "weight: " << get_weight(asms[0].get()) << " " << get_weight(asms[index-1].get()) << " num soft: " << index << "\n";);
|
||||
m_last_index = index;
|
||||
is_sat = s().check_sat(index, asms.c_ptr());
|
||||
}
|
||||
}
|
||||
|
@ -880,6 +887,7 @@ public:
|
|||
}
|
||||
m_max_upper = m_upper;
|
||||
m_found_feasible_optimum = false;
|
||||
m_last_index = 0;
|
||||
add_upper_bound_block();
|
||||
}
|
||||
|
||||
|
|
|
@ -123,6 +123,7 @@ namespace opt {
|
|||
m_objective_refs(m),
|
||||
m_enable_sat(false),
|
||||
m_enable_sls(false),
|
||||
m_is_clausal(false),
|
||||
m_pp_neat(false)
|
||||
{
|
||||
params_ref p;
|
||||
|
@ -553,6 +554,10 @@ namespace opt {
|
|||
}
|
||||
|
||||
void context::simplify_fmls(expr_ref_vector& fmls) {
|
||||
if (m_is_clausal) {
|
||||
return;
|
||||
}
|
||||
|
||||
goal_ref g(alloc(goal, m, true, false));
|
||||
for (unsigned i = 0; i < fmls.size(); ++i) {
|
||||
g->assert_expr(fmls[i].get());
|
||||
|
|
|
@ -126,6 +126,7 @@ namespace opt {
|
|||
tactic_ref m_simplify;
|
||||
bool m_enable_sat;
|
||||
bool m_enable_sls;
|
||||
bool m_is_clausal;
|
||||
bool m_pp_neat;
|
||||
symbol m_maxsat_engine;
|
||||
symbol m_logic;
|
||||
|
@ -155,6 +156,7 @@ namespace opt {
|
|||
virtual void display_assignment(std::ostream& out);
|
||||
virtual bool is_pareto() { return m_pareto.get() != 0; }
|
||||
virtual void set_logic(symbol const& s) { m_logic = s; }
|
||||
void set_clausal(bool f) { m_is_clausal = f; }
|
||||
|
||||
void display(std::ostream& out);
|
||||
static void collect_param_descrs(param_descrs & r);
|
||||
|
|
|
@ -161,17 +161,9 @@ namespace opt {
|
|||
|
||||
void opt_solver::maximize_objectives(expr_ref_vector& blockers) {
|
||||
expr_ref blocker(m);
|
||||
vector<inf_eps> values;
|
||||
for (unsigned i = 0; i < m_objective_vars.size(); ++i) {
|
||||
values.push_back(current_objective_value(i));
|
||||
}
|
||||
for (unsigned i = 0; i < m_objective_vars.size(); ++i) {
|
||||
maximize_objective(i, blocker);
|
||||
blockers.push_back(blocker);
|
||||
if (values[i] > m_objective_values[i]) {
|
||||
std::cout << "local optimization produced a worse result\n";
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue