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 
36  ~SensApplication();
37 
38  static void RegisterOptions(
40  );
41 
43 
44  void Initialize();
45 
46  void SetIpoptAlgorithmObjects(
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
SmartPtr< OptionsList > options_
bool run_sens_
storing options values
DECLARE_STD_SIPOPT_EXCEPTION(SENS_SUFFIX_ERROR)
Standard exception for wrong/inconsistent suffixes for sipopt.
SmartPtr< IpoptData > ip_data_
SmartPtr< Journalist > jnlst_
ipindex Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:20
This file contains a base class for all exceptions and a set of macros to help with exceptions...
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:164
Storing the reference count of all the smart pointers that currently reference it.
SmartPtr< SensAlgorithm > controller
Index nx()
accessor methods to get sizing info
SmartPtr< PDSystemSolver > pd_solver_
SmartPtr< IpoptNLP > ip_nlp_
U * GetRawPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:649
void GetDirectionalDerivatives(Number *SX, Number *SL, Number *SZL, Number *SZU)
Copy over value of Directional Derivatives K^(-1)N_p(p-p0)
SensAlgorithmExitStatus
Definition: SensUtils.hpp:21
SmartPtr< Journalist > Jnlst()
ipnumber Number
Type of all numbers.
Definition: IpTypes.hpp:17
SmartPtr< RegisteredOptions > reg_options_
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:663
SmartPtr< IpoptCalculatedQuantities > ip_cq_
ApplicationReturnStatus
Return codes for the Optimize call for an application.
SmartPtr< OptionsList > Options()
SmartPtr< const OptionsList > Options() const
Get the options list for setting options (const version)
void GetSensitivityMatrix(Number *SX, Number *SL, Number *SZL, Number *SZU)
Copy over value of ds/dp.
#define SIPOPTLIB_EXPORT
Definition: config.h:216
ApplicationReturnStatus ipopt_retval_