OpenGM  2.3.x
Discrete Graphical Model Library
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE > Class Template Reference

Interface definition for wrapper of LP Solvers like CPLEX and Gurobi. More...

#include <lp_solver_interface.hxx>

+ Inheritance diagram for opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >:
+ Collaboration diagram for opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >:

Classes

class  Parameter
 Parameter class provides options to modify LP Solver behavior. More...
 

Public Types

enum  Objective { Minimize, Maximize }
 This enum defines the type of the objective. It is used to select either to minimize or to maxime the objective function. More...
 
typedef LP_SOLVER_TYPE SolverType
 Defines the type of the child class which inherits from LPSolverInterface. More...
 
typedef VALUE_TYPE SolverValueType
 Defines the value type used by the LP Solver. More...
 
typedef INDEX_TYPE SolverIndexType
 Defines the index type used by the LP Solver. More...
 
typedef SOLUTION_ITERATOR_TYPE SolverSolutionIteratorType
 Defines the iterator type which can be used to iterate over the solution of the LP Solver. More...
 
typedef SOLVER_TIMING_TYPE SolverTimingType
 Defines the timing type used by the LP Solver. More...
 

Public Member Functions

 LPSolverInterface (const Parameter &parameter=Parameter())
 Default constructor of class LPSolverInterface. More...
 
 ~LPSolverInterface ()
 Default destructor of class LPSolverInterface. More...
 
void addContinuousVariables (const SolverIndexType numVariables, const SolverValueType lowerBound, const SolverValueType upperBound)
 Add new continuous variables to the model. More...
 
void addIntegerVariables (const SolverIndexType numVariables, const SolverValueType lowerBound, const SolverValueType upperBound)
 Add new integer variables to the model. More...
 
void addBinaryVariables (const SolverIndexType numVariables)
 Add new binary variables to the model. More...
 
void setObjective (const Objective objective)
 Set objective to minimize or maximize. More...
 
void setObjectiveValue (const SolverIndexType variable, const SolverValueType value)
 Set the coefficient of a variable in the objective function. More...
 
template<class ITERATOR_TYPE >
void setObjectiveValue (ITERATOR_TYPE begin, const ITERATOR_TYPE end)
 Set the coefficients of all variables in the objective function. More...
 
template<class VARIABLES_ITERATOR_TYPE , class COEFFICIENTS_ITERATOR_TYPE >
void setObjectiveValue (VARIABLES_ITERATOR_TYPE variableIDsBegin, const VARIABLES_ITERATOR_TYPE variableIDsEnd, COEFFICIENTS_ITERATOR_TYPE coefficientsBegin)
 Set the coefficients of selected variables in the objective function. More...
 
template<class VARIABLES_ITERATOR_TYPE , class COEFFICIENTS_ITERATOR_TYPE >
void addEqualityConstraint (VARIABLES_ITERATOR_TYPE variableIDsBegin, const VARIABLES_ITERATOR_TYPE variableIDsEnd, COEFFICIENTS_ITERATOR_TYPE coefficientsBegin, const SolverValueType bound, const std::string &constraintName="")
 Add a new equality constraint to the model. More...
 
template<class VARIABLES_ITERATOR_TYPE , class COEFFICIENTS_ITERATOR_TYPE >
void addLessEqualConstraint (VARIABLES_ITERATOR_TYPE variableIDsBegin, const VARIABLES_ITERATOR_TYPE variableIDsEnd, COEFFICIENTS_ITERATOR_TYPE coefficientsBegin, const SolverValueType bound, const std::string &constraintName="")
 Add a new less equal constraint to the model. More...
 
template<class VARIABLES_ITERATOR_TYPE , class COEFFICIENTS_ITERATOR_TYPE >
void addGreaterEqualConstraint (VARIABLES_ITERATOR_TYPE variableIDsBegin, const VARIABLES_ITERATOR_TYPE variableIDsEnd, COEFFICIENTS_ITERATOR_TYPE coefficientsBegin, const SolverValueType bound, const std::string &constraintName="")
 Add a new greater equal constraint to the model. More...
 
void addConstraintsFinished ()
 Join all constraints added via LPSolverInterface::addEqualityConstraint, LPSolverInterface::addLessEqualConstraint and LPSolverInterface::addGreaterEqualConstraint to the model. More...
 
