Skip to content

Commit

Permalink
make var-queue a template
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
  • Loading branch information
NikolajBjorner committed Dec 5, 2023
1 parent 156426a commit 1d6616a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/sat/sat_solver.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ namespace sat {
unsigned m_rephase_inc;
backoff m_rephase;
backoff m_reorder;
var_queue m_case_split_queue;
var_queue<unsigned_vector> m_case_split_queue;
unsigned m_qhead;
unsigned m_scope_lvl;
unsigned m_search_lvl;
Expand Down
15 changes: 8 additions & 7 deletions src/util/var_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ Revision History:
#include "util/heap.h"



template <class ActivityVector>
class var_queue {
typedef unsigned var;

struct lt {
svector<unsigned> & m_activity;
lt(svector<unsigned> & act):m_activity(act) {}
ActivityVector & m_activity;
lt(ActivityVector & act):m_activity(act) {}
bool operator()(var v1, var v2) const { return m_activity[v1] > m_activity[v2]; }
};
heap<lt> m_queue;
public:

public:

var_queue(svector<unsigned> & act):m_queue(128, lt(act)) {}
var_queue(ActivityVector & act):m_queue(128, lt(act)) {}

void activity_increased_eh(var v) {
if (m_queue.contains(v))
Expand Down Expand Up @@ -90,11 +90,12 @@ class var_queue {
return out;
}

using const_iterator = decltype(m_queue)::const_iterator;
using const_iterator = const int *;
const_iterator begin() const { return m_queue.begin(); }
const_iterator end() const { return m_queue.end(); }
};

inline std::ostream& operator<<(std::ostream& out, var_queue const& queue) {
template <typename T>
inline std::ostream& operator<<(std::ostream& out, var_queue<T> const& queue) {
return queue.display(out);
}

0 comments on commit 1d6616a

Please sign in to comment.