LimitedMemoryBFGSDescent.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK) LBFGS Library
3  *
4  * Copyright 2013-2015 Imperial College London
5  * Copyright 2013-2015 Andreas Schuh
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a copy
8  * of this software and associated documentation files (the "Software"), to deal
9  * in the Software without restriction, including without limitation the rights
10  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11  * copies of the Software, and to permit persons to whom the Software is
12  * furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in
15  * all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23  * THE SOFTWARE.
24  */
25 
26 #ifndef MIRTK_LimitedMemoryBFGSDescent_H
27 #define MIRTK_LimitedMemoryBFGSDescent_H
28 
29 #include "mirtk/LocalOptimizer.h"
30 
31 
32 namespace mirtk {
33 
34 
35 /**
36  * Minimizes objective function using L-BFGS
37  */
39 {
40  mirtkOptimizerMacro(LimitedMemoryBFGSDescent, OM_LBFGS);
41 
42  // ---------------------------------------------------------------------------
43  // Attributes
44 
45  /// Maximum number of iterations
46  mirtkPublicAttributeMacro(int, NumberOfIterations);
47 
48  /// Minimum length of steps
49  mirtkPublicAttributeMacro(double, MinStepLength);
50 
51  /// Maximum length of steps
52  mirtkPublicAttributeMacro(double, MaxStepLength);
53 
54  /// Copy attributes of this class from another instance
55  void CopyAttributes(const LimitedMemoryBFGSDescent &);
56 
57 public:
58 
59  /// Current line search progress
61 
62  // ---------------------------------------------------------------------------
63  // Construction/Destruction
64 public:
65 
66  /// Constructor
68 
69  /// Copy constructor
71 
72  /// Assignment operator
74 
75  /// Destructor
76  virtual ~LimitedMemoryBFGSDescent();
77 
78  // ---------------------------------------------------------------------------
79  // Parameters
80 
81  // Import other overloads
83 
84  /// Set parameter value from string
85  virtual bool Set(const char *, const char *);
86 
87  /// Get parameters as key/value as string map
88  virtual ParameterList Parameter() const;
89 
90  // ---------------------------------------------------------------------------
91  // Execution
92 
93  /// Optimize objective function using gradient descent
94  virtual double Run();
95 
96 };
97 
98 
99 } // namespace mirtk
100 
101 #endif // MIRTK_LimitedMemoryBFGSDescent_H
LineSearchStep _CurrentStep
Current line search progress.
virtual ParameterList Parameter() const
Get parameters as key/value as string map.
Array< Pair< string, string > > ParameterList
Ordered list of parameter name/value pairs.
Definition: Object.h:38
virtual ParameterList Parameter() const
Get parameters as key/value as string map.
virtual ~LimitedMemoryBFGSDescent()
Destructor.
Definition: IOConfig.h:41
Data of AcceptedStepEvent and RejectedStepEvent.
Definition: Event.h:144
virtual double Run()
Optimize objective function using gradient descent.
LimitedMemoryBFGSDescent & operator=(const LimitedMemoryBFGSDescent &)
Assignment operator.
virtual bool Set(const char *, const char *)
Set parameter value from string.
LimitedMemoryBFGSDescent(ObjectiveFunction *=NULL)
Constructor.