ConstrainedOptPack: C++ Tools for Constrained (and Unconstrained) Optimization  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Public Types | Public Member Functions | List of all members
ConstrainedOptPack::MatrixKKTFullSpaceRelaxed Class Reference

Implementation of a KKT matrix factorized in the full space. More...

#include <ConstrainedOptPack_MatrixKKTFullSpaceRelaxed.hpp>

Inherits MatrixWithOpFactorized, and MatrixConvertToSparseFortranCompatible.

Classes

class  InvalidMatrixType
 
class  NotInitializedException
 
class  SingularMatrixException
 

Public Types

enum  ERunTests
 
enum  EPrintMoreOrLess
 
typedef
AbstractLinAlgPack::DirectSparseFortranCompatibleSolver 
DirectSparseFortranCompatibleSolver
 

Public Member Functions

 STANDARD_COMPOSITION_MEMBERS (DirectSparseFortranCompatibleSolver, direct_solver)
 <<std comp>="">> members for the direct sparse linear solver More...
 
 MatrixKKTFullSpaceRelaxed (const direct_solver_ptr_t &direct_solver=0)
 
size_type rows () const
 
size_type cols () const
 
std::ostream & output (std::ostream &out) const
 
MatrixOp & operator= (const MatrixOp &m)
 
void Vp_StMtV (DVectorSlice *vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2, value_type beta) const
 (2) vs_lhs = alpha * op(M_rhs1) * vs_rhs2 + beta * vs_lhs (BLAS xGEMV) More...
 
void V_InvMtV (DVectorSlice *v_lhs, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2) const
 (1) v_lhs = inv(op(M_rhs1)) * vs_rhs2 More...
 
FortranTypes::f_int num_nonzeros (EExtractRegion extract_region) const
 
void coor_extract_nonzeros (EExtractRegion extract_region, const FortranTypes::f_int len_Aval, FortranTypes::f_dbl_prec Aval[], const FortranTypes::f_int len_Aij, FortranTypes::f_int Arow[], FortranTypes::f_int Acol[], const FortranTypes::f_int row_offset, const FortranTypes::f_int col_offset) const
 

Initialize the relaxed or unrelaxed KKT matrix.

These operations will factorize the matrix K. If the matrix K is not full rank then a SingularMatrixException exception will be thrown. The objects G and A must support the MatrixConvertToSparseFortranCompatible (MCTSFC) interface or the exception InvalidMatrixType will be thrown.

Some of the common arguments that these initialization methods share are:

{itemize} G [I] Hessian matrix ( must support MESFCE interface ). A [I] Gradient of constraints matrix ( must support MESFCE interface ). out [O] Output stream to print to. This stream may be used for output after initialization also so make sure that it remains valid as long as this matrix object is is use. For no output set out=NULL. run_test [I] If set the true then many (expensive) tests will be preformed to ensure that everything is working properly. print_more [I] If set the true then a lot more output may be produced expecially if some error occurs. {itemize}

Important: It is vital that the definitions of G and A do not change externally while this object is being used. To do so may invalidate the behavior of this object (especially the MatrixOp functions).

This class will try to reuse the factorization structure from the last call to initialze(...) or initialize_relaxed(...) when possible. Namely if G and A have the same dimensions and same number of nonzeros of the matrices previously factorized, it will be assumed that the structure will be the same. If this is not the case then the client should call release_memory(...) to wipe the slate clean and start over before calling initialize...(...) again.

void initialize (const MatrixOp &G, const MatrixOp &A, std::ostream *out=0, EPrintMoreOrLess print_what=PRINT_LESS, ERunTests test_what=NO_TESTS)
 Initialize the nonrelaxed matrix. More...
 
void initialize_relaxed (const MatrixOp &G, const MatrixOp &A, const DVectorSlice &c, value_type bigM=1e+10, std::ostream *out=0, EPrintMoreOrLess print_what=PRINT_LESS, ERunTests test_what=NO_TESTS)
 Initialize the relaxed matrix. More...
 
void set_uninitialized ()
 Set the matrix to uninitialized. More...
 
void release_memory ()
 Clear all allocated storage. More...
 

Detailed Description

