PIPS-NLP
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
ReducedSpaceSolver Class Reference

#include <ReducedSpaceSolver.h>

Inheritance diagram for ReducedSpaceSolver:
DoubleLinearSolver

Public Member Functions

virtual int getDecisionDim ()
 
virtual int matrixChanged ()
 
 ReducedSpaceSolver ()
 
 ReducedSpaceSolver (DoubleMatrix *MatIn, const int decisionVarSize, int *decisionVarID, const int fullVarXSize, const int fullVarYSize, const int fullVarSSize)
 
 ~ReducedSpaceSolver ()
 
- Public Member Functions inherited from DoubleLinearSolver
 DoubleLinearSolver ()
 
virtual void solveTrans (OoqpVector &x)
 
virtual void Lsolve (OoqpVector &x)
 
virtual void Dsolve (OoqpVector &x)
 
virtual void Ltsolve (OoqpVector &x)
 
virtual ~DoubleLinearSolver ()
 

Protected Member Functions

virtual void firstCall ()
 
virtual int _numericalFact ()
 
virtual void diagonalChanged (int idiag, int extent)
 
virtual void solve (OoqpVector &rhs_)
 
virtual void solve (GenMatrix &rhs_in)
 

Protected Attributes

DoubleLinearSolverAx_solver
 
DoubleLinearSolverSC_solver
 
int firstCallFlag
 
int firstSCsolve
 
int doBuildSc
 
SparseSymMatrixkkt_diag
 
DenseSymMatrixkktsc
 
DoubleLinearSolverSparseAug_solver
 
bool firstHxxUpdate
 
bool firstHssUpdate
 
bool firstAxUpdate
 
bool firstTxUpdate
 
std::map< int, int > LocHxxMap
 
std::map< int, int > LocHssMap
 
std::map< int, int > LocAxMap
 
std::map< int, int > LocTxMap
 
int Hxx_Dim
 
int Huu_Dim
 
int Hss_Dim
 
int Ax_Dim_m
 
int Tx_Dim_m
 
int fullMatDim
 
int Hxx_NNz
 
int Huu_NNz
 
int Hss_NNz
 
int Hux_NNz
 
int Ax_NNz
 
int Au_NNz
 
int Tx_NNz
 
int Tu_NNz
 
int I_NNz
 
int fullMatNNz
 
double * Hxx_ele
 
double * Huu_ele
 
double * Hss_ele
 
double * Hux_ele
 
double * Ax_ele
 
double * Au_ele
 
double * Tx_ele
 
double * Tu_ele
 
double * I_ele
 
int * Hxx_rowBeg
 
int * Huu_rowBeg
 
int * Hss_rowBeg
 
int * Hux_rowBeg
 
int * Ax_rowBeg
 
int * Au_rowBeg
 
int * Tx_rowBeg
 
int * Tu_rowBeg
 
int * I_rowBeg
 
int * Hxx_colIdx
 
int * Huu_colIdx
 
int * Hss_colIdx
 
int * Hux_colIdx
 
int * Ax_colIdx
 
int * Au_colIdx
 
int * Tx_colIdx
 
int * Tu_colIdx
 
int * I_colIdx
 
int * Hxx_Full_eleMap
 
int * Huu_Full_eleMap
 
int * Hss_Full_eleMap
 
int * Hux_Full_eleMap
 
int * Ax_Full_eleMap
 
int * Au_Full_eleMap
 
int * Tx_Full_eleMap
 
int * Tu_Full_eleMap
 
int * I_Full_eleMap
 
int * decisionVarIDinFull
 
int DecisionVarDim
 
int slackVarDim
 
int stateVarDim
 
int dualYDim
 
SparseSymMatrixHxx_Mat
 
SparseSymMatrixHuu_Mat
 
SparseSymMatrixHss_Mat
 
SparseSymMatrixI_Mat
 
SparseGenMatrixHux_Mat
 
SparseGenMatrixHxu_Mat
 
SparseGenMatrixAx_Mat
 
SparseGenMatrixAu_Mat
 
SparseGenMatrixTx_Mat
 
SparseGenMatrixTu_Mat
 
SparseSymMatrixMsys
 
int localNegaEigVal
 

Private Member Functions

void reducedSpaceJacSolve (OoqpVector *rhs_y_, OoqpVector *rhs_z_)
 
void reducedSpaceJacTransSolve (OoqpVector *rhs_x_, OoqpVector *rhs_s_)
 
void solveDeltaU (OoqpVector &rhs_u, OoqpVector *rhs_Full)
 
void schursolveDeltaU (OoqpVector &rhs_u, OoqpVector *rhs_Full)
 
void schursolveDeltaU_BuildSC (OoqpVector &rhs_, OoqpVector *rhs_Full)
 
void _schursolveDeltaU_BuildSC_firstCall ()
 
void addTermToDenseSchurCompl (DenseSymMatrix &SC)
 

Private Attributes

int * stateVarIDinFull
 
int * FullVarIDinLocal
 

Additional Inherited Members

- Public Attributes inherited from DoubleLinearSolver
int negEigVal
 
int KryIter
 

Detailed Description

u is the decision matrix, x is the others (state var) in this solver, we assume Ax and Ax' are invertible.

fullMat = Hxx | Hxu | |Ax' | Tx' | r_x Hux | Huu | |Au' | Tu' | r_u | | Hss | | -I | = r_s Ax | Au | | | | r_y Tx | Tu | -I | | | r_z

this can be reordered as fullMat = Hxx | | Hxu |Ax' | Tx' | r_x | Hss | | | -I | r_s Hux | | Huu |Au' | Tu' | = r_u (1) Ax | | Au | | | r_y Tx | -I | Tu | | | r_z

let C = ( Ax ) , Ac = ( Au ), Huc = ( Hux 0 ) = Hcu' (*) ( Tx -I ) ( Tu )

the invert mat of C is ^{-1} = ( Ax^{-1} ) ( TxAx^{-1} -I )

(1)can be rewrited as Hc | Hcu | C' | r_p Huc | Huu | Ac' | = r_u (2) C | Ac | | r_d

Hc | C' | Hcu | r_p C | | Ac | r_d (3) Huc | Ac' | Huu | = r_u

similar to the schur complement method, we solve the problem fullMat*(x,u,y,z)=r by the following sequence: (a) solve following equation to get ( Huu-Huc*C^{-1}*Ac-Ac'*C^{-T}Hcu+Ac'*C^{-T}*Hc*C^{-1}*Ac ) * = r_u -Ac'*C^{-T}(r_p-Hc*C^{-1}r_d)-Huc*C^{-1}r_d

here we save rhs_p = C^{-1}r_d and rhs_d = C^{-T}(r_p-Hc*C^{-1}r_d)

(b) compute = C^{-1}(r_d-Ac*) = rhs_p - C^{-1}Ac*

(c) compute = C^{-T} [ (r_p-Hc*C^{-1}r_d) - (Hcu-Hc*C^{-1}*Ac)* ] or = C^{-T} ( r_p - Hc*delta_p- Hcu*delta_u) or = rhs_d - C^{-T} (Hcu* -Hc*C^{-1}*Ac* )

the later terms in (b) and (c) are computed by solving

Hc  |      C'   |   =               r_p     =   Hcu*\delta_u

C | | r_d Ac*

note that input matrix fullMat is symmetric, and in a row-wise, lower-triangular form

Constructor & Destructor Documentation

ReducedSpaceSolver::ReducedSpaceSolver ( )
ReducedSpaceSolver::ReducedSpaceSolver ( DoubleMatrix MatIn,
const int  decisionVarSize,
int *  decisionVarID,
const int  fullVarXSize,
const int  fullVarYSize,
const int  fullVarSSize 
)
ReducedSpaceSolver::~ReducedSpaceSolver ( )
inline

Member Function Documentation

