IMP  2.0.1
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-2013 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/Optimizer.h>
14 #include <IMP/optimizer_macros.h>
15 
16 IMPCORE_BEGIN_NAMESPACE
17 
18 //! A simple steepest descent optimizer
19  /** Follow the gradient based on the partial derivatives. Multiply by the
20  current step size. If the score gets worse, reduce the step size.
21  If the score gets better, increase the step size if we are sufficiently
22  far from a score of zero. If the score reaches the threshold, quit.
23  */
24 class IMPCOREEXPORT SteepestDescent : public Optimizer
25 {
26  public:
27  SteepestDescent(Model *m= nullptr);
28 
30 
31  //! Set the minimum gradient threshold
32  void set_threshold(Float t) {threshold_=t;}
33  //! The starting step size
34  void set_step_size(Float t) {step_size_=t;}
35 //! The maximum step size
36  void set_maximum_step_size(Float t) {max_step_size_=t;}
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 */