- Main Page
- Classes
- Files

- File List
- File Members

# contrib/sIPOPT/src/SensApplication.hpp

Go to the documentation of this file.

    00001 // Copyright 2009, 2011 Hans Pirnay
    00002 // All Rights Reserved.
    00003 // This code is published under the Eclipse Public License.
    00004 //
    00005 // Date   : 2009-05-06
    00006
    00007 #ifndef __SENSAPPLICATION_HPP__
    00008 #define __SENSAPPLICATION_HPP__
    00009
    00010 #include "IpReferenced.hpp"
    00011 #include "SensUtils.hpp"
    00012 #include "SensUtils.hpp"
    00013 #include "SensAlgorithm.hpp"
    00014 #include "IpRegOptions.hpp"
    00015
    00016 #include "IpIpoptApplication.hpp"
    00017 #include "IpPDSystemSolver.hpp"
    00018
    00019 #include "IpSmartPtr.hpp"
    00020
    00021 namespace Ipopt
    00022 {
    00024   DECLARE_STD_EXCEPTION(SENS_SUFFIX_ERROR);
    00025
    00026   class SensApplication : public ReferencedObject
    00027   {
    00028   public:
    00029     // constructor
    00030     SensApplication(SmartPtr<Journalist> jnlst,
    00031             SmartPtr<OptionsList> options,
    00032             SmartPtr<RegisteredOptions> reg_options);
    00033
    00034     ~SensApplication();
    00035
    00036     static void RegisterOptions(SmartPtr<RegisteredOptions> roptions);
    00037
    00038     SensAlgorithmExitStatus Run();
    00039
    00040     void Initialize();
    00041
    00042     void SetIpoptAlgorithmObjects(SmartPtr<IpoptApplication> app_ipopt,
    00043                   ApplicationReturnStatus ipopt_retval);
    00044
    00045     SmartPtr<Journalist> Jnlst()
    00046     {
    00047       return jnlst_;
    00048     }
    00049
    00050
    00051     SmartPtr<OptionsList> Options()
    00052     {
    00053       return options_;
    00054     }
    00055
    00057     SmartPtr<const OptionsList> Options() const
    00058     {
    00059       return ConstPtr(options_);
    00060     }
    00061
    00063     void GetDirectionalDerivatives(Number *SX, Number *SL, Number *SZL, Number *SZU) {
    00064       if (GetRawPtr(controller) != NULL && NULL != DirectionalD_X && NULL != DirectionalD_Z_L && NULL != DirectionalD_Z_U && NULL != DirectionalD_L) {
    00065
    00066     for (int i=0 ; i < controller->nx(); ++i) SX[i] = DirectionalD_X[i] ;
    00067     for (int i=0; i < controller->nzu(); ++i) SZU[i] = DirectionalD_Z_U[i] ;
    00068     for (int i=0; i < controller->nzl(); ++i) SZL[i] = DirectionalD_Z_L[i] ;
    00069     for (int i=0 ; i < controller->nl(); ++i) SL[i]  = DirectionalD_L[i] ;
    00070
    00071       }
    00072     }
    00073
    00075     void GetSensitivityMatrix(Number *SX, Number *SL, Number *SZL, Number *SZU) {
    00076       if (GetRawPtr(controller) != NULL && NULL != SensitivityM_X && NULL != SensitivityM_Z_L && NULL != SensitivityM_Z_U && NULL != SensitivityM_L) {
    00077     for (int i=0 ; i < controller->nx()*controller->np(); ++i) SX[i] = SensitivityM_X[i] ;
    00078     for (int i=0; i < controller->nzu()*controller->np(); ++i) SZU[i] = SensitivityM_Z_U[i] ;
    00079     for (int i=0; i < controller->nzl()*controller->np(); ++i) SZL[i] = SensitivityM_Z_L[i] ;
    00080     for (int i=0 ; i < controller->nl()*controller->np(); ++i) SL[i]  = SensitivityM_L[i] ;
    00081
    00082       }
    00083     }
    00084
    00086     Index nx()  {return (GetRawPtr(controller)!=NULL) ? controller->nx() : -1 ;}
    00087     Index nl()  {return (GetRawPtr(controller)!=NULL) ? controller->nl() : -1 ;}
    00088     Index nzu() {return (GetRawPtr(controller)!=NULL) ? controller->nzu(): -1 ;}
    00089     Index nzl() {return (GetRawPtr(controller)!=NULL) ? controller->nzl(): -1 ;}
    00090     Index np() {return (GetRawPtr(controller)!=NULL) ? controller->np(): -1 ;}
    00091
    00092     /* place holders to keep the values of the directional derivatives for each type of variable */
    00093     Number *DirectionalD_X ;
    00094     Number *DirectionalD_L ;
    00095     Number *DirectionalD_Z_U ;
    00096     Number *DirectionalD_Z_L ;
    00097
    00098
    00099     /* place holders to keep the values of ds/dp for each type of variable */
    00100     Number *SensitivityM_X ;
    00101     Number *SensitivityM_L ;
    00102     Number *SensitivityM_Z_U ;
    00103     Number *SensitivityM_Z_L ;
    00104
    00105   private:
    00106
    00107     // standard constructor just so it can't be used
    00108     //    SensApplication();
    00109
    00110     // Pointers that are immediately passed from Ipopt and initialized by the constructor
    00111     SmartPtr<Journalist> jnlst_;
    00112     SmartPtr<OptionsList> options_;
    00113     SmartPtr<IpoptData> ip_data_;
    00114     SmartPtr<IpoptCalculatedQuantities> ip_cq_;
    00115     SmartPtr<PDSystemSolver> pd_solver_;
    00116     SmartPtr<IpoptNLP> ip_nlp_;
    00117     SmartPtr<RegisteredOptions> reg_options_;
    00118     ApplicationReturnStatus ipopt_retval_;
    00119
    00120     SmartPtr<SensAlgorithm> controller ;
    00121
    00123     bool run_sens_;
    00124     bool compute_red_hessian_;
    00125     bool compute_dsdp_ ;
    00126     Index n_sens_steps_;
    00127   };
    00128 }
    00129
    00130 #endif

All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines