ReadFramework
GCoptimization Class Referenceabstract

#include <GCoptimization.h>

Inheritance diagram for GCoptimization:
Collaboration diagram for GCoptimization:

Classes

struct  DataCostFnFromArray
 
struct  DataCostFnFromFunction
 
struct  DataCostFnFromFunctionExtra
 
class  DataCostFnSparse
 
struct  DataCostFunctor
 
class  GreedyIter< GCoptimization::DataCostFnSparse >
 
struct  LabelCost
 
struct  LabelCostIter
 
struct  SmoothCostFnFromArray
 
struct  SmoothCostFnFromFunction
 
struct  SmoothCostFnFromFunctionExtra
 
struct  SmoothCostFnPotts
 
struct  SmoothCostFunctor
 
struct  SparseDataCost
 

Public Types

typedef long long EnergyType
 
typedef int EnergyTermType
 
typedef Energy< EnergyTermType, EnergyTermType, EnergyTypeEnergyT
 
typedef EnergyT::Var VarID
 
typedef int LabelID
 
typedef VarID SiteID
 
typedef EnergyTermType(* SmoothCostFn) (SiteID s1, SiteID s2, LabelID l1, LabelID l2)
 
typedef EnergyTermType(* DataCostFn) (SiteID s, LabelID l)
 
typedef EnergyTermType(* SmoothCostFnExtra) (SiteID s1, SiteID s2, LabelID l1, LabelID l2, void *)
 
typedef EnergyTermType(* DataCostFnExtra) (SiteID s, LabelID l, void *)
 

Public Member Functions

 GCoptimization (SiteID num_sites, LabelID num_labels)
 
virtual ~GCoptimization ()
 
EnergyType expansion (int max_num_iterations=-1)
 
bool alpha_expansion (LabelID alpha_label)
 
EnergyType swap (int max_num_iterations=-1)
 
void alpha_beta_swap (LabelID alpha_label, LabelID beta_label)
 
void alpha_beta_swap (LabelID alpha_label, LabelID beta_label, SiteID *alphaSites, SiteID alpha_size, SiteID *betaSites, SiteID beta_size)
 
void setDataCost (DataCostFn fn)
 
void setDataCost (DataCostFnExtra fn, void *extraData)
 
void setDataCost (EnergyTermType *dataArray)
 
void setDataCost (SiteID s, LabelID l, EnergyTermType e)
 
void setDataCostFunctor (DataCostFunctor *f)
 
void setDataCost (LabelID l, SparseDataCost *costs, SiteID count)
 
void setSmoothCost (SmoothCostFn fn)
 
void setSmoothCost (SmoothCostFnExtra fn, void *extraData)
 
void setSmoothCost (LabelID l1, LabelID l2, EnergyTermType e)
 
void setSmoothCost (EnergyTermType *smoothArray)
 
void setSmoothCostFunctor (SmoothCostFunctor *f)
 
void setLabelCost (EnergyTermType cost)
 
void setLabelCost (EnergyTermType *costArray)
 
void setLabelSubsetCost (LabelID *labels, LabelID numLabels, EnergyTermType cost)
 
LabelID whatLabel (SiteID site)
 
void whatLabel (SiteID start, SiteID count, LabelID *labeling)
 
void setLabel (SiteID site, LabelID label)
 
void setLabelOrder (bool isRandom)
 
void setLabelOrder (const LabelID *order, LabelID size)
 
EnergyType compute_energy ()
 
EnergyType giveDataEnergy ()
 
EnergyType giveSmoothEnergy ()
 
EnergyType giveLabelEnergy ()
 
SiteID numSites () const
 
LabelID numLabels () const
 
void setVerbosity (int level)
 

Protected Member Functions

virtual void giveNeighborInfo (SiteID site, SiteID *numSites, SiteID **neighbors, EnergyTermType **weights)=0
 
virtual void finalizeNeighbors ()=0
 
template<typename DataCostT >
SiteID queryActiveSitesExpansion (LabelID alpha_label, SiteID *activeSites)
 
template<typename DataCostT >
void setupDataCostsExpansion (SiteID size, LabelID alpha_label, EnergyT *e, SiteID *activeSites)
 
template<typename DataCostT >
void setupDataCostsSwap (SiteID size, LabelID alpha_label, LabelID beta_label, EnergyT *e, SiteID *activeSites)
 
template<typename SmoothCostT >
void setupSmoothCostsExpansion (SiteID size, LabelID alpha_label, EnergyT *e, SiteID *activeSites)
 
template<typename SmoothCostT >
void setupSmoothCostsSwap (SiteID size, LabelID alpha_label, LabelID beta_label, EnergyT *e, SiteID *activeSites)
 
