Ipopt 3.12.10

- Main Page
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IpMa97SolverInterface.hpp
Go to the documentation of this file.
1 // Copyright (C) 2012, The Science and Technology Facilities Council (STFC)
2 // Copyright (C) 2009, Jonathan Hogg <jdh41.at.cantab.net>
3 // Copyright (C) 2004, 2007 International Business Machines and others.
4 // All Rights Reserved.
5 // This code is published under the Eclipse Public License.
6 //
7 // $Id: IpMa97SolverInterface.hpp 2001 2011-06-02 17:43:07Z andreasw $
8 //
9 // Authors: Jonathan Hogg STFC 2012-12-21
10 // Jonathan Hogg 2009-07-29
11 // Carl Laird, Andreas Waechter IBM 2004-03-17
12
13 #ifndef __IPMA97SOLVERINTERFACE_HPP__
14 #define __IPMA97SOLVERINTERFACE_HPP__
15
16 #include "IpSparseSymLinearSolverInterface.hpp"
17 extern "C"
18 {
19 #include "hsl_ma97d.h"
20 }
21
22 namespace Ipopt
23 {
24
104 class Ma97SolverInterface: public SparseSymLinearSolverInterface
105 {
106 private:
107 enum order_opts {
108 ORDER_AUTO,
109 ORDER_BEST,
110 ORDER_AMD,
111 ORDER_METIS,
112 ORDER_MATCHED_AUTO,
113 ORDER_MATCHED_AMD,
114 ORDER_MATCHED_METIS
115 };
116 enum scale_opts {
117 SWITCH_NEVER,
118 SWITCH_AT_START,
119 SWITCH_AT_START_REUSE,
120 SWITCH_ON_DEMAND,
121 SWITCH_ON_DEMAND_REUSE,
122 SWITCH_NDELAY,
123 SWITCH_NDELAY_REUSE,
124 SWITCH_OD_ND,
125 SWITCH_OD_ND_REUSE
126 };
127
128 int ndim_; // Number of dimensions
129 double *val_; // Storage for variables
130 int numneg_; // Number of negative pivots in last factorization
131 int numdelay_; // Number of delayed pivots last time we scaled
132 void *akeep_; // Stores pointer to factors (only understood Fortran code!)
133 void *fkeep_; // Stores pointer to factors (only understood Fortran code!)
134 bool pivtol_changed_; // indicates if pivtol has been changed
135 bool rescale_; // Indicates if we shuold rescale next factorization
136 double *scaling_; // Store scaling for reuse if doing dynamic scaling
137 int fctidx_; // Current factorization number to dump to
138
139 /* Options */
140 struct ma97_control control_;
141 double umax_;
142 int ordering_;
143 int scaling_type_;
144 enum scale_opts switch_[3];
145 int scaling_val_[3];
146 int current_level_;
147 bool dump_;
148
149 public:
150
151 Ma97SolverInterface() :
152 val_(NULL), numdelay_(0), akeep_(NULL), fkeep_(NULL), pivtol_changed_(false),
153 rescale_(false), scaling_(NULL), fctidx_(0), scaling_type_(0),
154 dump_(false)
155 {}
156 ~Ma97SolverInterface();
157
158 static void RegisterOptions(SmartPtr<RegisteredOptions> roptions);
159
160 bool InitializeImpl(const OptionsList& options,
161 const std::string& prefix);
162
171 ESymSolverStatus InitializeStructure(Index dim, Index nonzeros,
172 const Index* ia,
173 const Index* ja);
174
181 double* GetValuesArrayPtr()
182 {
183 return val_;
184 }
185
218 ESymSolverStatus MultiSolve(bool new_matrix,
219 const Index* ia,
220 const Index* ja,
221 Index nrhs,
222 double* rhs_vals,
223 bool check_NegEVals,
224 Index numberOfNegEVals);
225
232 Index NumberOfNegEVals() const
233 {
234 return numneg_;
235 }
237
238 //* @name Options of Linear solver */
240
246 bool IncreaseQuality();
247
251 bool ProvidesInertia() const
252 {
253 return true;
254 }
255
259 EMatrixFormat MatrixFormat() const
260 {
261 return CSR_Format_1_Offset;
262 }
264
270 bool ProvidesDegeneracyDetection() const
271 {
272 return false;
273 }
276 ESymSolverStatus DetermineDependentRows(const Index* ia,
277 const Index* ja,
278 std::list<Index>& c_deps)
279 {
280 return SYMSOLVER_FATAL_ERROR;
281 }
282
284 static int ScaleNameToNum(const std::string& name);
285 };
286
287 } // namespace Ipopt
288
289 #endif
Ipopt::Ma97SolverInterface::SWITCH_ON_DEMAND_REUSE
Definition: IpMa97SolverInterface.hpp:121
Ipopt::Ma97SolverInterface::IncreaseQuality
bool IncreaseQuality()
Request to increase quality of solution for next solve.
Ipopt::Ma97SolverInterface::ProvidesDegeneracyDetection
bool ProvidesDegeneracyDetection() const
Query whether the indices of linearly dependent rows/columns can be determined by this linear solver...
Definition: IpMa97SolverInterface.hpp:270
Ipopt::ESymSolverStatus
ESymSolverStatus
Enum to report outcome of a linear solve.
Definition: IpSymLinearSolver.hpp:21
Ipopt::Ma97SolverInterface::SWITCH_AT_START
Definition: IpMa97SolverInterface.hpp:118
Ipopt::Ma97SolverInterface::SWITCH_AT_START_REUSE
Definition: IpMa97SolverInterface.hpp:119
Ipopt::Ma97SolverInterface::SWITCH_OD_ND
Definition: IpMa97SolverInterface.hpp:124
Ipopt::Ma97SolverInterface::current_level_
int current_level_
Definition: IpMa97SolverInterface.hpp:146
Ipopt::Ma97SolverInterface::~Ma97SolverInterface
~Ma97SolverInterface()
Ipopt::Ma97SolverInterface::order_opts
order_opts
Definition: IpMa97SolverInterface.hpp:107
ma97_control
#define ma97_control
Definition: hsl_ma97d.h:13
Ipopt::Ma97SolverInterface::ORDER_BEST
Definition: IpMa97SolverInterface.hpp:109
Ipopt::SparseSymLinearSolverInterface
Base class for interfaces to symmetric indefinite linear solvers for sparse matrices.
Definition: IpSparseSymLinearSolverInterface.hpp:98
Ipopt::Ma97SolverInterface::numdelay_
int numdelay_
Definition: IpMa97SolverInterface.hpp:131
Ipopt::Ma97SolverInterface::ordering_
int ordering_
Definition: IpMa97SolverInterface.hpp:142
IpSparseSymLinearSolverInterface.hpp
Ipopt::Ma97SolverInterface::InitializeImpl
bool InitializeImpl(const OptionsList &options, const std::string &prefix)
overloaded from AlgorithmStrategyObject
Ipopt::Ma97SolverInterface
Base class for interfaces to symmetric indefinite linear solvers for sparse matrices.
Definition: IpMa97SolverInterface.hpp:104
Ipopt::Ma97SolverInterface::ORDER_AMD
Definition: IpMa97SolverInterface.hpp:110
Ipopt::Ma97SolverInterface::ScaleNameToNum
static int ScaleNameToNum(const std::string &name)
converts a scalign optoin name to its ma97 option number
Ipopt::Ma97SolverInterface::control_
struct ma97_control control_
Definition: IpMa97SolverInterface.hpp:140
Ipopt::Ma97SolverInterface::switch_
enum scale_opts switch_[3]
Definition: IpMa97SolverInterface.hpp:144
Ipopt::Ma97SolverInterface::NumberOfNegEVals
Index NumberOfNegEVals() const
Number of negative eigenvalues detected during last factorization.
Definition: IpMa97SolverInterface.hpp:232
Ipopt::Ma97SolverInterface::RegisterOptions
static void RegisterOptions(SmartPtr< RegisteredOptions > roptions)
Ipopt::Ma97SolverInterface::DetermineDependentRows
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.
Definition: IpMa97SolverInterface.hpp:276
Ipopt::SparseSymLinearSolverInterface::CSR_Format_1_Offset
Compressed sparse row format for lower triangular part, with 1 offset.
Definition: IpSparseSymLinearSolverInterface.hpp:110
hsl_ma97d.h
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
Ipopt::OptionsList
This class stores a list of user set options.
Definition: IpOptionsList.hpp:32
Ipopt::Ma97SolverInterface::ProvidesInertia
bool ProvidesInertia() const
Query whether inertia is computed by linear solver.
Definition: IpMa97SolverInterface.hpp:251
Ipopt::Ma97SolverInterface::ORDER_MATCHED_METIS
Definition: IpMa97SolverInterface.hpp:114
Ipopt::Ma97SolverInterface::fkeep_
void * fkeep_
Definition: IpMa97SolverInterface.hpp:133
Ipopt::Ma97SolverInterface::fctidx_
int fctidx_
Definition: IpMa97SolverInterface.hpp:137
Ipopt::Ma97SolverInterface::SWITCH_ON_DEMAND
Definition: IpMa97SolverInterface.hpp:120
Ipopt::Ma97SolverInterface::ORDER_AUTO
Definition: IpMa97SolverInterface.hpp:108
Ipopt::Ma97SolverInterface::ORDER_MATCHED_AUTO
Definition: IpMa97SolverInterface.hpp:112
Ipopt::Ma97SolverInterface::SWITCH_NDELAY
Definition: IpMa97SolverInterface.hpp:122
Ipopt::Ma97SolverInterface::val_
double * val_
Definition: IpMa97SolverInterface.hpp:129
Ipopt::Ma97SolverInterface::InitializeStructure
ESymSolverStatus InitializeStructure(Index dim, Index nonzeros, const Index *ia, const Index *ja)
Method for initializing internal stuctures.
Ipopt::Ma97SolverInterface::ORDER_MATCHED_AMD
Definition: IpMa97SolverInterface.hpp:113
Ipopt::Ma97SolverInterface::scaling_val_
int scaling_val_[3]
Definition: IpMa97SolverInterface.hpp:145
Ipopt::Ma97SolverInterface::dump_
bool dump_
Definition: IpMa97SolverInterface.hpp:147
Ipopt::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
Ipopt::Ma97SolverInterface::SWITCH_NDELAY_REUSE
Definition: IpMa97SolverInterface.hpp:123
Ipopt::SYMSOLVER_FATAL_ERROR
Unrecoverable error in linear solver occurred.
Definition: IpSymLinearSolver.hpp:33
Ipopt::SparseSymLinearSolverInterface::EMatrixFormat
EMatrixFormat
Enum to specify sparse matrix format.
Definition: IpSparseSymLinearSolverInterface.hpp:102
Ipopt::Ma97SolverInterface::SWITCH_NEVER
Definition: IpMa97SolverInterface.hpp:117
Ipopt::Ma97SolverInterface::GetValuesArrayPtr
double * GetValuesArrayPtr()
Method returing an internal array into which the nonzero elements (in the same order as ja) will be s...
Definition: IpMa97SolverInterface.hpp:181
Ipopt::Ma97SolverInterface::MultiSolve
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.
Ipopt::Ma97SolverInterface::MatrixFormat
EMatrixFormat MatrixFormat() const
Query of requested matrix type that the linear solver understands.
Definition: IpMa97SolverInterface.hpp:259
Ipopt::Ma97SolverInterface::akeep_
void * akeep_
Definition: IpMa97SolverInterface.hpp:132
Ipopt::Ma97SolverInterface::scaling_
double * scaling_
Definition: IpMa97SolverInterface.hpp:136
Ipopt::Ma97SolverInterface::umax_
double umax_
Definition: IpMa97SolverInterface.hpp:141
Ipopt::Ma97SolverInterface::numneg_
int numneg_
Definition: IpMa97SolverInterface.hpp:130
Ipopt::Ma97SolverInterface::Ma97SolverInterface
Ma97SolverInterface()
Definition: IpMa97SolverInterface.hpp:151
Ipopt::Ma97SolverInterface::scale_opts
scale_opts
Definition: IpMa97SolverInterface.hpp:116
Ipopt::Ma97SolverInterface::scaling_type_
int scaling_type_
Definition: IpMa97SolverInterface.hpp:143
Ipopt::Ma97SolverInterface::ORDER_METIS
Definition: IpMa97SolverInterface.hpp:111
Ipopt::Ma97SolverInterface::ndim_
int ndim_
Definition: IpMa97SolverInterface.hpp:128
Ipopt::Ma97SolverInterface::rescale_
bool rescale_
Definition: IpMa97SolverInterface.hpp:135
Ipopt::Ma97SolverInterface::pivtol_changed_
bool pivtol_changed_
Definition: IpMa97SolverInterface.hpp:134
Ipopt::Ma97SolverInterface::SWITCH_OD_ND_REUSE
Definition: IpMa97SolverInterface.hpp:125