IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
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-2026 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
14
15IMPCORE_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*/
23class 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;
28 IMP_OBJECT_METHODS(SteepestDescent);
29
30 //! Set the minimum gradient threshold
31 void set_threshold(Float t) { threshold_ = t; }
32 //! Get the minimum gradient threshold
33 Float get_threshold() const { return threshold_; }
34 //! The starting step size
35 void set_step_size(Float t) { step_size_ = t; }
36 //! Get the starting step size
37 Float get_step_size() const { return step_size_; }
38 //! The maximum step size
39 void set_maximum_step_size(Float t) { max_step_size_ = t; }
40 //! Get the maximum step size
41 Float get_maximum_step_size() const { return max_step_size_; }
42
43 private:
44 Float step_size_;
45 Float max_step_size_;
46 Float threshold_;
47};
48
49IMPCORE_END_NAMESPACE
50
51#endif /* IMPCORE_STEEPEST_DESCENT_H */
Base class for optimizers that act on individual attributes.
void set_maximum_step_size(Float t)
The maximum step size.
void set_threshold(Float t)
Set the minimum gradient threshold.
virtual Float do_optimize(unsigned int max_steps) override
override this function to do actual optimization
Float get_threshold() const
Get the minimum gradient threshold.
Float get_step_size() const
Get the starting step size.
void set_step_size(Float t)
The starting step size.
Float get_maximum_step_size() const
Get the maximum step size.
double Float
Basic floating-point value (could be float, double...).
Definition types.h:19
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.