OpenGM  2.3.x
Discrete Graphical Model Library
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > Class Template Reference

A linear constraint function class ensuring the correct label order for two variables. More...

#include <label_order_function.hxx>

+ Inheritance diagram for opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >:
+ Collaboration diagram for opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >:

Public Types

typedef LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > LinearConstraintFunctionType
 Typedef of the LabelOrderFunction class with appropriate template parameter. More...
 
typedef LinearConstraintFunctionBase< LinearConstraintFunctionTypeLinearConstraintFunctionBaseType
 Typedef of the LinearConstraintFunctionBase class with appropriate template parameter. More...
 
typedef LinearConstraintFunctionTraits< LinearConstraintFunctionTypeLinearConstraintFunctionTraitsType
 Typedef of the LinearConstraintFunctionTraits class with appropriate template parameter. More...
 
typedef LinearConstraintFunctionTraitsType::ValueType ValueType
 Typedef of the VALUE_TYPE template parameter type from the class LabelOrderFunction. More...
 
typedef LinearConstraintFunctionTraitsType::IndexType IndexType
 Typedef of the INDEX_TYPE template parameter type from the class LabelOrderFunction. More...
 
typedef LinearConstraintFunctionTraitsType::LabelType LabelType
 Typedef of the LABEL_TYPE template parameter type from the class LabelOrderFunction. More...
 
typedef std::vector< ValueTypeLabelOrderType
 Type to store the weights of the label order. More...
 
typedef LinearConstraintFunctionTraitsType::LinearConstraintType LinearConstraintType
 Typedef of the LinearConstraint class which is used to represent linear constraints. More...
 
typedef LinearConstraintFunctionTraitsType::LinearConstraintsContainerType LinearConstraintsContainerType
 Defines the linear constraints container type which is used to store multiple linear constraints. More...
 
typedef LinearConstraintFunctionTraitsType::LinearConstraintsIteratorType LinearConstraintsIteratorType
 Defines the linear constraints container iterator type which is used to iterate over the set of linear constraints. More...
 
typedef LinearConstraintFunctionTraitsType::IndicatorVariablesContainerType IndicatorVariablesContainerType
 Defines the indicator variables container type which is used to store the indicator variables used by the linear constraint function. More...
 
typedef LinearConstraintFunctionTraitsType::IndicatorVariablesIteratorType IndicatorVariablesIteratorType
 Defines the indicator variables container iterator type which is used to iterate over the indicator variables used by the linear constraint function. More...
 
typedef LinearConstraintFunctionTraitsType::VariableLabelPairsIteratorType VariableLabelPairsIteratorType
 Defines the variable label pairs iterator type which is used to iterate over the variable label pairs of an indicator variable. More...
 
typedef LinearConstraintFunctionTraitsType::ViolatedLinearConstraintsIteratorType ViolatedLinearConstraintsIteratorType
 Defines the violated linear constraints iterator type which is used to iterate over the set of violated linear constraints. More...
 
typedef LinearConstraintFunctionTraitsType::ViolatedLinearConstraintsWeightsContainerType ViolatedLinearConstraintsWeightsContainerType
 Defines the violated linear constraints weights container type which is used to store the weights of the violated linear constraints. More...
 
typedef LinearConstraintFunctionTraitsType::ViolatedLinearConstraintsWeightsIteratorType ViolatedLinearConstraintsWeightsIteratorType
 Defines the violated linear constraints weights iterator type which is used to iterate over the weights of the violated linear constraints. More...
 
- Public Types inherited from opengm::LinearConstraintFunctionBase< LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >
typedef LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > LinearConstraintFunctionType
 Typedef of the LINEAR_CONSTRAINT_FUNCTION_TYPE template parameter from the class LinearConstraintFunctionBase. More...
 
typedef LinearConstraintFunctionTraits< LinearConstraintFunctionTypeLinearConstraintFunctionTraitsType
 Typedef of the LinearConstraintFunctionTraits class with appropriate template parameter. More...
 
typedef LinearConstraintFunctionTraitsType::ValueType ValueType
 Typedef of the value type used by the linear constraint function. More...
 
typedef LinearConstraintFunctionTraitsType::IndexType IndexType
 Typedef of the index type used by the linear constraint function. More...
 
typedef LinearConstraintFunctionTraitsType::LabelType LabelType
 Typedef of the label type used by the linear constraint function. More...
 
