Ipopt Documentation  
IpMa57TSolverInterface.hpp
Go to the documentation of this file.
1 // Copyright (C) 2005, 2006 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // Authors: Michael Hagemann Univ of Basel 2005-10-28
6 // original version (based on MA27TSolverInterface.hpp)
7 
8 #ifndef __IPMA57TSOLVERINTERFACE_HPP__
9 #define __IPMA57TSOLVERINTERFACE_HPP__
10 
12 #include "IpLibraryLoader.hpp"
13 #include "IpTypes.h"
14 
15 #ifdef FUNNY_MA57_FINT
16 #include <cstddef>
17 typedef ptrdiff_t ma57int;
18 #else
19 #include "IpTypes.h"
20 typedef ipindex ma57int;
21 #endif
22 
24 #define IPOPT_DECL_MA57A(x) void (x)( \
25  ipindex* n, \
26  ipindex* ne, \
27  const ipindex* irn, \
28  const ipindex* jcn, \
29  ipindex* lkeep, \
30  ipindex* keep, \
31  /* Automatically iflag = 0; ikeep pivot order iflag = 1 */ \
32  ipindex* iwork, \
33  ipindex* icntl, \
34  ipindex* info, \
35  ipnumber* rinfo \
36 )
37 
39 #define IPOPT_DECL_MA57B(x) void (x)( \
40  ipindex* n, \
41  ipindex* ne, \
42  ipnumber* a, \
43  ipnumber* fact, \
44  ipindex* lfact, \
45  ipindex* ifact, \
46  ipindex* lifact, \
47  ipindex* lkeep, \
48  ipindex* keep, \
49  ipindex* iwork, \
50  ipindex* icntl, \
51  ipnumber* cntl, \
52  ipindex* info, \
53  ipnumber* rinfo \
54 )
55 
56 /* Solution job: Solve for...
57  * - JOB <= 1: A
58  * - JOB == 2: PLP^t
59  * - JOB == 3: PDP^t
60  * - JOB >= 4: PL^t P^t
61  */
63 #define IPOPT_DECL_MA57C(x) void (x)( \
64  ipindex* job, \
65  ipindex* n, \
66  ipnumber* fact, \
67  ipindex* lfact, \
68  ipindex* ifact, \
69  ipindex* lifact, \
70  ipindex* nrhs, \
71  ipnumber* rhs, \
72  ipindex* lrhs, \
73  ipnumber* work, \
74  ipindex* lwork, \
75  ipindex* iwork, \
76  ipindex* icntl, \
77  ipindex* info \
78 )
79 
81 #define IPOPT_DECL_MA57E(x) void (x)( \
82  ipindex* n, \
83  ipindex* ic, \
84  ipindex* keep, \
85  ipnumber* fact, \
86  ipindex* lfact, \
87  ipnumber* newfac, \
88  ipindex* lnew, \
89  ipindex* ifact, \
90  ipindex* lifact, \
91  ipindex* newifc, \
92  ipindex* linew, \
93  ipindex* info \
94 )
95 
97 #define IPOPT_DECL_MA57I(x) void (x)( \
98  ipnumber* cntl, \
99  ipindex* icntl \
100 )
101 
102 namespace Ipopt
103 {
108 {
109 public:
112 
114  SmartPtr<LibraryLoader> hslloader_
115  );
116 
120 
122  const OptionsList& options,
123  const std::string& prefix
124  );
125 
129  Index dim,
130  Index nonzeros,
131  const Index* airn,
132  const Index* ajcn
133  );
134 
136 
138  bool new_matrix,
139  const Index* airn,
140  const Index* ajcn,
141  Index nrhs,
142  Number* rhs_vals,
143  bool check_NegEVals,
144  Index numberOfNegEVals
145  );
146 
147  virtual Index NumberOfNegEVals() const;
149 
150  //* @name Options of Linear solver */
152  virtual bool IncreaseQuality();
153 
154  virtual bool ProvidesInertia() const
155  {
156  return true;
157  }
158 
160  {
161  return Triplet_Format;
162  }
164 
166  static void RegisterOptions(
168  );
170 
173  static void SetFunctions(
179  );
180 
181 private:
190 
192  const Ma57TSolverInterface&
193  );
194 
196  void operator=(
197  const Ma57TSolverInterface&
198  );
200 
205 
217 
220 
222 
226 
229 
232 
235 
250 
253 
264 
271 
274 
275  ma57int wd_lkeep_; /* LKEEP >= 5*N + NE + max(N,NE) + 42. */
277 
278  ma57int* wd_iwork_; /* 5 * N. */
279 
284 
288 
291 
297  const Index* airn,
298  const Index* ajcn
299  );
300 
307  const Index* airn,
308  const Index* ajcn,
309  bool check_NegEVals,
310  Index numberOfNegEVals
311  );
312 
315  Index nrhs,
316  Number* rhs_vals
317  );
319 };
320 
321 } // namespace Ipopt
322 #endif
#define IPOPT_DECL_MA57B(x)
#define IPOPT_DECL_MA57E(x)
#define IPOPT_DECL_MA57I(x)
#define IPOPT_DECL_MA57C(x)
ipindex ma57int
#define IPOPT_DECL_MA57A(x)
int ipindex
Type of all indices of vectors, matrices etc.
Definition: IpTypes.h:68
Interface to the symmetric linear solver MA57, derived from SparseSymLinearSolverInterface.
Number ma57_pre_alloc_
Factor for estimating initial size of work arrays.
static void RegisterOptions(SmartPtr< RegisteredOptions > roptions)
virtual bool IncreaseQuality()
Request to increase quality of solution for next solve.
Index negevals_
Number of negative eigenvalues.
virtual bool ProvidesInertia() const
Query whether inertia is computed by linear solver.
virtual ESymSolverStatus InitializeStructure(Index dim, Index nonzeros, const Index *airn, const Index *ajcn)
Method for initializing internal structures.
IPOPT_DECL_MA57C * ma57c
solution
virtual Index NumberOfNegEVals() const
Number of negative eigenvalues detected during last factorization.
static void SetFunctions(IPOPT_DECL_MA57A(*ma57a), IPOPT_DECL_MA57B(*ma57b), IPOPT_DECL_MA57C(*ma57c), IPOPT_DECL_MA57E(*ma57e),)
set MA57 functions to use for every instantiation of this class
Index nonzeros_
Number of nonzeros of the matrix.
ESymSolverStatus Factorization(const Index *airn, const Index *ajcn, bool check_NegEVals, Index numberOfNegEVals)
Call MA57BX to factorize the Matrix.
virtual Number * GetValuesArrayPtr()
Method returning an internal array into which the nonzero elements (in the same order as ja) will be ...
IPOPT_DECL_MA57E * ma57e
copy arrays
ESymSolverStatus SymbolicFactorization(const Index *airn, const Index *ajcn)
Call MA57AX and reserve memory for MA57 data.
void operator=(const Ma57TSolverInterface &)
Default Assignment Operator.
bool InitializeImpl(const OptionsList &options, const std::string &prefix)
Implementation of the initialization method that has to be overloaded by for each derived class.
bool initialized_
Flag indicating if internal data is initialized.
bool refactorize_
Flag that is true if we just requested the values of the matrix again (SYMSOLVER_CALL_AGAIN) and have...
Ma57TSolverInterface(const Ma57TSolverInterface &)
Copy Constructor.
bool pivtol_changed_
Flag indicating if the matrix has to be refactorized because the pivot tolerance has been changed.
Ma57TSolverInterface(SmartPtr< LibraryLoader > hslloader_)
Constructor.
Number pivtolmax_
Maximal pivot tolerance.
IPOPT_DECL_MA57I * ma57i
initialize solver
Number * a_
factor A of matrix
EMatrixFormat MatrixFormat() const
Query of requested matrix type that the linear solver understands.
bool warm_start_same_structure_
Flag indicating whether the TNLP with identical structure has already been solved before.
IPOPT_DECL_MA57A * ma57a
symbolic factorization
SmartPtr< LibraryLoader > hslloader
IPOPT_DECL_MA57B * ma57b
numerical factorization
virtual ESymSolverStatus MultiSolve(bool new_matrix, const Index *airn, const Index *ajcn, Index nrhs, Number *rhs_vals, bool check_NegEVals, Index numberOfNegEVals)
Solve operation for multiple right hand sides.
virtual ~Ma57TSolverInterface()
Destructor.
Index dim_
Number of rows and columns of the matrix.
ESymSolverStatus Backsolve(Index nrhs, Number *rhs_vals)
Call MA57CX to do the backsolve.
This class stores a list of user set options.
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:165
Base class for interfaces to symmetric indefinite linear solvers for sparse matrices.
EMatrixFormat
Enum to specify sparse matrix format.
@ Triplet_Format
Triplet (MA27) format for lower triangular part.
This file contains a base class for all exceptions and a set of macros to help with exceptions.
ESymSolverStatus
Enum to report outcome of a linear solve.
ipindex Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:20
ipnumber Number
Type of all numbers.
Definition: IpTypes.hpp:17