Ipopt Documentation  
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_SIPOPT_EXCEPTION(SENS_SUFFIX_ERROR);
25 
27 {
28 public:
29  // constructor
32  SmartPtr<OptionsList> options,
33  SmartPtr<RegisteredOptions> reg_options
34  );
35 
37 
38  static void RegisterOptions(
40  );
41 
43 
44  void Initialize();
45 
48  ApplicationReturnStatus ipopt_retval
49  );
50 
52  {
53  return jnlst_;
54  }
55 
57  {
58  return options_;
59  }
60 
63  {
64  return ConstPtr(options_);
65  }
66 
69  Number* SX,
70  Number* SL,
71  Number* SZL,
72  Number* SZU
73  )
74  {
75  if( GetRawPtr(controller) != NULL && NULL != DirectionalD_X && NULL != DirectionalD_Z_L
76  && NULL != DirectionalD_Z_U && NULL != DirectionalD_L )
77  {
78 
79  for( Index i = 0; i < controller->nx(); ++i )
80  {
81  SX[i] = DirectionalD_X[i];
82  }
83  for( Index i = 0; i < controller->nzu(); ++i )
84  {
85  SZU[i] = DirectionalD_Z_U[i];
86  }
87  for( Index i = 0; i < controller->nzl(); ++i )
88  {
89  SZL[i] = DirectionalD_Z_L[i];
90  }
91  for( Index i = 0; i < controller->nl(); ++i )
92  {
93  SL[i] = DirectionalD_L[i];
94  }
95  }
96  }
97 
100  Number* SX,
101  Number* SL,
102  Number* SZL,
103  Number* SZU
104  )
105  {
106  if( GetRawPtr(controller) != NULL && NULL != SensitivityM_X && NULL != SensitivityM_Z_L
107  && NULL != SensitivityM_Z_U && NULL != SensitivityM_L )
108  {
109  for( Index i = 0; i < controller->nx() * controller->np(); ++i )
110  {
111  SX[i] = SensitivityM_X[i];
112  }
113  for( Index i = 0; i < controller->nzu() * controller->np(); ++i )
114  {
115  SZU[i] = SensitivityM_Z_U[i];
116  }
117  for( Index i = 0; i < controller->nzl() * controller->np(); ++i )
118  {
119  SZL[i] = SensitivityM_Z_L[i];
120  }
121  for( Index i = 0; i < controller->nl() * controller->np(); ++i )
122  {
123  SL[i] = SensitivityM_L[i];
124  }
125 
126  }
127  }
128 
131  {
132  return (GetRawPtr(controller) != NULL) ? controller->nx() : -1;
133  }
135  {
136  return (GetRawPtr(controller) != NULL) ? controller->nl() : -1;
137  }
139  {
140  return (GetRawPtr(controller) != NULL) ? controller->nzu() : -1;
141  }
143  {
144  return (GetRawPtr(controller) != NULL) ? controller->nzl() : -1;
145  }
147  {
148  return (GetRawPtr(controller) != NULL) ? controller->np() : -1;
149  }
150 
151  /* place holders to keep the values of the directional derivatives for each type of variable */
156 
157  /* place holders to keep the values of ds/dp for each type of variable */
162 
163 private:
164  // standard constructor just so it can't be used
165  // SensApplication();
166 
167  // Pointers that are immediately passed from Ipopt and initialized by the constructor
176 
178 
180  bool run_sens_;
184 };
185 
186 }
187 
188 #endif
ApplicationReturnStatus
Return codes for the Optimize call for an application.
Storing the reference count of all the smart pointers that currently reference it.
Index nx()
accessor methods to get sizing info
SmartPtr< Journalist > Jnlst()
SmartPtr< IpoptData > ip_data_
SmartPtr< IpoptNLP > ip_nlp_
bool run_sens_
storing options values
SmartPtr< IpoptCalculatedQuantities > ip_cq_
SmartPtr< OptionsList > options_
SensApplication(SmartPtr< Journalist > jnlst, SmartPtr< OptionsList > options, SmartPtr< RegisteredOptions > reg_options)
SmartPtr< RegisteredOptions > reg_options_
SensAlgorithmExitStatus Run()
void GetDirectionalDerivatives(Number *SX, Number *SL, Number *SZL, Number *SZU)
Copy over value of Directional Derivatives K^(-1)N_p(p-p0)
void GetSensitivityMatrix(Number *SX, Number *SL, Number *SZL, Number *SZU)
Copy over value of ds/dp.
SmartPtr< SensAlgorithm > controller
ApplicationReturnStatus ipopt_retval_
void SetIpoptAlgorithmObjects(SmartPtr< IpoptApplication > app_ipopt, ApplicationReturnStatus ipopt_retval)
SmartPtr< Journalist > jnlst_
SmartPtr< OptionsList > Options()
SmartPtr< const OptionsList > Options() const
Get the options list for setting options (const version)
static void RegisterOptions(SmartPtr< RegisteredOptions > roptions)
SmartPtr< PDSystemSolver > pd_solver_
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:165
#define SIPOPTLIB_EXPORT
Definition: config.h:216
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)
Definition: IpSmartPtr.hpp:663
U * GetRawPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:649
ipindex Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:20
ipnumber Number
Type of all numbers.
Definition: IpTypes.hpp:17
SensAlgorithmExitStatus
Definition: SensUtils.hpp:22
DECLARE_STD_SIPOPT_EXCEPTION(SENS_SUFFIX_ERROR)
Standard exception for wrong/inconsistent suffixes for sipopt.