From: ajreynol Date: Mon, 31 Jul 2017 08:20:17 +0000 (-0500) Subject: Minor improvement for enumerative instantiation. X-Git-Tag: cvc5-1.0.0~5700 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ec16b410a725e4a7659c41f87327cdd1ef7b59e1;p=cvc5.git Minor improvement for enumerative instantiation. --- diff --git a/src/theory/quantifiers/inst_strategy_e_matching.cpp b/src/theory/quantifiers/inst_strategy_e_matching.cpp index 582b6ba7c..b4821cfd6 100644 --- a/src/theory/quantifiers/inst_strategy_e_matching.cpp +++ b/src/theory/quantifiers/inst_strategy_e_matching.cpp @@ -682,13 +682,36 @@ bool FullSaturation::process( Node f, bool fullEffort ){ std::vector< unsigned > maxs; std::vector< bool > max_zero; bool has_zero = false; + std::map< TypeNode, std::vector< Node > > term_db_list; + std::vector< TypeNode > ftypes; + // iterate over substitutions for variables for(unsigned i=0; igetRDomain( f, i )->d_terms.size(); }else{ - ts = d_quantEngine->getTermDatabase()->getNumTypeGroundTerms( f[0][i].getType() ); + ts = d_quantEngine->getTermDatabase()->getNumTypeGroundTerms( tn ); + std::map< TypeNode, std::vector< Node > >::iterator ittd = term_db_list.find( tn ); + if( ittd==term_db_list.end() ){ + std::map< Node, Node > reps_found; + for( unsigned j=0; jgetTermDatabase()->getTypeGroundTerm( ftypes[i], j ); + if( !options::cbqi() || !quantifiers::TermDb::hasInstConstAttr( gt ) ){ + Node r = d_quantEngine->getEqualityQuery()->getRepresentative( gt ); + if( reps_found.find( r )==reps_found.end() ){ + reps_found[r] = gt; + term_db_list[tn].push_back( gt ); + } + } + } + ts = term_db_list[tn].size(); + }else{ + ts = ittd->second.size(); + } } + // consider a default value if at full effort max_zero.push_back( fullEffort && ts==0 ); ts = ( fullEffort && ts==0 ) ? 1 : ts; Trace("inst-alg-rd") << "Variable " << i << " has " << ts << " in relevant domain." << std::endl; @@ -703,11 +726,6 @@ bool FullSaturation::process( Node f, bool fullEffort ){ } } if( !has_zero ){ - std::vector< TypeNode > ftypes; - for( unsigned i=0; igetTermDatabase()->getTypeGroundTerm( ftypes[index], nv ) ) ){ - nv++; - } - } if( nvgetRDomain( f, i )->d_terms[childIndex[i]] ); Trace("inst-alg-rd") << " " << rd->getRDomain( f, i )->d_terms[childIndex[i]] << std::endl; }else{ - terms.push_back( d_quantEngine->getTermDatabase()->getTypeGroundTerm( ftypes[i], childIndex[i] ) ); - Trace("inst-alg-rd") << " " << d_quantEngine->getTermDatabase()->getTypeGroundTerm( ftypes[i], childIndex[i] ) << std::endl; + Assert( childIndex[i]addInstantiation( f, terms ) ){