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 __SENSALGORITHM_HPP__ 00008 #define __SENSALGORITHM_HPP__ 00009 00010 #include "IpAlgStrategy.hpp" 00011 #include "SensStepCalc.hpp" 00012 #include "SensMeasurement.hpp" 00013 #include "SensSchurDriver.hpp" 00014 #include "SensUtils.hpp" 00015 00016 namespace Ipopt 00017 { 00018 00019 class SensAlgorithm : public AlgorithmStrategyObject 00020 { 00024 public: 00025 00026 SensAlgorithm(std::vector< SmartPtr<SchurDriver> >& driver_vec, 00027 SmartPtr<SensitivityStepCalculator> sens_step_calc, 00028 SmartPtr<Measurement> measurement, 00029 Index n_sens_steps); 00030 00031 virtual ~SensAlgorithm(); 00032 00033 virtual bool InitializeImpl(const OptionsList& options, 00034 const std::string& prefix); 00035 00039 SensAlgorithmExitStatus Run(); 00040 SensAlgorithmExitStatus ComputeSensitivityMatrix(void); 00041 00042 00044 Index nl(void) { return nl_ ; } 00045 Index nx(void) { return nx_ ; } 00046 Index nzl(void) {return nzl_ ; } 00047 Index nzu(void) {return nzu_ ; } 00048 Index ns(void) {return ns_ ; } 00049 Index np(void) {return np_ ; } 00050 00052 Number *DirectionalD_X_ ; 00053 Number *DirectionalD_L_ ; 00054 Number *DirectionalD_Z_U_ ; 00055 Number *DirectionalD_Z_L_ ; 00056 00058 Number *SensitivityM_X_ ; 00059 Number *SensitivityM_L_ ; 00060 Number *SensitivityM_Z_U_ ; 00061 Number *SensitivityM_Z_L_ ; 00062 00063 private: 00064 00065 Index nl_ ; 00066 Index nx_ ; 00067 Index nzl_ ; 00068 Index nzu_ ; 00069 Index nceq_ ; 00070 Index ncineq_ ; 00071 Index ns_ ; 00072 Index np_ ; 00073 00074 std::vector< SmartPtr<SchurDriver> > driver_vec_; 00075 SmartPtr<SensitivityStepCalculator> sens_step_calc_; 00076 SmartPtr<Measurement> measurement_; 00077 Index n_sens_steps_; // I think it is useful to state this number explicitly in the constructor and here. 00078 00080 void GetDirectionalDerivatives(void) ; 00081 00083 void GetSensitivityMatrix(Index col) ; 00084 00086 void UnScaleIteratesVector(SmartPtr<IteratesVector> *V) ; 00087 }; 00088 } 00089 00090 #endif