00001 // Copyright (C) 2005, 2007 International Business Machines and others. 00002 // All Rights Reserved. 00003 // This code is published under the Common Public License. 00004 // 00005 // $Id: IpCGPenaltyLSAcceptor.hpp 551 2005-10-27 00:31:28Z 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 namespace Ipopt 00017 { 00018 00021 class CGPenaltyLSAcceptor : public BacktrackingLSAcceptor 00022 { 00023 public: 00029 CGPenaltyLSAcceptor(const SmartPtr<PDSystemSolver>& pd_solver); 00030 00032 virtual ~CGPenaltyLSAcceptor(); 00034 00036 virtual bool InitializeImpl(const OptionsList& options, 00037 const std::string& prefix); 00038 00045 virtual void Reset(); 00046 00050 virtual void InitThisLineSearch(bool in_watchdog); 00051 00055 virtual void PrepareRestoPhaseStart(); 00056 00061 virtual Number CalculateAlphaMin(); 00062 00068 virtual bool CheckAcceptabilityOfTrialPoint(Number alpha_primal); 00069 00082 virtual bool TrySecondOrderCorrection(Number alpha_primal_test, 00083 Number& alpha_primal, 00084 SmartPtr<IteratesVector>& actual_delta); 00085 00092 virtual bool TryCorrector(Number alpha_primal_test, 00093 Number& alpha_primal, 00094 SmartPtr<IteratesVector>& actual_delta); 00095 00100 virtual char UpdateForNextIteration(Number alpha_primal_test); 00101 00104 virtual void StartWatchDog(); 00105 00108 virtual void StopWatchDog(); 00109 00112 virtual bool RestoredIterate(); 00115 virtual bool NeverRestorationPhase(); 00116 00120 virtual bool DoFallback(); 00121 00124 static void RegisterOptions(SmartPtr<RegisteredOptions> roptions); 00126 00127 private: 00137 CGPenaltyLSAcceptor(const CGPenaltyLSAcceptor&); 00138 00140 void operator=(const CGPenaltyLSAcceptor&); 00142 00143 00145 bool IsAcceptableToPiecewisePenalty(Number alpha_primal_test); 00146 00148 bool ArmijoHolds(Number alpha_primal_test); 00149 00151 //ToDo This should probably not be a static member function if we want to 00152 // allow for different relaxation parameters values 00153 static bool Compare_le(Number lhs, Number rhs, Number BasVal); 00154 00155 bool CurrentIsBest(); 00156 void StoreBestPoint(); 00157 bool RestoreBestPoint(); 00158 bool MultipliersDiverged(); 00159 char UpdatePenaltyParameter(); 00160 00164 Number eta_penalty_; 00167 Number penalty_update_infeasibility_tol_; 00170 Number eta_min_; 00173 Number penalty_update_compl_tol_; 00174 Number chi_hat_; 00175 Number chi_tilde_; 00176 Number chi_cup_; 00177 Number gamma_hat_; 00178 Number gamma_tilde_; 00179 Number penalty_max_; 00180 Number epsilon_c_; 00182 Number piecewisepenalty_gamma_obj_; 00183 Number piecewisepenalty_gamma_infeasi_; 00185 00186 Number pen_theta_max_; 00187 Number pen_theta_max_fact_; 00189 // Number used to indicate that mu has been decreased 00190 Number pen_curr_mu_; 00191 00193 Number theta_min_; 00194 00198 bool accepted_by_Armijo_; 00199 00201 Number min_alpha_primal_; 00202 00204 /*Initial constraint violation*/ 00205 Number reference_theta_; 00207 00208 Index max_soc_; 00212 Number kappa_soc_; 00214 00215 Index counter_first_type_penalty_updates_; 00216 Index counter_second_type_penalty_updates_; 00218 Number curr_eta_; 00219 00221 Index ls_counter_; 00223 Number best_KKT_error_; 00225 SmartPtr<const IteratesVector> best_iterate_; 00227 Number mult_diverg_feasibility_tol_; 00228 Number mult_diverg_y_tol_; 00229 00234 Number reference_penalty_function_; 00237 Number reference_direct_deriv_penalty_function_; 00238 Number reference_curr_direct_f_nrm_; 00241 Number watchdog_penalty_function_; 00244 Number watchdog_direct_deriv_penalty_function_; 00247 SmartPtr<const IteratesVector> watchdog_delta_cgpen_; 00249 00250 bool never_use_piecewise_penalty_ls_; 00251 // piecewise penalty list 00252 PiecewisePenalty PiecewisePenalty_; 00254 bool reset_piecewise_penalty_; 00255 00256 Index jump_for_tiny_step_; 00257 00260 SmartPtr<PDSystemSolver> pd_solver_; 00262 }; 00263 00264 00265 00266 00267 00268 } // namespace Ipopt 00269 00270 #endif