int ReducedSpaceSolver::_numericalFact ( )
protectedvirtual
void ReducedSpaceSolver::_schursolveDeltaU_BuildSC_firstCall ( )
private
void ReducedSpaceSolver::addTermToDenseSchurCompl ( DenseSymMatrix SC)
private
virtual void ReducedSpaceSolver::diagonalChanged ( int  idiag,
int  extent 
)
inlineprotectedvirtual

called if the diagonal elements of the matrix have changed. Triggers a refactorization of the matrix, if necessary.

Parameters
idiagindex of the first diagonal element that changed
extentthe number of diagonal element that changed.

Implements DoubleLinearSolver.

void ReducedSpaceSolver::firstCall ( )
protectedvirtual
virtual int ReducedSpaceSolver::getDecisionDim ( )
inlinevirtual
virtual int ReducedSpaceSolver::matrixChanged ( )
inlinevirtual

called if some elements of the matrix have changed. Triggers a refactorization of the matrix, if necessary.

Implements DoubleLinearSolver.

void ReducedSpaceSolver::reducedSpaceJacSolve ( OoqpVector rhs_y_,
OoqpVector rhs_z_ 
)
private
void ReducedSpaceSolver::reducedSpaceJacTransSolve ( OoqpVector rhs_x_,
OoqpVector rhs_s_ 
)
private
void ReducedSpaceSolver::schursolveDeltaU ( OoqpVector rhs_u,
OoqpVector rhs_Full 
)
private
void ReducedSpaceSolver::schursolveDeltaU_BuildSC ( OoqpVector rhs_,
OoqpVector rhs_Full 
)
private
void ReducedSpaceSolver::solve ( OoqpVector x)
protectedvirtual

solves a linear system.

Parameters
xon entry the right hand side of the system to be solved. On exit, the solution.

Implements DoubleLinearSolver.

void ReducedSpaceSolver::solve ( GenMatrix rhs_in)
protectedvirtual

Reimplemented from DoubleLinearSolver.

void ReducedSpaceSolver::solveDeltaU ( OoqpVector rhs_u,
OoqpVector rhs_Full 
)
private

Member Data Documentation