typedef LinearConstraintFunctionTraitsType::LinearConstraintType LinearConstraintType
 Typedef of the linear constraint type used by the linear constraint function. More...
 
typedef LinearConstraintFunctionTraitsType::LinearConstraintsIteratorType LinearConstraintsIteratorType
 Typedef of the linear constraints iterator type used by the linear constraint function to iterate over the set of linear constraints. More...
 
typedef LinearConstraintFunctionTraitsType::ViolatedLinearConstraintsIteratorType ViolatedLinearConstraintsIteratorType
 Typedef of the violated linear constraints iterator type used by the linear constraint function to iterate over the set of violated linear constraints. More...
 
typedef LinearConstraintFunctionTraitsType::ViolatedLinearConstraintsWeightsIteratorType ViolatedLinearConstraintsWeightsIteratorType
 Typedef of the violated linear constraints weights iterator type used by the linear constraint function to iterate over the weights of the violated linear constraints. More...
 
typedef LinearConstraintFunctionTraitsType::IndicatorVariablesIteratorType IndicatorVariablesIteratorType
 Typedef of the indicator variables iterator type used by the linear constraint function to iterate over the indicator variables. More...
 
- Public Types inherited from opengm::FunctionBase< LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >, LinearConstraintFunctionTraits< LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >::ValueType, LinearConstraintFunctionTraits< LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >::IndexType, LinearConstraintFunctionTraits< LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >::LabelType >
typedef AccessorIterator< FunctionShapeAccessorType, true > FunctionShapeIteratorType
 

Public Member Functions

 LabelOrderFunction ()
 LabelOrderFunction constructor. More...
 
 LabelOrderFunction (const LabelType numLabelsVar1, const LabelType numLabelsVar2, const LabelOrderType &labelOrder, const ValueType returnValid=0.0, const ValueType returnInvalid=1.0)
 LabelOrderFunction constructor. More...
 
template<class ITERATOR_TYPE >
 LabelOrderFunction (const LabelType numLabelsVar1, const LabelType numLabelsVar2, ITERATOR_TYPE labelOrderBegin, const ValueType returnValid=0.0, const ValueType returnInvalid=1.0)
 LabelOrderFunction constructor. More...
 
 ~LabelOrderFunction ()
 LabelOrderFunction destructor. More...
 
template<class Iterator >
ValueType operator() (Iterator statesBegin) const
 Function evaluation. More...
 
size_t shape (const size_t i) const
 Number of labels of the indicated input variable. More...
 
size_t dimension () const
 Number of input variables. More...
 
size_t size () const
 Number of parameters. More...
 
ValueType min () const
 Minimum value of the label order function. More...
 
ValueType max () const
 Maximum value of the label order function. More...
 
MinMaxFunctor< ValueTypeminMax () const
 Get minimum and maximum at the same time. More...
 
- Public Member Functions inherited from opengm::LinearConstraintFunctionBase< LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >
LinearConstraintsIteratorType linearConstraintsBegin () const
 Get the begin iterator to the set of linear constraints represented by the linear constraint function. More...
 
LinearConstraintsIteratorType linearConstraintsEnd () const
 Get the end iterator to the set of linear constraints represented by the linear constraint function. More...
 
IndicatorVariablesIteratorType indicatorVariablesOrderBegin () const
 Get the begin iterator to the set of indicator variables used by the linear constraint function. More...
 
IndicatorVariablesIteratorType indicatorVariablesOrderEnd () const
 Get the end iterator to the set of indicator variables used by the linear constraint function. More...
 
void challenge (ViolatedLinearConstraintsIteratorType &violatedConstraintsBegin, ViolatedLinearConstraintsIteratorType &violatedConstraintsEnd, ViolatedLinearConstraintsWeightsIteratorType &violatedConstraintsWeightsBegin, LABEL_ITERATOR labelingBegin, const ValueType tolerance=0.0) const
 Challenge the linear constraint function and get all linear constraints which are violated by a given labeling. More...
 
void challengeRelaxed (ViolatedLinearConstraintsIteratorType &violatedConstraintsBegin, ViolatedLinearConstraintsIteratorType &violatedConstraintsEnd, ViolatedLinearConstraintsWeightsIteratorType &violatedConstraintsWeightsBegin, LABEL_ITERATOR labelingBegin, const ValueType tolerance=0.0) const
 Challenge the linear constraint function and get all linear constraints which are violated by a given labeling. More...
 
