1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.sat4j.maxsat;
20
21 import org.sat4j.core.ASolverFactory;
22 import org.sat4j.minisat.constraints.MixedDataStructureDanielWL;
23 import org.sat4j.minisat.core.DataStructureFactory;
24 import org.sat4j.minisat.core.SearchParams;
25 import org.sat4j.minisat.core.Solver;
26 import org.sat4j.minisat.learning.MiniSATLearning;
27 import org.sat4j.minisat.orders.VarOrderHeap;
28 import org.sat4j.minisat.restarts.MiniSATRestarts;
29 import org.sat4j.minisat.uip.FirstUIP;
30 import org.sat4j.pb.IPBSolver;
31
32 public class SolverFactory extends ASolverFactory<IPBSolver> {
33
34 private static final long serialVersionUID = 1L;
35
36
37
38
39
40
41
42 public static Solver<DataStructureFactory> newMiniMaxSAT() {
43 MiniSATLearning<DataStructureFactory> learning = new MiniSATLearning<DataStructureFactory>();
44 Solver<DataStructureFactory> solver = new Solver<DataStructureFactory>(new FirstUIP(), learning,
45 new MixedDataStructureDanielWL(), new SearchParams(1.2,
46 100000), new VarOrderHeap(),
47 new MiniSATRestarts());
48 learning.setDataStructureFactory(solver.getDSFactory());
49 learning.setVarActivityListener(solver);
50 return solver;
51 }
52
53 @Override
54 public IPBSolver defaultSolver() {
55 return newDefault();
56 }
57
58 @Override
59 public IPBSolver lightSolver() {
60 return newLight();
61 }
62
63 public static IPBSolver newDefault() {
64 return org.sat4j.pb.SolverFactory.newDefault();
65 }
66
67 public static IPBSolver newLight() {
68 return org.sat4j.pb.SolverFactory.newLight();
69 }
70 }