|
OpenGM
2.3.x
Discrete Graphical Model Library
|
Base class for Linear Programming based inference. More...
#include <lp_inference_base.hxx>
Inheritance diagram for opengm::LPInferenceBase< LP_INFERENCE_TYPE >:
Collaboration diagram for opengm::LPInferenceBase< LP_INFERENCE_TYPE >:Classes | |
| struct | AddAllViolatedLinearConstraintsFunctor |
| Functor used to access the method challenge() of the underlying linear constraint function of a graphical model factor and to add all violated constraints to the LP/MIP model. More... | |
| struct | AddAllViolatedLinearConstraintsRelaxedFunctor |
| Functor used to access the method challengeRelaxed() of the underlying linear constraint function of a graphical model factor and to add all violated constraints to the LP/MIP model. More... | |
| struct | ConstraintStorage |
| Storage class for linear constraints representing the local polytope constraints. They are generated and stored for later use if LPInferenceBase::Parameter::LoosePolytope is selected as relaxation method. More... | |
| struct | GetIndicatorVariablesOrderBeginFunctor |
| Functor used to access the method indicatorVariablesOrderBegin() of the underlying linear constraint function of a graphical model factor. More... | |
| struct | GetIndicatorVariablesOrderEndFunctor |
| Functor used to access the method indicatorVariablesOrderEnd() of the underlying linear constraint function of a graphical model factor. More... | |
| struct | GetLinearConstraintsBeginFunctor |
| Functor used to access the method linearConstraintsBegin() of the underlying linear constraint function of a graphical model factor. More... | |
| struct | GetLinearConstraintsEndFunctor |
| Functor used to access the method linearConstraintsEnd() of the underlying linear constraint function of a graphical model factor. More... | |
| struct | Parameter |
| Parameter class for opengm::LPInferenceBase. More... | |
Public Types | |
| typedef LP_INFERENCE_TYPE | LPInferenceType |
| Typedef of the child class which inherits from opengm::LPInferenceBase. More... | |
| typedef LPInferenceTraits< LPInferenceType > | LPInferenceTraitsType |
| Typedef of the opengm::LPInferenceTraits class with appropriate template parameter. More... | |
| typedef LPInferenceBase< LPInferenceType > | LPInferenceBaseType |
| Typedef of the opengm::LPInferenceBase class with appropriate template parameter. More... | |
| typedef LPInferenceTraitsType::AccumulationType | AccumulationType |
| Typedef of the Accumulation type. More... | |
| typedef LPInferenceTraitsType::GraphicalModelType | GraphicalModelType |
| Typedef of the graphical model type. More... | |
| typedef visitors::VerboseVisitor< LPInferenceBaseType > | VerboseVisitorType |
| Typedef of the opengm::visitors::VerboseVisitor class with appropriate template parameter. More... | |
| typedef visitors::EmptyVisitor< LPInferenceBaseType > | EmptyVisitorType |
| Typedef of the opengm::visitors::EmptyVisitor class with appropriate template parameter. More... | |
| typedef visitors::TimingVisitor< LPInferenceBaseType > | TimingVisitorType |
| Typedef of the opengm::visitors::TimingVisitor class with appropriate template parameter. More... | |
| typedef LinearConstraint< ValueType, IndexType, LabelType > | LinearConstraintType |
| Typedef of the opengm::LinearConstraint class with appropriate template parameter. Used to represent linear constraints. More... | |
| typedef std::vector< LinearConstraintType > | LinearConstraintsContainerType |
| Typedef of the container type used to store a set of linear constraints. More... | |
| typedef LinearConstraintsContainerType::const_iterator | LinearConstraintsIteratorType |
| Typedef of the iterator type used to iterate over a set of linear constraints. More... | |
| typedef LinearConstraintType::IndicatorVariableType | IndicatorVariableType |
| Typedef of the indicator variable type used within linear constraints. More... | |
| typedef LinearConstraintType::IndicatorVariablesContainerType | IndicatorVariablesContainerType |
| Typedef of the container type used to store a set of indicator variables. More... | |
| typedef LinearConstraintType::IndicatorVariablesIteratorType | IndicatorVariablesIteratorType |
| Typedef of the iterator type used to iterate over a set of indicator variables. More... | |
| typedef LinearConstraintType::VariableLabelPairsIteratorType | VariableLabelPairsIteratorType |
| Typedef of the iterator type used to iterate over a set of varible label pairs used within an indicator variable. More... | |
| typedef LPFunctionTransfer< ValueType, IndexType, LabelType > | LPFunctionTransferType |
| Typedef of the opengm::LPFunctionTransfer class with appropriate template parameter. More... | |
| typedef LPInferenceTraitsType::SolverType | SolverType |
| Typedef of the solver type used to solve the LP or MIP which is generated from the graphical model. More... | |
| typedef LPInferenceTraitsType::SolverIndexType | SolverIndexType |
| Typedef of the index type used by the LP/MIP solver. More... | |
| typedef LPInferenceTraitsType::SolverValueType | SolverValueType |
| Typedef of the value type used by the LP/MIP solver. More... | |
| typedef LPInferenceTraitsType::SolverSolutionIteratorType | SolverSolutionIteratorType |
| Typedef of the iterator type used to iterate over the computed solution from the LP/MIP solver. More... | |
| typedef LPInferenceTraitsType::SolverTimingType | SolverTimingType |
| Typedef of the type used by the LP/MIP solver to measure timings. More... | |
| typedef LPInferenceTraitsType::SolverParameterType | SolverParameterType |
| Typedef of the parameter class used by the LP/MIP solver. More... | |
| typedef SubsequenceIterator< typename std::vector< LabelType >::const_iterator, typename std::vector< size_t >::const_iterator > | IntegerSolutionSubsequenceIterator |
| Typedef of the iterator type used to iterate over a subset of the computed solution. This iterator type is used to challenge the linear constraint functions present in the model. Only used when the problem is solved as a MIP. More... | |
| typedef SubsequenceIterator< SolverSolutionIteratorType, typename std::vector< size_t >::const_iterator > | RelaxedSolutionSubsequenceIterator |
| Typedef of the iterator type used to iterate over a subset of the computed solution. This iterator type is used to challenge the linear constraint functions present in the model. Only used when the problem is solved as a LP. More... | |
Public Types inherited from opengm::Inference< LPInferenceTraits< LP_INFERENCE_TYPE >::GraphicalModelType, LPInferenceTraits< LP_INFERENCE_TYPE >::AccumulationType > | |
| typedef LPInferenceTraits< LP_INFERENCE_TYPE >::GraphicalModelType | GraphicalModelType |
| typedef LPInferenceTraits< LP_INFERENCE_TYPE >::AccumulationType | AccumulationType |
| typedef GraphicalModelType::LabelType | LabelType |
| typedef GraphicalModelType::IndexType | IndexType |
| typedef GraphicalModelType::ValueType | ValueType |
| typedef GraphicalModelType::OperatorType | OperatorType |
| typedef GraphicalModelType::FactorType | FactorType |
| typedef GraphicalModelType::IndependentFactorType | IndependentFactorType |
| typedef GraphicalModelType::FunctionIdentifier | FunctionIdentifier |
Public Member Functions | |
| virtual const GraphicalModelType & | graphicalModel () const |
| Get graphical model. More... | |
| virtual InferenceTermination | infer () |
| Run inference with empty visitor. More... | |
| template<class VISITOR_TYPE > | |
| InferenceTermination | infer (VISITOR_TYPE &visitor) |
| Run inference with provided visitor. More... | |
| virtual ValueType | bound () const |
| Get the current bound. More... | |
| virtual ValueType | value () const |
| Get the current value. More... | |
| virtual InferenceTermination | arg (std::vector< LabelType > &x, const size_t N=1) const |
| Get the current argument. More... | |
Public Member Functions inherited from opengm::Inference< LPInferenceTraits< LP_INFERENCE_TYPE >::GraphicalModelType, LPInferenceTraits< LP_INFERENCE_TYPE >::AccumulationType > | |
| virtual | ~Inference () |
| virtual std::string | name () const =0 |
| virtual void | setStartingPoint (typename std::vector< LabelType >::const_iterator) |
| set initial labeling More... | |
| virtual InferenceTermination | args (std::vector< std::vector< LabelType > > &) const |
| virtual InferenceTermination | marginal (const size_t, IndependentFactorType &) const |
| output a solution for a marginal for a specific variable More... | |
| virtual InferenceTermination | factorMarginal (const size_t, IndependentFactorType &) const |
| output a solution for a marginal for all variables connected to a factor More... | |
| InferenceTermination | constrainedOptimum (std::vector< IndexType > &, std::vector< LabelType > &, std::vector< LabelType > &) const |
| InferenceTermination | modeFromMarginal (std::vector< LabelType > &) const |
| InferenceTermination | modeFromFactorMarginal (std::vector< LabelType > &) const |
Public Attributes | |
| OPENGM_GM_TYPE_TYPEDEFS | |
Protected Types | |
| typedef std::list< ConstraintStorage > | InactiveConstraintsListType |
| Typedef of the container type used to sore a set of LPInferenceBase::ConstraintStorage objects. More... | |
| typedef InactiveConstraintsListType::iterator | InactiveConstraintsListIteratorType |
| Typedef of the iterator type used to iterate over a set of LPInferenceBase::ConstraintStorage objects. More... | |
| typedef std::pair< IndexType, const LinearConstraintType * > | FactorIndexConstraintPointerPairType |
| Typedef of the pair type used to store a pointer to a linear constraint in combination with the linear constraint factor index it belongs to. More... | |
| typedef std::pair< InactiveConstraintsListIteratorType, FactorIndexConstraintPointerPairType > | InactiveConstraintFactorConstraintPairType |
| Typedef of the pair type used to store a pointer to an inactive constraint of the local polytope constraints and a LPInferenceBase::FactorIndexConstraintPointerPairType. More... | |
| typedef std::multimap< double, InactiveConstraintFactorConstraintPairType > | SortedViolatedConstraintsListType |
| Typedef of the map type used to store a set of violated constraints sorted by their weights. Is only used when LPInferenceBase::Parameter::Weighted is selected as challenge heuristic. More... | |
| typedef meta::GetLinearConstraintFunctionTypeList< typename GraphicalModelType::FunctionTypeList >::type | LinearConstraintFunctionTypeList |
| Typelist of all linear constraint function types which are present in the graphical model type. More... | |
Protected Member Functions | |
| LPInferenceBase (const GraphicalModelType &gm, const Parameter ¶meter=Parameter()) | |
| LPInferenceBase constructor. More... | |
| virtual | ~LPInferenceBase () |
| LPInferenceBase destructor. More... | |
| void | sortFactors () |
| Sorts the factors of the graphical model into the lists unaryFactors_, higherOrderFactors_, linearConstraintFactors_ and transferableFactors_. More... | |
| void | countLPVariables () |
| Count the number of lp variables required to build a lp model for inference of the graphical model. More... | |
| void | fillLinearConstraintLPVariablesSubsequenceIndices () |
| Fill the variable LPInferenceBase::linearConstraintLPVariablesSubsequenceIndices_ with the appropriate indices of the subset of the solution variables which are relevant for each linear constraint. More... | |
| void | setAccumulation () |
| Set the accumulation for the lp solver. More... | |
| void | addLPVariables () |
| Add the number of lp variables computed by LPInferenceBase::countLPVariables to the lp model. More... | |
| void | createObjectiveFunction () |
| Create the objective function for the lp model. More... | |
| void | addLocalPolytopeConstraints () |
| Add all constraints to the lp model which are required by the local polytope relaxation. More... | |
| void | addLoosePolytopeConstraints () |
| Add all constraints to the lp model which are required by the loose polytope relaxation. More... | |
| void | addTightPolytopeConstraints () |
| Add all constraints to the lp model which are required by the tight polytope relaxation. More... | |
| SolverIndexType | nodeLPVariableIndex (const IndexType nodeID, const LabelType label) const |
| Get the lp variable which corresponds to the variable label pair of the graphical model. More... | |
| SolverIndexType | factorLPVariableIndex (const IndexType factorID, const size_t labelingIndex) const |
| Get the lp variable which corresponds to the labeling of the factor. More... | |
| template<class LABELING_ITERATOR_TYPE > | |
| SolverIndexType | factorLPVariableIndex (const IndexType factorID, LABELING_ITERATOR_TYPE labelingBegin, const LABELING_ITERATOR_TYPE labelingEnd) const |
| Get the lp variable which corresponds to the labeling of the factor. More... | |
| template<class HIGHER_ORDER_FACTORS_MAP_TYPE , class INDICATOR_VARIABLES_MAP_TYPE > | |
| bool | getLPVariableIndexFromIndicatorVariable (const HIGHER_ORDER_FACTORS_MAP_TYPE &higherOrderFactorVariablesLookupTable, const INDICATOR_VARIABLES_MAP_TYPE &indicatorVariablesLookupTable, const IndicatorVariableType &indicatorVariable, const IndexType linearConstraintFactorIndex, SolverIndexType &lpVariableIndex) const |
| Get the index of the lp variable associated with an indicator variable. More... | |
| void | addLocalPolytopeVariableConstraint (const IndexType variableID, const bool addToModel) |
| Add a new variable constraint to the lp model. More... | |
| void | addLocalPolytopeFactorConstraint (const IndexType factor, const IndexType variable, const LabelType label, const bool addToModel) |
| Add a new factor constraint to the lp model. More... | |
| void | addIndicatorVariableConstraints (const IndexType factor, const IndicatorVariableType &indicatorVariable, const SolverIndexType indicatorVariableLPVariable, const bool addToModel) |
| Add constraints for an indicator variable to the lp model. More... | |
| void | addLinearConstraint (const IndexType linearConstraintFactor, const LinearConstraintType &constraint) |
| Add a new linear constraint from a linear constraint function to the lp model. More... | |
| template<class VISITOR_TYPE > | |
| InferenceTermination | infer_impl_selectRelaxation (VISITOR_TYPE &visitor) |
| Helper function for LPInferenceBase::infer_impl to select the relaxation template parameter. More... | |
| template<class VISITOR_TYPE , typename Parameter::Relaxation RELAXATION> | |
| InferenceTermination | infer_impl_selectHeuristic (VISITOR_TYPE &visitor) |
| Helper function for LPInferenceBase::infer_impl to select the challenge heuristic template parameter. More... | |
| template<class VISITOR_TYPE , typename Parameter::Relaxation RELAXATION, typename Parameter::ChallengeHeuristic HEURISTIC> | |
| InferenceTermination | infer_impl_selectIterations (VISITOR_TYPE &visitor) |
| Helper function for LPInferenceBase::infer_impl to select the use infinite iterations template parameter. More... | |
| template<class VISITOR_TYPE , typename Parameter::Relaxation RELAXATION, typename Parameter::ChallengeHeuristic HEURISTIC, bool USE_INFINITE_ITERATIONS> | |
| InferenceTermination | infer_impl_selectViolatedConstraints (VISITOR_TYPE &visitor) |
| Helper function for LPInferenceBase::infer_impl to select the add all violated constraints template parameter. More... | |
| template<class VISITOR_TYPE , typename Parameter::Relaxation RELAXATION, typename Parameter::ChallengeHeuristic HEURISTIC, bool USE_INFINITE_ITERATIONS, bool ADD_ALL_VIOLATED_CONSTRAINTS> | |
| InferenceTermination | infer_impl_selectLPType (VISITOR_TYPE &visitor) |
| Helper function for LPInferenceBase::infer_impl to select the use integer constraints template parameter. More... | |
| template<class VISITOR_TYPE , typename Parameter::Relaxation RELAXATION, typename Parameter::ChallengeHeuristic HEURISTIC, bool USE_INFINITE_ITERATIONS, bool ADD_ALL_VIOLATED_CONSTRAINTS, bool USE_INTEGER_CONSTRAINTS> | |
| InferenceTermination | infer_impl (VISITOR_TYPE &visitor) |
| The implementation of the inference method. More... | |
| template<typename Parameter::Relaxation RELAXATION, typename Parameter::ChallengeHeuristic HEURISTIC, bool ADD_ALL_VIOLATED_CONSTRAINTS> | |
| bool | tightenPolytope () |
| Search for linear constraints which are violated by the current integer solution and add them to the MIP model. More... | |
| template<typename Parameter::Relaxation RELAXATION, typename Parameter::ChallengeHeuristic HEURISTIC, bool ADD_ALL_VIOLATED_CONSTRAINTS> | |
| bool | tightenPolytopeRelaxed () |
| Search for linear constraints which are violated by the current relaxed solution and add them to the LP model. More... | |
| void | checkInactiveConstraint (const ConstraintStorage &constraint, double &weight) const |
| Check if a given linear constraint from the local polytope constraints is violated. More... | |
| void | addInactiveConstraint (const ConstraintStorage &constraint) |
| Add a linear constraint from the local polytope constraint to the LP/MIP model. More... | |
Protected Attributes | |
| const GraphicalModelType & | gm_ |
| Reference to the graphical model. More... | |
| const Parameter | parameter_ |
| Parameter which stores the settings for the inference. More... | |
| ValueType | constValue_ |
| Constant value offset. More... | |
| std::vector< IndexType > | unaryFactors_ |
| List of all unary factors. More... | |
| std::vector< IndexType > | higherOrderFactors_ |
| List of all higher order factors. More... | |
| std::vector< IndexType > | linearConstraintFactors_ |
| List of all linear constraint factors. More... | |
| std::vector< IndexType > | transferableFactors_ |
| List of all transferable factors. More... | |
| bool | inferenceStarted_ |
| Tell if inference was already started. More... | |
| SolverIndexType | numLPVariables_ |
| The total number of lp variables except slack variables. More... | |
| SolverIndexType | numNodesLPVariables_ |
| The number of lp variables for the nodes of the graphical model. More... | |
| SolverIndexType | numFactorsLPVariables_ |
| The number of lp variables for the factors of the graphical model. More... | |
| SolverIndexType | numLinearConstraintsLPVariables_ |
| The number of lp variables for the linear constraint factors of the graphical model. More... | |
| SolverIndexType | numTransferedFactorsLPVariables |
| The number of lp variables for the transferable factors of the graphical model. More... | |
| SolverIndexType | numSlackVariables_ |
| The number of slack variables for the transferable factors of the graphical model. More... | |
| std::vector< SolverIndexType > | nodesLPVariablesOffset_ |
| The offsets for the indices of the lp variables for each node of the graphical model. More... | |
| std::vector< SolverIndexType > | factorsLPVariablesOffset_ |
| The offsets for the indices of the lp variables for each factor of the graphical model. More... | |
| std::vector< std::map< const IndicatorVariableType, SolverIndexType > > | linearConstraintsLPVariablesIndicesLookupTable_ |
| Lookup table for the lp variable indices of each linear constraint. More... | |
| std::vector< std::map< const IndicatorVariableType, SolverIndexType > > | transferedFactorsLPVariablesIndicesLookupTable_ |
| Lookup table for the lp variable indices of each transferable factor. More... | |
| std::vector< std::vector< size_t > > | linearConstraintLPVariablesSubsequenceIndices_ |
| The indices of the subset of the solution variables which are relevant for each linear constraint. More... | |
| IndexType | addLocalPolytopeFactorConstraintCachePreviousFactorID_ |
| Cache for the function LPInferenceBase::addLocalPolytopeFactorConstraint. It is used to store the factor id used for the last call of this function. If the previous factor id and the factor id of the current call to LPInferenceBase::addLocalPolytopeFactorConstraint are the same, the variable LPInferenceBase::addLocalPolytopeFactorConstraintCacheFactorLPVariableIDs_ does not have to be updated. More... | |
| marray::Marray< SolverIndexType > | addLocalPolytopeFactorConstraintCacheFactorLPVariableIDs_ |
| Lookup table for the factor lp variable ids required by the LPInferenceBase::addLocalPolytopeFactorConstraint function. This lookup table is cached as it may not be necessary to create a new lookup table at each function call. This is only required if the factor id of the previous function call and the factor id of the current function call differ. The factor id of the previous function call is stored in the variable LPInferenceBase::addLocalPolytopeFactorConstraintCachePreviousFactorID_. More... | |
| InactiveConstraintsListType | inactiveConstraints_ |
| Storage for all linear constraints representing the local polytope constraints. They are generated and stored for later use if LPInferenceBase::Parameter::LoosePolytope is selected as relaxation method. The constraints are removed from this list when they are added to the LP/MIP model. More... | |
Base class for Linear Programming based inference.
This base class provides optimization by Linear Programming (LP) or Mixed Integer Programming (MIP) it can be used with different LP and MIP solvers (e.g. IBM ILOG CPLEX). Only a small interface class has to be written for each desired LP and MIP solver. It uses the curiously recurring template pattern (CRTP) to provide static polymorphism.
| LP_INFERENCE_TYPE | The lp inference class. |
Definition at line 29 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::AccumulationType |
Typedef of the Accumulation type.
Definition at line 35 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::EmptyVisitorType |
Typedef of the opengm::visitors::EmptyVisitor class with appropriate template parameter.
Definition at line 40 of file lp_inference_base.hxx.
|
protected |
Typedef of the pair type used to store a pointer to a linear constraint in combination with the linear constraint factor index it belongs to.
Definition at line 108 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::GraphicalModelType |
Typedef of the graphical model type.
Definition at line 36 of file lp_inference_base.hxx.
|
protected |
Typedef of the pair type used to store a pointer to an inactive constraint of the local polytope constraints and a LPInferenceBase::FactorIndexConstraintPointerPairType.
Definition at line 109 of file lp_inference_base.hxx.
|
protected |
Typedef of the iterator type used to iterate over a set of LPInferenceBase::ConstraintStorage objects.
Definition at line 107 of file lp_inference_base.hxx.
|
protected |
Typedef of the container type used to sore a set of LPInferenceBase::ConstraintStorage objects.
Definition at line 106 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::IndicatorVariablesContainerType |
Typedef of the container type used to store a set of indicator variables.
Definition at line 47 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::IndicatorVariablesIteratorType |
Typedef of the iterator type used to iterate over a set of indicator variables.
Definition at line 48 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::IndicatorVariableType |
Typedef of the indicator variable type used within linear constraints.
Definition at line 46 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::IntegerSolutionSubsequenceIterator |
Typedef of the iterator type used to iterate over a subset of the computed solution. This iterator type is used to challenge the linear constraint functions present in the model. Only used when the problem is solved as a MIP.
Definition at line 60 of file lp_inference_base.hxx.
|
protected |
Typelist of all linear constraint function types which are present in the graphical model type.
Definition at line 221 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::LinearConstraintsContainerType |
Typedef of the container type used to store a set of linear constraints.
Definition at line 44 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::LinearConstraintsIteratorType |
Typedef of the iterator type used to iterate over a set of linear constraints.
Definition at line 45 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::LinearConstraintType |
Typedef of the opengm::LinearConstraint class with appropriate template parameter. Used to represent linear constraints.
Definition at line 43 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::LPFunctionTransferType |
Typedef of the opengm::LPFunctionTransfer class with appropriate template parameter.
Definition at line 51 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::LPInferenceBaseType |
Typedef of the opengm::LPInferenceBase class with appropriate template parameter.
Definition at line 34 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::LPInferenceTraitsType |
Typedef of the opengm::LPInferenceTraits class with appropriate template parameter.
Definition at line 33 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::LPInferenceType |
Typedef of the child class which inherits from opengm::LPInferenceBase.
Definition at line 32 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::RelaxedSolutionSubsequenceIterator |
Typedef of the iterator type used to iterate over a subset of the computed solution. This iterator type is used to challenge the linear constraint functions present in the model. Only used when the problem is solved as a LP.
Definition at line 61 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::SolverIndexType |
Typedef of the index type used by the LP/MIP solver.
Definition at line 54 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::SolverParameterType |
Typedef of the parameter class used by the LP/MIP solver.
Definition at line 58 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::SolverSolutionIteratorType |
Typedef of the iterator type used to iterate over the computed solution from the LP/MIP solver.
Definition at line 56 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::SolverTimingType |
Typedef of the type used by the LP/MIP solver to measure timings.
Definition at line 57 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::SolverType |
Typedef of the solver type used to solve the LP or MIP which is generated from the graphical model.
Definition at line 53 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::SolverValueType |
Typedef of the value type used by the LP/MIP solver.
Definition at line 55 of file lp_inference_base.hxx.
|
protected |
Typedef of the map type used to store a set of violated constraints sorted by their weights. Is only used when LPInferenceBase::Parameter::Weighted is selected as challenge heuristic.
Definition at line 110 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::TimingVisitorType |
Typedef of the opengm::visitors::TimingVisitor class with appropriate template parameter.
Definition at line 41 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::VariableLabelPairsIteratorType |
Typedef of the iterator type used to iterate over a set of varible label pairs used within an indicator variable.
Definition at line 49 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::VerboseVisitorType |
Typedef of the opengm::visitors::VerboseVisitor class with appropriate template parameter.
Definition at line 39 of file lp_inference_base.hxx.
|
inlineprotected |
LPInferenceBase constructor.
| [in] | gm | The graphical model which will be solved. |
| [in] | parameter | Parameter providing the settings for the inference. |
Definition at line 1828 of file lp_inference_base.hxx.
Here is the call graph for this function:
|
inlineprotectedvirtual |
LPInferenceBase destructor.
Definition at line 1892 of file lp_inference_base.hxx.
|
inlineprotected |
Add a linear constraint from the local polytope constraint to the LP/MIP model.
| [in] | constraint | The linear constraint which will be added to the LP/MIP model. |
Definition at line 3225 of file lp_inference_base.hxx.
|
inlineprotected |
Add constraints for an indicator variable to the lp model.
Depending on the selected logical ooperator type there are three possibilities for an indicator variable:
. Hence the indicator variable
is one if all lp variables
are one and zero if at least one lp variable
is zero. The constraints which are added to achieve the logical conjunction are:
. Hence the indicator variable
is one if at least one lp variable
is one and zero if all lp variables are zero. The constraints which are added to achieve the logical disjunction are:
. Hence the indicator variable
is one if all lp variables
are zero and zero if at least one lp variable
is one. The constraints which are added to achieve the logical not are:
| [in] | factor | The index of the factor for which the indicator variable constraints will be added. |
| [in] | indicatorVariable | The index of the indicator variable from the factor for which the constraints will be added. |
| [in] | indicatorVariableLPVariable | The index of the lp variable which represents the indicator variable. |
| [in] | addToModel | Indicator to tell if the constraints shall be added directly to the LP/MIP model. If set to false the constraints will be added to LPInferenceBase::inactiveConstraints_. |
Definition at line 2557 of file lp_inference_base.hxx.
Here is the call graph for this function:
|
inlineprotected |
Add a new linear constraint from a linear constraint function to the lp model.
| [in] | linearConstraintFactor | The index of the linear constraint factor for which the linear constraint will be added. |
| [in] | constraint | The new linear constraint factor. |
Definition at line 2743 of file lp_inference_base.hxx.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlineprotected |
Add all constraints to the lp model which are required by the local polytope relaxation.
Definition at line 2199 of file lp_inference_base.hxx.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlineprotected |
Add a new factor constraint to the lp model.
The new factor constraint has the form
where
is the lp variable corresponding to the
-th label of variable
from the graphical model and
is the lp variable which corresponds to the
-th variable of the factor where variable
is fixed to the label
.
| [in] | factor | The factor for which the constraint will be added to the lp model. |
| [in] | variable | The variable of the factor for which the constraint will be added to the lp model. |
| [in] | label | The label of the variable of the factor for which the constraint will be added to the lp model. |
| [in] | addToModel | Indicator to tell if the constraint shall be added directly to the LP/MIP model. If set to false the constraint will be added to LPInferenceBase::inactiveConstraints_. |
Definition at line 2501 of file lp_inference_base.hxx.
Here is the call graph for this function:
|
inlineprotected |
Add a new variable constraint to the lp model.
The new variable constraint has the form
where
is the lp variable corresponding to the
-th label of the graphical model variable.
| [in] | variableID | The variable for which the new constraint will be added. |
| [in] | addToModel | Indicator to tell if the constraint shall be added directly to the LP/MIP model. If set to false the constraint will be added to LPInferenceBase::inactiveConstraints_. |
Definition at line 2468 of file lp_inference_base.hxx.
|
inlineprotected |
Add all constraints to the lp model which are required by the loose polytope relaxation.
Definition at line 2279 of file lp_inference_base.hxx.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlineprotected |
Add the number of lp variables computed by LPInferenceBase::countLPVariables to the lp model.
Definition at line 2124 of file lp_inference_base.hxx.
Here is the caller graph for this function:
|
inlineprotected |
Add all constraints to the lp model which are required by the tight polytope relaxation.
Definition at line 2357 of file lp_inference_base.hxx.
Here is the caller graph for this function:
|
inlinevirtual |
Get the current argument.
| [out] | x | Will be filled with the current argument. |
| [in] | N | UNKNOWN???? |
Reimplemented from opengm::Inference< LPInferenceTraits< LP_INFERENCE_TYPE >::GraphicalModelType, LPInferenceTraits< LP_INFERENCE_TYPE >::AccumulationType >.
Definition at line 1800 of file lp_inference_base.hxx.
Here is the caller graph for this function:
|
inlinevirtual |
Get the current bound.
Reimplemented from opengm::Inference< LPInferenceTraits< LP_INFERENCE_TYPE >::GraphicalModelType, LPInferenceTraits< LP_INFERENCE_TYPE >::AccumulationType >.
Definition at line 1783 of file lp_inference_base.hxx.
|
inlineprotected |
Check if a given linear constraint from the local polytope constraints is violated.
| [in] | constraint | The linear constraint which will be checked for violation. |
| [out] | weight | The weight by which the constraint is violated. Will be set to 0.0 if the constraint is not violated. |
Definition at line 3189 of file lp_inference_base.hxx.
Here is the call graph for this function:
|
inlineprotected |
Count the number of lp variables required to build a lp model for inference of the graphical model.
Definition at line 1917 of file lp_inference_base.hxx.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlineprotected |
Create the objective function for the lp model.
Definition at line 2146 of file lp_inference_base.hxx.
Here is the caller graph for this function:
|
inlineprotected |
Get the lp variable which corresponds to the labeling of the factor.
| [in] | factorID | The index of the factor. |
| [in] | labelingIndex | The index describing the selected labeling. |
Definition at line 2384 of file lp_inference_base.hxx.
|
inlineprotected |
Get the lp variable which corresponds to the labeling of the factor.
| LABELING_ITERATOR_TYPE | Iterator type to iterate over the selected labeling. |
| [in] | factorID | The index of the factor. |
| [in] | labelingBegin | Iterator pointing to the begin of the selected labeling. |
| [in] | labelingEnd | Iterator pointing to the end of the selected labeling. |
Definition at line 2393 of file lp_inference_base.hxx.
|
inlineprotected |
Fill the variable LPInferenceBase::linearConstraintLPVariablesSubsequenceIndices_ with the appropriate indices of the subset of the solution variables which are relevant for each linear constraint.
Definition at line 2086 of file lp_inference_base.hxx.
Here is the caller graph for this function:
|
inlineprotected |
Get the index of the lp variable associated with an indicator variable.
| HIGHER_ORDER_FACTORS_MAP_TYPE | The type of the map which is used as a lookup table for the higher order factors. |
| INDICATOR_VARIABLES_MAP_TYPE | The type of the map which is used as a lookup table for the indicator variables. |
| [in] | higherOrderFactorVariablesLookupTable | The lookup table which is used to check if another factor is connected to the exact same variables of the graphical model as the indicator variable. |
| [in] | indicatorVariablesLookupTable | The lookup table which is used to check if another indicator variable with the same set of variable label pairs exists. |
| [in] | indicatorVariable | The indicator variable for which the corresponding lp variable is searched. |
| [in] | linearConstraintFactorIndex | The index of the linear constraint factor to which the indicator variable belongs. |
| [out] | lpVariableIndex | If a lp variable which is associated with the indicator variable is found the corresponding index will be stored in this variable. |
Definition at line 2415 of file lp_inference_base.hxx.
Here is the call graph for this function:
|
inlinevirtual |
Get graphical model.
Definition at line 1763 of file lp_inference_base.hxx.
|
inlinevirtual |
Run inference with empty visitor.
Definition at line 1768 of file lp_inference_base.hxx.
|
inline |
Run inference with provided visitor.
| VISITOR_TYPE | The visitor type used to log inference. |
| [in,out] | visitor | The provided inference visitor. |
Definition at line 1775 of file lp_inference_base.hxx.
Here is the call graph for this function:
|
inlineprotected |
The implementation of the inference method.
| VISITOR_TYPE | The type of the visitor. |
| RELAXATION | The selected relaxation type. |
| HEURISTIC | The selected Heuristic type. |
| USE_INFINITE_ITERATIONS | Tell if inference is performed until no more violated constraints are found. |
| ADD_ALL_VIOLATED_CONSTRAINTS | Tell if all violated constraints which were found during one iteration are added to the lp model. |
| USE_INTEGER_CONSTRAINTS | Tell if the current model is a LP or a MIP model. |
| [in,out] | visitor | The visitor used during inference. |
Definition at line 2832 of file lp_inference_base.hxx.
Here is the call graph for this function:
|
inlineprotected |
Helper function for LPInferenceBase::infer_impl to select the challenge heuristic template parameter.
| VISITOR_TYPE | The type of the visitor. |
| RELAXATION | The selected relaxation type. |
| [in,out] | visitor | The visitor which will be passed to LPInferenceBase::infer_impl. |
Definition at line 2786 of file lp_inference_base.hxx.
|
inlineprotected |
Helper function for LPInferenceBase::infer_impl to select the use infinite iterations template parameter.
| VISITOR_TYPE | The type of the visitor. |
| RELAXATION | The selected relaxation type. |
| HEURISTIC | The selected Heuristic type. |
| [in,out] | visitor | The visitor which will be passed to LPInferenceBase::infer_impl. |
Definition at line 2802 of file lp_inference_base.hxx.
|
inlineprotected |
Helper function for LPInferenceBase::infer_impl to select the use integer constraints template parameter.
| VISITOR_TYPE | The type of the visitor. |
| RELAXATION | The selected relaxation type. |
| HEURISTIC | The selected Heuristic type. |
| USE_INFINITE_ITERATIONS | Tell if inference is performed until no more violated constraints are found. |
| ADD_ALL_VIOLATED_CONSTRAINTS | Tell if all violated constraints which were found during one iteration are added to the lp model. |
| [in,out] | visitor | The visitor which will be passed to LPInferenceBase::infer_impl. |
Definition at line 2822 of file lp_inference_base.hxx.
|
inlineprotected |
Helper function for LPInferenceBase::infer_impl to select the relaxation template parameter.
| VISITOR_TYPE | The type of the visitor. |
| [in,out] | visitor | The visitor which will be passed to LPInferenceBase::infer_impl. |
Definition at line 2767 of file lp_inference_base.hxx.
Here is the caller graph for this function:
|
inlineprotected |
Helper function for LPInferenceBase::infer_impl to select the add all violated constraints template parameter.
| VISITOR_TYPE | The type of the visitor. |
| RELAXATION | The selected relaxation type. |
| HEURISTIC | The selected Heuristic type. |
| USE_INFINITE_ITERATIONS | Tell if inference is performed until no more violated constraints are found. |
| [in,out] | visitor | The visitor which will be passed to LPInferenceBase::infer_impl. |
Definition at line 2812 of file lp_inference_base.hxx.
|
inlineprotected |
Get the lp variable which corresponds to the variable label pair of the graphical model.
| [in] | nodeID | The variable of the graphical model. |
| [in] | label | The label of the variable. |
Definition at line 2377 of file lp_inference_base.hxx.
|
inlineprotected |
Set the accumulation for the lp solver.
Definition at line 2113 of file lp_inference_base.hxx.
Here is the caller graph for this function:
|
inlineprotected |
Sorts the factors of the graphical model into the lists unaryFactors_, higherOrderFactors_, linearConstraintFactors_ and transferableFactors_.
Definition at line 1897 of file lp_inference_base.hxx.
Here is the caller graph for this function:
|
inlineprotected |
Search for linear constraints which are violated by the current integer solution and add them to the MIP model.
| RELAXATION | Tell which relaxation is used and therefore which constraints have to be evaluated to check if they are violated. |
| HEURISTIC | Tell which challenge heuristic will be used to add violated constraints. |
| ADD_ALL_VIOLATED_CONSTRAINTS | If set to true all violated constraints will be added to the MIP model. Otherwise only the number of violated constraints specified by the LPInferenceBase::parameter_ will be added. |
Definition at line 2900 of file lp_inference_base.hxx.
|
inlineprotected |
Search for linear constraints which are violated by the current relaxed solution and add them to the LP model.
| RELAXATION | Tell which relaxation is used and therefore which constraints have to be evaluated to check if they are violated. |
| HEURISTIC | Tell which challenge heuristic will be used to add violated constraints. |
| ADD_ALL_VIOLATED_CONSTRAINTS | If set to true all violated constraints will be added to the LP model. Otherwise only the number of violated constraints specified by the LPInferenceBase::parameter_ will be added. |
Definition at line 3044 of file lp_inference_base.hxx.
|
inlinevirtual |
Get the current value.
Reimplemented from opengm::Inference< LPInferenceTraits< LP_INFERENCE_TYPE >::GraphicalModelType, LPInferenceTraits< LP_INFERENCE_TYPE >::AccumulationType >.
Definition at line 1793 of file lp_inference_base.hxx.
Here is the call graph for this function:
|
protected |
Lookup table for the factor lp variable ids required by the LPInferenceBase::addLocalPolytopeFactorConstraint function. This lookup table is cached as it may not be necessary to create a new lookup table at each function call. This is only required if the factor id of the previous function call and the factor id of the current function call differ. The factor id of the previous function call is stored in the variable LPInferenceBase::addLocalPolytopeFactorConstraintCachePreviousFactorID_.
Definition at line 249 of file lp_inference_base.hxx.
|
protected |
Cache for the function LPInferenceBase::addLocalPolytopeFactorConstraint. It is used to store the factor id used for the last call of this function. If the previous factor id and the factor id of the current call to LPInferenceBase::addLocalPolytopeFactorConstraint are the same, the variable LPInferenceBase::addLocalPolytopeFactorConstraintCacheFactorLPVariableIDs_ does not have to be updated.
Definition at line 248 of file lp_inference_base.hxx.
|
protected |
Constant value offset.
Definition at line 226 of file lp_inference_base.hxx.
|
protected |
The offsets for the indices of the lp variables for each factor of the graphical model.
Definition at line 241 of file lp_inference_base.hxx.
|
protected |
Reference to the graphical model.
Definition at line 224 of file lp_inference_base.hxx.
|
protected |
List of all higher order factors.
Definition at line 228 of file lp_inference_base.hxx.
|
protected |
Storage for all linear constraints representing the local polytope constraints. They are generated and stored for later use if LPInferenceBase::Parameter::LoosePolytope is selected as relaxation method. The constraints are removed from this list when they are added to the LP/MIP model.
Definition at line 250 of file lp_inference_base.hxx.
|
protected |
Tell if inference was already started.
Definition at line 231 of file lp_inference_base.hxx.
|
protected |
List of all linear constraint factors.
Definition at line 229 of file lp_inference_base.hxx.
|
protected |
The indices of the subset of the solution variables which are relevant for each linear constraint.
Definition at line 245 of file lp_inference_base.hxx.
|
protected |
Lookup table for the lp variable indices of each linear constraint.
Definition at line 243 of file lp_inference_base.hxx.
|
protected |
The offsets for the indices of the lp variables for each node of the graphical model.
Definition at line 240 of file lp_inference_base.hxx.
|
protected |
The number of lp variables for the factors of the graphical model.
Definition at line 234 of file lp_inference_base.hxx.
|
protected |
The number of lp variables for the linear constraint factors of the graphical model.
Definition at line 235 of file lp_inference_base.hxx.
|
protected |
The total number of lp variables except slack variables.
Definition at line 232 of file lp_inference_base.hxx.
|
protected |
The number of lp variables for the nodes of the graphical model.
Definition at line 233 of file lp_inference_base.hxx.
|
protected |
The number of slack variables for the transferable factors of the graphical model.
Definition at line 237 of file lp_inference_base.hxx.
|
protected |
The number of lp variables for the transferable factors of the graphical model.
Definition at line 236 of file lp_inference_base.hxx.
| opengm::LPInferenceBase< LP_INFERENCE_TYPE >::OPENGM_GM_TYPE_TYPEDEFS |
Definition at line 37 of file lp_inference_base.hxx.
|
protected |
Parameter which stores the settings for the inference.
Definition at line 225 of file lp_inference_base.hxx.
|
protected |
List of all transferable factors.
Definition at line 230 of file lp_inference_base.hxx.
|
protected |
Lookup table for the lp variable indices of each transferable factor.
Definition at line 244 of file lp_inference_base.hxx.
|
protected |
List of all unary factors.
Definition at line 227 of file lp_inference_base.hxx.
1.8.9.1