SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
Sample.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../common.h"
4 
5 #include <iostream>
6 #include <limits>
7 
8 namespace smtrat {
9 namespace cad {
10  class Sample {
11  private:
13  bool mIsRoot;
16  carl::Bitset mEvaluatedWith;
17  carl::Bitset mEvaluationResult;
18 
19  public:
20  explicit Sample(const RAN& value): mValue(value), mIsRoot(false) {
21  setIsRoot(false);
22  }
23  explicit Sample(const RAN& value, bool isRoot): mValue(value), mIsRoot(isRoot) {
25  }
26  explicit Sample(const RAN& value, std::size_t id): mValue(value), mIsRoot(true) {
27  setIsRoot(true);
28  mRootOf.set(id);
29  }
30  const RAN& value() const {
31  return mValue;
32  }
33  bool isRoot() const {
34  return mIsRoot;
35  }
36  void setIsRoot(bool isRoot) {
37  mIsRoot = isRoot;
38  }
39  const SampleLiftedWith& liftedWith() const {
40  return mLiftedWith;
41  }
43  return mLiftedWith;
44  }
45  const SampleRootOf& rootOf() const {
46  assert(isRoot());
47  return mRootOf;
48  }
50  assert(isRoot());
51  return mRootOf;
52  }
53  const carl::Bitset& evaluatedWith() const {
54  return mEvaluatedWith;
55  }
56  carl::Bitset& evaluatedWith() {
57  return mEvaluatedWith;
58  }
59  const carl::Bitset& evaluationResult() const {
60  return mEvaluationResult;
61  }
62  carl::Bitset& evaluationResult() {
63  return mEvaluationResult;
64  }
67  }
69  return getConflictingConstraints().any();
70  }
71  void merge(const Sample& s) {
72  if (s.isRoot()) setIsRoot(true);
74  mRootOf = mRootOf | s.mRootOf;
75  }
76 
77  bool operator<(const Sample& s) const {
78  return value() < s.value();
79  }
80  bool operator>(const Sample& s) const {
81  return s.value() < value();
82  }
83  bool operator==(const Sample& s) const {
84  return value() == s.value();
85  }
86 
87  friend std::ostream& operator<<(std::ostream& os, const Sample& s) {
88  return os << s.mValue;
89  return os << s.mValue << "[" << s.mEvaluatedWith << "][" << s.mEvaluationResult << "]";
90  }
91  };
92 }
93 }
void setIsRoot(bool isRoot)
Definition: Sample.h:36
const carl::Bitset & evaluatedWith() const
Definition: Sample.h:53
SampleRootOf & rootOf()
Definition: Sample.h:49
Sample(const RAN &value, std::size_t id)
Definition: Sample.h:26
auto getConflictingConstraints() const
Definition: Sample.h:65
carl::Bitset mEvaluationResult
Definition: Sample.h:17
carl::Bitset mEvaluatedWith
Definition: Sample.h:16
SampleLiftedWith & liftedWith()
Definition: Sample.h:42
carl::Bitset & evaluatedWith()
Definition: Sample.h:56
const RAN & value() const
Definition: Sample.h:30
void merge(const Sample &s)
Definition: Sample.h:71
const SampleRootOf & rootOf() const
Definition: Sample.h:45
const carl::Bitset & evaluationResult() const
Definition: Sample.h:59
bool operator==(const Sample &s) const
Definition: Sample.h:83
SampleRootOf mRootOf
Definition: Sample.h:15
Sample(const RAN &value)
Definition: Sample.h:20
Sample(const RAN &value, bool isRoot)
Definition: Sample.h:23
SampleLiftedWith mLiftedWith
Definition: Sample.h:14
bool isRoot() const
Definition: Sample.h:33
const SampleLiftedWith & liftedWith() const
Definition: Sample.h:39
carl::Bitset & evaluationResult()
Definition: Sample.h:62
friend std::ostream & operator<<(std::ostream &os, const Sample &s)
Definition: Sample.h:87
bool hasConflictWithConstraint() const
Definition: Sample.h:68
bool operator<(const Sample &s) const
Definition: Sample.h:77
bool operator>(const Sample &s) const
Definition: Sample.h:80
smtrat::RAN RAN
Definition: common.h:11
carl::Bitset SampleLiftedWith
Definition: common.h:15
carl::Bitset SampleRootOf
Definition: common.h:16
Class to create the formulas for axioms.