IMP  2.0.1
The Integrative Modeling Platform
Simplex.h
Go to the documentation of this file.
1 /**
2  * \file IMP/gsl/Simplex.h
3  * \brief The simplex algorithm from GSL.
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPGSL_SIMPLEX_H
9 #define IMPGSL_SIMPLEX_H
10 
11 #include <IMP/gsl/gsl_config.h>
12 
13 #include "GSLOptimizer.h"
14 
15 IMPGSL_BEGIN_NAMESPACE
16 
17 //! A simplex optimizer taken from GSL
18 /** Simplex works by modifying a simplex in the space of the optimized
19  attributes. The algorithm may not behave well when using score
20  states, such as those involved in rigid bodies, which
21  significantly change the values of the attributes. Then, again, it
22  may work just fine. But be aware that it is not understood.
23 
24  The main advantage of Simplex is that it is a local optimizer that
25  does not require derivatives.
26  */
27 class IMPGSLEXPORT Simplex: public GSLOptimizer
28 {
29  double min_length_;
30  double max_length_;
31 public:
32  Simplex(Model *m= nullptr);
33 
34  /** \name Parameters
35 
36  The parameters are:
37 
38  - minumum_size: the optimization stops when the size of the
39  simplex falls below this. The size is defined as the average
40  distance from the centroid to the simplex vertices. (Default 0.1)
41 
42  - initial_length: the length of the initial sizes of the
43  simplex. Make sure that this covers the optimal solution, given
44  the starting configuration. (Default 1)
45 
46  \note Both quantities are relative to rescaled attribues and so should be
47  numbers between 0 and 1.
48  @{
49  */
50 
51  void set_initial_length(double length) {
52  IMP_USAGE_CHECK(length >0 && length <= 4,
53  "The initial length is relative to the rescaled attributes"
54  << " and so should not be much larger than 1.");
55  max_length_=length;
56  }
57 
58  void set_minimum_size(double d) {
59  IMP_USAGE_CHECK(d >0 && d <= 4,
60  "The minimum size is relative to the rescaled attributes"
61  << " and so should not be much larger than 1 "
62  << "(and must be non-zero).");
63  min_length_=d;
64  }
65  /** @} */
66 
68 };
69 
70 
71 IMPGSL_END_NAMESPACE
72 
73 #endif /* IMPGSL_SIMPLEX_H */