1 /****************************************** 2 Copyright (c) 2016, Mate Soos 3 4 Permission is hereby granted, free of charge, to any person obtaining a copy 5 of this software and associated documentation files (the "Software"), to deal 6 in the Software without restriction, including without limitation the rights 7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 copies of the Software, and to permit persons to whom the Software is 9 furnished to do so, subject to the following conditions: 10 11 The above copyright notice and this permission notice shall be included in 12 all copies or substantial portions of the Software. 13 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 THE SOFTWARE. 21 ***********************************************/ 22 23 #ifndef SUBSUMEIMPLICIT_H 24 #define SUBSUMEIMPLICIT_H 25 26 #include <vector> 27 #include "clause.h" 28 #include "constants.h" 29 #include "solvertypes.h" 30 #include "cloffset.h" 31 #include "watcharray.h" 32 #include "touchlist.h" 33 34 namespace CMSat { 35 36 using std::vector; 37 38 class Solver; 39 class Clause; 40 41 class SubsumeImplicit 42 { 43 public: 44 explicit SubsumeImplicit(Solver* solver); 45 void subsume_implicit(bool check_stats = true, std::string caller = std::string()); 46 uint32_t subsume_at_watch(const uint32_t at, 47 int64_t *timeAvail, 48 TouchList* touched = NULL); 49 50 struct Stats { clearStats51 void clear() 52 { 53 *this = Stats(); 54 } 55 Stats operator+=(const Stats& other); 56 void print_short(const Solver* solver, const char* caller) const; 57 void print(const char* caller) const; 58 59 double time_used = 0.0; 60 uint64_t numCalled = 0; 61 uint64_t time_out = 0; 62 uint64_t remBins = 0; 63 uint64_t numWatchesLooked = 0; 64 }; 65 Stats get_stats() const; 66 double mem_used() const; 67 68 private: 69 Solver* solver; 70 int64_t timeAvailable; 71 72 Lit lastLit2; 73 Watched* lastBin; 74 bool lastRed; 75 vector<Lit> tmplits; 76 Stats runStats; 77 Stats globalStats; 78 clear()79 void clear() 80 { 81 lastLit2 = lit_Undef; 82 lastBin = NULL; 83 lastRed = false; 84 } 85 86 //ImplSubsumeData impl_subs_dat; 87 void try_subsume_bin( 88 const Lit lit 89 , Watched* i 90 , Watched*& j 91 , int64_t* timeAvail 92 , TouchList* touched = NULL 93 ); 94 }; 95 96 } //end namespace 97 98 #endif //SUBSUMEIMPLICIT_H 99