Skip to content

Commit

Permalink
Merge pull request #66 from cvanaret/no_option_file
Browse files Browse the repository at this point in the history
Removed now useless option file
  • Loading branch information
cvanaret authored Nov 4, 2024
2 parents 60c18fc + 5ddc990 commit 6c5d4ce
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 254 deletions.
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,6 @@ set_property(TARGET uno PROPERTY POSITION_INDEPENDENT_CODE ON)
target_include_directories(uno PUBLIC ${DIRECTORIES})
target_link_libraries(uno PUBLIC ${LIBRARIES})

# copy the option file
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/uno.options DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

######################
# optional AMPL main #
######################
Expand Down
243 changes: 0 additions & 243 deletions uno.options

This file was deleted.

2 changes: 1 addition & 1 deletion uno/options/DefaultOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace uno {
options["enforce_linear_constraints"] = "no";

/** statistics table **/
options["statistics_print_header_every_iterations"] = "15";
options["statistics_print_header_frequency"] = "15";
options["statistics_major_column_order"] = "1";
options["statistics_minor_column_order"] = "2";
options["statistics_penalty_parameter_column_order"] = "5";
Expand Down
9 changes: 4 additions & 5 deletions uno/tools/Statistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ namespace uno {
int Statistics::string_width = 26;
int Statistics::numerical_format_size = 6;

Statistics::Statistics(const Options& options): print_header_every_iterations(options.get_unsigned_int("statistics_print_header_every_iterations")) {
}
Statistics::Statistics(const Options& options): print_header_frequency(options.get_unsigned_int("statistics_print_header_frequency")) { }

void Statistics::add_column(std::string_view name, int width, int order) {
this->columns[order] = name;
Expand Down Expand Up @@ -66,7 +65,7 @@ namespace uno {

void Statistics::print_header() {
/* line above */
this->print_horizontal_line(this->iteration == 0);
this->print_horizontal_line(this->line_number == 0);
/* headers */
std::cout << Statistics::symbol("left");
size_t k = 0;
Expand All @@ -87,7 +86,7 @@ namespace uno {
}

void Statistics::print_current_line() {
if (this->iteration % this->print_header_every_iterations == 0) {
if (this->line_number % this->print_header_frequency == 0) {
this->print_header();
}
std::cout << Statistics::symbol("left");
Expand All @@ -114,7 +113,7 @@ namespace uno {
k++;
}
std::cout << Statistics::symbol("right") << '\n';
this->iteration++;
this->line_number++;
}

void Statistics::print_footer() {
Expand Down
4 changes: 2 additions & 2 deletions uno/tools/Statistics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ namespace uno {


private:
size_t iteration{0};
size_t line_number{0};
std::map<int, std::string> columns{};
std::map<std::string_view, int> widths{};
std::map<std::string_view, std::string> current_line{};

size_t print_header_every_iterations{};
const size_t print_header_frequency{};
static std::string_view symbol(std::string_view value);
};
} // namespace
Expand Down

0 comments on commit 6c5d4ce

Please sign in to comment.