IMP logo
IMP Reference Guide  develop.63b38c487d,2024/12/21
The Integrative Modeling Platform
SteepestDescent.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/SteepestDescent.h \brief Simple steepest descent optimizer.
3  *
4  * Copyright 2007-2022 IMP Inventors. All rights reserved.
5  *
6  */
7 
8 #ifndef IMPCORE_STEEPEST_DESCENT_H
9 #define IMPCORE_STEEPEST_DESCENT_H
10 
11 #include <IMP/core/core_config.h>
12 
13 #include <IMP/AttributeOptimizer.h>
14 
15 IMPCORE_BEGIN_NAMESPACE
16 
17 //! A simple steepest descent optimizer
18 /** Follow the gradient based on the partial derivatives. Multiply by the
19  current step size. If the score gets worse, reduce the step size.
20  If the score gets better, increase the step size if we are sufficiently
21  far from a score of zero. If the score reaches the threshold, quit.
22 */
23 class IMPCOREEXPORT SteepestDescent : public AttributeOptimizer {
24  public:
25  SteepestDescent(Model *m, std::string name = "SteepestDescent%1%");
26 
27  virtual Float do_optimize(unsigned int max_steps) override;
29 
30  //! Set the minimum gradient threshold
31  void set_threshold(Float t) { threshold_ = t; }
32  //! The starting step size
33  void set_step_size(Float t) { step_size_ = t; }
34  //! The maximum step size
35  void set_maximum_step_size(Float t) { max_step_size_ = t; }
36 
37  private:
38  Float step_size_;
39  Float max_step_size_;
40  Float threshold_;
41 };
42 
43 IMPCORE_END_NAMESPACE
44 
45 #endif /* IMPCORE_STEEPEST_DESCENT_H */
void set_maximum_step_size(Float t)
The maximum step size.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
void set_threshold(Float t)
Set the minimum gradient threshold.
A simple steepest descent optimizer.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
virtual double do_optimize(unsigned int ns)=0
override this function to do actual optimization
void set_step_size(Float t)
The starting step size.
Base class for optimizers that act on individual attributes.
double Float
Basic floating-point value (could be float, double...)
Definition: types.h:19
Base class for optimizers that act on individual attributes.