bool isLinearConstraint () const
 Function specialization for each linear constraint function. More...
 
- Public Member Functions inherited from opengm::FunctionBase< LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >, LinearConstraintFunctionTraits< LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >::ValueType, LinearConstraintFunctionTraits< LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >::IndexType, LinearConstraintFunctionTraits< LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >::LabelType >
bool isPotts () const
 
bool isGeneralizedPotts () const
 
bool isSubmodular () const
 
bool isSquaredDifference () const
 
bool isTruncatedSquaredDifference () const
 
bool isAbsoluteDifference () const
 
bool isTruncatedAbsoluteDifference () const
 
bool isLinearConstraint () const
 
MinMaxFunctor< LinearConstraintFunctionTraits< LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >::ValueType > minMax () const
 find minimum and maximum of the function in a single sweep More...
 
ReturnType min () const
 
ReturnType max () const
 
ReturnType sum () const
 
ReturnType product () const
 
ReturnType accumulate () const
 accumulate all values of the function More...
 
void forAllValuesInOrder (FUNCTOR &functor) const
 call a functor for each value of the function (in lexicographical order of the variable indices) More...
 
void forAllValuesInSwitchedOrder (FUNCTOR &functor) const
 
void forAllValuesInAnyOrder (FUNCTOR &functor) const
 call a functor for each value of the function (in un-specified order) More...
 
void forAtLeastAllUniqueValues (FUNCTOR &functor) const
 call a functor for at least all unique values of the function More...
 
void forAllValuesInOrderWithCoordinate (COORDINATE_FUNCTOR &functor) const
 
void forAllValuesInAnyOrderWithCoordinate (COORDINATE_FUNCTOR &functor) const
 
void forAtLeastAllUniqueValuesWithCoordinate (COORDINATE_FUNCTOR &functor) const
 
bool operator== (const LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > &) const
 
FunctionShapeIteratorType functionShapeBegin () const
 
FunctionShapeIteratorType functionShapeEnd () const
 
size_t numberOfParameters () const
 
LinearConstraintFunctionTraits< LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >::IndexType parameterIndex (const size_t paramNumber) const
 

Static Public Attributes

static const bool useSingleConstraint_ = true
 Describe the label order constraint in one single linear constraint. More...
 
static const bool useMultipleConstraints_ = false
 Describe the label order constraint in multiple linear constraints. More...
 

Protected Member Functions

LinearConstraintsIteratorType linearConstraintsBegin_impl () const
 Implementation of LinearConstraintFunctionBase::linearConstraintsBegin. More...
 
LinearConstraintsIteratorType linearConstraintsEnd_impl () const
 Implementation of LinearConstraintFunctionBase::linearConstraintsEnd. More...
 
IndicatorVariablesIteratorType indicatorVariablesOrderBegin_impl () const
 Implementation of LinearConstraintFunctionBase::indicatorVariablesOrderBegin. More...
 
IndicatorVariablesIteratorType indicatorVariablesOrderEnd_impl () const
 Implementation of LinearConstraintFunctionBase::indicatorVariablesOrderEnd. More...
 
template<class LABEL_ITERATOR >
void challenge_impl (ViolatedLinearConstraintsIteratorType &violatedConstraintsBegin, ViolatedLinearConstraintsIteratorType &violatedConstraintsEnd, ViolatedLinearConstraintsWeightsIteratorType &violatedConstraintsWeightsBegin, LABEL_ITERATOR labelingBegin, const ValueType tolerance=0.0) const
 Implementation of LinearConstraintFunctionBase::challenge. More...
 
template<class LABEL_ITERATOR >
void challengeRelaxed_impl (ViolatedLinearConstraintsIteratorType &violatedConstraintsBegin, ViolatedLinearConstraintsIteratorType &violatedConstraintsEnd, ViolatedLinearConstraintsWeightsIteratorType &violatedConstraintsWeightsBegin, LABEL_ITERATOR labelingBegin, const ValueType tolerance=0.0) const
 Implementation of LinearConstraintFunctionBase::challengeRelaxed. More...
 
bool checkLabelOrder () const
 Check label order weights. Only used for assertion in debug mode. More...
 
void fillIndicatorVariableList ()
 Helper function to fill LabelOrderFunction::indicatorVariableList_ with all indicator variables used by the label order function. More...
 
void createConstraints ()
 Helper function to create all linear constraints which are implied by the label order function. More...
 

Protected Attributes

LabelType numLabelsVar1_
 The number of labels of the first variable. More...
 
LabelType numLabelsVar2_
 The number of labels of the second variable. More...
 
size_t size_
 Stores the size of the label order function. More...
 
LabelOrderType labelOrder_
 The weights defining the label order. More...
 
ValueType returnValid_
 Stores the return value of LabelOrderFunction::operator() if no constraint is violated. More...
 
ValueType returnInvalid_
 Stores the return value of LabelOrderFunction::operator() if at least one constraint is violated. More...
 
LinearConstraintsContainerType constraints_
 Stores the linear constraints of the label order function. More...
 
std::vector< size_tviolatedConstraintsIds_
 Stores the indices of the violated constraints which are detected by LabelOrderFunction::challenge and LabelOrderFunction::challengeRelaxed. More...
 
ViolatedLinearConstraintsWeightsContainerType violatedConstraintsWeights_
 Stores the weights of the violated constraints which are detected by LabelOrderFunction::challenge and LabelOrderFunction::challengeRelaxed. More...
 
IndicatorVariablesContainerType indicatorVariableList_
 A list of all indicator variables present in the label order function. More...
 

Static Protected Attributes

static const size_t dimension_ = 2
 The dimension of the label order function. More...
 

Detailed Description

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
class opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >

A linear constraint function class ensuring the correct label order for two variables.

This class implements a linear constraint function which ensures the correct label order for two variables. Each label is associated with a weight and the function checks the condition $w(l_1) \leq w(l_2)$ where $w(l_1)$ is the weight of the label of the first variable and $w(l_2)$ is the weight of the label of the second variable.

Template Parameters
VALUE_TYPEValue type.
INDEX_TYPEIndex type.
LABEL_TYPELabel type.

Definition at line 21 of file label_order_function.hxx.

Member Typedef Documentation

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::IndexType

Typedef of the INDEX_TYPE template parameter type from the class LabelOrderFunction.

Definition at line 32 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::IndicatorVariablesContainerType

Defines the indicator variables container type which is used to store the indicator variables used by the linear constraint function.

Definition at line 38 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::IndicatorVariablesIteratorType

Defines the indicator variables container iterator type which is used to iterate over the indicator variables used by the linear constraint function.

Definition at line 39 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LabelOrderType

Type to store the weights of the label order.

Definition at line 34 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LabelType

Typedef of the LABEL_TYPE template parameter type from the class LabelOrderFunction.

Definition at line 33 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LinearConstraintFunctionBaseType

Typedef of the LinearConstraintFunctionBase class with appropriate template parameter.

Definition at line 29 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LinearConstraintFunctionTraitsType

Typedef of the LinearConstraintFunctionTraits class with appropriate template parameter.

Definition at line 30 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LinearConstraintFunctionType

Typedef of the LabelOrderFunction class with appropriate template parameter.

Definition at line 28 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LinearConstraintsContainerType

Defines the linear constraints container type which is used to store multiple linear constraints.

Definition at line 36 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LinearConstraintsIteratorType

Defines the linear constraints container iterator type which is used to iterate over the set of linear constraints.

Definition at line 37 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LinearConstraintType

Typedef of the LinearConstraint class which is used to represent linear constraints.

Definition at line 35 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::ValueType

Typedef of the VALUE_TYPE template parameter type from the class LabelOrderFunction.

Definition at line 31 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::VariableLabelPairsIteratorType

Defines the variable label pairs iterator type which is used to iterate over the variable label pairs of an indicator variable.

Definition at line 40 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::ViolatedLinearConstraintsIteratorType

Defines the violated linear constraints iterator type which is used to iterate over the set of violated linear constraints.

Definition at line 41 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::ViolatedLinearConstraintsWeightsContainerType

Defines the violated linear constraints weights container type which is used to store the weights of the violated linear constraints.

Definition at line 42 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::ViolatedLinearConstraintsWeightsIteratorType

Defines the violated linear constraints weights iterator type which is used to iterate over the weights of the violated linear constraints.

Definition at line 43 of file label_order_function.hxx.

Constructor & Destructor Documentation

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LabelOrderFunction ( )
inline

LabelOrderFunction constructor.

This constructor will create an empty LabelOrderFunction.

Definition at line 478 of file label_order_function.hxx.

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LabelOrderFunction ( const LabelType  numLabelsVar1,
const LabelType  numLabelsVar2,
const LabelOrderType labelOrder,
const ValueType  returnValid = 0.0,
const ValueType  returnInvalid = 1.0 
)
inline

LabelOrderFunction constructor.

This constructor will create a LabelOrderFunction.

Parameters
[in]numLabelsVar1Number of labels for the first variable.
[in]numLabelsVar2Number of labels for the second variable.
[in]labelOrderWeights for the label order.
[in]returnValidThe value which will be returned by the function evaluation if no constraint is violated.
[in]returnInvalidThe value which will be returned by the function evaluation if at least one constraint is violated.

Definition at line 488 of file label_order_function.hxx.

+ Here is the call graph for this function:

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
template<class ITERATOR_TYPE >
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LabelOrderFunction ( const LabelType  numLabelsVar1,
const LabelType  numLabelsVar2,
ITERATOR_TYPE  labelOrderBegin,
const ValueType  returnValid = 0.0,
const ValueType  returnInvalid = 1.0 
)
inline

LabelOrderFunction constructor.

This constructor will create a LabelOrderFunction.

Template Parameters
ITERATOR_TYPEIterator to iterate over the weights of the label order.
Parameters
[in]numLabelsVar1Number of labels for the first variable.
[in]numLabelsVar2Number of labels for the second variable.
[in]labelOrderBeginIterator pointing to the begin of the weights for the label order.
[in]labelOrderBeginIterator pointing to the end of the weights for the label order.
[in]returnValidThe value which will be returned by the function evaluation if no constraint is violated.
[in]returnInvalidThe value which will be returned by the function evaluation if at least one constraint is violated.

Definition at line 511 of file label_order_function.hxx.

+ Here is the call graph for this function:

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::~LabelOrderFunction ( )
inline

LabelOrderFunction destructor.

Definition at line 534 of file label_order_function.hxx.

Member Function Documentation

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
template<class LABEL_ITERATOR >
void opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::challenge_impl ( ViolatedLinearConstraintsIteratorType violatedConstraintsBegin,
ViolatedLinearConstraintsIteratorType violatedConstraintsEnd,
ViolatedLinearConstraintsWeightsIteratorType violatedConstraintsWeightsBegin,
LABEL_ITERATOR  labelingBegin,
const ValueType  tolerance = 0.0 
) const
inlineprotected

Implementation of LinearConstraintFunctionBase::challenge.

Definition at line 606 of file label_order_function.hxx.

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
template<class LABEL_ITERATOR >
void opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::challengeRelaxed_impl ( ViolatedLinearConstraintsIteratorType violatedConstraintsBegin,
ViolatedLinearConstraintsIteratorType violatedConstraintsEnd,
ViolatedLinearConstraintsWeightsIteratorType violatedConstraintsWeightsBegin,
LABEL_ITERATOR  labelingBegin,
const ValueType  tolerance = 0.0 
) const
inlineprotected

Implementation of LinearConstraintFunctionBase::challengeRelaxed.

Definition at line 633 of file label_order_function.hxx.

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
bool opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::checkLabelOrder ( ) const
inlineprotected

Check label order weights. Only used for assertion in debug mode.

Returns
Returns true if the number of weights is large enough to define a weight for each label of both variables. False otherwise.

Definition at line 672 of file label_order_function.hxx.

+ Here is the caller graph for this function:

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
void opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::createConstraints ( )
inlineprotected

Helper function to create all linear constraints which are implied by the label order function.

Definition at line 691 of file label_order_function.hxx.

+ Here is the caller graph for this function:

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
size_t opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::dimension ( ) const
inline

Number of input variables.

Returns
Returns the number of variables.

Definition at line 555 of file label_order_function.hxx.

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
void opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::fillIndicatorVariableList ( )
inlineprotected

Helper function to fill LabelOrderFunction::indicatorVariableList_ with all indicator variables used by the label order function.

Definition at line 681 of file label_order_function.hxx.

+ Here is the caller graph for this function:

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::IndicatorVariablesIteratorType opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::indicatorVariablesOrderBegin_impl ( ) const
inlineprotected
template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::IndicatorVariablesIteratorType opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::indicatorVariablesOrderEnd_impl ( ) const
inlineprotected
template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LinearConstraintsIteratorType opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::linearConstraintsBegin_impl ( ) const
inlineprotected
template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LinearConstraintsIteratorType opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::linearConstraintsEnd_impl ( ) const
inlineprotected
template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::ValueType opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::max ( ) const
inline

Maximum value of the label order function.

