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

Default implementation of a linear constraint function class. More...

#include <linear_constraint_function.hxx>

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

Public Types

typedef LinearConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > LinearConstraintFunctionType
 Typedef of the LinearConstraintFunction 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 LinearConstraintFunction. More...
 
typedef LinearConstraintFunctionTraitsType::IndexType IndexType
 Typedef of the INDEX_TYPE template parameter type from the class LinearConstraintFunction. More...
 
typedef LinearConstraintFunctionTraitsType::LabelType LabelType
 Typedef of the LABEL_TYPE template parameter type from the class LinearConstraintFunction. 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< LinearConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >
typedef LinearConstraintFunction< 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< LinearConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >, LinearConstraintFunctionTraits< LinearConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >::ValueType, LinearConstraintFunctionTraits< LinearConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >::IndexType, LinearConstraintFunctionTraits< LinearConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >::LabelType >
typedef AccessorIterator< FunctionShapeAccessorType, true > FunctionShapeIteratorType
 

Public Member Functions

 LinearConstraintFunction ()
 LinearConstraintFunction constructor. More...
 
template<class SHAPE_ITERATOR_TYPE >
 LinearConstraintFunction (SHAPE_ITERATOR_TYPE shapeBegin, SHAPE_ITERATOR_TYPE shapeEnd, const LinearConstraintsContainerType &constraints, const ValueType returnValid=0.0, const ValueType returnInvalid=1.0)
 LinearConstraintFunction constructor. More...
 
template<class SHAPE_ITERATOR_TYPE , class CONSTRAINTS_ITERATOR_TYPE >
 LinearConstraintFunction (SHAPE_ITERATOR_TYPE shapeBegin, SHAPE_ITERATOR_TYPE shapeEnd, CONSTRAINTS_ITERATOR_TYPE constraintsBegin, CONSTRAINTS_ITERATOR_TYPE constraintsEnd, const ValueType returnValid=0.0, const ValueType returnInvalid=1.0)
 LinearConstraintFunction constructor. More...
 
 ~LinearConstraintFunction ()
 LinearConstraintFunction destructor. More...
 
template<class STATES_ITERATOR_TYPE >
ValueType operator() (STATES_ITERATOR_TYPE 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 linear constraint function. More...
 
ValueType max () const
 Maximum value of the linear constraint function. More...
 
MinMaxFunctor< ValueTypeminMax () const
 Get minimum and maximum at the same time. More...
 
- Public Member Functions inherited from opengm::LinearConstraintFunctionBase< LinearConstraintFunction< 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< LinearConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >, LinearConstraintFunctionTraits< LinearConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >::ValueType, LinearConstraintFunctionTraits< LinearConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > >::IndexType, LinearConstraintFunctionTraits< LinearConstraintFunction< 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< LinearConstraintFunction< 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 LinearConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE > &) const
 
FunctionShapeIteratorType functionShapeBegin () const
 
FunctionShapeIteratorType functionShapeEnd () const
 
size_t numberOfParameters () const
 
LinearConstraintFunctionTraits< LinearConstraintFunction< 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::indicatorVariableOrderBegin. More...
 
IndicatorVariablesIteratorType indicatorVariablesOrderEnd_impl () const
 Implementation of LinearConstraintFunctionBase::indicatorVariableOrderEnd. 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 checkConstraints () const
 Check linear constraints. Only used for assertion in debug mode. More...
 
void fillIndicatorVariableList ()
 Helper function to fill LinearConstraintFunction::indicatorVariableList_ with all indicator variables used by the linear constraint function. More...
 
void createIndicatorVariableLookupTable ()
 Helper function to create an indicator variable lookup table. The table is stored in LinearConstraintFunction::indicatorVariableLookupTable_. More...
 

Protected Attributes

std::vector< LabelTypeshape_
 Stores the shape of the linear constraint function. More...
 
size_t size_
 Stores the size of the linear constraint function. More...
 
LinearConstraintsContainerType constraints_
 Stores the constraints of the linear constraint function. More...
 
std::vector< size_tviolatedConstraintsIds_
 Stores the indices of the violated constraints which are detected by LinearConstraintFunction::challenge and LinearConstraintFunction::challengeRelaxed. More...
 
