Ipopt Documentation  
 
Loading...
Searching...
No Matches
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
64namespace Ipopt
65{
66
71{
72public:
75
77 SmartPtr<LibraryLoader> pardisoloader_
78 );
79
83
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
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
147private:
156
159
164
167
169
172
176
177#ifdef PARDISO_MATCHING_PREPROCESS
179 Index* ia2;
180 Index* ja2;
181 Number* a2_;
182 Index* perm2;
183 Number* scale2;
184#endif
185
188
191
194
223
226
231
234
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
274
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__ */
#define IPOPT_DECL_SMAT_REORDERING_PARDISO_WSMP(x)
#define IPOPT_DECL_PARDISO(x)
#define IPOPT_DECL_PARDISOINIT(x)
This class stores a list of user set options.
Interface to the linear solver Pardiso as distributed by pardiso-project.org, derived from SparseSymL...
Number * a_
Array for storing the values of the matrix.
static void RegisterOptions(SmartPtr< RegisteredOptions > roptions)
virtual bool IncreaseQuality()
Request to increase quality of solution for next solve.
PardisoSolverInterface(SmartPtr< LibraryLoader > pardisoloader_)
Constructor.
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
PardisoSolverInterface(const PardisoSolverInterface &)
Copy Constructor.
virtual ESymSolverStatus InitializeStructure(Index dim, Index nonzeros, const Index *ia, const Index *ja)
Method for initializing internal structures.
bool have_symbolic_factorization_
Flag indicating if symbolic factorization has already been performed.
Index nonzeros_
Number of nonzeros of the matrix in triplet representation.
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.
PardisoMatchingStrategy match_strat_
Option that controls the matching strategy.
Index pardiso_max_droptol_corrections_
Maximal number of decreases of drop tolerance during one solve.
Number * DPARM_
Parameter and info array for Pardiso.
bool pardiso_iterative_
Flag indicating whether we are using the iterative solver in Pardiso.
Index negevals_
Number of negative eigenvalues.
bool skip_inertia_check_
Flag indicating if the inertia is always assumed to be correct.
bool pardiso_repeated_perturbation_means_singular_
Flag indicating whether repeated perturbed elements even after a new symbolic factorization should be...
ESymSolverStatus Factorization(const Index *ia, const Index *ja, bool check_NegEVals, Index numberOfNegEVals)
Call Pardiso to factorize the Matrix.
ESymSolverStatus Solve(const Index *ia, const Index *ja, Index nrhs, Number *rhs_vals)
Call Pardiso to do the Solve.
virtual Number * GetValuesArrayPtr()
Method returning an internal array into which the nonzero elements (in the same order as ja) will be ...
void operator=(const PardisoSolverInterface &)
Default Assignment Operator.
ESymSolverStatus SymbolicFactorization(const Index *ia, const Index *ja)
Call Pardiso to do the analysis phase.
bool pardiso_redo_symbolic_fact_only_if_inertia_wrong_
Flag indicating whether the symbolic factorization should only be done after perturbed elements,...
Index MTYPE_
Matrix type; real and symmetric indefinite.
Index dim_
Number of rows and columns of the matrix.
virtual bool ProvidesInertia() const
Query whether inertia is computed by linear solver.
EMatrixFormat MatrixFormat() const
Query of requested matrix type that the linear solver understands.
bool initialized_
Flag indicating if internal data is initialized.
virtual ~PardisoSolverInterface()
Destructor.
bool InitializeImpl(const OptionsList &options, const std::string &prefix)
Implementation of the initialization method that has to be overloaded by for each derived class.
PardisoMatchingStrategy
Type for matching strategies.
void ** PT_
Internal data address pointers.
virtual Index NumberOfNegEVals() const
Number of negative eigenvalues detected during last factorization.
Index * IPARM_
Parameter and info array for Pardiso.
Index MNUM_
Actual matrix for the solution phase.
Index MAXFCT_
Maximal number of factors with identical nonzero structure.
Template class for Smart Pointers.
Base class for interfaces to symmetric indefinite linear solvers for sparse matrices.
@ CSR_Format_1_Offset
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.
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