OpenGM  2.3.x
Discrete Graphical Model Library
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
opengm::external::MRFLIB< GM > Class Template Reference

MRFLIB MRFLIB inference algorithm class. More...

#include <mrflib.hxx>

+ Inheritance diagram for opengm::external::MRFLIB< GM >:
+ Collaboration diagram for opengm::external::MRFLIB< GM >:

Classes

struct  Parameter
 Parameter. More...
 

Public Types

typedef GM GraphicalModelType
 
typedef opengm::Minimizer AccumulationType
 
typedef visitors::VerboseVisitor< MRFLIB< GM > > VerboseVisitorType
 
typedef visitors::EmptyVisitor< MRFLIB< GM > > EmptyVisitorType
 
typedef visitors::TimingVisitor< MRFLIB< GM > > TimingVisitorType
 
typedef size_t VariableIndex
 
- Public Types inherited from opengm::Inference< GM, opengm::Minimizer >
typedef GM GraphicalModelType
 
typedef opengm::Minimizer AccumulationType
 
typedef GraphicalModelType::LabelType LabelType
 
typedef GraphicalModelType::IndexType IndexType
 
typedef GraphicalModelType::ValueType ValueType
 
typedef GraphicalModelType::OperatorType OperatorType
 
typedef GraphicalModelType::FactorType FactorType
 
typedef GraphicalModelType::IndependentFactorType IndependentFactorType
 
typedef GraphicalModelType::FunctionIdentifier FunctionIdentifier
 

Public Member Functions

 MRFLIB (const GraphicalModelType &gm, const Parameter &para=Parameter())
 
 ~MRFLIB ()
 
std::string name () const
 
const GraphicalModelTypegraphicalModel () const
 
template<class VISITOR >
InferenceTermination infer (VISITOR &visitor)
 
InferenceTermination infer ()
 
InferenceTermination arg (std::vector< LabelType > &, const size_t &=1) const
 
GM::ValueType bound () const
 return a bound on the solution More...
 
GM::ValueType value () const
 return the solution (value) More...
 
- Public Member Functions inherited from opengm::Inference< GM, opengm::Minimizer >
virtual ~Inference ()
 
virtual void setStartingPoint (typename std::vector< LabelType >::const_iterator)
 set initial labeling More...
 
virtual InferenceTermination arg (std::vector< LabelType > &, const size_t=1) const
 output a solution More...
 
virtual InferenceTermination args (std::vector< std::vector< LabelType > > &) const
 
virtual InferenceTermination marginal (const size_t, IndependentFactorType &) const
 output a solution for a marginal for a specific variable More...
 
virtual InferenceTermination factorMarginal (const size_t, IndependentFactorType &) const
 output a solution for a marginal for all variables connected to a factor More...
 
InferenceTermination constrainedOptimum (std::vector< IndexType > &, std::vector< LabelType > &, std::vector< LabelType > &) const
 
InferenceTermination modeFromMarginal (std::vector< LabelType > &) const
 
InferenceTermination modeFromFactorMarginal (std::vector< LabelType > &) const
 

Public Attributes

 OPENGM_GM_TYPE_TYPEDEFS
 

Protected Member Functions

void generateEnergyView ()
 
void generateEnergyTables ()
 
void generateEnergyTL1 ()
 
void generateEnergyTL2 ()
 
void generateEnergyWeightedTable ()
 
void setD ()
 
void setV ()
 
void setWeightedTableWeights ()
 
bool hasSameLabelNumber () const
 
bool sameEnergyTable () const
 
bool symmetricEnergyTable () const
 
bool valueCheck () const
 
void generateFirstOrderFactorLookupTable_ ()
 
void generateSecondOrderFactorLookupTables_ ()
 
ValueType getT (IndexType factor, ValueType e) const
 
bool sameT (ValueType T, ValueType e) const
 
void setWeights ()
 
bool equalWeights () const
 
bool truncatedAbsoluteDifferenceFactors () const
 
bool truncatedSquaredDifferenceFactors () const
 
void copyFactorValues ()
 

Static Protected Member Functions

static mrfLib::MRF::CostVal firstOrderFactorViewAccess (int pix, int i)
 
static mrfLib::MRF::CostVal secondOrderFactorViewAccess (int pix1, int pix2, int i, int j)
 
static mrfLib::MRF::CostVal firstOrderFactorTablesAccess (int pix, int i)
 
