/build/buildd/coinor-ipopt-3.10.1/Ipopt/src/Algorithm/LinearSolvers/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: IpMa86SolverInterface.hpp 2001 2011-06-02 17:43:07Z andreasw $
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     int ndim_; // Number of dimensions
00108     double *val_; // Storage for variables
00109     int numneg_; // Number of negative pivots in last factorization
00110     Index *order_; // Fill reducing permutation
00111     void *keep_; // Stores pointer to factors (only understood by Fortran code!)
00112     bool pivtol_changed_; // indicates if pivtol has been changed
00113     double *scaling_; // Scaling factors
00114 
00115     /* Options */
00116     struct ma86_control control_;
00117     double umax_;
00118     bool scale_;
00119 
00120   public:
00121 
00122     Ma86SolverInterface() :
00123         val_(NULL), pivtol_changed_(false), scaling_(NULL)
00124     {}
00125     ~Ma86SolverInterface();
00126 
00127     static void RegisterOptions(SmartPtr<RegisteredOptions> roptions);
00128 
00129     bool InitializeImpl(const OptionsList& options,
00130                         const std::string& prefix);
00131 
00140     ESymSolverStatus InitializeStructure(Index dim, Index nonzeros,
00141                                          const Index* ia,
00142                                          const Index* ja);
00143 
00150     double* GetValuesArrayPtr()
00151     {
00152       return val_;
00153     }
00154 
00187     ESymSolverStatus MultiSolve(bool new_matrix,
00188                                 const Index* ia,
00189                                 const Index* ja,
00190                                 Index nrhs,
00191                                 double* rhs_vals,
00192                                 bool check_NegEVals,
00193                                 Index numberOfNegEVals);
00194 
00201     Index NumberOfNegEVals() const
00202     {
00203       return numneg_;
00204     }
00206 
00207     //* @name Options of Linear solver */
00209 
00215     bool IncreaseQuality();
00216 
00220     bool ProvidesInertia() const
00221     {
00222       return true;
00223     }
00224 
00228     EMatrixFormat MatrixFormat() const
00229     {
00230       return CSR_Format_1_Offset;
00231     }
00233 
00239     bool ProvidesDegeneracyDetection() const
00240     {
00241       return false;
00242     }
00245     ESymSolverStatus DetermineDependentRows(const Index* ia,
00246                                             const Index* ja,
00247                                             std::list<Index>& c_deps)
00248     {
00249       return SYMSOLVER_FATAL_ERROR;
00250     }
00251 
00253     static void MetisOrder(const int dim, const Index *ptr, const Index *row, Index *perm);
00254   };
00255 
00256 } // namespace Ipopt
00257 
00258 #endif