/*********************************************************************************** CryptoMiniSat -- Copyright (c) 2009 Mate Soos This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . **************************************************************************************************/ #ifndef PARTFINDER_H #define PARTFINDER_H #include #include #ifdef _MSC_VER #include #else #include #endif //_MSC_VER #include "Clause.h" class Solver; using std::map; using std::vector; using std::pair; class PartFinder { public: PartFinder(Solver& solver); const bool findParts(); const map >& getReverseTable() const; // part->var const uint32_t getVarPart(const Var var) const; const vector& getTable() const; //var -> part const vector& getPartVars(const uint32_t part); private: const uint setParts(); template void addToPart(const vec& cs); struct mysorter { bool operator () (const pair& left, const pair& right) { return left.second < right.second; } }; //const bool findParts(vector& xorFingerprintInMatrix, vector& xorsInMatrix); template void calcIn(const vec& cs, vector& numClauseInPart, vector& sumLitsInPart); map > reverseTable; //part -> vars vector table; //var -> part uint32_t part_no; Solver& solver; }; inline const map >& PartFinder::getReverseTable() const { return reverseTable; } inline const vector& PartFinder::getTable() const { return table; } inline const uint32_t PartFinder::getVarPart(const Var var) const { return table[var]; } inline const vector& PartFinder::getPartVars(const uint32_t part) { return reverseTable[part]; } #endif //PARTFINDER_H