SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
PolynomialLiftingQueue.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../common.h"
4 
5 #include <iostream>
6 #include <set>
7 
8 namespace smtrat {
9 namespace cad {
10 
11  template<typename PolynomialGetter>
13  private:
14  const PolynomialGetter* mPG;
15  std::size_t mLevel;
16  public:
17  PolynomialComparator(const PolynomialGetter* pg, std::size_t level): mPG(pg), mLevel(level) {}
18  bool operator()(std::size_t lhs, std::size_t rhs) const {
19  const UPoly& l = mPG->getPolynomialById(mLevel, lhs);
20  const UPoly& r = mPG->getPolynomialById(mLevel, rhs);
21  return l < r;
22  }
23  };
24 
25  template<typename PolynomialGetter>
27  template<typename PG>
28  friend std::ostream& operator<<(std::ostream& os, const PolynomialLiftingQueue<PG>& plq);
29  private:
31  std::set<std::size_t, PolynomialComparator<PolynomialGetter>> mQueue;
32  carl::Bitset mDisabled;
33  public:
34  PolynomialLiftingQueue(const PolynomialGetter* pg, std::size_t level):
35  mComparator(pg, level),
37  {}
38 
39  auto insert(std::size_t id) {
40  return mQueue.insert(id);
41  }
42  auto erase(std::size_t id) {
43  return mQueue.erase(id);
44  }
45 
46  auto begin() const {
47  return mQueue.begin();
48  }
49  auto end() const {
50  return mQueue.end();
51  }
52  auto size() const {
53  return mQueue.size();
54  }
55 
56  void disable(std::size_t id) {
57  erase(id);
58  mDisabled.set(id, true);
59  }
60  void restore(std::size_t id) {
61  if (mDisabled.test(id)) {
62  mDisabled.set(id, false);
63  insert(id);
64  }
65  }
66 
67  };
68  template<typename PG>
69  inline std::ostream& operator<<(std::ostream& os, const PolynomialLiftingQueue<PG>& plq) {
70  return os << plq.mQueue;
71  }
72 
73 }
74 }
std::set< std::size_t, PolynomialComparator< PolynomialGetter > > mQueue
friend std::ostream & operator<<(std::ostream &os, const PolynomialLiftingQueue< PG > &plq)
PolynomialLiftingQueue(const PolynomialGetter *pg, std::size_t level)
PolynomialComparator< PolynomialGetter > mComparator
std::ostream & operator<<(std::ostream &os, const SampleIteratorQueue< I, C > &siq)
carl::UnivariatePolynomial< Poly > UPoly
Definition: common.h:17
Class to create the formulas for axioms.
PolynomialComparator(const PolynomialGetter *pg, std::size_t level)
bool operator()(std::size_t lhs, std::size_t rhs) const