20 #define HUMOTO_CONFIG_SECTION_ID "SolverParameters" 21 #define HUMOTO_CONFIG_CONSTRUCTOR SolverParameters 22 #define HUMOTO_CONFIG_ENTRIES \ 23 HUMOTO_CONFIG_PARENT_CLASS(SolverParametersBase) \ 24 HUMOTO_CONFIG_SCALAR_(regularization_factor) 25 #include HUMOTO_CONFIG_DEFINE_ACCESSORS 36 regularization_factor_ = 0;
77 "Regularization factor must be nonnegative.");
79 if (parameters_.regularization_factor_ > 0)
81 qp_problem_.
regularize(parameters_.regularization_factor_);
84 double qp_status = solver.solve(qp_problem_.
getHessian(),
93 if (qp_status == QuadProgpp::Status::OK)
140 setParameters(parameters);
153 const std::string &name =
"quadprogpp")
const 156 qp_problem_.
log(logger, subname);
const humoto::constraints::ContainerAL & getInequalities() const
get container with inequalities
Eigen::VectorXd & getB()
Get vector b from equalities: 'A*x = b' or 'x = b'.
Solver()
Default constructor (with default parameters)
double regularization_factor_
Regularization factor (disabled if = 0)
void solveHierarchy(humoto::Solution &solution, const humoto::OptimizationProblem &hierarchy)
Solve the hierarchy.
SolverParameters()
Default constructor.
#define HUMOTO_GLOBAL_LOGGER_IF_DEFINED
#define HUMOTO_ASSERT(condition, message)
QuadProgpp::Solver solver
humoto::QPProblem_AB_AL qp_problem_
Analog of 'sol_structure' struct in Octave code. [determine_solution_structure.m].
Container of the solution.
A QP problem with constraints of a specific type.
Represents log entry name.
const Eigen::VectorXd & getGradient() const
Const accessor.
SolverStatus::Status return_status_
Eigen::MatrixXd & getA()
Get matrix A from general constraints: 'A*x = b', 'lb <= A*x <= ub'.
An optimization problem [initialize_stack.m, simulation_loop.m].
const humoto::constraints::ContainerAB & getEqualities() const
get container with equalities
Parameters of the solver.
Threaded logger: any data sent to this logger is wrapped in a message and pushed to a queue...
void setDefaults()
Set members to their default values.
The root namespace of HuMoTo.
Mixin solver interface (QP solver)
double quadprogpp_return_value_
The return value of quadprogpp.
void log(humoto::Logger &logger, const LogEntryName &parent=LogEntryName(), const std::string &name="quadprogpp") const
Log a QP problem.
Solver(const SolverParameters ¶meters)
Set parameters.
void regularize(const double regularization_factor)
Adds regularization to the Hessian.
LogEntryName & add(const char *name)
extends entry name with a subname
Eigen::VectorXd & getLowerBounds()
Get lower bounds (lb/ub vectors from 'lb <= A*x <= ub').
void log(humoto::Logger &logger, const LogEntryName &parent=LogEntryName(), const std::string &name="qp_problem") const
Log a QP problem.
void initialize(const humoto::OptimizationProblem &hierarchy, const humoto::SolutionStructure &sol_structure)
Initialize solver.
const Eigen::MatrixXd & getHessian() const
Const accessor.
void getQPProblem(QPProblemBase< t_QPConstraints > &qp_problem, const humoto::SolutionStructure &sol_structure, const bool initialize_upper_triangular_part=true) const
Form a QP problem.