All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
paal::lp::detail::glp_impl Class Reference

LP implementation using GLPK. More...

#include <glp.hpp>

Public Member Functions

 glp_impl ()
 
 ~glp_impl ()
 
void set_optimization_type (optimization_type opt_type)
 
col_id add_column (double cost_coef, double lb, double ub)
 
row_id add_row (const double_bounded_expression &constraint)
 
void set_col_lower_bound (col_id col, double lb)
 
void set_col_upper_bound (col_id col, double ub)
 
void set_col_cost (col_id col, double cost_coef)
 
void set_row_lower_bound (row_id row, double lb)
 
void set_row_upper_bound (row_id row, double ub)
 
void set_row_expression (row_id row, const linear_expression &expr)
 
void delete_col (col_id col)
 
void delete_row (row_id row)
 
problem_type solve_simplex (simplex_type type=PRIMAL)
 
problem_type resolve_simplex (simplex_type type=PRIMAL)
 
double get_obj_value () const
 
double get_col_value (col_id col) const
 
double get_col_coef (col_id col) const
 
double get_col_lower_bound (col_id col) const
 
double get_col_upper_bound (col_id col) const
 
double get_row_dual_value (row_id row) const
 
double get_row_lower_bound (row_id row) const
 
double get_row_upper_bound (row_id row) const
 
linear_expression get_row_expression (row_id row) const
 
boost::iterator_range
< RowsInColumnIterator > 
get_rows_in_column (col_id col) const
 

Static Public Member Functions

static void free_env ()
 

Detailed Description

LP implementation using GLPK.

Definition at line 39 of file glp.hpp.

Constructor & Destructor Documentation

paal::lp::detail::glp_impl::glp_impl ( )
inline

Constructor.

Definition at line 49 of file glp.hpp.

paal::lp::detail::glp_impl::~glp_impl ( )
inline

Destructor.

Definition at line 62 of file glp.hpp.

Member Function Documentation

col_id paal::lp::detail::glp_impl::add_column ( double  cost_coef,
double  lb,
double  ub 
)
inline

Adds a new column to the LP.

Parameters
cost_coefcoefficient of the column in the objective function
lbcolumn lower bound value
ubcolumn upper bound value
Returns
column identifier

Definition at line 86 of file glp.hpp.

row_id paal::lp::detail::glp_impl::add_row ( const double_bounded_expression constraint)
inline

Adds a new row to the LP.

Parameters
constraintconstraint being added
Returns
row identifier

Definition at line 106 of file glp.hpp.

void paal::lp::detail::glp_impl::delete_col ( col_id  col)
inline

Removes a column form the LP.

Parameters
colID of the column to be removed

Definition at line 204 of file glp.hpp.

void paal::lp::detail::glp_impl::delete_row ( row_id  row)
inline

Removes a row form the LP.

Parameters
rowID of the row to be removed

Definition at line 216 of file glp.hpp.

static void paal::lp::detail::glp_impl::free_env ( )
inlinestatic

Frees GLPK resources, common for all LP instances. Should be called after all LP instances are destructed.

Definition at line 68 of file glp.hpp.

double paal::lp::detail::glp_impl::get_col_coef ( col_id  col) const
inline

Returns the column cost function coefficient.

Definition at line 265 of file glp.hpp.

double paal::lp::detail::glp_impl::get_col_lower_bound ( col_id  col) const
inline

Returns the column lower bound.

Definition at line 272 of file glp.hpp.

double paal::lp::detail::glp_impl::get_col_upper_bound ( col_id  col) const
inline

Returns the column upper bound.

Definition at line 279 of file glp.hpp.

double paal::lp::detail::glp_impl::get_col_value ( col_id  col) const
inline

Returns column primal value. Should be called only after the LP has been solved and if it wasn't modified afterwards.

Definition at line 258 of file glp.hpp.

double paal::lp::detail::glp_impl::get_obj_value ( ) const
inline

Returns the found objective function value. Should be called only after the LP has been solved and if it wasn't modified afterwards.

Definition at line 251 of file glp.hpp.

double paal::lp::detail::glp_impl::get_row_dual_value ( row_id  row) const
inline

Returns row dual value. Should be called only after the LP has been solved and if it wasn't modified afterwards.

Definition at line 288 of file glp.hpp.

linear_expression paal::lp::detail::glp_impl::get_row_expression ( row_id  row) const
inline

Returns the expression of an existing row.

Definition at line 309 of file glp.hpp.

double paal::lp::detail::glp_impl::get_row_lower_bound ( row_id  row) const
inline

Returns the row lower bound.

Definition at line 295 of file glp.hpp.

double paal::lp::detail::glp_impl::get_row_upper_bound ( row_id  row) const
inline

Returns the row upper bound.

Definition at line 302 of file glp.hpp.

boost::iterator_range<RowsInColumnIterator> paal::lp::detail::glp_impl::get_rows_in_column ( col_id  col) const
inline

Returns the identifiers and coefficients of all rows in a given column, which constraint matrix coefficient is non-zero (as an iterator range).

Definition at line 324 of file glp.hpp.

problem_type paal::lp::detail::glp_impl::resolve_simplex ( simplex_type  type = PRIMAL)
inline

Resolves the LP (starting from the previously found solution) using the primal simplex method.

Parameters
typesimplex type (primal / dual)
Returns
solution status

Definition at line 242 of file glp.hpp.

void paal::lp::detail::glp_impl::set_col_cost ( col_id  col,
double  cost_coef 
)
inline

Sets the cost coefficient of an existing LP column.

Parameters
colcolumn identifier
cost_coefnew cost coefficient

Definition at line 152 of file glp.hpp.

void paal::lp::detail::glp_impl::set_col_lower_bound ( col_id  col,
double  lb 
)
inline

Sets the lower bound of an existing LP column.

Parameters
colcolumn identifier
lbrow lower bound value

Definition at line 128 of file glp.hpp.

void paal::lp::detail::glp_impl::set_col_upper_bound ( col_id  col,
double  ub 
)
inline

Sets the upper bound of an existing LP column.

Parameters
colcolumn identifier
ubrow upper bound value

Definition at line 140 of file glp.hpp.

void paal::lp::detail::glp_impl::set_optimization_type ( optimization_type  opt_type)
inline

Sets the problem optimization type (min/max).

Definition at line 73 of file glp.hpp.

void paal::lp::detail::glp_impl::set_row_expression ( row_id  row,
const linear_expression expr 
)
inline

Sets the expression of an existing row.

Parameters
rowrow identifier
exprnew expression

Definition at line 186 of file glp.hpp.

void paal::lp::detail::glp_impl::set_row_lower_bound ( row_id  row,
double  lb 
)
inline

Sets the lower bound of an existing LP row.

Parameters
rowrow identifier
lbrow lower bound value

Definition at line 162 of file glp.hpp.

void paal::lp::detail::glp_impl::set_row_upper_bound ( row_id  row,
double  ub 
)
inline

Sets the upper bound of an existing LP row.

Parameters
rowrow identifier
ubrow upper bound value

Definition at line 174 of file glp.hpp.

problem_type paal::lp::detail::glp_impl::solve_simplex ( simplex_type  type = PRIMAL)
inline

Solves the LP using the primal simplex method.

Parameters
typesimplex type (primal / dual)
Returns
solution status

Definition at line 230 of file glp.hpp.


The documentation for this class was generated from the following file: