mirror of
https://github.com/Z3Prover/z3
synced 2026-01-23 18:44:02 +00:00
* Introduce X-macro-based trace tag definition - Created trace_tags.def to centralize TRACE tag definitions - Each tag includes a symbolic name and description - Set up enum class TraceTag for type-safe usage in TRACE macros * Add script to generate Markdown documentation from trace_tags.def - Python script parses trace_tags.def and outputs trace_tags.md * Refactor TRACE_NEW to prepend TraceTag and pass enum to is_trace_enabled * trace: improve trace tag handling system with hierarchical tagging - Introduce hierarchical tag-class structure: enabling a tag class activates all child tags - Unify TRACE, STRACE, SCTRACE, and CTRACE under enum TraceTag - Implement initial version of trace_tag.def using X(tag, tag_class, description) (class names and descriptions to be refined in a future update) * trace: replace all string-based TRACE tags with enum TraceTag - Migrated all TRACE, STRACE, SCTRACE, and CTRACE macros to use enum TraceTag values instead of raw string literals * trace : add cstring header * trace : Add Markdown documentation generation from trace_tags.def via mk_api_doc.py * trace : rename macro parameter 'class' to 'tag_class' and remove Unicode comment in trace_tags.h. * trace : Add TODO comment for future implementation of tag_class activation * trace : Disable code related to tag_class until implementation is ready (#7663).
84 lines
2.1 KiB
C++
84 lines
2.1 KiB
C++
/*++
|
|
Copyright (c) 2017 Microsoft Corporation
|
|
|
|
Module Name:
|
|
|
|
<name>
|
|
|
|
Abstract:
|
|
|
|
<abstract>
|
|
|
|
Author:
|
|
|
|
Lev Nachmanson (levnach)
|
|
|
|
Revision History:
|
|
|
|
|
|
--*/
|
|
#pragma once
|
|
|
|
#include "math/lp/random_updater.h"
|
|
#include "math/lp/static_matrix.h"
|
|
#include "math/lp/lar_solver.h"
|
|
#include "util/vector.h"
|
|
namespace lp {
|
|
|
|
|
|
|
|
random_updater::random_updater(
|
|
lar_solver & lar_solver,
|
|
const vector<unsigned> & column_indices) :
|
|
m_lar_solver(lar_solver),
|
|
m_range(100000) {
|
|
for (unsigned j : column_indices)
|
|
m_var_set.insert(j);
|
|
TRACE(lar_solver_rand, tout << "size = " << m_var_set.size() << "\n";);
|
|
}
|
|
|
|
|
|
bool random_updater::shift_var(unsigned j) {
|
|
SASSERT(!m_lar_solver.column_is_fixed(j) && !m_lar_solver.is_base(j));
|
|
bool ret = m_lar_solver.get_int_solver()->shift_var(j, m_range);
|
|
if (ret) {
|
|
const auto & A = m_lar_solver.A_r();
|
|
for (const auto& c : A.m_columns[j]) {
|
|
unsigned k = m_lar_solver.r_basis()[c.var()];
|
|
if (m_var_set.contains(k))
|
|
m_var_set.remove(k);
|
|
}
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
|
|
void random_updater::update() {
|
|
// VERIFY(m_lar_solver.check_feasible());
|
|
unsigned_vector columns;
|
|
// m_var_set is going to change during the loop, make a copy
|
|
for (unsigned j : m_var_set) {
|
|
columns.push_back(j);
|
|
}
|
|
for (auto j : columns) {
|
|
if (!m_var_set.contains(j)) {
|
|
TRACE(lar_solver_rand, tout << "skipped " << j << "\n";);
|
|
continue;
|
|
}
|
|
if (!m_lar_solver.is_base(j))
|
|
shift_var(j);
|
|
else {
|
|
unsigned row_index = m_lar_solver.r_heading()[j];
|
|
for (auto & row_c : m_lar_solver.get_row(row_index)) {
|
|
unsigned cj = row_c.var();
|
|
if (!m_lar_solver.is_base(cj) &&
|
|
!m_lar_solver.column_is_fixed(cj) &&
|
|
shift_var(cj))
|
|
break; // done with the basic var j
|
|
}
|
|
}
|
|
}
|
|
TRACE(lar_solver_rand, tout << "m_var_set.size() = " << m_var_set.size() << "\n";);
|
|
}
|
|
|
|
}
|