Ipopt Documentation  
IpAugSystemSolver.hpp
Go to the documentation of this file.
1 // Copyright (C) 2004, 2006 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
6 
7 #ifndef __IP_AUGSYSTEMSOLVER_HPP__
8 #define __IP_AUGSYSTEMSOLVER_HPP__
9 
10 #include "IpSymMatrix.hpp"
11 #include "IpSymLinearSolver.hpp"
12 #include "IpAlgStrategy.hpp"
13 
14 namespace Ipopt
15 {
16 DECLARE_STD_EXCEPTION(FATAL_ERROR_IN_LINEAR_SOLVER);
17 
37 {
38 public:
40 
43  { }
45  virtual ~AugSystemSolver()
46  { }
48 
50  virtual bool InitializeImpl(
51  const OptionsList& options,
52  const std::string& prefix
53  ) = 0;
54 
64  const SymMatrix* W,
65  double W_factor,
66  const Vector* D_x,
67  double delta_x,
68  const Vector* D_s,
69  double delta_s,
70  const Matrix* J_c,
71  const Vector* D_c,
72  double delta_c,
73  const Matrix* J_d,
74  const Vector* D_d,
75  double delta_d,
76  const Vector& rhs_x,
77  const Vector& rhs_s,
78  const Vector& rhs_c,
79  const Vector& rhs_d,
80  Vector& sol_x,
81  Vector& sol_s,
82  Vector& sol_c,
83  Vector& sol_d,
84  bool check_NegEVals,
85  Index numberOfNegEVals
86  )
87  {
88  std::vector<SmartPtr<const Vector> > rhs_xV(1);
89  rhs_xV[0] = &rhs_x;
90  std::vector<SmartPtr<const Vector> > rhs_sV(1);
91  rhs_sV[0] = &rhs_s;
92  std::vector<SmartPtr<const Vector> > rhs_cV(1);
93  rhs_cV[0] = &rhs_c;
94  std::vector<SmartPtr<const Vector> > rhs_dV(1);
95  rhs_dV[0] = &rhs_d;
96  std::vector<SmartPtr<Vector> > sol_xV(1);
97  sol_xV[0] = &sol_x;
98  std::vector<SmartPtr<Vector> > sol_sV(1);
99  sol_sV[0] = &sol_s;
100  std::vector<SmartPtr<Vector> > sol_cV(1);
101  sol_cV[0] = &sol_c;
102  std::vector<SmartPtr<Vector> > sol_dV(1);
103  sol_dV[0] = &sol_d;
104  return MultiSolve(W, W_factor, D_x, delta_x, D_s, delta_s, J_c, D_c, delta_c, J_d, D_d, delta_d, rhs_xV, rhs_sV,
105  rhs_cV, rhs_dV, sol_xV, sol_sV, sol_cV, sol_dV, check_NegEVals, numberOfNegEVals);
106  }
107 
114  const SymMatrix* W,
115  double W_factor,
116  const Vector* D_x,
117  double delta_x,
118  const Vector* D_s,
119  double delta_s,
120  const Matrix* J_c,
121  const Vector* D_c,
122  double delta_c,
123  const Matrix* J_d,
124  const Vector* D_d,
125  double delta_d,
126  std::vector<SmartPtr<const Vector> >& rhs_xV,
127  std::vector<SmartPtr<const Vector> >& rhs_sV,
128  std::vector<SmartPtr<const Vector> >& rhs_cV,
129  std::vector<SmartPtr<const Vector> >& rhs_dV,
130  std::vector<SmartPtr<Vector> >& sol_xV,
131  std::vector<SmartPtr<Vector> >& sol_sV,
132  std::vector<SmartPtr<Vector> >& sol_cV,
133  std::vector<SmartPtr<Vector> >& sol_dV,
134  bool check_NegEVals,
135  Index numberOfNegEVals
136  )
137  {
138  // Solve for one right hand side after the other
139  Index nrhs = (Index) rhs_xV.size();
140  DBG_ASSERT(nrhs > 0);
141  DBG_ASSERT(nrhs == (Index)rhs_sV.size());
142  DBG_ASSERT(nrhs == (Index)rhs_cV.size());
143  DBG_ASSERT(nrhs == (Index)rhs_dV.size());
144  DBG_ASSERT(nrhs == (Index)sol_xV.size());
145  DBG_ASSERT(nrhs == (Index)sol_sV.size());
146  DBG_ASSERT(nrhs == (Index)sol_cV.size());
147  DBG_ASSERT(nrhs == (Index)sol_dV.size());
148 
150  for( Index i = 0; i < nrhs; i++ )
151  {
152  retval = Solve(W, W_factor, D_x, delta_x, D_s, delta_s, J_c, D_c, delta_c, J_d, D_d, delta_d, *rhs_xV[i],
153  *rhs_sV[i], *rhs_cV[i], *rhs_dV[i], *sol_xV[i], *sol_sV[i], *sol_cV[i], *sol_dV[i], check_NegEVals,
154  numberOfNegEVals);
155  if( retval != SYMSOLVER_SUCCESS )
156  {
157  break;
158  }
159  }
160  return retval;
161  }
162 
169  virtual Index NumberOfNegEVals() const = 0;
170 
175  virtual bool ProvidesInertia() const = 0;
176 
184  virtual bool IncreaseQuality() = 0;
185 
186 private:
196 
199  const AugSystemSolver&
200  );
201 
203  void operator=(
204  const AugSystemSolver&
205  );
207 
208 };
209 
210 } // namespace Ipopt
211 
212 #endif
AugSystemSolver()
Default constructor.
virtual ~AugSystemSolver()
Destructor.
ESymSolverStatus
Enum to report outcome of a linear solve.
This is the base class for all algorithm strategy objects.
DECLARE_STD_EXCEPTION(FATAL_ERROR_IN_LINEAR_SOLVER)
Vector Base Class.
Definition: IpVector.hpp:47
virtual ESymSolverStatus Solve(const SymMatrix *W, double W_factor, const Vector *D_x, double delta_x, const Vector *D_s, double delta_s, const Matrix *J_c, const Vector *D_c, double delta_c, const Matrix *J_d, const Vector *D_d, double delta_d, const Vector &rhs_x, const Vector &rhs_s, const Vector &rhs_c, const Vector &rhs_d, Vector &sol_x, Vector &sol_s, Vector &sol_c, Vector &sol_d, bool check_NegEVals, Index numberOfNegEVals)
Set up the augmented system and solve it for a given right hand side.
This file contains a base class for all exceptions and a set of macros to help with exceptions...
This is the base class for all derived symmetric matrix types.
Definition: IpSymMatrix.hpp:20
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:171
This class stores a list of user set options.
Base class for Solver for the augmented system.
virtual ESymSolverStatus MultiSolve(const SymMatrix *W, double W_factor, const Vector *D_x, double delta_x, const Vector *D_s, double delta_s, const Matrix *J_c, const Vector *D_c, double delta_c, const Matrix *J_d, const Vector *D_d, double delta_d, std::vector< SmartPtr< const Vector > > &rhs_xV, std::vector< SmartPtr< const Vector > > &rhs_sV, std::vector< SmartPtr< const Vector > > &rhs_cV, std::vector< SmartPtr< const Vector > > &rhs_dV, std::vector< SmartPtr< Vector > > &sol_xV, std::vector< SmartPtr< Vector > > &sol_sV, std::vector< SmartPtr< Vector > > &sol_cV, std::vector< SmartPtr< Vector > > &sol_dV, bool check_NegEVals, Index numberOfNegEVals)
Like Solve, but for multiple right hand sides.
Matrix Base Class.
Definition: IpMatrix.hpp:27
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:17
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:27
#define IPOPTLIB_EXPORT