1.drup_file
声明的成员与函数
FILE* drup_file;
#ifdef BIN_DRUP
static inline void byteDRUP(Lit l){ unsigned int u = 2 * (var(l) + 1) + sign(l); } template<class V> assert(op == 'a' || op == 'd'); } static inline void binDRUP_strengthen(const Clause& c, Lit l, FILE* drup_file){ *buf_ptr++ = 'a'; buf_len++; } static inline void binDRUP_flush(FILE* drup_file){ fwrite(drup_buf, sizeof(unsigned char), buf_len, drup_file); }
|
|
被使用的情况
bool Solver::addClause_(vec<Lit>& ps)
// Check if clause is satisfied and remove false/duplicate literals: if (drup_file){
for (i = j = 0, p = lit_Undef; i < ps.size(); i++) if (drup_file && i != j){ fprintf(drup_file, "d "); if (ps.size() == 0) return true;
|
|
void Solver::removeClause(CRef cr) { if (drup_file){ detachClause(cr); |
|
search函数传播遇到冲突代码段中有以下相关代码: if (drup_file){ |
|
solve_最后也有相关代码段 #ifdef BIN_DRUP |
|
其余被使用均在化简的相关函数之中 |
2.
真正的化简函数
// simplify
//
public:
bool simplifyAll();
void simplifyLearnt(Clause& c);
bool simplifyLearnt_x(vec<CRef>& learnts_x);
bool simplifyLearnt_core();
bool simplifyLearnt_tier2();
int trailRecord;
void litsEnqueue(int cutP, Clause& c);
void cancelUntilTrailRecord();
void simpleUncheckEnqueue(Lit p, CRef from = CRef_Undef);
CRef simplePropagate();
uint64_t nbSimplifyAll;
uint64_t simplified_length_record, original_length_record;
uint64_t s_propagations;
vec<Lit> simp_learnt_clause;
vec<CRef> simp_reason_clause;
void simpleAnalyze(CRef confl, vec<Lit>& out_learnt, vec<CRef>& reason_clause, bool True_confl);
3. 删除的学习子句“捞回”操作
// duplicate learnts version
int is_duplicate (std::vector<uint32_t>&c); //returns TRUE if a clause is duplicate
// duplicate learnts version
-------
// duplicate learnts version
uint32_t min_number_of_learnts_copies;
uint32_t dupl_db_init_size;
uint32_t max_lbd_dup;
std::chrono::microseconds duptime;
// duplicate learnts version
------
// duplicate learnts version
uint64_t duplicates_added_conflicts;
uint64_t duplicates_added_tier2;
uint64_t duplicates_added_minimization;
uint64_t dupl_db_size;
// duplicate learnts version
------
// duplicate learnts version
std::map<int32_t,std::map<uint32_t,std::unordered_map<uint64_t,uint32_t>>> ht;
// duplicate learnts version
4.利用seen解决回溯中学习子句的构建——切割UIP、距离冲突点的距离
涉及以下函数:
void analyze (CRef confl, vec<Lit>& out_learnt, int& out_btlevel, int& out_lbd); // (bt = backtrack)
void analyzeFinal (Lit p, vec<Lit>& out_conflict); // COULD THIS BE IMPLEMENTED BY THE ORDINARIY "analyze" BY SOME REASONABLE GENE
bool collectFirstUIP(CRef confl);
void simpleAnalyze(CRef confl, vec<Lit>& out_learnt, vec<CRef>& reason_clause, bool True_confl);
5.冗余检查、归结操作等逻辑推理操作(含化简)
bool litRedundant (Lit p, uint32_t abstract_levels);
//在SolverType.h中有两个函数需要重点注意subsumes 、strengthen
/*_________________________________________________________________________________________________
|
| subsumes : (other : const Clause&) -> Lit
|
| Description:
| Checks if clause subsumes 'other', and at the same time, if it can be used to simplify 'other'
| by subsumption resolution.
|
| Result:
| lit_Error - No subsumption or simplification
| lit_Undef - Clause subsumes 'other'
| p - The literal p can be deleted from 'other'
|________________________________________________________________________________________________@*/
inline Lit Clause::subsumes(const Clause& other) const
{
//if (other.size() < size() || (extra.abst & ~other.extra.abst) != 0)
//if (other.size() < size() || (!learnt() && !other.learnt() && (extra.abst & ~other.extra.abst) != 0))
assert(!header.learnt); assert(!other.header.learnt);
assert(header.has_extra); assert(other.header.has_extra);
if (other.header.size < header.size || (data[header.size].abs & ~other.data[other.header.size].abs) != 0)
return lit_Error;
Lit ret = lit_Undef;
const Lit* c = (const Lit*)(*this);
const Lit* d = (const Lit*)other;
for (unsigned i = 0; i < header.size; i++) {
// search for c[i] or ~c[i]
for (unsigned j = 0; j < other.header.size; j++)
if (c[i] == d[j])
goto ok;
else if (ret == lit_Undef && c[i] == ~d[j]){
ret = c[i];
goto ok;
}
// did not find it
return lit_Error;
ok:;
}
return ret;
}
inline void Clause::strengthen(Lit p)
{
remove(*this, p);
calcAbstraction();
}
6.有部分假定已知赋值(部分模型已知)开展求解
vec<Lit> assumptions; // Current set of assumptions provided to solve by the user.
double progress_estimate;// Set by 'search()'.
inline void Solver::checkGarbage(void){ return checkGarbage(garbage_frac); }
7.内存控制与垃圾回收
// Resource contraints:
//
int64_t conflict_budget; // -1 means no budget.
int64_t propagation_budget; // -1 means no budget.
bool asynch_interrupt;
void Solver::relocAll(ClauseAllocator& to)
void Solver::garbageCollect()