ViolatedLinearConstraintsWeightsContainerType violatedConstraintsWeights_
 Stores the weights of the violated constraints which are detected by LinearConstraintFunction::challenge and LinearConstraintFunction::challengeRelaxed. More...
 
ValueType returnValid_
 Stores the return value of LinearConstraintFunction::operator() if no constraint is violated. More...
 
ValueType returnInvalid_
 Stores the return value of LinearConstraintFunction::operator() if at least one constraint is violated. More...
 
IndicatorVariablesContainerType indicatorVariableList_
 A list of all indicator variables present in the linear constraint function. More...
 
std::vector< std::vector< size_t > > indicatorVariableLookupTable_
 Lookup table for fast access of the indicator variable IDs. More...
 

Detailed Description

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

Default implementation of a linear constraint function class.

This class implements a generic linear constraint function. May be slow for function evaluations etc. but can be used to describe all kinds of linear constraints.

Template Parameters
VALUE_TYPEThe value type used by the linear constraint function.
INDEX_TYPEThe index type used by the linear constraint function.
LABEL_TYPEThe label type used by the linear constraint function.

Definition at line 22 of file linear_constraint_function.hxx.

Member Typedef Documentation

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

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

Definition at line 29 of file linear_constraint_function.hxx.

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

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

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

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

Definition at line 30 of file linear_constraint_function.hxx.

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

Typedef of the LinearConstraintFunctionBase class with appropriate template parameter.

Definition at line 26 of file linear_constraint_function.hxx.

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

Typedef of the LinearConstraintFunctionTraits class with appropriate template parameter.

Definition at line 27 of file linear_constraint_function.hxx.

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

Typedef of the LinearConstraintFunction class with appropriate template parameter.

Definition at line 25 of file linear_constraint_function.hxx.

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

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

Definition at line 32 of file linear_constraint_function.hxx.

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

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

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

Definition at line 31 of file linear_constraint_function.hxx.

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

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

Definition at line 28 of file linear_constraint_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LinearConstraintFunction< 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 36 of file linear_constraint_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LinearConstraintFunction< 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 37 of file linear_constraint_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LinearConstraintFunction< 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 38 of file linear_constraint_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LinearConstraintFunction< 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 39 of file linear_constraint_function.hxx.

Constructor & Destructor Documentation

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

LinearConstraintFunction constructor.

This constructor will create an empty LinearConstraintFunction.

Definition at line 431 of file linear_constraint_function.hxx.

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
template<class SHAPE_ITERATOR_TYPE >
opengm::LinearConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LinearConstraintFunction ( SHAPE_ITERATOR_TYPE  shapeBegin,
SHAPE_ITERATOR_TYPE  shapeEnd,
const LinearConstraintsContainerType constraints,
const ValueType  returnValid = 0.0,
const ValueType  returnInvalid = 1.0 
)
inline

LinearConstraintFunction constructor.

This constructor will create a LinearConstraintFunction.

