Ipopt
trunk
|
00001 // Copyright (C) 2004, 2010 International Business Machines and others. 00002 // All Rights Reserved. 00003 // This code is published under the Eclipse Public License. 00004 // 00005 // $Id$ 00006 // 00007 // Authors: Carl Laird, Andreas Waechter IBM 2005-03-17 00008 00009 00010 #ifndef __IPPARDISOSOLVERINTERFACE_HPP__ 00011 #define __IPPARDISOSOLVERINTERFACE_HPP__ 00012 00013 #include "IpSparseSymLinearSolverInterface.hpp" 00014 00015 //#define PARDISO_MATCHING_PREPROCESS 00016 00017 namespace Ipopt 00018 { 00019 00024 class PardisoSolverInterface: public SparseSymLinearSolverInterface 00025 { 00026 public: 00030 PardisoSolverInterface(); 00031 00033 virtual ~PardisoSolverInterface(); 00035 00037 bool InitializeImpl(const OptionsList& options, 00038 const std::string& prefix); 00039 00040 00044 virtual ESymSolverStatus InitializeStructure(Index dim, Index nonzeros, 00045 const Index *ia, 00046 const Index *ja); 00047 00050 virtual double* GetValuesArrayPtr(); 00051 00053 virtual ESymSolverStatus MultiSolve(bool new_matrix, 00054 const Index* ia, 00055 const Index* ja, 00056 Index nrhs, 00057 double* rhs_vals, 00058 bool check_NegEVals, 00059 Index numberOfNegEVals); 00060 00064 virtual Index NumberOfNegEVals() const; 00066 00067 //* @name Options of Linear solver */ 00069 00071 virtual bool IncreaseQuality(); 00072 00076 virtual bool ProvidesInertia() const 00077 { 00078 return true; 00079 } 00083 EMatrixFormat MatrixFormat() const 00084 { 00085 return CSR_Format_1_Offset; 00086 } 00088 00091 static void RegisterOptions(SmartPtr<RegisteredOptions> roptions); 00093 00094 private: 00104 PardisoSolverInterface(const PardisoSolverInterface&); 00105 00107 void operator=(const PardisoSolverInterface&); 00109 00113 Index dim_; 00114 00116 Index nonzeros_; 00117 00119 double* a_; 00121 00122 #ifdef PARDISO_MATCHING_PREPROCESS 00123 00124 ipfint* ia2; 00125 ipfint* ja2; 00126 double* a2_; 00127 ipfint* perm2; 00128 double* scale2; 00129 00130 #endif 00131 00135 Index negevals_; 00137 00141 enum PardisoMatchingStrategy 00142 { 00143 COMPLETE, 00144 COMPLETE2x2, 00145 CONSTRAINT 00146 }; 00148 PardisoMatchingStrategy match_strat_; 00151 bool have_symbolic_factorization_; 00154 bool pardiso_redo_symbolic_fact_only_if_inertia_wrong_; 00158 bool pardiso_repeated_perturbation_means_singular_; 00161 bool skip_inertia_check_; 00164 bool pardiso_iterative_; 00166 Index pardiso_max_droptol_corrections_; 00168 00173 bool initialized_; 00175 00179 void** PT_; 00182 ipfint MAXFCT_; 00184 ipfint MNUM_; 00186 ipfint MTYPE_; 00188 ipfint* IPARM_; 00190 double* DPARM_; 00192 ipfint MSGLVL_; 00194 00197 Index debug_last_iter_; 00198 Index debug_cnt_; 00200 00205 ESymSolverStatus SymbolicFactorization(const Index* ia, 00206 const Index* ja); 00207 00210 ESymSolverStatus Factorization(const Index* ia, 00211 const Index* ja, 00212 bool check_NegEVals, 00213 Index numberOfNegEVals); 00214 00217 ESymSolverStatus Solve(const Index* ia, 00218 const Index* ja, 00219 Index nrhs, 00220 double *rhs_vals); 00222 }; 00223 00224 } // namespace Ipopt 00225 #endif