All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
soth::Stage Class Reference

#include <Stage.hpp>

Inheritance diagram for soth::Stage:
[legend]
Collaboration diagram for soth::Stage:
[legend]

Public Types

typedef MatrixXd::Index Index
 
typedef SubMatrix< MatrixXd >
::RowIndices 
Indirect
 
typedef TriangularView
< SubMatrixXd, Lower > 
TriSubMatrixXd
 
typedef TriangularView
< const_SubMatrixXd, Lower > 
const_TriSubMatrixXd
 
typedef VectorBlock
< MatrixXd::RowXpr > 
RowL
 
typedef MatrixXd::RowXpr RowML
 
- Public Types inherited from soth::BasicStage
typedef boost::function< void(std::string,
ConstraintRef, std::string)> 
listener_function_t
 

Public Member Functions

 Stage (const MatrixXd &J, const VectorBound &bounds, BaseY &Y)
 
 Stage (const Index nr, const Index nc, const double *Jdata, const Bound *bdata, const BaseY &Y)
 
 Stage (const Index nr, const Index nc, const double *Jdata, const BaseY &Y)
 
void setInitialActiveSet (void)
 
void setInitialActiveSet (const cstref_vector_t &initialGuess, bool checkTwin=false)
 
cstref_vector_t getOptimalActiveSet (bool withTwin=false)
 
void reset (void)
 
void computeInitialCOD (BaseY &Yinit)
 
bool downdate (const Index position, GivensSequence &Ydown)
 
bool propagateDowndate (GivensSequence &Ydown, bool decreasePreviousRank)
 
Index update (const ConstraintRef &cst, GivensSequence &Yup)
 
void propagateUpdate (GivensSequence &Ydown, Index decreasePreviousRank)
 
void computeSolution (VectorXd &Ytu) const
 
void damp (void)
 
template<typename VectorDerived >
void applyDamping (MatrixBase< VectorDerived > &x) const
 
template<typename VD1 , typename VD2 >
void applyDamping (MatrixBase< VD1 > &x, MatrixBase< VD2 > &y) const
 
template<typename VectorDerived >
void applyDampingTranspose (MatrixBase< VectorDerived > &x) const
 
template<typename VD1 , typename VD2 >
void applyDampingTranspose (MatrixBase< VD1 > &x, const MatrixBase< VD2 > &y) const
 
void damping (const double &factor)
 
double damping (void) const
 
bool useDamp (void) const
 
void dampBoundValue (const ConstraintRef &cst, const double &value)
 
template<typename D >
void computeError (const VectorXd &Ytu, MatrixBase< D > &err) const
 
void computeError (const VectorXd &Ytu)
 
void computeRho (const VectorXd &Ytu, VectorXd &Ytrho, bool inLambda=false)
 
template<typename D >
void computeLagrangeMultipliers (VectorXd &rho, MatrixBase< D > &l) const
 
input: rho_under_i = {ro_1, ..., ro_i}

on return: lambda_i = Wr_i*L_i^{-T}*rho_i rho_under_{i-1} = rho_under_{i-1} + Mr_i^T*L_i^{-T}*rho_i ??? * rho_i = L_i^{-T}*rho_i (should not be useful). More...

 
void computeLagrangeMultipliers (VectorXd &rho)
 
bool checkBound (const VectorXd &u0, const VectorXd &u1, ConstraintRef *, double *tau)
 
bool checkBound (const VectorXd &u0, const VectorXd &u1, ConstraintRef &cstmax, double &taumax)
 
bool maxLambda (const VectorXd &u, double &lmax, Index &row) const
 
void freezeSlacks (const bool &slacks=true)
 
void recompose (MatrixXd &WMLY) const
 
void show (std::ostream &os, Index stageRef, bool check=false) const
 
void showActiveSet (std::ostream &os) const
 
SubMatrix< MatrixXd,
RowPermutation > 
Jactive (MatrixXd &J_) const
 
MatrixXd Jactive () const
 
SubVectorXd eactive (VectorXd &e_) const
 
VectorXd eactive () const
 
bool testRecomposition (void) const
 
bool testSolution (const VectorXd &solution) const
 
bool testUnactiveTwins (void)
 
Index where (Index cst) const
 
ConstraintRef which (Index row) const
 
bool isActive (Index cst) const
 
SubMatrixXd getM ()
 
const_SubMatrixXd getM () const
 
SubMatrixXd getL ()
 
const_SubMatrixXd getL () const
 
TriSubMatrixXd getLtri ()
 
const_TriSubMatrixXd getLtri () const
 
TriSubMatrixXd getLdtri ()
 
const_TriSubMatrixXd getLdtri () const
 
SubVectorXd gete ()
 
const_SubVectorXd gete () const
 
SubVectorXd getLagrangeMultipliers ()
 
const_SubVectorXd getLagrangeMultipliers () const
 
MatrixXd getWr () const
 
VectorXd getLagrangeDamped () const
 
RowL rowL0 (const Index r)
 
RowML rowMrL0 (const Index r)
 
RowL rowML (const Index r)
 
Index rowSize (const Index r)
 
Index nbConstraints (void) const
 
Index sizeA (void) const
 
Index sizeN (void) const
 
Index rank () const
 
Index getSizeM () const
 
Index getSizeL () const
 
- Public Member Functions inherited from soth::BasicStage
 BasicStage (const MatrixXd &J, const VectorBound &bounds, const BaseY &Y)
 
 BasicStage (const Index nr, const Index nc, const double *Jdata, const Bound *bdata, const BaseY &Y)
 
 BasicStage (const Index nr, const Index nc, const double *Jdata, const BaseY &Y)
 
void set (const MatrixXd &J, const VectorBound &bounds)
 
void set (const double *Jdata, const Bound *bdata)
 
Index nbConstraints (void) const
 
VectorXd getJrow (const Index &cst) const
 
Bound getBoundRow (const Index &cst) const
 
MatrixXd getJ () const
 
VectorBound getBounds () const
 
VectorBoundgetBoundsInternal ()
 

Public Attributes

std::string name
 
- Public Attributes inherited from soth::BasicStage
std::string name
 
boost::signal< void(std::string,
ConstraintRef, std::string)> 
notifior
 

Static Public Attributes

static double EPSILON = 1e-8
 

Protected Member Functions

void nullifyLineDeficient (const Index row, const Index in_r)
 
void computeInitialJY ()
 
void conditionalWinit (bool id)
 
void regularizeHessenberg (GivensSequence &Ydown)
 
Index nullifyACrossFromW (const Index position)
 
void removeARowFromL (Index row)
 
void removeACrossFromW (const Index &row, const Index &col)
 
void addARow (const Index &mlrowup, bool deficient=false)
 
void computeErrorFromJu (const VectorXd &MLYtu)
 
template<typename D >
void computeErrorFromJu (const VectorXd &Ytu, MatrixBase< D > &err) const
 
void computeMLYtu (const VectorXd &Ytu, VectorXd &MLYtu) const
 

Protected Attributes

MatrixXd W_
 
MatrixXd ML_
 
VectorXd e_
 
VectorXd lambda_
 
Indirect Ir
 
Indirect Irn
 
Indirect Iw
 
Indirect Im
 
Indirect Il
 
SubMatrixXd M
 
SubMatrixXd L
 
SubMatrixXd W
 
SubMatrixXd Wr
 
SubMatrixXd Mr
 
SubVectorXd e
 
SubVectorXd lambda
 
VectorXd lambdadamped
 
VectorXd lzfreezed
 
bool isWIdenty
 
Index sizeM
 
Index sizeL
 
SubActiveSet< ActiveSet
< Indirect >, Indirect
activeSet
 
AllocatorML freeML
 
MatrixXd Ld_
 
MatrixXd Ldwork_
 
VectorXd edwork_
 
SubMatrixXd Ld
 
SubMatrixXd Ldwork
 
SubVectorXd edwork
 
GivensSequence Wd
 
double dampingFactor
 
bool isReset
 
bool isInit
 
bool isOptimumCpt
 
bool isLagrangeCpt
 
bool isDampCpt
 
bool isFreezed
 
- Protected Attributes inherited from soth::BasicStage
const MatrixXdRefJ
 
const VectorBoundRefbounds
 
const Index nr
 
const Index nc
 
const BaseYY
 

Static Protected Attributes

static const double DAMPING_FACTOR
 

Additional Inherited Members

- Protected Types inherited from soth::BasicStage
typedef MapXd MatrixXdRef
 
typedef MapBound VectorBoundRef
 

Member Typedef Documentation

typedef TriangularView<const_SubMatrixXd, Lower> soth::Stage::const_TriSubMatrixXd
typedef MatrixXd::Index soth::Stage::Index
typedef SubMatrix<MatrixXd>::RowIndices soth::Stage::Indirect
typedef VectorBlock<MatrixXd::RowXpr> soth::Stage::RowL
typedef MatrixXd::RowXpr soth::Stage::RowML
typedef TriangularView<SubMatrixXd, Lower> soth::Stage::TriSubMatrixXd

Constructor & Destructor Documentation

soth::Stage::Stage ( const MatrixXd &  J,
const VectorBound bounds,
BaseY Y 
)
soth::Stage::Stage ( const Index  nr,
const Index  nc,
const double *  Jdata,
const Bound bdata,
const BaseY Y 
)
soth::Stage::Stage ( const Index  nr,
const Index  nc,
const double *  Jdata,
const BaseY Y 
)

