Ipopt Documentation  
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 
26 class SIPOPTLIB_EXPORT PCalculator: public AlgorithmStrategyObject
27 {
28 public:
30  SmartPtr<SensBacksolver> backsolver,
31  SmartPtr<SchurData> A_data
32  )
33  : backsolver_(backsolver),
34  data_A_init(ConstPtr(A_data->MakeNewSchurDataCopy())),
35  data_A_(A_data)
36  { }
37 
38  virtual ~PCalculator()
39  { }
40 
41  /* Overloaded from AlgorithmStrategyObject */
42  virtual bool InitializeImpl(
43  const OptionsList& /*options*/,
44  const std::string& /*prefix*/
45  )
46  {
47  return true;
48  }
49 
51  virtual bool ComputeP() = 0;
52 
57  virtual bool GetSchurMatrix(
60  ) = 0;
61 
62  virtual void PrintImpl(
63  const Journalist& jnlst,
64  EJournalLevel level,
65  EJournalCategory category,
66  const std::string& name,
67  Index indent,
68  const std::string& prefix
69  ) const = 0;
70 
71  void Print(
72  const Journalist& jnlst,
73  EJournalLevel level,
74  EJournalCategory category,
75  const std::string& name,
76  Index indent = 0,
77  const std::string& prefix = ""
78  ) const
79  {
80  if( jnlst.ProduceOutput(level, category) )
81  {
82  PrintImpl(jnlst, level, category, name, indent, prefix);
83  }
84  }
85 
86  void Print(
88  EJournalLevel level,
89  EJournalCategory category,
90  const std::string& name,
91  Index indent,
92  const std::string& prefix
93  ) const
94  {
95  if( IsValid(jnlst) && jnlst->ProduceOutput(level, category) )
96  {
97  PrintImpl(*jnlst, level, category, name, indent, prefix);
98  }
99  }
100 
108  {
109  return backsolver_;
110  }
111 
113  {
114  return ConstPtr(data_A_);
115  }
116 
118  {
119  return data_A_;
120  }
121 
123  {
124  data_A_ = data_A_init->MakeNewSchurDataCopy();
125  }
126 
127 private:
128 
130 
133 };
134 
135 }
136 
137 #endif
Ipopt::PCalculator::data_A
SmartPtr< const SchurData > data_A() const
Definition: SensPCalculator.hpp:112
Ipopt::PCalculator::data_A_init
SmartPtr< const SchurData > data_A_init
Definition: SensPCalculator.hpp:131
Ipopt::PCalculator::~PCalculator
virtual ~PCalculator()
Definition: SensPCalculator.hpp:38
Ipopt
This file contains a base class for all exceptions and a set of macros to help with exceptions.
Definition: IpInexactAlgBuilder.hpp:14
Ipopt::PCalculator::Solver
SmartPtr< SensBacksolver > Solver() const
Accessor methods for data and backsolver.
Definition: SensPCalculator.hpp:107
Ipopt::PCalculator::InitializeImpl
virtual bool InitializeImpl(const OptionsList &, const std::string &)
Implementation of the initialization method that has to be overloaded by for each derived class.
Definition: SensPCalculator.hpp:42
Ipopt::PCalculator::PrintImpl
virtual void PrintImpl(const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent, const std::string &prefix) const =0
Ipopt::EJournalLevel
EJournalLevel
Print Level Enum.
Definition: IpJournalist.hpp:32
Ipopt::PCalculator::Print
void Print(const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent=0, const std::string &prefix="") const
Definition: SensPCalculator.hpp:71
Ipopt::Journalist::ProduceOutput
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...
Ipopt::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:17
Ipopt::PCalculator::data_A_
SmartPtr< SchurData > data_A_
Definition: SensPCalculator.hpp:132
Ipopt::PCalculator::reset_data_A
void reset_data_A()
Definition: SensPCalculator.hpp:122
Ipopt::PCalculator::ComputeP
virtual bool ComputeP()=0
Function to start the computation of P from E_0 and KKT.
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
Ipopt::EJournalCategory
EJournalCategory
Category Selection Enum.
Definition: IpJournalist.hpp:52
Ipopt::PCalculator::backsolver_
SmartPtr< SensBacksolver > backsolver_
Definition: SensPCalculator.hpp:129
Ipopt::PCalculator::GetSchurMatrix
virtual bool GetSchurMatrix(const SmartPtr< const SchurData > &B, SmartPtr< Matrix > &S)=0
Function to extract a SchurMatrix corresponding to $B K^{-1} A$.
SensSchurData.hpp
Ipopt::PCalculator::PCalculator
PCalculator(SmartPtr< SensBacksolver > backsolver, SmartPtr< SchurData > A_data)
Definition: SensPCalculator.hpp:29
Ipopt::ConstPtr
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:665
Ipopt::Journalist
Class responsible for all message output.
Definition: IpJournalist.hpp:117
Ipopt::AlgorithmStrategyObject
This is the base class for all algorithm strategy objects.
Definition: IpAlgStrategy.hpp:35
Ipopt::PCalculator
This class is the interface for implementations of any class that calculates the matrix of the follo...
Definition: SensPCalculator.hpp:27
Ipopt::PCalculator::Print
void Print(SmartPtr< const Journalist > jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent, const std::string &prefix) const
Definition: SensPCalculator.hpp:86
IpAlgStrategy.hpp
Ipopt::PCalculator::data_A_nonconst
SmartPtr< SchurData > data_A_nonconst() const
Definition: SensPCalculator.hpp:117
Ipopt::IsValid
bool IsValid(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:674
SensSimpleBacksolver.hpp
Ipopt::OptionsList
This class stores a list of user set options.
Definition: IpOptionsList.hpp:33