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

A linear constraint function class for limiting the number of used labels. More...

#include <num_labels_limitation_function.hxx>

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

Public Types

typedef NumLabelsLimitationFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > LinearConstraintFunctionType
 Typedef of the NumLabelsLimitationFunction 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 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< NumLabelsLimitationFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >
typedef NumLabelsLimitationFunction< 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< NumLabelsLimitationFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >, LinearConstraintFunctionTraits< NumLabelsLimitationFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >::ValueType, LinearConstraintFunctionTraits< NumLabelsLimitationFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >::IndexType, LinearConstraintFunctionTraits< NumLabelsLimitationFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >::LabelType >
typedef AccessorIterator< FunctionShapeAccessorType, true > FunctionShapeIteratorType
 

Public Member Functions

 NumLabelsLimitationFunction ()
 NumLabelsLimitationFunction constructor. More...
 
template<class SHAPE_ITERATOR_TYPE >
 NumLabelsLimitationFunction (SHAPE_ITERATOR_TYPE shapeBegin, SHAPE_ITERATOR_TYPE shapeEnd, const LabelType maxNumUsedLabels, const ValueType returnValid=0.0, const ValueType returnInvalid=1.0)
 NumLabelsLimitationFunction constructor. More...
 
 NumLabelsLimitationFunction (const IndexType numVariables, const LabelType numLabels, const LabelType maxNumUsedLabels, const ValueType returnValid=0.0, const ValueType returnInvalid=1.0)
 NumLabelsLimitationFunction constructor. More...
 
 ~NumLabelsLimitationFunction ()
 NumLabelsLimitationFunction 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 function. More...
 
ValueType max () const
 Maximum value of the function. More...
 
MinMaxFunctor< ValueTypeminMax () const
 Get minimum and maximum at the same time. More...
 
- Public Member Functions inherited from opengm::LinearConstraintFunctionBase< NumLabelsLimitationFunction< 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< NumLabelsLimitationFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >, LinearConstraintFunctionTraits< NumLabelsLimitationFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >::ValueType, LinearConstraintFunctionTraits< NumLabelsLimitationFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >::IndexType, LinearConstraintFunctionTraits< NumLabelsLimitationFunction< 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< NumLabelsLimitationFunction< 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 NumLabelsLimitationFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > &) const
 
FunctionShapeIteratorType functionShapeBegin () const
 
FunctionShapeIteratorType functionShapeEnd () const
 
size_t numberOfParameters () const
 
LinearConstraintFunctionTraits< NumLabelsLimitationFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >::IndexType parameterIndex (const size_t paramNumber) const
 

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...
 
void fillIndicatorVariableList ()
 Helper function to fill NumLabelsLimitationFunction::indicatorVariableList_ with all indicator variables used by the function. More...
 
void createConstraints ()
 Helper function to create all linear constraints which are implied by the function. More...
 

Protected Attributes

std::vector< LabelTypeshape_
 The shape of the function (only used if variables have different number of labels). More...
 
size_t numVariables_
 The number of variables of the function. More...
 
bool useSameNumLabels_
 Indicator to tell that all variables have the same number of variables. More...
 
LabelType maxNumLabels_
 The maximum number of labels of the variables. More...
 
LabelType maxNumUsedLabels_
 The maximum number of different labels which are allowed in the assignment of the function. More...
 
size_t size_
 Stores the size of the function. More...
 
ValueType returnValid_
 Stores the return value of NumLabelsLimitationFunction::operator() if the number of different labels which are used in the assignment of the function is smaller or equal to NumLabelsLimitationFunction::maxNumUsedLabels_. More...
 
ValueType returnInvalid_
 Stores the return value of NumLabelsLimitationFunction::operator() if the number of different labels which are used in the assignment of the function exceeds NumLabelsLimitationFunction::maxNumUsedLabels_. More...
 
LinearConstraintsContainerType constraints_
 Stores the linear constraints of the function. More...
 
std::vector< size_tviolatedConstraintsIds_
 Stores the indices of the violated constraints which are detected by NumLabelsLimitationFunction::challenge and NumLabelsLimitationFunction::challengeRelaxed. More...
 
ViolatedLinearConstraintsWeightsContainerType violatedConstraintsWeights_
 Stores the weights of the violated constraints which are detected by NumLabelsLimitationFunction::challenge and NumLabelsLimitationFunction::challengeRelaxed. More...
 
IndicatorVariablesContainerType indicatorVariableList_
 A list of all indicator variables present in the function. More...
 

Detailed Description

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

A linear constraint function class for limiting the number of used labels.

This class implements a linear constraint function which limits the number of used labels. The number of different labels in the assignment of the function is counted and if this number exceeds the value of maximum allowed different labels the function will return an invalid value.

Template Parameters
VALUE_TYPEValue type.
INDEX_TYPEIndex type.
LABEL_TYPELabel type.

Definition at line 18 of file num_labels_limitation_function.hxx.

Member Typedef Documentation

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

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

Definition at line 25 of file num_labels_limitation_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::NumLabelsLimitationFunction< 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 30 of file num_labels_limitation_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::NumLabelsLimitationFunction< 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 31 of file num_labels_limitation_function.hxx.

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

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

Definition at line 26 of file num_labels_limitation_function.hxx.

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

Typedef of the LinearConstraintFunctionBase class with appropriate template parameter.

Definition at line 22 of file num_labels_limitation_function.hxx.

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

Typedef of the LinearConstraintFunctionTraits class with appropriate template parameter.

Definition at line 23 of file num_labels_limitation_function.hxx.

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

Typedef of the NumLabelsLimitationFunction class with appropriate template parameter.

Definition at line 21 of file num_labels_limitation_function.hxx.

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

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

Definition at line 28 of file num_labels_limitation_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::NumLabelsLimitationFunction< 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 29 of file num_labels_limitation_function.hxx.

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

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

Definition at line 27 of file num_labels_limitation_function.hxx.

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

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

Definition at line 24 of file num_labels_limitation_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::NumLabelsLimitationFunction< 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 32 of file num_labels_limitation_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::NumLabelsLimitationFunction< 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 33 of file num_labels_limitation_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::NumLabelsLimitationFunction< 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 34 of file num_labels_limitation_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::NumLabelsLimitationFunction< 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 35 of file num_labels_limitation_function.hxx.

Constructor & Destructor Documentation

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

NumLabelsLimitationFunction constructor.

This constructor will create an empty NumLabelsLimitationFunction.

Definition at line 444 of file num_labels_limitation_function.hxx.

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
template<class SHAPE_ITERATOR_TYPE >
opengm::NumLabelsLimitationFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::NumLabelsLimitationFunction ( SHAPE_ITERATOR_TYPE  shapeBegin,
SHAPE_ITERATOR_TYPE  shapeEnd,
const LabelType  maxNumUsedLabels,
const ValueType  returnValid = 0.0,
const ValueType  returnInvalid = 1.0 
)
inline

NumLabelsLimitationFunction constructor.

This constructor will create a NumLabelsLimitationFunction where each variable can have a different number of labels.

Template Parameters
SHAPE_ITERATOR_TYPEIterator type to iterate over the shape of the function.
Parameters
[in]shapeBeginIterator pointing to the begin of a sequence which defines the shape of the function.
[in]shapeEndIterator pointing to the end of a sequence which defines the shape of the function.
[in]maxNumUsedLabelsThe maximum number of different labels which are allowed in the assignment of the function.
[in]returnValidThe value which will be returned by the function evaluation if the number of different labels which are used in the assignment of the function do not exceed NumLabelsLimitationFunction::maxNumUsedLabels.
[in]returnInvalidThe value which will be returned by the function evaluation if the number of different labels which are used in the assignment of the function exceed NumLabelsLimitationFunction::maxNumUsedLabels.

Definition at line 454 of file num_labels_limitation_function.hxx.

+ Here is the call graph for this function:

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
opengm::NumLabelsLimitationFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::NumLabelsLimitationFunction ( const IndexType  numVariables,
const LabelType  numLabels,
const LabelType  maxNumUsedLabels,
const ValueType  returnValid = 0.0,
const ValueType  returnInvalid = 1.0 
)
inline

NumLabelsLimitationFunction constructor.

This constructor will create a NumLabelsLimitationFunction where each variable has the same number of labels.

Parameters
[in]numVariablesThe number of variables of the function
[in]numLabelsThe number of labels of each variable.
[in]maxNumUsedLabelsThe maximum number of different labels which are allowed in the assignment of the function.
[in]returnValidThe value which will be returned by the function evaluation if the number of different labels which are used in the assignment of the function do not exceed NumLabelsLimitationFunction::maxNumUsedLabels.
[in]returnInvalidThe value which will be returned by the function evaluation if the number of different labels which are used in the assignment of the function exceed NumLabelsLimitationFunction::maxNumUsedLabels.

Definition at line 471 of file num_labels_limitation_function.hxx.

+ Here is the call graph for this function:

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

NumLabelsLimitationFunction destructor.

Definition at line 486 of file num_labels_limitation_function.hxx.

Member Function Documentation

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
template<class LABEL_ITERATOR >
void opengm::NumLabelsLimitationFunction< 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 569 of file num_labels_limitation_function.hxx.

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

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

Definition at line 639 of file num_labels_limitation_function.hxx.

+ Here is the caller graph for this function:

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

Number of input variables.

Returns
Returns the number of variables.

Definition at line 518 of file num_labels_limitation_function.hxx.

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

Helper function to fill NumLabelsLimitationFunction::indicatorVariableList_ with all indicator variables used by the function.

Definition at line 623 of file num_labels_limitation_function.hxx.

+ Here is the caller graph for this function:

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

Maximum value of the function.

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

Definition at line 533 of file num_labels_limitation_function.hxx.

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

Minimum value of the function.

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

Definition at line 528 of file num_labels_limitation_function.hxx.

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
MinMaxFunctor< typename NumLabelsLimitationFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::ValueType > opengm::NumLabelsLimitationFunction< 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 function.

Definition at line 538 of file num_labels_limitation_function.hxx.

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
template<class Iterator >
NumLabelsLimitationFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::ValueType opengm::NumLabelsLimitationFunction< 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
NumLabelsLimitationFunction::returnValid_ if no constraint is violated by the labeling. NumLabelsLimitationFunction::returnInvalid_ if at least one constraint is violated by the labeling.

Definition at line 492 of file num_labels_limitation_function.hxx.

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
size_t opengm::NumLabelsLimitationFunction< 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 512 of file num_labels_limitation_function.hxx.

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

Number of parameters.

Returns
Returns the number of parameters.

Definition at line 523 of file num_labels_limitation_function.hxx.

Member Data Documentation

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

Stores the linear constraints of the function.

Definition at line 66 of file num_labels_limitation_function.hxx.

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

A list of all indicator variables present in the function.

Definition at line 69 of file num_labels_limitation_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::NumLabelsLimitationFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::maxNumLabels_
protected

The maximum number of labels of the variables.

Definition at line 61 of file num_labels_limitation_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::NumLabelsLimitationFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::maxNumUsedLabels_
protected

The maximum number of different labels which are allowed in the assignment of the function.

Definition at line 62 of file num_labels_limitation_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::NumLabelsLimitationFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::numVariables_
protected

The number of variables of the function.

Definition at line 59 of file num_labels_limitation_function.hxx.

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

Stores the return value of NumLabelsLimitationFunction::operator() if the number of different labels which are used in the assignment of the function exceeds NumLabelsLimitationFunction::maxNumUsedLabels_.

Definition at line 65 of file num_labels_limitation_function.hxx.

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

Stores the return value of NumLabelsLimitationFunction::operator() if the number of different labels which are used in the assignment of the function is smaller or equal to NumLabelsLimitationFunction::maxNumUsedLabels_.

Definition at line 64 of file num_labels_limitation_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::NumLabelsLimitationFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::shape_
protected

The shape of the function (only used if variables have different number of labels).

Definition at line 58 of file num_labels_limitation_function.hxx.

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

Stores the size of the function.

Definition at line 63 of file num_labels_limitation_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::NumLabelsLimitationFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::useSameNumLabels_
protected

Indicator to tell that all variables have the same number of variables.

Definition at line 60 of file num_labels_limitation_function.hxx.

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

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

Definition at line 67 of file num_labels_limitation_function.hxx.

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

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

Definition at line 68 of file num_labels_limitation_function.hxx.