diff --git a/bindings/AMPL/AMPLModel.cpp b/bindings/AMPL/AMPLModel.cpp index 310756ef..8db01eab 100644 --- a/bindings/AMPL/AMPLModel.cpp +++ b/bindings/AMPL/AMPLModel.cpp @@ -12,6 +12,7 @@ #include "tools/Infinity.hpp" #include "options/Options.hpp" #include "symbolic/Concatenation.hpp" +#include "Uno.hpp" namespace uno { ASL* generate_asl(std::string file_name) { @@ -374,8 +375,8 @@ namespace uno { } Option_Info option_info{}; option_info.wantsol = 9; // write the solution without printing the message to stdout - std::string message = "Uno 1.1.0: "; - message.append(status_to_message(termination_status)); + std::string message = "Uno "; + message.append(Uno::current_version()).append(": ").append(status_to_message(termination_status)); write_sol_ASL(this->asl, message.data(), iterate.primals.data(), iterate.multipliers.constraints.data(), &option_info); } } diff --git a/bindings/AMPL/uno_ampl.cpp b/bindings/AMPL/uno_ampl.cpp index 53ca2c4e..cf5e203e 100644 --- a/bindings/AMPL/uno_ampl.cpp +++ b/bindings/AMPL/uno_ampl.cpp @@ -13,6 +13,7 @@ #include "options/Options.hpp" #include "options/DefaultOptions.hpp" #include "tools/Logger.hpp" +#include "Uno.hpp" /* size_t memory_allocation_amount = 0; @@ -56,7 +57,7 @@ namespace uno { } void print_uno_instructions() { - std::cout << "Welcome in Uno 1.1.0\n"; + std::cout << "Welcome in Uno " << Uno::current_version() << '\n'; std::cout << "To solve an AMPL model, type ./uno_ampl model.nl -AMPL [option_name=option_value ...]\n"; std::cout << "To choose a constraint relaxation strategy, use the argument constraint_relaxation_strategy=" "[feasibility_restoration|l1_relaxation]\n"; diff --git a/uno/Uno.cpp b/uno/Uno.cpp index abf3bdf5..965fcd4c 100644 --- a/uno/Uno.cpp +++ b/uno/Uno.cpp @@ -118,6 +118,10 @@ namespace uno { Iterate::number_eval_jacobian, number_hessian_evaluations, number_subproblems_solved}; } + std::string Uno::current_version() { + return "1.1.0"; + } + void Uno::print_available_strategies() { std::cout << "Available strategies:\n"; std::cout << "- Constraint relaxation strategies: " << join(ConstraintRelaxationStrategyFactory::available_strategies(), ", ") << '\n'; @@ -136,7 +140,7 @@ namespace uno { } void Uno::print_optimization_summary(const Result& result) { - DISCRETE << "\nUno 1.1.0 (" << this->strategy_combination << ")\n"; + DISCRETE << "\nUno " << Uno::current_version() << " (" << this->strategy_combination << ")\n"; DISCRETE << Timer::get_current_date(); DISCRETE << "────────────────────────────────────────\n"; result.print(this->print_solution); diff --git a/uno/Uno.hpp b/uno/Uno.hpp index fae11dcc..03cb2031 100644 --- a/uno/Uno.hpp +++ b/uno/Uno.hpp @@ -29,6 +29,7 @@ namespace uno { [[nodiscard]] Result solve(const Model& model, Iterate& initial_iterate, const Options& options); + static std::string current_version(); static void print_available_strategies(); static std::string get_strategy_combination(const Options& options); void print_optimization_summary(const Result& result);