- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# /home/coin/SVN-release/Ipopt-3.5.1/Ipopt/src/Algorithm/IpAugSystemSolver.hpp

Go to the documentation of this file.

    00001 // Copyright (C) 2004, 2006 International Business Machines and others.
    00002 // All Rights Reserved.
    00003 // This code is published under the Common Public License.
    00004 //
    00005 // $Id: IpAugSystemSolver.hpp 908 2007-03-01 17:40:32Z andreasw $
    00006 //
    00007 // Authors:  Carl Laird, Andreas Waechter     IBM    2004-08-13
    00008
    00009 #ifndef __IP_AUGSYSTEMSOLVER_HPP__
    00010 #define __IP_AUGSYSTEMSOLVER_HPP__
    00011
    00012 #include "IpSymMatrix.hpp"
    00013 #include "IpSymLinearSolver.hpp"
    00014 #include "IpAlgStrategy.hpp"
    00015
    00016 namespace Ipopt
    00017 {
    00018   DECLARE_STD_EXCEPTION(FATAL_ERROR_IN_LINEAR_SOLVER);
    00019
    00037   class AugSystemSolver: public AlgorithmStrategyObject
    00038   {
    00039   public:
    00043     AugSystemSolver()
    00044     {}
    00046     virtual ~AugSystemSolver()
    00047     {}
    00049
    00051     virtual bool InitializeImpl(const OptionsList& options,
    00052                                 const std::string& prefix) = 0;
    00053
    00061     virtual ESymSolverStatus Solve(
    00062       const SymMatrix* W,
    00063       double W_factor,
    00064       const Vector* D_x,
    00065       double delta_x,
    00066       const Vector* D_s,
    00067       double delta_s,
    00068       const Matrix* J_c,
    00069       const Vector* D_c,
    00070       double delta_c,
    00071       const Matrix* J_d,
    00072       const Vector* D_d,
    00073       double delta_d,
    00074       const Vector& rhs_x,
    00075       const Vector& rhs_s,
    00076       const Vector& rhs_c,
    00077       const Vector& rhs_d,
    00078       Vector& sol_x,
    00079       Vector& sol_s,
    00080       Vector& sol_c,
    00081       Vector& sol_d,
    00082       bool check_NegEVals,
    00083       Index numberOfNegEVals)
    00084     {
    00085       std::vector<SmartPtr<const Vector> > rhs_xV(1);
    00086       rhs_xV[0] = &rhs_x;
    00087       std::vector<SmartPtr<const Vector> > rhs_sV(1);
    00088       rhs_sV[0] = &rhs_s;
    00089       std::vector<SmartPtr<const Vector> > rhs_cV(1);
    00090       rhs_cV[0] = &rhs_c;
    00091       std::vector<SmartPtr<const Vector> > rhs_dV(1);
    00092       rhs_dV[0] = &rhs_d;
    00093       std::vector<SmartPtr<Vector> > sol_xV(1);
    00094       sol_xV[0] = &sol_x;
    00095       std::vector<SmartPtr<Vector> > sol_sV(1);
    00096       sol_sV[0] = &sol_s;
    00097       std::vector<SmartPtr<Vector> > sol_cV(1);
    00098       sol_cV[0] = &sol_c;
    00099       std::vector<SmartPtr<Vector> > sol_dV(1);
    00100       sol_dV[0] = &sol_d;
    00101       return MultiSolve(W, W_factor, D_x, delta_x, D_s, delta_s, J_c, D_c, delta_c,
    00102                         J_d, D_d, delta_d, rhs_xV, rhs_sV, rhs_cV, rhs_dV,
    00103                         sol_xV, sol_sV, sol_cV, sol_dV, check_NegEVals,
    00104                         numberOfNegEVals);
    00105     }
    00106
    00110     virtual ESymSolverStatus MultiSolve(
    00111       const SymMatrix* W,
    00112       double W_factor,
    00113       const Vector* D_x,
    00114       double delta_x,
    00115       const Vector* D_s,
    00116       double delta_s,
    00117       const Matrix* J_c,
    00118       const Vector* D_c,
    00119       double delta_c,
    00120       const Matrix* J_d,
    00121       const Vector* D_d,
    00122       double delta_d,
    00123       std::vector<SmartPtr<const Vector> >& rhs_xV,
    00124       std::vector<SmartPtr<const Vector> >& rhs_sV,
    00125       std::vector<SmartPtr<const Vector> >& rhs_cV,
    00126       std::vector<SmartPtr<const Vector> >& rhs_dV,
    00127       std::vector<SmartPtr<Vector> >& sol_xV,
    00128       std::vector<SmartPtr<Vector> >& sol_sV,
    00129       std::vector<SmartPtr<Vector> >& sol_cV,
    00130       std::vector<SmartPtr<Vector> >& sol_dV,
    00131       bool check_NegEVals,
    00132       Index numberOfNegEVals)
    00133     {
    00134       // Solve for one right hand side after the other
    00135       Index nrhs = (Index)rhs_xV.size();
    00136       DBG_ASSERT(nrhs>0);
    00137       DBG_ASSERT(nrhs==(Index)rhs_sV.size());
    00138       DBG_ASSERT(nrhs==(Index)rhs_cV.size());
    00139       DBG_ASSERT(nrhs==(Index)rhs_dV.size());
    00140       DBG_ASSERT(nrhs==(Index)sol_xV.size());
    00141       DBG_ASSERT(nrhs==(Index)sol_sV.size());
    00142       DBG_ASSERT(nrhs==(Index)sol_cV.size());
    00143       DBG_ASSERT(nrhs==(Index)sol_dV.size());
    00144
    00145       ESymSolverStatus retval=SYMSOLVER_SUCCESS;
    00146       for (Index i=0; i<nrhs; i++) {
    00147         retval = Solve(W, W_factor, D_x, delta_x, D_s, delta_s, J_c, D_c, delta_c,
    00148                        J_d, D_d, delta_d,
    00149                        *rhs_xV[i], *rhs_sV[i], *rhs_cV[i], *rhs_dV[i],
    00150                        *sol_xV[i], *sol_sV[i], *sol_cV[i], *sol_dV[i],
    00151                        check_NegEVals, numberOfNegEVals);
    00152         if (retval!=SYMSOLVER_SUCCESS) {
    00153           break;
    00154         }
    00155       }
    00156       return retval;
    00157     }
    00158
    00165     virtual Index NumberOfNegEVals() const =0;
    00166
    00170     virtual bool ProvidesInertia() const =0;
    00171
    00178     virtual bool IncreaseQuality() =0;
    00179
    00180   private:
    00190     AugSystemSolver(const AugSystemSolver&);
    00191
    00193     void operator=(const AugSystemSolver&);
    00195
    00196   };
    00197
    00198 } // namespace Ipopt
    00199
    00200 #endif