3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-26 21:16:02 +00:00

cap cube size

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2025-08-17 18:22:50 -07:00
parent a5c9e370de
commit 53f32bf08f
3 changed files with 9 additions and 1 deletions

View file

@ -9,5 +9,6 @@ def_module_params('smt_parallel',
('relevant_units_only', BOOL, True, 'only share relvant units'), ('relevant_units_only', BOOL, True, 'only share relvant units'),
('max_conflict_mul', DOUBLE, 1.5, 'increment multiplier for max-conflicts'), ('max_conflict_mul', DOUBLE, 1.5, 'increment multiplier for max-conflicts'),
('share_units_initial_only', BOOL, False, 'share only initial Boolean atoms as units'), ('share_units_initial_only', BOOL, False, 'share only initial Boolean atoms as units'),
('cube_initial_only', BOOL, False, 'cube only on initial Boolean atoms') ('cube_initial_only', BOOL, False, 'cube only on initial Boolean atoms'),
('max_cube_size', UINT, 20, 'maximum size of a cube to share'),
)) ))

View file

@ -420,6 +420,8 @@ namespace smt {
for (unsigned i = start; i < stop; ++i) { for (unsigned i = start; i < stop; ++i) {
// copy the last cube so that expanding m_cubes doesn't invalidate reference. // copy the last cube so that expanding m_cubes doesn't invalidate reference.
auto cube = m_cubes[i]; auto cube = m_cubes[i];
if (cube.size() >= m_config.m_max_cube_size)
continue;
m_cubes.push_back(cube); m_cubes.push_back(cube);
m_cubes.back().push_back(m.mk_not(atom)); m_cubes.back().push_back(m.mk_not(atom));
m_cubes[i].push_back(atom); m_cubes[i].push_back(atom);
@ -522,6 +524,7 @@ namespace smt {
m_cubes.reset(); m_cubes.reset();
m_cubes.push_back(expr_ref_vector(m)); // push empty cube m_cubes.push_back(expr_ref_vector(m)); // push empty cube
m_split_atoms.reset(); m_split_atoms.reset();
m_config.m_max_cube_size = smt_parallel_params(p.ctx.m_params).max_cube_size();
} }
lbool parallel::operator()(expr_ref_vector const& asms) { lbool parallel::operator()(expr_ref_vector const& asms) {

View file

@ -45,11 +45,15 @@ namespace smt {
is_exception_msg, is_exception_msg,
is_exception_code is_exception_code
}; };
struct config {
unsigned m_max_cube_size = 20;
};
ast_manager& m; ast_manager& m;
parallel& p; parallel& p;
std::mutex mux; std::mutex mux;
state m_state = state::is_running; state m_state = state::is_running;
config m_config;
expr_ref_vector m_split_atoms; // atoms to split on expr_ref_vector m_split_atoms; // atoms to split on
vector<expr_ref_vector> m_cubes; vector<expr_ref_vector> m_cubes;
unsigned m_max_batch_size = 10; unsigned m_max_batch_size = 10;