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

Default implementation for class opengm::LPFunctionTransfer. More...

#include <label_cost_function.hxx>

+ Collaboration diagram for opengm::LPFunctionTransfer_impl< FUNCTION_TYPE, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >:

Public Types

typedef VALUE_TYPE ValueType
 Typedef of the VALUE_TYPE template parameter type from the class LPFunctionTransfer_impl. More...
 
typedef INDEX_TYPE IndexType
 Typedef of the INDEX_TYPE template parameter type from the class LPFunctionTransfer_impl. More...
 
typedef LABEL_TYPE LabelType
 Typedef of the LABEL_TYPE template parameter type from the class LPFunctionTransfer_impl. More...
 
typedef FUNCTION_TYPE FunctionType
 Typedef of the FUNCTION_TYPE template parameter type from the class LPFunctionTransfer_impl. More...
 
typedef LPFunctionTransfer< ValueType, IndexType, LabelTypeLPFunctionTransferType
 Typedef of the LPFunctionTransfer class with appropriate template parameter. More...
 
typedef LPFunctionTransferType::LinearConstraintType LinearConstraintType
 Typedef of the LinearConstraint class with appropriate template parameter. More...
 
typedef LPFunctionTransferType::LinearConstraintsContainerType LinearConstraintsContainerType
 Defines the linear constraints container type which is used to store multiple linear constraints. More...
 
typedef LPFunctionTransferType::IndicatorVariableType IndicatorVariableType
 Defines the indicator variable type which is used within linear constraints. More...
 
typedef LPFunctionTransferType::IndicatorVariablesContainerType IndicatorVariablesContainerType
 Defines the indicator variables container type which is used to store multiple indicator variables. More...
 
typedef LPFunctionTransferType::SlackVariablesObjectiveCoefficientsContainerType SlackVariablesObjectiveCoefficientsContainerType
 Defines the container type which is used to store the coefficients of the slack variables for the objective function. More...
 

Static Public Member Functions

static bool isTransferable ()
 This function will tell if the function type provided via the template parameter can be transfered into a more efficient LP formulation. More...
 
static IndexType numSlackVariables (const FunctionType &function)
 This function will tell the number of required slack variables for the LP function transfer. More...
 
static void getSlackVariablesOrder (const FunctionType &function, IndicatorVariablesContainerType &order)
 This function will tell the order of the slack variables for the LP function transfer. More...
 
static void getSlackVariablesObjectiveCoefficients (const FunctionType &function, SlackVariablesObjectiveCoefficientsContainerType &coefficients)
 This function will tell the coefficients of the slack variables for the objective function of the linear program. More...
 
static void getIndicatorVariables (const FunctionType &function, IndicatorVariablesContainerType &variables)
 This function will tell the used indicator variables for the linear constraints. More...
 
static void getLinearConstraints (const FunctionType &function, LinearConstraintsContainerType &constraints)
 This function will create the necessary linear constraints to add the function to the linear program. More...
 

Detailed Description

template<class FUNCTION_TYPE, class VALUE_TYPE, class INDEX_TYPE, class LABEL_TYPE>
class opengm::LPFunctionTransfer_impl< FUNCTION_TYPE, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >

Default implementation for class opengm::LPFunctionTransfer.

Template Parameters
FUNCTION_TYPEFunction type,
VALUE_TYPEValue type.
INDEX_TYPEIndex type.
LABEL_TYPELabel type.
Note
This class has to be overwritten via partial template specialization to enable support for new function types.

Definition at line 17 of file label_cost_function.hxx.

Member Typedef Documentation

template<class FUNCTION_TYPE, class VALUE_TYPE, class INDEX_TYPE, class LABEL_TYPE>
opengm::LPFunctionTransfer_impl< FUNCTION_TYPE, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::FunctionType

Typedef of the FUNCTION_TYPE template parameter type from the class LPFunctionTransfer_impl.

Definition at line 81 of file lp_functiontransfer.hxx.

template<class FUNCTION_TYPE, class VALUE_TYPE, class INDEX_TYPE, class LABEL_TYPE>
opengm::LPFunctionTransfer_impl< FUNCTION_TYPE, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::IndexType

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

Definition at line 79 of file lp_functiontransfer.hxx.

template<class FUNCTION_TYPE, class VALUE_TYPE, class INDEX_TYPE, class LABEL_TYPE>
opengm::LPFunctionTransfer_impl< FUNCTION_TYPE, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::IndicatorVariablesContainerType

Defines the indicator variables container type which is used to store multiple indicator variables.

Definition at line 86 of file lp_functiontransfer.hxx.

template<class FUNCTION_TYPE, class VALUE_TYPE, class INDEX_TYPE, class LABEL_TYPE>
opengm::LPFunctionTransfer_impl< FUNCTION_TYPE, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::IndicatorVariableType

Defines the indicator variable type which is used within linear constraints.

Definition at line 85 of file lp_functiontransfer.hxx.

template<class FUNCTION_TYPE, class VALUE_TYPE, class INDEX_TYPE, class LABEL_TYPE>
opengm::LPFunctionTransfer_impl< FUNCTION_TYPE, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LabelType

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

Definition at line 80 of file lp_functiontransfer.hxx.

template<class FUNCTION_TYPE, class VALUE_TYPE, class INDEX_TYPE, class LABEL_TYPE>
opengm::LPFunctionTransfer_impl< FUNCTION_TYPE, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LinearConstraintsContainerType

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

Definition at line 84 of file lp_functiontransfer.hxx.

template<class FUNCTION_TYPE, class VALUE_TYPE, class INDEX_TYPE, class LABEL_TYPE>
opengm::LPFunctionTransfer_impl< FUNCTION_TYPE, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LinearConstraintType

