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
 
struct  RebindGm
 Parameter. More...
 
struct  RebindGmAndAcc
 

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

§ AccumulationType

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

Definition at line 39 of file mrflib.hxx.

§ EmptyVisitorType

Definition at line 42 of file mrflib.hxx.

§ GraphicalModelType

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

Definition at line 38 of file mrflib.hxx.

§ TimingVisitorType

Definition at line 43 of file mrflib.hxx.

§ VariableIndex

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

Definition at line 44 of file mrflib.hxx.

§ VerboseVisitorType

Definition at line 41 of file mrflib.hxx.

Constructor & Destructor Documentation

§ MRFLIB()

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

Definition at line 163 of file mrflib.hxx.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ ~MRFLIB()

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

Definition at line 251 of file mrflib.hxx.

+ Here is the caller graph for this function:

Member Function Documentation

§ arg()

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

Definition at line 346 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ bound()

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 360 of file mrflib.hxx.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ copyFactorValues()

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

Definition at line 855 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ equalWeights()

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

Definition at line 835 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ firstOrderFactorTablesAccess()

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

Definition at line 915 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ firstOrderFactorViewAccess()

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

Definition at line 695 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ generateEnergyTables()

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

Definition at line 384 of file mrflib.hxx.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ generateEnergyTL1()

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

Definition at line 393 of file mrflib.hxx.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ generateEnergyTL2()

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

Definition at line 426 of file mrflib.hxx.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ generateEnergyView()

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

Definition at line 374 of file mrflib.hxx.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ generateEnergyWeightedTable()

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

Definition at line 459 of file mrflib.hxx.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ generateFirstOrderFactorLookupTable_()

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

Definition at line 652 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ generateSecondOrderFactorLookupTables_()

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

Definition at line 666 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ getT()

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

Definition at line 765 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ graphicalModel()

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

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

Definition at line 289 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ hasSameLabelNumber()

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

Definition at line 576 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ infer() [1/2]

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

Definition at line 301 of file mrflib.hxx.

+ Here is the call graph for this function:

§ infer() [2/2]

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

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

Definition at line 294 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ name()

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

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

Definition at line 284 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ sameEnergyTable()

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

Definition at line 586 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ sameT()

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

Definition at line 788 of file mrflib.hxx.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ secondOrderFactorTablesAccess()

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

Definition at line 920 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ secondOrderFactorViewAccess()

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

Definition at line 706 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ setD()

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

Definition at line 481 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ setV()

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

Definition at line 501 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ setWeightedTableWeights()

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

Definition at line 519 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ setWeights()

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

Definition at line 802 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ symmetricEnergyTable()

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

Definition at line 628 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ truncatedAbsoluteDifferenceFactors()

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

Definition at line 741 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ truncatedSquaredDifferenceFactors()

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

Definition at line 753 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ value()

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 369 of file mrflib.hxx.

+ Here is the caller graph for this function:

§ valueCheck()

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

Definition at line 640 of file mrflib.hxx.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

§ D_

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

Definition at line 102 of file mrflib.hxx.

§ data_

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

Definition at line 106 of file mrflib.hxx.

§ down_

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

Definition at line 151 of file mrflib.hxx.

§ energy_

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

Definition at line 108 of file mrflib.hxx.

§ firstOrderFactorLookupTable_

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

Definition at line 126 of file mrflib.hxx.

§ firstOrderFactorValues

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

Definition at line 148 of file mrflib.hxx.

§ gm_

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

Definition at line 95 of file mrflib.hxx.

§ grid_

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

Definition at line 99 of file mrflib.hxx.

§ hCue_

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

Definition at line 104 of file mrflib.hxx.

§ horizontalSecondOrderFactorLookupTable_

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

Definition at line 127 of file mrflib.hxx.

§ mrf_

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

Definition at line 101 of file mrflib.hxx.

§ mySelfTables_

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

Definition at line 147 of file mrflib.hxx.

§ mySelfView_

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

Definition at line 125 of file mrflib.hxx.

§ numLabels_

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

Definition at line 98 of file mrflib.hxx.

§ OPENGM_GM_TYPE_TYPEDEFS

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

Definition at line 40 of file mrflib.hxx.

§ parameter_

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

Definition at line 100 of file mrflib.hxx.

§ right_

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

Definition at line 150 of file mrflib.hxx.

§ secondOrderFactorValues

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

Definition at line 149 of file mrflib.hxx.

§ sizeX_

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

Definition at line 96 of file mrflib.hxx.

§ sizeY_

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

Definition at line 97 of file mrflib.hxx.

§ smooth_

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

Definition at line 107 of file mrflib.hxx.

§ V_

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

Definition at line 103 of file mrflib.hxx.

§ vCue_

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

Definition at line 105 of file mrflib.hxx.

§ verticalSecondOrderFactorLookupTable_

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

Definition at line 128 of file mrflib.hxx.