Ipopt 3.12.10

- Main Page
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SensApplication.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 __SENSAPPLICATION_HPP__
8 #define __SENSAPPLICATION_HPP__
9
10 #include "IpReferenced.hpp"
11 #include "SensUtils.hpp"
12 #include "SensUtils.hpp"
13 #include "SensAlgorithm.hpp"
14 #include "IpRegOptions.hpp"
15
16 #include "IpIpoptApplication.hpp"
17 #include "IpPDSystemSolver.hpp"
18
19 #include "IpSmartPtr.hpp"
20
21 namespace Ipopt
22 {
24 DECLARE_STD_EXCEPTION(SENS_SUFFIX_ERROR);
25
26 class SensApplication : public ReferencedObject
27 {
28 public:
29 // constructor
30 SensApplication(SmartPtr<Journalist> jnlst,
31 SmartPtr<OptionsList> options,
32 SmartPtr<RegisteredOptions> reg_options);
33
34 ~SensApplication();
35
36 static void RegisterOptions(SmartPtr<RegisteredOptions> roptions);
37
38 SensAlgorithmExitStatus Run();
39
40 void Initialize();
41
42 void SetIpoptAlgorithmObjects(SmartPtr<IpoptApplication> app_ipopt,
43 ApplicationReturnStatus ipopt_retval);
44
45 SmartPtr<Journalist> Jnlst()
46 {
47 return jnlst_;
48 }
49
50
51 SmartPtr<OptionsList> Options()
52 {
53 return options_;
54 }
55
57 SmartPtr<const OptionsList> Options() const
58 {
59 return ConstPtr(options_);
60 }
61
63 void GetDirectionalDerivatives(Number *SX, Number *SL, Number *SZL, Number *SZU) {
64 if (GetRawPtr(controller) != NULL && NULL != DirectionalD_X && NULL != DirectionalD_Z_L && NULL != DirectionalD_Z_U && NULL != DirectionalD_L) {
65
66 for (int i=0 ; i < controller->nx(); ++i) SX[i] = DirectionalD_X[i] ;
67 for (int i=0; i < controller->nzu(); ++i) SZU[i] = DirectionalD_Z_U[i] ;
68 for (int i=0; i < controller->nzl(); ++i) SZL[i] = DirectionalD_Z_L[i] ;
69 for (int i=0 ; i < controller->nl(); ++i) SL[i] = DirectionalD_L[i] ;
70
71 }
72 }
73
75 void GetSensitivityMatrix(Number *SX, Number *SL, Number *SZL, Number *SZU) {
76 if (GetRawPtr(controller) != NULL && NULL != SensitivityM_X && NULL != SensitivityM_Z_L && NULL != SensitivityM_Z_U && NULL != SensitivityM_L) {
77 for (int i=0 ; i < controller->nx()*controller->np(); ++i) SX[i] = SensitivityM_X[i] ;
78 for (int i=0; i < controller->nzu()*controller->np(); ++i) SZU[i] = SensitivityM_Z_U[i] ;
79 for (int i=0; i < controller->nzl()*controller->np(); ++i) SZL[i] = SensitivityM_Z_L[i] ;
80 for (int i=0 ; i < controller->nl()*controller->np(); ++i) SL[i] = SensitivityM_L[i] ;
81
82 }
83 }
84
86 Index nx() {return (GetRawPtr(controller)!=NULL) ? controller->nx() : -1 ;}
87 Index nl() {return (GetRawPtr(controller)!=NULL) ? controller->nl() : -1 ;}
88 Index nzu() {return (GetRawPtr(controller)!=NULL) ? controller->nzu(): -1 ;}
89 Index nzl() {return (GetRawPtr(controller)!=NULL) ? controller->nzl(): -1 ;}
90 Index np() {return (GetRawPtr(controller)!=NULL) ? controller->np(): -1 ;}
91
92 /* place holders to keep the values of the directional derivatives for each type of variable */
93 Number *DirectionalD_X ;
94 Number *DirectionalD_L ;
95 Number *DirectionalD_Z_U ;
96 Number *DirectionalD_Z_L ;
97
98
99 /* place holders to keep the values of ds/dp for each type of variable */
100 Number *SensitivityM_X ;
101 Number *SensitivityM_L ;
102 Number *SensitivityM_Z_U ;
103 Number *SensitivityM_Z_L ;
104
105 private:
106
107 // standard constructor just so it can't be used
108 // SensApplication();
109
110 // Pointers that are immediately passed from Ipopt and initialized by the constructor
111 SmartPtr<Journalist> jnlst_;
112 SmartPtr<OptionsList> options_;
113 SmartPtr<IpoptData> ip_data_;
114 SmartPtr<IpoptCalculatedQuantities> ip_cq_;
115 SmartPtr<PDSystemSolver> pd_solver_;
116 SmartPtr<IpoptNLP> ip_nlp_;
117 SmartPtr<RegisteredOptions> reg_options_;
118 ApplicationReturnStatus ipopt_retval_;
119
120 SmartPtr<SensAlgorithm> controller ;
121
123 bool run_sens_;
124 bool compute_red_hessian_;
125 bool compute_dsdp_ ;
126 Index n_sens_steps_;
127 };
128 }
129
130 #endif
Ipopt::SensApplication::n_sens_steps_
Index n_sens_steps_
Definition: SensApplication.hpp:126
Ipopt::SensApplication::SensitivityM_L
Number * SensitivityM_L
Definition: SensApplication.hpp:101
Ipopt::SensApplication::options_
SmartPtr< OptionsList > options_
Definition: SensApplication.hpp:112
Ipopt::SensApplication::run_sens_
bool run_sens_
storing options values
Definition: SensApplication.hpp:123
Ipopt::SensApplication::DirectionalD_L
Number * DirectionalD_L
Definition: SensApplication.hpp:94
IpPDSystemSolver.hpp
Ipopt::SensApplication
Definition: SensApplication.hpp:26
Ipopt::Number
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
Ipopt::SensApplication::ip_data_
SmartPtr< IpoptData > ip_data_
Definition: SensApplication.hpp:113
Ipopt::SensApplication::nzu
Index nzu()
Definition: SensApplication.hpp:88
Ipopt::SensApplication::nl
Index nl()
Definition: SensApplication.hpp:87
Ipopt::SensApplication::compute_red_hessian_
bool compute_red_hessian_
Definition: SensApplication.hpp:124
Ipopt::SensApplication::np
Index np()
Definition: SensApplication.hpp:90
Ipopt::SensApplication::jnlst_
SmartPtr< Journalist > jnlst_
Definition: SensApplication.hpp:111
Ipopt::SensApplication::SensitivityM_Z_U
Number * SensitivityM_Z_U
Definition: SensApplication.hpp:102
Ipopt::SensApplication::SetIpoptAlgorithmObjects
void SetIpoptAlgorithmObjects(SmartPtr< IpoptApplication > app_ipopt, ApplicationReturnStatus ipopt_retval)
Ipopt::SensApplication::DirectionalD_Z_U
Number * DirectionalD_Z_U
Definition: SensApplication.hpp:95
Ipopt::SensApplication::Initialize
void Initialize()
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
Ipopt::ReferencedObject
ReferencedObject class.
Definition: IpReferenced.hpp:174
Ipopt::SensApplication::controller
SmartPtr< SensAlgorithm > controller
Definition: SensApplication.hpp:120
Ipopt::SensApplication::~SensApplication
~SensApplication()
Ipopt::SensApplication::DirectionalD_X
Number * DirectionalD_X
Definition: SensApplication.hpp:93
Ipopt::SensApplication::nx
Index nx()
accessor methods to get sizing info
Definition: SensApplication.hpp:86
Ipopt::SensApplication::pd_solver_
SmartPtr< PDSystemSolver > pd_solver_
Definition: SensApplication.hpp:115
Ipopt::SensApplication::ip_nlp_
SmartPtr< IpoptNLP > ip_nlp_
Definition: SensApplication.hpp:116
Ipopt::SensApplication::SensApplication
SensApplication(SmartPtr< Journalist > jnlst, SmartPtr< OptionsList > options, SmartPtr< RegisteredOptions > reg_options)
Ipopt::GetRawPtr
U * GetRawPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:560
Ipopt::SensApplication::GetDirectionalDerivatives
void GetDirectionalDerivatives(Number *SX, Number *SL, Number *SZL, Number *SZU)
Copy over value of Directional Derivatives K^(-1)N_p(p-p0)
Definition: SensApplication.hpp:63
Ipopt::SensApplication::RegisterOptions
static void RegisterOptions(SmartPtr< RegisteredOptions > roptions)
Ipopt::SensAlgorithmExitStatus
SensAlgorithmExitStatus
This header file provides some definitions used throughout the program.
Definition: SensUtils.hpp:22
Ipopt::SensApplication::Jnlst
SmartPtr< Journalist > Jnlst()
Definition: SensApplication.hpp:45
Ipopt::SensApplication::SensitivityM_X
Number * SensitivityM_X
Definition: SensApplication.hpp:100
Ipopt::SensApplication::SensitivityM_Z_L
Number * SensitivityM_Z_L
Definition: SensApplication.hpp:103
SensAlgorithm.hpp
Ipopt::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
IpReferenced.hpp
Ipopt::SensApplication::reg_options_
SmartPtr< RegisteredOptions > reg_options_
Definition: SensApplication.hpp:117
IpIpoptApplication.hpp
Ipopt::SensApplication::Options
SmartPtr< const OptionsList > Options() const
Get the options list for setting options (const version)
Definition: SensApplication.hpp:57
Ipopt::ConstPtr
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:572
Ipopt::DECLARE_STD_EXCEPTION
DECLARE_STD_EXCEPTION(SUFFIX_EMPTY)
Ipopt::SensApplication::ip_cq_
SmartPtr< IpoptCalculatedQuantities > ip_cq_
Definition: SensApplication.hpp:114
Ipopt::SensApplication::Run
SensAlgorithmExitStatus Run()
Ipopt::SensApplication::nzl
Index nzl()
Definition: SensApplication.hpp:89
Ipopt::ApplicationReturnStatus
ApplicationReturnStatus
Return codes for the Optimize call for an application.
Definition: IpReturnCodes.hpp:17
Ipopt::SensApplication::Options
SmartPtr< OptionsList > Options()
Definition: SensApplication.hpp:51
Ipopt::SensApplication::DirectionalD_Z_L
Number * DirectionalD_Z_L
Definition: SensApplication.hpp:96
Ipopt::SensApplication::GetSensitivityMatrix
void GetSensitivityMatrix(Number *SX, Number *SL, Number *SZL, Number *SZU)
Copy over value of ds/dp.
Definition: SensApplication.hpp:75
IpRegOptions.hpp
IpSmartPtr.hpp
SensUtils.hpp
Ipopt::SensApplication::ipopt_retval_
ApplicationReturnStatus ipopt_retval_
Definition: SensApplication.hpp:118
Ipopt::SensApplication::compute_dsdp_
bool compute_dsdp_
Definition: SensApplication.hpp:125