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 
93 namespace Ipopt
94 {
95 
97 {
98 private:
100  {
104  };
105 
106  int ndim_;
108  int numneg_;
109  int* order_;
110  void* keep_;
112 
113  /* Options */
114  struct ma86_control control_;
117 
122 
132 
133 public:
134 
136  SmartPtr<LibraryLoader> hslloader_
137  ) : val_(NULL),
138  order_(NULL),
139  keep_(NULL),
140  pivtol_changed_(false),
141  hslloader(hslloader_),
142  ma86_default_control(NULL),
143  ma86_analyse(NULL),
144  ma86_factor(NULL),
145  ma86_factor_solve(NULL),
146  ma86_solve(NULL),
147  ma86_finalise(NULL),
148  mc68_default_control(NULL),
149  mc68_order(NULL)
150  { }
151 
153 
154  static void RegisterOptions(
156  );
157 
160  static void SetFunctions(
169  );
170 
172  const OptionsList& options,
173  const std::string& prefix
174  );
175 
179  Index dim,
180  Index nonzeros,
181  const Index* ia,
182  const Index* ja
183  );
184 
186  {
187  return val_;
188  }
189 
191  bool new_matrix,
192  const Index* ia,
193  const Index* ja,
194  Index nrhs,
195  Number* rhs_vals,
196  bool check_NegEVals,
197  Index numberOfNegEVals
198  );
199 
201  {
202  return numneg_;
203  }
205 
206  //* @name Options of Linear solver */
209 
210  bool ProvidesInertia() const
211  {
212  return true;
213  }
214 
216  {
217  return CSR_Format_1_Offset;
218  }
220 
225  {
226  return false;
227  }
228 
230  const Index* /*ia*/,
231  const Index* /*ja*/,
232  std::list<Index>& /*c_deps*/
233  )
234  {
235  return SYMSOLVER_FATAL_ERROR;
236  }
237 };
238 
239 } // namespace Ipopt
240 
241 #endif
#define IPOPT_DECL_MC68_ORDER(x)
#define IPOPT_DECL_MC68_DEFAULT_CONTROL(x)
#define IPOPT_DECL_MA86_FACTOR_SOLVE(x)
#define IPOPT_DECL_MA86_SOLVE(x)
#define IPOPT_DECL_MA86_DEFAULT_CONTROL(x)
#define IPOPT_DECL_MA86_FACTOR(x)
#define IPOPT_DECL_MA86_FINALISE(x)
#define IPOPT_DECL_MA86_ANALYSE(x)
ESymSolverStatus DetermineDependentRows(const Index *, const Index *, std::list< Index > &)
This method determines the list of row indices of the linearly dependent rows.
Ma86SolverInterface(SmartPtr< LibraryLoader > hslloader_)
bool InitializeImpl(const OptionsList &options, const std::string &prefix)
Implementation of the initialization method that has to be overloaded by for each derived class.
int ndim_
Number of dimensions.
IPOPT_DECL_MA86_SOLVE * ma86_solve
IPOPT_DECL_MA86_DEFAULT_CONTROL * ma86_default_control
IPOPT_DECL_MA86_ANALYSE * ma86_analyse
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.
Index NumberOfNegEVals() const
Number of negative eigenvalues detected during last factorization.
bool ProvidesInertia() const
Query whether inertia is computed by linear solver.
IPOPT_DECL_MA86_FACTOR_SOLVE * ma86_factor_solve
int * order_
Fill reducing permutation.
EMatrixFormat MatrixFormat() const
Query of requested matrix type that the linear solver understands.
IPOPT_DECL_MA86_FINALISE * ma86_finalise
int numneg_
Number of negative pivots in last factorization.
ESymSolverStatus InitializeStructure(Index dim, Index nonzeros, const Index *ia, const Index *ja)
Method for initializing internal structures.
IPOPT_DECL_MC68_DEFAULT_CONTROL * mc68_default_control
IPOPT_DECL_MA86_FACTOR * ma86_factor
static void RegisterOptions(SmartPtr< RegisteredOptions > roptions)
Number * val_
Storage for variables.
void * keep_
Stores pointer to factors (only understood by Fortran code!)
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
bool IncreaseQuality()
Request to increase quality of solution for next solve.
bool pivtol_changed_
indicates if pivtol has been changed
IPOPT_DECL_MC68_ORDER * mc68_order
bool ProvidesDegeneracyDetection() const
Query whether the indices of linearly dependent rows/columns can be determined by this linear solver.
SmartPtr< LibraryLoader > hslloader
Number * GetValuesArrayPtr()
Method returning an internal array into which the nonzero elements (in the same order as ja) will be ...
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.
@ CSR_Format_1_Offset
Compressed sparse row format for upper triangular part, with 1 offset.
#define ma86_control
Definition: hsl_ma86d.h:44
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.
@ SYMSOLVER_FATAL_ERROR
Unrecoverable error in linear solver occurred.
ipindex Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:20
ipnumber Number
Type of all numbers.
Definition: IpTypes.hpp:17