3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-07-01 18:38:47 +00:00

porting more

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2022-10-28 20:06:28 -07:00
parent d08e61219b
commit 6616a75283
5 changed files with 45 additions and 21 deletions

View file

@ -264,6 +264,7 @@ namespace sat {
m_xor_gauss_min_matrix_rows = p.xor_gauss_min_matrix_rows(); m_xor_gauss_min_matrix_rows = p.xor_gauss_min_matrix_rows();
m_xor_gauss_max_matrix_columns = p.xor_gauss_max_matrix_columns(); m_xor_gauss_max_matrix_columns = p.xor_gauss_max_matrix_columns();
m_xor_gauss_max_num_matrices = p.xor_gauss_max_num_matrices(); m_xor_gauss_max_num_matrices = p.xor_gauss_max_num_matrices();
m_xor_gauss_force_use_all_matrices = p.xor_gauss_force_use_all_matrices();
sat_simplifier_params ssp(_p); sat_simplifier_params ssp(_p);
m_elim_vars = ssp.elim_vars(); m_elim_vars = ssp.elim_vars();

View file

@ -207,6 +207,7 @@ namespace sat {
unsigned m_xor_gauss_min_matrix_rows; unsigned m_xor_gauss_min_matrix_rows;
unsigned m_xor_gauss_max_matrix_columns; unsigned m_xor_gauss_max_matrix_columns;
unsigned m_xor_gauss_max_num_matrices; unsigned m_xor_gauss_max_num_matrices;
bool m_xor_gauss_force_use_all_matrices;
config(params_ref const & p); config(params_ref const & p);

View file

@ -139,6 +139,7 @@ def_module_params('sat',
('xor.gauss.max_matrix_rows', UINT, UINT_MAX, 'The maximum matrix size -- no. of rows'), ('xor.gauss.max_matrix_rows', UINT, UINT_MAX, 'The maximum matrix size -- no. of rows'),
('xor.gauss.min_matrix_rows', UINT, 0, 'The minimum matrix size -- no. of rows'), ('xor.gauss.min_matrix_rows', UINT, 0, 'The minimum matrix size -- no. of rows'),
('xor.gauss.max_num_matrices', UINT, UINT_MAX, 'Maximum number of matrices'), ('xor.gauss.max_num_matrices', UINT, UINT_MAX, 'Maximum number of matrices'),
('xor.gauss.force_use_all_matrices', BOOL, True, 'tbd'),
# ('xor.gauss.autodisable', BOOL, False, 'tbd'), # ('xor.gauss.autodisable', BOOL, False, 'tbd'),
# ('xor.gauss.min_usefulness_cutoff', DOUBLE, 0, 'tbd'), # ('xor.gauss.min_usefulness_cutoff', DOUBLE, 0, 'tbd'),
# ('xor.gauss.do_matrix_find', BOOL, True, 'tbd'), # ('xor.gauss.do_matrix_find', BOOL, True, 'tbd'),

View file

@ -1,3 +1,17 @@
/*++
Copyright (c) 2022 Microsoft Corporation
Module Name:
xor_matrix_finder.cpp
Abstract:
Based on CMS (crypto minisat by Mate Soos).
--*/
#include "sat/smt/xor_matrix_finder.h" #include "sat/smt/xor_matrix_finder.h"
#include "sat/smt/xor_solver.h" #include "sat/smt/xor_solver.h"
@ -9,14 +23,11 @@ namespace xr {
inline bool xor_matrix_finder::belong_same_matrix(const constraint& x) { inline bool xor_matrix_finder::belong_same_matrix(const constraint& x) {
uint32_t comp_num = -1; uint32_t comp_num = -1;
for (sat::bool_var v : x) { for (sat::bool_var v : x) {
if (m_table[v] == l_undef) if (m_table[v] == l_undef) // Belongs to none, abort
//Belongs to none, abort
return false; return false;
if (comp_num == -1) if (comp_num == -1) // Belongs to this one
//Belongs to this one
comp_num = m_table[v]; comp_num = m_table[v];
else if (comp_num != m_table[v]) else if (comp_num != m_table[v]) // Another var in this XOR belongs to another component
//Another var in this XOR belongs to another component
return false; return false;
} }
return true; return true;
@ -26,7 +37,7 @@ namespace xr {
SASSERT(!m_sat.inconsistent()); SASSERT(!m_sat.inconsistent());
#if 0 #if 0
SASSERT(m_solver->gmatrices.empty()); SASSERT(m_xor.gmatrices.empty());
can_detach = true; can_detach = true;
m_table.clear(); m_table.clear();
@ -174,11 +185,8 @@ namespace xr {
} }
} }
#if 0 if (m_sat.get_config().m_xor_gauss_force_use_all_matrices)
if (m_sat.get_config().force_use_all_matrixes) {
use_matrix = true; use_matrix = true;
}
#endif
#if 0 #if 0
if (use_matrix) { if (use_matrix) {

View file

@ -1,3 +1,16 @@
/*++
Copyright (c) 2022 Microsoft Corporation
Module Name:
xor_matrix_finder.h
Abstract:
Based on CMS (crypto minisat by Mate Soos).
--*/
#pragma once #pragma once
#include "util/debug.h" #include "util/debug.h"