38 #ifndef BATCH_SOLVER_H 39 #define BATCH_SOLVER_H 44 #define DO_FINAL_GETCHAR 45 #define PRINT_TOTALS_PERIOD 10.0 50 #include "util_funcs.h" 54 #define BATCH_CK(prm) DBG_CK(prm) 56 #define LOG_NM_ERROR "error.log" 57 #define LOG_NM_RESULTS "results.log" 58 #define LOG_NM_STATS "stats.log" 59 #define LOG_NM_ASSIGS "assigs.log" 60 #define TEST_SUF ".test" 62 #define INVALID_TEST_FILE "invalid_test_file" 67 #define DO_PRINTS(prm) prm 69 #define PRT_OUT_0(comm) \ 72 bj_ostream& os = bj_out; \ 80 #define PRT_OUT_1(comm) 87 get_log_name(ch_string f_nam, ch_string sufix){
88 ch_string lg_nm = f_nam +
"_" + sufix;
97 DECLARE_PRINT_FUNCS(batch_entry)
102 #define cbool_to_str(vv) ((vv == 0)?("0"):("1")) 108 ch_string be_result_str;
113 be_result_str =
"invalud_result_str";
119 bj_ostream& print_batch_entry(bj_ostream& os,
bool from_pt =
false);
125 long get_free_mem_kb();
132 ch_string version_str;
134 ch_string result_titles_str;
141 bool op_dbg_as_release;
143 mem_size dbg_mem_at_start;
145 bool dbg_skip_print_info;
147 bj_ostr_stream error_stm;
150 ch_string input_file_nm;
153 ch_string batch_name;
154 ch_string batch_log_errors_pth;
155 ch_string batch_log_results_pth;
156 ch_string batch_log_stats_pth;
157 ch_string batch_log_assigs_pth;
159 integer batch_num_files;
160 integer batch_consec;
161 integer batch_num_unknown_satisf;
162 integer batch_num_yes_satisf;
163 integer batch_num_no_satisf;
164 integer batch_num_timeout;
165 integer batch_num_memout;
166 integer batch_num_error;
168 avg_stat batch_stat_lits;
169 avg_stat batch_stat_laps;
170 avg_stat batch_stat_solve_tm;
171 avg_stat batch_stat_mem_used;
173 avg_stat batch_stat_load_tm;
174 avg_stat batch_stat_num_cnf_saved;
175 avg_stat batch_stat_num_cnf_finds;
176 avg_stat batch_stat_quick_discards;
178 double batch_start_time;
179 double batch_end_time;
180 timer batch_prt_totals_timer;
182 row<batch_entry> batch_instances;
183 row<batch_entry> batch_test_entries;
185 bool batch_test_has_errors;
187 ch_string gg_file_name;
189 ch_string bc_slvr_path;
192 void init_batch_solver();
193 void finish_batch_solver();
203 bool get_args(
int argc,
char** argv);
204 void set_input_name();
206 batch_entry& get_curr_inst(){
207 long batch_idx = batch_consec - 1;
208 DBG_CK(batch_instances.is_valid_idx(batch_idx));
209 batch_entry& the_ans = batch_instances[batch_idx];
213 bool in_valid_inst(){
214 long batch_idx = batch_consec - 1;
215 return (batch_instances.is_valid_idx(batch_idx));
218 ch_string init_log_name(ch_string sufix);
220 ch_string get_file_name(
bool& is_batch){
221 ch_string f_nam = gg_file_name;
223 if(batch_name.size() > 0){
230 void reset_err_msg(){
232 error_stm.str() =
"";
236 double mem_percent_used();
238 void print_final_assig();
239 void count_instance(batch_entry& inst_info);
241 bj_ostream& print_mini_stats(bj_ostream& os);
242 bj_ostream& print_stats(bj_ostream& os,
double current_secs = 0.0);
244 bj_ostream& print_mem_used(bj_ostream& os);
245 bj_ostream& print_totals(bj_ostream& os,
double curr_tm = 0.0);
246 bj_ostream& print_final_totals(bj_ostream& os);
247 void print_batch_consec();
249 void log_error_message(
const ch_string& msg_log);
250 void log_batch_info(ch_string& log_nm);
251 void print_end_msg();
252 void read_batch_file(row<batch_entry>& names);
253 void work_all_instances();
254 void do_all_instances();
257 ch_string get_test_file_path();
258 void read_test_file(row<batch_entry>& test_entries, ch_string& file_nm_str);
259 void test_result_entries();
260 bool test_entry(batch_entry& rr, batch_entry& tt);
268 batch_entry::print_batch_entry(bj_ostream& os,
bool from_pt){
273 DEFINE_PRINT_FUNCS(batch_entry)
278 void chomp_string(ch_string& s1);
279 int solver_main(
int argc,
char** argv);
282 #endif // BATCH_SOLVER_H void * bj_solver_t
A ben-jose solver object is of this tyoe.
Definition: ben_jose.h:165
ben_jose API declaration.
void bj_init_output(bj_output_t *the_out)
Definition: ben_jose.cpp:49