chore(lp): remove warnings

Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
This commit is contained in:
Lev Nachmanson 2016-01-26 14:40:29 -08:00 committed by Leonardo de Moura
parent 739f9e5486
commit fbe4f56aea
8 changed files with 19 additions and 15 deletions

View file

@ -2076,7 +2076,11 @@ void process_test_file(string test_dir, string test_file_name, argument_parser &
}
}
}
int my_readdir(DIR *dirp, struct dirent *entry, struct dirent **result) {
int my_readdir(DIR *dirp, struct dirent *
#ifndef LEAN_WINDOWS
entry
#endif
, struct dirent **result) {
#ifdef LEAN_WINDOWS
*result = readdir(dirp);
return *result != nullptr? 0 : 1;

View file

@ -239,7 +239,7 @@ class mps_reader {
void read_column(string column_name, string column_data){
auto tokens = split_and_trim(column_data);
for (int i = 0; i < tokens.size() - 1; i+= 2) {
for (unsigned i = 0; i < tokens.size() - 1; i+= 2) {
auto row_name = tokens[i];
if (row_name == "'MARKER'") return; // it is the integrality marker, no real data here
auto t = m_rows.find(row_name);

View file

@ -57,7 +57,7 @@ template <typename T> void binary_heap_priority_queue<T>::remove(unsigned o) {
return; // nothing to do
}
lean_assert(o_in_heap <= m_heap_size);
if (o_in_heap < m_heap_size) {
if (static_cast<unsigned>(o_in_heap) < m_heap_size) {
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);
@ -143,11 +143,11 @@ template <typename T> unsigned binary_heap_priority_queue<T>::dequeue_and_get_pr
template <typename T> void binary_heap_priority_queue<T>::fix_heap_under(unsigned i) {
while (true) {
int smallest = i;
int l = i << 1;
unsigned smallest = i;
unsigned l = i << 1;
if (l <= m_heap_size && m_priorities[m_heap[l]] < m_priorities[m_heap[i]])
smallest = l;
int r = l + 1;
unsigned r = l + 1;
if (r <= m_heap_size && m_priorities[m_heap[r]] < m_priorities[m_heap[smallest]])
smallest = r;
if (smallest != i)

View file

@ -474,18 +474,18 @@ non_basis_has_no_doubles() {
template <typename T, typename X> bool lp_core_solver_base<T, X>::
basis_is_correctly_represented_in_heading() {
for (unsigned i = 0; i < m_m; i++) {
if (m_basis_heading[m_basis[i]] != i)
if (m_basis_heading[m_basis[i]] != static_cast<int>(i))
return false;
}
return true;
}
template <typename T, typename X> bool lp_core_solver_base<T, X>::
non_basis_is_correctly_represented_in_heading() {
for (int i = 0; i < m_non_basic_columns.size(); i++) {
if (m_basis_heading[m_non_basic_columns[i]] != - i - 1)
for (unsigned i = 0; i < m_non_basic_columns.size(); i++) {
if (m_basis_heading[m_non_basic_columns[i]] != - static_cast<int>(i) - 1)
return false;
}
for (int j = 0; j < m_A.column_count(); j++) {
for (unsigned j = 0; j < m_A.column_count(); j++) {
if (m_basis_heading[j] >= 0) {
lean_assert(m_basis_heading[j] < m_A.row_count() && m_basis[m_basis_heading[j]] == j);
}

View file

@ -379,7 +379,7 @@ template <typename T, typename X> void lp_dual_core_solver<T, X>::update_betas()
T k = -2 * one_over_arq;
unsigned i = this->m_m;
while (i--) {
if (i == m_r) continue;
if (static_cast<int>(i) == m_r) continue;
T a = this->m_ed[i];
m_betas[i] += a * (a * beta_r + k * this->m_pivot_row_of_B_1[i]);
if (m_betas[i] < T(0.0001))

View file

@ -315,7 +315,7 @@ template <typename T, typename X> void lp_dual_simplex<T, X>::augment_matrix_A_a
template <typename T, typename X> void lp_dual_simplex<T, X>::copy_m_b_aside_and_set_it_to_zeros() {
for (int i = 0; i < this->m_b.size(); i++) {
for (unsigned i = 0; i < this->m_b.size(); i++) {
m_b_copy.push_back(this->m_b[i]);
this->m_b[i] = numeric_traits<T>::zero(); // preparing for the first stage
}

View file

@ -233,7 +233,7 @@ template <typename T, typename X> void lp_primal_simplex<T, X>::solve_with_total
fill_A_x_and_basis_for_stage_one_total_inf();
this->print_statistics_on_A();
this->fill_column_names_for_core_solver();
int j = this->m_A->column_count() - 1;
unsigned j = this->m_A->column_count() - 1;
unsigned core_solver_cols = this->number_of_core_structurals();
while (j >= core_solver_cols)

View file

@ -424,7 +424,7 @@ template <typename T, typename X>
void lu<T, X>::process_column(int j) {
unsigned pi, pj;
m_U.get_pivot_for_column(pi, pj, T(m_settings.c_partial_pivoting), j);
if (pi == -1) {
if (static_cast<int>(pi) == -1) {
std::cout << "cannot find the pivot for column " << j << std::endl;
m_failure = true;
return;
@ -523,7 +523,7 @@ void lu<T, X>::pivot_in_dense_mode(unsigned i) {
m_failure = true;
return;
}
if (i != j) {
if (i != static_cast<unsigned>(j)) {
swap_columns(i, j);
m_dense_LU->swap_columns(i, j);
}