Ipopt Documentation  
IpPardisoSolverInterface.hpp
Go to the documentation of this file.
1 // Copyright (C) 2004, 2010 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // Authors: Carl Laird, Andreas Waechter IBM 2005-03-17
6 
7 #ifndef __IPPARDISOSOLVERINTERFACE_HPP__
8 #define __IPPARDISOSOLVERINTERFACE_HPP__
9 
10 #include "IpoptConfig.h"
12 #include "IpLibraryLoader.hpp"
13 #include "IpTypes.h"
14 
15 //#define PARDISO_MATCHING_PREPROCESS
16 
17 /* assuming PARDISO 4.0.0 or above */
19 #define IPOPT_DECL_PARDISOINIT(x) void (x)( \
20  void* PT, \
21  const ipindex* MTYPE, \
22  const ipindex* SOLVER, \
23  ipindex* IPARM, \
24  ipnumber* DPARM, \
25  ipindex* E \
26 )
27 
29 #define IPOPT_DECL_PARDISO(x) void (x)( \
30  void** PT, \
31  const ipindex* MAXFCT, \
32  const ipindex* MNUM, \
33  const ipindex* MTYPE, \
34  const ipindex* PHASE, \
35  const ipindex* N, \
36  const ipnumber* A, \
37  const ipindex* IA, \
38  const ipindex* JA, \
39  const ipindex* PERM, \
40  const ipindex* NRHS, \
41  ipindex* IPARM, \
42  const ipindex* MSGLVL, \
43  ipnumber* B, \
44  ipnumber* X, \
45  ipindex* E, \
46  ipnumber* DPARM \
47 )
48 
50 #define IPOPT_DECL_SMAT_REORDERING_PARDISO_WSMP(x) void (x)( \
51  const ipindex* N, \
52  const ipindex* ia, \
53  const ipindex* ja, \
54  const ipnumber* a_, \
55  ipindex* a2, \
56  ipindex* ja2, \
57  ipnumber* a2_, \
58  ipindex* perm2, \
59  ipnumber* scale2, \
60  ipindex* tmp2_, \
61  ipindex preprocess \
62 )
63 
64 namespace Ipopt
65 {
66 
71 {
72 public:
74 
77  SmartPtr<LibraryLoader> pardisoloader_
78  );
79 
81  virtual ~PardisoSolverInterface();
83 
84  bool InitializeImpl(
85  const OptionsList& options,
86  const std::string& prefix
87  );
88 
92  Index dim,
93  Index nonzeros,
94  const Index* ia,
95  const Index* ja
96  );
97 
98  virtual Number* GetValuesArrayPtr();
99 
101  bool new_matrix,
102  const Index* ia,
103  const Index* ja,
104  Index nrhs,
105  Number* rhs_vals,
106  bool check_NegEVals,
107  Index numberOfNegEVals);
108 
109  virtual Index NumberOfNegEVals() const;
111 
112  //* @name Options of Linear solver */
114  virtual bool IncreaseQuality();
115 
116  virtual bool ProvidesInertia() const
117  {
118  return true;
119  }
120 
122  {
123  return CSR_Format_1_Offset;
124  }
126 
128  static void RegisterOptions(
130  );
132 
137  static void SetFunctions(
140  bool isparallel,
141  IPOPT_DECL_SMAT_REORDERING_PARDISO_WSMP(*smat_reordering_pardiso_wsmp)
142 #ifndef PARDISO_MATCHING_PREPROCESS
143  = NULL
144 #endif
145  );
146 
147 private:
155 
158  const PardisoSolverInterface&);
159 
161  void operator=(
162  const PardisoSolverInterface&);
164 
166 
169 
172 
176 
177 #ifdef PARDISO_MATCHING_PREPROCESS
178 
179  Index* ia2;
180  Index* ja2;
181  Number* a2_;
182  Index* perm2;
183  Number* scale2;
184 #endif
185 
187 
191 
193 
196  {
200  };
223 
225 
231 
233 
235  void** PT_;
251 
257 
262 
265 #ifdef PARDISO_MATCHING_PREPROCESS
266  IPOPT_DECL_SMAT_REORDERING_PARDISO_WSMP(*smat_reordering_pardiso_wsmp);
267 #endif
268 
273 
276  const Index* ia,
277  const Index* ja
278  );
279 
282  const Index* ia,
283  const Index* ja,
284  bool check_NegEVals,
285  Index numberOfNegEVals
286  );
287 
290  const Index* ia,
291  const Index* ja,
292  Index nrhs,
293  Number* rhs_vals
294  );
296 };
297 
298 } // namespace Ipopt
299 
300 #endif /* __IPPARDISOSOLVERINTERFACE_HPP__ */
virtual Index NumberOfNegEVals() const
Number of negative eigenvalues detected during last factorization.
Index * IPARM_
Parameter and info array for Pardiso.
#define IPOPT_DECL_PARDISO(x)
bool InitializeImpl(const OptionsList &options, const std::string &prefix)
Implementation of the initialization method that has to be overloaded by for each derived class...
Number * a_
Array for storing the values of the matrix.
ESymSolverStatus
Enum to report outcome of a linear solve.
Base class for interfaces to symmetric indefinite linear solvers for sparse matrices.
Index pardiso_max_droptol_corrections_
Maximal number of decreases of drop tolerance during one solve.
ESymSolverStatus Solve(const Index *ia, const Index *ja, Index nrhs, Number *rhs_vals)
Call Pardiso to do the Solve.
static void RegisterOptions(SmartPtr< RegisteredOptions > roptions)
EMatrixFormat MatrixFormat() const
Query of requested matrix type that the linear solver understands.
bool initialized_
Flag indicating if internal data is initialized.
PardisoMatchingStrategy match_strat_
Option that controls the matching strategy.
PardisoMatchingStrategy
Type for matching strategies.
bool skip_inertia_check_
Flag indicating if the inertia is always assumed to be correct.
ESymSolverStatus SymbolicFactorization(const Index *ia, const Index *ja)
Call Pardiso to do the analysis phase.
Index MAXFCT_
Maximal number of factors with identical nonzero structure.
ipindex Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:20
#define IPOPT_DECL_SMAT_REORDERING_PARDISO_WSMP(x)
virtual ESymSolverStatus MultiSolve(bool new_matrix, const Index *ia, const Index *ja, Index nrhs, Number *rhs_vals, bool check_NegEVals, Index numberOfNegEVals)
Solve operation for multiple right hand sides.
Compressed sparse row format for upper triangular part, with 1 offset.
This file contains a base class for all exceptions and a set of macros to help with exceptions...
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:164
virtual ESymSolverStatus InitializeStructure(Index dim, Index nonzeros, const Index *ia, const Index *ja)
Method for initializing internal structures.
This class stores a list of user set options.
bool pardiso_redo_symbolic_fact_only_if_inertia_wrong_
Flag indicating whether the symbolic factorization should only be done after perturbed elements...
Interface to the linear solver Pardiso as distributed by pardiso-project.org, derived from SparseSymL...
virtual bool ProvidesInertia() const
Query whether inertia is computed by linear solver.
Index negevals_
Number of negative eigenvalues.
Number * DPARM_
Parameter and info array for Pardiso.
#define IPOPT_DECL_PARDISOINIT(x)
void operator=(const PardisoSolverInterface &)
Default Assignment Operator.
bool pardiso_repeated_perturbation_means_singular_
Flag indicating whether repeated perturbed elements even after a new symbolic factorization should be...
ipnumber Number
Type of all numbers.
Definition: IpTypes.hpp:17
bool pardiso_iterative_
Flag indicating whether we are using the iterative solver in Pardiso.
Index MNUM_
Actual matrix for the solution phase.
SmartPtr< LibraryLoader > pardisoloader
Index MTYPE_
Matrix type; real and symmetric indefinite.
EMatrixFormat
Enum to specify sparse matrix format.
PardisoSolverInterface(SmartPtr< LibraryLoader > pardisoloader_)
Constructor.
virtual bool IncreaseQuality()
Request to increase quality of solution for next solve.
void ** PT_
Internal data address pointers.
static void SetFunctions(IPOPT_DECL_PARDISOINIT(*pardisoinit), IPOPT_DECL_PARDISO(*pardiso), bool isparallel,=NULL)
set Pardiso functions to use for every instantiation of this class
ESymSolverStatus Factorization(const Index *ia, const Index *ja, bool check_NegEVals, Index numberOfNegEVals)
Call Pardiso to factorize the Matrix.
Index nonzeros_
Number of nonzeros of the matrix in triplet representation.
virtual Number * GetValuesArrayPtr()
Method returning an internal array into which the nonzero elements (in the same order as ja) will be ...
virtual ~PardisoSolverInterface()
Destructor.
bool have_symbolic_factorization_
Flag indicating if symbolic factorization has already been performed.
Index dim_
Number of rows and columns of the matrix.