|
OpenGM
2.3.x
Discrete Graphical Model Library
|
Define a linear constraint for a set of indicatorVariables. More...
#include <linear_constraint.hxx>
Collaboration diagram for opengm::LinearConstraint< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >:Public Types | |
| typedef VALUE_TYPE | ValueType |
| Typedef of the VALUE_TYPE template parameter type from the class LinearConstraint. More... | |
| typedef INDEX_TYPE | IndexType |
| Typedef of the INDEX_TYPE template parameter type from the class LinearConstraint. More... | |
| typedef LABEL_TYPE | LabelType |
| Typedef of the LABEL_TYPE template parameter type from the class LinearConstraint. More... | |
| typedef IndicatorVariable< IndexType, LabelType > | IndicatorVariableType |
| Typedef of the IndicatorVariable class with appropriate template parameter. More... | |
| typedef std::vector< IndicatorVariableType > | IndicatorVariablesContainerType |
| Defines the storage type for the set of indicator variables. More... | |
| typedef std::vector< ValueType > | CoefficientsContainerType |
| Defines the storage type for the set of coefficients for the indicator variables. More... | |
| typedef ValueType | BoundType |
| Defines the data type for the bound. More... | |
| typedef LinearConstraintTraits::LinearConstraintOperator | LinearConstraintOperatorType |
| Defines the linear constraint operator. More... | |
| typedef LinearConstraintOperatorType::ValueType | LinearConstraintOperatorValueType |
| Defines the linear constraint operator type. More... | |
| typedef IndicatorVariableType::IteratorType | VariableLabelPairsIteratorType |
| Defines the const iterator type to iterate over the variable label pairs of an indicator variable. More... | |
| typedef IndicatorVariablesContainerType::const_iterator | IndicatorVariablesIteratorType |
| Defines the const iterator type to iterate over the set of indicator variables. More... | |
| typedef CoefficientsContainerType::const_iterator | CoefficientsIteratorType |
| Defines the const iterator type to iterate over the set of coefficients for the indicator variables. More... | |
Public Member Functions | |
| LinearConstraint () | |
| LinearConstraint constructor. More... | |
| LinearConstraint (const IndicatorVariablesContainerType &indicatorVariables, const CoefficientsContainerType &coefficients, const BoundType bound=0.0, const LinearConstraintOperatorValueType constraintOperator=LinearConstraintOperatorType::LessEqual) | |
| LinearConstraint constructor. More... | |
| template<class INDICATOR_VARIABLES_ITERATOR_TYPE , class COEFFICIENTS_ITERATOR_TYPE > | |
| LinearConstraint (const INDICATOR_VARIABLES_ITERATOR_TYPE indicatorVariablesBegin, const INDICATOR_VARIABLES_ITERATOR_TYPE indicatorVariablesEnd, const COEFFICIENTS_ITERATOR_TYPE coefficientsBegin, const BoundType bound=0.0, const LinearConstraintOperatorValueType constraintOperator=LinearConstraintOperatorType::LessEqual) | |
| LinearConstraint constructor. More... | |
| LinearConstraint (const LinearConstraint< ValueType, IndexType, LabelType > &linearConstraint) | |
| LinearConstraint constructor. More... | |
| void | reserve (const size_t numIndicatorVariables) |
| Preallocate memory. More... | |
| void | add (const IndicatorVariableType &indicatorVariable, const ValueType coefficient) |
| Add a single indicator variable and the corresponding coefficient to the linear constraint. More... | |
| void | add (const IndicatorVariablesContainerType &indicatorVariables, const CoefficientsContainerType &coefficients) |
| Add a set of indicator variables and the corresponding coefficients to the linear constraint. More... | |
| template<class INDICATOR_VARIABLES_ITERATOR_TYPE , class COEFFICIENTS_ITERATOR_TYPE > | |
| void | add (const INDICATOR_VARIABLES_ITERATOR_TYPE indicatorVariablesBegin, const INDICATOR_VARIABLES_ITERATOR_TYPE indicatorVariablesEnd, const COEFFICIENTS_ITERATOR_TYPE coefficientsBegin) |
| Add a set of indicator variables and the corresponding coefficients to the linear constraint. More... | |
| void | setBound (const BoundType bound) |
| Set the bound of the linear constraint. More... | |
| void | setConstraintOperator (const LinearConstraintOperatorValueType constraintOperator) |
| Set the constraint operator for the linear constraint. More... | |
| template<class ITERATOR_TYPE > | |
| ValueType | operator() (const ITERATOR_TYPE statesBegin) const |
| Evaluation operator to check if the linear constraint is violated by the given labeling. More... | |
| IndicatorVariablesIteratorType | indicatorVariablesBegin () const |
| Get the begin iterator to the set of indicator variables. More... | |
| IndicatorVariablesIteratorType | indicatorVariablesEnd () const |
| Get the end iterator to the set of indicator variables. More... | |
| CoefficientsIteratorType | coefficientsBegin () const |
| Get the begin iterator to the set of coefficients for the indicator variables. More... | |
| CoefficientsIteratorType | coefficientsEnd () const |
| Get the end iterator to the set of coefficients for the indicator variables. More... | |
| BoundType | getBound () const |
| Get the bound of the linear constraint. More... | |
| LinearConstraintOperatorValueType | getConstraintOperator () const |
| Get the constraint operator of the linear constraint. More... | |
Protected Attributes | |
| IndicatorVariablesContainerType | indicatorVariables_ |
| Storage for the set of indicator variables. More... | |
| CoefficientsContainerType | coefficients_ |
| Storage for the set of coefficients for the indicator variables. More... | |
| BoundType | bound_ |
| Storage for the bound of the linear constraint. More... | |
| LinearConstraintOperatorValueType | constraintOperator_ |
| Storage for the constraint operator of the linear constraint. More... | |
Define a linear constraint for a set of indicatorVariables.
This class defines a linear constraint for a set of indicator variables. Each variable has to be an indicator variable of the class IndicatorVariable. Each constraint consists of four parts:
The constraint will be evaluated by the following formula:
Here
represents the
-th indicator variable,
represents the coefficient belonging to the
-th indictor variable,
represents the bound and
is the selected operator type (
,
or
).
| VALUE_TYPE | Value type. |
| INDEX_TYPE | Index type. |
| LABEL_TYPE | Label type. |
Definition at line 21 of file linear_constraint.hxx.
| opengm::LinearConstraint< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::BoundType |
Defines the data type for the bound.
Definition at line 31 of file linear_constraint.hxx.
| opengm::LinearConstraint< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::CoefficientsContainerType |
Defines the storage type for the set of coefficients for the indicator variables.
Definition at line 30 of file linear_constraint.hxx.
| opengm::LinearConstraint< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::CoefficientsIteratorType |
Defines the const iterator type to iterate over the set of coefficients for the indicator variables.
Definition at line 37 of file linear_constraint.hxx.
| opengm::LinearConstraint< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::IndexType |
Typedef of the INDEX_TYPE template parameter type from the class LinearConstraint.
Definition at line 25 of file linear_constraint.hxx.
| opengm::LinearConstraint< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::IndicatorVariablesContainerType |
Defines the storage type for the set of indicator variables.
Definition at line 29 of file linear_constraint.hxx.
| opengm::LinearConstraint< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::IndicatorVariablesIteratorType |
Defines the const iterator type to iterate over the set of indicator variables.
Definition at line 36 of file linear_constraint.hxx.
| opengm::LinearConstraint< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::IndicatorVariableType |
Typedef of the IndicatorVariable class with appropriate template parameter.
Definition at line 28 of file linear_constraint.hxx.
| opengm::LinearConstraint< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LabelType |
Typedef of the LABEL_TYPE template parameter type from the class LinearConstraint.
Definition at line 26 of file linear_constraint.hxx.
| opengm::LinearConstraint< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LinearConstraintOperatorType |
Defines the linear constraint operator.
Definition at line 32 of file linear_constraint.hxx.
| opengm::LinearConstraint< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LinearConstraintOperatorValueType |
Defines the linear constraint operator type.
Definition at line 33 of file linear_constraint.hxx.
| opengm::LinearConstraint< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::ValueType |
Typedef of the VALUE_TYPE template parameter type from the class LinearConstraint.
Definition at line 24 of file linear_constraint.hxx.
| opengm::LinearConstraint< VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::VariableLabelPairsIteratorType |
Defines the const iterator type to iterate over the variable label pairs of an indicator variable.
Definition at line 35 of file linear_constraint.hxx.
|
inline |
LinearConstraint constructor.
This constructor will create an empty LinearConstraint.
Definition at line 391 of file linear_constraint.hxx.
|
inline |
LinearConstraint constructor.
This constructor will create a LinearConstraint by copying the set of indicator variables and coefficients.
| [in] | indicatorVariables | The set of indicator variables. |
| [in] | coefficients | The set of coefficients for the indicator variables. |
| [in] | bound | The right hand side of the constraint. |
| [in] | constraintOperator | The comparison operator by which the constraint will be evaluated. |
Definition at line 398 of file linear_constraint.hxx.
|
inline |
LinearConstraint constructor.
This constructor will create a LinearConstraint by copying the set of indicator variables and coefficients.
| INDICATOR_VARIABLES_ITERATOR_TYPE | Iterator type to iterate over the set of indicator variables. |
| COEFFICIENTS_ITERATOR_TYPE | Iterator type to iterate over the set of coefficients for the indicator variables. |
| [in] | indicatorVariablesBegin | Iterator pointing to the begin of the set of indicator variables. |
| [in] | indicatorVariablesEnd | Iterator pointing to the end of the set of indicator variables. |
| [in] | coefficientsBegin | Iterator pointing to the begin of the set of coefficients for the indicator variables. |
| [in] | bound | The right hand side of the constraint. |
| [in] | constraintOperator | The comparison operator by which the constraint will be evaluated. |
Definition at line 406 of file linear_constraint.hxx.
|
inline |
LinearConstraint constructor.
This constructor will create a LinearConstraint by copying an existing linear constraint.
| [in] | linearConstraint | Existing linear constraint which will be copied. |
Definition at line 414 of file linear_constraint.hxx.
|
inline |
Add a single indicator variable and the corresponding coefficient to the linear constraint.
| [in] | indicatorVariable | Indicator variable which will be added to the linear constraint. |
| [in] | coefficient | Coefficient of the indicator variable. |
Definition at line 429 of file linear_constraint.hxx.
Here is the caller graph for this function:
|
inline |
Add a set of indicator variables and the corresponding coefficients to the linear constraint.
| [in] | indicatorVariables | Set of indicator variables which will be added to the linear constraint. |
| [in] | coefficients | Set of coefficients for the indicator variables. |
Definition at line 435 of file linear_constraint.hxx.
|
inline |
Add a set of indicator variables and the corresponding coefficients to the linear constraint.
| INDICATOR_VARIABLES_ITERATOR_TYPE | Iterator type to iterate over the set of indicator variables. |
| COEFFICIENTS_ITERATOR_TYPE | Iterator type to iterate over the set of coefficients for the indicator variables. |
| [in] | indicatorVariablesBegin | Iterator pointing to the begin of the set of indicator variables which will be added to the linear constraint. |
| [in] | indicatorVariablesEnd | Iterator pointing to the end of the set of indicator variables which will be added to the linear constraint. |
| [in] | coefficientsBegin | Iterator pointing to the begin of the set of coefficients for the indicator variables. |
Definition at line 442 of file linear_constraint.hxx.
|
inline |
Get the begin iterator to the set of coefficients for the indicator variables.
Definition at line 517 of file linear_constraint.hxx.
Here is the caller graph for this function:
|
inline |
Get the end iterator to the set of coefficients for the indicator variables.
Definition at line 522 of file linear_constraint.hxx.
Here is the caller graph for this function:
|
inline |
Get the bound of the linear constraint.
Definition at line 527 of file linear_constraint.hxx.
Here is the caller graph for this function:
|
inline |
Get the constraint operator of the linear constraint.
Definition at line 532 of file linear_constraint.hxx.
Here is the caller graph for this function:
|
inline |
Get the begin iterator to the set of indicator variables.
Definition at line 507 of file linear_constraint.hxx.
Here is the caller graph for this function:
|
inline |
Get the end iterator to the set of indicator variables.
Definition at line 512 of file linear_constraint.hxx.
Here is the caller graph for this function:
|
inline |
Evaluation operator to check if the linear constraint is violated by the given labeling.
| ITERATOR_TYPE | Iterator type. |
| [in] | statesBegin | Iterator pointing to the begin of the labeling. |
Definition at line 459 of file linear_constraint.hxx.
|
inline |
Preallocate memory.
The reserve function fill preallocate enough memory to store at least the stated number of indicator variables and the corresponding coefficients.
| [in] | numIndicatorVariables | The number of indicator variables for which memory will be allocated. |
Definition at line 423 of file linear_constraint.hxx.
|
inline |
Set the bound of the linear constraint.
| [in] | bound | The new bound for the linear constraint. |
Definition at line 448 of file linear_constraint.hxx.
Here is the caller graph for this function:
|
inline |
Set the constraint operator for the linear constraint.
| [in] | constraintOperator | The new constraint operator for the linear constraint. |
Definition at line 453 of file linear_constraint.hxx.
Here is the caller graph for this function:
|
protected |
Storage for the bound of the linear constraint.
Definition at line 70 of file linear_constraint.hxx.
|
protected |
Storage for the set of coefficients for the indicator variables.
Definition at line 69 of file linear_constraint.hxx.
|
protected |
Storage for the constraint operator of the linear constraint.
Definition at line 71 of file linear_constraint.hxx.
|
protected |
Storage for the set of indicator variables.
Definition at line 68 of file linear_constraint.hxx.
1.8.9.1