OpenGM  2.3.x
Discrete Graphical Model Library
Public Types | Public Member Functions | List of all members
SubmodelCGC< GM > Class Template Reference

#include <submodel2.hxx>

+ Inheritance diagram for SubmodelCGC< GM >:
+ Collaboration diagram for SubmodelCGC< GM >:

Public Types

enum  Mode { SingleSubset, TwoSubsets }
 
typedef GM::ValueType ValueType
 
typedef GM::IndexType IndexType
 
typedef GM::LabelType LabelType
 
typedef std::vector< ValueTypeValueVector
 
typedef std::vector< double > DoubleVector
 
typedef std::vector< IndexTypeIndexVector
 
typedef std::vector< LabelTypeLabelVector
 
typedef std::vector< boolBoolVector
 
typedef std::vector< unsigned char > PseudoBoolVector
 
typedef std::pair< int, ValueTypeIVPairType
 
typedef std::pair< size_t, size_tEdge
 
typedef std::pair< Edge, size_tEdgeMapEntry
 
typedef boost::unordered_map< Edge, size_tEdgeMap
 

Public Member Functions

 SubmodelCGC (const GM &gm, const IndexType maxBruteForceSize2, const IndexType maxBruteForceSize4, const bool useBfs)
 
ValueType inferMulticut (Mode mode)
 
ValueType inferQPBOI (Mode mode)
 
ValueType inferPlanarMaxCut ()
 
ValueType inferBruteForce2 ()
 
ValueType inferBruteForce4 ()
 
template<class ARG >
IVPairType inferSubset (ARG &globalArg, const LabelType colorCC, const IndexType viCC, IndexType offset, std::deque< IndexType > &deque, const bool planar, bool verbose=false)
 
template<class ARG >
IVPairType infer2Subsets (ARG &globalArg, const LabelType colorCC0, const LabelType colorCC1, const IndexType viCC0, const IndexType viCC1, IndexType offset, const bool planar=true)
 
void updateDirtyness (std::vector< unsigned char > &dirtyFactors, const bool changes)
 
void cleanInsideAndBorder ()
 
template<class ARG >
SubmodelCGC< GM >::IVPairType infer2Subsets (ARG &globalArg, typename SubmodelCGC< GM >::LabelType colorCC0, typename SubmodelCGC< GM >::LabelType colorCC1, const typename SubmodelCGC< GM >::IndexType viCC0, const typename SubmodelCGC< GM >::IndexType viCC1, typename SubmodelCGC< GM >::IndexType offset, const bool planar)
 
template<class ARG >
SubmodelCGC< GM >::IVPairType inferSubset (ARG &globalArg, typename SubmodelCGC< GM >::LabelType colorCC, typename SubmodelCGC< GM >::IndexType viCC, typename SubmodelCGC< GM >::IndexType offset, std::deque< typename SubmodelCGC< GM >::IndexType > &deque, const bool planar, bool verbose)
 
template<class ARG >
void setSubVarImplicit (const ARG &arg, const typename SubmodelCGC< GM >::LabelType ccColor, const typename SubmodelCGC< GM >::IndexType vi)
 
template<class ARG >
void setSubVarImplicitBfs (const ARG &arg, const typename SubmodelCGC< GM >::LabelType ccColor, const typename SubmodelCGC< GM >::IndexType vi)
 
template<class ARG >
void setSubVarImplicit (const ARG &arg, const typename SubmodelCGC< GM >::LabelType ccColor0, const typename SubmodelCGC< GM >::LabelType ccColor1, const typename SubmodelCGC< GM >::IndexType vi0, const typename SubmodelCGC< GM >::IndexType vi1)
 
template<class ARG >
void setSubVarImplicitBfs (const ARG &arg, const typename SubmodelCGC< GM >::LabelType ccColor0, const typename SubmodelCGC< GM >::LabelType ccColor1, const typename SubmodelCGC< GM >::IndexType vi0, const typename SubmodelCGC< GM >::IndexType vi1)
 

Detailed Description

template<class GM>
class SubmodelCGC< GM >

Definition at line 32 of file submodel2.hxx.

Member Typedef Documentation

template<class GM>
typedef std::vector<bool> SubmodelCGC< GM >::BoolVector

Definition at line 42 of file submodel2.hxx.

template<class GM>
typedef std::vector<double > SubmodelCGC< GM >::DoubleVector

Definition at line 39 of file submodel2.hxx.

template<class GM>
typedef std::pair<size_t,size_t> SubmodelCGC< GM >::Edge

Definition at line 48 of file submodel2.hxx.

template<class GM>
typedef boost::unordered_map<Edge,size_t> SubmodelCGC< GM >::EdgeMap

Definition at line 50 of file submodel2.hxx.

template<class GM>
typedef std::pair<Edge, size_t> SubmodelCGC< GM >::EdgeMapEntry

Definition at line 49 of file submodel2.hxx.

template<class GM>
typedef GM::IndexType SubmodelCGC< GM >::IndexType

Definition at line 35 of file submodel2.hxx.

template<class GM>
typedef std::vector<IndexType> SubmodelCGC< GM >::IndexVector

Definition at line 40 of file submodel2.hxx.

template<class GM>
typedef std::pair<int,ValueType> SubmodelCGC< GM >::IVPairType

Definition at line 45 of file submodel2.hxx.

template<class GM>
typedef GM::LabelType SubmodelCGC< GM >::LabelType

Definition at line 36 of file submodel2.hxx.

template<class GM>
typedef std::vector<LabelType> SubmodelCGC< GM >::LabelVector

Definition at line 41 of file submodel2.hxx.

template<class GM>
typedef std::vector<unsigned char> SubmodelCGC< GM >::PseudoBoolVector

Definition at line 43 of file submodel2.hxx.

template<class GM>
typedef GM::ValueType SubmodelCGC< GM >::ValueType

Definition at line 34 of file submodel2.hxx.

template<class GM>
typedef std::vector<ValueType> SubmodelCGC< GM >::ValueVector

Definition at line 38 of file submodel2.hxx.

Member Enumeration Documentation

template<class GM>
enum SubmodelCGC::Mode
Enumerator
SingleSubset 
TwoSubsets 

Definition at line 52 of file submodel2.hxx.

Constructor & Destructor Documentation

template<class GM>
SubmodelCGC< GM >::SubmodelCGC ( const GM &  gm,
const IndexType  maxBruteForceSize2,
const IndexType  maxBruteForceSize4,
const bool  useBfs 
)
inline

Definition at line 638 of file submodel2.hxx.

+ Here is the call graph for this function:

Member Function Documentation

template<class GM>
void SubmodelCGC< GM >::cleanInsideAndBorder ( )
inline

Definition at line 199 of file submodel2.hxx.

template<class GM>
template<class ARG >
IVPairType SubmodelCGC< GM >::infer2Subsets ( ARG &  globalArg,
const LabelType  colorCC0,
const LabelType  colorCC1,
const IndexType  viCC0,
const IndexType  viCC1,
IndexType  offset,
const bool  planar = true 
)

globalArg: length #nodes of full model colorCC0, color of two neighboring CCs for which we want to run inference again colorCC1 offset: needed to disambiguate colors w.r.t. rest of the nodes

template<class GM>
template<class ARG >
SubmodelCGC<GM>::IVPairType SubmodelCGC< GM >::infer2Subsets ( ARG &  globalArg,
typename SubmodelCGC< GM >::LabelType  colorCC0,
typename SubmodelCGC< GM >::LabelType  colorCC1,
const typename SubmodelCGC< GM >::IndexType  viCC0,
const typename SubmodelCGC< GM >::IndexType  viCC1,
typename SubmodelCGC< GM >::IndexType  offset,
const bool  planar 
)

Definition at line 306 of file submodel2.hxx.

template<class GM >
GM::ValueType SubmodelCGC< GM >::inferBruteForce2 ( )

Definition at line 839 of file submodel2.hxx.

