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 759 2006-07-07 03:07:08Z 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 
00036   class AugSystemSolver: public AlgorithmStrategyObject
00037   {
00038   public:
00042     AugSystemSolver()
00043     {}
00045     virtual ~AugSystemSolver()
00046     {}
00048 
00050     virtual bool InitializeImpl(const OptionsList& options,
00051                                 const std::string& prefix) = 0;
00052 
00060     virtual ESymSolverStatus Solve(
00061       const SymMatrix* W,
00062       double W_factor,
00063       const Vector* D_x,
00064       double delta_x,
00065       const Vector* D_s,
00066       double delta_s,
00067       const Matrix* J_c,
00068       const Vector* D_c,
00069       double delta_c,
00070       const Matrix* J_d,
00071       const Vector* D_d,
00072       double delta_d,
00073       const Vector& rhs_x,
00074       const Vector& rhs_s,
00075       const Vector& rhs_c,
00076       const Vector& rhs_d,
00077       Vector& sol_x,
00078       Vector& sol_s,
00079       Vector& sol_c,
00080       Vector& sol_d,
00081       bool check_NegEVals,
00082       Index numberOfNegEVals)
00083     {
00084       std::vector<SmartPtr<const Vector> > rhs_xV(1);
00085       rhs_xV[0] = &rhs_x;
00086       std::vector<SmartPtr<const Vector> > rhs_sV(1);
00087       rhs_sV[0] = &rhs_s;
00088       std::vector<SmartPtr<const Vector> > rhs_cV(1);
00089       rhs_cV[0] = &rhs_c;
00090       std::vector<SmartPtr<const Vector> > rhs_dV(1);
00091       rhs_dV[0] = &rhs_d;
00092       std::vector<SmartPtr<Vector> > sol_xV(1);
00093       sol_xV[0] = &sol_x;
00094       std::vector<SmartPtr<Vector> > sol_sV(1);
00095       sol_sV[0] = &sol_s;
00096       std::vector<SmartPtr<Vector> > sol_cV(1);
00097       sol_cV[0] = &sol_c;
00098       std::vector<SmartPtr<Vector> > sol_dV(1);
00099       sol_dV[0] = &sol_d;
00100       return MultiSolve(W, W_factor, D_x, delta_x, D_s, delta_s, J_c, D_c, delta_c,
00101                         J_d, D_d, delta_d, rhs_xV, rhs_sV, rhs_cV, rhs_dV,
00102                         sol_xV, sol_sV, sol_cV, sol_dV, check_NegEVals,
00103                         numberOfNegEVals);
00104     }
00105 
00109     virtual ESymSolverStatus MultiSolve(
00110       const SymMatrix* W,
00111       double W_factor,
00112       const Vector* D_x,
00113       double delta_x,
00114       const Vector* D_s,
00115       double delta_s,
00116       const Matrix* J_c,
00117       const Vector* D_c,
00118       double delta_c,
00119       const Matrix* J_d,
00120       const Vector* D_d,
00121       double delta_d,
00122       std::vector<SmartPtr<const Vector> >& rhs_xV,
00123       std::vector<SmartPtr<const Vector> >& rhs_sV,
00124       std::vector<SmartPtr<const Vector> >& rhs_cV,
00125       std::vector<SmartPtr<const Vector> >& rhs_dV,
00126       std::vector<SmartPtr<Vector> >& sol_xV,
00127       std::vector<SmartPtr<Vector> >& sol_sV,
00128       std::vector<SmartPtr<Vector> >& sol_cV,
00129       std::vector<SmartPtr<Vector> >& sol_dV,
00130       bool check_NegEVals,
00131       Index numberOfNegEVals)
00132     {
00133       // Solve for one right hand side after the other
00134       Index nrhs = (Index)rhs_xV.size();
00135       DBG_ASSERT(nrhs>0);
00136       DBG_ASSERT(nrhs==(Index)rhs_sV.size());
00137       DBG_ASSERT(nrhs==(Index)rhs_cV.size());
00138       DBG_ASSERT(nrhs==(Index)rhs_dV.size());
00139       DBG_ASSERT(nrhs==(Index)sol_xV.size());
00140       DBG_ASSERT(nrhs==(Index)sol_sV.size());
00141       DBG_ASSERT(nrhs==(Index)sol_cV.size());
00142       DBG_ASSERT(nrhs==(Index)sol_dV.size());
00143 
00144       ESymSolverStatus retval=SYMSOLVER_SUCCESS;
00145       for (Index i=0; i<nrhs; i++) {
00146         retval = Solve(W, W_factor, D_x, delta_x, D_s, delta_s, J_c, D_c, delta_c,
00147                        J_d, D_d, delta_d,
00148                        *rhs_xV[i], *rhs_sV[i], *rhs_cV[i], *rhs_dV[i],
00149                        *sol_xV[i], *sol_sV[i], *sol_cV[i], *sol_dV[i],
00150                        check_NegEVals, numberOfNegEVals);
00151         if (retval!=SYMSOLVER_SUCCESS) {
00152           break;
00153         }
00154       }
00155       return retval;
00156     }
00157 
00164     virtual Index NumberOfNegEVals() const =0;
00165 
00169     virtual bool ProvidesInertia() const =0;
00170 
00177     virtual bool IncreaseQuality() =0;
00178 
00179   private:
00189     AugSystemSolver(const AugSystemSolver&);
00190 
00192     void operator=(const AugSystemSolver&);
00194 
00195   };
00196 
00197 } // namespace Ipopt
00198 
00199 #endif

Generated on Fri Sep 26 07:44:10 2008 for SimTKcore by  doxygen 1.5.6