/home/coin/SVN-release/CoinAll-1.1.0/Ipopt/src/contrib/CGPenalty/IpCGPenaltyData.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2007 International Business Machines and others.
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // $Id: IpIpoptData.hpp 988 2007-06-01 21:57:27Z andreasw $
00006 //
00007 // Authors:  Andreas Waechter           IBM     2007-06-04
00008 //                   based on IpIpoptData.hpp
00009 
00010 #ifndef __IPCGPENALTYDATA_HPP__
00011 #define __IPCGPENALTYDATA_HPP__
00012 
00013 #include "IpIteratesVector.hpp"
00014 #include "IpOptionsList.hpp"
00015 
00016 namespace Ipopt
00017 {
00018 
00021   class CGPenaltyData : public ReferencedObject
00022   {
00023   public:
00027     CGPenaltyData();
00028 
00030     ~CGPenaltyData();
00032 
00036     bool Initialize(const Journalist& jnlst,
00037                     const OptionsList& options,
00038                     const std::string& prefix);
00039 
00041     bool InitializeDataStructures();
00042 
00044     SmartPtr<const IteratesVector> delta_cgpen() const;
00045 
00050     void set_delta_cgpen(SmartPtr<IteratesVector>& delta_pen);
00051 
00058     void set_delta_cgpen(SmartPtr<const IteratesVector>& delta_pen);
00059 
00061     SmartPtr<const IteratesVector> delta_cgfast() const;
00062 
00067     void set_delta_cgfast(SmartPtr<IteratesVector>& delta_fast);
00068 
00072     bool HaveCgPenDeltas() const
00073     {
00074       return have_cgpen_deltas_;
00075     }
00076     void SetHaveCgPenDeltas(bool have_cgpen_deltas)
00077     {
00078       have_cgpen_deltas_ = have_cgpen_deltas;
00079     }
00080 
00081     bool HaveCgFastDeltas() const
00082     {
00083       return have_cgfast_deltas_;
00084     }
00085     void SetHaveCgFastDeltas(bool have_cgfast_deltas)
00086     {
00087       have_cgfast_deltas_ = have_cgfast_deltas;
00088     }
00090 
00095     void AcceptTrialPoint();
00097 
00098     Number CurrPenaltyPert()
00099     {
00100       return curr_penalty_pert_;
00101     }
00102     void SetCurrPenaltyPert(Number curr_penalty_pert)
00103     {
00104       curr_penalty_pert_ = curr_penalty_pert;
00105     }
00106 
00107     void SetNeverTryPureNewton(bool never_try_pure_Newton)
00108     {
00109       never_try_pure_Newton_ = never_try_pure_Newton;
00110     }
00111     Index NeverTryPureNewton()
00112     {
00113       return never_try_pure_Newton_;
00114     }
00115 
00116     Index restor_iter()
00117     {
00118       return restor_iter_;
00119     }
00120 
00121     void SetRestorIter(Index restor_iter)
00122     {
00123       restor_iter_ = restor_iter;
00124     }
00125     Number restor_counter()
00126     {
00127       return restor_counter_;
00128     }
00129     void SetRestorCounter(Number restor_counter)
00130     {
00131       restor_counter_ = restor_counter;
00132     }
00133 
00134     void SetPrimalStepSize(Number max_alpha_x)
00135     {
00136       max_alpha_x_ = max_alpha_x;
00137     }
00138     Number PrimalStepSize()
00139     {
00140       return max_alpha_x_;
00141     }
00142 
00143     Number curr_penalty() const
00144     {
00145       DBG_ASSERT(penalty_initialized_);
00146       return curr_penalty_;
00147     }
00148     void Set_penalty(Number penalty)
00149     {
00150       curr_penalty_ = penalty;
00151       penalty_initialized_ = true;
00152     }
00153     void SetPenaltyUninitialized()
00154     {
00155       penalty_initialized_ = false;
00156     }
00157     bool PenaltyInitialized() const
00158     {
00159       return penalty_initialized_;
00160     }
00161     Number curr_kkt_penalty() const
00162     {
00163       DBG_ASSERT(kkt_penalty_initialized_);
00164       return curr_kkt_penalty_;
00165     }
00166     void Set_kkt_penalty(Number kkt_penalty)
00167     {
00168       curr_kkt_penalty_ = kkt_penalty;
00169       kkt_penalty_initialized_ = true;
00170     }
00171     void SetKKTPenaltyUninitialized()
00172     {
00173       kkt_penalty_initialized_ = false;
00174     }
00175     bool KKTPenaltyInitialized() const
00176     {
00177       return kkt_penalty_initialized_;
00178     }
00179 
00180 
00181   private:
00182 
00188     SmartPtr<const IteratesVector> delta_cgpen_;
00194     bool have_cgpen_deltas_;
00196 
00202     SmartPtr<const IteratesVector> delta_cgfast_;
00208     bool have_cgfast_deltas_;
00210 
00214     bool never_try_pure_Newton_;
00215 
00217     Index restor_iter_;
00218     Number restor_counter_;
00219 
00221     Number curr_penalty_;
00222     bool penalty_initialized_;
00223     Number curr_kkt_penalty_;
00224     bool kkt_penalty_initialized_;
00225     Number curr_penalty_pert_;
00226     Number max_alpha_x_;
00228 
00231     bool initialize_called_;
00232 
00242     CGPenaltyData(const CGPenaltyData&);
00243 
00245     void operator=(const CGPenaltyData&);
00247 
00248 #if COIN_IPOPT_CHECKLEVEL > 0
00249 
00253     TaggedObject::Tag debug_delta_cgpen_tag_;
00254     TaggedObject::Tag debug_delta_cgfast_tag_;
00255     TaggedObject::Tag debug_delta_cgpen_tag_sum_;
00256     TaggedObject::Tag debug_delta_cgfast_tag_sum_;
00258 #endif
00259 
00260   };
00261 
00262   inline
00263   SmartPtr<const IteratesVector> CGPenaltyData::delta_cgpen() const
00264   {
00265     DBG_ASSERT(IsNull(delta_cgpen_) || (delta_cgpen_->GetTag() == debug_delta_cgpen_tag_ && delta_cgpen_->GetTagSum() == debug_delta_cgpen_tag_sum_) );
00266 
00267     return delta_cgpen_;
00268   }
00269 
00270   inline
00271   SmartPtr<const IteratesVector> CGPenaltyData::delta_cgfast() const
00272   {
00273     DBG_ASSERT(IsNull(delta_cgfast_) || (delta_cgfast_->GetTag() == debug_delta_cgfast_tag_ && delta_cgfast_->GetTagSum() == debug_delta_cgfast_tag_sum_) );
00274 
00275     return delta_cgfast_;
00276   }
00277 
00278   inline
00279   void CGPenaltyData::set_delta_cgpen(SmartPtr<IteratesVector>& delta_cgpen)
00280   {
00281     delta_cgpen_ = ConstPtr(delta_cgpen);
00282 #if COIN_IPOPT_CHECKLEVEL > 0
00283 
00284     if (IsValid(delta_cgpen)) {
00285       debug_delta_cgpen_tag_ = delta_cgpen->GetTag();
00286       debug_delta_cgpen_tag_sum_ = delta_cgpen->GetTagSum();
00287     }
00288     else {
00289       debug_delta_cgpen_tag_ = 0;
00290       debug_delta_cgpen_tag_sum_ = delta_cgpen->GetTagSum();
00291     }
00292 #endif
00293 
00294     delta_cgpen = NULL;
00295   }
00296 
00297   inline
00298   void CGPenaltyData::set_delta_cgpen(SmartPtr<const IteratesVector>& delta_cgpen)
00299   {
00300     delta_cgpen_ = delta_cgpen;
00301 #if COIN_IPOPT_CHECKLEVEL > 0
00302 
00303     if (IsValid(delta_cgpen)) {
00304       debug_delta_cgpen_tag_ = delta_cgpen->GetTag();
00305       debug_delta_cgpen_tag_sum_ = delta_cgpen->GetTagSum();
00306     }
00307     else {
00308       debug_delta_cgpen_tag_ = 0;
00309       debug_delta_cgpen_tag_sum_ = delta_cgpen->GetTagSum();
00310     }
00311 #endif
00312 
00313     delta_cgpen = NULL;
00314   }
00315 
00316   inline
00317   void CGPenaltyData::set_delta_cgfast(SmartPtr<IteratesVector>& delta_cgfast)
00318   {
00319     delta_cgfast_ = ConstPtr(delta_cgfast);
00320 #if COIN_IPOPT_CHECKLEVEL > 0
00321 
00322     if (IsValid(delta_cgfast)) {
00323       debug_delta_cgfast_tag_ = delta_cgfast->GetTag();
00324       debug_delta_cgfast_tag_sum_ = delta_cgfast->GetTagSum();
00325     }
00326     else {
00327       debug_delta_cgfast_tag_ = 0;
00328       debug_delta_cgfast_tag_sum_ = delta_cgfast->GetTagSum();
00329     }
00330 #endif
00331 
00332     delta_cgfast = NULL;
00333   }
00334 
00335 } // namespace Ipopt
00336 
00337 #endif

Generated on Sun Nov 14 14:06:36 2010 for Coin-All by  doxygen 1.4.7