DART
6.7.3
|
Abstract class that provides a common interface for different Solvers. More...
#include <Solver.hpp>
Classes | |
struct | Properties |
The Solver::Properties class contains Solver parameters that are common to all Solver types. More... | |
Public Member Functions | |
Solver (const Properties &_properties=Properties()) | |
Default Constructor. More... | |
Solver (std::shared_ptr< Problem > _problem) | |
Alternative Constructor. More... | |
virtual | ~Solver ()=default |
Destructor. More... | |
virtual bool | solve ()=0 |
Solve optimization problem. More... | |
virtual std::string | getType () const =0 |
Get the type (implementation) of this Solver. More... | |
virtual std::shared_ptr< Solver > | clone () const =0 |
Create an identical clone of this Solver. More... | |
void | setProperties (const Properties &_properties) |
Set the generic Properties of this Solver. More... | |
const Properties & | getSolverProperties () const |
Get the generic Properties of this Solver. More... | |
void | copy (const Solver &_otherSolver) |
Copy the generic Properties of another Solver. More... | |
Solver & | operator= (const Solver &_otherSolver) |
Copy the generic Properties of another Solver. More... | |
virtual void | setProblem (std::shared_ptr< Problem > _newProblem) |
Set the nonlinear optimization problem. More... | |
std::shared_ptr< Problem > | getProblem () const |
Get nonlinear optimization problem. More... | |
virtual void | setTolerance (double _newTolerance) |
Set the maximum step size allowed for the Problem to be considered converged. More... | |
double | getTolerance () const |
Get the maximum step size allowed for the Problem to be considered converged. More... | |
virtual void | setNumMaxIterations (std::size_t _newMax) |
Set the maximum number of iterations that the Solver should use. More... | |
std::size_t | getNumMaxIterations () const |
Get the maximum number of iterations that the Solver should use. More... | |
virtual void | setIterationsPerPrint (std::size_t _newRatio) |
Set the number of iterations that should pass between printing progress to the terminal. More... | |
std::size_t | getIterationsPerPrint () const |
Get the number of iterations that should pass between printing progress to the terminal. More... | |
virtual void | setOutStream (std::ostream *_os) |
Set the output stream that prints the Solver's progress. More... | |
std::ostream * | getOutStream () const |
Get the output stream that prints the Solver's progress. More... | |
virtual void | setPrintFinalResult (bool _print) |
Set to true if the final result should be printed to the terminal. More... | |
bool | getPrintFinalResult () const |
Returns true if the final result should be printed to the terminal. More... | |
virtual void | setResultFileName (const std::string &_resultFile) |
Set the name of the file that results should be printed to. More... | |
const std::string & | getResultFileName () const |
Get the name of the file that results should be printed to. More... | |
Protected Attributes | |
Properties | mProperties |
Abstract class that provides a common interface for different Solvers.
The different Solver implementations each use a different nonlinear problem solving library, which could lead to differences in performance for various problem types. This base class allows the different Solver implementations to be swapped out with each other quickly and easily to help with testing, benchmarking, and experimentation.
|
explicit |
Default Constructor.
|
explicit |
Alternative Constructor.
|
virtualdefault |
Destructor.
|
pure virtual |
Create an identical clone of this Solver.
Implemented in dart::optimizer::NloptSolver, dart::optimizer::IpoptSolver, and dart::optimizer::GradientDescentSolver.
void dart::optimizer::Solver::copy | ( | const Solver & | _otherSolver | ) |
Copy the generic Properties of another Solver.
std::size_t dart::optimizer::Solver::getIterationsPerPrint | ( | ) | const |
Get the number of iterations that should pass between printing progress to the terminal.
A value of 0 means there will be no printing.
std::size_t dart::optimizer::Solver::getNumMaxIterations | ( | ) | const |
Get the maximum number of iterations that the Solver should use.
std::ostream * dart::optimizer::Solver::getOutStream | ( | ) | const |
Get the output stream that prints the Solver's progress.
bool dart::optimizer::Solver::getPrintFinalResult | ( | ) | const |
Returns true if the final result should be printed to the terminal.
std::shared_ptr< Problem > dart::optimizer::Solver::getProblem | ( | ) | const |
Get nonlinear optimization problem.
const std::string & dart::optimizer::Solver::getResultFileName | ( | ) | const |
Get the name of the file that results should be printed to.
An empty string indicates that results should not be printed to a file.
const Solver::Properties & dart::optimizer::Solver::getSolverProperties | ( | ) | const |
Get the generic Properties of this Solver.
double dart::optimizer::Solver::getTolerance | ( | ) | const |
Get the maximum step size allowed for the Problem to be considered converged.
|
pure virtual |
Get the type (implementation) of this Solver.
Implemented in dart::optimizer::NloptSolver, dart::optimizer::IpoptSolver, and dart::optimizer::GradientDescentSolver.
Copy the generic Properties of another Solver.
|
virtual |
Set the number of iterations that should pass between printing progress to the terminal.
Use 0 for no printing.
|
virtual |
Set the maximum number of iterations that the Solver should use.
|
virtual |
Set the output stream that prints the Solver's progress.
|
virtual |
Set to true if the final result should be printed to the terminal.
|
virtual |
Set the nonlinear optimization problem.
void dart::optimizer::Solver::setProperties | ( | const Properties & | _properties | ) |
Set the generic Properties of this Solver.
|
virtual |
Set the name of the file that results should be printed to.
Use an empty string to indicate that results should not be printed to a file.
|
virtual |
Set the maximum step size allowed for the Problem to be considered converged.
|
pure virtual |
Solve optimization problem.
Implemented in dart::optimizer::NloptSolver, dart::optimizer::IpoptSolver, dart::optimizer::GradientDescentSolver, and dart::optimizer::snopt::SnoptSolver.
|
protected |