Ipopt  3.12.12
 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 
27  {
28  public:
29  // constructor
31  SmartPtr<OptionsList> options,
32  SmartPtr<RegisteredOptions> reg_options);
33 
35 
36  static void RegisterOptions(SmartPtr<RegisteredOptions> roptions);
37 
39 
40  void Initialize();
41 
43  ApplicationReturnStatus ipopt_retval);
44 
46  {
47  return jnlst_;
48  }
49 
50 
52  {
53  return options_;
54  }
55 
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 */
97 
98 
99  /* place holders to keep the values of ds/dp for each type of variable */
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
119 
121 
123  bool run_sens_;
127  };
128 }
129 
130 #endif
SmartPtr< OptionsList > options_
bool run_sens_
storing options values
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
SmartPtr< IpoptData > ip_data_
SmartPtr< Journalist > jnlst_
void SetIpoptAlgorithmObjects(SmartPtr< IpoptApplication > app_ipopt, ApplicationReturnStatus ipopt_retval)
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
ReferencedObject class.
SmartPtr< SensAlgorithm > controller
Index nx()
accessor methods to get sizing info
SmartPtr< PDSystemSolver > pd_solver_
SmartPtr< IpoptNLP > ip_nlp_
SensApplication(SmartPtr< Journalist > jnlst, SmartPtr< OptionsList > options, SmartPtr< RegisteredOptions > reg_options)
U * GetRawPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:560
void GetDirectionalDerivatives(Number *SX, Number *SL, Number *SZL, Number *SZU)
Copy over value of Directional Derivatives K^(-1)N_p(p-p0)
static void RegisterOptions(SmartPtr< RegisteredOptions > roptions)
SensAlgorithmExitStatus
This header file provides some definitions used throughout the program.
Definition: SensUtils.hpp:22
SmartPtr< Journalist > Jnlst()
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
SmartPtr< RegisteredOptions > reg_options_
SmartPtr< const OptionsList > Options() const
Get the options list for setting options (const version)
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:572
DECLARE_STD_EXCEPTION(SUFFIX_EMPTY)
SmartPtr< IpoptCalculatedQuantities > ip_cq_
SensAlgorithmExitStatus Run()
ApplicationReturnStatus
Return codes for the Optimize call for an application.
SmartPtr< OptionsList > Options()
void GetSensitivityMatrix(Number *SX, Number *SL, Number *SZL, Number *SZU)
Copy over value of ds/dp.
ApplicationReturnStatus ipopt_retval_