33 #ifndef DART_OPTIMIZATION_GRADIENTDESCENTSOLVER_HPP_ 34 #define DART_OPTIMIZATION_GRADIENTDESCENTSOLVER_HPP_ 38 #include "dart/optimization/Solver.hpp" 41 namespace optimization {
52 static const std::string Type;
103 double _stepMultiplier = 0.1,
104 std::size_t _maxAttempts = 1,
105 std::size_t _perturbationStep = 0,
106 double _maxPerturbationFactor = 1.0,
107 double _maxRandomizationStep = 1e10,
108 double _defaultConstraintWeight = 1.0,
109 Eigen::VectorXd _eqConstraintWeights = Eigen::VectorXd(),
110 Eigen::VectorXd _ineqConstraintWeights = Eigen::VectorXd());
130 bool solve()
override;
136 std::string
getType()
const override;
139 std::shared_ptr<Solver>
clone()
const override;
240 #endif // DART_OPTIMIZATION_GRADIENTDESCENTSOLVER_HPP_ std::size_t mPerturbationStep
The number of steps between random perturbations being applied to the configuration.
Definition: GradientDescentSolver.hpp:69
double getMaxPerturbationFactor() const
Get UniqueProperties::mPerturbationFactor.
Definition: GradientDescentSolver.cpp:392
std::size_t getLastNumIterations() const
Get the number of iterations used in the last attempt to solve the problem.
Definition: GradientDescentSolver.cpp:485
std::size_t getMaxAttempts() const
Get the maximum number of solving attempts.
Definition: GradientDescentSolver.cpp:368
void copy(const GradientDescentSolver &_other)
Copy the Properties of another GradientDescentSolver.
Definition: GradientDescentSolver.cpp:333
Eigen::VectorXd mIneqConstraintWeights
Vector of weights that should be applied to the inequality constraints.
Definition: GradientDescentSolver.hpp:100
void setDefaultConstraintWeight(double _newDefault)
Set UniqueProperties::mDefaultConstraintWeight.
Definition: GradientDescentSolver.cpp:398
void setMaxAttempts(std::size_t _maxAttempts)
Set the maximum number of solving attempts before quitting.
Definition: GradientDescentSolver.cpp:362
void randomizeConfiguration(Eigen::VectorXd &_x)
Randomize the configuration based on this Solver's settings.
Definition: GradientDescentSolver.cpp:434
void clampToBoundary(Eigen::VectorXd &_x)
Clamp the configuration to the limits of the Problem.
Definition: GradientDescentSolver.cpp:458
void setMaxPerturbationFactor(double _factor)
Set UniqueProperties::mPerturbationFactor.
Definition: GradientDescentSolver.cpp:386
double getDefaultConstraintWeight() const
Get UniqueProperties::mDefaultConstraintWeight.
Definition: GradientDescentSolver.cpp:404
std::size_t mLastNumIterations
The last number of iterations performed by this Solver.
Definition: GradientDescentSolver.hpp:216
Eigen::VectorXd mIneqConstraintCostCache
Cache to track the costs of inequality constraints.
Definition: GradientDescentSolver.hpp:231
Eigen::VectorXd mEqConstraintWeights
Vector of weights that should be applied to the equality constraints.
Definition: GradientDescentSolver.hpp:94
void setProperties(const Properties &_properties)
Set the Properties of this GradientDescentSolver.
Definition: GradientDescentSolver.cpp:308
Eigen::VectorXd getLastConfiguration() const
Get the last configuration that was used by the Solver.
Definition: GradientDescentSolver.cpp:289
std::size_t getPerturbationStep() const
Get UniqueProperties::mPerturbationStep.
Definition: GradientDescentSolver.cpp:380
Eigen::VectorXd & getEqConstraintWeights()
Set UniqueProperties::mEqConstraintWeights.
Definition: GradientDescentSolver.cpp:410
GradientDescentSolver & operator=(const GradientDescentSolver &_other)
Copy the Properties of another GradientDescentSolver.
Definition: GradientDescentSolver.cpp:342
Definition: Aspect.cpp:40
double mDefaultConstraintWeight
This is the weight that will be applied to any constraints that do not have a corresponding weight sp...
Definition: GradientDescentSolver.hpp:88
double mStepSize
Value of the fixed step size.
Definition: GradientDescentSolver.hpp:57
Eigen::VectorXd mLastConfig
The last config reached by this Solver.
Definition: GradientDescentSolver.hpp:234
Eigen::VectorXd & getIneqConstraintWeights()
Set UniqueProperties::mIneqConstraintWeights.
Definition: GradientDescentSolver.cpp:422
void setStepSize(double _newMultiplier)
Set the multiplier for the step size.
Definition: GradientDescentSolver.cpp:350
std::shared_ptr< Solver > clone() const override
Create an identical clone of this Solver.
Definition: GradientDescentSolver.cpp:301
Properties getGradientDescentProperties() const
Get the Properties of this GradientDescentSolver.
Definition: GradientDescentSolver.cpp:327
Eigen::VectorXd mEqConstraintCostCache
Cache to track the costs of equality constraints.
Definition: GradientDescentSolver.hpp:228
bool solve() override
Solve optimization problem.
Definition: GradientDescentSolver.cpp:107
Definition: GradientDescentSolver.hpp:113
Abstract class that provides a common interface for different Solvers.
Definition: Solver.hpp:52
virtual ~GradientDescentSolver()
Destructor.
Definition: GradientDescentSolver.cpp:101
Definition: GradientDescentSolver.hpp:54
DefaultSolver is a Solver extension which is native to DART (rather than relying on third-party libra...
Definition: GradientDescentSolver.hpp:49
void setPerturbationStep(std::size_t _step)
Set the number of steps that will be taken before applying a randomized perturbation.
Definition: GradientDescentSolver.cpp:374
std::string getType() const override
Get the type (implementation) of this Solver.
Definition: GradientDescentSolver.cpp:295
std::uniform_real_distribution< double > mDistribution
Distribution.
Definition: GradientDescentSolver.hpp:225
std::mt19937 mMT
Mersenne twister method.
Definition: GradientDescentSolver.hpp:222
UniqueProperties mGradientP
GradientDescentSolver properties.
Definition: GradientDescentSolver.hpp:213
double mMaxPerturbationFactor
The random perturbation works as follows: A random point in the domain of the Problem is selected...
Definition: GradientDescentSolver.hpp:80
std::random_device mRD
Randomization device.
Definition: GradientDescentSolver.hpp:219
std::size_t mMaxAttempts
Number of attempts to make before quitting.
Definition: GradientDescentSolver.hpp:65
double mMaxRandomizationStep
The largest permittable change in value when randomizing a configuration.
Definition: GradientDescentSolver.hpp:83
GradientDescentSolver(const Properties &_properties=Properties())
Default constructor.
Definition: GradientDescentSolver.cpp:78
double getStepSize() const
Get the multiplier for the step size.
Definition: GradientDescentSolver.cpp:356
The Solver::Properties class contains Solver parameters that are common to all Solver types...
Definition: Solver.hpp:59