From 19cbae0d4ee81907c7b3d060b0dfc91e9e8469d6 Mon Sep 17 00:00:00 2001 From: ajreynol Date: Tue, 29 Apr 2014 15:39:11 +0200 Subject: [PATCH] Significantly improve performance for producing datatypes models. --- src/theory/datatypes/theory_datatypes.cpp | 47 +++++++++++++++-------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/src/theory/datatypes/theory_datatypes.cpp b/src/theory/datatypes/theory_datatypes.cpp index 2715f8e75..d30c3639e 100644 --- a/src/theory/datatypes/theory_datatypes.cpp +++ b/src/theory/datatypes/theory_datatypes.cpp @@ -1149,27 +1149,38 @@ void TheoryDatatypes::collectModelInfo( TheoryModel* m, bool fullModel ){ ++eqccs_i; } - unsigned orig_size = nodes.size(); + //unsigned orig_size = nodes.size(); + std::map< TypeNode, int > typ_enum_map; + std::vector< TypeEnumerator > typ_enum; unsigned index = 0; while( index::iterator it = typ_enum_map.find( tn ); + int teIndex; + if( it==typ_enum_map.end() ){ + teIndex = (int)typ_enum.size(); + typ_enum_map[tn] = teIndex; + typ_enum.push_back( TypeEnumerator(tn) ); + }else{ + teIndex = it->second; + } + bool success; + do{ + success = true; + Assert( !typ_enum[teIndex].isFinished() ); + neqc = *typ_enum[teIndex]; + Trace("dt-cmi-debug") << "Try " << neqc << " ... " << std::endl; + ++typ_enum[teIndex]; for( unsigned i=0; iassertRepresentative( neqc ); - cons.push_back( neqc ); + if( addCons ){ + cons.push_back( neqc ); + } ++index; } -- 2.30.2