程式碼解讀——Solver.h及Solver.cpp
阿新 • • 發佈:2020-08-09
一些重要筆記整理
1.變元v的decision[v部分變元不參與活躍度排序
在讀入cnf檔案時,首先呼叫的是newVars函式,該函式呼叫的第二個引數是預設值True。
1 Var Solver::newVar(bool sign, bool dvar) //該函式第二個引數預設值為true 2 { 3 int v = nVars(); 4 5 //-------------------------------- 6 // Update on 2020-03-10 7 // node created for var graph 8 varGraph->AddNode(v); // |
|
1 inline void Solver::setDecisionVar(Var v, bool b) 2 { 3 if ( b && !decision[v]) dec_vars++; 4 else if (!b && decision[v]) dec_vars--; 5 6 decision[v] = b; 7 if (b && !order_heap_CHB.inHeap(v)){ 8 order_heap_CHB.insert(v); 9 order_heap_VSIDS.insert(v); 10 order_heap_distance.insert(v);} 11 } 可以看到,採用預設引數b為真,則 (1) decision[v] = b; 該變元可以作為決策變元使用; |
|