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

Merge branch 'master' of https://github.com/Z3Prover/z3 into csp

This commit is contained in:
Nikolaj Bjorner 2018-10-21 12:26:53 -07:00
commit ccca063e54
254 changed files with 1194 additions and 1753 deletions

View file

@ -126,7 +126,7 @@ unsigned ntz(unsigned sz, unsigned const * data) {
/**
\brief dst <- src
Trucate if src_sz > dst_sz.
Truncate if src_sz > dst_sz.
Fill range [src_sz, dst_sz) of dst with zeros if dst_sz > src_sz.
*/
void copy(unsigned src_sz, unsigned const * src,

View file

@ -48,7 +48,7 @@ unsigned ntz(unsigned sz, unsigned const * data);
/**
\brief dst <- src
Trucate if src_sz > dst_sz.
Truncate if src_sz > dst_sz.
Fill range [src_sz, dst_sz) of dst with zeros if dst_sz > src_sz.
*/
void copy(unsigned src_sz, unsigned const * src, unsigned dst_sz, unsigned * dst);
@ -87,7 +87,7 @@ void shr(unsigned sz, unsigned const * src, unsigned k, unsigned * dst);
\brief dst <- src >> k
Store in dst the result of shifting src k bits to the right.
Trucate if src_sz > dst_sz.
Truncate if src_sz > dst_sz.
Fill range [src_sz, dst_sz) of dst with zeros if dst_sz > src_sz.
\pre src_sz != 0

View file

@ -68,7 +68,7 @@ unsigned length(list<T> * l) {
}
/**
\brief Non destructive apppend operation. The new nodes are allocated
\brief Non destructive append operation. The new nodes are allocated
using the given region allocator.
*/
template<typename T>

View file

@ -76,7 +76,7 @@ template <typename T> void binary_heap_priority_queue<T>::remove(unsigned o) {
put_at(o_in_heap, m_heap[m_heap_size--]);
if (m_priorities[m_heap[o_in_heap]] > priority_of_o) {
fix_heap_under(o_in_heap);
} else { // we need to propogate the m_heap[o_in_heap] up
} else { // we need to propagate the m_heap[o_in_heap] up
unsigned i = o_in_heap;
while (i > 1) {
unsigned ip = i >> 1;

View file

@ -270,7 +270,7 @@ public :
}
}
// // it is the coefficent before the bounded column
// // it is the coefficient before the bounded column
// void provide_evidence(bool coeff_is_pos) {
// /*
// auto & be = m_ibounds.back();

View file

@ -74,7 +74,7 @@ lp_core_solver_base(static_matrix<T, X> & A,
}
template <typename T, typename X> void lp_core_solver_base<T, X>::
allocate_basis_heading() { // the rest of initilization will be handled by the factorization class
allocate_basis_heading() { // the rest of initialization will be handled by the factorization class
init_basis_heading_and_non_basic_columns_vector();
lp_assert(basis_heading_is_correct());
}

View file

@ -276,7 +276,7 @@ template <typename T, typename X> bool lp_dual_core_solver<T, X>::can_be_breakpo
bool grawing = m_sign_of_alpha_r * this->m_pivot_row[j] > 0;
return lower_bound == grawing;
}
case column_type::fixed: // is always dual feasible so we ingore it
case column_type::fixed: // is always dual feasible so we ignore it
return false;
case column_type::free_column:
return true;

View file

@ -284,7 +284,7 @@ template <typename T, typename X> int lp_primal_core_solver<T, X>::advance_on_so
break;
} else {
if ((numeric_traits<T>::precise() == false) || ( numeric_traits<T>::is_zero(slope_at_entering) && this->m_settings.random_next() % 2 == 0)) {
// it is not cost benefitial to advance the delta more, so just break to increas the randomness
// it is not cost beneficial to advance the delta more, so just break to increase the randomness
break;
}
}
@ -612,7 +612,7 @@ template <typename T, typename X> int lp_primal_core_solver<T, X>::refresh_re
return 2; // abort entering
} else {
if (refreshed_cost > -m_epsilon_of_reduced_cost)
return 2; // abort entiring
return 2; // abort entering
}
return 1; // go on with this entering
} else {
@ -621,7 +621,7 @@ template <typename T, typename X> int lp_primal_core_solver<T, X>::refresh_re
return 2; // abort entering
} else {
if (refreshed_cost > -m_epsilon_of_reduced_cost)
return 2; // abort entiring
return 2; // abort entering
}
}
return 0;