void addConstraintsFinished (SolverTimingType &timing)
 Join all constraints added via LPSolverInterface::addEqualityConstraint, LPSolverInterface::addLessEqualConstraint and LPSolverInterface::addGreaterEqualConstraint to the model. More...
 
template<class PARAMETER_TYPE , class PARAMETER_VALUE_TYPE >
void setParameter (const PARAMETER_TYPE parameter, const PARAMETER_VALUE_TYPE value)
 Set Solver parameter. More...
 
bool solve ()
 Solve the current model. More...
 
bool solve (SolverTimingType &timing)
 Solve the current model and measure solving time. More...
 
SolverSolutionIteratorType solutionBegin () const
 Get an iterator which is pointing to the begin of the solution computed by the Solver. More...
 
SolverSolutionIteratorType solutionEnd () const
 Get an iterator which is pointing to the end of the solution computed by the Solver. More...
 
SolverValueType solution (const SolverIndexType variable) const
 Get the solution value of a variable computed by the Solver. More...
 
SolverValueType objectiveFunctionValue () const
 Get the objective function value from the Solver. More...
 
SolverValueType objectiveFunctionValueBound () const
 Get the best known bound for the optimal solution of the current model. More...
 
void exportModel (const std::string &filename) const
 Export model to file. More...
 

Static Public Member Functions

static SolverValueType infinity ()
 Get the value which is used by the LP Solver to represent infinity. More...
 

Protected Attributes

const Parameter parameter_
 Storage for parameter. More...
 

Detailed Description

template<class LP_SOLVER_TYPE, class VALUE_TYPE, class INDEX_TYPE, class SOLUTION_ITERATOR_TYPE, class SOLVER_TIMING_TYPE>
class opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >

Interface definition for wrapper of LP Solvers like CPLEX and Gurobi.

Template Parameters
LP_SOLVER_TYPEThe type of the child class which inherits from LPSolverInterface.
VALUE_TYPEThe value type used by the LP Solver.
INDEX_TYPEThe index type used by the LP Solver.
SOLUTION_ITERATOR_TYPEThe iterator type which can be used to iterate over the solution of the LP Solver.
SOLVER_TIMING_TYPEThe timing type used by the LP Solver.
Note
The interface uses the curiously recurring template pattern (CRTP) to provide static polymorphism. Hence a child class which inherits from LPSolverInterface has to provide itself as a template parameter to LPSolverInterface.

Definition at line 12 of file lp_solver_interface.hxx.

Member Typedef Documentation

template<class LP_SOLVER_TYPE, class VALUE_TYPE, class INDEX_TYPE, class SOLUTION_ITERATOR_TYPE, class SOLVER_TIMING_TYPE>
LPSolverInterface::SolverIndexType

Defines the index type used by the LP Solver.

Definition at line 17 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE, class VALUE_TYPE, class INDEX_TYPE, class SOLUTION_ITERATOR_TYPE, class SOLVER_TIMING_TYPE>
LPSolverInterface::SolverSolutionIteratorType

Defines the iterator type which can be used to iterate over the solution of the LP Solver.

Definition at line 18 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE, class VALUE_TYPE, class INDEX_TYPE, class SOLUTION_ITERATOR_TYPE, class SOLVER_TIMING_TYPE>
LPSolverInterface::SolverTimingType

Defines the timing type used by the LP Solver.

Definition at line 19 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE, class VALUE_TYPE, class INDEX_TYPE, class SOLUTION_ITERATOR_TYPE, class SOLVER_TIMING_TYPE>
LPSolverInterface::SolverType

Defines the type of the child class which inherits from LPSolverInterface.

Definition at line 15 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE, class VALUE_TYPE, class INDEX_TYPE, class SOLUTION_ITERATOR_TYPE, class SOLVER_TIMING_TYPE>
LPSolverInterface::SolverValueType

Defines the value type used by the LP Solver.

Definition at line 16 of file lp_solver_interface.hxx.

Member Enumeration Documentation

template<class LP_SOLVER_TYPE, class VALUE_TYPE, class INDEX_TYPE, class SOLUTION_ITERATOR_TYPE, class SOLVER_TIMING_TYPE>
enum opengm::LPSolverInterface::Objective

This enum defines the type of the objective. It is used to select either to minimize or to maxime the objective function.

Enumerator
Minimize 

Objective function will be minimized.

Maximize 

Objective function will be maximized.

Definition at line 22 of file lp_solver_interface.hxx.

Constructor & Destructor Documentation

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::LPSolverInterface ( const Parameter parameter = Parameter())
inline

