From 4bc3501f3497f25541557900ccd8232b29036122 Mon Sep 17 00:00:00 2001 From: Charlie Vanaret Date: Mon, 4 Nov 2024 12:09:05 +0100 Subject: [PATCH 1/2] Minor change in Statistics [skip ci] --- uno/options/DefaultOptions.cpp | 2 +- uno/tools/Statistics.cpp | 9 ++++----- uno/tools/Statistics.hpp | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/uno/options/DefaultOptions.cpp b/uno/options/DefaultOptions.cpp index bb1e47c9..aab8e779 100644 --- a/uno/options/DefaultOptions.cpp +++ b/uno/options/DefaultOptions.cpp @@ -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"; diff --git a/uno/tools/Statistics.cpp b/uno/tools/Statistics.cpp index 8e7e12b6..b3ab26aa 100644 --- a/uno/tools/Statistics.cpp +++ b/uno/tools/Statistics.cpp @@ -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; @@ -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; @@ -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"); @@ -114,7 +113,7 @@ namespace uno { k++; } std::cout << Statistics::symbol("right") << '\n'; - this->iteration++; + this->line_number++; } void Statistics::print_footer() { diff --git a/uno/tools/Statistics.hpp b/uno/tools/Statistics.hpp index bc71bc41..ca38f995 100644 --- a/uno/tools/Statistics.hpp +++ b/uno/tools/Statistics.hpp @@ -34,12 +34,12 @@ namespace uno { private: - size_t iteration{0}; + size_t line_number{0}; std::map columns{}; std::map widths{}; std::map current_line{}; - size_t print_header_every_iterations{}; + const size_t print_header_frequency{}; static std::string_view symbol(std::string_view value); }; } // namespace From 5ddc9907f9eca5c25feb27c596309828774de11a Mon Sep 17 00:00:00 2001 From: Charlie Vanaret Date: Mon, 4 Nov 2024 12:09:53 +0100 Subject: [PATCH 2/2] Deleted now useless option file + corresponding command line in CMakeLists --- CMakeLists.txt | 3 - uno.options | 243 ------------------------------------------------- 2 files changed, 246 deletions(-) delete mode 100644 uno.options diff --git a/CMakeLists.txt b/CMakeLists.txt index 817fda4d..8b1cf83b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 # ###################### diff --git a/uno.options b/uno.options deleted file mode 100644 index 64c0a1fa..00000000 --- a/uno.options +++ /dev/null @@ -1,243 +0,0 @@ -##### termination ##### -# (tight) tolerance -tolerance 1e-8 - -# loose tolerance used if tight tolerance cannot be reached -loose_tolerance 1e-6 - -# number of iterations during which the loose tolerance is monitored -loose_tolerance_consecutive_iteration_threshold 15 - -# maximum outer iterations -max_iterations 2000 - -# CPU time limit (in seconds) -time_limit inf - -# print optimal solution (yes|no) -print_solution no - -# threshold on objective to declare unbounded NLP -unbounded_objective_threshold -1e20 - -# enforce linear constraints at the initial point (yes|no) -enforce_linear_constraints no - -# statistics table -statistics_print_header_every_iterations 15 - -statistics_major_column_order 1 -statistics_minor_column_order 2 -statistics_penalty_parameter_column_order 5 -statistics_barrier_parameter_column_order 8 -statistics_SOC_column_order 9 -statistics_TR_radius_column_order 10 -statistics_LS_step_length_column_order 10 -statistics_restoration_phase_column_order 20 -statistics_regularization_column_order 21 -statistics_funnel_width_column_order 25 -statistics_step_norm_column_order 31 -statistics_objective_column_order 100 -statistics_primal_feasibility_column_order 101 -statistics_dual_feasibility_column_order 102 -statistics_stationarity_column_order 104 -statistics_complementarity_column_order 105 -statistics_status_column_order 200 - -##### ingredients ##### -# default constraint relaxation strategy (feasibility_restoration|l1_relaxation) -constraint_relaxation_strategy feasibility_restoration - -# default subproblem (QP|LP|primal_dual_interior_point) -subproblem QP - -# default globalization strategy (l1_merit|fletcher_filter_method|waechter_filter_method) -globalization_strategy fletcher_filter_method - -# default globalization mechanism (TR|LS) -globalization_mechanism TR - -##### main options ##### -# logging level (SILENT|DISCRETE|WARNING|INFO|DEBUG|DEBUG2|DEBUG3) -logger INFO - -# Hessian model (exact|BFGS) -hessian_model exact - -# sparse matrix format (COO|CSC) -sparse_format COO - -# scale the functions (yes|no) -scale_functions no - -function_scaling_threshold 100 - -# factor scaling -function_scaling_factor 100 - -# scale the errors with respect to the current point (yes|no) -scale_residuals yes - -# enforce the linear constraints at the initial point (yes|no) -enforce_linear_constraints no - -# norm of the progress measures (L1|L2|INF) -progress_norm L1 - -# norm of the primal-dual residuals (L1|L2|INF) -residual_norm INF - -residual_scaling_threshold 100. - -protect_actual_reduction_against_roundoff no - -##### solvers ##### -# default QP solver (BQPD) -QP_solver BQPD - -# default LP solver (BQPD) -LP_solver BQPD - -# default linear solver (MA57|MUMPS) -linear_solver MA57 - -##### strategy options ##### -armijo_decrease_fraction 1e-4 -armijo_tolerance 1e-9 - -##### switching method options ##### -switching_delta 0.999 -switching_infeasibility_exponent 2 - -##### filter method options ##### -# filter type (standard|nonmonotone) -filter_type standard - -filter_beta 0.999 -filter_gamma 0.001 -filter_ubd 1e2 -filter_fact 1.25 - -filter_capacity 50 - -# used by Waechter filter method -filter_sufficient_infeasibility_decrease_factor 0.9 - -# nonmonotone filter strategy -nonmonotone_filter_number_dominated_entries 3 - -##### funnel options ##### -# funnel options -funnel_kappa 0.5 -funnel_beta 0.9999 -funnel_gamma 0.001 -funnel_ubd 1.0 -funnel_fact 1.5 -funnel_update_strategy 1 - -funnel_require_acceptance_wrt_current_iterate no - -##### line search options ##### -# backtracking ratio -LS_backtracking_ratio 0.5 - -# minimum step length -LS_min_step_length 1e-12 - -# regularization failure threshold -regularization_failure_threshold 1e40 - -# Hessian regularization: initial value -regularization_initial_value 1e-4 - -regularization_increase_factor 2 - -# regularization of augmented system -primal_regularization_initial_factor 1e-4 -dual_regularization_fraction 1e-8 - -primal_regularization_lb 1e-20 -primal_regularization_decrease_factor 3. -primal_regularization_fast_increase_factor 100. -primal_regularization_slow_increase_factor 8. -threshold_unsuccessful_attempts 8 - -# use the primal-dual and dual step lengths to scale the dual directions when assembling the trial iterate -LS_scale_duals_with_step_length yes - -##### trust region options ##### -# initial trust region radius -TR_radius 10. - -# TR radius increase factor -TR_increase_factor 2 - -# TR radius decrease factor -TR_decrease_factor 2 - -# TR aggressive radius decrease factor -TR_aggressive_decrease_factor 4 - -# tolerance in TR constraint activity -TR_activity_tolerance 1e-6 - -# minimum TR radius -TR_min_radius 1e-7 - -# threshold below which the TR radius is reset -TR_radius_reset_threshold 1e-4 - -# force QP convexification when in a trust-region setting -convexify_QP false - -##### constraint relaxation options ##### -##### l1 relaxation options ##### -# initial value of the penalty parameter -l1_relaxation_initial_parameter 1. - -# use a fixed parameter (yes|no) -l1_relaxation_fixed_parameter no - -# decrease (multiplicative) factor of penalty parameter -l1_relaxation_decrease_factor 10. - -# epsilon constants in Byrd's article -l1_relaxation_epsilon1 0.1 -l1_relaxation_epsilon2 0.1 - -l1_relaxation_residual_small_threshold 1e-12 - -# coefficient of constraint violation -l1_constraint_violation_coefficient 1 - -# threshold for determining if duals have a zero norm -l1_small_duals_threshold 1e-10 - -##### feasibility restoration options ##### -# test linearized feasibility when switching back to the optimality phase -switch_to_optimality_requires_linearized_feasibility yes - -##### barrier subproblem options ##### -barrier_initial_parameter 0.1 -barrier_default_multiplier 1 -# Ipopt parameters -barrier_tau_min 0.99 -barrier_k_sigma 1e10 -barrier_smax 100 -barrier_k_mu 0.2 -barrier_theta_mu 1.5 -barrier_k_epsilon 10 -barrier_update_fraction 10 -barrier_regularization_exponent 0.25 -barrier_small_direction_factor 10. -barrier_push_variable_to_interior_k1 1e-2 -barrier_push_variable_to_interior_k2 1e-2 -barrier_damping_factor 1e-5 -least_square_multiplier_max_norm 1e3 - -##### BQPD options ##### -BQPD_print_subproblem no -BQPD_kmax 500 - -##### AMPL options ##### -AMPL_write_solution_to_file yes