3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-20 12:53:38 +00:00

initialize

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-02-22 15:11:18 -08:00
parent 43ddad0ecd
commit 54f145b364
3 changed files with 12 additions and 2 deletions

View file

@ -20,6 +20,7 @@
#include "sat_local_search.h" #include "sat_local_search.h"
#include "sat_solver.h" #include "sat_solver.h"
#include "card_extension.h" #include "card_extension.h"
#include "sat_params.hpp"
namespace sat { namespace sat {
@ -42,6 +43,7 @@ namespace sat {
} }
} }
} }
set_parameters();
} }
void local_search::reinit() { void local_search::reinit() {
@ -285,6 +287,8 @@ namespace sat {
} }
lbool local_search::operator()() { lbool local_search::operator()() {
sat_params params;
std::cout << "my parameter value: " << params.cliff() << "\n";
init(); init();
bool reach_cutoff_time = false; bool reach_cutoff_time = false;
bool reach_known_best_value = false; bool reach_known_best_value = false;
@ -294,7 +298,7 @@ namespace sat {
srand(0); // TBD, use random facility and parameters to set random seed. srand(0); // TBD, use random facility and parameters to set random seed.
set_parameters(); set_parameters();
// ################## start ###################### // ################## start ######################
//cout << "Start initialize and local search, restart in every " << max_steps << " steps" << endl; std::cout << "Start initialize and local search, restart in every " << max_steps << " steps\n";
for (unsigned tries = 0; ; ++tries) { for (unsigned tries = 0; ; ++tries) {
reinit(); reinit();
for (int step = 1; step <= max_steps; ++step) { for (int step = 1; step <= max_steps; ++step) {

View file

@ -27,4 +27,5 @@ def_module_params('sat',
('drat.file', SYMBOL, '', 'file to dump DRAT proofs'), ('drat.file', SYMBOL, '', 'file to dump DRAT proofs'),
('drat.check', BOOL, False, 'build up internal proof and check'), ('drat.check', BOOL, False, 'build up internal proof and check'),
('cardinality.solver', BOOL, False, 'use cardinality/xor solver'), ('cardinality.solver', BOOL, False, 'use cardinality/xor solver'),
('cliff', UINT, 0, 'my favorite parameter'),
)) ))

View file

@ -65,7 +65,7 @@ static bool build_instance(char const * filename, sat::solver& s, sat::local_sea
} }
void tst_sat_local_search(char ** argv, int argc, int& i) { void tst_sat_local_search(char ** argv, int argc, int& i) {
if (argc != i + 2) { if (argc < i + 2) {
std::cout << "require dimacs file name\n"; std::cout << "require dimacs file name\n";
return; return;
} }
@ -75,6 +75,11 @@ void tst_sat_local_search(char ** argv, int argc, int& i) {
sat::local_search local_search(solver); sat::local_search local_search(solver);
char const* file_name = argv[i + 1]; char const* file_name = argv[i + 1];
++i; ++i;
while (i + 1 < argc) {
// set other ad hoc parameters.
std::cout << argv[i + 1] << "\n";
++i;
}
if (!build_instance(file_name, solver, local_search)) { if (!build_instance(file_name, solver, local_search)) {
return; return;