Scippy

SoPlex

Sequential object-oriented simPlex

LPRowBase< R > Class Template Reference

(In)equality for LPs.Class LPRowBase provides constraints for linear programs in the form

\[ l \le a^Tx \le r, \]

where a is a DSVector. l is referred to as left hand side, r as right hand side and a as row vector or the constraint vector. l and r may also take values \(\pm\) #R(infinity). This static member is predefined, but may be overridden to meet the needs of the LP solver to be used. More...

#include <lprowbase.h>

Public Types

Types
enum  Type { LESS_EQUAL, EQUAL, GREATER_EQUAL, RANGE }
 (In)Equality type of an LP row. More...
 

Public Member Functions

Construction / destruction
 LPRowBase (int defDim=0)
 Constructs LPRowBase with a vector ready to hold defDim nonzeros. More...
 
LPRowBase< R > & operator= (const LPRowBase< R > &row)
 Assignment operator. More...
 
 LPRowBase (const LPRowBase< R > &row)
 Copy constructor. More...
 
template<class S >
 LPRowBase (const LPRowBase< S > &row)
 Copy constructor. More...
 
 LPRowBase (const R &p_lhs, const SVectorBase< R > &p_rowVector, const R &p_rhs, const R &p_obj=0)
 Constructs LPRowBase with the given left-hand side, right-hand side and rowVector. More...
 
 LPRowBase (const SVectorBase< R > &p_rowVector, Type p_type, const R &p_value, const R &p_obj=0)
 Constructs LPRowBase from passed rowVector, type and value. More...
 
 ~LPRowBase ()
 Destructor. More...
 
Access / modification
Type type () const
 Gets type of row. More...
 
void setType (Type p_type)
 Sets type of (in)equality. More...
 
value () const
 Right hand side value of (in)equality. More...
 
lhs () const
 Left-hand side value. More...
 
void setLhs (const R &p_left)
 Sets left-hand side value. More...
 
rhs () const
 Right-hand side value. More...
 
void setRhs (const R &p_right)
 Sets right-hand side value. More...
 
obj () const
 Objective coefficient value. More...
 
void setObj (const R &p_obj)
 Sets objective coefficient value. More...
 
const SVectorBase< R > & rowVector () const
 Constraint row vector. More...
 
void setRowVector (const DSVectorBase< R > &p_vec)
 access constraint row vector. More...
 
Consistency check
bool isConsistent () const
 Checks consistency. More...
 

Private Attributes

Data
left
 left-hand side of the constraint More...
 
right
 right-hand side of the constraint More...
 
object
 objective coefficient of corresponding slack variable s = vec times primal More...
 
DSVectorBase< R > vec
 the row vector More...
 

Friends

template<class S >
class LPRowBase
 

Detailed Description

template<class R>
class soplex::LPRowBase< R >

(In)equality for LPs.

Class LPRowBase provides constraints for linear programs in the form

\[ l \le a^Tx \le r, \]

where a is a DSVector. l is referred to as left hand side, r as right hand side and a as row vector or the constraint vector. l and r may also take values \(\pm\) #R(infinity). This static member is predefined, but may be overridden to meet the needs of the LP solver to be used.

LPRowBases allow to specify regular inequalities of the form

\[ a^Tx \sim \alpha, \]

where \(\sim\) can take any value of \(\le, =, \ge\), by setting rhs and lhs to the same value or setting one of them to \(\infty\).

Since constraints in the regular form occur often, LPRowBases offers methods type() and value() for retreiving \(\sim\) and \(\alpha\) of an LPRowBase in this form, respectively. Also, a constructor for LPRowBases given in regular form is provided.

Definition at line 54 of file lprowbase.h.

Member Enumeration Documentation

◆ Type

enum Type

(In)Equality type of an LP row.

LPRowBases may be of one of the following Types. This datatype may be used for constructing new LPRowBases in the regular form.

Enumerator
LESS_EQUAL 

\(a^Tx \le \alpha\).

EQUAL 

\(a^Tx = \alpha\).

GREATER_EQUAL 

\(a^Tx \ge \alpha\).

RANGE 

\(\lambda \le a^Tx \le \rho\).

Definition at line 81 of file lprowbase.h.

Constructor & Destructor Documentation

◆ LPRowBase() [1/5]

LPRowBase ( int  defDim = 0)
explicit

Constructs LPRowBase with a vector ready to hold defDim nonzeros.

Definition at line 96 of file lprowbase.h.

References LPRowBase< R >::isConsistent().

◆ LPRowBase() [2/5]

LPRowBase ( const LPRowBase< R > &  row)

