OpenGM  2.3.x
Discrete Graphical Model Library
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator > Class Template Referenceabstract

#include <trws_subproblemsolver.hxx>

+ Inheritance diagram for opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >:
+ Collaboration diagram for opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >:

Public Types

typedef GM GMType
 
typedef ACC ACCType
 
typedef GM::ValueType ValueType
 
typedef GM::IndexType IndexType
 
typedef GM::LabelType LabelType
 
typedef InputIterator InputIteratorType
 
typedef SequenceStorage< GM > Storage
 
typedef Storage::IndexList IndexList
 
typedef Storage::UnaryFactor UnaryFactor
 
typedef Storage::MoveDirection MoveDirection
 
typedef std::vector< IndexListIndexTable
 
typedef FunctionParameters< GM > FactorProperties
 
typedef UnaryFactor::const_iterator ConstIterator
 
typedef GM::FactorType Factor
 
typedef std::pair< typename UnaryFactor::const_iterator, typename UnaryFactor::const_iterator > const_iterators_pair
 

Public Member Functions

 DynamicProgramming (Storage &storage, const FactorProperties &factorProperties, bool fastComputations=true)
 
virtual ~DynamicProgramming ()
 
void InitMove ()
 
void InitMove (MoveDirection movedirection)
 
virtual void InitReverseMove ()
 
virtual void Move ()
 >initializes move, which is reverse to the current one//TODO: remove virtual ? More...
 
virtual void PushBack ()
 
virtual void MoveBack ()
 
const_iterators_pair GetMarginals () const
 
const_iterators_pair GetMarginals (IndexType indx) const
 
ValueType GetObjectiveValue () const
 
virtual ValueType ComputeObjectiveValue ()=0
 
virtual void IncreaseUnaryWeights (InputIteratorType begin, InputIteratorType end)
 
virtual void FinalizeMove ()
 
LabelType numOfLabels () const
 
virtual void UpdateMarginals ()
 
virtual IndexType getNextPWId () const
 

updates marginals in the current node so, that they correspond to the forward (backward) accumulated probabilities of labels

More...
 
virtual IndexType getPrevPWId () const
 

returns an external (_gm[.]) pairwise index, which follows the current variable. For the last variable this::NaN is returned

More...
 
MoveDirection getMoveDirection () const
 

returns an external (_gm[.]) pairwise index, which is in front of the current variable. For the first variable this::NaN is returned

More...
 
IndexType size () const
 
template<class ITERATOR >
ValueType evaluate (ITERATOR labeling)
 
void SetFastComputation (bool fc)
 

Static Public Attributes

static const IndexType NaN =std::numeric_limits<IndexType>::max()
 

Protected Member Functions

void _PottsUnaryTransform (LabelType newSize, const typename FactorProperties::ParameterStorageType &params)
 
void _InitReverseMoveBack ()
 
void _InitMove (ValueType rho, MoveDirection movedirection)
 >initializes move, which is reverse to the current one More...
 
virtual void _Push ()
 
void _core_InitMoves (ValueType rho, MoveDirection movedirection)
 
void _PushMessagesToFactor ()
 
void _ClearMessages (UnaryFactor *pbuffer=0)
 
virtual void _makeLocalCopyOfPWFactor (LabelType trgsize)
 
void _SumUpBufferToMarginals ()
 
virtual void _BackUpForwardMarginals ()
 
virtual void _InitCurrentUnaryBuffer (IndexType index)
 
IndexType _core_next (IndexType begin, MoveDirection dir) const
 
IndexType _next (IndexType begin) const
 
IndexType _previous (IndexType begin) const
 
IndexType _nextPWIndex () const
 

Protected Attributes

bool _fastComputation
 
Storage_storage
 
const FactorProperties_factorProperties
 
std::vector< UnaryFactor_marginals
 
ValueType _objectiveValue
 
ValueType _rho
 
MoveDirection _moveDirection
 
bool _bInitializationNeeded
 
UnaryFactor _currentPWFactor
 
UnaryFactor _currentUnaryFactor
 
IndexType _currentUnaryIndex
 
UnaryFactor _unaryTemp
 
Pseudo2DArray< ValueType_spst
 

Detailed Description

template<class GM, class ACC, class InputIterator>
class opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >

Definition at line 178 of file trws_subproblemsolver.hxx.

Member Typedef Documentation

template<class GM, class ACC, class InputIterator>
typedef ACC opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::ACCType

Definition at line 182 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
typedef std::pair<typename UnaryFactor::const_iterator,typename UnaryFactor::const_iterator> opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::const_iterators_pair

Definition at line 196 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
typedef UnaryFactor::const_iterator opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::ConstIterator

Definition at line 194 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
typedef GM::FactorType opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::Factor

Definition at line 195 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
typedef FunctionParameters<GM> opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::FactorProperties

