Ipopt Documentation  
IpIterativeSolverTerminationTester.hpp
Go to the documentation of this file.
1 // Copyright (C) 2008 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // Authors: Andreas Waechter IBM 2008-09-19
6 
7 #ifndef __IPITERATIVESOLVERTERMINATIONTESTER_HPP__
8 #define __IPITERATIVESOLVERTERMINATIONTESTER_HPP__
9 
10 #include "IpAlgStrategy.hpp"
11 #include "IpInexactCq.hpp"
12 
13 namespace Ipopt
14 {
15 
20 {
21 public:
24  {
37  };
38 
43  { }
44 
47  { }
49 
50  virtual bool InitializeImpl(
51  const OptionsList& options,
52  const std::string& prefix
53  ) = 0;
54 
59  virtual bool InitializeSolve() = 0;
60 
71  Index ndim,
72  const Number* sol,
73  const Number* resid,
74  Index iter,
75  Number norm2_rhs
76  ) = 0;
77 
81  virtual void Clear() = 0;
82 
84  const Journalist& GetJnlst() const
85  {
86  return Jnlst();
87  }
88 
92  virtual Index GetSolverIterations() const = 0;
93 
94 protected:
98  void GetVectors(
99  Index ndim,
100  const Number* array,
101  SmartPtr<const Vector>& comp_x,
102  SmartPtr<const Vector>& comp_s,
103  SmartPtr<const Vector>& comp_c,
104  SmartPtr<const Vector>& comp_d
105  );
106 
109  {
110  InexactData& inexact_data = static_cast<InexactData&>(IpData().AdditionalData());
111  DBG_ASSERT(dynamic_cast<InexactData*>(&IpData().AdditionalData()));
112  return inexact_data;
113  }
114 
117  {
118  InexactCq& inexact_cq = static_cast<InexactCq&>(IpCq().AdditionalCq());
119  DBG_ASSERT(dynamic_cast<InexactCq*>(&IpCq().AdditionalCq()));
120  return inexact_cq;
121  }
122 
123 private:
137  );
139 };
140 
141 } // namespace Ipopt
142 
143 #endif
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:28
This is the base class for all algorithm strategy objects.
IpoptCalculatedQuantities & IpCq() const
const Journalist & Jnlst() const
Class for all Chen-Goldfarb penalty method specific calculated quantities.
Definition: IpInexactCq.hpp:21
Class to organize all the additional data required by the Chen-Goldfarb penalty function algorithm.
IpoptAdditionalData & AdditionalData()
Get access to additional data object.
This base class is for the termination tests for the iterative linear solver in the inexact version o...
virtual Index GetSolverIterations() const =0
Return the number of iterative solver iteration from the most recent solve.
virtual bool InitializeSolve()=0
Method for initializing for the next iterative solve.
ETerminationTest
Enum to report result of termination test.
@ OTHER_SATISFIED
Some other termination criterion satisfied.
@ CONTINUE
The current solution is not yet good enough.
InexactCq & InexCq()
Method to easily access Inexact calculated quantities.
virtual void Clear()=0
This method can be called after the Solve is over and we can delete anything that has been allocated ...
InexactData & InexData()
Method to easily access Inexact data.
virtual ETerminationTest TestTermination(Index ndim, const Number *sol, const Number *resid, Index iter, Number norm2_rhs)=0
This method checks if the current solution of the iterative linear solver is good enough (by returnin...
virtual bool InitializeImpl(const OptionsList &options, const std::string &prefix)=0
Implementation of the initialization method that has to be overloaded by for each derived class.
const Journalist & GetJnlst() const
An easy way to get the journalist if accessed from the outside.
void GetVectors(Index ndim, const Number *array, SmartPtr< const Vector > &comp_x, SmartPtr< const Vector > &comp_s, SmartPtr< const Vector > &comp_c, SmartPtr< const Vector > &comp_d)
Method for copying a long augmented system array into Vectors in Ipopt notation.
IterativeSolverTerminationTester & operator=(const IterativeSolverTerminationTester &)
Overloaded Assignment Operator.
Class responsible for all message output.
This class stores a list of user set options.
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
This file contains a base class for all exceptions and a set of macros to help with exceptions.
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:17
double Number
Type of all numbers.
Definition: IpTypes.hpp:15