Returns
Returns the maximum value of LabelOrderFunction::returnValid_ and LabelOrderFunction::returnInvalid_.

Definition at line 570 of file label_order_function.hxx.

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::ValueType opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::min ( ) const
inline

Minimum value of the label order function.

Returns
Returns the minimum value of LabelOrderFunction::returnValid_ and LabelOrderFunction::returnInvalid_.

Definition at line 565 of file label_order_function.hxx.

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
MinMaxFunctor< typename LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::ValueType > opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::minMax ( ) const
inline

Get minimum and maximum at the same time.

Returns
Returns a functor containing the minimum and the maximum value of the label order function.

Definition at line 575 of file label_order_function.hxx.

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
template<class Iterator >
LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::ValueType opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::operator() ( Iterator  statesBegin) const
inline

Function evaluation.

Parameters
[in]statesBeginIterator pointing to the begin of a sequence of labels for the variables of the function.
Returns
LabelOrderFunction::returnValid_ if no constraint is violated by the labeling. LabelOrderFunction::returnInvalid_ if at least one constraint is violated by the labeling.

Definition at line 540 of file label_order_function.hxx.

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
size_t opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::shape ( const size_t  i) const
inline

Number of labels of the indicated input variable.

Parameters
[in]iIndex of the variable.
Returns
Returns the number of labels of the i-th variable.

Definition at line 549 of file label_order_function.hxx.

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
size_t opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::size ( ) const
inline

Number of parameters.

Returns
Returns the number of parameters.

Definition at line 560 of file label_order_function.hxx.

Member Data Documentation

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::constraints_
protected

Stores the linear constraints of the label order function.

Definition at line 73 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::dimension_ = 2
staticprotected

The dimension of the label order function.

Definition at line 66 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::indicatorVariableList_
protected

A list of all indicator variables present in the label order function.

Definition at line 76 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::labelOrder_
protected

The weights defining the label order.

Definition at line 70 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::numLabelsVar1_
protected

The number of labels of the first variable.

Definition at line 67 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::numLabelsVar2_
protected

The number of labels of the second variable.

Definition at line 68 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::returnInvalid_
protected

Stores the return value of LabelOrderFunction::operator() if at least one constraint is violated.

Definition at line 72 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::returnValid_
protected

Stores the return value of LabelOrderFunction::operator() if no constraint is violated.

Definition at line 71 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::size_
protected

Stores the size of the label order function.

Definition at line 69 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::useMultipleConstraints_ = false
static

Describe the label order constraint in multiple linear constraints.

The label order constraint is described by the following set of linear constraints:

\[ c_i \cdot v^0_i - \sum_j c_j \cdot v^1_j \quad \leq \quad 0 \qquad \forall i \in \{0, ..., n - 1\}. \]

Where $c_i$ is the weight for label i, $v^0_i$ is the indicator variable of variable 0 which is 1 if variable 0 is set to label i and 0 otherwise, $v^1_j$ is the indicator variable of variable 1 and n is the number of labels of variable 0.

Note
LabelOrderFunction::useMultipleConstraints_ can be used in combination with LabelOrderFunction::useSingleConstraint_ in this case both descriptions of the label order constraint are considered. At least one of both variables has to be set to true.

Definition at line 25 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::useSingleConstraint_ = true
static

Describe the label order constraint in one single linear constraint.

The label order constraint is described by the following linear constraint:

\[ \sum_i c_i \cdot v^0_i - \sum_j c_j \cdot v^1_j \quad \leq \quad 0. \]

Where $c_i$ is the weight for label i, $v^0_i$ is the indicator variable of variable 0 which is 1 if variable 0 is set to label i and 0 otherwise and $v^1_j$ is the indicator variable of variable 1.

Note
LabelOrderFunction::useSingleConstraint_ can be used in combination with LabelOrderFunction::useMultipleConstraints_ in this case both descriptions of the label order constraint are considered. At least one of both variables has to be set to true.

Definition at line 24 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::violatedConstraintsIds_
mutableprotected

Stores the indices of the violated constraints which are detected by LabelOrderFunction::challenge and LabelOrderFunction::challengeRelaxed.

Definition at line 74 of file label_order_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LabelOrderFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::violatedConstraintsWeights_
mutableprotected

Stores the weights of the violated constraints which are detected by LabelOrderFunction::challenge and LabelOrderFunction::challengeRelaxed.

Definition at line 75 of file label_order_function.hxx.