@@ -312,19 +312,18 @@ DLL_PUBLIC const vector<Lit> Arjun::get_internal_cnf(uint32_t& num_cls) const
312312 return cnf;
313313}
314314
315- static std::pair<vector<vector<Lit>>, uint32_t > get_simplified_cnf (
316- SATSolver* solver, vector<uint32_t >& sampl_vars, const bool renumber)
315+ static void get_simplified_cnf (
316+ SATSolver* solver, vector<uint32_t >& sampl_vars, const bool renumber,
317+ vector<vector<Lit>>& cnf, uint32_t & nvars)
317318{
318- vector<vector<Lit>> cnf;
319+ assert ( cnf. empty ()) ;
319320 solver->start_getting_small_clauses (
320321 std::numeric_limits<uint32_t >::max (),
321322 std::numeric_limits<uint32_t >::max (),
322323 false , // red
323324 false , // bva vars
324325 renumber); // simplified
325-
326326 if (renumber) sampl_vars = solver->translate_sampl_set (sampl_vars);
327- std::sort (sampl_vars.begin (), sampl_vars.end ());
328327
329328 bool ret = true ;
330329 vector<Lit> clause;
@@ -335,8 +334,7 @@ static std::pair<vector<vector<Lit>>, uint32_t> get_simplified_cnf(
335334 }
336335 }
337336 solver->end_getting_small_clauses ();
338- return std::make_pair (cnf,
339- renumber ? solver->simplified_nvars () : solver->nVars ());
337+ nvars = renumber ? solver->simplified_nvars () : solver->nVars ();
340338}
341339
342340static void fill_solver (
@@ -387,8 +385,7 @@ static void fill_solver(
387385 }
388386}
389387
390- DLL_PUBLIC std::tuple<std::pair<std::vector<std::vector<CMSat::Lit>>, uint32_t >, std::vector<uint32_t >>
391- Arjun::get_fully_simplified_renumbered_cnf (
388+ DLL_PUBLIC SimplifiedCNF Arjun::get_fully_simplified_renumbered_cnf (
392389 const vector<uint32_t >& sampl_vars, // contains empty_vars!
393390 const uint32_t orig_num_vars,
394391 const bool sparsify,
@@ -438,10 +435,17 @@ Arjun::get_fully_simplified_renumbered_cnf(
438435 str += string (" , must-scc-vrepl, must-renumber" );
439436 solver.simplify (&dont_elim, &str);
440437
441- vector<uint32_t > new_sampl_set;
442- for (const auto & l: dont_elim) new_sampl_set.push_back (l.var ());
443- auto cnf = get_simplified_cnf (&solver, new_sampl_set, renumber);
444- return std::make_tuple (cnf, new_sampl_set);
438+ vector<uint32_t > new_sampl_vars (sampl_vars);
439+ SimplifiedCNF cnf;
440+ get_simplified_cnf (&solver, new_sampl_vars, renumber, cnf.cnf , cnf.nvars );
441+
442+ vector<uint32_t > empty_occs;
443+ if (arjdata->common .conf .empty_occs_based )
444+ solver.find_equiv_subformula (new_sampl_vars, empty_occs);
445+ std::sort (new_sampl_vars.begin (), new_sampl_vars.end ());
446+ cnf.sampling_vars = new_sampl_vars;
447+ cnf.empty_occs = empty_occs.size ();
448+ return cnf;
445449}
446450
447451DLL_PUBLIC void Arjun::set_pred_forever_cutoff (int pred_forever_cutoff)
0 commit comments