mlpack  2.2.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | List of all members
SDP< ObjectiveMatrixType > Class Template Reference

Specify an SDP in primal form. More...

Inheritance diagram for SDP< ObjectiveMatrixType >:
Inheritance graph
[legend]

Public Types

typedef ObjectiveMatrixType objective_matrix_type
 

Public Member Functions

 SDP ()
 Initialize this SDP to an empty state. More...
 
 SDP (const size_t n, const size_t numSparseConstraints, const size_t numDenseConstraints)
 Initialize this SDP to one which structurally has size n. More...
 
ObjectiveMatrixType & C ()
 Modify the sparse objective function matrix (sparseC). More...
 
const ObjectiveMatrixType & C () const
 Return the sparse objective function matrix (sparseC). More...
 
const std::vector< arma::mat > & DenseA () const
 Return the vector of dense A matrices (which correspond to the dense constraints). More...
 
std::vector< arma::mat > & DenseA ()
 Modify the veector of dense A matrices (which correspond to the dense constraints). More...
 
const arma::vec & DenseB () const
 Return the vector of dense B values. More...
 
arma::vec & DenseB ()
 Modify the vector of dense B values. More...
 
bool HasLinearlyIndependentConstraints () const
 Check whether or not the constraint matrices are linearly independent. More...
 
size_t N () const
 Return number of rows and columns in the objective matrix C. More...
 
size_t N2bar () const
 
size_t NumConstraints () const
 Return the total number of constraints in the SDP. More...
 
size_t NumDenseConstraints () const
 Return the number of dense constraints (constraints with dense Ai) in the SDP. More...
 
size_t NumSparseConstraints () const
 Return the number of sparse constraints (constraints with sparse Ai) in the SDP. More...
 
const std::vector< arma::sp_mat > & SparseA () const
 Return the vector of sparse A matrices (which correspond to the sparse constraints). More...
 
std::vector< arma::sp_mat > & SparseA ()
 Modify the veector of sparse A matrices (which correspond to the sparse constraints). More...
 
const arma::vec & SparseB () const
 Return the vector of sparse B values. More...
 
arma::vec & SparseB ()
 Modify the vector of sparse B values. More...
 

Detailed Description

template<typename ObjectiveMatrixType>
class mlpack::optimization::SDP< ObjectiveMatrixType >

Specify an SDP in primal form.

min    dot(C, X)
s.t.   dot(Ai, X) = bi, i=1,...,m, X >= 0

This representation allows the constraint matrices Ai to be specified as either dense matrices (arma::mat) or sparse matrices (arma::sp_mat). After initializing the SDP object, you will need to set the constraints yourself, via the SparseA(), SparseB(), DenseA(), DenseB(), and C() functions. Note that for each matrix you add to either SparseA() or DenseA(), you must add the corresponding b value to the corresponding vector SparseB() or DenseB().

The objective matrix (C) may be stored as either dense or sparse depending on the ObjectiveMatrixType parameter.

Template Parameters
ObjectiveMatrixTypeShould be either arma::mat or arma::sp_mat.

Definition at line 39 of file sdp.hpp.

Member Typedef Documentation

typedef ObjectiveMatrixType objective_matrix_type

Definition at line 43 of file sdp.hpp.

Constructor & Destructor Documentation

SDP ( )

Initialize this SDP to an empty state.

To add constraints, you will have to modify the constraints via the SparseA(), DenseA(), SparseB(), DenseB(), and C() functions. For the sake of speed, there is no error checking, so if you specify an invalid SDP, whatever solver you use will gladly try to solve it! (And it will probably crash horribly.)

Referenced by LRSDP< optimization::SDP< arma::sp_mat > >::SDP().

SDP ( const size_t  n,
const size_t  numSparseConstraints,
const size_t  numDenseConstraints 
)

Initialize this SDP to one which structurally has size n.

To set the constraints you will still need to access through SparseA(), DenseA(), SparseB(), DenseB(), and C(). Consider using move semantics to keep things fast. As with the previous constructor, there is no error checking for the sake of speed, so if you build an invalid SDP, whatever solver you use will gladly try to solve it! (And it will probably crash horribly.)

Parameters
nNumber of rows (and columns) in the objective matrix C.
numSparseConstraintsNumber of sparse constraints.
numDenseConstraintsNumber of dense constraints.

Member Function Documentation

ObjectiveMatrixType& C ( )
inline

Modify the sparse objective function matrix (sparseC).

Definition at line 86 of file sdp.hpp.

const ObjectiveMatrixType& C ( ) const
inline

Return the sparse objective function matrix (sparseC).

Definition at line 88 of file sdp.hpp.

const std::vector<arma::mat>& DenseA ( ) const
inline

Return the vector of dense A matrices (which correspond to the dense constraints).

Definition at line 100 of file sdp.hpp.

std::vector<arma::mat>& DenseA ( )
inline

Modify the veector of dense A matrices (which correspond to the dense constraints).

Definition at line 104 of file sdp.hpp.

const arma::vec& DenseB ( ) const
inline

Return the vector of dense B values.

Definition at line 112 of file sdp.hpp.

arma::vec& DenseB ( )
inline

Modify the vector of dense B values.

Definition at line 114 of file sdp.hpp.

bool HasLinearlyIndependentConstraints ( ) const

Check whether or not the constraint matrices are linearly independent.

Warning: possibly very expensive check.

size_t N ( ) const
inline

Return number of rows and columns in the objective matrix C.

Definition at line 71 of file sdp.hpp.

Referenced by SDP< arma::sp_mat >::N2bar().

size_t N2bar ( ) const
inline

Definition at line 73 of file sdp.hpp.

size_t NumConstraints ( ) const
inline

Return the total number of constraints in the SDP.

Definition at line 83 of file sdp.hpp.

size_t NumDenseConstraints ( ) const
inline

Return the number of dense constraints (constraints with dense Ai) in the SDP.

Definition at line 80 of file sdp.hpp.

size_t NumSparseConstraints ( ) const
inline

Return the number of sparse constraints (constraints with sparse Ai) in the SDP.

Definition at line 77 of file sdp.hpp.

const std::vector<arma::sp_mat>& SparseA ( ) const
inline

Return the vector of sparse A matrices (which correspond to the sparse constraints).

Definition at line 92 of file sdp.hpp.

std::vector<arma::sp_mat>& SparseA ( )
inline

Modify the veector of sparse A matrices (which correspond to the sparse constraints).

Definition at line 96 of file sdp.hpp.

const arma::vec& SparseB ( ) const
inline

Return the vector of sparse B values.

Definition at line 107 of file sdp.hpp.

arma::vec& SparseB ( )
inline

Modify the vector of sparse B values.

Definition at line 109 of file sdp.hpp.


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