00001 // Copyright (C) 2005, 2008 International Business Machines and others. 00002 // All Rights Reserved. 00003 // This code is published under the Eclipse Public License. 00004 // 00005 // $Id: IpCGPenaltyLSAcceptor.hpp 1861 2010-12-21 21:34:47Z andreasw $ 00006 // 00007 // Authors: Andreas Waechter IBM 2005-10-13 00008 00009 #ifndef __IPCGPENALTYLSACCEPTOR_HPP__ 00010 #define __IPCGPENALTYLSACCEPTOR_HPP__ 00011 00012 #include "IpPiecewisePenalty.hpp" 00013 #include "IpBacktrackingLSAcceptor.hpp" 00014 #include "IpPDSystemSolver.hpp" 00015 #include "IpIpoptAlg.hpp" 00016 #include "IpCGPenaltyCq.hpp" 00017 00018 namespace Ipopt 00019 { 00020 00023 class CGPenaltyLSAcceptor : public BacktrackingLSAcceptor 00024 { 00025 public: 00031 CGPenaltyLSAcceptor(const SmartPtr<PDSystemSolver>& pd_solver); 00032 00034 virtual ~CGPenaltyLSAcceptor(); 00036 00038 virtual bool InitializeImpl(const OptionsList& options, 00039 const std::string& prefix); 00040 00047 virtual void Reset(); 00048 00052 virtual void InitThisLineSearch(bool in_watchdog); 00053 00057 virtual void PrepareRestoPhaseStart(); 00058 00063 virtual Number CalculateAlphaMin(); 00064 00070 virtual bool CheckAcceptabilityOfTrialPoint(Number alpha_primal); 00071 00084 virtual bool TrySecondOrderCorrection(Number alpha_primal_test, 00085 Number& alpha_primal, 00086 SmartPtr<IteratesVector>& actual_delta); 00087 00094 virtual bool TryCorrector(Number alpha_primal_test, 00095 Number& alpha_primal, 00096 SmartPtr<IteratesVector>& actual_delta); 00097 00102 virtual char UpdateForNextIteration(Number alpha_primal_test); 00103 00106 virtual void StartWatchDog(); 00107 00110 virtual void StopWatchDog(); 00111 00114 virtual bool RestoredIterate(); 00117 virtual bool NeverRestorationPhase(); 00118 00122 virtual bool DoFallback(); 00123 00126 static void RegisterOptions(SmartPtr<RegisteredOptions> roptions); 00128 00129 private: 00139 CGPenaltyLSAcceptor(const CGPenaltyLSAcceptor&); 00140 00142 void operator=(const CGPenaltyLSAcceptor&); 00144 00146 CGPenaltyData& CGPenData() 00147 { 00148 CGPenaltyData& cg_pen_data = 00149 static_cast<CGPenaltyData&>(IpData().AdditionalData()); 00150 DBG_ASSERT(dynamic_cast<CGPenaltyData*>(&IpData().AdditionalData())); 00151 return cg_pen_data; 00152 } 00153 00155 CGPenaltyCq& CGPenCq() 00156 { 00157 CGPenaltyCq& cg_pen_cq = 00158 static_cast<CGPenaltyCq&>(IpCq().AdditionalCq()); 00159 DBG_ASSERT(dynamic_cast<CGPenaltyCq*>(&IpCq().AdditionalCq())); 00160 return cg_pen_cq; 00161 } 00162 00164 bool IsAcceptableToPiecewisePenalty(Number alpha_primal_test); 00165 00167 bool ArmijoHolds(Number alpha_primal_test); 00168 00170 //ToDo This should probably not be a static member function if we want to 00171 // allow for different relaxation parameters values 00172 static bool Compare_le(Number lhs, Number rhs, Number BasVal); 00173 00174 bool CurrentIsBest(); 00175 void StoreBestPoint(); 00176 bool RestoreBestPoint(); 00177 bool MultipliersDiverged(); 00178 char UpdatePenaltyParameter(); 00179 00183 Number eta_penalty_; 00186 Number penalty_update_infeasibility_tol_; 00189 Number eta_min_; 00192 Number penalty_update_compl_tol_; 00193 Number chi_hat_; 00194 Number chi_tilde_; 00195 Number chi_cup_; 00196 Number gamma_hat_; 00197 Number gamma_tilde_; 00198 Number penalty_max_; 00199 Number epsilon_c_; 00201 Number piecewisepenalty_gamma_obj_; 00202 Number piecewisepenalty_gamma_infeasi_; 00204 00205 Number pen_theta_max_; 00206 Number pen_theta_max_fact_; 00208 // Number used to indicate that mu has been decreased 00209 Number pen_curr_mu_; 00210 00212 Number theta_min_; 00213 00217 bool accepted_by_Armijo_; 00218 00220 Number min_alpha_primal_; 00221 00223 /*Initial constraint violation*/ 00224 Number reference_theta_; 00226 00227 Index max_soc_; 00231 Number kappa_soc_; 00233 00234 Index counter_first_type_penalty_updates_; 00235 Index counter_second_type_penalty_updates_; 00237 Number curr_eta_; 00238 00240 Index ls_counter_; 00242 Number best_KKT_error_; 00244 SmartPtr<const IteratesVector> best_iterate_; 00246 Number mult_diverg_feasibility_tol_; 00247 Number mult_diverg_y_tol_; 00248 00253 Number reference_penalty_function_; 00256 Number reference_direct_deriv_penalty_function_; 00257 Number reference_curr_direct_f_nrm_; 00260 Number watchdog_penalty_function_; 00263 Number watchdog_direct_deriv_penalty_function_; 00266 SmartPtr<const IteratesVector> watchdog_delta_cgpen_; 00268 00269 bool never_use_piecewise_penalty_ls_; 00270 // piecewise penalty list 00271 PiecewisePenalty PiecewisePenalty_; 00273 bool reset_piecewise_penalty_; 00274 00275 Index jump_for_tiny_step_; 00276 00279 SmartPtr<PDSystemSolver> pd_solver_; 00281 }; 00282 00283 00284 00285 00286 00287 } // namespace Ipopt 00288 00289 #endif