diff --git a/bindings/AMPL/uno_ampl.cpp b/bindings/AMPL/uno_ampl.cpp index 2d54e19f..69711ccb 100644 --- a/bindings/AMPL/uno_ampl.cpp +++ b/bindings/AMPL/uno_ampl.cpp @@ -13,7 +13,6 @@ #include "options/Options.hpp" #include "options/DefaultOptions.hpp" #include "tools/Logger.hpp" -#include "Uno.hpp" /* size_t memory_allocation_amount = 0; @@ -100,8 +99,8 @@ int main(int argc, char* argv[]) { throw std::runtime_error("The second command line argument should be -AMPL"); } - // determine the default solvers based on the available libraries - Options solvers_options = DefaultOptions::determine_solvers(); + // determine the default solvers based on the available libraries and possibly set a preset + Options solvers_options = DefaultOptions::determine_solvers_and_preset(); options.overwrite_with(solvers_options); // overwrite the default options with the command line arguments diff --git a/uno/options/DefaultOptions.cpp b/uno/options/DefaultOptions.cpp index a8068a0a..f57658ef 100644 --- a/uno/options/DefaultOptions.cpp +++ b/uno/options/DefaultOptions.cpp @@ -189,7 +189,7 @@ namespace uno { return options; } - Options DefaultOptions::determine_solvers() { + Options DefaultOptions::determine_solvers_and_preset() { Options options(false); /** solvers: check the available solvers **/ @@ -209,15 +209,14 @@ namespace uno { options["linear_solver"] = linear_solvers[0]; } - /** ingredients **/ - // default constraint relaxation strategy (feasibility_restoration|l1_relaxation) - options["constraint_relaxation_strategy"] = "feasibility_restoration"; - // default subproblem (QP|LP|primal_dual_interior_point) - options["subproblem"] = "QP"; - // default globalization strategy (l1_merit|fletcher_filter_method|waechter_filter_method) - options["globalization_strategy"] = "fletcher_filter_method"; - // default globalization mechanism (TR|LS) - options["globalization_mechanism"] = "TR"; + /** default preset **/ + if (not QP_solvers.empty()) { + Options::set_preset(options, "filtersqp"); + } + else if (not linear_solvers.empty()) { + Options::set_preset(options, "ipopt"); + } + // note: byrd is not very robust and is not considered as a default preset return options; } diff --git a/uno/options/DefaultOptions.hpp b/uno/options/DefaultOptions.hpp index f1d47ebc..cf3ed80e 100644 --- a/uno/options/DefaultOptions.hpp +++ b/uno/options/DefaultOptions.hpp @@ -10,7 +10,7 @@ namespace uno { class DefaultOptions { public: [[nodiscard]] static Options load(); - [[nodiscard]] static Options determine_solvers(); + [[nodiscard]] static Options determine_solvers_and_preset(); }; } // namespace