template<typename DataCostT >
void applyNewLabeling (EnergyT *e, SiteID *activeSites, SiteID size, LabelID alpha_label)
 
template<typename DataCostT >
void updateLabelingDataCosts ()
 
template<typename UserFunctor >
void specializeDataCostFunctor (const UserFunctor f)
 
template<typename UserFunctor >
void specializeSmoothCostFunctor (const UserFunctor f)
 
EnergyType setupLabelCostsExpansion (SiteID size, LabelID alpha_label, EnergyT *e, SiteID *activeSites)
 
void updateLabelingInfo (bool updateCounts=true, bool updateActive=true, bool updateCosts=true)
 
void addterm1_checked (EnergyT *e, VarID i, EnergyTermType e0, EnergyTermType e1)
 
void addterm1_checked (EnergyT *e, VarID i, EnergyTermType e0, EnergyTermType e1, EnergyTermType w)
 
void addterm2_checked (EnergyT *e, VarID i, VarID j, EnergyTermType e00, EnergyTermType e01, EnergyTermType e10, EnergyTermType e11, EnergyTermType w)
 
template<typename SmoothCostT >
EnergyType giveSmoothEnergyInternal ()
 

Static Protected Member Functions

template<typename Functor >
static void deleteFunctor (void *f)
 
static void handleError (const char *message)
 
static void checkInterrupt ()
 

Protected Attributes

LabelID m_num_labels
 
SiteID m_num_sites
 
LabelIDm_labeling
 
SiteIDm_lookupSiteVar
 
LabelIDm_labelTable
 
int m_stepsThisCycle
 
int m_stepsThisCycleTotal
 
int m_random_label_order
 
EnergyTermTypem_datacostIndividual
 
EnergyTermTypem_smoothcostIndividual
 
EnergyTermTypem_labelingDataCosts
 
SiteIDm_labelCounts
 
SiteIDm_activeLabelCounts
 
LabelCostm_labelcostsAll
 
LabelCostIter ** m_labelcostsByLabel
 
int m_labelcostCount
 
bool m_labelingInfoDirty
 
int m_verbosity
 
void * m_datacostFn
 
void * m_smoothcostFn
 
EnergyType m_beforeExpansionEnergy
 
SiteIDm_numNeighbors
 
SiteID m_numNeighborsTotal
 
EnergyType(GCoptimization::* m_giveSmoothEnergyInternal )()
 
SiteID(GCoptimization::* m_queryActiveSitesExpansion )(LabelID, SiteID *)
 
void(GCoptimization::* m_setupDataCostsExpansion )(SiteID, LabelID, EnergyT *, SiteID *)
 
void(GCoptimization::* m_setupSmoothCostsExpansion )(SiteID, LabelID, EnergyT *, SiteID *)
 
void(GCoptimization::* m_setupDataCostsSwap )(SiteID, LabelID, LabelID, EnergyT *, SiteID *)
 
void(GCoptimization::* m_setupSmoothCostsSwap )(SiteID, LabelID, LabelID, EnergyT *, SiteID *)
 
void(GCoptimization::* m_applyNewLabeling )(EnergyT *, SiteID *, SiteID, LabelID)
 
void(GCoptimization::* m_updateLabelingDataCosts )()
 
void(* m_datacostFnDelete )(void *f)
 
void(* m_smoothcostFnDelete )(void *f)
 
bool(GCoptimization::* m_solveSpecialCases )(EnergyType &)
 

Member Typedef Documentation

typedef EnergyTermType(* GCoptimization::DataCostFn) (SiteID s, LabelID l)
typedef EnergyTermType(* GCoptimization::DataCostFnExtra) (SiteID s, LabelID l, void *)
typedef long long GCoptimization::EnergyType
typedef EnergyTermType(* GCoptimization::SmoothCostFn) (SiteID s1, SiteID s2, LabelID l1, LabelID l2)
typedef EnergyTermType(* GCoptimization::SmoothCostFnExtra) (SiteID s1, SiteID s2, LabelID l1, LabelID l2, void *)

Constructor & Destructor Documentation

GCoptimization::GCoptimization ( SiteID  num_sites,
LabelID  num_labels 
)
GCoptimization::~GCoptimization ( )
virtual

Member Function Documentation

OLGA_INLINE void GCoptimization::addterm1_checked ( EnergyT e,
VarID  i,
EnergyTermType  e0,
EnergyTermType  e1 
)
protected

Here is the caller graph for this function:

