View Javadoc

1   /*
2    * Created on 8 juin 07
3    *
4    * To change the template for this generated file go to
5    * Window>Preferences>Java>Code Generation>Code and Comments
6    */
7   package org.sat4j.minisat.restarts;
8   
9   import org.sat4j.minisat.core.RestartStrategy;
10  import org.sat4j.minisat.core.SearchParams;
11  
12  public class ArminRestarts implements RestartStrategy {
13  
14      /**
15       * 
16       */
17      private static final long serialVersionUID = 1L;
18      
19      private double  inner,outer;
20      private long conflicts;
21      private SearchParams params;
22      
23      public void init(SearchParams params) {
24          this.params = params;
25          inner = params.getInitConflictBound();
26          outer = params.getInitConflictBound();
27          conflicts = Math.round(inner);
28      }
29  
30      public long nextRestartNumberOfConflict() {
31          return conflicts;
32      }
33  
34      public void onRestart() {
35          if (inner>=outer) {
36              outer *= params.getConflictBoundIncFactor();
37              inner = params.getInitConflictBound();
38          } else {
39              inner *= params.getConflictBoundIncFactor();
40          }
41          conflicts = Math.round(inner);
42      }
43  
44      @Override
45      public String toString() {
46          return "Armin Biere (Picosat) restarts strategy"; 
47      }
48  }