summaryrefslogtreecommitdiff
path: root/src/theory/quantifiers_engine.cpp
diff options
context:
space:
mode:
authorajreynol <andrew.j.reynolds@gmail.com>2014-10-08 00:29:57 +0200
committerajreynol <andrew.j.reynolds@gmail.com>2014-10-08 00:29:57 +0200
commitfc788d5125fed8257544e74ab8898344b1e7b19d (patch)
tree290549d7537318819a92cb146a846c35e28a7d60 /src/theory/quantifiers_engine.cpp
parent33d0894b7707e3f590404cc51963af7740e7412a (diff)
Cache for getInstance, thanks to Johannes Kanig for the report. Do not mkRep for multi triggers.
Diffstat (limited to 'src/theory/quantifiers_engine.cpp')
-rw-r--r--src/theory/quantifiers_engine.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/theory/quantifiers_engine.cpp b/src/theory/quantifiers_engine.cpp
index d81db8b8d..7ed5b2164 100644
--- a/src/theory/quantifiers_engine.cpp
+++ b/src/theory/quantifiers_engine.cpp
@@ -911,7 +911,8 @@ Node EqualityQueryQuantifiersEngine::getInternalRepresentative( Node a, Node f,
}
}
//now, make sure that no other member of the class is an instance
- r_best = getInstance( r_best, eqc );
+ std::hash_map<TNode, Node, TNodeHashFunction> cache;
+ r_best = getInstance( r_best, eqc, cache );
//store that this representative was chosen at this point
if( d_rep_score.find( r_best )==d_rep_score.end() ){
d_rep_score[ r_best ] = d_reset_count;
@@ -1018,17 +1019,20 @@ void EqualityQueryQuantifiersEngine::getEquivalenceClass( Node a, std::vector< N
//helper functions
-Node EqualityQueryQuantifiersEngine::getInstance( Node n, std::vector< Node >& eqc ){
+Node EqualityQueryQuantifiersEngine::getInstance( Node n, const std::vector< Node >& eqc, std::hash_map<TNode, Node, TNodeHashFunction>& cache ){
+ if(cache.find(n) != cache.end()) {
+ return cache[n];
+ }
for( size_t i=0; i<n.getNumChildren(); i++ ){
- Node nn = getInstance( n[i], eqc );
+ Node nn = getInstance( n[i], eqc, cache );
if( !nn.isNull() ){
- return nn;
+ return cache[n] = nn;
}
}
if( std::find( eqc.begin(), eqc.end(), n )!=eqc.end() ){
- return n;
+ return cache[n] = n;
}else{
- return Node::null();
+ return cache[n] = Node::null();
}
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback