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.MixedDataStructureDaniel;
23 import org.sat4j.minisat.core.DataStructureFactory;
24 import org.sat4j.minisat.core.ILits;
25 import org.sat4j.minisat.core.SearchParams;
26 import org.sat4j.minisat.core.Solver;
27 import org.sat4j.minisat.learning.MiniSATLearning;
28 import org.sat4j.minisat.orders.VarOrderHeap;
29 import org.sat4j.minisat.restarts.MiniSATRestarts;
30 import org.sat4j.minisat.uip.FirstUIP;
31 import org.sat4j.pb.IPBSolver;
32
33 public class SolverFactory extends ASolverFactory<IPBSolver> {
34
35 private static final long serialVersionUID = 1L;
36
37
38
39
40
41
42
43 public static Solver<ILits,DataStructureFactory<ILits>> newMiniMaxSAT() {
44 MiniSATLearning<ILits,DataStructureFactory<ILits>> learning = new MiniSATLearning<ILits,DataStructureFactory<ILits>>();
45 Solver<ILits,DataStructureFactory<ILits>> solver = new Solver<ILits,DataStructureFactory<ILits>>(new FirstUIP(), learning,
46 new MixedDataStructureDaniel(), new SearchParams(1.2,
47 100000), new VarOrderHeap<ILits>(),
48 new MiniSATRestarts());
49 learning.setDataStructureFactory(solver.getDSFactory());
50 learning.setVarActivityListener(solver);
51 return solver;
52 }
53
54 @Override
55 public IPBSolver defaultSolver() {
56 return newDefault();
57 }
58
59 @Override
60 public IPBSolver lightSolver() {
61 return newLight();
62 }
63
64 public static IPBSolver newDefault() {
65 return org.sat4j.pb.SolverFactory.newDefault();
66 }
67
68 public static IPBSolver newLight() {
69 return org.sat4j.pb.SolverFactory.newLight();
70 }
71 }