1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 package org.sat4j.pb.core;
29
30 import org.sat4j.minisat.core.IOrder;
31 import org.sat4j.minisat.core.LearningStrategy;
32 import org.sat4j.minisat.core.RestartStrategy;
33 import org.sat4j.minisat.core.SearchParams;
34
35 public class PBSolverResCP extends PBSolverCP {
36
37
38
39
40 private static final long serialVersionUID = 1L;
41
42 public static final long MAXCONFLICTS = 100000L;
43
44 private long bound;
45
46 public PBSolverResCP(LearningStrategy<PBDataStructureFactory> learner,
47 PBDataStructureFactory dsf, IOrder order) {
48 this(learner, dsf, order, MAXCONFLICTS);
49 }
50
51 public PBSolverResCP(LearningStrategy<PBDataStructureFactory> learner,
52 PBDataStructureFactory dsf, IOrder order, long bound) {
53 super(learner, dsf, order);
54 this.bound = bound;
55 }
56
57 public PBSolverResCP(LearningStrategy<PBDataStructureFactory> learner,
58 PBDataStructureFactory dsf, SearchParams params, IOrder order,
59 RestartStrategy restarter) {
60 super(learner, dsf, params, order, restarter);
61 }
62
63 public PBSolverResCP(LearningStrategy<PBDataStructureFactory> learner,
64 PBDataStructureFactory dsf, SearchParams params, IOrder order) {
65 super(learner, dsf, params, order);
66
67 }
68
69 @Override
70 boolean someCriteria() {
71 if (stats.conflicts == bound) {
72 this.setSimplifier(NO_SIMPLIFICATION);
73 this.reduceDB();
74 stats.numberOfCP++;
75 return true;
76 } else if (stats.conflicts > bound) {
77 stats.numberOfCP++;
78 return true;
79 } else {
80 stats.numberOfResolution++;
81 return false;
82 }
83 }
84
85 }