int main(int ac, char **av) { int rval = 0; int d; MWSSgraph graph; MWSSdata data; wstable_info info; wstable_parameters parms; MWISNW goal = MWISNW_MAX; reset_pointers(&graph, &data, &info); default_parameters(&parms); parseargs (ac, av, &parms); if (test) { for(n = 10; n <= 100; n = n + 10) { for(d = 1; d <= 9; d = d + 2) { seed = 3.1567; rval = testprobs(&graph, &data, &parms, n, d / 10.0, &seed, &info); MWIScheck_rval(rval,"Failed in testprobs"); } } } else { if (gen) { rval = rgrphgen(&graph, n, density, &seed); MWIScheck_rval(rval,"Failed in rgrphgen"); } else { rval = read_dimacs(&graph, prob_file); MWIScheck_rval(rval,"Failed in read_dimacs"); } if(parms.prn_info > 0) prn_graph(&graph); rval = initialize_max_wstable(&graph, &info); MWIScheck_rval(rval,"Failed in initialize_max_wstable"); if (lower_bound > 0) { goal = lower_bound + 1; } rval = call_max_wstable(&graph, &data, &parms, &info, goal, lower_bound); MWIScheck_rval(rval,"Failed in call_max_wstable"); if (rval == 0) { printf("Found best stable set of weight %d.\n",data.best_z); fflush(stdout); } } CLEANUP: free_max_wstable(&graph,&data, &info); return rval; }
int main(int argc, char ** argv) { try{ unsigned return_value = 0; memory::initialize(0); memory::exit_when_out_of_memory(true, "ERROR: out of memory"); parse_cmd_line_args(argc, argv); env_params::updt_params(); if (g_input_file && g_standard_input) { error("using standard input to read formula."); } if (!g_input_file && !g_standard_input) { error("input file was not specified."); } if (g_input_kind == IN_UNSPECIFIED) { g_input_kind = IN_SMTLIB; char const * ext = get_extension(g_input_file); if (ext) { if (strcmp(ext, "datalog") == 0 || strcmp(ext, "dl") == 0) { g_input_kind = IN_DATALOG; } else if (strcmp(ext, "dimacs") == 0 || strcmp(ext, "cnf") == 0) { g_input_kind = IN_DIMACS; } else if (strcmp(ext, "log") == 0) { g_input_kind = IN_Z3_LOG; } else if (strcmp(ext, "smt2") == 0) { g_input_kind = IN_SMTLIB_2; } else if (strcmp(ext, "smt") == 0) { g_input_kind = IN_SMTLIB; } } } switch (g_input_kind) { case IN_SMTLIB: return_value = read_smtlib_file(g_input_file); break; case IN_SMTLIB_2: memory::exit_when_out_of_memory(true, "(error \"out of memory\")"); return_value = read_smtlib2_commands(g_input_file); break; case IN_DIMACS: return_value = read_dimacs(g_input_file); break; case IN_DATALOG: read_datalog(g_input_file); break; case IN_Z3_LOG: replay_z3_log(g_input_file); break; default: UNREACHABLE(); } #ifdef _WINDOWS _CrtDumpMemoryLeaks(); #endif return return_value; } catch (z3_exception & ex) { // unhandled exception std::cerr << "ERROR: " << ex.msg() << "\n"; if (ex.has_error_code()) return ex.error_code(); else return ERR_INTERNAL_FATAL; } }