1. 程式人生 > 其它 >CaDiCal的基本資料結構

CaDiCal的基本資料結構

      CaDiCal是目前最先進的開源完備求解器之一。其學術帶頭人Univ.-Prof. Dr. Armin Biere在SAT領域非常著名,自上個世紀末以來他所帶領的研究團隊始終走在研發的前列,不斷推出最新版本。近十年來該求解器成為求解器研發社群的主流和對照基準。該求解器架構先進,學習門檻較高。必須對基本資料結構有深入的研讀和剖析。下面記錄一下自己的學習筆記。

一、簡單的基本型別

  1.Level    檔案level.hpp
 
 1 #ifndef _level_hpp_INCLUDED
 2 #define _level_hpp_INCLUDED
 3 
 4 #include <climits>
 5
6 namespace CaDiCaL { 7 8 // For each new decision we increase the decision level and push a 'Level' 9 // on the 'control' stack. The information gathered here is used in 10 // 'reuse_trail' and for early aborts in clause minimization. 11 12 struct Level { 13 14 int decision; // decision literal of this level
15 int trail; // trail start of this level 16 17 struct { 18 int count; // how many variables seen during 'analyze' 19 int trail; // smallest trail position seen on this level 20 } seen; 21 22 void reset () { seen.count = 0; seen.trail = INT_MAX; } 23 24 Level (int
d, int t) : decision (d), trail (t) { reset (); } 25 Level () { } 26 }; 27 28 } 29 30 #endif
View Code