/** \brief From \c cont which is list of indexes of tail literals of rule \c r, select the index pointing to a literal with at least one bound variable that will be the next bound literal in the process of creating an adorned rule. If all literals are unbound, return -1. */ int mk_magic_sets::pop_bound(unsigned_vector & cont, rule * r, const var_idx_set & bound_vars) { float best_cost; int candidate_index = -1; unsigned n = cont.size(); for (unsigned i=0; i<n; i++) { app * lit = r->get_tail(cont[i]); unsigned bound_cnt = get_bound_arg_count(lit, bound_vars); if (bound_cnt==0) { continue; } float cost = get_unbound_cost(lit, bound_vars); if (candidate_index==-1 || cost<best_cost) { best_cost = cost; candidate_index = i; } } if (candidate_index==-1) { return -1; } if (candidate_index != static_cast<int>(n-1)) { std::swap(cont[candidate_index], cont[n-1]); } unsigned res = cont.back(); cont.pop_back(); return res; }
void tactic2solver::pop_core(unsigned n) { unsigned new_lvl = m_scopes.size() - n; unsigned old_sz = m_scopes[new_lvl]; m_assertions.shrink(old_sz); m_scopes.shrink(new_lvl); m_result = 0; }
void get_renaming_args(const unsigned_vector & map, const relation_signature & orig_sig, expr_ref_vector & renaming_arg) { ast_manager & m = renaming_arg.get_manager(); unsigned sz = map.size(); unsigned ofs = sz-1; renaming_arg.resize(sz, static_cast<expr *>(0)); for(unsigned i=0; i<sz; i++) { if(map[i]!=UINT_MAX) { renaming_arg.set(ofs-i, m.mk_var(map[i], orig_sig[i])); } } }
void pop(unsigned num_scopes) { SASSERT(m_bounds.empty()); // bounds must be flushed before pop. if (num_scopes > 0) { SASSERT(num_scopes <= m_enum_consts_lim.size()); unsigned new_sz = m_enum_consts_lim.size() - num_scopes; unsigned lim = m_enum_consts_lim[new_sz]; for (unsigned i = m_enum_consts.size(); i > lim; ) { --i; func_decl* f = m_enum_consts[i].get(); func_decl* f_fresh = m_enum2bv.find(f); m_bv2enum.erase(f_fresh); m_enum2bv.erase(f); m_enum2def.erase(f); } m_enum_consts_lim.resize(new_sz); m_enum_consts.resize(lim); m_enum_defs.resize(lim); m_enum_bvs.resize(lim); } m_rw.reset(); }
static void display_results() { if (g_opt) { for (unsigned i = 0; i < g_handles.size(); ++i) { expr_ref lo = g_opt->get_lower(g_handles[i]); expr_ref hi = g_opt->get_upper(g_handles[i]); if (lo == hi) { std::cout << " " << lo << "\n"; } else { std::cout << " [" << lo << ":" << hi << "]\n"; } } } }
void group_by(table_fact const& in, table_fact& out) { out.reset(); for (unsigned i = 0; i < m_group_by_cols.size(); ++i) { out.push_back(in[m_group_by_cols[i]]); } }
virtual void operator()(table_base& _t) { lazy_table& t = get(_t); t.set(alloc(lazy_table_filter_identical, m_cols.size(), m_cols.c_ptr(), t)); }
unsigned scope_level() const override { return m_scopes.size(); }