1. 冲突子句中各个文字所在层的排查--(1)是否有仅有一个在决策层;(2)次大层是否为0层;如为0层,则推到出UNSAT;

   
 
 1 struct ConflictData
 2 {
 3     ConflictData() :
 4             nHighestLevel(-1),
 5             bOnlyOneLitFromHighest(false)
 6         {}
 7 
 8     int nHighestLevel;
 9     bool bOnlyOneLitFromHighest;
10 };

 

   
 
 1 inline Solver::ConflictData Solver::FindConflictLevel(CRef cind)
 2 {
 3     ConflictData data;
 4     Clause& conflCls = ca[cind];
 5     data.nHighestLevel = level(var(conflCls[0]));
 6     if (data.nHighestLevel == decisionLevel() && level(var(conflCls[1])) == decisionLevel())
 7     {
 8         return data;
 9     }
10     int highestId = 0;
11     data.bOnlyOneLitFromHighest = true;
12     // find the largest decision level in the clause
13     for (int nLitId = 1; nLitId < conflCls.size(); ++nLitId)
14     {
15         int nLevel = level(var(conflCls[nLitId]));
16         if (nLevel > data.nHighestLevel)
17         {
18             highestId = nLitId;
19             data.nHighestLevel = nLevel;
20             data.bOnlyOneLitFromHighest = true;
21         }
22         else if (nLevel == data.nHighestLevel && data.bOnlyOneLitFromHighest == true)
23         {
24             data.bOnlyOneLitFromHighest = false;
25         }
26     }
27 
28     if (highestId != 0)
29     {
30         std::swap(conflCls[0], conflCls[highestId]);
31         if (highestId > 1)
32         {
33             OccLists<Lit, vec<Watcher>, WatcherDeleted>& ws = conflCls.size() == 2 ? watches_bin : watches;
34             //ws.smudge(~conflCls[highestId]);
35             remove(ws[~conflCls[highestId]], Watcher(cind, conflCls[1]));
36             ws[~conflCls[0]].push(Watcher(cind, conflCls[1]));
37         }
38     }
39 
40     return data;
41 }

 

   
posted on 2022-07-24 11:15  海阔凭鱼跃越  阅读(20)  评论(0编辑  收藏  举报