Default constructor of class LPSolverInterface.

Definition at line 663 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::~LPSolverInterface ( )
inline

Default destructor of class LPSolverInterface.

Definition at line 669 of file lp_solver_interface.hxx.

Member Function Documentation

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
void opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::addBinaryVariables ( const SolverIndexType  numVariables)
inline

Add new binary variables to the model.

Parameters
[in]numVariablesThe number of new Variables.
Note
The Solver class has to provide the corresponding addBinaryVariables_impl() method.

Definition at line 684 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
void opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::addConstraintsFinished ( )
inline

Join all constraints added via LPSolverInterface::addEqualityConstraint, LPSolverInterface::addLessEqualConstraint and LPSolverInterface::addGreaterEqualConstraint to the model.

Note
The Solver class has to provide the corresponding addConstraintsFinished_impl() method.

Definition at line 729 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
void opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::addConstraintsFinished ( SolverTimingType timing)
inline

Join all constraints added via LPSolverInterface::addEqualityConstraint, LPSolverInterface::addLessEqualConstraint and LPSolverInterface::addGreaterEqualConstraint to the model.

Parameters
[out]timingReturns the time needed to join all constraints to the model.
Note
The Solver class has to provide the corresponding addConstraintsFinished_impl() method.

Definition at line 734 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
void opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::addContinuousVariables ( const SolverIndexType  numVariables,
const SolverValueType  lowerBound,
const SolverValueType  upperBound 
)
inline

Add new continuous variables to the model.

Parameters
[in]numVariablesThe number of new Variables.
[in]lowerBoundThe lower bound for the new Variables.
[in]upperBoundThe upper bound for the new Variables.
Note
The Solver class has to provide the corresponding addContinuousVariables_impl() method.

Definition at line 674 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
template<class VARIABLES_ITERATOR_TYPE , class COEFFICIENTS_ITERATOR_TYPE >
void opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::addEqualityConstraint ( VARIABLES_ITERATOR_TYPE  variableIDsBegin,
const VARIABLES_ITERATOR_TYPE  variableIDsEnd,
COEFFICIENTS_ITERATOR_TYPE  coefficientsBegin,
const SolverValueType  bound,
const std::string &  constraintName = "" 
)
inline

Add a new equality constraint to the model.

Template Parameters
VARIABLES_ITERATOR_TYPEIterator type to iterate over the variable ids of the constraints.
COEFFICIENTS_ITERATOR_TYPEIterator type to iterate over the coefficients of the constraints.
Parameters
[in]variableIDsBeginIterator pointing to the begin of a sequence of values defining the variables of the constraint.
[in]variableIDsEndIterator pointing to the end of a sequence of values defining the variables of the constraint.
[in]coefficientsBeginIterator pointing to the begin of a sequence of values defining the coefficients for the variables.
[in]boundThe right hand side of the equality constraint.
[in]constraintNameThe name for the equality constraint.
Note
  1. The Solver class has to provide the corresponding addEqualityConstraint_impl() method.
  2. To increase performance for adding multiple constraints to the model, all constraints added via LPSolverInterface::addEqualityConstraint, LPSolverInterface::addLessEqualConstraint and LPSolverInterface::addGreaterEqualConstraint are stored in a puffer and will be added to the model all at once when the function LPSolverInterface::addConstraintsFinished is called.

Definition at line 712 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
template<class VARIABLES_ITERATOR_TYPE , class COEFFICIENTS_ITERATOR_TYPE >
void opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::addGreaterEqualConstraint ( VARIABLES_ITERATOR_TYPE  variableIDsBegin,
const VARIABLES_ITERATOR_TYPE  variableIDsEnd,
COEFFICIENTS_ITERATOR_TYPE  coefficientsBegin,
const SolverValueType  bound,
const std::string &  constraintName = "" 
)
inline

Add a new greater equal constraint to the model.

Template Parameters
VARIABLES_ITERATOR_TYPEIterator type to iterate over the variable ids of the constraints.
COEFFICIENTS_ITERATOR_TYPEIterator type to iterate over the coefficients of the constraints.
Parameters
[in]variableIDsBeginIterator pointing to the begin of a sequence of values defining the variables of the constraint.
[in]variableIDsEndIterator pointing to the end of a sequence of values defining the variables of the constraint.
[in]coefficientsBeginIterator pointing to the begin of a sequence of values defining the coefficients for the variables.
[in]boundThe right hand side of the greater equal constraint.
[in]constraintNameThe name for the greater equal constraint.
Note
  1. The Solver class has to provide the corresponding addGreaterEqualConstraint_impl() method.
  2. To increase performance for adding multiple constraints to the model, all constraints added via LPSolverInterface::addEqualityConstraint, LPSolverInterface::addLessEqualConstraint and LPSolverInterface::addGreaterEqualConstraint are stored in a puffer and will be added to the model all at once when the function LPSolverInterface::addConstraintsFinished is called.

Definition at line 724 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
void opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::addIntegerVariables ( const SolverIndexType  numVariables,
const SolverValueType  lowerBound,
const SolverValueType  upperBound 
)
inline

Add new integer variables to the model.

Parameters
[in]numVariablesThe number of new Variables.
[in]lowerBoundThe lower bound for the new Variables.
[in]upperBoundThe upper bound for the new Variables.
Note
The Solver class has to provide the corresponding addIntegerVariables_impl() method.

Definition at line 679 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
template<class VARIABLES_ITERATOR_TYPE , class COEFFICIENTS_ITERATOR_TYPE >
void opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::addLessEqualConstraint ( VARIABLES_ITERATOR_TYPE  variableIDsBegin,
const VARIABLES_ITERATOR_TYPE  variableIDsEnd,
COEFFICIENTS_ITERATOR_TYPE  coefficientsBegin,
const SolverValueType  bound,
const std::string &  constraintName = "" 
)
inline

Add a new less equal constraint to the model.

Template Parameters
VARIABLES_ITERATOR_TYPEIterator type to iterate over the variable ids of the constraints.
COEFFICIENTS_ITERATOR_TYPEIterator type to iterate over the coefficients of the constraints.
Parameters
[in]variableIDsBeginIterator pointing to the begin of a sequence of values defining the variables of the constraint.
[in]variableIDsEndIterator pointing to the end of a sequence of values defining the variables of the constraint.
[in]coefficientsBeginIterator pointing to the begin of a sequence of values defining the coefficients for the variables.
[in]boundThe right hand side of the less equal constraint.
[in]constraintNameThe name for the less equal constraint.
Note
  1. The Solver class has to provide the corresponding addLessEqualConstraint_impl() method.
  2. To increase performance for adding multiple constraints to the model, all constraints added via LPSolverInterface::addEqualityConstraint, LPSolverInterface::addLessEqualConstraint and LPSolverInterface::addGreaterEqualConstraint are stored in a puffer and will be added to the model all at once when the function LPSolverInterface::addConstraintsFinished is called.

Definition at line 718 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
void opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::exportModel ( const std::string &  filename) const
inline

Export model to file.

Parameters
[in]filenameThe name of the file where the model will be stored.
Note
The Solver class has to provide the corresponding exportModel_impl() method.

Definition at line 780 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::SolverValueType opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::infinity ( )
inlinestatic

Get the value which is used by the LP Solver to represent infinity.

Note
The Solver class has to provide the corresponding infinity_impl() method.

Definition at line 658 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::SolverValueType opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::objectiveFunctionValue ( ) const
inline

Get the objective function value from the Solver.

Returns
Objective function value.
Note
The Solver class has to provide the corresponding objectiveFunctionValue_impl() method.

Definition at line 770 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::SolverValueType opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::objectiveFunctionValueBound ( ) const
inline

Get the best known bound for the optimal solution of the current model.

Returns
The bound for the current model.
Note
The Solver class has to provide the corresponding objectiveFunctionValueBound_impl() method.

Definition at line 775 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
void opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::setObjective ( const Objective  objective)
inline

Set objective to minimize or maximize.

Parameters
[in]objectiveThe new objective.
Note
The Solver class has to provide the corresponding setObjective_impl() method.

Definition at line 689 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
void opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::setObjectiveValue ( const SolverIndexType  variable,
const SolverValueType  value 
)
inline

Set the coefficient of a variable in the objective function.

Parameters
[in]variableThe index of the variable.
[in]valueThe value which will be added to the coefficient of the variable in the objective function.
Note
The Solver class has to provide the corresponding setObjectiveValue_impl() method.

Definition at line 694 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
template<class ITERATOR_TYPE >
void opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::setObjectiveValue ( ITERATOR_TYPE  begin,
const ITERATOR_TYPE  end 
)
inline