Template Parameters
SHAPE_ITERATOR_TYPEIterator to iterate over the shape of the function
Parameters
[in]shapeBeginIterator pointing to the begin of the sequence where the shape of the function is stored.
[in]shapeEndIterator pointing to the end of the sequence where the shape of the function is stored.
[in]constraintsThe container where the linear constraints for the linear constraint function are stored.
[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 440 of file linear_constraint_function.hxx.

+ Here is the call graph for this function:

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
template<class SHAPE_ITERATOR_TYPE , class CONSTRAINTS_ITERATOR_TYPE >
opengm::LinearConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LinearConstraintFunction ( SHAPE_ITERATOR_TYPE  shapeBegin,
SHAPE_ITERATOR_TYPE  shapeEnd,
CONSTRAINTS_ITERATOR_TYPE  constraintsBegin,
CONSTRAINTS_ITERATOR_TYPE  constraintsEnd,
const ValueType  returnValid = 0.0,
const ValueType  returnInvalid = 1.0 
)
inline

LinearConstraintFunction constructor.

This constructor will create a LinearConstraintFunction.

Template Parameters
SHAPE_ITERATOR_TYPEIterator to iterate over the shape of the function.
CONSTRAINTS_ITERATOR_TYPEIterator to iterate over the linear constraints which shall be added to the function.
Parameters
[in]shapeBeginIterator pointing to the begin of the sequence where the shape of the function is stored.
[in]shapeEndIterator pointing to the end of the sequence where the shape of the function is stored.
[in]constraintsBeginIterator pointing to the begin of the sequence where the linear constraints for the linear constraint function are stored.
[in]constraintsEndIterator pointing to the end of the sequence where the linear constraints for the linear constraint function are stored.
[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 458 of file linear_constraint_function.hxx.

+ Here is the call graph for this function:

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

LinearConstraintFunction destructor.

Definition at line 475 of file linear_constraint_function.hxx.

Member Function Documentation

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
template<class LABEL_ITERATOR >
void opengm::LinearConstraintFunction< 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 550 of file linear_constraint_function.hxx.

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
template<class LABEL_ITERATOR >
void opengm::LinearConstraintFunction< 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 >
bool opengm::LinearConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::checkConstraints ( ) const
inlineprotected

Check linear constraints. Only used for assertion in debug mode.

Returns
Returns true if all linear constraints do not violate the number of variables and states. False otherwise.

Definition at line 626 of file linear_constraint_function.hxx.

+ Here is the caller graph for this function:

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
void opengm::LinearConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::createIndicatorVariableLookupTable ( )
inlineprotected

Helper function to create an indicator variable lookup table. The table is stored in LinearConstraintFunction::indicatorVariableLookupTable_.

Definition at line 668 of file linear_constraint_function.hxx.

+ Here is the caller graph for this function:

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

Number of input variables.

Returns
Returns the number of variables.

Definition at line 499 of file linear_constraint_function.hxx.

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

Helper function to fill LinearConstraintFunction::indicatorVariableList_ with all indicator variables used by the linear constraint function.

Definition at line 653 of file linear_constraint_function.hxx.

+ Here is the caller graph for this function:

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
LinearConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::IndicatorVariablesIteratorType opengm::LinearConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::indicatorVariablesOrderBegin_impl ( ) const
inlineprotected

Implementation of LinearConstraintFunctionBase::indicatorVariableOrderBegin.

Definition at line 539 of file linear_constraint_function.hxx.

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
LinearConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::IndicatorVariablesIteratorType opengm::LinearConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::indicatorVariablesOrderEnd_impl ( ) const
inlineprotected

Implementation of LinearConstraintFunctionBase::indicatorVariableOrderEnd.

Definition at line 544 of file linear_constraint_function.hxx.

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

Maximum value of the linear constraint function.

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

Definition at line 514 of file linear_constraint_function.hxx.

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

Minimum value of the linear constraint function.

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

Definition at line 509 of file linear_constraint_function.hxx.

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

Definition at line 519 of file linear_constraint_function.hxx.

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

Function evaluation.

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

Definition at line 481 of file linear_constraint_function.hxx.

template<class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
size_t opengm::LinearConstraintFunction< 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 493 of file linear_constraint_function.hxx.

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

Number of parameters.

Returns
Returns the number of parameters.

Definition at line 504 of file linear_constraint_function.hxx.

Member Data Documentation

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

Stores the constraints of the linear constraint function.

Definition at line 65 of file linear_constraint_function.hxx.

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

A list of all indicator variables present in the linear constraint function.

Definition at line 70 of file linear_constraint_function.hxx.

template<class VALUE_TYPE, class INDEX_TYPE = size_t, class LABEL_TYPE = size_t>
opengm::LinearConstraintFunction< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::indicatorVariableLookupTable_
protected

Lookup table for fast access of the indicator variable IDs.

Definition at line 71 of file linear_constraint_function.hxx.

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

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

Definition at line 69 of file linear_constraint_function.hxx.

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

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

Definition at line 68 of file linear_constraint_function.hxx.

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

Stores the shape of the linear constraint function.

Definition at line 63 of file linear_constraint_function.hxx.

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

Stores the size of the linear constraint function.

Definition at line 64 of file linear_constraint_function.hxx.

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

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

Definition at line 66 of file linear_constraint_function.hxx.

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

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

Definition at line 67 of file linear_constraint_function.hxx.