|
primatologist-gpl
5.0.5
|
Once an ascent direction is given, this class performs a line search that respects wolfe conditions. More...
#include <primatologist/optimization/wolfe_decl.h>

Public Types | |
| typedef O | Objective |
| typedef math::Matrix | Matrix |
| typedef math::Vector | Vector |
Public Member Functions | |
| WolfeLineSearch (const Objective &f=Objective(), const Vector &x=Vector(), const Vector &p=Vector()) | |
| WolfeLineSearch (const WolfeLineSearch< O > &other) | |
| ~WolfeLineSearch () | |
| WolfeLineSearch< O > & | operator= (const WolfeLineSearch< O > &other) |
| void | setC1 (float c1=1E-4) |
| void | setC2 (float c2=0.9) |
| void | setStrongWolfe (bool strong=false) |
| void | setMaximize (bool maximize=false) |
| void | setMaxIterations (int n=- 1) |
| void | setVerbose (int v=carto::verbose) |
| void | setObjectiveFunction (const Objective &f) |
| void | setPosition (const Vector &x=Vector()) |
| void | setSearchDirection (const Vector &p=Vector()) |
| float | c1 () const |
| float | c2 () const |
| bool | strongWolfe () const |
| bool | maximize () const |
| int | maxIterations () const |
| int | verbose () const |
| const Objective & | objectiveFunction () const |
| const Vector & | position () const |
| const Vector & | searchDirection () const |
| Vector | execute () |
Protected Member Functions | |
| bool | wolfe1 (float a) const |
| Armijo (= Wolfe 1st) condition. More... | |
| bool | wolfe2w (float a) const |
| weak 2nd Wolfe condition More... | |
| bool | wolfe2s (float a) const |
| strong 2nd Wolfe condition More... | |
| bool | wolfe2 (float a) const |
| select condition based on _strong More... | |
| bool | checkDirection () |
| Compute f(x) and <p, g(x)>. More... | |
Protected Attributes | |
| float | _c1 |
| Wolfe c1. More... | |
| float | _c2 |
| Wolfe c2. More... | |
| Vector | _x |
| position More... | |
| Vector | _p |
| ascentDirection More... | |
| Objective | _f |
| objectiveFunction More... | |
| bool | _strong |
| strongWolfe More... | |
| int | _verbose |
| verbosity level More... | |
| bool | _maximize |
| maximize or minimize More... | |
| int | _max_it |
| maximum number of iterations More... | |
| float | _previous_value |
| f(x) More... | |
| float | _current_value |
| f(x + a.p) More... | |
| float | _previous_scalarprod |
| <p, g(x)> More... | |
Once an ascent direction is given, this class performs a line search that respects wolfe conditions.
Wolfe conditions depend on two parameters 0 < c1 < c2 < 1 and hold if: 1) f( x + a.p ) >= f(x) + c1.a.p * g( x ) , 2a) p * g( x + a.p ) >= c2.p * g( x ) , where x is the previous parameter value of the objective function, p is the provided search direction, f returns the value of the objective function, g returns its gradient and a is the step length optimzed by this line search. For strong wolfe condition, inequality 2a is replaced by inequality 2b: 2b) |p * g( x + a.p )| <= c2.|p * g( x )| .
| Model | An objective function class that implements value( Vector ) and derivative( Vector ) |
Definition at line 38 of file wolfe_decl.h.
| typedef math::Matrix aims::WolfeLineSearch< O >::Matrix |
Definition at line 45 of file wolfe_decl.h.
| typedef O aims::WolfeLineSearch< O >::Objective |
Definition at line 44 of file wolfe_decl.h.
| typedef math::Vector aims::WolfeLineSearch< O >::Vector |
Definition at line 46 of file wolfe_decl.h.
| aims::WolfeLineSearch< O >::WolfeLineSearch | ( | const Objective & | f = Objective(), |
| const Vector & | x = Vector(), |
||
| const Vector & | p = Vector() |
||
| ) |
Definition at line 27 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::setC1(), aims::WolfeLineSearch< O >::setC2(), aims::WolfeLineSearch< O >::setMaximize(), aims::WolfeLineSearch< O >::setMaxIterations(), aims::WolfeLineSearch< O >::setStrongWolfe(), and aims::WolfeLineSearch< O >::setVerbose().
| aims::WolfeLineSearch< O >::WolfeLineSearch | ( | const WolfeLineSearch< O > & | other | ) |
| aims::WolfeLineSearch< O >::~WolfeLineSearch | ( | ) |
| float aims::WolfeLineSearch< O >::c1 | ( | ) | const |
Definition at line 146 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_c1.
Referenced by aims::WolfeLineSearch< O >::setC1().
| float aims::WolfeLineSearch< O >::c2 | ( | ) | const |
Definition at line 152 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_c2.
Referenced by aims::WolfeLineSearch< O >::setC2().
|
protected |
Compute f(x) and <p, g(x)>.
Check that the search direction has the right orientation.
Definition at line 317 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_p, aims::WolfeLineSearch< O >::_previous_scalarprod, aims::WolfeLineSearch< O >::_previous_value, aims::WolfeLineSearch< O >::_x, at(), aims::WolfeLineSearch< O >::maximize(), aims::WolfeLineSearch< O >::objectiveFunction(), and aims::math::transpose().
Referenced by aims::WolfeLineSearch< O >::execute().
| WolfeLineSearch< O >::Vector aims::WolfeLineSearch< O >::execute | ( | ) |
Definition at line 208 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_current_value, aims::WolfeLineSearch< O >::_p, aims::WolfeLineSearch< O >::_previous_value, aims::WolfeLineSearch< O >::_x, aims::WolfeLineSearch< O >::checkDirection(), aims::WolfeLineSearch< O >::maximize(), aims::WolfeLineSearch< O >::maxIterations(), aims::WolfeLineSearch< O >::objectiveFunction(), aims::WolfeLineSearch< O >::verbose(), aims::WolfeLineSearch< O >::wolfe1(), and aims::WolfeLineSearch< O >::wolfe2().
| bool aims::WolfeLineSearch< O >::maximize | ( | ) | const |
Definition at line 191 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_maximize.
Referenced by aims::WolfeLineSearch< O >::checkDirection(), aims::WolfeLineSearch< O >::execute(), aims::WolfeLineSearch< O >::setMaximize(), aims::WolfeLineSearch< O >::wolfe1(), and aims::WolfeLineSearch< O >::wolfe2w().
| int aims::WolfeLineSearch< O >::maxIterations | ( | ) | const |
Definition at line 197 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_max_it.
Referenced by aims::WolfeLineSearch< O >::execute().
| const WolfeLineSearch< O >::Objective & aims::WolfeLineSearch< O >::objectiveFunction | ( | ) | const |
Definition at line 173 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_f.
Referenced by aims::WolfeLineSearch< O >::checkDirection(), aims::WolfeLineSearch< O >::execute(), aims::WolfeLineSearch< O >::wolfe2s(), and aims::WolfeLineSearch< O >::wolfe2w().
| WolfeLineSearch< O > & aims::WolfeLineSearch< O >::operator= | ( | const WolfeLineSearch< O > & | other | ) |
Definition at line 64 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_c1, aims::WolfeLineSearch< O >::_c2, aims::WolfeLineSearch< O >::_current_value, aims::WolfeLineSearch< O >::_f, aims::WolfeLineSearch< O >::_max_it, aims::WolfeLineSearch< O >::_maximize, aims::WolfeLineSearch< O >::_p, aims::WolfeLineSearch< O >::_previous_scalarprod, aims::WolfeLineSearch< O >::_previous_value, aims::WolfeLineSearch< O >::_strong, aims::WolfeLineSearch< O >::_verbose, and aims::WolfeLineSearch< O >::_x.
| const WolfeLineSearch< O >::Vector & aims::WolfeLineSearch< O >::position | ( | ) | const |
Definition at line 159 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_x.
| const WolfeLineSearch< O >::Vector & aims::WolfeLineSearch< O >::searchDirection | ( | ) | const |
Definition at line 166 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_p.
| void aims::WolfeLineSearch< O >::setC1 | ( | float | c1 = 1E-4 | ) |
Definition at line 88 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_c1, and aims::WolfeLineSearch< O >::c1().
Referenced by aims::WolfeLineSearch< O >::WolfeLineSearch().
| void aims::WolfeLineSearch< O >::setC2 | ( | float | c2 = 0.9 | ) |
Definition at line 94 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_c2, and aims::WolfeLineSearch< O >::c2().
Referenced by aims::WolfeLineSearch< O >::WolfeLineSearch().
| void aims::WolfeLineSearch< O >::setMaximize | ( | bool | maximize = false | ) |
Definition at line 130 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_maximize, and aims::WolfeLineSearch< O >::maximize().
Referenced by aims::WolfeLineSearch< O >::WolfeLineSearch().
| void aims::WolfeLineSearch< O >::setMaxIterations | ( | int | n = - 1 | ) |
Definition at line 136 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_max_it.
Referenced by aims::WolfeLineSearch< O >::WolfeLineSearch().
| void aims::WolfeLineSearch< O >::setObjectiveFunction | ( | const Objective & | f | ) |
Definition at line 112 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_f.
| void aims::WolfeLineSearch< O >::setPosition | ( | const Vector & | x = Vector() | ) |
Definition at line 100 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_x.
| void aims::WolfeLineSearch< O >::setSearchDirection | ( | const Vector & | p = Vector() | ) |
Definition at line 106 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_p.
| void aims::WolfeLineSearch< O >::setStrongWolfe | ( | bool | strong = false | ) |
Definition at line 118 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_strong.
Referenced by aims::WolfeLineSearch< O >::WolfeLineSearch().
| void aims::WolfeLineSearch< O >::setVerbose | ( | int | v = carto::verbose | ) |
Definition at line 124 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_verbose.
Referenced by aims::WolfeLineSearch< O >::WolfeLineSearch().
| bool aims::WolfeLineSearch< O >::strongWolfe | ( | ) | const |
Definition at line 179 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_strong.
| int aims::WolfeLineSearch< O >::verbose | ( | ) | const |
Definition at line 185 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_verbose.
Referenced by aims::WolfeLineSearch< O >::execute().
|
protected |
Armijo (= Wolfe 1st) condition.
Definition at line 328 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_c1, aims::WolfeLineSearch< O >::_current_value, aims::WolfeLineSearch< O >::_previous_scalarprod, aims::WolfeLineSearch< O >::_previous_value, and aims::WolfeLineSearch< O >::maximize().
Referenced by aims::WolfeLineSearch< O >::execute().
|
protected |
select condition based on _strong
Definition at line 357 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_strong, aims::WolfeLineSearch< O >::wolfe2s(), and aims::WolfeLineSearch< O >::wolfe2w().
Referenced by aims::WolfeLineSearch< O >::execute().
|
protected |
strong 2nd Wolfe condition
Definition at line 349 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_c2, aims::WolfeLineSearch< O >::_p, aims::WolfeLineSearch< O >::_previous_scalarprod, aims::WolfeLineSearch< O >::_x, at(), aims::WolfeLineSearch< O >::objectiveFunction(), and aims::math::transpose().
Referenced by aims::WolfeLineSearch< O >::wolfe2().
|
protected |
weak 2nd Wolfe condition
Definition at line 338 of file wolfe_d.h.
References aims::WolfeLineSearch< O >::_c2, aims::WolfeLineSearch< O >::_p, aims::WolfeLineSearch< O >::_previous_scalarprod, aims::WolfeLineSearch< O >::_x, at(), aims::WolfeLineSearch< O >::maximize(), aims::WolfeLineSearch< O >::objectiveFunction(), and aims::math::transpose().
Referenced by aims::WolfeLineSearch< O >::wolfe2().
|
protected |
Wolfe c1.
Definition at line 101 of file wolfe_decl.h.
Referenced by aims::WolfeLineSearch< O >::c1(), aims::WolfeLineSearch< O >::operator=(), aims::WolfeLineSearch< O >::setC1(), and aims::WolfeLineSearch< O >::wolfe1().
|
protected |
Wolfe c2.
Definition at line 102 of file wolfe_decl.h.
Referenced by aims::WolfeLineSearch< O >::c2(), aims::WolfeLineSearch< O >::operator=(), aims::WolfeLineSearch< O >::setC2(), aims::WolfeLineSearch< O >::wolfe2s(), and aims::WolfeLineSearch< O >::wolfe2w().
|
protected |
f(x + a.p)
Definition at line 121 of file wolfe_decl.h.
Referenced by aims::WolfeLineSearch< O >::execute(), aims::WolfeLineSearch< O >::operator=(), and aims::WolfeLineSearch< O >::wolfe1().
|
protected |
objectiveFunction
Definition at line 105 of file wolfe_decl.h.
Referenced by aims::WolfeLineSearch< O >::objectiveFunction(), aims::WolfeLineSearch< O >::operator=(), and aims::WolfeLineSearch< O >::setObjectiveFunction().
|
protected |
maximum number of iterations
Definition at line 109 of file wolfe_decl.h.
Referenced by aims::WolfeLineSearch< O >::maxIterations(), aims::WolfeLineSearch< O >::operator=(), and aims::WolfeLineSearch< O >::setMaxIterations().
|
protected |
maximize or minimize
Definition at line 108 of file wolfe_decl.h.
Referenced by aims::WolfeLineSearch< O >::maximize(), aims::WolfeLineSearch< O >::operator=(), and aims::WolfeLineSearch< O >::setMaximize().
|
protected |
ascentDirection
Definition at line 104 of file wolfe_decl.h.
Referenced by aims::WolfeLineSearch< O >::checkDirection(), aims::WolfeLineSearch< O >::execute(), aims::WolfeLineSearch< O >::operator=(), aims::WolfeLineSearch< O >::searchDirection(), aims::WolfeLineSearch< O >::setSearchDirection(), aims::WolfeLineSearch< O >::wolfe2s(), and aims::WolfeLineSearch< O >::wolfe2w().
|
protected |
<p, g(x)>
Definition at line 122 of file wolfe_decl.h.
Referenced by aims::WolfeLineSearch< O >::checkDirection(), aims::WolfeLineSearch< O >::operator=(), aims::WolfeLineSearch< O >::wolfe1(), aims::WolfeLineSearch< O >::wolfe2s(), and aims::WolfeLineSearch< O >::wolfe2w().
|
protected |
f(x)
Definition at line 120 of file wolfe_decl.h.
Referenced by aims::WolfeLineSearch< O >::checkDirection(), aims::WolfeLineSearch< O >::execute(), aims::WolfeLineSearch< O >::operator=(), and aims::WolfeLineSearch< O >::wolfe1().
|
protected |
strongWolfe
Definition at line 106 of file wolfe_decl.h.
Referenced by aims::WolfeLineSearch< O >::operator=(), aims::WolfeLineSearch< O >::setStrongWolfe(), aims::WolfeLineSearch< O >::strongWolfe(), and aims::WolfeLineSearch< O >::wolfe2().
|
protected |
verbosity level
Definition at line 107 of file wolfe_decl.h.
Referenced by aims::WolfeLineSearch< O >::operator=(), aims::WolfeLineSearch< O >::setVerbose(), and aims::WolfeLineSearch< O >::verbose().
|
protected |
position
Definition at line 103 of file wolfe_decl.h.
Referenced by aims::WolfeLineSearch< O >::checkDirection(), aims::WolfeLineSearch< O >::execute(), aims::WolfeLineSearch< O >::operator=(), aims::WolfeLineSearch< O >::position(), aims::WolfeLineSearch< O >::setPosition(), aims::WolfeLineSearch< O >::wolfe2s(), and aims::WolfeLineSearch< O >::wolfe2w().