Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
178 commits
Select commit Hold shift + click to select a range
41b5c64
very basic setup
ilanashapiro Jul 23, 2025
563906d
Merge branch 'Z3Prover:master' into parallel-solving
ilanashapiro Jul 24, 2025
4b87458
Merge remote-tracking branch 'upstream/ilana' into parallel-solving
ilanashapiro Jul 24, 2025
a6c51df
ensure solve_eqs is fully disabled when smt.solve_eqs=false, #7743
NikolajBjorner Jul 24, 2025
01633f7
respect smt configuration parameter in elim_unconstrained simplifier
NikolajBjorner Jul 24, 2025
1a488bb
indentation
NikolajBjorner Jul 25, 2025
6550495
add bash files for test runs
ilanashapiro Jul 25, 2025
e549286
add option to selectively disable variable solving for only ground ex…
NikolajBjorner Jul 26, 2025
95be0cf
remove verbose output
NikolajBjorner Jul 26, 2025
0528c86
fix #7745
NikolajBjorner Jul 26, 2025
8e1a528
ensure atomic constraints are processed by arithmetic solver
NikolajBjorner Jul 26, 2025
1f8b081
#7739 optimization
NikolajBjorner Jul 26, 2025
ad2934f
fix unsound len(substr) axiom
NikolajBjorner Jul 26, 2025
eb24488
FreshConst is_sort (#7748)
humnrdble Jul 27, 2025
e3139d4
#7750
NikolajBjorner Jul 27, 2025
0761394
Add parameter validation for selected API functions
NikolajBjorner Jul 27, 2025
67695b4
updates to ac-plugin
NikolajBjorner Jul 27, 2025
f77123c
enable passive, add check for bloom up-to-date
NikolajBjorner Jul 28, 2025
36fbee3
add top-k fixed-sized min-heap priority queue for top scoring literals
ilanashapiro Jul 28, 2025
f607a70
Merge branch 'Z3Prover:master' into parallel-solving
ilanashapiro Jul 28, 2025
4eeb98d
Merge branch 'ilana' into parallel-solving
NikolajBjorner Jul 29, 2025
2c188a5
set up worker thread batch manager for multithreaded batch cubes para…
ilanashapiro Jul 29, 2025
375d537
Merge branch 'parallel-solving' of github.com:ilanashapiro/z3 into pa…
ilanashapiro Jul 29, 2025
8a6cbec
fix bug in parallel solving batch setup
ilanashapiro Jul 30, 2025
e6213f8
fix bug
ilanashapiro Jul 31, 2025
2d876d5
allow for internalize implies
NikolajBjorner Aug 1, 2025
89cc9bd
disable pre-processing during cubing
NikolajBjorner Aug 1, 2025
12df9f8
Merge branch 'Z3Prover:master' into parallel-solving
ilanashapiro Aug 1, 2025
2a26776
debugging
ilanashapiro Aug 1, 2025
33c184f
Merge branch 'parallel-solving' of github.com:ilanashapiro/z3 into pa…
ilanashapiro Aug 1, 2025
97aa46a
remove default constructor
nunoplopes Aug 3, 2025
f23b053
remove a bunch of string copies
nunoplopes Aug 3, 2025
d8fafd8
Update euf_ac_plugin.cpp
NikolajBjorner Aug 3, 2025
b9b3e0d
Update euf_completion.cpp
NikolajBjorner Aug 3, 2025
d66fabe
Update smt_parallel.cpp
NikolajBjorner Aug 3, 2025
aac8787
process cubes as lists of individual lits
ilanashapiro Aug 4, 2025
a0a0670
Merge branch 'ilana' into parallel-solving
NikolajBjorner Aug 4, 2025
c9c3548
Merge branch 'Z3Prover:master' into parallel-solving
ilanashapiro Aug 4, 2025
7df95c0
merge
ilanashapiro Aug 4, 2025
cc8bc84
Merge branch 'parallel-solving' of github.com:ilanashapiro/z3 into pa…
ilanashapiro Aug 4, 2025
e520a42
merge
ilanashapiro Aug 4, 2025
7a8ba4b
Add support for Algebraic Datatypes in JavaScript/TypeScript bindings…
Copilot Aug 5, 2025
3982b29
chipping away at the new code structure
ilanashapiro Aug 5, 2025
0b21376
Merge branch 'Z3Prover:master' into parallel-solving
ilanashapiro Aug 5, 2025
2fce048
comments
ilanashapiro Aug 5, 2025
cdcc89a
merge
ilanashapiro Aug 5, 2025
d0bf711
Merge branch 'parallel-solving' of github.com:ilanashapiro/z3 into pa…
ilanashapiro Aug 5, 2025
723de8d
debug infinite recursion and split cubes on existing split atoms that…
ilanashapiro Aug 6, 2025
58e3121
share lemmas, learn from unsat core, try to debug a couple of things,…
ilanashapiro Aug 6, 2025
445339d
merge
ilanashapiro Aug 6, 2025
870729b
merge
ilanashapiro Aug 6, 2025
b1ab695
fix #7603: race condition in Ctrl-C handling (#7755)
nunoplopes Aug 6, 2025
d4a4dd6
add arithemtic saturation
NikolajBjorner Aug 6, 2025
b33f444
add an option to register callback on quantifier instantiation
NikolajBjorner Aug 7, 2025
aad511d
missing new closure
NikolajBjorner Aug 7, 2025
31a3037
add Z3_solver_propagate_on_binding to ml callback declarations
NikolajBjorner Aug 7, 2025
d218e87
add python file
levnach Aug 6, 2025
efa63db
debug under defined calls
levnach Aug 7, 2025
eeb1c18
more untangle params
levnach Aug 7, 2025
3eda386
precalc parameters to define the eval order
levnach Aug 7, 2025
f5016b4
remove a printout
levnach Aug 7, 2025
30830aa
rename a Python file
levnach Aug 7, 2025
fa3d341
add on_binding callbacks across APIs
NikolajBjorner Aug 7, 2025
d57dd6e
use jboolean in Native interface
NikolajBjorner Aug 7, 2025
0cefc92
register on_binding attribute
NikolajBjorner Aug 7, 2025
7ba967e
fix java build for java bindings
NikolajBjorner Aug 7, 2025
2ac1b24
avoid interferring side-effects in function calls
NikolajBjorner Aug 7, 2025
fcd3a70
remove theory_str and classes that are only used by it
NikolajBjorner Aug 8, 2025
baa0588
remove automata from python build
NikolajBjorner Aug 8, 2025
efb0bda
remove ref to theory_str
NikolajBjorner Aug 8, 2025
88293bf
get the finest factorizations before project
levnach Aug 7, 2025
8598a74
rename add_lcs to add_lc
levnach Aug 8, 2025
72757c4
resolve bad bug about l2g and g2l translators using wrong global cont…
ilanashapiro Aug 8, 2025
a9228f4
initial attempt at dynamically switching from greedy to frugal splitt…
ilanashapiro Aug 9, 2025
b7d5add
Update RELEASE_NOTES.md
NikolajBjorner Aug 10, 2025
8493c30
resolve bug about not translating managers correctly for the second p…
ilanashapiro Aug 11, 2025
2e6d95d
Merge branch 'Z3Prover:master' into parallel-solving
ilanashapiro Aug 11, 2025
e33dc47
remove unused square-free check
levnach Aug 11, 2025
7d57e6f
Merge branch 'ilana' into parallel-solving
NikolajBjorner Aug 11, 2025
6b3b8ac
add some debug prints and impelement internal polynomial fix
ilanashapiro Aug 11, 2025
ffb4bf1
merge
ilanashapiro Aug 11, 2025
de64a53
Merge branch 'parallel-solving' of github.com:ilanashapiro/z3 into pa…
ilanashapiro Aug 11, 2025
53eb2ca
Merge branch 'Z3Prover:master' into parallel-solving
ilanashapiro Aug 11, 2025
9373fec
Merge branch 'parallel-solving' of github.com:ilanashapiro/z3 into pa…
ilanashapiro Aug 11, 2025
cf8a17a
restore the square-free check
levnach Aug 11, 2025
ef61315
add some comments and debug m_assumptions_used
ilanashapiro Aug 11, 2025
a32b7ba
redo greedy->frugal strategy so we don't split on existing cubes in f…
ilanashapiro Aug 12, 2025
d864226
set up initial scaffolding for sharing clauses between threads and ba…
ilanashapiro Aug 12, 2025
f895dbc
merge
ilanashapiro Aug 12, 2025
efa5219
Merge remote-tracking branch 'upstream/ilana' into parallel-solving
ilanashapiro Aug 12, 2025
6486d92
Add .github/copilot-instructions.md with comprehensive Z3 development…
Copilot Aug 12, 2025
d375d97
Bump actions/checkout from 4 to 5 (#7773)
dependabot[bot] Aug 12, 2025
4bd40e9
turn off logging at level 0 for testing
ilanashapiro Aug 12, 2025
bdd0122
Merge remote-tracking branch 'upstream/ilana' into parallel-solving
ilanashapiro Aug 13, 2025
ae64207
add max thread conflicts backoff
ilanashapiro Aug 13, 2025
c8e866f
Parallel solving (#7775)
ilanashapiro Aug 13, 2025
3abb091
fix #7776
NikolajBjorner Aug 13, 2025
57a60c8
add > operator as shorthand for Array
NikolajBjorner Aug 13, 2025
237891c
updates to euf completion
NikolajBjorner Aug 13, 2025
bba1111
resolve bug about not popping local ctx to base level before collecti…
ilanashapiro Aug 13, 2025
eb7fd9e
Add virtual translate method to solver_factory class (#7780)
Copilot Aug 14, 2025
7f25a0d
put return_cubes under lock
ilanashapiro Aug 14, 2025
3ba08bd
Revert "resolve bug about not popping local ctx to base level before …
ilanashapiro Aug 14, 2025
6df8b39
Update seq_rewriter.cpp
NikolajBjorner Aug 14, 2025
174d64c
fix releaseNotesSource to inline
NikolajBjorner Aug 14, 2025
4362f2d
merge
ilanashapiro Aug 15, 2025
1e7832a
Use solver factory translate method in Z3_solver_translate (#7782)
Copilot Aug 15, 2025
e24a5b6
Revert "Parallel solving (#7775)" (#7777)
NikolajBjorner Aug 15, 2025
7422d81
remove upload artifact for azure-pipeline
NikolajBjorner Aug 15, 2025
a467d8c
Fix compilation warning: add missing is_passive_eq case to switch sta…
Copilot Aug 15, 2025
7b8482a
Remove NugetPublishNightly stage from nightly.yaml (#7787)
Copilot Aug 15, 2025
7250146
add more params
ilanashapiro Aug 15, 2025
063c09b
merge, and remove misleading defaults
ilanashapiro Aug 15, 2025
9b8dc4a
Merge remote-tracking branch 'upstream/ilana' into parallel-solving
ilanashapiro Aug 15, 2025
a121e6c
enable pypi public
NikolajBjorner Aug 15, 2025
d8bf0e0
Fix nullptr dereference in pp_symbol when handling null symbol names …
Copilot Aug 17, 2025
c75b8ec
add option to control epsilon #7791
NikolajBjorner Aug 17, 2025
4082e4e
update on euf
NikolajBjorner Aug 17, 2025
ff74af7
check for internalized in solve_for
NikolajBjorner Aug 17, 2025
5ad5899
merge
ilanashapiro Aug 17, 2025
7ff0b24
fix #7792
NikolajBjorner Aug 18, 2025
4542fc0
update version number to 4.15.4
NikolajBjorner Aug 18, 2025
21e3168
fix #7753
NikolajBjorner Aug 18, 2025
debe043
fix #7796
NikolajBjorner Aug 18, 2025
b1eb5b5
Merge remote-tracking branch 'upstream/ilana' into parallel-solving
ilanashapiro Aug 19, 2025
265265a
Create centralized version management with VERSION.txt (#7802)
Copilot Aug 20, 2025
7265563
read version from VERSION.txt
NikolajBjorner Aug 20, 2025
02f195a
fix version parse
NikolajBjorner Aug 20, 2025
fa0f9c9
fix parsing of version
NikolajBjorner Aug 20, 2025
48c8da4
add param tuning experiment in python
ilanashapiro Aug 21, 2025
47ce383
Merge branch 'Z3Prover:master' into parallel-solving
ilanashapiro Aug 21, 2025
4e3734d
Merge remote-tracking branch 'upstream/ilana' into parallel-solving
ilanashapiro Aug 22, 2025
d5764a1
Merge branch 'parallel-solving' of github.com:ilanashapiro/z3 into pa…
ilanashapiro Aug 22, 2025
05e8c2e
Merge remote-tracking branch 'upstream/ilana' into parallel-solving
ilanashapiro Aug 22, 2025
5d29eb1
Fix Azure Pipeline PyPI package builds by including VERSION.txt in so…
Copilot Aug 23, 2025
64419ad
Update nightly.yaml to match release.yml NuGet tool installer changes…
Copilot Aug 23, 2025
4792068
Attempt at adding the README to the NuGet package (#7807)
SolalPirelli Aug 23, 2025
12e7478
add resources
NikolajBjorner Aug 23, 2025
7e6e96f
remove resources directive again
NikolajBjorner Aug 23, 2025
ba068d7
Document how to use system-installed Z3 with CMake projects (#7809)
Copilot Aug 23, 2025
8d395d6
Fix Julia bindings linker errors on Windows MSVC (#7794)
Copilot Aug 23, 2025
21e63db
add print for version file
NikolajBjorner Aug 23, 2025
3b03636
add more logging to setup.py
NikolajBjorner Aug 23, 2025
778b9a5
try diferennt dirs
NikolajBjorner Aug 24, 2025
1987b3d
try src_dir_repo
NikolajBjorner Aug 24, 2025
438b41a
try other dir
NikolajBjorner Aug 24, 2025
867bc6a
remove extra characters
NikolajBjorner Aug 24, 2025
be22111
more output
NikolajBjorner Aug 24, 2025
116e1ec
print dirs
NikolajBjorner Aug 24, 2025
2874645
copy VERSION from SRC_DIR
NikolajBjorner Aug 24, 2025
300e0ae
Move VERSION.txt to scripts directory and update all references (#7811)
Copilot Aug 24, 2025
12563c6
clean up a little of the handling of VERSION.txt
NikolajBjorner Aug 24, 2025
9bf74b5
add implementation and toggleable param for splitting frugal + choosi…
ilanashapiro Aug 25, 2025
8866cf5
Merge branch 'Z3Prover:master' into parallel-solving
ilanashapiro Aug 25, 2025
58dc54e
remove priority queue for top-k lits and replace with simple linear s…
ilanashapiro Aug 25, 2025
0901711
Merge branch 'parallel-solving' of github.com:ilanashapiro/z3 into pa…
ilanashapiro Aug 25, 2025
b9256ba
Add new configurations for SMT parallel settings
ilanashapiro Aug 25, 2025
894c0e9
Bugfix: post-build sanity check when an old version of ocaml-z3 is in…
arbipher Aug 25, 2025
12dd705
Rename configuration from 'shareconflicts' to 'depthsplitting'
ilanashapiro Aug 25, 2025
0fdf5bc
Fix configuration for depth splitting in notes
ilanashapiro Aug 25, 2025
43d2a1f
rename variables
ilanashapiro Aug 25, 2025
307a8c5
merge
ilanashapiro Aug 25, 2025
1bed5a4
remove double tweak versioning
NikolajBjorner Aug 26, 2025
c010a38
attempting to add backbone code, it does not work. still debugging th…
ilanashapiro Aug 27, 2025
5c2f244
depth splitting now applies to greedy+frugal unless specified otherwise
ilanashapiro Aug 27, 2025
7a1c5e3
Merge branch 'Z3Prover:master' into parallel-solving
ilanashapiro Aug 27, 2025
04ef9dc
Merge remote-tracking branch 'upstream/ilana' into parallel-solving
ilanashapiro Aug 27, 2025
44e3f22
debug the backbone crash (it was references not being counted)
ilanashapiro Aug 27, 2025
e6afc50
Merge branch 'parallel-solving' of github.com:ilanashapiro/z3 into pa…
ilanashapiro Aug 27, 2025
9ea6f2e
merge
ilanashapiro Aug 27, 2025
1fae0de
iterative deepening experiment (no PQ yet). the hardness heuristic is…
ilanashapiro Aug 29, 2025
a42d21f
fix iterative deepening bug: unsolved cube needs to get re-enqueued e…
ilanashapiro Aug 29, 2025
651b860
debug iterative deepening some more and add first attempt at PQ (unte…
ilanashapiro Aug 29, 2025
67f5962
merge
ilanashapiro Aug 29, 2025
c2c0194
Merge remote-tracking branch 'upstream/ilana' into parallel-solving
ilanashapiro Aug 31, 2025
7af7ba6
fix some bugs and the PQ approach is working for now. the depth sets …
ilanashapiro Sep 1, 2025
a3024b7
add new attempt at hardness function
ilanashapiro Sep 1, 2025
042ebf5
attempt to add different hardness functions including heule schur and…
ilanashapiro Sep 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
172 changes: 130 additions & 42 deletions src/smt/smt_parallel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,120 @@ namespace smt {

namespace smt {

double parallel::worker::explicit_hardness(expr_ref_vector const& cube) {
double total = 0.0;
unsigned clause_count = 0;

// Get the scope level before the cube is assumed
unsigned scope_lvl = ctx->get_scope_level();

// Build a set of bool_vars corresponding to the cube literals
svector<bool_var> cube_vars;
for (expr* e : cube) {
bool_var v = ctx->get_bool_var(e);
if (v != null_bool_var) cube_vars.push_back(v);
}

for (auto* cp : ctx->m_aux_clauses) {
auto& clause = *cp;
unsigned sz = 0;
unsigned n_false = 0;
bool satisfied = false;

for (literal l : clause) {
bool_var v = l.var();

// Only consider literals that are part of the cube
if (!cube_vars.contains(v)) continue;

lbool val = ctx->get_assignment(l);
unsigned lvl = ctx->get_assign_level(l);

// Only include assignments made after the scope level
if (lvl <= scope_lvl) continue;

sz++;
if (val == l_true) { satisfied = true; break; }
if (val == l_false) n_false++;
}

if (satisfied || sz == 0) continue;

double m = static_cast<double>(sz) / std::max(1u, sz - n_false);
total += m;
clause_count++;
}

return clause_count ? total / clause_count : 0.0;
}

double parallel::worker::heule_schur_hardness(expr_ref_vector const& cube) {
double total = 0.0;
unsigned n = 0;

for (expr* e : cube) {
double literal_score = 0.0;

for (auto* cp : ctx->m_aux_clauses) {
auto& clause = *cp;
unsigned sz = 0;
bool occurs = false;

for (literal l : clause) {
expr* lit_expr = ctx->bool_var2expr(l.var());
if (asms.contains(lit_expr)) continue; // ignore assumptions
sz++;
if (lit_expr == e) occurs = true;
}

if (occurs && sz > 0) {
literal_score += 1.0 / pow(2.0, sz); // weight inversely by clause size
}
}

total += literal_score;
n++;
}

return n ? total / n : 0.0;
}

double parallel::worker::march_cu_hardness(expr_ref_vector const& cube) {
double total = 0.0;
unsigned n = 0;

for (expr* e : cube) {
double score = 1.0; // start with 1 to avoid zero

for (auto* cp : ctx->m_aux_clauses) {
auto& clause = *cp;
bool occurs = false;

unsigned sz = 0; // clause size counting only non-assumption literals

for (literal l : clause) {
expr* lit_expr = ctx->bool_var2expr(l.var());

if (asms.contains(lit_expr)) continue; // ignore assumptions
sz++;

if (lit_expr == e) {
occurs = true;
}
}

if (occurs && sz > 0) {
score += pow(0.5, static_cast<double>(sz)); // approximate March weight
}
}

total += score;
n++;
}

return n ? total / n : 0.0;
}

void parallel::worker::run() {
while (m.inc()) { // inc: increase the limit and check if it is canceled, vs m.limit().is_canceled() is readonly. the .limit() is also not necessary (m.inc() etc provides a convenience wrapper)
vector<expr_ref_vector> cubes;
Expand All @@ -57,16 +171,12 @@ namespace smt {
b.set_exception("context cancelled");
return;
}
LOG_WORKER(1, " checking cube: " << mk_bounded_pp(mk_and(cube), m, 3) << " max-conflicts " << m_config.m_threads_max_conflicts << "\n");

LOG_WORKER(1, " checking cube\n");
lbool r = check_cube(cube);
if (m.limit().is_canceled()) {
LOG_WORKER(1, " context cancelled\n");
return;
}

switch (r) {
case l_undef: {
if (m.limit().is_canceled())
break;
LOG_WORKER(1, " found undef cube\n");
// return unprocessed cubes to the batch manager
// add a split literal to the batch manager.
Expand All @@ -76,40 +186,17 @@ namespace smt {
returned_cubes.push_back(cube);
auto split_atoms = get_split_atoms();

if (m_config.m_iterative_deepening) {
unsigned conflicts_before = ctx->m_stats.m_num_conflicts;
unsigned propagations_before = ctx->m_stats.m_num_propagations + ctx->m_stats.m_num_bin_propagations;
unsigned decisions_before = ctx->m_stats.m_num_decisions;
unsigned restarts_before = ctx->m_stats.m_num_restarts;

lbool r = check_cube(cube);

unsigned conflicts_after = ctx->m_stats.m_num_conflicts;
unsigned propagations_after = ctx->m_stats.m_num_propagations + ctx->m_stats.m_num_bin_propagations;
unsigned decisions_after = ctx->m_stats.m_num_decisions;
unsigned restarts_after = ctx->m_stats.m_num_restarts;

// per-cube deltas
unsigned conflicts_delta = conflicts_after - conflicts_before;
unsigned propagations_delta = propagations_after - propagations_before;
unsigned decisions_delta = decisions_after - decisions_before;
unsigned restarts_delta = restarts_after - restarts_before;
LOG_WORKER(1, " cube deltas: conflicts: " << conflicts_delta << " propagations: " << propagations_delta << " decisions: " << decisions_delta << " restarts: " << restarts_delta << "\n");

// tuned experimentally
const double w_conflicts = 1.0;
const double w_propagations = 0.001;
const double w_decisions = 0.1;
const double w_restarts = 0.5;

const double cube_hardness = w_conflicts * conflicts_delta +
w_propagations * propagations_delta +
w_decisions * decisions_delta +
w_restarts * restarts_delta;
LOG_WORKER(1, " CUBING\n");
if (m_config.m_iterative_deepening || m_config.m_beam_search) { // let's automatically do iterative deepening for beam search
LOG_WORKER(1, " applying iterative deepening\n");

// const double cube_hardness = ctx->m_stats.m_num_decisions / std::max(1u, ctx->m_stats.m_num_conflicts);
const double cube_hardness = explicit_hardness(cube); // huele_schur_hardness(cube); march_cu_hardness(cube);

const double avg_hardness = b.update_avg_cube_hardness(cube_hardness);
const double factor = 1; // can tune for multiple of avg hardness later
bool should_split = cube_hardness >= avg_hardness * factor;
bool should_split = cube_hardness > avg_hardness * factor;

LOG_WORKER(1, " cube hardness: " << cube_hardness << " avg: " << avg_hardness << " avg*factor: " << avg_hardness * factor << " should-split: " << should_split << "\n");
// we still need to call return_cubes, even if we don't split, since we need to re-enqueue the current unsolved cube to the batch manager!
// should_split tells return_cubes whether to further split the unsolved cube.
Expand Down Expand Up @@ -194,6 +281,7 @@ namespace smt {
m_config.m_num_split_lits = pp.num_split_lits();
m_config.m_backbone_detection = pp.backbone_detection();
m_config.m_iterative_deepening = pp.iterative_deepening();
m_config.m_beam_search = pp.beam_search();

// don't share initial units
ctx->pop_to_base_lvl();
Expand Down Expand Up @@ -504,7 +592,7 @@ namespace smt {
------------------------------------------------------------------------------------------------------------------------------------------------------------
Final thought (do this!): use greedy strategy by a policy when C_batch, A_batch, A_worker are "small". -- want to do this. switch to frugal strategy after reaching size limit
*/
void parallel::batch_manager::return_cubes(ast_translation& l2g, vector<expr_ref_vector>const& C_worker, expr_ref_vector const& A_worker, const bool should_split) {
void parallel::batch_manager::return_cubes(ast_translation& l2g, vector<expr_ref_vector>const& C_worker, expr_ref_vector const& A_worker, const bool should_split, const double hardness) {
// SASSERT(!m_config.never_cube());

auto atom_in_cube = [&](expr_ref_vector const& cube, expr* atom) {
Expand Down Expand Up @@ -573,12 +661,12 @@ namespace smt {
// Positive atom branch
expr_ref_vector cube_pos = g_cube;
cube_pos.push_back(atom);
m_cubes_pq.push(ScoredCube(d, cube_pos));
m_cubes_pq.push(ScoredCube(d / hardness, cube_pos));

// Negative atom branch
expr_ref_vector cube_neg = g_cube;
cube_neg.push_back(m.mk_not(atom));
m_cubes_pq.push(ScoredCube(d, cube_neg));
m_cubes_pq.push(ScoredCube(d / hardness, cube_neg));

m_stats.m_num_cubes += 2;
m_stats.m_max_cube_depth = std::max(m_stats.m_max_cube_depth, d + 1);
Expand Down Expand Up @@ -630,7 +718,7 @@ namespace smt {
if ((c.size() >= m_config.m_max_cube_depth || !should_split)
&& (m_config.m_depth_splitting_only || m_config.m_iterative_deepening || m_config.m_beam_search)) {
if (m_config.m_beam_search) {
m_cubes_pq.push(ScoredCube(g_cube.size(), g_cube)); // re-enqueue the cube as is
m_cubes_pq.push(ScoredCube(g_cube.size() / hardness, g_cube)); // re-enqueue the cube as is
} else {
// need to add the depth set if it doesn't exist yet
if (m_cubes_depth_sets.find(g_cube.size()) == m_cubes_depth_sets.end()) {
Expand Down
6 changes: 5 additions & 1 deletion src/smt/smt_parallel.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ namespace smt {
// worker threads return unprocessed cubes to the batch manager together with split literal candidates.
// the batch manager re-enqueues unprocessed cubes and optionally splits them using the split_atoms returned by this and workers.
//
void return_cubes(ast_translation& l2g, vector<expr_ref_vector>const& cubes, expr_ref_vector const& split_atoms, const bool should_split=true);
void return_cubes(ast_translation& l2g, vector<expr_ref_vector>const& cubes, expr_ref_vector const& split_atoms, const bool should_split=true, const double hardness=1.0);
void report_assumption_used(ast_translation& l2g, expr* assumption);
void collect_clause(ast_translation& l2g, unsigned source_worker_id, expr* e);
expr_ref_vector return_shared_clauses(ast_translation& g2l, unsigned& worker_limit, unsigned worker_id);
Expand Down Expand Up @@ -164,6 +164,7 @@ namespace smt {
unsigned m_num_split_lits = 2;
bool m_backbone_detection = false;
bool m_iterative_deepening = false;
bool m_beam_search = false;
};

unsigned id; // unique identifier for the worker
Expand All @@ -186,6 +187,9 @@ namespace smt {

expr_ref_vector find_backbone_candidates();
expr_ref_vector get_backbones_from_candidates(expr_ref_vector const& candidates);
double explicit_hardness(expr_ref_vector const& cube);
double heule_schur_hardness(expr_ref_vector const& cube);
double march_cu_hardness(expr_ref_vector const& cube);
public:
worker(unsigned id, parallel& p, expr_ref_vector const& _asms);
void run();
Expand Down