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