Skip to content

Commit

Permalink
Set QP/LP/linear solvers in default options based on the available so…
Browse files Browse the repository at this point in the history
…lvers
  • Loading branch information
cvanaret committed Oct 22, 2024
1 parent 6c3d8b4 commit fe614bd
Showing 1 changed file with 33 additions and 18 deletions.
51 changes: 33 additions & 18 deletions uno/tools/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#include <iostream>
#include <fstream>
#include <sstream>
#include "solvers/QPSolverFactory.hpp"
#include "solvers/LPSolverFactory.hpp"
#include "solvers/SymmetricIndefiniteLinearSolverFactory.hpp"
#include "Options.hpp"
#include "Logger.hpp"

Expand Down Expand Up @@ -96,16 +99,6 @@ namespace uno {
options["statistics_complementarity_column_order"] = "105";
options["statistics_status_column_order"] = "200";

/** 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";

/** main options **/
// logging level (SILENT|DISCRETE|WARNING|INFO|DEBUG|DEBUG2|DEBUG3)
options["logger"] = "INFO";
Expand All @@ -127,14 +120,6 @@ namespace uno {
options["residual_scaling_threshold"] = "100.";
options["protect_actual_reduction_against_roundoff"] = "no";

/** solvers **/
// default QP solver (BQPD)
options["QP_solver"] = "BQPD";
// default LP solver (BQPD)
options["LP_solver"] = "BQPD";
// default linear solver (MA57|MUMPS)
options["linear_solver"] = "MA57";

/** globalization strategy options **/
options["armijo_decrease_fraction"] = "1e-4";
options["armijo_tolerance"] = "1e-9";
Expand Down Expand Up @@ -252,6 +237,36 @@ namespace uno {
/** AMPL options **/
options["AMPL_write_solution_to_file"] = "yes";

/** solvers: check the available solvers **/
// QP solver
const auto QP_solvers = QPSolverFactory::available_solvers();
if (not QP_solvers.empty()) {
options["QP_solver"] = QP_solvers[0];
options.is_default["QP_solver"] = false;
}
// LP solver
const auto LP_solvers = LPSolverFactory::available_solvers();
if (not LP_solvers.empty()) {
options["LP_solver"] = LP_solvers[0];
options.is_default["LP_solver"] = false;
}
// linear solver
const auto linear_solvers = SymmetricIndefiniteLinearSolverFactory::available_solvers();
if (not linear_solvers.empty()) {
options["linear_solver"] = linear_solvers[0];
options.is_default["linear_solver"] = false;
}

/** 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";

return options;
}

Expand Down

0 comments on commit fe614bd

Please sign in to comment.