OLGA_INLINE void GCoptimization::addterm1_checked ( EnergyT e,
VarID  i,
EnergyTermType  e0,
EnergyTermType  e1,
EnergyTermType  w 
)
protected
OLGA_INLINE void GCoptimization::addterm2_checked ( EnergyT e,
VarID  i,
VarID  j,
EnergyTermType  e00,
EnergyTermType  e01,
EnergyTermType  e10,
EnergyTermType  e11,
EnergyTermType  w 
)
protected

Here is the caller graph for this function:

void GCoptimization::alpha_beta_swap ( LabelID  alpha_label,
LabelID  beta_label 
)

Here is the caller graph for this function:

void GCoptimization::alpha_beta_swap ( LabelID  alpha_label,
LabelID  beta_label,
SiteID alphaSites,
SiteID  alpha_size,
SiteID betaSites,
SiteID  beta_size 
)
bool GCoptimization::alpha_expansion ( LabelID  alpha_label)

Here is the caller graph for this function:

template<typename DataCostT >
void GCoptimization::applyNewLabeling ( EnergyT e,
SiteID activeSites,
SiteID  size,
LabelID  alpha_label 
)
protected
void GCoptimization::checkInterrupt ( )
staticprotected

Here is the caller graph for this function:

GCoptimization::EnergyType GCoptimization::compute_energy ( )

Here is the caller graph for this function:

template<typename Functor >
static void GCoptimization::deleteFunctor ( void *  f)
inlinestaticprotected
GCoptimization::EnergyType GCoptimization::expansion ( int  max_num_iterations = -1)
virtual void GCoptimization::finalizeNeighbors ( )
protectedpure virtual

Implemented in GCoptimizationGeneralGraph, and GCoptimizationGridGraph.

Here is the caller graph for this function:

GCoptimization::EnergyType GCoptimization::giveDataEnergy ( )

Here is the caller graph for this function:

GCoptimization::EnergyType GCoptimization::giveLabelEnergy ( )

Here is the caller graph for this function:

virtual void GCoptimization::giveNeighborInfo ( SiteID  site,
SiteID numSites,
SiteID **  neighbors,
EnergyTermType **  weights 
)
protectedpure virtual

Implemented in GCoptimizationGridGraph.

Here is the caller graph for this function:

GCoptimization::EnergyType GCoptimization::giveSmoothEnergy ( )

Here is the caller graph for this function:

template<typename SmoothCostT >
GCoptimization::EnergyType GCoptimization::giveSmoothEnergyInternal ( )
protected
void GCoptimization::handleError ( const char *  message)
staticprotected

Here is the caller graph for this function:

OLGA_INLINE GCoptimization::LabelID GCoptimization::numLabels ( ) const

Here is the caller graph for this function:

OLGA_INLINE GCoptimization::SiteID GCoptimization::numSites ( ) const

Here is the caller graph for this function:

template<typename DataCostT >
GCoptimization::SiteID GCoptimization::queryActiveSitesExpansion ( LabelID  alpha_label,
SiteID activeSites 
)
protected

Here is the caller graph for this function:

void GCoptimization::setDataCost ( DataCostFn  fn)
void GCoptimization::setDataCost ( DataCostFnExtra  fn,
void *  extraData 
)
void GCoptimization::setDataCost ( EnergyTermType dataArray)
void GCoptimization::setDataCost ( SiteID  s,
LabelID  l,
EnergyTermType  e 
)
void GCoptimization::setDataCost ( LabelID  l,
SparseDataCost costs,
SiteID  count 
)
void GCoptimization::setDataCostFunctor ( DataCostFunctor f)
OLGA_INLINE void GCoptimization::setLabel ( SiteID  site,
LabelID  label 
)
void GCoptimization::setLabelCost ( EnergyTermType  cost)
void GCoptimization::setLabelCost ( EnergyTermType costArray)
void GCoptimization::setLabelOrder ( bool  isRandom)

Here is the caller graph for this function:

void GCoptimization::setLabelOrder ( const LabelID order,
LabelID  size 
)
void GCoptimization::setLabelSubsetCost ( LabelID labels,
LabelID  numLabels,
EnergyTermType  cost 
)

Here is the caller graph for this function:

void GCoptimization::setSmoothCost ( SmoothCostFn  fn)

Here is the caller graph for this function:

void GCoptimization::setSmoothCost ( SmoothCostFnExtra  fn,
void *  extraData 
)
void GCoptimization::setSmoothCost ( LabelID  l1,
LabelID  l2,
EnergyTermType  e 
)
void GCoptimization::setSmoothCost ( EnergyTermType smoothArray)
void GCoptimization::setSmoothCostFunctor ( SmoothCostFunctor f)
template<typename DataCostT >
void GCoptimization::setupDataCostsExpansion ( SiteID  size,
LabelID  alpha_label,
EnergyT e,
SiteID activeSites 
)
protected
template<typename DataCostT >
void GCoptimization::setupDataCostsSwap ( SiteID  size,
LabelID  alpha_label,
LabelID  beta_label,
EnergyT e,
SiteID activeSites 
)
protected
GCoptimization::EnergyType GCoptimization::setupLabelCostsExpansion ( SiteID  size,
LabelID  alpha_label,
EnergyT e,
SiteID activeSites 
)
protected