Set the coefficients of all variables in the objective function.

Template Parameters
ITERATOR_TYPEIterator type used to iterate over the values which will be set as the coefficients of the objective function.
Parameters
[in]beginIterator pointing to the begin of the sequence of values which will be set as the coefficients of the objective function.
[in]endIterator pointing to the end of the sequence of values which will be set as the coefficients of the objective function.
Note
The Solver class has to provide the corresponding setObjectiveValue_impl() method.

Definition at line 700 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
template<class VARIABLES_ITERATOR_TYPE , class COEFFICIENTS_ITERATOR_TYPE >
void opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::setObjectiveValue ( VARIABLES_ITERATOR_TYPE  variableIDsBegin,
const VARIABLES_ITERATOR_TYPE  variableIDsEnd,
COEFFICIENTS_ITERATOR_TYPE  coefficientsBegin 
)
inline

Set the coefficients of selected variables in the objective function.

Template Parameters
VARIABLES_ITERATOR_TYPEIterator type used to iterate over the indices of the variables.
COEFFICIENTS_ITERATOR_TYPEIterator type used to iterate over the coefficients of the variables which will be set for the objective function.
Parameters
[in]variableIDsBeginIterator pointing to the begin of the sequence of indices of the variables.
[in]variableIDsEndIterator pointing to the end of the sequence of indices of the variables.
[in]coefficientsBeginIterator pointing to the begin of the sequence of values which will be set as the coefficients of the objective function.
Note
The Solver class has to provide the corresponding setObjectiveValue_impl() method.

Definition at line 706 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
template<class PARAMETER_TYPE , class PARAMETER_VALUE_TYPE >
void opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::setParameter ( const PARAMETER_TYPE  parameter,
const PARAMETER_VALUE_TYPE  value 
)
inline

Set Solver parameter.

Template Parameters
PARAMETER_VALUE_TYPEThe type of the parameter.
VALUE_TYPEThe type of the value.
Parameters
[in]parameterThe Solver parameter.
[in]valueThe new value to which the parameter will be set.
Note
The Solver class has to provide the corresponding setParameter_impl() method.

Definition at line 740 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::SolverValueType opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::solution ( const SolverIndexType  variable) const
inline

Get the solution value of a variable computed by the Solver.

Parameters
[in]variableIndex of the variable for which the solution value is requested.
Returns
Solution value of the selected variable.
Note
The Solver class has to provide the corresponding solution_impl() method.

Definition at line 765 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::SolverSolutionIteratorType opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::solutionBegin ( ) const
inline

Get an iterator which is pointing to the begin of the solution computed by the Solver.

Returns
Iterator pointing to the begin of the solution.
Note
The Solver class has to provide the corresponding solutionBegin_impl() method.

Definition at line 755 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::SolverSolutionIteratorType opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::solutionEnd ( ) const
inline

Get an iterator which is pointing to the end of the solution computed by the Solver.

Returns
Iterator pointing to the begin of the solution.
Note
The Solver class has to provide the corresponding solutionEnd_impl() method.

Definition at line 760 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
bool opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::solve ( )
inline

Solve the current model.

Returns
True if solving the model finished successfully, false if the Solver was not able to solve the model.
Note
The Solver class has to provide the corresponding solve_impl() method.

Definition at line 745 of file lp_solver_interface.hxx.

template<class LP_SOLVER_TYPE , class VALUE_TYPE , class INDEX_TYPE , class SOLUTION_ITERATOR_TYPE , class SOLVER_TIMING_TYPE >
bool opengm::LPSolverInterface< LP_SOLVER_TYPE, VALUE_TYPE, INDEX_TYPE, SOLUTION_ITERATOR_TYPE, SOLVER_TIMING_TYPE >::solve ( SolverTimingType timing)
inline

Solve the current model and measure solving time.

Parameters
[out]timingThe time the solver needed to solve the problem.
Returns
True if solving the model finished successfully, false if the solver was not able to solve the model.
Note
The Solver class has to provide the corresponding solve_impl() method.

Definition at line 750 of file lp_solver_interface.hxx.

Member Data Documentation

template<class LP_SOLVER_TYPE, class VALUE_TYPE, class INDEX_TYPE, class SOLUTION_ITERATOR_TYPE, class SOLVER_TIMING_TYPE>
LPSolverInterface::parameter_
protected

Storage for parameter.

Definition at line 112 of file lp_solver_interface.hxx.