Member Function Documentation

void soth::Stage::addARow ( const Index mlrowup,
bool  deficient = false 
)
protected
template<typename VectorDerived >
void soth::Stage::applyDamping ( MatrixBase< VectorDerived > &  x) const

References sotDEBUG.

template<typename VD1 , typename VD2 >
void soth::Stage::applyDamping ( MatrixBase< VD1 > &  x,
MatrixBase< VD2 > &  y 
) const

References sotDEBUG.

template<typename VectorDerived >
void soth::Stage::applyDampingTranspose ( MatrixBase< VectorDerived > &  x) const

References sotDEBUG.

template<typename VD1 , typename VD2 >
void soth::Stage::applyDampingTranspose ( MatrixBase< VD1 > &  x,
const MatrixBase< VD2 > &  y 
) const

References sotDEBUG.

bool soth::Stage::checkBound ( const VectorXd &  u0,
const VectorXd &  u1,
ConstraintRef cstptr,
double *  tau 
)
bool soth::Stage::checkBound ( const VectorXd &  u0,
const VectorXd &  u1,
ConstraintRef cstmax,
double &  taumax 
)
template<typename D >
void soth::Stage::computeError ( const VectorXd &  Ytu,
MatrixBase< D > &  err 
) const
void soth::Stage::computeError ( const VectorXd &  Ytu)
void soth::Stage::computeErrorFromJu ( const VectorXd &  MLYtu)
protected

References sotDEBUG.

template<typename D >
void soth::Stage::computeErrorFromJu ( const VectorXd &  Ytu,
MatrixBase< D > &  err 
) const
protected
void soth::Stage::computeInitialJY ( void  )
protected

References sotDEBUG.

template<typename D >
void soth::Stage::computeLagrangeMultipliers ( VectorXd &  rho,
MatrixBase< D > &  l 
) const

input: rho_under_i = {ro_1, ..., ro_i}

on return: lambda_i = Wr_i*L_i^{-T}*rho_i rho_under_{i-1} = rho_under_{i-1} + Mr_i^T*L_i^{-T}*rho_i ??? * rho_i = L_i^{-T}*rho_i (should not be useful).

References soth::solveInPlaceWithUpperTriangular(), and sotDEBUG.

void soth::Stage::computeLagrangeMultipliers ( VectorXd &  rho)

References sotDEBUG.

void soth::Stage::computeMLYtu ( const VectorXd &  Ytu,
VectorXd &  MLYtu 
) const
protected

References sotDEBUG.

void soth::Stage::computeRho ( const VectorXd &  Ytu,
VectorXd &  Ytrho,
bool  inLambda = false 
)

References sotDEBUG.

void soth::Stage::computeSolution ( VectorXd &  Ytu) const
void soth::Stage::conditionalWinit ( bool  id)
protected
void soth::Stage::damp ( void  )
void soth::Stage::dampBoundValue ( const ConstraintRef cst,
const double &  value 
)

Referenced by soth::HCOD::downdate().

void soth::Stage::damping ( const double &  factor)
inline
double soth::Stage::damping ( void  ) const
inline
bool soth::Stage::downdate ( const Index  position,
GivensSequence Ydown 
)

References sotDEBUG.

SubVectorXd soth::Stage::eactive ( VectorXd &  e_) const
VectorXd soth::Stage::eactive ( ) const
void soth::Stage::freezeSlacks ( const bool &  slacks = true)

References EI_FOREACH, and sotDEBUG.

SubVectorXd soth::Stage::gete ( )
inline
const_SubVectorXd soth::Stage::gete ( ) const
inline
SubMatrixXd soth::Stage::getL ( )
inline
const_SubMatrixXd soth::Stage::getL ( ) const
inline
VectorXd soth::Stage::getLagrangeDamped ( ) const
inline
SubVectorXd soth::Stage::getLagrangeMultipliers ( )
inline
const_SubVectorXd soth::Stage::getLagrangeMultipliers ( ) const
inline
TriSubMatrixXd soth::Stage::getLdtri ( )
inline
const_TriSubMatrixXd soth::Stage::getLdtri ( ) const
inline
TriSubMatrixXd soth::Stage::getLtri ( )
inline
const_TriSubMatrixXd soth::Stage::getLtri ( ) const
inline
SubMatrixXd soth::Stage::getM ( )
inline
const_SubMatrixXd soth::Stage::getM ( ) const
inline
cstref_vector_t soth::Stage::getOptimalActiveSet ( bool  withTwin = false)
Index soth::Stage::getSizeL ( ) const
inline
Index soth::Stage::getSizeM ( ) const
inline
MatrixXd soth::Stage::getWr ( ) const
inline
bool soth::Stage::isActive ( Index  cst) const
SubMatrix< MatrixXd, RowPermutation > soth::Stage::Jactive ( MatrixXd &  J_) const
MatrixXd soth::Stage::Jactive ( ) const
bool soth::Stage::maxLambda ( const VectorXd &  u,
double &  lmax,
Index row 
) const
Index soth::Stage::nbConstraints ( void  ) const
inline
MatrixXd::Index soth::Stage::nullifyACrossFromW ( const Index  position)
protected

