@@ -70,11 +70,14 @@ namespace smt {
7070 lbool r = l_undef;
7171 try {
7272 r = ctx->check ();
73- } catch (z3_error &err) {
73+ }
74+ catch (z3_error &err) {
7475 b.set_exception (err.error_code ());
75- } catch (z3_exception &ex) {
76+ }
77+ catch (z3_exception &ex) {
7678 b.set_exception (ex.what ());
77- } catch (...) {
79+ }
80+ catch (...) {
7881 b.set_exception (" unknown exception" );
7982 }
8083 return r;
@@ -130,6 +133,52 @@ namespace smt {
130133 return best_param_state_idx;
131134 }
132135
136+ void parallel::param_generator::init_param_state () {
137+ // param_descrs smt_desc;
138+ // smt_params_helper::collect_param_descrs(smt_desc);
139+ smt_params_helper smtp (m_p);
140+ m_my_param_state.insert (symbol (" smt.arith.nl.branching" ), smtp.arith_nl_branching ());
141+ m_my_param_state.insert (symbol (" smt.arith.nl.cross_nested" ), smtp.arith_nl_cross_nested ());
142+ m_my_param_state.insert (symbol (" smt.arith.nl.delay" ), smtp.arith_nl_delay ());
143+ m_my_param_state.insert (symbol (" smt.arith.nl.expensive_patching" ), smtp.arith_nl_expensive_patching ());
144+ m_my_param_state.insert (symbol (" smt.arith.nl.gb" ), smtp.arith_nl_gb ());
145+ m_my_param_state.insert (symbol (" smt.arith.nl.horner" ), smtp.arith_nl_horner ());
146+ m_my_param_state.insert (symbol (" smt.arith.nl.horner_frequency" ), smtp.arith_nl_horner_frequency ());
147+ m_my_param_state.insert (symbol (" smt.arith.nl.optimize_bounds" ), smtp.arith_nl_optimize_bounds ());
148+ m_my_param_state.insert (symbol (" smt.arith.nl.propagate_linear_monomials" ), smtp.arith_nl_propagate_linear_monomials ());
149+ m_my_param_state.insert (symbol (" smt.arith.nl.tangents" ), smtp.arith_nl_tangents ());
150+ };
151+
152+ // TODO: this should mutate only one field at a time an mutate it based on m_my_param_state to keep it generic.
153+
154+ smt_params parallel::param_generator::mutate_param_state () {
155+ smt_params p = m_param_state;
156+ random_gen m_rand;
157+
158+ auto flip_bool = [&](bool &x) {
159+ if (m_rand (2 ) == 0 )
160+ x = !x;
161+ };
162+
163+ auto mutate_uint = [&](unsigned &x, unsigned lo, unsigned hi) {
164+ if ((m_rand () % 2 ) == 0 )
165+ x = lo + (m_rand ((hi - lo + 1 )));
166+ };
167+
168+ flip_bool (p.m_nl_arith_branching );
169+ flip_bool (p.m_nl_arith_cross_nested );
170+ mutate_uint (p.m_nl_arith_delay , 5 , 20 );
171+ flip_bool (p.m_nl_arith_expensive_patching );
172+ flip_bool (p.m_nl_arith_gb );
173+ flip_bool (p.m_nl_arith_horner );
174+ mutate_uint (p.m_nl_arith_horner_frequency , 2 , 6 );
175+ flip_bool (p.m_nl_arith_optimize_bounds );
176+ flip_bool (p.m_nl_arith_propagate_linear_monomials );
177+ flip_bool (p.m_nl_arith_tangents );
178+
179+ return p;
180+ }
181+
133182 void parallel::param_generator::protocol_iteration () {
134183 IF_VERBOSE (1 , verbose_stream () << " PARAM TUNER running protocol iteration\n " );
135184 ctx->get_fparams ().m_max_conflicts = m_max_prefix_conflicts;
@@ -144,6 +193,8 @@ namespace smt {
144193
145194 switch (r) {
146195 case l_undef: {
196+ // TODO, change from smt_params to a generic param state representation based on params_ref
197+ // only params_ref have effect on updates.
147198 smt_params best_param_state = m_param_state;
148199 vector<smt_params> candidate_param_states;
149200
0 commit comments