Ipopt Documentation  
IpMa86SolverInterface.hpp
Go to the documentation of this file.
1 // Copyright (C) 2011, Science and Technology Facilities Council
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 // Authors: Jonathan Hogg STFC 2011-03-14
8 // Jonathan Hogg 2009-07-29
9 // Carl Laird, Andreas Waechter IBM 2004-03-17
10 
11 #ifndef __IPMA86SOLVERINTERFACE_HPP__
12 #define __IPMA86SOLVERINTERFACE_HPP__
13 
15 #include "IpMa77SolverInterface.hpp" // to get MC68 declaration macros
16 #include "IpLibraryLoader.hpp"
17 #include "IpTypes.h"
18 
19 extern "C"
20 {
21 #ifdef IPOPT_SINGLE
22 #include "hsl_ma86s.h"
23 #else
24 #include "hsl_ma86d.h"
25 #endif
26 }
27 
29 #define IPOPT_DECL_MA86_DEFAULT_CONTROL(x) void (x)( \
30  struct ma86_control* control \
31 )
32 
34 #define IPOPT_DECL_MA86_ANALYSE(x) void (x)( \
35  const int n, \
36  const int ptr[], \
37  const int row[], \
38  int order[], \
39  void** keep, \
40  const struct ma86_control* control, \
41  struct ma86_info* info \
42 )
43 
45 #define IPOPT_DECL_MA86_FACTOR(x) void (x)( \
46  const int n, \
47  const int ptr[], \
48  const int row[], \
49  const ipnumber val[], \
50  const int order[], \
51  void** keep, \
52  const struct ma86_control* control, \
53  struct ma86_info* info, \
54  const ipnumber scale[] \
55 )
56 
58 #define IPOPT_DECL_MA86_FACTOR_SOLVE(x) void (x)( \
59  const int n, \
60  const int ptr[], \
61  const int row[], \
62  const ipnumber val[], \
63  const int order[], \
64  void** keep, \
65  const struct ma86_control* control, \
66  struct ma86_info* info, \
67  const int nrhs, \
68  const int ldx, \
69  ipnumber xx[], \
70  const ipnumber scale[] \
71 )
72 
74 #define IPOPT_DECL_MA86_SOLVE(x) void (x)( \
75  const int job, \
76  const int nrhs, \
77  const int ldx, \
78  ipnumber* xx, \
79  const int order[],\
80  void** keep, \
81  const struct ma86_control* control,\
82  struct ma86_info* info, \
83  const ipnumber scale[] \
84 )
85 
87 #define IPOPT_DECL_MA86_FINALISE(x) void (x)( \
88  void** keep, \
89  const struct ma86_control* control \
90 )
91 
92 namespace Ipopt
93 {
94 
96 {
97 private:
99  {
103  };
104 
105  int ndim_;
107  int numneg_;
108  int* order_;
109  void* keep_;
111 
112  /* Options */
116 
121 
131 
132 public:
133 
135  SmartPtr<LibraryLoader> hslloader_
136  ) : val_(NULL),
137  order_(NULL),
138  keep_(NULL),
139  pivtol_changed_(false),
140  hslloader(hslloader_),
141  ma86_default_control(NULL),
142  ma86_analyse(NULL),
143  ma86_factor(NULL),
144  ma86_factor_solve(NULL),
145  ma86_solve(NULL),
146  ma86_finalise(NULL),
147  mc68_default_control(NULL),
148  mc68_order(NULL)
149  { }
150 
152 
153  static void RegisterOptions(
155  );
156 
159  static void SetFunctions(
168  );
169 
170  bool InitializeImpl(
171  const OptionsList& options,
172  const std::string& prefix
173  );
174 
178  Index dim,
179  Index nonzeros,
180  const Index* ia,
181  const Index* ja
182  );
183 
185  {
186  return val_;
187  }
188 
190  bool new_matrix,
191  const Index* ia,
192  const Index* ja,
193  Index nrhs,
194  Number* rhs_vals,
195  bool check_NegEVals,
196  Index numberOfNegEVals
197  );
198 
200  {
201  return numneg_;
202  }
204 
205  //* @name Options of Linear solver */
207  bool IncreaseQuality();
208 
209  bool ProvidesInertia() const
210  {
211  return true;
212  }
213 
215  {
216  return CSR_Format_1_Offset;
217  }
219 
222  bool ProvidesDegeneracyDetection() const
224  {
225  return false;
226  }
227 
229  const Index* /*ia*/,
230  const Index* /*ja*/,
231  std::list<Index>& /*c_deps*/
232  )
233  {
234  return SYMSOLVER_FATAL_ERROR;
235  }
236 };
237 
238 } // namespace Ipopt
239 
240 #endif
IPOPT_DECL_MA86_SOLVE * ma86_solve
#define IPOPT_DECL_MA86_FACTOR_SOLVE(x)
static void RegisterOptions(SmartPtr< RegisteredOptions > roptions)
ESymSolverStatus
Enum to report outcome of a linear solve.
Number * GetValuesArrayPtr()
Method returning an internal array into which the nonzero elements (in the same order as ja) will be ...
ESymSolverStatus InitializeStructure(Index dim, Index nonzeros, const Index *ia, const Index *ja)
Method for initializing internal structures.
bool InitializeImpl(const OptionsList &options, const std::string &prefix)
Implementation of the initialization method that has to be overloaded by for each derived class...
Index NumberOfNegEVals() const
Number of negative eigenvalues detected during last factorization.
Base class for interfaces to symmetric indefinite linear solvers for sparse matrices.
Number * val_
Storage for variables.
#define IPOPT_DECL_MC68_DEFAULT_CONTROL(x)
#define IPOPT_DECL_MA86_SOLVE(x)
int numneg_
Number of negative pivots in last factorization.
IPOPT_DECL_MC68_DEFAULT_CONTROL * mc68_default_control
IPOPT_DECL_MA86_FACTOR * ma86_factor
ESymSolverStatus DetermineDependentRows(const Index *, const Index *, std::list< Index > &)
This method determines the list of row indices of the linearly dependent rows.
static void SetFunctions(IPOPT_DECL_MA86_DEFAULT_CONTROL(*ma86_default_control), IPOPT_DECL_MA86_ANALYSE(*ma86_analyse), IPOPT_DECL_MA86_FACTOR(*ma86_factor), IPOPT_DECL_MA86_FACTOR_SOLVE(*ma86_factor_solve), IPOPT_DECL_MA86_SOLVE(*ma86_solve), IPOPT_DECL_MA86_FINALISE(*ma86_finalise), IPOPT_DECL_MC68_DEFAULT_CONTROL(*mc68_default_control),)
set MA86 and MC68 functions to use for every instantiation of this class
IPOPT_DECL_MA86_DEFAULT_CONTROL * ma86_default_control
SmartPtr< LibraryLoader > hslloader
ipindex Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:20
Compressed sparse row format for upper triangular part, with 1 offset.
#define IPOPT_DECL_MA86_FINALISE(x)
This file contains a base class for all exceptions and a set of macros to help with exceptions...
int * order_
Fill reducing permutation.
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:164
bool IncreaseQuality()
Request to increase quality of solution for next solve.
This class stores a list of user set options.
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.
bool pivtol_changed_
indicates if pivtol has been changed
int ndim_
Number of dimensions.
ipnumber Number
Type of all numbers.
Definition: IpTypes.hpp:17
void * keep_
Stores pointer to factors (only understood by Fortran code!)
#define IPOPT_DECL_MC68_ORDER(x)
EMatrixFormat MatrixFormat() const
Query of requested matrix type that the linear solver understands.
Unrecoverable error in linear solver occurred.
IPOPT_DECL_MA86_FACTOR_SOLVE * ma86_factor_solve
EMatrixFormat
Enum to specify sparse matrix format.
#define ma86_control
Definition: hsl_ma86d.h:44
bool ProvidesDegeneracyDetection() const
Query whether the indices of linearly dependent rows/columns can be determined by this linear solver...
IPOPT_DECL_MA86_ANALYSE * ma86_analyse
bool ProvidesInertia() const
Query whether inertia is computed by linear solver.
IPOPT_DECL_MC68_ORDER * mc68_order
#define IPOPT_DECL_MA86_DEFAULT_CONTROL(x)
#define IPOPT_DECL_MA86_FACTOR(x)
#define IPOPT_DECL_MA86_ANALYSE(x)
IPOPT_DECL_MA86_FINALISE * ma86_finalise
Ma86SolverInterface(SmartPtr< LibraryLoader > hslloader_)