OpenGM  2.3.x
Discrete Graphical Model Library
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
opengm::LPGurobi< GM, ACC > Class Template Reference

Optimization by Linear Programming (LP) or Integer LP using Guroi

http://www.gurobi.com. More...

#include <lpgurobi.hxx>

+ Inheritance diagram for opengm::LPGurobi< GM, ACC >:
+ Collaboration diagram for opengm::LPGurobi< GM, ACC >:

Classes

class  Parameter
 

Public Types

typedef ACC AccumulationType
 
typedef ACC AccumulatorType
 
typedef GM GraphicalModelType
 
typedef visitors::VerboseVisitor< LPGurobi< GM, ACC > > VerboseVisitorType
 
typedef visitors::TimingVisitor< LPGurobi< GM, ACC > > TimingVisitorType
 
typedef visitors::EmptyVisitor< LPGurobi< GM, ACC > > EmptyVisitorType
 
- Public Types inherited from opengm::Inference< GM, ACC >
typedef GM GraphicalModelType
 
typedef ACC 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 Types inherited from opengm::LPDef
enum  LP_SOLVER {
  LP_SOLVER_AUTO, LP_SOLVER_PRIMAL_SIMPLEX, LP_SOLVER_DUAL_SIMPLEX, LP_SOLVER_NETWORK_SIMPLEX,
  LP_SOLVER_BARRIER, LP_SOLVER_SIFTING, LP_SOLVER_CONCURRENT
}
 
enum  LP_PRESOLVE { LP_PRESOLVE_AUTO, LP_PRESOLVE_OFF, LP_PRESOLVE_CONSERVATIVE, LP_PRESOLVE_AGGRESSIVE }
 
enum  MIP_EMPHASIS {
  MIP_EMPHASIS_BALANCED, MIP_EMPHASIS_FEASIBILITY, MIP_EMPHASIS_OPTIMALITY, MIP_EMPHASIS_BESTBOUND,
  MIP_EMPHASIS_HIDDENFEAS
}
 
enum  MIP_CUT {
  MIP_CUT_DEFAULT, MIP_CUT_AUTO, MIP_CUT_OFF, MIP_CUT_ON,
  MIP_CUT_AGGRESSIVE, MIP_CUT_VERYAGGRESSIVE
}
 

Public Member Functions

 LPGurobi (const GraphicalModelType &, const Parameter &=Parameter())
 
 ~LPGurobi ()
 
virtual std::string name () const
 
const GraphicalModelTypegraphicalModel () const
 
virtual InferenceTermination infer ()
 
template<class VisitorType >
InferenceTermination infer (VisitorType &)
 
virtual InferenceTermination arg (std::vector< LabelType > &, const size_t=1) const
 output a solution More...
 
virtual InferenceTermination args (std::vector< std::vector< LabelType > > &) const
 
void variable (const size_t, IndependentFactorType &out) const
 
void factorVariable (const size_t, IndependentFactorType &out) const
 
GM::ValueType bound () const
 return a bound on the solution More...
 
GM::ValueType value () const
 return the solution (value) More...
 
size_t lpNodeVi (const IndexType variableIndex, const LabelType label) const
 
size_t lpFactorVi (const IndexType factorIndex, const size_t labelingIndex) const
 
template<class LABELING_ITERATOR >
size_t lpFactorVi (const IndexType factorIndex, LABELING_ITERATOR labelingBegin, LABELING_ITERATOR labelingEnd) const
 
template<class LPVariableIndexIterator , class CoefficientIterator >
void addConstraint (LPVariableIndexIterator, LPVariableIndexIterator, CoefficientIterator, const ValueType &, const ValueType &, const char *name=0)
 add constraint More...
 
void writeModelToDisk (const std::string &filename) const
 
template<class LABELING_ITERATOR >
size_t lpFactorVi (const typename LPGurobi< GM, ACC >::IndexType factorIndex, LABELING_ITERATOR labelingBegin, LABELING_ITERATOR labelingEnd) const
 
- Public Member Functions inherited from opengm::Inference< GM, ACC >
virtual ~Inference ()
 
virtual void setStartingPoint (typename std::vector< LabelType >::const_iterator)
 set initial labeling More...
 
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
 

Additional Inherited Members

