dart
Classes | Public Member Functions | Protected Attributes | List of all members
dart::optimization::Solver Class Referenceabstract

Abstract class that provides a common interface for different Solvers. More...

#include <Solver.hpp>

Inheritance diagram for dart::optimization::Solver:
Inheritance graph
[legend]
Collaboration diagram for dart::optimization::Solver:
Collaboration graph
[legend]

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.
 
 Solver (std::shared_ptr< Problem > _problem)
 Alternative Constructor.
 
virtual ~Solver ()=default
 Destructor.
 
virtual bool solve ()=0
 Solve optimization problem.
 
virtual std::string getType () const =0
 Get the type (implementation) of this Solver.
 
virtual std::shared_ptr< Solverclone () const =0
 Create an identical clone of this Solver.
 
void setProperties (const Properties &_properties)
 Set the generic Properties of this Solver.
 
const PropertiesgetSolverProperties () const
 Get the generic Properties of this Solver.
 
void copy (const Solver &_otherSolver)
 Copy the generic Properties of another Solver.
 
Solveroperator= (const Solver &_otherSolver)
 Copy the generic Properties of another Solver.
 
virtual void setProblem (std::shared_ptr< Problem > _newProblem)
 Set the nonlinear optimization problem.
 
std::shared_ptr< ProblemgetProblem () const
 Get nonlinear optimization problem.
 
virtual void setTolerance (double _newTolerance)
 Set the maximum step size allowed for the Problem to be considered converged.
 
double getTolerance () const
 Get the maximum step size allowed for the Problem to be considered converged.
 
virtual void setNumMaxIterations (std::size_t _newMax)
 Set the maximum number of iterations that the Solver should use.
 
std::size_t getNumMaxIterations () const
 Get the maximum number of iterations that the Solver should use.
 
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.
 
std::ostream * getOutStream () const
 Get the output stream that prints the Solver's progress.
 
virtual void setPrintFinalResult (bool _print)
 Set to true if the final result should be printed to the terminal.
 
bool getPrintFinalResult () const
 Returns true if the final result should be printed to the terminal.
 
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
 

Detailed Description

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.

Member Function Documentation

◆ getIterationsPerPrint()

std::size_t dart::optimization::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.

◆ getResultFileName()

const std::string & dart::optimization::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.

◆ setIterationsPerPrint()

void dart::optimization::Solver::setIterationsPerPrint ( std::size_t  _newRatio)
virtual

Set the number of iterations that should pass between printing progress to the terminal.

Use 0 for no printing.

◆ setResultFileName()

void dart::optimization::Solver::setResultFileName ( const std::string &  _resultFile)
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.


The documentation for this class was generated from the following files: