Ipopt  3.12.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | List of all members
Ipopt::Ma97SolverInterface Class Reference

Base class for interfaces to symmetric indefinite linear solvers for sparse matrices. More...

#include <IpMa97SolverInterface.hpp>

+ Inheritance diagram for Ipopt::Ma97SolverInterface:

Public Member Functions

 Ma97SolverInterface ()
 
 ~Ma97SolverInterface ()
 
bool InitializeImpl (const OptionsList &options, const std::string &prefix)
 overloaded from AlgorithmStrategyObject More...
 
Methods for requesting solution of the linear system.
ESymSolverStatus InitializeStructure (Index dim, Index nonzeros, const Index *ia, const Index *ja)
 Method for initializing internal stuctures. More...
 
double * GetValuesArrayPtr ()
 Method returing an internal array into which the nonzero elements (in the same order as ja) will be stored by the calling routine before a call to MultiSolve with a new_matrix=true (or after a return of MultiSolve with SYMSOLV_CALL_AGAIN). More...
 
ESymSolverStatus MultiSolve (bool new_matrix, const Index *ia, const Index *ja, Index nrhs, double *rhs_vals, bool check_NegEVals, Index numberOfNegEVals)
 Solve operation for multiple right hand sides. More...
 
Index NumberOfNegEVals () const
 Number of negative eigenvalues detected during last factorization. More...
 
bool IncreaseQuality ()
 Request to increase quality of solution for next solve. More...
 
bool ProvidesInertia () const
 Query whether inertia is computed by linear solver. More...
 
EMatrixFormat MatrixFormat () const
 Query of requested matrix type that the linear solver understands. More...
 
- Public Member Functions inherited from Ipopt::SparseSymLinearSolverInterface
 SparseSymLinearSolverInterface ()
 
virtual ~SparseSymLinearSolverInterface ()
 
- Public Member Functions inherited from Ipopt::AlgorithmStrategyObject
bool Initialize (const Journalist &jnlst, IpoptNLP &ip_nlp, IpoptData &ip_data, IpoptCalculatedQuantities &ip_cq, const OptionsList &options, const std::string &prefix)
 This method is called every time the algorithm starts again - it is used to reset any internal state. More...
 
bool ReducedInitialize (const Journalist &jnlst, const OptionsList &options, const std::string &prefix)
 Reduced version of the Initialize method, which does not require special Ipopt information. More...
 
 AlgorithmStrategyObject ()
 Default Constructor. More...
 
virtual ~AlgorithmStrategyObject ()
 Default Destructor. More...
 
- Public Member Functions inherited from Ipopt::ReferencedObject
 ReferencedObject ()
 
virtual ~ReferencedObject ()
 
Index ReferenceCount () const
 
void AddRef (const Referencer *referencer) const
 
void ReleaseRef (const Referencer *referencer) const
 

Static Public Member Functions

static void RegisterOptions (SmartPtr< RegisteredOptions > roptions)
 

Private Types

enum  order_opts {
  ORDER_AUTO, ORDER_BEST, ORDER_AMD, ORDER_METIS,
  ORDER_MATCHED_AUTO, ORDER_MATCHED_AMD, ORDER_MATCHED_METIS
}
 
enum  scale_opts {
  SWITCH_NEVER, SWITCH_AT_START, SWITCH_AT_START_REUSE, SWITCH_ON_DEMAND,
  SWITCH_ON_DEMAND_REUSE, SWITCH_NDELAY, SWITCH_NDELAY_REUSE, SWITCH_OD_ND,
  SWITCH_OD_ND_REUSE
}
 

Private Attributes

int ndim_
 
double * val_
 
int numneg_
 
int numdelay_
 
void * akeep_
 
void * fkeep_
 
bool pivtol_changed_
 
bool rescale_
 
double * scaling_
 
int fctidx_
 
struct ma97_control control_
 
double umax_
 
int ordering_
 
int scaling_type_
 
enum scale_opts switch_ [3]
 
int scaling_val_ [3]
 
int current_level_
 
bool dump_
 

Methods related to the detection of linearly dependent

rows in a matrix

bool ProvidesDegeneracyDetection () const
 Query whether the indices of linearly dependent rows/columns can be determined by this linear solver. More...
 
ESymSolverStatus DetermineDependentRows (const Index *ia, const Index *ja, std::list< Index > &c_deps)
 This method determines the list of row indices of the linearly dependent rows. More...
 
static int ScaleNameToNum (const std::string &name)
 converts a scalign optoin name to its ma97 option number More...
 

Additional Inherited Members

- Public Types inherited from Ipopt::SparseSymLinearSolverInterface
enum  EMatrixFormat {
  Triplet_Format, CSR_Format_0_Offset, CSR_Format_1_Offset, CSR_Full_Format_0_Offset,
  CSR_Full_Format_1_Offset
}
 Enum to specify sparse matrix format. More...
 
- Protected Member Functions inherited from Ipopt::AlgorithmStrategyObject
const JournalistJnlst () const
 
IpoptNLPIpNLP () const
 
IpoptDataIpData () const
 
IpoptCalculatedQuantitiesIpCq () const
 
bool HaveIpData () const
 

Detailed Description

Base class for interfaces to symmetric indefinite linear solvers for sparse matrices.

This defines the general interface to linear solvers for sparse symmetric indefinite matrices. The matrices can be provided either in "triplet format" (like for Harwell's MA27 solver), or in compressed sparse row (CSR) format for the lower triangular part of the symmetric matrix.

The solver should be able to compute the interia of the matrix, or more specifically, the number of negative eigenvalues in the factorized matrix.

This interface is used by the calling objective in the following way:

  1. The InitializeImpl method is called at the very beginning (for every optimization run), which allows the linear solver object to retrieve options given in the OptionsList (such as pivot tolerances etc). At this point, some internal data can also be initialized.
  2. The calling class calls MatrixFormat to find out which matrix representation the linear solver requires. The possible options are Triplet_Format, as well as CSR_Format_0_Offset and CSR_Format_1_Offset. The difference between the last two is that for CSR_Format_0_Offset the couning of the element position in the ia and ja arrays starts are 0 (C-style numbering), whereas for the other one it starts at 1 (Fortran-style numbering).
  3. After this, the InitializeStructure method is called (once). Here, the structure of the matrix is provided. If the linear solver requires a symbolic preprocessing phase that can be done without knowledge of the matrix element values, it can be done here.
  4. The calling class will request an array for storing the actual values for a matrix using the GetValuesArrayPtr method. This array must be at least as large as the number of nonzeros in the matrix (as given to this class by the InitializeStructure method call). After a call of this method, the calling class will fill this array with the actual values of the matrix.
  5. Every time lateron, when actual solves of a linear system is requested, the calling class will call the MultiSolve to request the solve, possibly for mulitple right-hand sides. The flag new_matrix then indicates if the values of the matrix have changed and if a factorization is required, or if an old factorization can be used to do the solve.

Note that the GetValuesArrayPtr method will be called before every call of MultiSolve with new_matrix=true, or before a renewed call of MultiSolve if the most previous return value was SYMSOLV_CALL_AGAIN.

  1. The calling class might request with NumberOfNegEVals the number of the negative eigenvalues for the original matrix that were detected during the most recently performed factorization.
  2. The calling class might ask the linear solver to increase the quality of the solution. For example, if the linear solver uses a pivot tolerance, a larger value should be used for the next solve (which might require a refactorization).
  3. Finally, when the destructor is called, the internal storage, also in the linear solver, should be released.

Note, if the matrix is given in triplet format, entries might be listed multiple times, in which case the corresponsing elements have to be added.

A note for warm starts: If the option "warm_start_same_structure" is specified with "yes", the algorithm assumes that a problem with the same sparsity structure is solved for a repeated time. In that case, the linear solver might reuse information from the previous optimization. See Ma27TSolverInterface for an example.

Definition at line 104 of file IpMa97SolverInterface.hpp.

Member Enumeration Documentation

Enumerator
ORDER_AUTO 
ORDER_BEST 
ORDER_AMD 
ORDER_METIS 
ORDER_MATCHED_AUTO 
ORDER_MATCHED_AMD 
ORDER_MATCHED_METIS 

Definition at line 107 of file IpMa97SolverInterface.hpp.

Enumerator
SWITCH_NEVER 
SWITCH_AT_START 
SWITCH_AT_START_REUSE 
SWITCH_ON_DEMAND 
SWITCH_ON_DEMAND_REUSE 
SWITCH_NDELAY 
SWITCH_NDELAY_REUSE 
SWITCH_OD_ND 
SWITCH_OD_ND_REUSE 

Definition at line 116 of file IpMa97SolverInterface.hpp.

Constructor & Destructor Documentation

Ipopt::Ma97SolverInterface::Ma97SolverInterface ( )
inline

Definition at line 151 of file IpMa97SolverInterface.hpp.

Ipopt::Ma97SolverInterface::~Ma97SolverInterface ( )

Member Function Documentation

static void Ipopt::Ma97SolverInterface::RegisterOptions ( SmartPtr< RegisteredOptions roptions)
static
bool Ipopt::Ma97SolverInterface::InitializeImpl ( const OptionsList options,
const std::string &  prefix 
)
virtual
ESymSolverStatus Ipopt::Ma97SolverInterface::InitializeStructure ( Index  dim,
Index  nonzeros,
const Index ia,
const Index ja 
)
virtual

Method for initializing internal stuctures.

Here, ndim gives the number of rows and columns of the matrix, nonzeros give the number of nonzero elements, and ia and ja give the positions of the nonzero elements, given in the matrix format determined by MatrixFormat.

Implements Ipopt::SparseSymLinearSolverInterface.

double* Ipopt::Ma97SolverInterface::GetValuesArrayPtr ( )
inlinevirtual

Method returing an internal array into which the nonzero elements (in the same order as ja) will be stored by the calling routine before a call to MultiSolve with a new_matrix=true (or after a return of MultiSolve with SYMSOLV_CALL_AGAIN).

The returned array must have space for at least nonzero elements.

Implements Ipopt::SparseSymLinearSolverInterface.

Definition at line 181 of file IpMa97SolverInterface.hpp.

ESymSolverStatus Ipopt::Ma97SolverInterface::MultiSolve ( bool  new_matrix,
const Index ia,
const Index ja,
Index  nrhs,
double *  rhs_vals,
bool  check_NegEVals,
Index  numberOfNegEVals 
)
virtual

Solve operation for multiple right hand sides.

Solves the linear system A * x = b with multiple right hand sides, where A is the symmtric indefinite matrix. Here, ia and ja give the positions of the values (in the required matrix data format). The actual values of the matrix will have been given to this object by copying them into the array provided by GetValuesArrayPtr. ia and ja are identical to the ones given to InitializeStructure. The flag new_matrix is set to true, if the values of the matrix has changed, and a refactorzation is required.

The return code is SYMSOLV_SUCCESS if the factorization and solves were successful, SYMSOLV_SINGULAR if the linear system is singular, and SYMSOLV_WRONG_INERTIA if check_NegEVals is true and the number of negative eigenvalues in the matrix does not match numberOfNegEVals. If SYMSOLV_CALL_AGAIN is returned, then the calling function will request the pointer for the array for storing a again (with GetValuesPtr), write the values of the nonzero elements into it, and call this MultiSolve method again with the same right-hand sides. (This can be done, for example, if the linear solver realized it does not have sufficient memory and needs to redo the factorization; e.g., for MA27.)

The number of right-hand sides is given by nrhs, the values of the right-hand sides are given in rhs_vals (one full right-hand side stored immediately after the other), and solutions are to be returned in the same array.

check_NegEVals will not be chosen true, if ProvidesInertia() returns false.

Implements Ipopt::SparseSymLinearSolverInterface.

Index Ipopt::Ma97SolverInterface::NumberOfNegEVals ( ) const
inlinevirtual

Number of negative eigenvalues detected during last factorization.

Returns the number of negative eigenvalues of the most recent factorized matrix. This must not be called if the linear solver does not compute this quantities (see ProvidesInertia).

Implements Ipopt::SparseSymLinearSolverInterface.

Definition at line 232 of file IpMa97SolverInterface.hpp.

bool Ipopt::Ma97SolverInterface::IncreaseQuality ( )
virtual

Request to increase quality of solution for next solve.

The calling class asks linear solver to increase quality of solution for the next solve (e.g. increase pivot tolerance). Returns false, if this is not possible (e.g. maximal pivot tolerance already used.)

Implements Ipopt::SparseSymLinearSolverInterface.

bool Ipopt::Ma97SolverInterface::ProvidesInertia ( ) const
inlinevirtual

Query whether inertia is computed by linear solver.

Returns true, if linear solver provides inertia.

Implements Ipopt::SparseSymLinearSolverInterface.

Definition at line 251 of file IpMa97SolverInterface.hpp.

EMatrixFormat Ipopt::Ma97SolverInterface::MatrixFormat ( ) const
inlinevirtual

Query of requested matrix type that the linear solver understands.

Implements Ipopt::SparseSymLinearSolverInterface.

Definition at line 259 of file IpMa97SolverInterface.hpp.

bool Ipopt::Ma97SolverInterface::ProvidesDegeneracyDetection ( ) const
inlinevirtual

Query whether the indices of linearly dependent rows/columns can be determined by this linear solver.

Reimplemented from Ipopt::SparseSymLinearSolverInterface.

Definition at line 270 of file IpMa97SolverInterface.hpp.

ESymSolverStatus Ipopt::Ma97SolverInterface::DetermineDependentRows ( const Index ia,
const Index ja,
std::list< Index > &  c_deps 
)
inlinevirtual

This method determines the list of row indices of the linearly dependent rows.

Reimplemented from Ipopt::SparseSymLinearSolverInterface.

Definition at line 276 of file IpMa97SolverInterface.hpp.

static int Ipopt::Ma97SolverInterface::ScaleNameToNum ( const std::string &  name)
static

converts a scalign optoin name to its ma97 option number

Member Data Documentation

int Ipopt::Ma97SolverInterface::ndim_
private

Definition at line 128 of file IpMa97SolverInterface.hpp.

double* Ipopt::Ma97SolverInterface::val_
private

Definition at line 129 of file IpMa97SolverInterface.hpp.

int Ipopt::Ma97SolverInterface::numneg_
private

Definition at line 130 of file IpMa97SolverInterface.hpp.

int Ipopt::Ma97SolverInterface::numdelay_
private

Definition at line 131 of file IpMa97SolverInterface.hpp.

void* Ipopt::Ma97SolverInterface::akeep_
private

Definition at line 132 of file IpMa97SolverInterface.hpp.

void* Ipopt::Ma97SolverInterface::fkeep_
private

Definition at line 133 of file IpMa97SolverInterface.hpp.

bool Ipopt::Ma97SolverInterface::pivtol_changed_
private

Definition at line 134 of file IpMa97SolverInterface.hpp.

bool Ipopt::Ma97SolverInterface::rescale_
private

Definition at line 135 of file IpMa97SolverInterface.hpp.

double* Ipopt::Ma97SolverInterface::scaling_
private

Definition at line 136 of file IpMa97SolverInterface.hpp.

int Ipopt::Ma97SolverInterface::fctidx_
private

Definition at line 137 of file IpMa97SolverInterface.hpp.

struct ma97_control Ipopt::Ma97SolverInterface::control_
private

Definition at line 140 of file IpMa97SolverInterface.hpp.

double Ipopt::Ma97SolverInterface::umax_
private

Definition at line 141 of file IpMa97SolverInterface.hpp.

int Ipopt::Ma97SolverInterface::ordering_
private

Definition at line 142 of file IpMa97SolverInterface.hpp.

int Ipopt::Ma97SolverInterface::scaling_type_
private

Definition at line 143 of file IpMa97SolverInterface.hpp.

enum scale_opts Ipopt::Ma97SolverInterface::switch_[3]
private

Definition at line 144 of file IpMa97SolverInterface.hpp.

int Ipopt::Ma97SolverInterface::scaling_val_[3]
private

Definition at line 145 of file IpMa97SolverInterface.hpp.

int Ipopt::Ma97SolverInterface::current_level_
private

Definition at line 146 of file IpMa97SolverInterface.hpp.

bool Ipopt::Ma97SolverInterface::dump_
private

Definition at line 147 of file IpMa97SolverInterface.hpp.


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