int * ReducedSpaceSolver::Au_colIdx
protected
double * ReducedSpaceSolver::Au_ele
protected
int * ReducedSpaceSolver::Au_Full_eleMap
protected
SparseGenMatrix * ReducedSpaceSolver::Au_Mat
protected
int ReducedSpaceSolver::Au_NNz
protected
int * ReducedSpaceSolver::Au_rowBeg
protected
int * ReducedSpaceSolver::Ax_colIdx
protected
int ReducedSpaceSolver::Ax_Dim_m
protected
double * ReducedSpaceSolver::Ax_ele
protected
int * ReducedSpaceSolver::Ax_Full_eleMap
protected
SparseGenMatrix * ReducedSpaceSolver::Ax_Mat
protected
int ReducedSpaceSolver::Ax_NNz
protected
int * ReducedSpaceSolver::Ax_rowBeg
protected
DoubleLinearSolver* ReducedSpaceSolver::Ax_solver
protected
int ReducedSpaceSolver::DecisionVarDim
protected
int* ReducedSpaceSolver::decisionVarIDinFull
protected
int ReducedSpaceSolver::doBuildSc
protected
int ReducedSpaceSolver::dualYDim
protected
bool ReducedSpaceSolver::firstAxUpdate
protected
int ReducedSpaceSolver::firstCallFlag
protected
bool ReducedSpaceSolver::firstHssUpdate
protected
bool ReducedSpaceSolver::firstHxxUpdate
protected
int ReducedSpaceSolver::firstSCsolve
protected
bool ReducedSpaceSolver::firstTxUpdate
protected
int ReducedSpaceSolver::fullMatDim
protected
int ReducedSpaceSolver::fullMatNNz
protected
int* ReducedSpaceSolver::FullVarIDinLocal
private
int * ReducedSpaceSolver::Hss_colIdx
protected
int ReducedSpaceSolver::Hss_Dim
protected
double * ReducedSpaceSolver::Hss_ele
protected
int * ReducedSpaceSolver::Hss_Full_eleMap
protected
SparseSymMatrix * ReducedSpaceSolver::Hss_Mat
protected
int ReducedSpaceSolver::Hss_NNz
protected
int * ReducedSpaceSolver::Hss_rowBeg
protected
int * ReducedSpaceSolver::Huu_colIdx
protected
int ReducedSpaceSolver::Huu_Dim
protected
double * ReducedSpaceSolver::Huu_ele
protected
int * ReducedSpaceSolver::Huu_Full_eleMap
protected
SparseSymMatrix * ReducedSpaceSolver::Huu_Mat
protected
int ReducedSpaceSolver::Huu_NNz
protected
int * ReducedSpaceSolver::Huu_rowBeg
protected
int * ReducedSpaceSolver::Hux_colIdx
protected
double * ReducedSpaceSolver::Hux_ele
protected
int * ReducedSpaceSolver::Hux_Full_eleMap
protected
SparseGenMatrix* ReducedSpaceSolver::Hux_Mat
protected
int ReducedSpaceSolver::Hux_NNz
protected
int * ReducedSpaceSolver::Hux_rowBeg
protected
SparseGenMatrix * ReducedSpaceSolver::Hxu_Mat
protected
int* ReducedSpaceSolver::Hxx_colIdx
protected
int ReducedSpaceSolver::Hxx_Dim
protected
double* ReducedSpaceSolver::Hxx_ele
protected
int* ReducedSpaceSolver::Hxx_Full_eleMap
protected
SparseSymMatrix* ReducedSpaceSolver::Hxx_Mat
protected
int ReducedSpaceSolver::Hxx_NNz
protected
int* ReducedSpaceSolver::Hxx_rowBeg
protected
int * ReducedSpaceSolver::I_colIdx
protected
double * ReducedSpaceSolver::I_ele
protected
int * ReducedSpaceSolver::I_Full_eleMap
protected
SparseSymMatrix * ReducedSpaceSolver::I_Mat
protected
int ReducedSpaceSolver::I_NNz
protected
int * ReducedSpaceSolver::I_rowBeg
protected
SparseSymMatrix* ReducedSpaceSolver::kkt_diag
protected
DenseSymMatrix* ReducedSpaceSolver::kktsc
protected
int ReducedSpaceSolver::localNegaEigVal
protected
std::map<int,int> ReducedSpaceSolver::LocAxMap
protected
std::map<int,int> ReducedSpaceSolver::LocHssMap
protected
std::map<int,int> ReducedSpaceSolver::LocHxxMap
protected
std::map<int,int> ReducedSpaceSolver::LocTxMap
protected
SparseSymMatrix* ReducedSpaceSolver::Msys
protected
DoubleLinearSolver* ReducedSpaceSolver::SC_solver
protected
int ReducedSpaceSolver::slackVarDim
protected
DoubleLinearSolver* ReducedSpaceSolver::SparseAug_solver
protected
int ReducedSpaceSolver::stateVarDim
protected
int* ReducedSpaceSolver::stateVarIDinFull
private
int * ReducedSpaceSolver::Tu_colIdx
protected
double * ReducedSpaceSolver::Tu_ele
protected
int * ReducedSpaceSolver::Tu_Full_eleMap
protected
SparseGenMatrix * ReducedSpaceSolver::Tu_Mat
protected
int ReducedSpaceSolver::Tu_NNz
protected
int * ReducedSpaceSolver::Tu_rowBeg
protected
int * ReducedSpaceSolver::Tx_colIdx
protected
int ReducedSpaceSolver::Tx_Dim_m
protected
double * ReducedSpaceSolver::Tx_ele
protected
int * ReducedSpaceSolver::Tx_Full_eleMap
protected
SparseGenMatrix * ReducedSpaceSolver::Tx_Mat
protected
int ReducedSpaceSolver::Tx_NNz
protected
int * ReducedSpaceSolver::Tx_rowBeg
protected

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