Here is the caller graph for this function:

template<typename SmoothCostT >
void GCoptimization::setupSmoothCostsExpansion ( SiteID  size,
LabelID  alpha_label,
EnergyT e,
SiteID activeSites 
)
protected
template<typename SmoothCostT >
void GCoptimization::setupSmoothCostsSwap ( SiteID  size,
LabelID  alpha_label,
LabelID  beta_label,
EnergyT e,
SiteID activeSites 
)
protected
void GCoptimization::setVerbosity ( int  level)
inline
template<typename UserFunctor >
void GCoptimization::specializeDataCostFunctor ( const UserFunctor  f)
protected

Here is the caller graph for this function:

template<typename UserFunctor >
void GCoptimization::specializeSmoothCostFunctor ( const UserFunctor  f)
protected

Here is the caller graph for this function:

GCoptimization::EnergyType GCoptimization::swap ( int  max_num_iterations = -1)
template<typename DataCostT >
void GCoptimization::updateLabelingDataCosts ( )
protected
void GCoptimization::updateLabelingInfo ( bool  updateCounts = true,
bool  updateActive = true,
bool  updateCosts = true 
)
protected

Here is the caller graph for this function:

OLGA_INLINE GCoptimization::LabelID GCoptimization::whatLabel ( SiteID  site)
void GCoptimization::whatLabel ( SiteID  start,
SiteID  count,
LabelID labeling 
)

Member Data Documentation

SiteID* GCoptimization::m_activeLabelCounts
protected
void(GCoptimization::* GCoptimization::m_applyNewLabeling) (EnergyT *, SiteID *, SiteID, LabelID)
protected
EnergyType GCoptimization::m_beforeExpansionEnergy
protected
void* GCoptimization::m_datacostFn
protected
void(* GCoptimization::m_datacostFnDelete) (void *f)
protected
EnergyTermType* GCoptimization::m_datacostIndividual
protected
EnergyType(GCoptimization::* GCoptimization::m_giveSmoothEnergyInternal) ()
protected
int GCoptimization::m_labelcostCount
protected
LabelCost* GCoptimization::m_labelcostsAll
protected
LabelCostIter** GCoptimization::m_labelcostsByLabel
protected
SiteID* GCoptimization::m_labelCounts
protected
LabelID* GCoptimization::m_labeling
protected
EnergyTermType* GCoptimization::m_labelingDataCosts
protected
bool GCoptimization::m_labelingInfoDirty
protected
LabelID* GCoptimization::m_labelTable
protected
SiteID* GCoptimization::m_lookupSiteVar
protected
LabelID GCoptimization::m_num_labels
protected
SiteID GCoptimization::m_num_sites
protected
SiteID* GCoptimization::m_numNeighbors
protected
SiteID GCoptimization::m_numNeighborsTotal
protected
SiteID(GCoptimization::* GCoptimization::m_queryActiveSitesExpansion) (LabelID, SiteID *)
protected
int GCoptimization::m_random_label_order
protected
void(GCoptimization::* GCoptimization::m_setupDataCostsExpansion) (SiteID, LabelID, EnergyT *, SiteID *)
protected
void(GCoptimization::* GCoptimization::m_setupDataCostsSwap) (SiteID, LabelID, LabelID, EnergyT *, SiteID *)
protected
void(GCoptimization::* GCoptimization::m_setupSmoothCostsExpansion) (SiteID, LabelID, EnergyT *, SiteID *)
protected
void(GCoptimization::* GCoptimization::m_setupSmoothCostsSwap) (SiteID, LabelID, LabelID, EnergyT *, SiteID *)
protected
void* GCoptimization::m_smoothcostFn
protected
void(* GCoptimization::m_smoothcostFnDelete) (void *f)
protected
EnergyTermType* GCoptimization::m_smoothcostIndividual
protected
bool(GCoptimization::* GCoptimization::m_solveSpecialCases) (EnergyType &)
protected
int GCoptimization::m_stepsThisCycle
protected
int GCoptimization::m_stepsThisCycleTotal
protected
void(GCoptimization::* GCoptimization::m_updateLabelingDataCosts) ()
protected
int GCoptimization::m_verbosity
protected

The documentation for this class was generated from the following files: