|
OpenGM
2.3.x
Discrete Graphical Model Library
|
A label cost function class penalizing the usage of labels. More...
#include <label_cost_function.hxx>
Inheritance diagram for opengm::LabelCostFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >:
Collaboration diagram for opengm::LabelCostFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >:Public Types | |
| typedef VALUE_TYPE | ValueType |
| Typedef of the VALUE_TYPE template parameter type from the class LabelCostFunction. More... | |
| typedef INDEX_TYPE | IndexType |
| Typedef of the INDEX_TYPE template parameter type from the class LabelCostFunction. More... | |
| typedef LABEL_TYPE | LabelType |
| Typedef of the LABEL_TYPE template parameter type from the class LabelCostFunction. More... | |
Public Types inherited from opengm::FunctionBase< LabelCostFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > | |
| typedef AccessorIterator< FunctionShapeAccessorType, true > | FunctionShapeIteratorType |
Public Member Functions | |
| LabelCostFunction () | |
| LabelCostFunction constructor. More... | |
| template<class SHAPE_ITERATOR_TYPE , class COST_ITERATOR_TYPE > | |
| LabelCostFunction (SHAPE_ITERATOR_TYPE shapeBegin, SHAPE_ITERATOR_TYPE shapeEnd, COST_ITERATOR_TYPE costsBegin, COST_ITERATOR_TYPE costsEnd) | |
| LabelCostFunction constructor. More... | |
| template<class SHAPE_ITERATOR_TYPE > | |
| LabelCostFunction (SHAPE_ITERATOR_TYPE shapeBegin, SHAPE_ITERATOR_TYPE shapeEnd, const LabelType label, const ValueType cost) | |
| LabelCostFunction constructor. More... | |
| template<class COST_ITERATOR_TYPE > | |
| LabelCostFunction (const IndexType numVariables, const LabelType numLabels, COST_ITERATOR_TYPE costsBegin, COST_ITERATOR_TYPE costsEnd) | |
| LabelCostFunction constructor. More... | |
| LabelCostFunction (const IndexType numVariables, const LabelType numLabels, const LabelType label, const ValueType cost) | |
| LabelCostFunction constructor. More... | |
| ~LabelCostFunction () | |
| LabelCostFunction 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... | |
Public Member Functions inherited from opengm::FunctionBase< LabelCostFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > | |
| 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< VALUE_TYPE > | 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 LabelCostFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > &) const |
| FunctionShapeIteratorType | functionShapeBegin () const |
| FunctionShapeIteratorType | functionShapeEnd () const |
| size_t | numberOfParameters () const |
| INDEX_TYPE | parameterIndex (const size_t paramNumber) const |
Protected Attributes | |
| std::vector< LabelType > | shape_ |
| Storage for the shape of the function which is used if all variables can have different numbers of labels. More... | |
| IndexType | numVariables_ |
| Storage for the number of variables of the function. More... | |
| LabelType | maxNumLabels_ |
| Storage for the maximum number of labels of the function. More... | |
| bool | useSameNumLabels_ |
| Indicator to tell if all variables have the same number of labels. More... | |
| size_t | size_ |
| Stores the size of the label cost function. More... | |
| std::vector< ValueType > | costs_ |
| Storage for the label costs which is used if all labels can have label costs. More... | |
| bool | useSingleCost_ |
| Indicator to tell if only a single label has label costs. More... | |
| LabelType | singleLabel_ |
| Storage for the single label which has label costs. Is only used when useSingleCost_ is set to true. More... | |
| ValueType | singleCost_ |
| Storage for cost of the single label which has label costs. Is only used when useSingleCost_ is set to true. More... | |
A label cost function class penalizing the usage of labels.
This class implements a label cost function which penalizes the usage of labels.
where
is the cost of label
if
is used in
and zero otherwise. The function supports to assign each label a different cost or to set a cost for one label while all other costs are treated as zero.
| VALUE_TYPE | Value type. |
| INDEX_TYPE | Index type. |
| LABEL_TYPE | Label type. |
Definition at line 20 of file label_cost_function.hxx.
| opengm::LabelCostFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::IndexType |
Typedef of the INDEX_TYPE template parameter type from the class LabelCostFunction.
Definition at line 24 of file label_cost_function.hxx.
| opengm::LabelCostFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LabelType |
Typedef of the LABEL_TYPE template parameter type from the class LabelCostFunction.
Definition at line 25 of file label_cost_function.hxx.
| opengm::LabelCostFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::ValueType |
Typedef of the VALUE_TYPE template parameter type from the class LabelCostFunction.
Definition at line 23 of file label_cost_function.hxx.
|
inline |
LabelCostFunction constructor.
This constructor will create an empty LabelCostFunction.
Definition at line 285 of file label_cost_function.hxx.
|
inline |
LabelCostFunction constructor.
This constructor will create a LabelCostFunction where each variable can have a different number of labels and where a cost value is set for each label.
| SHAPE_ITERATOR_TYPE | Iterator type used to iterate over the shape of the function. |
| COST_ITERATOR_TYPE | Iterator type used to iterate over the costs for each label. |
| [in] | shapeBegin | Iterator pointing to the begin of the sequence which defines the shape of the function. |
| [in] | shapeEnd | Iterator pointing to the end of the sequence which defines the shape of the function. |
| [in] | costsBegin | Iterator pointing to the begin of the sequence of the costs for each label. |
| [in] | costsEnd | Iterator pointing to the end of the sequence of the costs for each label. |
Definition at line 293 of file label_cost_function.hxx.
|
inline |
LabelCostFunction constructor.
This constructor will create a LabelCostFunction where each variable can have a different number of labels and where a cost value is set for exactly one label while the costs for each other label will be treated as zero.
| SHAPE_ITERATOR_TYPE | Iterator type used to iterate over the shape of the function. |
| [in] | shapeBegin | Iterator pointing to the begin of the sequence which defines the shape of the function. |
| [in] | shapeEnd | Iterator pointing to the end of the sequence which defines the shape of the function. |
| [in] | label | The label for which a cost is set. |
| [in] | cost | The cost which is used for the selected label. |
Definition at line 305 of file label_cost_function.hxx.
|
inline |
LabelCostFunction constructor.
This constructor will create a LabelCostFunction where each variable has the same number of labels and where a cost value is set for each label.
| COST_ITERATOR_TYPE | Iterator type used to iterate over the costs for each label. |
| [in] | numVariables | The number of variables of the function. |
| [in] | numLabels | The number of labels for each variable of the function. |
| [in] | costsBegin | Iterator pointing to the begin of the sequence of the costs for each label. |
| [in] | costsEnd | Iterator pointing to the end of the sequence of the costs for each label. |
Definition at line 316 of file label_cost_function.hxx.
|
inline |
LabelCostFunction constructor.
This constructor will create a LabelCostFunction where each variable has the same number of labels and where a cost value is set for exactly one label while the costs for each other label will be treated as zero.
| [in] | numVariables | The number of variables of the function. |
| [in] | numLabels | The number of labels for each variable of the function. |
| [in] | label | The label for which a cost is set. |
| [in] | cost | The cost which is used for the selected label. |
Definition at line 326 of file label_cost_function.hxx.
|
inline |
LabelCostFunction destructor.
Definition at line 335 of file label_cost_function.hxx.
|
inline |
Number of input variables.
Definition at line 381 of file label_cost_function.hxx.
|
inline |
Function evaluation.
| Iterator | Iterator type |
| [in] | statesBegin | Iterator pointing to the begin of a sequence of labels for the variables of the function. |
Definition at line 341 of file label_cost_function.hxx.
|
inline |
Number of labels of the indicated input variable.
| [in] | i | Index of the variable. |
Definition at line 371 of file label_cost_function.hxx.
|
inline |
Number of parameters.
Definition at line 386 of file label_cost_function.hxx.
|
protected |
Storage for the label costs which is used if all labels can have label costs.
Definition at line 52 of file label_cost_function.hxx.
|
protected |
Storage for the maximum number of labels of the function.
Definition at line 49 of file label_cost_function.hxx.
|
protected |
Storage for the number of variables of the function.
Definition at line 48 of file label_cost_function.hxx.
|
protected |
Storage for the shape of the function which is used if all variables can have different numbers of labels.
Definition at line 47 of file label_cost_function.hxx.
|
protected |
Storage for cost of the single label which has label costs. Is only used when useSingleCost_ is set to true.
Definition at line 55 of file label_cost_function.hxx.
|
protected |
Storage for the single label which has label costs. Is only used when useSingleCost_ is set to true.
Definition at line 54 of file label_cost_function.hxx.
|
protected |
Stores the size of the label cost function.
Definition at line 51 of file label_cost_function.hxx.
|
protected |
Indicator to tell if all variables have the same number of labels.
Definition at line 50 of file label_cost_function.hxx.
|
protected |
Indicator to tell if only a single label has label costs.
Definition at line 53 of file label_cost_function.hxx.
1.8.9.1