Skip to content

Commit ccbe6c3

Browse files
fixes
Signed-off-by: Nikolaj Bjorner <[email protected]>
1 parent 8804890 commit ccbe6c3

File tree

3 files changed

+22
-21
lines changed

3 files changed

+22
-21
lines changed

src/ast/sls/sls_smt_plugin.cpp

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ namespace sls {
106106
m_rewards[v] = m_ddfw->get_reward_avg(w);
107107
}
108108
m_completed = true;
109+
m_min_unsat_size = UINT_MAX;
109110
}
110111

111112
void smt_plugin::bounded_run(unsigned max_iterations) {
@@ -174,6 +175,7 @@ namespace sls {
174175
}
175176

176177
void smt_plugin::add_unit(sat::literal lit) {
178+
verbose_stream() << "add unit " << lit << " " << is_shared(lit) << "\n";
177179
if (!is_shared(lit))
178180
return;
179181
std::lock_guard<std::mutex> lock(m_mutex);
@@ -194,27 +196,29 @@ namespace sls {
194196

195197
bool smt_plugin::export_to_sls() {
196198
bool updated = false;
197-
if (export_units_to_sls())
199+
if (m_has_units) {
200+
std::lock_guard<std::mutex> lock(m_mutex);
201+
smt_units_to_sls();
202+
m_has_units = false;
198203
updated = true;
199-
if (export_phase_to_sls())
204+
}
205+
if (m_has_new_sat_phase) {
206+
std::lock_guard<std::mutex> lock(m_mutex);
207+
export_phase_to_sls();
208+
m_has_new_sat_phase = false;
200209
updated = true;
210+
}
201211
return updated;
202212
}
203213

204-
bool smt_plugin::export_phase_to_sls() {
205-
if (!m_has_new_sat_phase)
206-
return false;
207-
std::lock_guard<std::mutex> lock(m_mutex);
208-
IF_VERBOSE(3, verbose_stream() << "SMT -> SLS phase\n");
214+
void smt_plugin::export_phase_to_sls() {
215+
IF_VERBOSE(2, verbose_stream() << "SMT -> SLS phase\n");
209216
for (auto v : m_shared_bool_vars) {
210217
auto w = m_smt_bool_var2sls_bool_var[v];
211218
if (m_sat_phase[v] != is_true(sat::literal(w, false)))
212219
flip(w);
213220
m_ddfw->bias(w) = m_sat_phase[v] ? 1 : -1;
214221
}
215-
smt_phase_to_sls();
216-
m_has_new_sat_phase = false;
217-
return true;
218222
}
219223

220224
void smt_plugin::smt_phase_to_sls() {
@@ -250,27 +254,22 @@ namespace sls {
250254
ctx.inc_activity(v, 200 * m_rewards[v]);
251255
}
252256

253-
bool smt_plugin::export_units_to_sls() {
254-
if (!m_has_units)
255-
return false;
256-
std::lock_guard<std::mutex> lock(m_mutex);
257-
IF_VERBOSE(2, verbose_stream() << "SMT -> SLS units " << m_units << "\n");
257+
void smt_plugin::smt_units_to_sls() {
258+
IF_VERBOSE(2, if (!m_units.empty()) verbose_stream() << "SMT -> SLS units " << m_units << "\n");
258259
for (auto lit : m_units) {
259260
auto v = lit.var();
260261
if (m_shared_bool_vars.contains(v)) {
261262
auto w = m_smt_bool_var2sls_bool_var[v];
262263
sat::literal sls_lit(w, lit.sign());
263-
IF_VERBOSE(10, verbose_stream() << "unit " << sls_lit << "\n");
264+
IF_VERBOSE(2, verbose_stream() << "unit " << sls_lit << "\n");
264265
m_ddfw->add(1, &sls_lit);
265266
}
266267
else {
267268
IF_VERBOSE(0, verbose_stream() << "value restriction " << lit << " "
268269
<< mk_bounded_pp(ctx.bool_var2expr(lit.var()), m) << "\n");
269270
}
270-
}
271-
m_has_units = false;
271+
}
272272
m_units.reset();
273-
return true;
274273
}
275274

276275
void smt_plugin::export_from_sls() {

src/ast/sls/sls_smt_plugin.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ namespace sls {
9292
void export_values_from_sls();
9393
void export_phase_from_sls();
9494
void import_activity_from_sls();
95-
bool export_phase_to_sls();
96-
bool export_units_to_sls();
95+
void export_phase_to_sls();
9796
void export_values_to_smt();
9897
void export_activity_to_smt();
9998

@@ -136,6 +135,7 @@ namespace sls {
136135

137136
void smt_phase_to_sls();
138137
void smt_values_to_sls();
138+
void smt_units_to_sls();
139139
void sls_phase_to_smt();
140140
void sls_values_to_smt();
141141
void sls_activity_to_smt();

src/smt/theory_sls.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ namespace smt {
139139

140140
if (ctx.m_stats.m_num_restarts >= m_threshold + 5) {
141141
m_threshold *= 2;
142+
m_smt_plugin->smt_units_to_sls();
142143
bounded_run(m_restart_ls_steps);
143144
m_smt_plugin->sls_activity_to_smt();
144145
}
@@ -165,6 +166,7 @@ namespace smt {
165166
++m_num_guided_sls;
166167

167168
m_smt_plugin->smt_phase_to_sls();
169+
m_smt_plugin->smt_units_to_sls();
168170
m_smt_plugin->smt_values_to_sls();
169171
bounded_run(m_final_check_ls_steps);
170172
dec_final_check_ls_steps();

0 commit comments

Comments
 (0)