template<class GM >
GM::ValueType SubmodelCGC< GM >::inferBruteForce4 ( )

Definition at line 870 of file submodel2.hxx.

template<class GM >
SubmodelCGC< GM >::ValueType SubmodelCGC< GM >::inferMulticut ( Mode  mode)

Definition at line 715 of file submodel2.hxx.

+ Here is the call graph for this function:

template<class GM >
SubmodelCGC< GM >::ValueType SubmodelCGC< GM >::inferPlanarMaxCut ( )

Definition at line 810 of file submodel2.hxx.

template<class GM >
SubmodelCGC< GM >::ValueType SubmodelCGC< GM >::inferQPBOI ( Mode  mode)

Definition at line 764 of file submodel2.hxx.

template<class GM>
template<class ARG >
IVPairType SubmodelCGC< GM >::inferSubset ( ARG &  globalArg,
const LabelType  colorCC,
const IndexType  viCC,
IndexType  offset,
std::deque< IndexType > &  deque,
const bool  planar,
bool  verbose = false 
)

globalArg: length #nodes of full model colorCC: color of CC for which we want to run inference offset: needed to disambiguate colors w.r.t. rest of the nodes deque: After running infer, the region decomposes into N connected components. Then, deque.size() += N, and deque[prevSize()+i] is a representative node label of connected component i

template<class GM>
template<class ARG >
SubmodelCGC<GM>::IVPairType SubmodelCGC< GM >::inferSubset ( ARG &  globalArg,
typename SubmodelCGC< GM >::LabelType  colorCC,
typename SubmodelCGC< GM >::IndexType  viCC,
typename SubmodelCGC< GM >::IndexType  offset,
std::deque< typename SubmodelCGC< GM >::IndexType > &  deque,
const bool  planar,
bool  verbose 
)

Definition at line 408 of file submodel2.hxx.

template<class GM>
template<class ARG >
void SubmodelCGC< GM >::setSubVarImplicit ( const ARG &  arg,
const typename SubmodelCGC< GM >::LabelType  ccColor,
const typename SubmodelCGC< GM >::IndexType  vi 
)

Definition at line 492 of file submodel2.hxx.

template<class GM>
template<class ARG >
void SubmodelCGC< GM >::setSubVarImplicit ( const ARG &  arg,
const typename SubmodelCGC< GM >::LabelType  ccColor0,
const typename SubmodelCGC< GM >::LabelType  ccColor1,
const typename SubmodelCGC< GM >::IndexType  vi0,
const typename SubmodelCGC< GM >::IndexType  vi1 
)

Definition at line 536 of file submodel2.hxx.

template<class GM>
template<class ARG >
void SubmodelCGC< GM >::setSubVarImplicitBfs ( const ARG &  arg,
const typename SubmodelCGC< GM >::LabelType  ccColor,
const typename SubmodelCGC< GM >::IndexType  vi 
)

Definition at line 513 of file submodel2.hxx.

template<class GM>
template<class ARG >
void SubmodelCGC< GM >::setSubVarImplicitBfs ( const ARG &  arg,
const typename SubmodelCGC< GM >::LabelType  ccColor0,
const typename SubmodelCGC< GM >::LabelType  ccColor1,
const typename SubmodelCGC< GM >::IndexType  vi0,
const typename SubmodelCGC< GM >::IndexType  vi1 
)

Definition at line 561 of file submodel2.hxx.

template<class GM>
void SubmodelCGC< GM >::updateDirtyness ( std::vector< unsigned char > &  dirtyFactors,
const bool  changes 
)
inline

changes: whether, in the optimization for the current submodel, there were any changes w.r.t to the previous solution stored for the global model (this is checked by energy only! FIXME: degenerate solutions?

dirtyFactors: current dirtyness per factor (global)

This function updates dirtyFactors according to this:

  • if a factor's variables are both in the subgraph, mark this factor as clean
  • if only a subset of the factor's variables are in the subgraph:
    • if changes, mark this factor as dirty
    • if no changes, do not change dirtyness

Definition at line 124 of file submodel2.hxx.