|
OpenGM
2.3.x
Discrete Graphical Model Library
|
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< LinearConstraintFunctionType > | LinearConstraintFunctionBaseType |
| Typedef of the LinearConstraintFunctionBase class with appropriate template parameter. More... | |
| typedef LinearConstraintFunctionTraits< LinearConstraintFunctionType > | LinearConstraintFunctionTraitsType |
| 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< ValueType > | LabelOrderType |
| 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< LinearConstraintFunctionType > | LinearConstraintFunctionTraitsType |
| 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< ValueType > | minMax () 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 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_t > | violatedConstraintsIds_ |
| 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... | |
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
where
is the weight of the label of the first variable and
is the weight of the label of the second variable.
| VALUE_TYPE | Value type. |
| INDEX_TYPE | Index type. |
| LABEL_TYPE | Label type. |
Definition at line 21 of file label_order_function.hxx.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
|
inline |
LabelOrderFunction constructor.
This constructor will create an empty LabelOrderFunction.
Definition at line 478 of file label_order_function.hxx.
|
inline |
LabelOrderFunction constructor.
This constructor will create a LabelOrderFunction.
| [in] | numLabelsVar1 | Number of labels for the first variable. |
| [in] | numLabelsVar2 | Number of labels for the second variable. |
| [in] | labelOrder | Weights for the label order. |
| [in] | returnValid | The value which will be returned by the function evaluation if no constraint is violated. |
| [in] | returnInvalid | The 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:
|
inline |
LabelOrderFunction constructor.
This constructor will create a LabelOrderFunction.
| ITERATOR_TYPE | Iterator to iterate over the weights of the label order. |
| [in] | numLabelsVar1 | Number of labels for the first variable. |
| [in] | numLabelsVar2 | Number of labels for the second variable. |
| [in] | labelOrderBegin | Iterator pointing to the begin of the weights for the label order. |
| [in] | labelOrderBegin | Iterator pointing to the end of the weights for the label order. |
| [in] | returnValid | The value which will be returned by the function evaluation if no constraint is violated. |
| [in] | returnInvalid | The 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:
|
inline |
LabelOrderFunction destructor.
Definition at line 534 of file label_order_function.hxx.
|
inlineprotected |
Implementation of LinearConstraintFunctionBase::challenge.
Definition at line 606 of file label_order_function.hxx.
|
inlineprotected |
Implementation of LinearConstraintFunctionBase::challengeRelaxed.
Definition at line 633 of file label_order_function.hxx.
|
inlineprotected |
Check label order weights. Only used for assertion in debug mode.
Definition at line 672 of file label_order_function.hxx.
Here is the caller graph for this function:
|
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:
|
inline |
Number of input variables.
Definition at line 555 of file label_order_function.hxx.
|
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:
|
inlineprotected |
Implementation of LinearConstraintFunctionBase::indicatorVariablesOrderBegin.
Definition at line 595 of file label_order_function.hxx.
|
inlineprotected |
Implementation of LinearConstraintFunctionBase::indicatorVariablesOrderEnd.
Definition at line 600 of file label_order_function.hxx.
|
inlineprotected |
Implementation of LinearConstraintFunctionBase::linearConstraintsBegin.
Definition at line 585 of file label_order_function.hxx.
|
inlineprotected |
Implementation of LinearConstraintFunctionBase::linearConstraintsEnd.
Definition at line 590 of file label_order_function.hxx.
|
inline |
Maximum value of the label order function.
Definition at line 570 of file label_order_function.hxx.
|
inline |
Minimum value of the label order function.
Definition at line 565 of file label_order_function.hxx.
|
inline |
Get minimum and maximum at the same time.
Definition at line 575 of file label_order_function.hxx.
|
inline |
Function evaluation.
| [in] | statesBegin | Iterator pointing to the begin of a sequence of labels for the variables of the function. |
Definition at line 540 of file label_order_function.hxx.
|
inline |
Number of labels of the indicated input variable.
| [in] | i | Index of the variable. |
Definition at line 549 of file label_order_function.hxx.
|
inline |
Number of parameters.
Definition at line 560 of file label_order_function.hxx.
|
protected |
Stores the linear constraints of the label order function.
Definition at line 73 of file label_order_function.hxx.
|
staticprotected |
The dimension of the label order function.
Definition at line 66 of file label_order_function.hxx.
|
protected |
A list of all indicator variables present in the label order function.
Definition at line 76 of file label_order_function.hxx.
|
protected |
The weights defining the label order.
Definition at line 70 of file label_order_function.hxx.
|
protected |
The number of labels of the first variable.
Definition at line 67 of file label_order_function.hxx.
|
protected |
The number of labels of the second variable.
Definition at line 68 of file label_order_function.hxx.
|
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.
|
protected |
Stores the return value of LabelOrderFunction::operator() if no constraint is violated.
Definition at line 71 of file label_order_function.hxx.
|
protected |
Stores the size of the label order function.
Definition at line 69 of file label_order_function.hxx.
|
static |
Describe the label order constraint in multiple linear constraints.
The label order constraint is described by the following set of linear constraints:
Where
is the weight for label i,
is the indicator variable of variable 0 which is 1 if variable 0 is set to label i and 0 otherwise,
is the indicator variable of variable 1 and n is the number of labels of variable 0.
Definition at line 25 of file label_order_function.hxx.
|
static |
Describe the label order constraint in one single linear constraint.
The label order constraint is described by the following linear constraint:
Where
is the weight for label i,
is the indicator variable of variable 0 which is 1 if variable 0 is set to label i and 0 otherwise and
is the indicator variable of variable 1.
Definition at line 24 of file label_order_function.hxx.
|
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.
|
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.
1.8.9.1