Ipopt Documentation  
 
Loading...
Searching...
No Matches
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"
12#include "SensSchurData.hpp"
13
14namespace Ipopt
15{
16
26class SIPOPTLIB_EXPORT PCalculator: public AlgorithmStrategyObject
27{
28public:
30 SmartPtr<SensBacksolver> backsolver,
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
127private:
128
130
133};
134
135}
136
137#endif
This is the base class for all algorithm strategy objects.
Class responsible for all message output.
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...
This class stores a list of user set options.
This class is the interface for implementations of any class that calculates the matrix of the follo...
SmartPtr< SchurData > data_A_nonconst() const
PCalculator(SmartPtr< SensBacksolver > backsolver, SmartPtr< SchurData > A_data)
virtual void PrintImpl(const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent, const std::string &prefix) const =0
SmartPtr< SensBacksolver > Solver() const
Accessor methods for data and backsolver.
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_init
SmartPtr< SchurData > data_A_
virtual bool GetSchurMatrix(const SmartPtr< const SchurData > &B, SmartPtr< Matrix > &S)=0
Function to extract a SchurMatrix corresponding to $B K^{-1} A$.
SmartPtr< const SchurData > data_A() const
void Print(const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent=0, const std::string &prefix="") const
virtual bool ComputeP()=0
Function to start the computation of P from E_0 and KKT.
virtual bool InitializeImpl(const OptionsList &, const std::string &)
Implementation of the initialization method that has to be overloaded by for each derived class.
SmartPtr< SensBacksolver > backsolver_
Template class for Smart Pointers.
This file contains a base class for all exceptions and a set of macros to help with exceptions.
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
bool IsValid(const SmartPtr< U > &smart_ptr)
ipindex Index
Type of all indices of vectors, matrices etc.
Definition IpTypes.hpp:20
EJournalCategory
Category Selection Enum.
EJournalLevel
Print Level Enum.