References sotDEBUG.

void soth::Stage::nullifyLineDeficient ( const Index  row,
const Index  in_r 
)
protected
bool soth::Stage::propagateDowndate ( GivensSequence Ydown,
bool  decreasePreviousRank 
)
void soth::Stage::propagateUpdate ( GivensSequence Ydown,
Index  decreasePreviousRank 
)
Index soth::Stage::rank ( ) const
inline
void soth::Stage::recompose ( MatrixXd &  WMLY) const

References sotDEBUG.

void soth::Stage::regularizeHessenberg ( GivensSequence Ydown)
protected
void soth::Stage::removeACrossFromW ( const Index row,
const Index col 
)
protected

References sotDEBUG.

void soth::Stage::removeARowFromL ( Index  row)
protected

References sotDEBUG.

void soth::Stage::reset ( void  )

References sotDEBUG.

Stage::RowL soth::Stage::rowL0 ( const Index  r)
Stage::RowL soth::Stage::rowML ( const Index  r)
Stage::RowML soth::Stage::rowMrL0 ( const Index  r)
Stage::Index soth::Stage::rowSize ( const Index  r)
void soth::Stage::setInitialActiveSet ( void  )
void soth::Stage::setInitialActiveSet ( const cstref_vector_t initialGuess,
bool  checkTwin = false 
)

References sotDEBUG, sotDEBUGIN, and sotDEBUGOUT.

void soth::Stage::show ( std::ostream &  os,
Index  stageRef,
bool  check = false 
) const
void soth::Stage::showActiveSet ( std::ostream &  os) const
Index soth::Stage::sizeA ( void  ) const
inline
Index soth::Stage::sizeN ( void  ) const
inline
bool soth::Stage::testRecomposition ( void  ) const
bool soth::Stage::testSolution ( const VectorXd &  solution) const
bool soth::Stage::testUnactiveTwins ( void  )

References sotDEBUG.

MatrixXd::Index soth::Stage::update ( const ConstraintRef cst,
GivensSequence Yup 
)
bool soth::Stage::useDamp ( void  ) const
inline
Stage::Index soth::Stage::where ( Index  cst) const
ConstraintRef soth::Stage::which ( Index  row) const

Member Data Documentation

SubActiveSet<ActiveSet<Indirect>, Indirect> soth::Stage::activeSet
protected
const double soth::Stage::DAMPING_FACTOR
staticprotected
double soth::Stage::dampingFactor
protected
SubVectorXd soth::Stage::e
protected
VectorXd soth::Stage::e_
protected
SubVectorXd soth::Stage::edwork
mutableprotected
VectorXd soth::Stage::edwork_
mutableprotected
double soth::Stage::EPSILON = 1e-8
static
AllocatorML soth::Stage::freeML
protected
Indirect soth::Stage::Il
protected
Indirect soth::Stage::Im
protected
Indirect soth::Stage::Ir
protected
Indirect soth::Stage::Irn
protected
bool soth::Stage::isDampCpt
protected
bool soth::Stage::isFreezed
protected
bool soth::Stage::isInit
protected
bool soth::Stage::isLagrangeCpt
protected
bool soth::Stage::isOptimumCpt
protected
bool soth::Stage::isReset
protected
bool soth::Stage::isWIdenty
protected
Indirect soth::Stage::Iw
protected
SubMatrixXd soth::Stage::L
protected
SubVectorXd soth::Stage::lambda
protected
VectorXd soth::Stage::lambda_
protected
VectorXd soth::Stage::lambdadamped
mutableprotected
SubMatrixXd soth::Stage::Ld
protected
MatrixXd soth::Stage::Ld_
protected
SubMatrixXd soth::Stage::Ldwork
protected
MatrixXd soth::Stage::Ldwork_
protected
VectorXd soth::Stage::lzfreezed
protected
SubMatrixXd soth::Stage::M
protected
MatrixXd soth::Stage::ML_
protected
SubMatrixXd soth::Stage::Mr
protected
std::string soth::Stage::name
Index soth::Stage::sizeL
protected
Index soth::Stage::sizeM
protected
SubMatrixXd soth::Stage::W
protected
MatrixXd soth::Stage::W_
protected
GivensSequence soth::Stage::Wd
protected
SubMatrixXd soth::Stage::Wr
protected