|
OpenGM
2.3.x
Discrete Graphical Model Library
|
A sum constraint function class penalizing the violation of a given linear equality constraint. More...
#include <sum_constraint_function.hxx>
Inheritance diagram for opengm::SumConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >:
Collaboration diagram for opengm::SumConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >:Public Types | |
| typedef VALUE_TYPE | ValueType |
| Typedef of the VALUE_TYPE template parameter type from the class SumConstraintFunction. More... | |
| typedef INDEX_TYPE | IndexType |
| Typedef of the INDEX_TYPE template parameter type from the class SumConstraintFunction. More... | |
| typedef LABEL_TYPE | LabelType |
| Typedef of the LABEL_TYPE template parameter type from the class SumConstraintFunction. More... | |
Public Types inherited from opengm::FunctionBase< SumConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > | |
| typedef AccessorIterator< FunctionShapeAccessorType, true > | FunctionShapeIteratorType |
Public Member Functions | |
| SumConstraintFunction () | |
| SumConstraintFunction constructor. More... | |
| template<class SHAPE_ITERATOR_TYPE , class COEFFICIENTS_ITERATOR_TYPE > | |
| SumConstraintFunction (SHAPE_ITERATOR_TYPE shapeBegin, SHAPE_ITERATOR_TYPE shapeEnd, COEFFICIENTS_ITERATOR_TYPE coefficientsBegin, COEFFICIENTS_ITERATOR_TYPE coefficientsEnd, const bool shareCoefficients, const ValueType lambda=1.0, const ValueType bound=0.0) | |
| SumConstraintFunction constructor. More... | |
| template<class COEFFICIENTS_ITERATOR_TYPE > | |
| SumConstraintFunction (const IndexType numVariables, const LabelType numLabels, COEFFICIENTS_ITERATOR_TYPE coefficientsBegin, COEFFICIENTS_ITERATOR_TYPE coefficientsEnd, const bool shareCoefficients, const ValueType lambda=1.0, const ValueType bound=0.0) | |
| SumConstraintFunction constructor. More... | |
| ~SumConstraintFunction () | |
| SumConstraintFunction 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< SumConstraintFunction< 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 SumConstraintFunction< 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_ |
| The shape of the function. Only valid if SumConstraintFunction::useSameNumLabels_ is set to false. More... | |
| size_t | numVariables_ |
| The number of variables of the function. More... | |
| bool | useSameNumLabels_ |
| Tell if each variable of the function has the same number of labels. More... | |
| LabelType | maxNumLabels_ |
| The maximum number of labels of the variables. More... | |
| size_t | size_ |
| Stores the size of the function. More... | |
| std::vector< ValueType > | coefficients_ |
| The coefficients of the equality constraint. More... | |
| bool | shareCoefficients_ |
| Tell if the labels of the variables share the same coefficients. More... | |
| std::vector< size_t > | coefficientsOffsets_ |
| The Offsets of the SumConstraintFunction::coefficients_ indices for each variable. Only valid if SumConstraintFunction::shareCoefficients_ is set to false. More... | |
| ValueType | lambda_ |
| The scaling factor for the violation of the equality constraint. More... | |
| ValueType | bound_ |
| The bound for the equality constraint. More... | |
A sum constraint function class penalizing the violation of a given linear equality constraint.
This class implements a sum constraint function which penalizes the violation of a linear equality constraint. The function evaluates to
where
is the coefficient value of variable
if the variable takes the label
.
| VALUE_TYPE | Value type. |
| INDEX_TYPE | Index type. |
| LABEL_TYPE | Label type. |
Definition at line 20 of file sum_constraint_function.hxx.
| opengm::SumConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::IndexType |
Typedef of the INDEX_TYPE template parameter type from the class SumConstraintFunction.
Definition at line 24 of file sum_constraint_function.hxx.
| opengm::SumConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LabelType |
Typedef of the LABEL_TYPE template parameter type from the class SumConstraintFunction.
Definition at line 25 of file sum_constraint_function.hxx.
| opengm::SumConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::ValueType |
Typedef of the VALUE_TYPE template parameter type from the class SumConstraintFunction.
Definition at line 23 of file sum_constraint_function.hxx.
|
inline |
SumConstraintFunction constructor.
This constructor will create an empty SumConstraintFunction.
Definition at line 301 of file sum_constraint_function.hxx.
|
inline |
SumConstraintFunction constructor.
This constructor will create a SumConstraintFunction where each variable can have a different number of labels.
| SHAPE_ITERATOR_TYPE | Iterator type used to iterate over the shape of the function. |
| COEFFICIENTS_ITERATOR_TYPE | Iterator type used to iterate over the coefficients 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] | coefficientsBegin | Iterator pointing to the begin of the sequence which defines the coefficients of the linear constraint. There are two possibilities for the coefficients.
|
| [in] | coefficientsEnd | Iterator pointing to the end of the sequence which defines the coefficients of the linear constraint. |
| [in] | shareCoefficients | Tell if the variables share the coefficients for the labels. |
| [in] | lambda | The factor by which the violation of the equality constraint will be penalized. |
| [in] | bound | The bound of the equality constraint. |
Definition at line 310 of file sum_constraint_function.hxx.
|
inline |
SumConstraintFunction constructor.
This constructor will create a SumConstraintFunction where each variable has the same number of labels.
| COEFFICIENTS_ITERATOR_TYPE | Iterator type used to iterate over the coefficients of the function. |
| [in] | numVariables | The number of variables of the SumConstraintFunction. |
| [in] | numLabels | The number of labels of each variable. |
| [in] | coefficientsBegin | Iterator pointing to the begin of the sequence which defines the coefficients of the linear constraint. There are two possibilities for the coefficients.
|
| [in] | coefficientsEnd | Iterator pointing to the end of the sequence which defines the coefficients of the linear constraint. |
| [in] | shareCoefficients | Tell if the variables share the coefficients for the labels. |
| [in] | lambda | The factor by which the violation of the equality constraint will be penalized. |
| [in] | bound | The bound of the equality constraint. |
Definition at line 334 of file sum_constraint_function.hxx.
|
inline |
SumConstraintFunction destructor.
Definition at line 356 of file sum_constraint_function.hxx.
|
inline |
Number of input variables.
Definition at line 387 of file sum_constraint_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 362 of file sum_constraint_function.hxx.
Here is the call graph for this function:
|
inline |
Number of labels of the indicated input variable.
| [in] | i | Index of the variable. |
Definition at line 377 of file sum_constraint_function.hxx.
|
inline |
Number of parameters.
Definition at line 392 of file sum_constraint_function.hxx.
|
protected |
The bound for the equality constraint.
Definition at line 53 of file sum_constraint_function.hxx.
|
protected |
The coefficients of the equality constraint.
Definition at line 49 of file sum_constraint_function.hxx.
|
protected |
The Offsets of the SumConstraintFunction::coefficients_ indices for each variable. Only valid if SumConstraintFunction::shareCoefficients_ is set to false.
Definition at line 51 of file sum_constraint_function.hxx.
|
protected |
The scaling factor for the violation of the equality constraint.
Definition at line 52 of file sum_constraint_function.hxx.
|
protected |
The maximum number of labels of the variables.
Definition at line 47 of file sum_constraint_function.hxx.
|
protected |
The number of variables of the function.
Definition at line 45 of file sum_constraint_function.hxx.
|
protected |
The shape of the function. Only valid if SumConstraintFunction::useSameNumLabels_ is set to false.
Definition at line 44 of file sum_constraint_function.hxx.
|
protected |
Tell if the labels of the variables share the same coefficients.
Definition at line 50 of file sum_constraint_function.hxx.
|
protected |
Stores the size of the function.
Definition at line 48 of file sum_constraint_function.hxx.
|
protected |
Tell if each variable of the function has the same number of labels.
Definition at line 46 of file sum_constraint_function.hxx.
1.8.9.1