- Static Public Attributes inherited from opengm::LPDef
static const int default_numberOfThreads_
 
static const bool default_verbose_
 
static const double default_cutUp_
 
static const double default_epOpt_
 
static const double default_epMrk_
 
static const double default_epRHS_
 
static const double default_epInt_
 
static const double default_epAGap_
 
static const double default_epGap_
 
static const double default_workMem_
 
static const double default_treeMemoryLimit_
 
static const double default_timeLimit_
 
static const int default_probingLevel_
 
static const LP_SOLVER default_rootAlg_
 
static const LP_SOLVER default_nodeAlg_
 
static const MIP_EMPHASIS default_mipEmphasis_
 
static const LP_PRESOLVE default_presolve_
 
static const MIP_CUT default_cutLevel_
 
static const MIP_CUT default_cliqueCutLevel_
 
static const MIP_CUT default_coverCutLevel_
 
static const MIP_CUT default_gubCutLevel_
 
static const MIP_CUT default_mirCutLevel_
 
static const MIP_CUT default_iboundCutLevel_
 
static const MIP_CUT default_flowcoverCutLevel_
 
static const MIP_CUT default_flowpathCutLevel_
 
static const MIP_CUT default_disjunctCutLevel_
 
static const MIP_CUT default_gomoryCutLevel_
 

Detailed Description

template<class GM, class ACC>
class opengm::LPGurobi< GM, ACC >

Optimization by Linear Programming (LP) or Integer LP using Guroi

http://www.gurobi.com.

The optimization problem is reformulated as an LP or ILP. For the LP, a first order local polytope approximation of the marginal polytope is used, i.e. the affine instead of the convex hull.

Gurobi is a commercial product that is free for accadamical use.

Definition at line 38 of file lpgurobi.hxx.

Member Typedef Documentation

template<class GM, class ACC>
typedef ACC opengm::LPGurobi< GM, ACC >::AccumulationType

Definition at line 40 of file lpgurobi.hxx.

template<class GM, class ACC>
typedef ACC opengm::LPGurobi< GM, ACC >::AccumulatorType

Definition at line 41 of file lpgurobi.hxx.

template<class GM, class ACC>
typedef visitors::EmptyVisitor< LPGurobi<GM, ACC> > opengm::LPGurobi< GM, ACC >::EmptyVisitorType

Definition at line 46 of file lpgurobi.hxx.

template<class GM, class ACC>
typedef GM opengm::LPGurobi< GM, ACC >::GraphicalModelType

Definition at line 42 of file lpgurobi.hxx.

template<class GM, class ACC>
typedef visitors::TimingVisitor<LPGurobi<GM, ACC> > opengm::LPGurobi< GM, ACC >::TimingVisitorType

Definition at line 45 of file lpgurobi.hxx.

template<class GM, class ACC>
typedef visitors::VerboseVisitor<LPGurobi<GM, ACC> > opengm::LPGurobi< GM, ACC >::VerboseVisitorType

Definition at line 44 of file lpgurobi.hxx.

Constructor & Destructor Documentation

template<class GM , class ACC >
opengm::LPGurobi< GM, ACC >::LPGurobi ( const GraphicalModelType gm,
const Parameter para = Parameter() 
)

Definition at line 217 of file lpgurobi.hxx.

+ Here is the call graph for this function:

template<class GM , class ACC >
opengm::LPGurobi< GM, ACC >::~LPGurobi ( )

Definition at line 657 of file lpgurobi.hxx.

Member Function Documentation

template<class GM , class ACC >
template<class LPVariableIndexIterator , class CoefficientIterator >
void opengm::LPGurobi< GM, ACC >::addConstraint ( LPVariableIndexIterator  viBegin,
LPVariableIndexIterator  viEnd,
CoefficientIterator  coefficient,
const ValueType lowerBound,
const ValueType upperBound,
const char *  name = 0 
)
inline

add constraint

Parameters
viBeginiterator to the beginning of a sequence of variable indices
viEnditerator to the end of a sequence of variable indices
coefficientiterator to the beginning of a sequence of coefficients
lowerBoundlower bound
upperBoundupper bound

variable indices refer to variables of the LP that is set up in the constructor of LPGurobi (NOT to the variables of the graphical model).