static mrfLib::MRF::CostVal secondOrderFactorTablesAccess (int pix1, int pix2, int i, int j)
 

Protected Attributes

const GraphicalModelTypegm_
 
IndexType sizeX_
 
IndexType sizeY_
 
IndexType numLabels_
 
marray::Matrix< size_tgrid_
 
Parameter parameter_
 
mrfLib::MRF * mrf_
 
mrfLib::MRF::CostVal * D_
 
mrfLib::MRF::CostVal * V_
 
mrfLib::MRF::CostVal * hCue_
 
mrfLib::MRF::CostVal * vCue_
 
mrfLib::DataCost * data_
 
mrfLib::SmoothnessCost * smooth_
 
mrfLib::EnergyFunction * energy_
 
std::vector< std::vector< IndexType > > firstOrderFactorLookupTable_
 
std::vector< std::vector< IndexType > > horizontalSecondOrderFactorLookupTable_
 
std::vector< std::vector< IndexType > > verticalSecondOrderFactorLookupTable_
 
std::vector< mrfLib::MRF::CostVal > firstOrderFactorValues
 
std::vector< mrfLib::MRF::CostVal > secondOrderFactorValues
 

Static Protected Attributes

static MRFLIB< GM > * mySelfView_ = NULL
 
static MRFLIB< GM > * mySelfTables_ = NULL
 
static const IndexType right_ = 0
 
static const IndexType down_ = 1
 

Detailed Description

template<class GM>
class opengm::external::MRFLIB< GM >

MRFLIB MRFLIB inference algorithm class.

Maximum factor order :2

Definition at line 36 of file mrflib.hxx.

Member Typedef Documentation

template<class GM>
typedef opengm::Minimizer opengm::external::MRFLIB< GM >::AccumulationType

Definition at line 39 of file mrflib.hxx.

Definition at line 42 of file mrflib.hxx.

template<class GM>
typedef GM opengm::external::MRFLIB< GM >::GraphicalModelType

Definition at line 38 of file mrflib.hxx.

Definition at line 43 of file mrflib.hxx.

template<class GM>
typedef size_t opengm::external::MRFLIB< GM >::VariableIndex

Definition at line 44 of file mrflib.hxx.

Definition at line 41 of file mrflib.hxx.

Constructor & Destructor Documentation

template<class GM>
opengm::external::MRFLIB< GM >::MRFLIB ( const GraphicalModelType gm,
const Parameter para = Parameter() 
)

Definition at line 148 of file mrflib.hxx.

+ Here is the call graph for this function:

template<class GM >
opengm::external::MRFLIB< GM >::~MRFLIB ( )

Definition at line 236 of file mrflib.hxx.

Member Function Documentation

template<class GM >
InferenceTermination opengm::external::MRFLIB< GM >::arg ( std::vector< LabelType > &  arg,
const size_t n = 1 
) const
inline

Definition at line 331 of file mrflib.hxx.

template<class GM >
GM::ValueType opengm::external::MRFLIB< GM >::bound ( ) const
inlinevirtual

return a bound on the solution

Reimplemented from opengm::Inference< GM, opengm::Minimizer >.

Definition at line 345 of file mrflib.hxx.

+ Here is the call graph for this function:

template<class GM >
void opengm::external::MRFLIB< GM >::copyFactorValues ( )
inlineprotected

Definition at line 840 of file mrflib.hxx.

template<class GM >
bool opengm::external::MRFLIB< GM >::equalWeights ( ) const
inlineprotected

Definition at line 820 of file mrflib.hxx.

template<class GM >
mrfLib::MRF::CostVal opengm::external::MRFLIB< GM >::firstOrderFactorTablesAccess ( int  pix,
int  i 
)
inlinestaticprotected

Definition at line 900 of file mrflib.hxx.

template<class GM >
mrfLib::MRF::CostVal opengm::external::MRFLIB< GM >::firstOrderFactorViewAccess ( int  pix,
int  i 
)
inlinestaticprotected

Definition at line 680 of file mrflib.hxx.

template<class GM >
void opengm::external::MRFLIB< GM >::generateEnergyTables ( )
inlineprotected

Definition at line 369 of file mrflib.hxx.

+ Here is the caller graph for this function:

template<class GM >
void opengm::external::MRFLIB< GM >::generateEnergyTL1 ( )
inlineprotected

Definition at line 378 of file mrflib.hxx.

+ Here is the caller graph for this function:

template<class GM >
void opengm::external::MRFLIB< GM >::generateEnergyTL2 ( )
inlineprotected

Definition at line 411 of file mrflib.hxx.

+ Here is the caller graph for this function:

template<class GM >
void opengm::external::MRFLIB< GM >::generateEnergyView ( )
inlineprotected

Definition at line 359 of file mrflib.hxx.

+ Here is the caller graph for this function:

template<class GM >
void opengm::external::MRFLIB< GM >::generateEnergyWeightedTable ( )
inlineprotected

Definition at line 444 of file mrflib.hxx.

+ Here is the caller graph for this function:

template<class GM >
void opengm::external::MRFLIB< GM >::generateFirstOrderFactorLookupTable_ ( )
inlineprotected

Definition at line 637 of file mrflib.hxx.

template<class GM >
void opengm::external::MRFLIB< GM >::generateSecondOrderFactorLookupTables_ ( )
inlineprotected

Definition at line 651 of file mrflib.hxx.

template<class GM >
GM::ValueType opengm::external::MRFLIB< GM >::getT ( IndexType  factor,
ValueType  e 
) const
inlineprotected

Definition at line 750 of file mrflib.hxx.

template<class GM >
const MRFLIB< GM >::GraphicalModelType & opengm::external::MRFLIB< GM >::graphicalModel ( ) const
inlinevirtual

Implements opengm::Inference< GM, opengm::Minimizer >.

Definition at line 274 of file mrflib.hxx.

template<class GM >
bool opengm::external::MRFLIB< GM >::hasSameLabelNumber ( ) const
inlineprotected

Definition at line 561 of file mrflib.hxx.

+ Here is the caller graph for this function:

template<class GM >
template<class VISITOR >
InferenceTermination opengm::external::MRFLIB< GM >::infer ( VISITOR &  visitor)
inline

Definition at line 286 of file mrflib.hxx.

template<class GM >
InferenceTermination opengm::external::MRFLIB< GM >::infer ( )
inlinevirtual

Implements opengm::Inference< GM, opengm::Minimizer >.

Definition at line 279 of file mrflib.hxx.

template<class GM >
std::string opengm::external::MRFLIB< GM >::name ( ) const
inlinevirtual

Implements opengm::Inference< GM, opengm::Minimizer >.

Definition at line 269 of file mrflib.hxx.

template<class GM >
bool opengm::external::MRFLIB< GM >::sameEnergyTable ( ) const
inlineprotected

Definition at line 571 of file mrflib.hxx.

template<class GM >
bool opengm::external::MRFLIB< GM >::sameT ( ValueType  T,
ValueType  e 
) const
inlineprotected

Definition at line 773 of file mrflib.hxx.

template<class GM >
mrfLib::MRF::CostVal opengm::external::MRFLIB< GM >::secondOrderFactorTablesAccess ( int  pix1,
int  pix2,
int  i,
int  j 
)
inlinestaticprotected

Definition at line 905 of file mrflib.hxx.

template<class GM >
mrfLib::MRF::CostVal opengm::external::MRFLIB< GM >::secondOrderFactorViewAccess ( int  pix1,
int  pix2,
int  i,
int  j 
)
inlinestaticprotected

Definition at line 691 of file mrflib.hxx.

template<class GM >
void opengm::external::MRFLIB< GM >::setD ( )
inlineprotected

Definition at line 466 of file mrflib.hxx.

template<class GM >
void opengm::external::MRFLIB< GM >::setV ( )
inlineprotected

Definition at line 486 of file mrflib.hxx.

template<class GM >
void opengm::external::MRFLIB< GM >::setWeightedTableWeights ( )
inlineprotected

Definition at line 504 of file mrflib.hxx.

template<class GM >
void opengm::external::MRFLIB< GM >::setWeights ( )
inlineprotected

Definition at line 787 of file mrflib.hxx.

template<class GM >
bool opengm::external::MRFLIB< GM >::symmetricEnergyTable ( ) const
inlineprotected

Definition at line 613 of file mrflib.hxx.

template<class GM >
bool opengm::external::MRFLIB< GM >::truncatedAbsoluteDifferenceFactors ( ) const
inlineprotected

Definition at line 726 of file mrflib.hxx.

template<class GM >
bool opengm::external::MRFLIB< GM >::truncatedSquaredDifferenceFactors ( ) const
inlineprotected

Definition at line 738 of file mrflib.hxx.

template<class GM >
GM::ValueType opengm::external::MRFLIB< GM >::value ( ) const
inlinevirtual

return the solution (value)

Reimplemented from opengm::Inference< GM, opengm::Minimizer >.

Definition at line 354 of file mrflib.hxx.

template<class GM >
bool opengm::external::MRFLIB< GM >::valueCheck ( ) const
inlineprotected

Definition at line 625 of file mrflib.hxx.

Member Data Documentation

template<class GM>
mrfLib::MRF::CostVal* opengm::external::MRFLIB< GM >::D_
protected

Definition at line 87 of file mrflib.hxx.

template<class GM>
mrfLib::DataCost* opengm::external::MRFLIB< GM >::data_
protected

Definition at line 91 of file mrflib.hxx.

template<class GM>
const IndexType opengm::external::MRFLIB< GM >::down_ = 1
staticprotected

Definition at line 136 of file mrflib.hxx.

template<class GM>
mrfLib::EnergyFunction* opengm::external::MRFLIB< GM >::energy_
protected

Definition at line 93 of file mrflib.hxx.

template<class GM>
std::vector<std::vector<IndexType> > opengm::external::MRFLIB< GM >::firstOrderFactorLookupTable_
protected

Definition at line 111 of file mrflib.hxx.

template<class GM>
std::vector<mrfLib::MRF::CostVal> opengm::external::MRFLIB< GM >::firstOrderFactorValues
protected

Definition at line 133 of file mrflib.hxx.

template<class GM>
const GraphicalModelType& opengm::external::MRFLIB< GM >::gm_
protected

Definition at line 80 of file mrflib.hxx.

template<class GM>
marray::Matrix<size_t> opengm::external::MRFLIB< GM >::grid_
protected

Definition at line 84 of file mrflib.hxx.

template<class GM>
mrfLib::MRF::CostVal* opengm::external::MRFLIB< GM >::hCue_
protected

Definition at line 89 of file mrflib.hxx.

template<class GM>
std::vector<std::vector<IndexType> > opengm::external::MRFLIB< GM >::horizontalSecondOrderFactorLookupTable_
protected

Definition at line 112 of file mrflib.hxx.

template<class GM>
mrfLib::MRF* opengm::external::MRFLIB< GM >::mrf_
protected

Definition at line 86 of file mrflib.hxx.

template<class GM>
MRFLIB< GM > * opengm::external::MRFLIB< GM >::mySelfTables_ = NULL
staticprotected

Definition at line 132 of file mrflib.hxx.

template<class GM>
MRFLIB< GM > * opengm::external::MRFLIB< GM >::mySelfView_ = NULL
staticprotected

Definition at line 110 of file mrflib.hxx.

template<class GM>
IndexType opengm::external::MRFLIB< GM >::numLabels_
protected

Definition at line 83 of file mrflib.hxx.

template<class GM>
opengm::external::MRFLIB< GM >::OPENGM_GM_TYPE_TYPEDEFS

Definition at line 40 of file mrflib.hxx.

template<class GM>
Parameter opengm::external::MRFLIB< GM >::parameter_
protected

Definition at line 85 of file mrflib.hxx.

template<class GM>
const IndexType opengm::external::MRFLIB< GM >::right_ = 0
staticprotected

Definition at line 135 of file mrflib.hxx.

template<class GM>
std::vector<mrfLib::MRF::CostVal> opengm::external::MRFLIB< GM >::secondOrderFactorValues
protected

Definition at line 134 of file mrflib.hxx.

template<class GM>
IndexType opengm::external::MRFLIB< GM >::sizeX_
protected

Definition at line 81 of file mrflib.hxx.

template<class GM>
IndexType opengm::external::MRFLIB< GM >::sizeY_
protected

Definition at line 82 of file mrflib.hxx.

template<class GM>
mrfLib::SmoothnessCost* opengm::external::MRFLIB< GM >::smooth_
protected

Definition at line 92 of file mrflib.hxx.

template<class GM>
mrfLib::MRF::CostVal* opengm::external::MRFLIB< GM >::V_
protected

Definition at line 88 of file mrflib.hxx.

template<class GM>
mrfLib::MRF::CostVal* opengm::external::MRFLIB< GM >::vCue_
protected

Definition at line 90 of file mrflib.hxx.

template<class GM>
std::vector<std::vector<IndexType> > opengm::external::MRFLIB< GM >::verticalSecondOrderFactorLookupTable_
protected

Definition at line 113 of file mrflib.hxx.