diff --git a/external/SBVA/sbva_lib.cc b/external/SBVA/sbva_lib.cc index d0ed6cf..8857204 100644 --- a/external/SBVA/sbva_lib.cc +++ b/external/SBVA/sbva_lib.cc @@ -76,7 +76,7 @@ class Formula { public: Formula() { adj_deleted = 0; } - void read_cnf(vector> cnf) { + void read_cnf(const vector> &cnf) { ClauseCache cache; int curr_clause = 0; @@ -91,7 +91,7 @@ class Formula { } } clauses = vector(num_clauses); - clauses.reserve(num_clauses * 10); + // clauses.reserve(num_clauses * 10); lit_to_clauses = vector>(num_vars * 2); lit_count_adjust = vector(num_vars * 2); adjacency_matrix_width = num_vars * 4; @@ -258,19 +258,19 @@ class Formula { vector matched_clauses_swap = vector(); vector matched_clauses_id = vector(); vector matched_clauses_id_swap = vector(); - matched_lits.reserve(10000); - matched_clauses.reserve(10000); - matched_clauses_swap.reserve(10000); - matched_clauses_id.reserve(10000); - matched_clauses_id_swap.reserve(10000); + // matched_lits.reserve(10000); + // matched_clauses.reserve(10000); + // matched_clauses_swap.reserve(10000); + // matched_clauses_id.reserve(10000); + // matched_clauses_id_swap.reserve(10000); // Track the index of the matched clauses from every literal that is added to matched_lits. vector> clauses_to_remove = vector>(); - clauses_to_remove.reserve(10000); + // clauses_to_remove.reserve(10000); // Used for computing clause differences vector diff = vector(); - diff.reserve(10000); + // diff.reserve(10000); // Keep track of the matrix of swaps that we can perform. // Each entry is of the form (literal, , ) @@ -308,15 +308,15 @@ class Formula { // (C v E) (C v F) (C v H) // vector> matched_entries = vector>(); - matched_entries.reserve(10000); + // matched_entries.reserve(10000); // Keep a list of the literals that are matched so we can sort and count later. vector matched_entries_lits = vector(); - matched_entries_lits.reserve(10000); + // matched_entries_lits.reserve(10000); // Used for priority queue updates. unordered_set lits_to_update; - lits_to_update.reserve(10000); + // lits_to_update.reserve(10000); // Track number of replacements (new auxiliary variables). int num_replacements = 0; @@ -636,7 +636,7 @@ class Formula { map tmp_heuristic_cache_full; }; -pair>> runBVA(vector> cnf, int max_seconds) { +pair>> runBVA(const vector> &cnf, int max_seconds) { end_time = nullptr; if (max_seconds) { end_time = make_unique( diff --git a/src/solvers/sat/sbva_wrapper.cpp b/src/solvers/sat/sbva_wrapper.cpp index 3662c08..0bc28fa 100644 --- a/src/solvers/sat/sbva_wrapper.cpp +++ b/src/solvers/sat/sbva_wrapper.cpp @@ -9,8 +9,8 @@ #include "solvers/sat/sat_utils.hpp" #include "solvers/sat/sat_wrapper.hpp" -extern std::pair>> runBVA(std::vector> cnf, - int max_seconds); +extern std::pair>> runBVA( + const std::vector>& cnf, int max_seconds); void SbvaWrapper::run(std::unique_ptr& sat_wrapper, int max_seconds) { // convert sat_utils::Clause to DIMACS input for SBVA