Implementation of a KKT matrix factorized in the full space.

This class is used to represent the KKT matrix of the following relaxed QP:

{verbatim} min [ g' M ] * [ d ] + 1/2 * [ d' eta ] * [ G ] * [ d ] [ eta ] [ M ] [ eta ]

s.t. [ A' -c ] * [ d ] + c = 0 [ eta ] {verbatim}

The only matrix actually factorized is:

{verbatim} K_bar = [ G A ] [ A' ] {verbatim}

The class has two modes.

First mode is to not include the relaxation term and therefore the KKT matrix is:

{verbatim} K = [ G A ] [ A' ] {verbatim}

The second mode is the use the relaxation and he represented matrix is:

{verbatim} [ G A ] K = [ M -c' ] [ A' -c ] {verbatim}

This class uses an aggregate DirectSparseFortranCompatibleSolver (DSFCS) object to factorize K above and then to solve for the linear systems involving K.

Definition at line 94 of file ConstrainedOptPack_MatrixKKTFullSpaceRelaxed.hpp.

Member Typedef Documentation

typedef AbstractLinAlgPack::DirectSparseFortranCompatibleSolver ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::DirectSparseFortranCompatibleSolver

Member Enumeration Documentation

Constructor & Destructor Documentation

ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::MatrixKKTFullSpaceRelaxed ( const direct_solver_ptr_t &  direct_solver = 0)

Member Function Documentation

ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::STANDARD_COMPOSITION_MEMBERS ( DirectSparseFortranCompatibleSolver  ,
direct_solver   
)

<<std comp>="">> members for the direct sparse linear solver

void ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::initialize ( const MatrixOp &  G,
const MatrixOp &  A,
std::ostream *  out = 0,
EPrintMoreOrLess  print_what = PRINT_LESS,
ERunTests  test_what = NO_TESTS 
)

Initialize the nonrelaxed matrix.

void ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::initialize_relaxed ( const MatrixOp &  G,
const MatrixOp &  A,
const DVectorSlice &  c,
value_type  bigM = 1e+10,
std::ostream *  out = 0,
EPrintMoreOrLess  print_what = PRINT_LESS,
ERunTests  test_what = NO_TESTS 
)

Initialize the relaxed matrix.

If the unrelaxed QP is well scaled (near 1.0) then a reasonable value for bigM = M might be 1e+10 however this is problem specific.

void ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::set_uninitialized ( )

Set the matrix to uninitialized.

The purpose of this method is for the client to specifically state that it is done using this object for now. This is to avoid problems where the definitions of G and A might change and then another client unknowingly trys to use this object.

Note that this does not erase storage of the factorization structure for example.

void ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::release_memory ( )

Clear all allocated storage.

The client should call this routine if he wants the new KKT matrix to be reanalyze and factorized the next time initialize...(...) is called.

size_type ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::rows ( ) const

size_type ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::cols ( ) const

std::ostream& ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::output ( std::ostream &  out) const

MatrixOp& ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::operator= ( const MatrixOp &  m)

void ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::Vp_StMtV ( DVectorSlice *  vs_lhs,
value_type  alpha,
BLAS_Cpp::Transp  trans_rhs1,
const DVectorSlice &  vs_rhs2,
value_type  beta 
) const

(2) vs_lhs = alpha * op(M_rhs1) * vs_rhs2 + beta * vs_lhs (BLAS xGEMV)

void ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::V_InvMtV ( DVectorSlice *  v_lhs,
BLAS_Cpp::Transp  trans_rhs1,
const DVectorSlice &  vs_rhs2 
) const

(1) v_lhs = inv(op(M_rhs1)) * vs_rhs2

FortranTypes::f_int ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::num_nonzeros ( EExtractRegion  extract_region) const

void ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::coor_extract_nonzeros ( EExtractRegion  extract_region,
const FortranTypes::f_int  len_Aval,
FortranTypes::f_dbl_prec  Aval[],
const FortranTypes::f_int  len_Aij,
FortranTypes::f_int  Arow[],
FortranTypes::f_int  Acol[],
const FortranTypes::f_int  row_offset,
const FortranTypes::f_int  col_offset 
) const


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