LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::lp::LpModel< T > Class Template Reference

Sparse LP in the natural form, with per-variable bounds. More...

#include <line/util/simplex.h>

Public Member Functions

 LpModel (std::size_t nvars)
std::size_t num_vars () const
std::size_t num_rows () const
std::size_t num_nonzeros () const
void set_lower (std::size_t j, const T &v)
void set_upper (std::size_t j, const T &v)
void set_bounds (std::size_t j, const T &lo, const T &hi)
void set_free_lower (std::size_t j)
void set_free_upper (std::size_t j)
void set_free (std::size_t j)
void fix (std::size_t j, const T &v)
 Pin a variable to a value; it is substituted out of the tableau.
const T & lower (std::size_t j) const
const T & upper (std::size_t j) const
bool lower_is_free (std::size_t j) const
bool upper_is_free (std::size_t j) const
void set_cost (std::size_t j, const T &v)
void add_cost (std::size_t j, const T &v)
const std::vector< T > & costs () const
void set_maximize (bool m)
 true to maximize c'x (the default), false to minimize.
bool maximize () const
void row_clear ()
 Discard whatever the row accumulator holds.
void row_add (std::size_t j, const T &v)
 row(j) += v, the accumulation the MATLAB reference performs.
void row_add_int (std::size_t j, long v)
void emit (LpSense sense, const T &rhs)
 Emit the accumulated row with the given relation and right-hand side.
void emit_le (const T &rhs)
void emit_eq (const T &rhs)
void emit_ge (const T &rhs)
void emit_le_int (long rhs)
void emit_eq_int (long rhs)
void emit_ge_int (long rhs)
std::size_t row_begin (std::size_t i) const
std::size_t row_end (std::size_t i) const
std::size_t col_at (std::size_t k) const
const T & val_at (std::size_t k) const
const T & rhs (std::size_t i) const
LpSense sense (std::size_t i) const

Detailed Description

template<class T>
class line::lp::LpModel< T >

Sparse LP in the natural form, with per-variable bounds.

Default bounds are x_j >= 0 with no upper bound, matching linprog's convention when lb is given as zeros and ub is omitted.

Definition at line 112 of file simplex.h.

Constructor & Destructor Documentation

◆ LpModel()

template<class T>
line::lp::LpModel< T >::LpModel ( std::size_t nvars)
inlineexplicit

Definition at line 114 of file simplex.h.

Member Function Documentation

◆ add_cost()

template<class T>
void line::lp::LpModel< T >::add_cost ( std::size_t j,
const T & v )
inline

Definition at line 168 of file simplex.h.

◆ col_at()

template<class T>
std::size_t line::lp::LpModel< T >::col_at ( std::size_t k) const
inline

Definition at line 226 of file simplex.h.

Referenced by line::lp::simplex_solve().

◆ costs()

template<class T>
const std::vector< T > & line::lp::LpModel< T >::costs ( ) const
inline

Definition at line 172 of file simplex.h.

Referenced by line::lp::simplex_solve().

◆ emit()

template<class T>
void line::lp::LpModel< T >::emit ( LpSense sense,
const T & rhs )
inline

Emit the accumulated row with the given relation and right-hand side.

Definition at line 200 of file simplex.h.

References rhs(), row_clear(), and sense().

Referenced by emit_eq(), emit_eq_int(), emit_ge(), emit_ge_int(), emit_le(), emit_le_int(), line::fj::fj_tsm_capacity(), line::mapqn::mapqn_bnd_lr_pf(), line::npfqn::npfqn_bnd_bgt(), and line::npfqn::npfqn_bnd_bpt().

◆ emit_eq()

◆ emit_eq_int()

template<class T>
void line::lp::LpModel< T >::emit_eq_int ( long rhs)
inline

Definition at line 220 of file simplex.h.

References emit(), line::lp::EQ, and rhs().

◆ emit_ge()

template<class T>
void line::lp::LpModel< T >::emit_ge ( const T & rhs)
inline

Definition at line 218 of file simplex.h.

References emit(), line::lp::GE, and rhs().

Referenced by line::mapqn::qr_thm4(), and line::spn::spn_lpbnd().

◆ emit_ge_int()

template<class T>
void line::lp::LpModel< T >::emit_ge_int ( long rhs)
inline

Definition at line 221 of file simplex.h.

References emit(), line::lp::GE, and rhs().

◆ emit_le()

template<class T>
void line::lp::LpModel< T >::emit_le ( const T & rhs)
inline

◆ emit_le_int()

template<class T>
void line::lp::LpModel< T >::emit_le_int ( long rhs)
inline

Definition at line 219 of file simplex.h.

References emit(), line::lp::LE, and rhs().

◆ fix()

template<class T>
void line::lp::LpModel< T >::fix ( std::size_t j,
const T & v )
inline

Pin a variable to a value; it is substituted out of the tableau.

Definition at line 156 of file simplex.h.

References set_bounds().

◆ lower()

template<class T>
const T & line::lp::LpModel< T >::lower ( std::size_t j) const
inline

Definition at line 158 of file simplex.h.

Referenced by line::lp::simplex_solve().

◆ lower_is_free()

template<class T>
bool line::lp::LpModel< T >::lower_is_free ( std::size_t j) const
inline

Definition at line 160 of file simplex.h.

Referenced by line::lp::simplex_solve().

◆ maximize()

template<class T>
bool line::lp::LpModel< T >::maximize ( ) const
inline

Definition at line 175 of file simplex.h.

Referenced by line::lp::simplex_solve().

◆ num_nonzeros()

template<class T>
std::size_t line::lp::LpModel< T >::num_nonzeros ( ) const
inline

Definition at line 126 of file simplex.h.

◆ num_rows()

◆ num_vars()

◆ rhs()

template<class T>
const T & line::lp::LpModel< T >::rhs ( std::size_t i) const
inline

◆ row_add()

◆ row_add_int()

template<class T>
void line::lp::LpModel< T >::row_add_int ( std::size_t j,
long v )
inline

◆ row_begin()

template<class T>
std::size_t line::lp::LpModel< T >::row_begin ( std::size_t i) const
inline

Definition at line 224 of file simplex.h.

Referenced by line::lp::simplex_solve().

◆ row_clear()

◆ row_end()

template<class T>
std::size_t line::lp::LpModel< T >::row_end ( std::size_t i) const
inline

Definition at line 225 of file simplex.h.

Referenced by line::lp::simplex_solve().

◆ sense()

template<class T>
LpSense line::lp::LpModel< T >::sense ( std::size_t i) const
inline

Definition at line 229 of file simplex.h.

Referenced by emit(), and line::lp::simplex_solve().

◆ set_bounds()

template<class T>
void line::lp::LpModel< T >::set_bounds ( std::size_t j,
const T & lo,
const T & hi )
inline

◆ set_cost()

◆ set_free()

template<class T>
void line::lp::LpModel< T >::set_free ( std::size_t j)
inline

Definition at line 151 of file simplex.h.

References set_free_lower(), and set_free_upper().

◆ set_free_lower()

template<class T>
void line::lp::LpModel< T >::set_free_lower ( std::size_t j)
inline

Definition at line 143 of file simplex.h.

Referenced by set_free().

◆ set_free_upper()

template<class T>
void line::lp::LpModel< T >::set_free_upper ( std::size_t j)
inline

Definition at line 147 of file simplex.h.

Referenced by line::mam::m3pp22_interleave_fitc(), and set_free().

◆ set_lower()

template<class T>
void line::lp::LpModel< T >::set_lower ( std::size_t j,
const T & v )
inline

Definition at line 129 of file simplex.h.

Referenced by line::mam::m3pp22_interleave_fitc(), and set_bounds().

◆ set_maximize()

◆ set_upper()

template<class T>
void line::lp::LpModel< T >::set_upper ( std::size_t j,
const T & v )
inline

◆ upper()

template<class T>
const T & line::lp::LpModel< T >::upper ( std::size_t j) const
inline

Definition at line 159 of file simplex.h.

Referenced by line::lp::simplex_solve().

◆ upper_is_free()

template<class T>
bool line::lp::LpModel< T >::upper_is_free ( std::size_t j) const
inline

Definition at line 161 of file simplex.h.

Referenced by line::lp::simplex_solve().

◆ val_at()

template<class T>
const T & line::lp::LpModel< T >::val_at ( std::size_t k) const
inline

Definition at line 227 of file simplex.h.

Referenced by line::lp::simplex_solve().


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