mlpack  git-master
SDP< ObjectiveMatrixType > Class Template Reference

Specify an SDP in primal form. More...

Inheritance diagram for SDP< ObjectiveMatrixType >:

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 vector 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 vector 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

◆ objective_matrix_type

typedef ObjectiveMatrixType objective_matrix_type

Definition at line 42 of file sdp.hpp.

Constructor & Destructor Documentation

◆ SDP() [1/2]

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< mlpack::optimization::SDP< arma::sp_mat > >::SDP().

◆ SDP() [2/2]

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

◆ C() [1/2]

ObjectiveMatrixType& C ( )
inline

Modify the sparse objective function matrix (sparseC).

Definition at line 85 of file sdp.hpp.

◆ C() [2/2]

const ObjectiveMatrixType& C ( ) const
inline

Return the sparse objective function matrix (sparseC).

Definition at line 87 of file sdp.hpp.

◆ DenseA() [1/2]

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

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

Definition at line 99 of file sdp.hpp.

◆ DenseA() [2/2]

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

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

Definition at line 103 of file sdp.hpp.

◆ DenseB() [1/2]

const arma::vec& DenseB ( ) const
inline

Return the vector of dense B values.

Definition at line 111 of file sdp.hpp.

◆ DenseB() [2/2]

arma::vec& DenseB ( )
inline

Modify the vector of dense B values.

Definition at line 113 of file sdp.hpp.

◆ HasLinearlyIndependentConstraints()

bool HasLinearlyIndependentConstraints ( ) const

Check whether or not the constraint matrices are linearly independent.

Warning: possibly very expensive check.

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

◆ N()

size_t N ( ) const
inline

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

Definition at line 70 of file sdp.hpp.

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

◆ N2bar()

size_t N2bar ( ) const
inline

Definition at line 72 of file sdp.hpp.

◆ NumConstraints()

size_t NumConstraints ( ) const
inline

Return the total number of constraints in the SDP.

Definition at line 82 of file sdp.hpp.

◆ NumDenseConstraints()

size_t NumDenseConstraints ( ) const
inline

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

Definition at line 79 of file sdp.hpp.

◆ NumSparseConstraints()

size_t NumSparseConstraints ( ) const
inline

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

Definition at line 76 of file sdp.hpp.

◆ SparseA() [1/2]

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 91 of file sdp.hpp.

◆ SparseA() [2/2]

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

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

Definition at line 95 of file sdp.hpp.

◆ SparseB() [1/2]

const arma::vec& SparseB ( ) const
inline

Return the vector of sparse B values.

Definition at line 106 of file sdp.hpp.

◆ SparseB() [2/2]

arma::vec& SparseB ( )
inline

Modify the vector of sparse B values.

Definition at line 108 of file sdp.hpp.


The documentation for this class was generated from the following file:
  • src/mlpack/core/optimizers/sdp/sdp.hpp