00001 // Copyright 2009 Hans Pirnay 00002 // All Rights Reserved. 00003 // This code is published under the Common Public License. 00004 // 00005 // Date : 2009-05-14 00006 00007 #ifndef __ASSENSSTEPCALC_HPP__ 00008 #define __ASSENSSTEPCALC_HPP__ 00009 00010 #include "IpAlgStrategy.hpp" 00011 #include "AsSchurDriver.hpp" 00012 00013 00014 namespace Ipopt 00015 { 00017 class DenseVector; 00018 class IteratesVector; 00019 00020 class SensitivityStepCalculator : public AlgorithmStrategyObject 00021 { 00022 /* This is the interface for the classes that perform the actual step. */ 00023 00024 public: 00025 SensitivityStepCalculator() 00026 : 00027 driver_(NULL), 00028 do_boundcheck_(false) 00029 { 00030 } 00031 00032 virtual ~SensitivityStepCalculator() 00033 { 00034 } 00035 00036 virtual bool InitializeImpl(const OptionsList& options, 00037 const std::string& prefix) 00038 { 00039 options.GetBoolValue("nmpc_boundcheck", do_boundcheck_, prefix); 00040 return true; 00041 } 00042 00043 bool Do_Boundcheck() const 00044 { 00045 return do_boundcheck_; 00046 } 00047 00048 void SetSchurDriver(SmartPtr<SchurDriver> driver) 00049 { 00050 DBG_ASSERT(IsValid(driver)); 00051 driver_ = driver; 00052 if (IsValid(driver_->pcalc_nonconst())) { 00053 driver_->pcalc_nonconst()->reset_data_A(); 00054 // when the schurdriver is set, the data in the pcalculator has to be reset to its data? 00055 } 00056 } 00057 00058 SmartPtr<SchurDriver> Driver() // this should be const or protected 00059 { 00060 DBG_ASSERT(IsValid(driver_)); 00061 return driver_; 00062 } 00063 00066 virtual bool Step(DenseVector& delta_u, IteratesVector& sol) =0; 00067 00068 00069 private: 00070 SmartPtr<SchurDriver> driver_; 00071 bool do_boundcheck_; 00072 }; 00073 } 00074 00075 #endif