Ipopt  trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
IpMa86SolverInterface.hpp
Go to the documentation of this file.
00001 // Copyright (C) 2011, Science and Technology Facilities Council
00002 // Copyright (C) 2009, Jonathan Hogg <jdh41.at.cantab.net>
00003 // Copyright (C) 2004, 2007 International Business Machines and others.
00004 // All Rights Reserved.
00005 // This code is published under the Eclipse Public License.
00006 //
00007 // $Id$
00008 //
00009 // Authors: Jonathan Hogg                    STFC   2011-03-14
00010 //          Jonathan Hogg                           2009-07-29
00011 //          Carl Laird, Andreas Waechter     IBM    2004-03-17
00012 
00013 #ifndef __IPMA86SOLVERINTERFACE_HPP__
00014 #define __IPMA86SOLVERINTERFACE_HPP__
00015 
00016 #include "IpSparseSymLinearSolverInterface.hpp"
00017 extern "C"
00018 {
00019 #include "hsl_ma86d.h"
00020 }
00021 
00022 namespace Ipopt
00023 {
00024 
00104   class Ma86SolverInterface: public SparseSymLinearSolverInterface
00105   {
00106   private:
00107     enum order_opts {
00108        ORDER_AUTO,
00109        ORDER_AMD,
00110        ORDER_METIS
00111     };
00112 
00113     int ndim_; // Number of dimensions
00114     double *val_; // Storage for variables
00115     int numneg_; // Number of negative pivots in last factorization
00116     Index *order_; // Fill reducing permutation
00117     void *keep_; // Stores pointer to factors (only understood by Fortran code!)
00118     bool pivtol_changed_; // indicates if pivtol has been changed
00119 
00120     /* Options */
00121     struct ma86_control control_;
00122     double umax_;
00123     int ordering_;
00124 
00125   public:
00126 
00127     Ma86SolverInterface() :
00128         val_(NULL), keep_(NULL), pivtol_changed_(false)
00129     {}
00130     ~Ma86SolverInterface();
00131 
00132     static void RegisterOptions(SmartPtr<RegisteredOptions> roptions);
00133 
00134     bool InitializeImpl(const OptionsList& options,
00135                         const std::string& prefix);
00136 
00145     ESymSolverStatus InitializeStructure(Index dim, Index nonzeros,
00146                                          const Index* ia,
00147                                          const Index* ja);
00148 
00155     double* GetValuesArrayPtr()
00156     {
00157       return val_;
00158     }
00159 
00192     ESymSolverStatus MultiSolve(bool new_matrix,
00193                                 const Index* ia,
00194                                 const Index* ja,
00195                                 Index nrhs,
00196                                 double* rhs_vals,
00197                                 bool check_NegEVals,
00198                                 Index numberOfNegEVals);
00199 
00206     Index NumberOfNegEVals() const
00207     {
00208       return numneg_;
00209     }
00211 
00212     //* @name Options of Linear solver */
00214 
00220     bool IncreaseQuality();
00221 
00225     bool ProvidesInertia() const
00226     {
00227       return true;
00228     }
00229 
00233     EMatrixFormat MatrixFormat() const
00234     {
00235       return CSR_Format_1_Offset;
00236     }
00238 
00244     bool ProvidesDegeneracyDetection() const
00245     {
00246       return false;
00247     }
00250     ESymSolverStatus DetermineDependentRows(const Index* ia,
00251                                             const Index* ja,
00252                                             std::list<Index>& c_deps)
00253     {
00254       return SYMSOLVER_FATAL_ERROR;
00255     }
00256   };
00257 
00258 } // namespace Ipopt
00259 
00260 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines