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