Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes

cmtk::SearchTrace< R > Class Template Reference
[cmtkRegistration Library]

Class for traces in the optimization search space. More...

#include <cmtkSearchTrace.h>

Collaboration diagram for cmtk::SearchTrace< R >:
Collaboration graph
[legend]

List of all members.

Classes

struct  _TraceListEntry

Public Member Functions

 SearchTrace (const int _DOF)
 Constructor.
 ~SearchTrace ()
 Destructor.
void Add (const double value, const int dir=0, const R step=0)
 Add a location to the trace list.
int Get (double &value, const int dir=0, const R step=0) const
 Get a previously visited location from the list.
void Move (const int dir, const R step)
 Move current position in search space.
void Clear ()
 Clear list from memory.

Private Types

typedef struct
cmtk::SearchTrace::_TraceListEntry 
TraceListEntry

Private Member Functions

int IsHit (const TraceListEntry *entry, const int dir, const R step) const
 Compare an item from the track list to a given location.

Private Attributes

int DOF
 Dimension of the search space.
TraceListEntryList
 Pointer to the first element of the list of visited locations.

Detailed Description

template<class R = short>
class cmtk::SearchTrace< R >

Class for traces in the optimization search space.

An object of this class runs a list of those locations in search space that have already been visited during the optimization. This may save evaluations of the target function when these locations are approached again later in the optimum search. The type of relative vectors is defined by a template argument R. For one step size only, the default setting of "short", even "signed char" may be enough. To keep track of multiresolution schemes, however, we shall need to use "float" or "double".

Definition at line 55 of file cmtkSearchTrace.h.


Member Typedef Documentation

template<class R = short>
typedef struct cmtk::SearchTrace::_TraceListEntry cmtk::SearchTrace< R >::TraceListEntry [private]

Constructor & Destructor Documentation

template<class R = short>
cmtk::SearchTrace< R >::SearchTrace ( const int  _DOF ) [inline]

Constructor.

Set dimension of search space and initialize trace list.

Definition at line 102 of file cmtkSearchTrace.h.

References NULL.

template<class R = short>
cmtk::SearchTrace< R >::~SearchTrace (  ) [inline]

Destructor.

Call Clear() to remove list from memory.

Definition at line 110 of file cmtkSearchTrace.h.


Member Function Documentation

template<class R = short>
void cmtk::SearchTrace< R >::Add ( const double  value,
const int  dir = 0,
const R  step = 0 
) [inline]

Add a location to the trace list.

Parameters:
valueThe value of the target function at the location to be added to the list.
dirDirection of the location to add with respect to the current position in search space. This is the index of the parameter we are modifying.
stepSize of the step, ie. distance of the new location from the current position in search space.

Definition at line 121 of file cmtkSearchTrace.h.

References cmtk::SearchTrace< R >::_TraceListEntry::FunctionValue, cmtk::SearchTrace< R >::_TraceListEntry::Next, and cmtk::SearchTrace< R >::_TraceListEntry::RelativePosition.

template<class R = short>
void cmtk::SearchTrace< R >::Clear (  ) [inline]

Clear list from memory.

All list entries as well as the location vectors stored in them are deleted and the list pointer is reset to NULL.

Definition at line 176 of file cmtkSearchTrace.h.

References cmtk::Memory::DeleteArray(), and cmtk::SearchTrace< R >::_TraceListEntry::Next.

template<class R = short>
int cmtk::SearchTrace< R >::Get ( double &  value,
const int  dir = 0,
const R  step = 0 
) const [inline]

Get a previously visited location from the list.

Parameters:
valueThis reference is used to return the target function's value at the location that was asked for. This value is only valid, if the location was in the list. In case the function returns 0, value is undefined.
dirDirection in search space towards the location we ask for.
stepSize of the step to make in the given direction.
Returns:
1 if the desired location was in the list, 0 otherwise.

Definition at line 141 of file cmtkSearchTrace.h.

References cmtk::SearchTrace< R >::_TraceListEntry::FunctionValue, and cmtk::SearchTrace< R >::_TraceListEntry::Next.

Referenced by cmtk::BestNeighbourOptimizer::Optimize().

template<class R = short>
int cmtk::SearchTrace< R >::IsHit ( const TraceListEntry entry,
const int  dir,
const R  step 
) const [inline, private]

Compare an item from the track list to a given location.

As with every move in the search space, relative locations of the previously seen samples are updated, all components of the tested location must be zero except for the one giving the current search direction.

Parameters:
entryThe entry in the track list to be tested.
dirDirection, i.e. index of the parameter, in which we are moving.
stepSize of the intended step.
Returns:
1, if the list entry pointed to by "entry" is the location we would be in when making the step defined by "dir" and "step", 0 otherwise.

Definition at line 89 of file cmtkSearchTrace.h.

References cmtk::SearchTrace< R >::_TraceListEntry::RelativePosition.

template<class R = short>
void cmtk::SearchTrace< R >::Move ( const int  dir,
const R  step 
) [inline]

Move current position in search space.

All entries in the table of visited positions are modified accordingly to keep their relative positions up-to-date.

Parameters:
dirParameter modified to do the move.
stepSize of the update step in the direction defined by 'dir'.

Definition at line 162 of file cmtkSearchTrace.h.

References cmtk::SearchTrace< R >::_TraceListEntry::Next, and cmtk::SearchTrace< R >::_TraceListEntry::RelativePosition.

Referenced by cmtk::BestNeighbourOptimizer::Optimize().


Member Data Documentation

template<class R = short>
int cmtk::SearchTrace< R >::DOF [private]

Dimension of the search space.

Definition at line 72 of file cmtkSearchTrace.h.

template<class R = short>
TraceListEntry* cmtk::SearchTrace< R >::List [private]

Pointer to the first element of the list of visited locations.

Definition at line 76 of file cmtkSearchTrace.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines