primatologist-gpl 6.0.4
nolinesearch.h
Go to the documentation of this file.
1/* Copyright (C) 2000-2013 CEA
2 *
3 * This software and supporting documentation were developed by
4 * bioPICSEL
5 * CEA/DSV/I²BM/MIRCen/LMN, Batiment 61,
6 * 18, route du Panorama
7 * 92265 Fontenay-aux-Roses
8 * France
9 */
10
11#ifndef PRIMATOLOGIST_OPTIMIZATION_NOLINESEARCH_H
12#define PRIMATOLOGIST_OPTIMIZATION_NOLINESEARCH_H
13
15#include <cartobase/config/verbose.h>
16
17namespace aims {
18
19 //==========================================================================
20 // NO LINE SEARCH UTILITY
21 //==========================================================================
24 template <typename O>
26 {
27 public:
28 //------------------------------------------------------------------------
29 // TYPEDEFS
30 //------------------------------------------------------------------------
31 typedef O Objective;
34
35 //------------------------------------------------------------------------
36 // CONSTRUCTOR / DESTRUCTOR / COPY
37 //------------------------------------------------------------------------
39 _f(f), _x(), _p()
40 {}
41 NoLineSearch( const NoLineSearch<O> & other ):
42 _f(other._f), _x(other._x), _p(other._p)
43 {}
47 {
48 if( this != & other )
49 {
50 _f = other._f;
51 _x = other._x;
52 _p = other._p;
53 _maximize = other._maximize;
54 _verbose = other._verbose;
55 }
56 return *this;
57 }
58
59 //------------------------------------------------------------------------
60 // SET PARAMETERS
61 //------------------------------------------------------------------------
62 void setObjectiveFunction( const Objective & f ) { _f = f; }
63 void setPosition( const Vector & x = Vector() ) { _x = x; }
64 void setSearchDirection( const Vector & p = Vector() ) { _p = p; }
65 void setMaximize( bool maximize = false ) { _maximize = maximize; }
66 void setVerbose( int v = carto::verbose ) { _verbose = v; }
67
68 //------------------------------------------------------------------------
69 // GET PARAMETERS
70 //------------------------------------------------------------------------
71 const Objective & objectiveFunction() const { return _f; }
72 const Vector & position() const { return _x; }
73 const Vector & searchDirection() const { return _p; }
74 bool maximize() const { return _maximize(); }
75 int verbose() const { return _verbose; }
76
77 //------------------------------------------------------------------------
78 // EXECUTE
79 //------------------------------------------------------------------------
80 Vector execute() { return _x + _p; }
81
82 protected:
88 };
89
90
91} // namespace aims
92
93#endif // PRIMATOLOGIST_OPTIMIZATION_NOLINESEARCH_H
int verbose() const
bool maximize() const
math::Matrix Matrix
NoLineSearch & operator=(const NoLineSearch< O > &other)
const Objective & objectiveFunction() const
void setPosition(const Vector &x=Vector())
void setMaximize(bool maximize=false)
const Vector & position() const
math::Vector Vector
void setSearchDirection(const Vector &p=Vector())
NoLineSearch(const Objective &f=Objective())
const Vector & searchDirection() const
NoLineSearch(const NoLineSearch< O > &other)
void setVerbose(int v=carto::verbose)
void setObjectiveFunction(const Objective &f)
MatrixBase< float > Vector
Definition matrix.h:29
MatrixBase< float > Matrix
Definition matrix.h:27