ConstrainedOptPack::MatrixKKTFullSpaceRelaxed Class Reference

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

#include <ConstrainedOptPack_MatrixKKTFullSpaceRelaxed.hpp>

List of all members.

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.
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.
void set_uninitialized ()
 Set the matrix to uninitialized.
void release_memory ()
 Clear all allocated storage.

Public Types

typedef AbstractLinAlgPack::DirectSparseFortranCompatibleSolver DirectSparseFortranCompatibleSolver
 
 RUN_TESTS
 NO_TESTS
 PRINT_MORE
 PRINT_LESS
enum  ERunTests { RUN_TESTS, NO_TESTS }
  More...
enum  EPrintMoreOrLess { PRINT_MORE, PRINT_LESS }
  More...

Public Member Functions

 STANDARD_COMPOSITION_MEMBERS (DirectSparseFortranCompatibleSolver, direct_solver)
 <<std comp>="">> members for the direct sparse linear solver
 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)
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
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
 

Private Member Functions

void assert_matrices_set () const
 
void assert_initialized () const
 
void validate_and_set_matrices (const MatrixOp &G, const MatrixOp &A)
 Validate the types and sizes of G and A, set the member pointers G_ and A_ and return the conversion interfaces convG and convA.

Private Attributes

bool initialized_
size_type n_
size_type m_
bool use_relaxation_
value_type bigM_
EPrintMoreOrLess print_what_
ERunTests test_what_
std::ostream * out_
const MatrixOp * G_
const MatrixConvertToSparseFortranCompatible * convG_
size_type G_nz_
const MatrixOp * A_
const MatrixConvertToSparseFortranCompatible * convA_
size_type A_nz_

Classes

class  InvalidMatrixType
  More...
class  NotInitializedException
  More...
class  SingularMatrixException
  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 81 of file ConstrainedOptPack_MatrixKKTFullSpaceRelaxed.hpp.


Member Typedef Documentation

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

Definition at line 89 of file ConstrainedOptPack_MatrixKKTFullSpaceRelaxed.hpp.


Member Enumeration Documentation

enum ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::ERunTests

Enumerator:
RUN_TESTS 
NO_TESTS 

Definition at line 104 of file ConstrainedOptPack_MatrixKKTFullSpaceRelaxed.hpp.

enum ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::EPrintMoreOrLess

Enumerator:
PRINT_MORE 
PRINT_LESS 

Definition at line 107 of file ConstrainedOptPack_MatrixKKTFullSpaceRelaxed.hpp.


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

void ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::assert_matrices_set (  )  const [private]

void ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::assert_initialized (  )  const [private]

void ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::validate_and_set_matrices ( const MatrixOp &  G,
const MatrixOp &  A 
) [private]

Validate the types and sizes of G and A, set the member pointers G_ and A_ and return the conversion interfaces convG and convA.


Member Data Documentation

bool ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::initialized_ [private]

Definition at line 243 of file ConstrainedOptPack_MatrixKKTFullSpaceRelaxed.hpp.

size_type ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::n_ [private]

Definition at line 244 of file ConstrainedOptPack_MatrixKKTFullSpaceRelaxed.hpp.

size_type ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::m_ [private]

Definition at line 245 of file ConstrainedOptPack_MatrixKKTFullSpaceRelaxed.hpp.

bool ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::use_relaxation_ [private]

Definition at line 246 of file ConstrainedOptPack_MatrixKKTFullSpaceRelaxed.hpp.

value_type ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::bigM_ [private]

Definition at line 247 of file ConstrainedOptPack_MatrixKKTFullSpaceRelaxed.hpp.

EPrintMoreOrLess ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::print_what_ [private]

Definition at line 248 of file ConstrainedOptPack_MatrixKKTFullSpaceRelaxed.hpp.

ERunTests ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::test_what_ [private]

Definition at line 249 of file ConstrainedOptPack_MatrixKKTFullSpaceRelaxed.hpp.

std::ostream* ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::out_ [private]

Definition at line 250 of file ConstrainedOptPack_MatrixKKTFullSpaceRelaxed.hpp.

const MatrixOp* ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::G_ [private]

Definition at line 251 of file ConstrainedOptPack_MatrixKKTFullSpaceRelaxed.hpp.

const MatrixConvertToSparseFortranCompatible* ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::convG_ [private]

Definition at line 253 of file ConstrainedOptPack_MatrixKKTFullSpaceRelaxed.hpp.

size_type ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::G_nz_ [private]

Definition at line 254 of file ConstrainedOptPack_MatrixKKTFullSpaceRelaxed.hpp.

const MatrixOp* ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::A_ [private]

Definition at line 255 of file ConstrainedOptPack_MatrixKKTFullSpaceRelaxed.hpp.

const MatrixConvertToSparseFortranCompatible* ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::convA_ [private]

Definition at line 257 of file ConstrainedOptPack_MatrixKKTFullSpaceRelaxed.hpp.

size_type ConstrainedOptPack::MatrixKKTFullSpaceRelaxed::A_nz_ [private]

Definition at line 258 of file ConstrainedOptPack_MatrixKKTFullSpaceRelaxed.hpp.


The documentation for this class was generated from the following file:
Generated on Wed May 12 21:57:14 2010 for MOOCHO (Single Doxygen Collection) by  doxygen 1.4.7