#include <trws_subproblemsolver.hxx>
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< IndexList > | IndexTable |
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 ? | |
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 | |
virtual IndexType | getPrevPWId () const |
> returns an external (_gm[.]) pairwise index, which follows the current variable. For the last variable this::NaN is returned | |
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 | |
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 ¶ms) |
void | _InitReverseMoveBack () |
void | _InitMove (ValueType rho, MoveDirection movedirection) |
>initializes move, which is reverse to the current one | |
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 |
Definition at line 171 of file trws_subproblemsolver.hxx.
typedef ACC trws_base::DynamicProgramming< GM, ACC, InputIterator >::ACCType |
Definition at line 175 of file trws_subproblemsolver.hxx.
typedef std::pair<typename UnaryFactor::const_iterator,typename UnaryFactor::const_iterator> trws_base::DynamicProgramming< GM, ACC, InputIterator >::const_iterators_pair |
Reimplemented in trws_base::SumProdSolver< GM, ACC, InputIterator >, and trws_base::SumProdSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >.
Definition at line 189 of file trws_subproblemsolver.hxx.
typedef UnaryFactor::const_iterator trws_base::DynamicProgramming< GM, ACC, InputIterator >::ConstIterator |
Definition at line 187 of file trws_subproblemsolver.hxx.
typedef GM::FactorType trws_base::DynamicProgramming< GM, ACC, InputIterator >::Factor |
Reimplemented in trws_base::MaxSumSolver< GM, ACC, InputIterator >, and trws_base::MaxSumSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >.
Definition at line 188 of file trws_subproblemsolver.hxx.
typedef FunctionParameters<GM> trws_base::DynamicProgramming< GM, ACC, InputIterator >::FactorProperties |
Reimplemented in trws_base::MaxSumSolver< GM, ACC, InputIterator >, trws_base::SumProdSolver< GM, ACC, InputIterator >, trws_base::MaxSumSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >, and trws_base::SumProdSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >.
Definition at line 186 of file trws_subproblemsolver.hxx.
typedef GM trws_base::DynamicProgramming< GM, ACC, InputIterator >::GMType |
Definition at line 174 of file trws_subproblemsolver.hxx.
typedef Storage::IndexList trws_base::DynamicProgramming< GM, ACC, InputIterator >::IndexList |
Definition at line 182 of file trws_subproblemsolver.hxx.
typedef std::vector<IndexList> trws_base::DynamicProgramming< GM, ACC, InputIterator >::IndexTable |
Definition at line 185 of file trws_subproblemsolver.hxx.
typedef GM::IndexType trws_base::DynamicProgramming< GM, ACC, InputIterator >::IndexType |
Reimplemented in trws_base::MaxSumSolver< GM, ACC, InputIterator >, trws_base::SumProdSolver< GM, ACC, InputIterator >, trws_base::MaxSumSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >, and trws_base::SumProdSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >.
Definition at line 177 of file trws_subproblemsolver.hxx.
typedef InputIterator trws_base::DynamicProgramming< GM, ACC, InputIterator >::InputIteratorType |
Reimplemented in trws_base::MaxSumSolver< GM, ACC, InputIterator >, trws_base::SumProdSolver< GM, ACC, InputIterator >, trws_base::MaxSumSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >, and trws_base::SumProdSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >.
Definition at line 180 of file trws_subproblemsolver.hxx.
typedef GM::LabelType trws_base::DynamicProgramming< GM, ACC, InputIterator >::LabelType |
Reimplemented in trws_base::MaxSumSolver< GM, ACC, InputIterator >, trws_base::SumProdSolver< GM, ACC, InputIterator >, trws_base::MaxSumSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >, and trws_base::SumProdSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >.
Definition at line 178 of file trws_subproblemsolver.hxx.
typedef Storage::MoveDirection trws_base::DynamicProgramming< GM, ACC, InputIterator >::MoveDirection |
Reimplemented in trws_base::SumProdSolver< GM, ACC, InputIterator >, and trws_base::SumProdSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >.
Definition at line 184 of file trws_subproblemsolver.hxx.
typedef SequenceStorage<GM> trws_base::DynamicProgramming< GM, ACC, InputIterator >::Storage |
Reimplemented in trws_base::SumProdSolver< GM, ACC, InputIterator >, and trws_base::SumProdSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >.
Definition at line 181 of file trws_subproblemsolver.hxx.
typedef Storage::UnaryFactor trws_base::DynamicProgramming< GM, ACC, InputIterator >::UnaryFactor |
Reimplemented in trws_base::MaxSumSolver< GM, ACC, InputIterator >, trws_base::SumProdSolver< GM, ACC, InputIterator >, trws_base::MaxSumSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >, and trws_base::SumProdSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >.
Definition at line 183 of file trws_subproblemsolver.hxx.
typedef GM::ValueType trws_base::DynamicProgramming< GM, ACC, InputIterator >::ValueType |
Reimplemented in trws_base::MaxSumSolver< GM, ACC, InputIterator >, trws_base::SumProdSolver< GM, ACC, InputIterator >, trws_base::MaxSumSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >, and trws_base::SumProdSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >.
Definition at line 176 of file trws_subproblemsolver.hxx.
trws_base::DynamicProgramming< GM, ACC, InputIterator >::DynamicProgramming | ( | Storage & | storage, | |
const FactorProperties & | factorProperties, | |||
bool | fastComputations = true | |||
) | [inline] |
virtual trws_base::DynamicProgramming< GM, ACC, InputIterator >::~DynamicProgramming | ( | ) | [inline, virtual] |
Definition at line 196 of file trws_subproblemsolver.hxx.
virtual void trws_base::DynamicProgramming< GM, ACC, InputIterator >::_BackUpForwardMarginals | ( | ) | [inline, protected, virtual] |
Definition at line 271 of file trws_subproblemsolver.hxx.
void trws_base::DynamicProgramming< GM, ACC, InputIterator >::_ClearMessages | ( | UnaryFactor * | pbuffer = 0 |
) | [inline, protected] |
Definition at line 738 of file trws_subproblemsolver.hxx.
void trws_base::DynamicProgramming< GM, ACC, InputIterator >::_core_InitMoves | ( | ValueType | rho, | |
MoveDirection | movedirection | |||
) | [inline, protected] |
Definition at line 831 of file trws_subproblemsolver.hxx.
DynamicProgramming< GM, ACC, InputIterator >::IndexType trws_base::DynamicProgramming< GM, ACC, InputIterator >::_core_next | ( | IndexType | begin, | |
MoveDirection | dir | |||
) | const [inline, protected] |
Definition at line 646 of file trws_subproblemsolver.hxx.
void trws_base::DynamicProgramming< GM, ACC, InputIterator >::_InitCurrentUnaryBuffer | ( | IndexType | index | ) | [inline, protected, virtual] |
Reimplemented in trws_base::SumProdSolver< GM, ACC, InputIterator >, and trws_base::SumProdSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >.
Definition at line 720 of file trws_subproblemsolver.hxx.
void trws_base::DynamicProgramming< GM, ACC, InputIterator >::_InitMove | ( | ValueType | rho, | |
MoveDirection | movedirection | |||
) | [inline, protected] |
>initializes move, which is reverse to the current one
Definition at line 846 of file trws_subproblemsolver.hxx.
void trws_base::DynamicProgramming< GM, ACC, InputIterator >::_InitReverseMoveBack | ( | ) | [inline, protected] |
Definition at line 263 of file trws_subproblemsolver.hxx.
void trws_base::DynamicProgramming< GM, ACC, InputIterator >::_makeLocalCopyOfPWFactor | ( | LabelType | trgsize | ) | [inline, protected, virtual] |
Reimplemented in trws_base::SumProdSolver< GM, ACC, InputIterator >, and trws_base::SumProdSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >.
Definition at line 689 of file trws_subproblemsolver.hxx.
DynamicProgramming< GM, ACC, InputIterator >::IndexType trws_base::DynamicProgramming< GM, ACC, InputIterator >::_next | ( | IndexType | begin | ) | const [inline, protected] |
Definition at line 662 of file trws_subproblemsolver.hxx.
DynamicProgramming< GM, ACC, InputIterator >::IndexType trws_base::DynamicProgramming< GM, ACC, InputIterator >::_nextPWIndex | ( | ) | const [inline, protected] |
Definition at line 679 of file trws_subproblemsolver.hxx.
void trws_base::DynamicProgramming< GM, ACC, InputIterator >::_PottsUnaryTransform | ( | LabelType | newSize, | |
const typename FactorProperties::ParameterStorageType & | params | |||
) | [inline, protected] |
> if anti-Potts model
> if anti-Potts model
Definition at line 398 of file trws_subproblemsolver.hxx.
DynamicProgramming< GM, ACC, InputIterator >::IndexType trws_base::DynamicProgramming< GM, ACC, InputIterator >::_previous | ( | IndexType | begin | ) | const [inline, protected] |
Definition at line 669 of file trws_subproblemsolver.hxx.
void trws_base::DynamicProgramming< GM, ACC, InputIterator >::_Push | ( | ) | [inline, protected, virtual] |
Reimplemented in trws_base::MaxSumSolver< GM, ACC, InputIterator >, trws_base::SumProdSolver< GM, ACC, InputIterator >, trws_base::MaxSumSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >, and trws_base::SumProdSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >.
Definition at line 758 of file trws_subproblemsolver.hxx.
void trws_base::DynamicProgramming< GM, ACC, InputIterator >::_PushMessagesToFactor | ( | ) | [inline, protected] |
Definition at line 702 of file trws_subproblemsolver.hxx.
void trws_base::DynamicProgramming< GM, ACC, InputIterator >::_SumUpBufferToMarginals | ( | ) | [inline, protected] |
Definition at line 775 of file trws_subproblemsolver.hxx.
virtual ValueType trws_base::DynamicProgramming< GM, ACC, InputIterator >::ComputeObjectiveValue | ( | ) | [pure virtual] |
Implemented in trws_base::MaxSumSolver< GM, ACC, InputIterator >, trws_base::SumProdSolver< GM, ACC, InputIterator >, trws_base::MaxSumSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >, and trws_base::SumProdSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >.
ValueType trws_base::DynamicProgramming< GM, ACC, InputIterator >::evaluate | ( | ITERATOR | labeling | ) | [inline] |
Definition at line 249 of file trws_subproblemsolver.hxx.
void trws_base::DynamicProgramming< GM, ACC, InputIterator >::FinalizeMove | ( | ) | [inline, virtual] |
Reimplemented in trws_base::MaxSumSolver< GM, ACC, InputIterator >, and trws_base::MaxSumSolver< GM, ACC, std::vector< GM::ValueType >::const_iterator >.
Definition at line 854 of file trws_subproblemsolver.hxx.
const_iterators_pair trws_base::DynamicProgramming< GM, ACC, InputIterator >::GetMarginals | ( | IndexType | indx | ) | const [inline] |
Definition at line 220 of file trws_subproblemsolver.hxx.
const_iterators_pair trws_base::DynamicProgramming< GM, ACC, InputIterator >::GetMarginals | ( | ) | const [inline] |
Returns NON-normalized marginals ...(logSumProd or maxSum marginals)
Definition at line 219 of file trws_subproblemsolver.hxx.
MoveDirection 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 246 of file trws_subproblemsolver.hxx.
DynamicProgramming< GM, ACC, InputIterator >::IndexType trws_base::DynamicProgramming< GM, ACC, InputIterator >::getNextPWId | ( | ) | const [inline, virtual] |
> updates marginals in the current node so, that they correspond to the forward (backward) accumulated probabilities of labels
Definition at line 884 of file trws_subproblemsolver.hxx.
ValueType trws_base::DynamicProgramming< GM, ACC, InputIterator >::GetObjectiveValue | ( | ) | const [inline] |
Definition at line 222 of file trws_subproblemsolver.hxx.
DynamicProgramming< GM, ACC, InputIterator >::IndexType trws_base::DynamicProgramming< GM, ACC, InputIterator >::getPrevPWId | ( | ) | const [inline, virtual] |
> returns an external (_gm[.]) pairwise index, which follows the current variable. For the last variable this::NaN is returned
Definition at line 872 of file trws_subproblemsolver.hxx.
void trws_base::DynamicProgramming< GM, ACC, InputIterator >::IncreaseUnaryWeights | ( | InputIteratorType | begin, | |
InputIteratorType | end | |||
) | [inline, virtual] |
void trws_base::DynamicProgramming< GM, ACC, InputIterator >::InitMove | ( | MoveDirection | movedirection | ) | [inline] |
Definition at line 211 of file trws_subproblemsolver.hxx.
void 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 210 of file trws_subproblemsolver.hxx.
virtual void trws_base::DynamicProgramming< GM, ACC, InputIterator >::InitReverseMove | ( | ) | [inline, virtual] |
Definition at line 212 of file trws_subproblemsolver.hxx.
void trws_base::DynamicProgramming< GM, ACC, InputIterator >::Move | ( | ) | [inline, virtual] |
>initializes move, which is reverse to the current one//TODO: remove virtual ?
Definition at line 784 of file trws_subproblemsolver.hxx.
void trws_base::DynamicProgramming< GM, ACC, InputIterator >::MoveBack | ( | ) | [inline, virtual] |
performs size() steps with PushBack();
Definition at line 821 of file trws_subproblemsolver.hxx.
LabelType trws_base::DynamicProgramming< GM, ACC, InputIterator >::numOfLabels | ( | ) | const [inline] |
Returns number of labels in the current node
Definition at line 240 of file trws_subproblemsolver.hxx.
void trws_base::DynamicProgramming< GM, ACC, InputIterator >::PushBack | ( | ) | [inline, virtual] |
performs a single step of the move and sums up corresponding fw-bk marginals
Definition at line 806 of file trws_subproblemsolver.hxx.
void trws_base::DynamicProgramming< GM, ACC, InputIterator >::SetFastComputation | ( | bool | fc | ) | [inline] |
Tests
Definition at line 257 of file trws_subproblemsolver.hxx.
IndexType trws_base::DynamicProgramming< GM, ACC, InputIterator >::size | ( | ) | const [inline] |
Definition at line 247 of file trws_subproblemsolver.hxx.
void trws_base::DynamicProgramming< GM, ACC, InputIterator >::UpdateMarginals | ( | ) | [inline, virtual] |
Definition at line 769 of file trws_subproblemsolver.hxx.
bool trws_base::DynamicProgramming< GM, ACC, InputIterator >::_bInitializationNeeded [protected] |
Definition at line 288 of file trws_subproblemsolver.hxx.
UnaryFactor trws_base::DynamicProgramming< GM, ACC, InputIterator >::_currentPWFactor [protected] |
Definition at line 291 of file trws_subproblemsolver.hxx.
UnaryFactor trws_base::DynamicProgramming< GM, ACC, InputIterator >::_currentUnaryFactor [protected] |
Definition at line 292 of file trws_subproblemsolver.hxx.
IndexType trws_base::DynamicProgramming< GM, ACC, InputIterator >::_currentUnaryIndex [protected] |
Definition at line 293 of file trws_subproblemsolver.hxx.
const FactorProperties& trws_base::DynamicProgramming< GM, ACC, InputIterator >::_factorProperties [protected] |
Definition at line 281 of file trws_subproblemsolver.hxx.
bool trws_base::DynamicProgramming< GM, ACC, InputIterator >::_fastComputation [protected] |
Definition at line 279 of file trws_subproblemsolver.hxx.
std::vector<UnaryFactor> trws_base::DynamicProgramming< GM, ACC, InputIterator >::_marginals [protected] |
Definition at line 283 of file trws_subproblemsolver.hxx.
MoveDirection trws_base::DynamicProgramming< GM, ACC, InputIterator >::_moveDirection [protected] |
Definition at line 287 of file trws_subproblemsolver.hxx.
ValueType trws_base::DynamicProgramming< GM, ACC, InputIterator >::_objectiveValue [protected] |
Definition at line 285 of file trws_subproblemsolver.hxx.
ValueType trws_base::DynamicProgramming< GM, ACC, InputIterator >::_rho [protected] |
Definition at line 286 of file trws_subproblemsolver.hxx.
Pseudo2DArray<ValueType> trws_base::DynamicProgramming< GM, ACC, InputIterator >::_spst [mutable, protected] |
Definition at line 296 of file trws_subproblemsolver.hxx.
Storage& trws_base::DynamicProgramming< GM, ACC, InputIterator >::_storage [protected] |
Definition at line 280 of file trws_subproblemsolver.hxx.
UnaryFactor trws_base::DynamicProgramming< GM, ACC, InputIterator >::_unaryTemp [mutable, protected] |
Definition at line 295 of file trws_subproblemsolver.hxx.
const DynamicProgramming< GM, ACC, InputIterator >::IndexType trws_base::DynamicProgramming< GM, ACC, InputIterator >::NaN = std::numeric_limits<IndexType>::max() [inline, static] |
Definition at line 192 of file trws_subproblemsolver.hxx.