Typedef of the LinearConstraint class with appropriate template parameter.

Definition at line 83 of file lp_functiontransfer.hxx.

template<class FUNCTION_TYPE, class VALUE_TYPE, class INDEX_TYPE, class LABEL_TYPE>
opengm::LPFunctionTransfer_impl< FUNCTION_TYPE, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::LPFunctionTransferType

Typedef of the LPFunctionTransfer class with appropriate template parameter.

Definition at line 82 of file lp_functiontransfer.hxx.

template<class FUNCTION_TYPE, class VALUE_TYPE, class INDEX_TYPE, class LABEL_TYPE>
opengm::LPFunctionTransfer_impl< FUNCTION_TYPE, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::SlackVariablesObjectiveCoefficientsContainerType

Defines the container type which is used to store the coefficients of the slack variables for the objective function.

Definition at line 87 of file lp_functiontransfer.hxx.

template<class FUNCTION_TYPE, class VALUE_TYPE, class INDEX_TYPE, class LABEL_TYPE>
opengm::LPFunctionTransfer_impl< FUNCTION_TYPE, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::ValueType

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

Definition at line 78 of file lp_functiontransfer.hxx.

Member Function Documentation

template<class FUNCTION_TYPE , class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
void opengm::LPFunctionTransfer_impl< FUNCTION_TYPE, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::getIndicatorVariables ( const FunctionType function,
IndicatorVariablesContainerType variables 
)
inlinestatic

This function will tell the used indicator variables for the linear constraints.

Note
This function will throw a runtime error of unsupported function type as getIndicatorVariables() must not be called for functions which are not supported. Supported functions are those for which a partial template specialization of the class LPFunctionTransfer_impl is provided.
Parameters
[in]functionThe function which will be transformed.
[out]variablesThis container will be filled with the indicator variables which are used in the linear constraints.

Definition at line 686 of file lp_functiontransfer.hxx.

+ Here is the caller graph for this function:

template<class FUNCTION_TYPE , class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
void opengm::LPFunctionTransfer_impl< FUNCTION_TYPE, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::getLinearConstraints ( const FunctionType function,
LinearConstraintsContainerType constraints 
)
inlinestatic

This function will create the necessary linear constraints to add the function to the linear program.

Note
This function will throw a runtime error of unsupported function type as getLinearConstraints() must not be called for functions which are not supported. Supported functions are those for which a partial template specialization of the class LPFunctionTransfer_impl is provided.
Parameters
[in]functionThe function which will be transformed.
[out]constraintsThis container will be filled with the linear constraints which are required to add the function to the linear program. Slack variables which are required for the transformation will be represented by opengm::IndicatorVariables consisting of exactly one variable-label-pair where the variable id is set to a value greater or equal to the number of variables of the function and the label is set to 0.

Definition at line 692 of file lp_functiontransfer.hxx.

+ Here is the caller graph for this function:

template<class FUNCTION_TYPE , class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
void opengm::LPFunctionTransfer_impl< FUNCTION_TYPE, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::getSlackVariablesObjectiveCoefficients ( const FunctionType function,
SlackVariablesObjectiveCoefficientsContainerType coefficients 
)
inlinestatic

This function will tell the coefficients of the slack variables for the objective function of the linear program.

Note
This function will throw a runtime error of unsupported function type as getSlackVariablesObjectiveCoefficients() must not be called for functions which are not supported. Supported functions are those for which a partial template specialization of the class LPFunctionTransfer_impl is provided.
Parameters
[in]functionThe function which will be transformed.
[out]coefficientsThis container will be filled with the coefficients of the slack variables for the objective function of the lLP.

Definition at line 680 of file lp_functiontransfer.hxx.

+ Here is the caller graph for this function:

template<class FUNCTION_TYPE , class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
void opengm::LPFunctionTransfer_impl< FUNCTION_TYPE, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::getSlackVariablesOrder ( const FunctionType function,
IndicatorVariablesContainerType order 
)
inlinestatic

This function will tell the order of the slack variables for the LP function transfer.

Note
This function will throw a runtime error of unsupported function type as getSlackVariablesOrder() must not be called for functions which are not supported. Supported functions are those for which a partial template specialization of the class LPFunctionTransfer_impl is provided.
Parameters
[in]functionThe function which will be transformed.
[out]orderThis container will be filled with the order of the slack variables.

Definition at line 674 of file lp_functiontransfer.hxx.

+ Here is the caller graph for this function:

template<class FUNCTION_TYPE , class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
bool opengm::LPFunctionTransfer_impl< FUNCTION_TYPE, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::isTransferable ( )
inlinestatic

This function will tell if the function type provided via the template parameter can be transfered into a more efficient LP formulation.

Returns
This function will always return false as this is the default return value.

Definition at line 661 of file lp_functiontransfer.hxx.

+ Here is the caller graph for this function:

template<class FUNCTION_TYPE , class VALUE_TYPE , class INDEX_TYPE , class LABEL_TYPE >
LPFunctionTransfer_impl< FUNCTION_TYPE, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::IndexType opengm::LPFunctionTransfer_impl< FUNCTION_TYPE, VALUE_TYPE, INDEX_TYPE, LABEL_TYPE >::numSlackVariables ( const FunctionType function)
inlinestatic

This function will tell the number of required slack variables for the LP function transfer.

Note
This function will throw a runtime error of unsupported function type as numSlackVariables() must not be called for functions which are not supported. Supported functions are those for which a partial template specialization of the class LPFunctionTransfer_impl is provided.
Parameters
[in]functionThe function which will be transformed.
Returns
Nothing as this function will throw a runtime error.

Definition at line 667 of file lp_functiontransfer.hxx.

+ Here is the caller graph for this function: