AdaptiveLineSearch.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2013-2015 Imperial College London
5  * Copyright 2013-2015 Andreas Schuh
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef MIRTK_AdaptiveLineSearch_H
21 #define MIRTK_AdaptiveLineSearch_H
22 
23 #include "mirtk/InexactLineSearch.h"
24 
25 
26 namespace mirtk {
27 
28 
29 /**
30  * Searches sufficiently optimal step length along search direction
31  *
32  * This local optimizer implements an inexact line search with adaptive step
33  * size control, increasing the step size while steps are accepted, and
34  * decreasing it when a step did not yield a sufficient improvement.
35  */
37 {
38  mirtkLineSearchMacro(AdaptiveLineSearch, LS_Adaptive);
39 
40  // ---------------------------------------------------------------------------
41  // Attributes
42 
43  /// Increase factor of step size if accepted
44  mirtkPublicAttributeMacro(double, StepLengthRise);
45 
46  /// Decrease factor of step size if rejected
47  mirtkPublicAttributeMacro(double, StepLengthDrop);
48 
49  /// Copy attributes of this class from another instance
50  void CopyAttributes(const AdaptiveLineSearch &other);
51 
52  // ---------------------------------------------------------------------------
53  // Construction/Destruction
54 public:
55 
56  /// Constructor
58 
59  /// Copy constructor
61 
62  /// Assignment operator
64 
65  /// Destructor
66  virtual ~AdaptiveLineSearch();
67 
68  // ---------------------------------------------------------------------------
69  // Parameters
71 
72  /// Set parameter value from string
73  virtual bool Set(const char *, const char *);
74 
75  /// Get parameters as key/value as string map
76  virtual ParameterList Parameter() const;
77 
78  // ---------------------------------------------------------------------------
79  // Optimization
80 
81  /// Initialize optimization
82  virtual void Initialize();
83 
84  /// Make optimal step along search direction
85  virtual double Run();
86 
87 };
88 
89 
90 } // namespace mirtk
91 
92 #endif // MIRTK_AdaptiveLineSearch_H
virtual ParameterList Parameter() const
Get parameters as key/value as string map.
virtual double Run()
Make optimal step along search direction.
Inexact line search with adaptive step length.
Definition: LineSearch.h:36
Array< Pair< string, string > > ParameterList
Ordered list of parameter name/value pairs.
Definition: Object.h:38
virtual void Initialize()
Initialize optimization.
virtual ~AdaptiveLineSearch()
Destructor.
virtual ParameterList Parameter() const
Get parameters as key/value as string map.
Definition: IOConfig.h:41
AdaptiveLineSearch & operator=(const AdaptiveLineSearch &)
Assignment operator.
AdaptiveLineSearch(ObjectiveFunction *=NULL)
Constructor.
virtual bool Set(const char *, const char *)
Set parameter value from string.