summaryrefslogtreecommitdiff
path: root/src/theory/bv/equality_engine.h
diff options
context:
space:
mode:
authorDejan Jovanović <dejan.jovanovic@gmail.com>2011-03-20 16:31:19 +0000
committerDejan Jovanović <dejan.jovanovic@gmail.com>2011-03-20 16:31:19 +0000
commit8dd7462696b1d354f2dbdf840e9f50226f4c489a (patch)
tree2f36f252ee66df2508def7add42f18366f0e0833 /src/theory/bv/equality_engine.h
parent3af0d6493cdea4be4130076fee93ebbeff669545 (diff)
fixing the failure from last nigth, due to using a reference to an element in a growing vector
Diffstat (limited to 'src/theory/bv/equality_engine.h')
-rw-r--r--src/theory/bv/equality_engine.h33
1 files changed, 28 insertions, 5 deletions
diff --git a/src/theory/bv/equality_engine.h b/src/theory/bv/equality_engine.h
index 954253269..6b9551950 100644
--- a/src/theory/bv/equality_engine.h
+++ b/src/theory/bv/equality_engine.h
@@ -23,6 +23,7 @@
#include <vector>
#include <ext/hash_map>
+#include <sstream>
#include "expr/node.h"
#include "context/cdo.h"
@@ -217,6 +218,11 @@ private:
std::vector<EqualityEdge> d_equalityEdges;
/**
+ * Returns the string representation of the edges.
+ */
+ std::string edgesToString(size_t edgeId) const;
+
+ /**
* Reasons for equalities.
*/
std::vector<Node> d_equalityReasons;
@@ -643,6 +649,21 @@ void EqualityEngine<OwnerClass, NotifyClass, UnionFindPreferences>::addGraphEdge
}
template <typename OwnerClass, typename NotifyClass, typename UnionFindPreferences>
+std::string EqualityEngine<OwnerClass, NotifyClass, UnionFindPreferences>::edgesToString(size_t edgeId) const {
+ std::stringstream out;
+ bool first = true;
+ while (edgeId != BitSizeTraits::id_null) {
+ const EqualityEdge& edge = d_equalityEdges[edgeId];
+ if (!first) out << ",";
+ out << d_nodes[edge.getNodeId()];
+ edgeId = edge.getNext();
+ first = false;
+ }
+ return out.str();
+}
+
+
+template <typename OwnerClass, typename NotifyClass, typename UnionFindPreferences>
void EqualityEngine<OwnerClass, NotifyClass, UnionFindPreferences>::getExplanation(TNode t1, TNode t2, std::vector<TNode>& equalities) const {
Assert(equalities.empty());
Assert(t1 != t2);
@@ -675,6 +696,8 @@ void EqualityEngine<OwnerClass, NotifyClass, UnionFindPreferences>::getExplanati
// Go through the equality edges of this node
size_t currentEdge = d_equalityGraph[currentNode];
+ Debug("equality") << "EqualityEngine::getExplanation(): edges = " << edgesToString(currentEdge) << std::endl;
+
while (currentEdge != BitSizeTraits::id_null) {
// Get the edge
const EqualityEdge& edge = d_equalityEdges[currentEdge];
@@ -698,13 +721,13 @@ void EqualityEngine<OwnerClass, NotifyClass, UnionFindPreferences>::getExplanati
// Go to the previous
currentEdge = bfsQueue[currentIndex].edgeId;
currentIndex = bfsQueue[currentIndex].previousIndex;
- } while (currentEdge != BitSizeTraits::id_null);
+ } while (currentEdge != BitSizeTraits::id_null);
- // Done
- return;
- }
+ // Done
+ return;
+ }
- // Push to the visitation queue if it's not the backward edge
+ // Push to the visitation queue if it's not the backward edge
bfsQueue.push_back(BfsData(edge.getNodeId(), currentEdge, currentIndex));
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback