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
29
30 package org.sat4j.pb.core;
31
32 import org.sat4j.minisat.core.IOrder;
33 import org.sat4j.minisat.core.LearningStrategy;
34 import org.sat4j.minisat.core.RestartStrategy;
35 import org.sat4j.minisat.core.SearchParams;
36
37 public class PBSolverResCP extends PBSolverCP {
38
39
40
41
42 private static final long serialVersionUID = 1L;
43
44 public static final long MAXCONFLICTS = 100000L;
45
46 private long bound;
47
48 public PBSolverResCP(LearningStrategy<PBDataStructureFactory> learner,
49 PBDataStructureFactory dsf, IOrder order) {
50 this(learner, dsf, order, MAXCONFLICTS);
51 }
52
53 public PBSolverResCP(LearningStrategy<PBDataStructureFactory> learner,
54 PBDataStructureFactory dsf, IOrder order, long bound) {
55 super(learner, dsf, order);
56 this.bound = bound;
57 }
58
59 public PBSolverResCP(LearningStrategy<PBDataStructureFactory> learner,
60 PBDataStructureFactory dsf, SearchParams params, IOrder order,
61 RestartStrategy restarter) {
62 super(learner, dsf, params, order, restarter);
63 }
64
65 public PBSolverResCP(LearningStrategy<PBDataStructureFactory> learner,
66 PBDataStructureFactory dsf, SearchParams params, IOrder order) {
67 super(learner, dsf, params, order);
68
69 }
70
71 @Override
72 boolean someCriteria() {
73 if (this.stats.conflicts == this.bound) {
74 this.setSimplifier(NO_SIMPLIFICATION);
75 this.reduceDB();
76 this.stats.numberOfCP++;
77 return true;
78 } else if (this.stats.conflicts > this.bound) {
79 this.stats.numberOfCP++;
80 return true;
81 } else {
82 this.stats.numberOfResolution++;
83 return false;
84 }
85 }
86
87 }