00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef __IPMA97SOLVERINTERFACE_HPP__
00014 #define __IPMA97SOLVERINTERFACE_HPP__
00015
00016 #include "IpSparseSymLinearSolverInterface.hpp"
00017 extern "C"
00018 {
00019 #include "hsl_ma97d.h"
00020 }
00021
00022 namespace Ipopt
00023 {
00024
00104 class Ma97SolverInterface: public SparseSymLinearSolverInterface
00105 {
00106 private:
00107 enum order_opts {
00108 ORDER_AUTO,
00109 ORDER_BEST,
00110 ORDER_AMD,
00111 ORDER_METIS,
00112 ORDER_MATCHED_AUTO,
00113 ORDER_MATCHED_AMD,
00114 ORDER_MATCHED_METIS
00115 };
00116 enum scale_opts {
00117 SWITCH_NEVER,
00118 SWITCH_AT_START,
00119 SWITCH_AT_START_REUSE,
00120 SWITCH_ON_DEMAND,
00121 SWITCH_ON_DEMAND_REUSE,
00122 SWITCH_NDELAY,
00123 SWITCH_NDELAY_REUSE,
00124 SWITCH_OD_ND,
00125 SWITCH_OD_ND_REUSE
00126 };
00127
00128 int ndim_;
00129 double *val_;
00130 int numneg_;
00131 int numdelay_;
00132 void *akeep_;
00133 void *fkeep_;
00134 bool pivtol_changed_;
00135 bool rescale_;
00136 double *scaling_;
00137 int fctidx_;
00138
00139
00140 struct ma97_control control_;
00141 double umax_;
00142 int ordering_;
00143 int scaling_type_;
00144 enum scale_opts switch_[3];
00145 int scaling_val_[3];
00146 int current_level_;
00147 bool dump_;
00148
00149 public:
00150
00151 Ma97SolverInterface() :
00152 val_(NULL), numdelay_(0), akeep_(NULL), fkeep_(NULL), pivtol_changed_(false),
00153 rescale_(false), scaling_(NULL), fctidx_(0), scaling_type_(0),
00154 dump_(false)
00155 {}
00156 ~Ma97SolverInterface();
00157
00158 static void RegisterOptions(SmartPtr<RegisteredOptions> roptions);
00159
00160 bool InitializeImpl(const OptionsList& options,
00161 const std::string& prefix);
00162
00171 ESymSolverStatus InitializeStructure(Index dim, Index nonzeros,
00172 const Index* ia,
00173 const Index* ja);
00174
00181 double* GetValuesArrayPtr()
00182 {
00183 return val_;
00184 }
00185
00218 ESymSolverStatus MultiSolve(bool new_matrix,
00219 const Index* ia,
00220 const Index* ja,
00221 Index nrhs,
00222 double* rhs_vals,
00223 bool check_NegEVals,
00224 Index numberOfNegEVals);
00225
00232 Index NumberOfNegEVals() const
00233 {
00234 return numneg_;
00235 }
00237
00238
00240
00246 bool IncreaseQuality();
00247
00251 bool ProvidesInertia() const
00252 {
00253 return true;
00254 }
00255
00259 EMatrixFormat MatrixFormat() const
00260 {
00261 return CSR_Format_1_Offset;
00262 }
00264
00270 bool ProvidesDegeneracyDetection() const
00271 {
00272 return false;
00273 }
00276 ESymSolverStatus DetermineDependentRows(const Index* ia,
00277 const Index* ja,
00278 std::list<Index>& c_deps)
00279 {
00280 return SYMSOLVER_FATAL_ERROR;
00281 }
00282
00284 static int ScaleNameToNum(const std::string& name);
00285 };
00286
00287 }
00288
00289 #endif