Definition at line 193 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
typedef GM opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::GMType

Definition at line 181 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
typedef Storage::IndexList opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::IndexList

Definition at line 189 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
typedef std::vector<IndexList> opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::IndexTable

Definition at line 192 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
typedef GM::IndexType opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::IndexType

Definition at line 184 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
typedef InputIterator opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::InputIteratorType

Definition at line 187 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
typedef GM::LabelType opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::LabelType

Definition at line 185 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
typedef Storage::MoveDirection opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::MoveDirection

Definition at line 191 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
typedef SequenceStorage<GM> opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::Storage

Definition at line 188 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
typedef Storage::UnaryFactor opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::UnaryFactor

Definition at line 190 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
typedef GM::ValueType opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::ValueType

Definition at line 183 of file trws_subproblemsolver.hxx.

Constructor & Destructor Documentation

template<class GM , class ACC , class InputIterator >
opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::DynamicProgramming ( Storage storage,
const FactorProperties factorProperties,
bool  fastComputations = true 
)

Definition at line 631 of file trws_subproblemsolver.hxx.

+ Here is the call graph for this function:

template<class GM, class ACC, class InputIterator>
virtual opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::~DynamicProgramming ( )
inlinevirtual

Definition at line 203 of file trws_subproblemsolver.hxx.

Member Function Documentation

template<class GM, class ACC, class InputIterator>
virtual void opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_BackUpForwardMarginals ( )
inlineprotectedvirtual

Definition at line 278 of file trws_subproblemsolver.hxx.

template<class GM , class ACC , class InputIterator >
void opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_ClearMessages ( UnaryFactor pbuffer = 0)
protected

Definition at line 776 of file trws_subproblemsolver.hxx.

+ Here is the call graph for this function:

template<class GM , class ACC , class InputIterator >
void opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_core_InitMoves ( ValueType  rho,
MoveDirection  movedirection 
)
protected

Definition at line 873 of file trws_subproblemsolver.hxx.

+ Here is the caller graph for this function:

template<class GM , class ACC , class InputIterator >
DynamicProgramming< GM, ACC, InputIterator >::IndexType opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_core_next ( IndexType  begin,
MoveDirection  dir 
) const
protected

Definition at line 663 of file trws_subproblemsolver.hxx.

template<class GM , class ACC , class InputIterator >
void opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_InitCurrentUnaryBuffer ( IndexType  index)
protectedvirtual
template<class GM , class ACC , class InputIterator >
void opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_InitMove ( ValueType  rho,
MoveDirection  movedirection 
)
protected

>initializes move, which is reverse to the current one

Definition at line 888 of file trws_subproblemsolver.hxx.

+ Here is the caller graph for this function:

template<class GM, class ACC, class InputIterator>
void opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_InitReverseMoveBack ( )
inlineprotected

Definition at line 270 of file trws_subproblemsolver.hxx.

template<class GM , class ACC , class InputIterator >
void opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_makeLocalCopyOfPWFactor ( LabelType  trgsize)
protectedvirtual
template<class GM , class ACC , class InputIterator >
DynamicProgramming< GM, ACC, InputIterator >::IndexType opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_next ( IndexType  begin) const
protected

Definition at line 679 of file trws_subproblemsolver.hxx.

template<class GM , class ACC , class InputIterator >
DynamicProgramming< GM, ACC, InputIterator >::IndexType opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_nextPWIndex ( ) const
protected

Definition at line 696 of file trws_subproblemsolver.hxx.

template<class GM , class ACC , class InputIterator >
void opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_PottsUnaryTransform ( LabelType  newSize,
const typename FactorProperties::ParameterStorageType &  params 
)
protected

if anti-Potts model

if anti-Potts model

Definition at line 405 of file trws_subproblemsolver.hxx.

+ Here is the call graph for this function:

template<class GM , class ACC , class InputIterator >
DynamicProgramming< GM, ACC, InputIterator >::IndexType opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_previous ( IndexType  begin) const
protected

Definition at line 686 of file trws_subproblemsolver.hxx.

template<class GM , class ACC , class InputIterator >
void opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_Push ( )
protectedvirtual
template<class GM , class ACC , class InputIterator >
void opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_PushMessagesToFactor ( )
protected

Definition at line 719 of file trws_subproblemsolver.hxx.

+ Here is the call graph for this function:

template<class GM , class ACC , class InputIterator >
void opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_SumUpBufferToMarginals ( )
protected

Definition at line 817 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
virtual ValueType opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::ComputeObjectiveValue ( )
pure virtual
template<class GM, class ACC, class InputIterator>
template<class ITERATOR >
ValueType opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::evaluate ( ITERATOR  labeling)
inline

Definition at line 256 of file trws_subproblemsolver.hxx.

template<class GM , class ACC , class InputIterator >
void opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::FinalizeMove ( )
virtual
template<class GM, class ACC, class InputIterator>
const_iterators_pair opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::GetMarginals ( ) const
inline

