3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-15 05:11:49 +00:00

Standardize for-loop increments to prefix form (++i) (#8199)

* Initial plan

* Convert postfix to prefix increment in for loops

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Fix member variable increment conversion bug

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Update API generator to produce prefix increments

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
Copilot 2026-01-14 19:55:31 -08:00 committed by GitHub
parent 1bf463d77a
commit 2436943794
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
475 changed files with 3237 additions and 3237 deletions

View file

@ -300,7 +300,7 @@ namespace lp {
}
std::ostream& lar_solver::print_values(std::ostream& out) const {
for (unsigned i = 0; i < get_core_solver().r_x().size(); i++) {
for (unsigned i = 0; i < get_core_solver().r_x().size(); ++i) {
const numeric_pair<mpq>& rp = get_core_solver().r_x(i);
out << this->get_variable_name(i) << " -> " << rp << "\n";
}
@ -564,7 +564,7 @@ namespace lp {
SASSERT(get_core_solver().m_r_solver.m_basis.size() == A_r().row_count());
SASSERT(get_core_solver().m_r_solver.basis_heading_is_correct());
SASSERT(A_r().column_count() == n);
TRACE(lar_solver_details, for (unsigned j = 0; j < n; j++) print_column_info(j, tout) << "\n";);
TRACE(lar_solver_details, for (unsigned j = 0; j < n; ++j) print_column_info(j, tout) << "\n";);
get_core_solver().pop(k);
remove_non_fixed_from_fixed_var_table();
@ -689,13 +689,13 @@ namespace lp {
}
bool lar_solver::costs_are_zeros_for_r_solver() const {
for (unsigned j = 0; j < get_core_solver().m_r_solver.m_costs.size(); j++) {
for (unsigned j = 0; j < get_core_solver().m_r_solver.m_costs.size(); ++j) {
SASSERT(is_zero(get_core_solver().m_r_solver.m_costs[j]));
}
return true;
}
bool lar_solver::reduced_costs_are_zeroes_for_r_solver() const {
for (unsigned j = 0; j < get_core_solver().m_r_solver.m_d.size(); j++) {
for (unsigned j = 0; j < get_core_solver().m_r_solver.m_d.size(); ++j) {
SASSERT(is_zero(get_core_solver().m_r_solver.m_d[j]));
}
return true;
@ -817,7 +817,7 @@ namespace lp {
prepare_costs_for_r_solver(term);
ret = maximize_term_on_tableau(term, term_max);
if (ret && max_coeffs != nullptr) {
for (unsigned j = 0; j < column_count(); j++) {
for (unsigned j = 0; j < column_count(); ++j) {
const mpq& d_j = get_core_solver().m_r_solver.m_d[j];
if (d_j.is_zero())
continue;
@ -871,7 +871,7 @@ namespace lp {
impq opt_val = term_max;
bool change = false;
for (unsigned j = 0; j < get_core_solver().r_x().size(); j++) {
for (unsigned j = 0; j < get_core_solver().r_x().size(); ++j) {
if (!column_is_int(j))
continue;
if (column_value_is_integer(j))
@ -1144,7 +1144,7 @@ namespace lp {
}
#ifdef Z3DEBUG
bool lar_solver::fixed_base_removed_correctly() const {
for (unsigned i = 0; i < A_r().row_count(); i++) {
for (unsigned i = 0; i < A_r().row_count(); ++i) {
unsigned j = get_base_column_in_row(i);
if (column_is_fixed(j)) {
for (const auto & c : A_r().m_rows[i] ) {
@ -1181,7 +1181,7 @@ namespace lp {
bool lar_solver::ax_is_correct() const {
for (unsigned i = 0; i < A_r().row_count(); i++) {
for (unsigned i = 0; i < A_r().row_count(); ++i) {
if (!row_is_correct(i)) {
return false;
}
@ -1500,7 +1500,7 @@ namespace lp {
unsigned n = get_core_solver().r_x().size();
for (unsigned j = 0; j < n; j++)
for (unsigned j = 0; j < n; ++j)
variable_values[j] = get_value(j);
TRACE(lar_solver_model, tout << "delta = " << m_imp->m_delta << "\nmodel:\n";
@ -1529,7 +1529,7 @@ namespace lp {
do {
m_imp->m_set_of_different_pairs.clear();
m_imp->m_set_of_different_singles.clear();
for (j = 0; j < n; j++) {
for (j = 0; j < n; ++j) {
const numeric_pair<mpq>& rp = get_core_solver().r_x(j);
mpq x = rp.x + m_imp->m_delta * rp.y;
m_imp->m_set_of_different_pairs.insert(rp);
@ -1546,7 +1546,7 @@ namespace lp {
void lar_solver::get_model_do_not_care_about_diff_vars(std::unordered_map<lpvar, mpq>& variable_values) const {
mpq delta = get_core_solver().find_delta_for_strict_bounds(m_imp->m_settings.m_epsilon);
for (unsigned i = 0; i < get_core_solver().r_x().size(); i++) {
for (unsigned i = 0; i < get_core_solver().r_x().size(); ++i) {
const impq& rp = get_core_solver().r_x(i);
variable_values[i] = rp.x + delta * rp.y;
}
@ -1561,7 +1561,7 @@ namespace lp {
void lar_solver::get_rid_of_inf_eps() {
bool y_is_zero = true;
for (unsigned j = 0; j < number_of_vars(); j++) {
for (unsigned j = 0; j < number_of_vars(); ++j) {
if (!get_core_solver().r_x(j).y.is_zero()) {
y_is_zero = false;
break;
@ -1570,7 +1570,7 @@ namespace lp {
if (y_is_zero)
return;
mpq delta = get_core_solver().find_delta_for_strict_bounds(m_imp->m_settings.m_epsilon);
for (unsigned j = 0; j < number_of_vars(); j++) {
for (unsigned j = 0; j < number_of_vars(); ++j) {
auto& v = get_core_solver().r_x(j);
if (!v.y.is_zero()) {
v = impq(v.x + delta * v.y);
@ -1608,7 +1608,7 @@ namespace lp {
out << constraints();
print_terms(out);
pp(out).print();
for (unsigned j = 0; j < number_of_vars(); j++)
for (unsigned j = 0; j < number_of_vars(); ++j)
print_column_info(j, out);
return out;
}
@ -1666,7 +1666,7 @@ namespace lp {
void lar_solver::fill_var_set_for_random_update(unsigned sz, lpvar const* vars, vector<unsigned>& column_list) {
TRACE(lar_solver_rand, tout << "sz = " << sz << "\n";);
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
lpvar var = vars[i];
if (column_has_term(var)) {
if (m_imp->m_columns[var].associated_with_row()) {
@ -1848,7 +1848,7 @@ namespace lp {
bool lar_solver::model_is_int_feasible() const {
unsigned n = A_r().column_count();
for (unsigned j = 0; j < n; j++) {
for (unsigned j = 0; j < n; ++j) {
if (column_is_int(j) && !column_value_is_integer(j))
return false;
}
@ -2571,7 +2571,7 @@ namespace lp {
void lar_solver::round_to_integer_solution() {
for (unsigned j = 0; j < column_count(); j++) {
for (unsigned j = 0; j < column_count(); ++j) {
if (!column_is_int(j)) continue;
if (column_has_term(j)) continue;
impq & v = get_core_solver().r_x(j);