Skip to content

Conversation

@maxguy2001
Copy link
Owner

No description provided.

@maxguy2001 maxguy2001 marked this pull request as draft November 1, 2022 23:56
} else {
num_variables_string = temp_string;
}
const int num_variables = static_cast<int>(atoi(num_variables_string.c_str()));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

atoi returns int anyways, no need to typecast

const core::int_t num_inequality_rows = static_cast<core::int_t>(atoi(num_inequality_rows_string.c_str()));
// Get number of inequalities.
std::getline(problems_filestream, num_inequality_rows_string);
const int num_inequality_rows = static_cast<int>(atoi(num_inequality_rows_string.c_str()));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typecasting

std::vector<core::int_t> matrix_row;
// Define vectors to read in constraints.
std::vector<int> problem_row; // A line in the input file
int constant_term;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this do? naming isn't clear? Also a bit misleading since constant implies unchanging but this variable is reassigned a few times?

matrix_row.clear();

problem_matrix_.push_back(problem_matrix_row);
upper_bounds_.push_back(kMaxInt);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switching to core::kIntInfinity. Works better algebraically and theoretically


core::int_t num_equality_rows = static_cast<core::int_t>(atoi(num_equality_rows_string.c_str()));
std::getline(problems_filestream, num_equality_rows_string);
int num_equality_rows = static_cast<int>(atoi(num_equality_rows_string.c_str()));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typecasting

std::vector<std::vector<int>> problem_matrix_;

const core::int_t kMinInt = -32765;
const int kMaxInt = 32765;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove these

std::vector<core::int_t> convertStringToVector(const std::string vector_string);
std::vector<int> convertStringToVector(const std::string vector_string);

std::vector<int> getProblemRowAsIntVector(const std::string problem_row_string);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

documentation/docstrings?

std::vector<core::int_t> min = reader_.lower_bounds_;
for (int i = 0; i < problem_matrix.size(); ++i) {
std::string upper_bound = std::to_string(upper_bounds[i]);
if (upper_bound == "32765") {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be changed once upper bounds are of type core::kIntInfinity

for (int row_num = 0; row_num < num_rows; ++row_num) {
// Getting row, constant term and bounds for the row.
std::vector<int> row = problem_matrix[row_num];
int constant_term = row[0];
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this never seems to be used?

int lower_bound = lower_bounds[row_num];
int upper_bound;

if (upper_bounds[row_num] == 32765) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to core::kIntInfinity

cmake_minimum_required(VERSION 3.12.0)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 11)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They just released the preview for C++ 23 at the end of last year. C++ 14 is already quite old, why do we need to change it to C++11?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants