1 /***************************************************************************************[SolverConfiguration.cc]
2 Glucose -- Copyright (c) 2009-2014, Gilles Audemard, Laurent Simon
3 CRIL - Univ. Artois, France
4 LRI - Univ. Paris Sud, France (2009-2013)
5 Labri - Univ. Bordeaux, France
6
7 Syrup (Glucose Parallel) -- Copyright (c) 2013-2014, Gilles Audemard, Laurent Simon
8 CRIL - Univ. Artois, France
9 Labri - Univ. Bordeaux, France
10
11 Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of
12 Glucose (sources until 2013, Glucose 3.0, single core) are exactly the same as Minisat on which it
13 is based on. (see below).
14
15 Glucose-Syrup sources are based on another copyright. Permissions and copyrights for the parallel
16 version of Glucose-Syrup (the "Software") are granted, free of charge, to deal with the Software
17 without restriction, including the rights to use, copy, modify, merge, publish, distribute,
18 sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is
19 furnished to do so, subject to the following conditions:
20
21 - The above and below copyrights notices and this permission notice shall be included in all
22 copies or substantial portions of the Software;
23 - The parallel version of Glucose (all files modified since Glucose 3.0 releases, 2013) cannot
24 be used in any competitive event (sat competitions/evaluations) without the express permission of
25 the authors (Gilles Audemard / Laurent Simon). This is also the case for any competitive event
26 using Glucose Parallel as an embedded SAT engine (single core or not).
27
28
29 --------------- Original Minisat Copyrights
30
31 Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson
32 Copyright (c) 2007-2010, Niklas Sorensson
33
34 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
35 associated documentation files (the "Software"), to deal in the Software without restriction,
36 including without limitation the rights to use, copy, modify, merge, publish, distribute,
37 sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
38 furnished to do so, subject to the following conditions:
39
40 The above copyright notice and this permission notice shall be included in all copies or
41 substantial portions of the Software.
42
43 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
44 NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
45 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
46 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
47 OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
48 **************************************************************************************************/
49
50 #include "parallel/MultiSolvers.h"
51 #include "core/Solver.h"
52 //#include "parallel/ParallelSolver.h"
53 #include "parallel/SolverConfiguration.h"
54
55 using namespace Glucose;
56
57
configure(MultiSolvers * ms,int nbsolvers)58 void SolverConfiguration::configure(MultiSolvers *ms, int nbsolvers) {
59 for(int i = 1;i<nbsolvers;i++) { // Configuration for the sat race 2015
60 ms->solvers[i]->randomizeFirstDescent = true;
61 ms->solvers[i]->adaptStrategies = (i%2==0); // Just half of the cores are in adaptive mode
62 ms->solvers[i]->forceUnsatOnNewDescent = (i%4==0); // Just half of adaptive cores have the unsat force
63 }
64 if (nbsolvers > 8) { // configuration for the second phase of the sat race 2015
65 for(int i=0;i<nbsolvers;i++) { // we have like 32 threads, so we need to export just very good clauses
66 ms->solvers[i]->goodlimitlbd = 5;
67 ms->solvers[i]->goodlimitsize = 15;
68 }
69 }
70
71 }
72
73
configureSAT15Adapt(MultiSolvers * ms,int nbsolvers)74 void SolverConfiguration::configureSAT15Adapt(MultiSolvers *ms, int nbsolvers) {
75 for(int i = 1;i<nbsolvers;i++) { // Configuration for the sat race 2015
76 ms->solvers[i]->randomizeFirstDescent = true;
77 ms->solvers[i]->adaptStrategies = (i%2==0); // Just half of the cores are in adaptive mode
78 }
79 if (nbsolvers > 8) { // configuration for the second phase of the sat race 2015
80 for(int i=0;i<nbsolvers;i++) { // we have like 32 threads, so we need to export just very good clauses
81 ms->solvers[i]->goodlimitlbd = 5;
82 ms->solvers[i]->goodlimitsize = 15;
83 }
84 }
85 }
86
87
configureSAT15Default(MultiSolvers * ms,int nbsolvers)88 void SolverConfiguration::configureSAT15Default(MultiSolvers *ms, int nbsolvers) {
89 for(int i = 1;i<nbsolvers;i++)
90 ms->solvers[i]->randomizeFirstDescent = true;
91
92 if (nbsolvers > 8) { // configuration for the second phase of the sat race 2015
93 for(int i=0;i<nbsolvers;i++) {
94 ms->solvers[i]->goodlimitlbd = 5;
95 ms->solvers[i]->goodlimitsize = 15;
96
97 }
98 }
99
100 }
101
configureSAT14(MultiSolvers * ms,int nbsolvers)102 void SolverConfiguration::configureSAT14(MultiSolvers *ms, int nbsolvers) {
103
104 if (nbsolvers < 2 ) return;
105
106 ms->solvers[1]->var_decay = 0.94;
107 ms->solvers[1]->max_var_decay = 0.96;
108 ms->solvers[1]->firstReduceDB=600;
109
110 if (nbsolvers < 3 ) return;
111
112 ms->solvers[2]->var_decay = 0.90;
113 ms->solvers[2]->max_var_decay = 0.97;
114 ms->solvers[2]->firstReduceDB=500;
115
116 if (nbsolvers < 4 ) return;
117
118 ms->solvers[3]->var_decay = 0.85;
119 ms->solvers[3]->max_var_decay = 0.93;
120 ms->solvers[3]->firstReduceDB=400;
121
122 if (nbsolvers < 5 ) return;
123
124 // Glucose 2.0 (+ blocked restarts)
125 ms->solvers[4]->var_decay = 0.95;
126 ms->solvers[4]->max_var_decay = 0.95;
127 ms->solvers[4]->firstReduceDB=4000;
128 ms->solvers[4]->lbdQueue.growTo(100);
129 ms->solvers[4]->sizeLBDQueue = 100;
130 ms->solvers[4]->K = 0.7;
131 ms->solvers[4]->incReduceDB = 500;
132
133 if (nbsolvers < 6 ) return;
134
135 ms->solvers[5]->var_decay = 0.93;
136 ms->solvers[5]->max_var_decay = 0.96;
137 ms->solvers[5]->firstReduceDB=100;
138 ms->solvers[5]->incReduceDB = 500;
139
140 if (nbsolvers < 7 ) return;
141
142 ms->solvers[6]->var_decay = 0.75;
143 ms->solvers[6]->max_var_decay = 0.94;
144 ms->solvers[6]->firstReduceDB=2000;
145
146 if (nbsolvers < 8 ) return;
147
148 ms->solvers[7]->var_decay = 0.94;
149 ms->solvers[7]->max_var_decay = 0.96;
150 ms->solvers[7]->firstReduceDB=800;
151
152 if (nbsolvers < 9) return;
153
154 // ms->solvers[8]->reduceOnSize = true; // NOT USED ANYMORE
155
156 if (nbsolvers < 10 ) return;
157
158 // ms->solvers[9]->reduceOnSize = true; // NOT USED ANYMORE
159 // ms->solvers[9]->reduceOnSizeSize = 14;
160
161 if (nbsolvers < 11 ) return;
162
163 double noisevar_decay = 0.005;
164 int noiseReduceDB = 50;
165 for (int i=10;i<nbsolvers;i++) {
166 ms->solvers[i]-> var_decay = ms->solvers[i%8]->var_decay;
167 ms->solvers[i]-> max_var_decay = ms->solvers[i%8]->max_var_decay;
168 ms->solvers[i]-> firstReduceDB= ms->solvers[i%8]->firstReduceDB;
169 ms->solvers[i]->var_decay += noisevar_decay;
170 ms->solvers[i]->firstReduceDB+=noiseReduceDB;
171 if ((i+1) % 8 == 0) {
172 noisevar_decay += 0.006;
173 noiseReduceDB += 25;
174 }
175 }
176 }
177