Ipopt  3.12.11
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SensPCalculator.hpp
Go to the documentation of this file.
1 // Copyright 2009, 2011 Hans Pirnay
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // Date : 2009-05-06
6 
7 #ifndef __ASPCALCULATOR_HPP__
8 #define __ASPCALCULATOR_HPP__
9 
10 #include "IpAlgStrategy.hpp"
11 #include "SensSimpleBacksolver.hpp"
12 #include "SensSchurData.hpp"
13 
14 namespace Ipopt
15 {
16 
18  {
29  public:
30 
32  SmartPtr<SchurData> A_data)
33  :
34  backsolver_(backsolver),
35  data_A_init(ConstPtr(A_data->MakeNewSchurDataCopy())),
36  data_A_(A_data)
37  {
38  }
39 
40  virtual ~PCalculator()
41  {
42  }
43 
45  virtual bool InitializeImpl(const OptionsList& options,
46  const std::string& prefix)
47  {
48  return true;
49  }
50 
52  virtual bool ComputeP()=0;
53 
55  virtual bool GetSchurMatrix(const SmartPtr<const SchurData>& B, SmartPtr<Matrix>& S) =0;
56 
57  virtual void PrintImpl(const Journalist& jnlst,
58  EJournalLevel level,
59  EJournalCategory category,
60  const std::string& name,
61  Index indent,
62  const std::string& prefix) const =0;
63 
64  void Print(const Journalist& jnlst,
65  EJournalLevel level,
66  EJournalCategory category,
67  const std::string& name,
68  Index indent=0,
69  const std::string& prefix="") const
70  {
71  if (jnlst.ProduceOutput(level, category)) {
72  PrintImpl(jnlst, level, category, name, indent, prefix);
73  }
74  }
75 
77  EJournalLevel level,
78  EJournalCategory category,
79  const std::string& name,
80  Index indent,
81  const std::string& prefix) const
82  {
83  if (IsValid(jnlst) && jnlst->ProduceOutput(level, category)) {
84  PrintImpl(*jnlst, level, category, name, indent, prefix);
85  }
86  }
87 
92  {
93  return backsolver_;
94  }
95 
97  {
98  return ConstPtr(data_A_);
99  }
100 
102  {
103  return data_A_;
104  }
105 
107  {
108  data_A_ = data_A_init->MakeNewSchurDataCopy();
109  }
110 
111  private:
112 
114 
117 
118 
119  };
120 
121 
122 }
123 
124 #endif
SmartPtr< const SchurData > data_A_init
bool IsValid(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:579
SmartPtr< SensBacksolver > backsolver_
This is the base class for all algorithm strategy objects.
virtual void PrintImpl(const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent, const std::string &prefix) const =0
void Print(const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent=0, const std::string &prefix="") const
SmartPtr< SchurData > data_A_nonconst() const
virtual bool GetSchurMatrix(const SmartPtr< const SchurData > &B, SmartPtr< Matrix > &S)=0
Function to extract a SchurMatrix corresponding to $B K^{-1} A$.
SmartPtr< SensBacksolver > Solver() const
Accessor methods for data and backsolver.
EJournalLevel
Print Level Enum.
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
This class stores a list of user set options.
PCalculator(SmartPtr< SensBacksolver > backsolver, SmartPtr< SchurData > A_data)
This class is the interface for implementations of any class that calculates the matrix of the follo...
void Print(SmartPtr< const Journalist > jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent, const std::string &prefix) const
SmartPtr< const SchurData > data_A() const
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:572
SmartPtr< SchurData > data_A_
Class responsible for all message output.
virtual bool ComputeP()=0
Function to start the computation of P from E_0 and KKT.
virtual bool ProduceOutput(EJournalLevel level, EJournalCategory category) const
Method that returns true if there is a Journal that would write output for the given JournalLevel and...
virtual bool InitializeImpl(const OptionsList &options, const std::string &prefix)
Overloaded from AlgorithmStrategyObject.
EJournalCategory
Category Selection Enum.