View file

@ -68,7 +68,7 @@ enum class lp_status {
CANCELLED
};
// when the ratio of the vector lenth to domain size to is greater than the return value we switch to solve_By_for_T_indexed_only
// when the ratio of the vector length to domain size to is greater than the return value we switch to solve_By_for_T_indexed_only
template <typename X>
unsigned ratio_of_index_size_to_all_size() {
if (numeric_traits<X>::precise())
@ -145,7 +145,7 @@ public:
double pivot_epsilon;
// see Chatal, page 115
double positive_price_epsilon;
// a quatation "if some choice of the entering vairable leads to an eta matrix
// a quotation "if some choice of the entering variable leads to an eta matrix
// whose diagonal element in the eta column is less than e2 (entering_diag_epsilon) in magnitude, the this choice is rejected ...
double entering_diag_epsilon;
int c_partial_pivoting; // this is the constant c from page 410

View file

@ -126,7 +126,7 @@ template <typename T, typename X> void scaler<T, X>::scale_once_for_ratio() {
T max_ratio_on_rows = get_max_ratio_on_rows();
T max_ratio_on_columns = get_max_ratio_on_columns();
bool scale_rows_first = max_ratio_on_rows > max_ratio_on_columns;
// if max_ratio_on_columns is the largerst then the rows are in worser shape then columns
// if max_ratio_on_columns is the largest then the rows are in worse shape than columns
if (scale_rows_first) {
scale_rows_with_geometric_mean();
scale_columns_with_geometric_mean();

View file

@ -186,7 +186,7 @@ void square_sparse_matrix<T, X>::init_row_headers() {
}
template <typename T, typename X>
void square_sparse_matrix<T, X>::init_column_headers() { // we alway have only square square_sparse_matrix
void square_sparse_matrix<T, X>::init_column_headers() { // we always have only square square_sparse_matrix
for (unsigned l = 0; l < m_row_permutation.size(); l++) {
m_columns.push_back(col_header());
}

View file

@ -93,7 +93,7 @@ public:
unsigned m_row;
public:
ref_row(const static_matrix & m, unsigned row): m_matrix(m), m_row(row) {}
const T operator[](unsigned col) const { return m_matrix.get_elem(m_row, col); }
T operator[](unsigned col) const { return m_matrix.get_elem(m_row, col); }
};
public:

View file

@ -952,7 +952,7 @@ void my_mpz_sqrt(unsynch_mpz_manager & m, unsigned sbits, bool odd_exp, mpz & in
scoped_mpz lower(m), upper(m);
scoped_mpz mid(m), product(m), diff(m);
// we have lower <= a.significand <= upper and we need 1.[52+3 bits] in the bounds.
// since we comapre upper*upper to a.significand further down, we need a.significand
// since we compare upper*upper to a.significand further down, we need a.significand
// to be of twice the size.
m.set(lower, 1);
m.mul2k(lower, sbits+2-1);
@ -978,7 +978,7 @@ void my_mpz_sqrt(unsynch_mpz_manager & m, unsigned sbits, bool odd_exp, mpz & in
}
else {
STRACE("mpf_dbg", tout << "choosing upper" << std::endl;);
m.set(o, upper); // chosing upper is like a sticky bit here.
m.set(o, upper); // choosing upper is like a sticky bit here.
}
break;
}

View file

@ -7,7 +7,7 @@ Module Name:
Abstract:
corresponding obj_map with reference count managment.
corresponding obj_map with reference count management.
Author:

View file

@ -20,7 +20,7 @@ Revision History:
#ifndef STOPWATCH_H_
#define STOPWATCH_H_
#if defined(_WINDOWS) || defined(_CYGWIN)
#if defined(_WINDOWS) || defined(_CYGWIN) || defined(_MINGW)
// Does this redefinition work?

View file

@ -16,8 +16,8 @@ Author:
Revision History:
--*/
#include<stdio.h>
#include<stdarg.h>
#include <stdio.h>
#include <stdarg.h>
#include "util/error_codes.h"
#include "util/util.h"
@ -25,7 +25,6 @@ Revision History:
#include "util/vector.h"
#ifdef _WINDOWS
#define PRF sprintf_s
#define VPRF vsprintf_s
void STD_CALL myInvalidParameterHandler(
@ -54,7 +53,6 @@ void STD_CALL myInvalidParameterHandler(
#else
#define PRF snprintf
#define VPRF vsnprintf
#define BEGIN_ERR_HANDLER() {}
#define END_ERR_HANDLER() {}
@ -64,7 +62,6 @@ static bool g_warning_msgs = true;
static bool g_use_std_stdout = false;
static std::ostream* g_error_stream = nullptr;
static std::ostream* g_warning_stream = nullptr;
static bool g_show_error_msg_prefix = true;
void send_warnings_to_stdout(bool flag) {
g_use_std_stdout = flag;
@ -82,61 +79,24 @@ void set_warning_stream(std::ostream* strm) {
g_warning_stream = strm;
}
void disable_error_msg_prefix() {
g_show_error_msg_prefix = false;
}
#if 0
// [Leo]: Do we need this?
static void string2ostream(std::ostream& out, char const* msg) {
svector<char> buff;
buff.resize(10);
BEGIN_ERR_HANDLER();
while (true) {
int nc = PRF(buff.c_ptr(), buff.size(), msg);
if (nc >= 0 && nc < static_cast<int>(buff.size()))
break; // success
buff.resize(buff.size()*2 + 1);
}
END_ERR_HANDLER();
out << buff.c_ptr();
}
#endif
void format2ostream(std::ostream & out, char const* msg, va_list args) {
svector<char> buff;
#if !defined(_WINDOWS) && defined(_AMD64_)
// see comment below.
buff.resize(1024);
#else
buff.resize(128);
#endif
BEGIN_ERR_HANDLER();
while (true) {
int nc = VPRF(buff.c_ptr(), buff.size(), msg, args);
#if !defined(_WINDOWS) && defined(_AMD64_)
// For some strange reason, on Linux 64-bit version, va_list args is reset by vsnprintf.
// Z3 crashes when trying to use va_list args again.
// Hack: I truncate the message instead of expanding the buffer to make sure that
// va_list args is only used once.
END_ERR_HANDLER();
if (nc < 0) {
// vsnprintf didn't work, so we just print the msg
out << msg;
return;
}
if (nc >= static_cast<int>(buff.size())) {
// truncate the message
buff[buff.size() - 1] = 0;
}
out << buff.c_ptr();
return;
va_list args_copy;
va_copy(args_copy, args);
#ifdef _WINDOWS
size_t msg_len = _vscprintf(msg, args_copy);
#else
if (nc >= 0 && nc < static_cast<int>(buff.size()))
break; // success
buff.resize(buff.size()*2 + 1);
size_t msg_len = vsnprintf(NULL, 0, msg, args_copy);
#endif
}
va_end(args_copy);
// +1 is for NUL termination.
buff.resize(msg_len + 1);
VPRF(buff.c_ptr(), buff.size(), msg, args);
END_ERR_HANDLER();
out << buff.c_ptr();
}

View file

@ -31,30 +31,7 @@ void set_warning_stream(std::ostream* strm);
void warning_msg(const char * msg, ...);
void disable_error_msg_prefix();
void format2ostream(std::ostream& out, char const* fmt, va_list args);
class warning_displayer {
const char * m_msg;
bool m_displayed;
public:
warning_displayer(const char * msg):
m_msg(msg),
m_displayed(false) {
}
void sign() {
if (!m_displayed) {
warning_msg(m_msg);
m_displayed = true;
}
}
void reset() {
m_displayed = false;
}
};
#endif /* WARNING_H_ */