3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

Add initial value setting for variables in Z3 API, solver, and optimize modules

This commit is contained in:
Nikolaj Bjorner 2024-09-18 16:13:15 +03:00
parent 0ba306e7b3
commit 48712b4f60
31 changed files with 297 additions and 9 deletions

View file

@ -2081,6 +2081,24 @@ namespace lp {
lpvar lar_solver::to_column(unsigned ext_j) const {
return m_var_register.external_to_local(ext_j);
}
bool lar_solver::move_lpvar_to_value(lpvar j, mpq const& value) {
if (is_base(j))
return false;
impq ivalue(value);
auto& lcs = m_mpq_lar_core_solver;
auto& slv = m_mpq_lar_core_solver.m_r_solver;
if (slv.column_has_upper_bound(j) && lcs.m_r_upper_bounds()[j] < ivalue)
return false;
if (slv.column_has_lower_bound(j) && lcs.m_r_lower_bounds()[j] > ivalue)
return false;
set_value_for_nbasic_column(j, ivalue);
return true;
}
bool lar_solver::tighten_term_bounds_by_delta(lpvar j, const impq& delta) {
SASSERT(column_has_term(j));

View file

@ -623,6 +623,7 @@ public:
lp_status find_feasible_solution();
void move_non_basic_columns_to_bounds();
bool move_non_basic_column_to_bounds(unsigned j);
bool move_lpvar_to_value(lpvar j, mpq const& value);
inline bool r_basis_has_inf_int() const {
for (unsigned j : r_basis()) {
if (column_is_int(j) && !column_value_is_int(j))