Returns NON-normalized marginals ...(logSumProd or maxSum marginals)

Definition at line 226 of file trws_subproblemsolver.hxx.

+ Here is the caller graph for this function:

template<class GM, class ACC, class InputIterator>
const_iterators_pair opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::GetMarginals ( IndexType  indx) const
inline

Definition at line 227 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
MoveDirection opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::getMoveDirection ( ) const
inline

returns an external (_gm[.]) pairwise index, which is in front of the current variable. For the first variable this::NaN is returned

Definition at line 253 of file trws_subproblemsolver.hxx.

template<class GM , class ACC , class InputIterator >
DynamicProgramming< GM, ACC, InputIterator >::IndexType opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::getNextPWId ( ) const
virtual

updates marginals in the current node so, that they correspond to the forward (backward) accumulated probabilities of labels

Definition at line 926 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
ValueType opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::GetObjectiveValue ( ) const
inline

Definition at line 229 of file trws_subproblemsolver.hxx.

+ Here is the caller graph for this function:

template<class GM , class ACC , class InputIterator >
DynamicProgramming< GM, ACC, InputIterator >::IndexType opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::getPrevPWId ( ) const
virtual

returns an external (_gm[.]) pairwise index, which follows the current variable. For the last variable this::NaN is returned

Definition at line 914 of file trws_subproblemsolver.hxx.

template<class GM , class ACC , class InputIterator >
void opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::IncreaseUnaryWeights ( InputIteratorType  begin,
InputIteratorType  end 
)
virtual

Definition at line 904 of file trws_subproblemsolver.hxx.

+ Here is the call graph for this function:

template<class GM, class ACC, class InputIterator>
void opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::InitMove ( )
inline

Inference: usage: InitMove(rho);//once initialize smoothing value

then

Move();/MoveBack(); parent::_moveDirection or

PushBack();....PushBack();FinalizeMove();

Definition at line 217 of file trws_subproblemsolver.hxx.

+ Here is the caller graph for this function:

template<class GM, class ACC, class InputIterator>
void opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::InitMove ( MoveDirection  movedirection)
inline

Definition at line 218 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
virtual void opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::InitReverseMove ( )
inlinevirtual

Definition at line 219 of file trws_subproblemsolver.hxx.

template<class GM , class ACC , class InputIterator >
void opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::Move ( )
virtual

>initializes move, which is reverse to the current one//TODO: remove virtual ?

Definition at line 826 of file trws_subproblemsolver.hxx.

+ Here is the caller graph for this function:

template<class GM , class ACC , class InputIterator >
void opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::MoveBack ( )
virtual

performs size() steps with PushBack();

Definition at line 863 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
LabelType opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::numOfLabels ( ) const
inline

Returns number of labels in the current node

Definition at line 247 of file trws_subproblemsolver.hxx.

template<class GM , class ACC , class InputIterator >
void opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::PushBack ( )
virtual

performs a single step of the move and sums up corresponding fw-bk marginals

Definition at line 848 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
void opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::SetFastComputation ( bool  fc)
inline

Tests

Definition at line 264 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
IndexType opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::size ( ) const
inline

Definition at line 254 of file trws_subproblemsolver.hxx.

template<class GM , class ACC , class InputIterator >
void opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::UpdateMarginals ( )
virtual

Definition at line 811 of file trws_subproblemsolver.hxx.

Member Data Documentation

template<class GM, class ACC, class InputIterator>
bool opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_bInitializationNeeded
protected

Definition at line 295 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
UnaryFactor opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_currentPWFactor
protected

Definition at line 298 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
UnaryFactor opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_currentUnaryFactor
protected

Definition at line 299 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
IndexType opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_currentUnaryIndex
protected

Definition at line 300 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
const FactorProperties& opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_factorProperties
protected

Definition at line 288 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
bool opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_fastComputation
protected

Definition at line 286 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
std::vector<UnaryFactor> opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_marginals
protected

Definition at line 290 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
MoveDirection opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_moveDirection
protected

Definition at line 294 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
ValueType opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_objectiveValue
protected

Definition at line 292 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
ValueType opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_rho
protected

Definition at line 293 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
Pseudo2DArray<ValueType> opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_spst
mutableprotected

Definition at line 303 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
Storage& opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_storage
protected

Definition at line 287 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
UnaryFactor opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::_unaryTemp
mutableprotected

Definition at line 302 of file trws_subproblemsolver.hxx.

template<class GM, class ACC, class InputIterator>
const DynamicProgramming< GM, ACC, InputIterator >::IndexType opengm::trws_base::DynamicProgramming< GM, ACC, InputIterator >::NaN =std::numeric_limits<IndexType>::max()
static

Definition at line 199 of file trws_subproblemsolver.hxx.