Ipopt
trunk
|
00001 // Copyright (C) 2009, Jonathan Hogg <jdh41.at.cantab.net> 00002 // Copyright (C) 2004, 2007 International Business Machines and others. 00003 // All Rights Reserved. 00004 // This code is published under the Eclipse Public License. 00005 // 00006 // $Id$ 00007 // 00008 // Authors: Jonathan Hogg STFC 2013-30-05 00009 // Jonathan Hogg 2009-07-29 00010 // Carl Laird, Andreas Waechter IBM 2004-03-17 00011 00012 #ifndef __IPMA77SOLVERINTERFACE_HPP__ 00013 #define __IPMA77SOLVERINTERFACE_HPP__ 00014 00015 #include "IpSparseSymLinearSolverInterface.hpp" 00016 00017 extern "C" { 00018 #include "hsl_ma77d.h" 00019 } 00020 00021 namespace Ipopt 00022 { 00023 00103 class Ma77SolverInterface: public SparseSymLinearSolverInterface 00104 { 00105 private: 00106 enum order_opts { 00107 ORDER_AMD, 00108 ORDER_METIS 00109 }; 00110 00111 int ndim_; // Number of dimensions 00112 double *val_; // Storage for variables 00113 int numneg_; // Number of negative pivots in last factorization 00114 void *keep_; // Stores pointer to factors (only understood by Fortran code!) 00115 bool pivtol_changed_; // indicates if pivtol has been changed 00116 00117 /* Options */ 00118 struct ma77_control control_; 00119 double umax_; 00120 int ordering_; 00121 00122 public: 00123 00124 Ma77SolverInterface() : 00125 val_(NULL), keep_(NULL), pivtol_changed_(false) 00126 {} 00127 ~Ma77SolverInterface(); 00128 00129 static void RegisterOptions(SmartPtr<RegisteredOptions> roptions); 00130 00131 bool InitializeImpl(const OptionsList& options, 00132 const std::string& prefix); 00133 00142 ESymSolverStatus InitializeStructure(Index dim, Index nonzeros, 00143 const Index* ia, 00144 const Index* ja); 00145 00152 double* GetValuesArrayPtr() 00153 { 00154 return val_; 00155 } 00156 00189 ESymSolverStatus MultiSolve(bool new_matrix, 00190 const Index* ia, 00191 const Index* ja, 00192 Index nrhs, 00193 double* rhs_vals, 00194 bool check_NegEVals, 00195 Index numberOfNegEVals); 00196 00203 Index NumberOfNegEVals() const 00204 { 00205 return numneg_; 00206 } 00208 00209 //* @name Options of Linear solver */ 00211 00217 bool IncreaseQuality(); 00218 00222 bool ProvidesInertia() const 00223 { 00224 return true; 00225 } 00226 00230 EMatrixFormat MatrixFormat() const 00231 { 00232 return CSR_Full_Format_1_Offset; 00233 } 00235 00241 bool ProvidesDegeneracyDetection() const 00242 { 00243 return false; 00244 } 00247 ESymSolverStatus DetermineDependentRows(const Index* ia, 00248 const Index* ja, 00249 std::list<Index>& c_deps) 00250 { 00251 return SYMSOLVER_FATAL_ERROR; 00252 } 00253 }; 00254 00255 } // namespace Ipopt 00256 00257 #endif