Copy constructor.

Definition at line 117 of file lprowbase.h.

References LPRowBase< R >::isConsistent().

◆ LPRowBase() [3/5]

LPRowBase ( const LPRowBase< S > &  row)

Copy constructor.

Definition at line 125 of file lprowbase.h.

References LPRowBase< R >::isConsistent().

◆ LPRowBase() [4/5]

LPRowBase ( const R &  p_lhs,
const SVectorBase< R > &  p_rowVector,
const R &  p_rhs,
const R &  p_obj = 0 
)

Constructs LPRowBase with the given left-hand side, right-hand side and rowVector.

Definition at line 132 of file lprowbase.h.

References LPRowBase< R >::isConsistent().

◆ LPRowBase() [5/5]

LPRowBase ( const SVectorBase< R > &  p_rowVector,
Type  p_type,
const R &  p_value,
const R &  p_obj = 0 
)

Constructs LPRowBase from passed rowVector, type and value.

Definition at line 139 of file lprowbase.h.

References LPRowBase< R >::EQUAL, LPRowBase< R >::GREATER_EQUAL, soplex::infinity, LPRowBase< R >::isConsistent(), and LPRowBase< R >::LESS_EQUAL.

◆ ~LPRowBase()

~LPRowBase ( )

Destructor.

Definition at line 167 of file lprowbase.h.

Member Function Documentation

◆ isConsistent()

bool isConsistent ( ) const

Checks consistency.

Definition at line 288 of file lprowbase.h.

References DSVectorBase< R >::isConsistent().

Referenced by LPRowBase< R >::LPRowBase(), and LPRowBase< R >::operator=().

◆ lhs()

R lhs ( ) const

◆ obj()

R obj ( ) const

Objective coefficient value.

Definition at line 258 of file lprowbase.h.

References LPRowBase< R >::object.

Referenced by LPRowSetBase< R >::add(), and SPxLPBase< BP >::changeRow().

◆ operator=()

LPRowBase<R>& operator= ( const LPRowBase< R > &  row)

◆ rhs()

R rhs ( ) const

◆ rowVector()

const SVectorBase<R>& rowVector ( ) const

Constraint row vector.

Definition at line 270 of file lprowbase.h.

References LPRowBase< R >::vec.

Referenced by LPRowSetBase< R >::add(), SPxLPBase< BP >::changeRow(), and SoPlex_getRowVectorRational().

◆ setLhs()

void setLhs ( const R &  p_left)

Sets left-hand side value.

Definition at line 240 of file lprowbase.h.

Referenced by SPxLPBase< BP >::getRow().

◆ setObj()

void setObj ( const R &  p_obj)

Sets objective coefficient value.

Definition at line 264 of file lprowbase.h.

Referenced by SPxLPBase< BP >::getRow().

◆ setRhs()

void setRhs ( const R &  p_right)

Sets right-hand side value.

Definition at line 252 of file lprowbase.h.

Referenced by SPxLPBase< BP >::getRow().

◆ setRowVector()

void setRowVector ( const DSVectorBase< R > &  p_vec)

access constraint row vector.

Definition at line 276 of file lprowbase.h.

Referenced by SPxLPBase< BP >::getRow().

◆ setType()

◆ type()

◆ value()

R value ( ) const

Right hand side value of (in)equality.

This method returns \(\alpha\) for a LPRowBase in regular form. However, value() may only be called for LPRowBases with type() != RANGE.

Definition at line 226 of file lprowbase.h.

References soplex::infinity, LPRowBase< R >::lhs(), LPRowBase< R >::RANGE, LPRowBase< R >::rhs(), and LPRowBase< R >::type().

Friends And Related Function Documentation

◆ LPRowBase

friend class LPRowBase
friend

Definition at line 56 of file lprowbase.h.

Member Data Documentation

◆ left

R left
private

left-hand side of the constraint

Definition at line 64 of file lprowbase.h.

Referenced by LPRowBase< R >::lhs(), and LPRowBase< R >::operator=().

◆ object

R object
private

objective coefficient of corresponding slack variable s = vec times primal

Definition at line 66 of file lprowbase.h.

Referenced by LPRowBase< R >::obj(), and LPRowBase< R >::operator=().

◆ right

R right
private

right-hand side of the constraint

Definition at line 65 of file lprowbase.h.

Referenced by LPRowBase< R >::operator=(), and LPRowBase< R >::rhs().

◆ vec

DSVectorBase<R> vec
private

the row vector

Definition at line 67 of file lprowbase.h.

Referenced by LPRowBase< R >::operator=(), and LPRowBase< R >::rowVector().