Doxygen Generated Documentation of Ben-Jose Trainable SAT Solver Library
solver.h
1 
2 
3 /*************************************************************
4 
5 This file is part of ben-jose.
6 
7 ben-jose is free software: you can redistribute it and/or modify
8 it under the terms of the version 3 of the GNU General Public
9 License as published by the Free Software Foundation.
10 
11 ben-jose is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with ben-jose. If not, see <http://www.gnu.org/licenses/>.
18 
19 ------------------------------------------------------------
20 
21 Copyright (C) 2007-2012, 2014-2016. QUIROGA BELTRAN, Jose Luis.
22 Id (cedula): 79523732 de Bogota - Colombia.
23 See https://github.com/joseluisquiroga/ben-jose
24 
25 ben-jose is free software thanks to The Glory of Our Lord
26  Yashua Melej Hamashiaj.
27 Our Resurrected and Living, both in Body and Spirit,
28  Prince of Peace.
29 
30 ------------------------------------------------------------
31 
32 solver.h
33 
34 the solver wrapper.
35 
36 --------------------------------------------------------------*/
37 
38 #ifndef SOLVER_H
39 #define SOLVER_H
40 
41 #include "dbg_config.h"
42 #include "instance_info.h"
43 #include "skeleton.h"
44 #include "ben_jose.h"
45 
46 #define SOLVER_CK(prm) DBG_BJ_LIB_CK(prm)
47 #define SOLVER_REL_CK(prm) if(! (prm)){ throw solver_exception(); }
48 
49 class brain;
50 
51 DBG(
52  class dbg_inst_info;
53  class dbg_slvr_info;
54 )
55 
56 //======================================================================
57 // solver_exception
58 
59 class solver_exception : public top_exception {
60 public:
61  solver_exception(long the_id = 0) : top_exception(the_id)
62  {}
63 };
64 
65 //=================================================================
66 // dbg_slvr_info
67 
68 #ifdef FULL_DEBUG
69 
70 class dbg_slvr_info {
71 public:
72  long dbg_max_lv;
73  long dbg_max_wrt_num_subnmp;
74  long dbg_max_fnd_num_subnmp;
75 
76  avg_stat dbg_avg_num_filled;
77  avg_stat dbg_avg_neu_sz;
78 
79  ch_string dbg_html_out_path;
80 
81  bool dbg_as_release;
82 
83  dbg_slvr_info(){
84  init_dbg_slvr_info();
85  }
86 
87  void init_dbg_slvr_info(){
88  dbg_max_lv = 0;
89  dbg_max_wrt_num_subnmp = 0;
90  dbg_max_fnd_num_subnmp = 0;
91 
92  dbg_avg_num_filled.vs_nam = "NUM_FILLED";
93  dbg_avg_neu_sz.vs_nam = "NEU_SZ";
94 
95  dbg_html_out_path = ".";
96 
97  dbg_as_release = false;
98  }
99 };
100 
101 #endif
102 
103 //=================================================================
104 // slvr_params
105 
106 class slvr_params {
107 public:
108  bool sp_as_release;
109  bool sp_only_deduc;
110  bool sp_write_proofs;
111  bool sp_test_result;
112 
113  slvr_params(){
114  init_slvr_params();
115  }
116 
117  void init_slvr_params(){
118  sp_as_release = false;
119  sp_only_deduc = false;
120  sp_write_proofs = false;
121  sp_test_result = false;
122  }
123 };
124 
125 //=================================================================
126 // solver
127 
128 class solver {
129 private:
130  solver& operator = (solver& other){
131  throw instance_exception(inx_bad_eq_op);
132  }
133 
134  solver(solver& other){
135  throw instance_exception(inx_bad_creat);
136  }
137 
138 public:
139  static
140  char* CL_NAME;
141 
142  virtual
143  char* get_cls_name(){
144  return solver::CL_NAME;
145  }
146 
147  brain* slv_dbg_brn;
148  debug_info slv_dbg_conf_info;
149 
150  slvr_params slv_prms;
151  instance_info slv_inst;
152  skeleton_glb slv_skl;
153  DBG(dbg_slvr_info slv_dbg2;)
154 
155  solver(){
156  init_solver();
157  }
158 
159  ~solver(){
160  }
161 
162  void init_solver();
163 
164  DBG(
165  void update_dbg2(dbg_inst_info& ist_info);
166  );
167 
168  static
169  solver* create_solver(){
170  solver* lv = tpl_malloc<solver>();
171  new (lv) solver();
172  return lv;
173  }
174 
175  static
176  void release_solver(solver* lv){
177  SOLVER_CK(lv != NULL_PT);
178  lv->~solver();
179  tpl_free<solver>(lv);
180  }
181 
182 };
183 
184 #endif // SOLVER_H
185 
186 
Class that holds all data used to solve a particular CNF instance.
Definition: brain.h:3085
Class that holds an instance data.
Definition: instance_info.h:96
ben_jose API declaration.
A skeleton_glb is a directory holding a database.
Definition: skeleton.h:761