Definition at line 828 of file lpgurobi.hxx.

template<class GM, class ACC>
InferenceTermination opengm::LPGurobi< GM, ACC >::arg ( std::vector< LabelType > &  arg,
const size_t  argIndex = 1 
) const
inlinevirtual

output a solution

Parameters
[out]arglabeling
argIndexsolution index (1=best, 2=second best, etc.)

Reimplemented from opengm::Inference< GM, ACC >.

Definition at line 665 of file lpgurobi.hxx.

template<class GM, class ACC>
virtual InferenceTermination opengm::LPGurobi< GM, ACC >::args ( std::vector< std::vector< LabelType > > &  ) const
inlinevirtual

Reimplemented from opengm::Inference< GM, ACC >.

Definition at line 156 of file lpgurobi.hxx.

template<class GM , class ACC >
GM::ValueType opengm::LPGurobi< GM, ACC >::bound ( ) const
virtual

return a bound on the solution

Reimplemented from opengm::Inference< GM, ACC >.

Definition at line 752 of file lpgurobi.hxx.

template<class GM , class ACC >
void opengm::LPGurobi< GM, ACC >::factorVariable ( const size_t  factorId,
IndependentFactorType out 
) const

Definition at line 712 of file lpgurobi.hxx.

template<class GM , class ACC >
const LPGurobi< GM, ACC >::GraphicalModelType & opengm::LPGurobi< GM, ACC >::graphicalModel ( ) const
inlinevirtual

Implements opengm::Inference< GM, ACC >.

Definition at line 739 of file lpgurobi.hxx.

template<class GM , class ACC >
InferenceTermination opengm::LPGurobi< GM, ACC >::infer ( )
virtual

Implements opengm::Inference< GM, ACC >.

Definition at line 616 of file lpgurobi.hxx.

template<class GM , class ACC >
template<class VisitorType >
InferenceTermination opengm::LPGurobi< GM, ACC >::infer ( VisitorType &  visitor)

Definition at line 625 of file lpgurobi.hxx.

template<class GM, class ACC>
size_t opengm::LPGurobi< GM, ACC >::lpFactorVi ( const IndexType  factorIndex,
const size_t  labelingIndex 
) const
template<class GM, class ACC>
template<class LABELING_ITERATOR >
size_t opengm::LPGurobi< GM, ACC >::lpFactorVi ( const IndexType  factorIndex,
LABELING_ITERATOR  labelingBegin,
LABELING_ITERATOR  labelingEnd 
) const
template<class GM, class ACC>
template<class LABELING_ITERATOR >
size_t opengm::LPGurobi< GM, ACC >::lpFactorVi ( const typename LPGurobi< GM, ACC >::IndexType  factorIndex,
LABELING_ITERATOR  labelingBegin,
LABELING_ITERATOR  labelingEnd 
) const
inline

Definition at line 794 of file lpgurobi.hxx.

template<class GM, class ACC>
size_t opengm::LPGurobi< GM, ACC >::lpNodeVi ( const IndexType  variableIndex,
const LabelType  label 
) const
inline

Definition at line 767 of file lpgurobi.hxx.

template<class GM, class ACC>
virtual std::string opengm::LPGurobi< GM, ACC >::name ( ) const
inlinevirtual

Implements opengm::Inference< GM, ACC >.

Definition at line 149 of file lpgurobi.hxx.

template<class GM , class ACC >
GM::ValueType opengm::LPGurobi< GM, ACC >::value ( ) const
virtual

return the solution (value)

Reimplemented from opengm::Inference< GM, ACC >.

Definition at line 745 of file lpgurobi.hxx.

template<class GM , class ACC >
void opengm::LPGurobi< GM, ACC >::variable ( const size_t  nodeId,
IndependentFactorType out 
) const

Definition at line 695 of file lpgurobi.hxx.

template<class GM, class ACC>
void opengm::LPGurobi< GM, ACC >::writeModelToDisk ( const std::string &  filename) const
inline

Definition at line 171 of file lpgurobi.hxx.

Member Data Documentation

template<class GM, class ACC>
opengm::LPGurobi< GM, ACC >::OPENGM_GM_TYPE_TYPEDEFS

Definition at line 43 of file lpgurobi.hxx.