Ipopt
trunk
|
00001 // Copyright (C) 2004, 2009 International Business Machines and others. 00002 // All Rights Reserved. 00003 // This code is published under the Eclipse Public License. 00004 // 00005 // $Id$ 00006 // 00007 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 00008 // Andreas Waechter IBM 2005-10-13 00009 // derived file from IpFilterLineSearch.hpp 00010 00011 #ifndef __IPBACKTRACKINGLINESEARCH_HPP__ 00012 #define __IPBACKTRACKINGLINESEARCH_HPP__ 00013 00014 #include "IpLineSearch.hpp" 00015 #include "IpBacktrackingLSAcceptor.hpp" 00016 #include "IpRestoPhase.hpp" 00017 #include "IpConvCheck.hpp" 00018 00019 namespace Ipopt 00020 { 00021 00036 class BacktrackingLineSearch : public LineSearch 00037 { 00038 public: 00048 BacktrackingLineSearch(const SmartPtr<BacktrackingLSAcceptor>& acceptor, 00049 const SmartPtr<RestorationPhase>& resto_phase, 00050 const SmartPtr<ConvergenceCheck>& conv_check 00051 ); 00052 00054 virtual ~BacktrackingLineSearch(); 00056 00058 virtual bool InitializeImpl(const OptionsList& options, 00059 const std::string& prefix); 00060 00064 virtual void FindAcceptableTrialPoint(); 00065 00072 virtual void Reset(); 00073 00085 virtual void SetRigorousLineSearch(bool rigorous) 00086 { 00087 rigorous_ = rigorous; 00088 } 00089 00094 virtual bool CheckSkippedLineSearch() 00095 { 00096 return skipped_line_search_; 00097 } 00098 00101 virtual bool ActivateFallbackMechanism(); 00102 00105 static void RegisterOptions(SmartPtr<RegisteredOptions> roptions); 00107 00108 private: 00118 BacktrackingLineSearch(const BacktrackingLineSearch&); 00119 00121 void operator=(const BacktrackingLineSearch&); 00123 00128 bool DoBacktrackingLineSearch(bool skip_first_trial_point, 00129 Number& alpha_primal, 00130 bool& corr_taken, 00131 bool& soc_taken, 00132 Index& n_steps, 00133 bool& evaluation_error, 00134 SmartPtr<IteratesVector>& actual_delta); 00135 00138 void StartWatchDog(); 00139 00142 void StopWatchDog(SmartPtr<IteratesVector>& actual_delta); 00143 00149 bool CheckAcceptabilityOfTrialPoint(Number alpha_primal); 00150 00156 void PerformDualStep(Number alpha_primal, 00157 Number alpha_dual, 00158 SmartPtr<IteratesVector>& delta); 00159 00169 bool TrySoftRestoStep(SmartPtr<IteratesVector>& actual_delta, 00170 bool &satisfies_original_criterion); 00171 00183 bool TrySecondOrderCorrection(Number alpha_primal_test, 00184 Number& alpha_primal, 00185 SmartPtr<IteratesVector>& actual_delta); 00186 00193 bool TryCorrector(Number alpha_primal_test, 00194 Number& alpha_primal, 00195 SmartPtr<IteratesVector>& actual_delta); 00196 00201 void PerformMagicStep(); 00202 00206 bool DetectTinyStep(); 00207 00209 void StoreAcceptablePoint(); 00210 00213 bool RestoreAcceptablePoint(); 00214 00219 bool CurrentIsAcceptable(); 00220 00225 Number alpha_red_factor_; 00226 00228 enum AlphaForYEnum 00229 { 00230 PRIMAL_ALPHA_FOR_Y=0, 00231 DUAL_ALPHA_FOR_Y, 00232 MIN_ALPHA_FOR_Y, 00233 MAX_ALPHA_FOR_Y, 00234 FULL_STEP_FOR_Y, 00235 MIN_DUAL_INFEAS_ALPHA_FOR_Y, 00236 SAFE_MIN_DUAL_INFEAS_ALPHA_FOR_Y, 00237 PRIMAL_AND_FULL_ALPHA_FOR_Y, 00238 DUAL_AND_FULL_ALPHA_FOR_Y, 00239 LSACCEPTOR_ALPHA_FOR_Y 00240 }; 00245 AlphaForYEnum alpha_for_y_; 00246 00249 Number alpha_for_y_tol_; 00250 00254 Number soft_resto_pderror_reduction_factor_; 00258 Index max_soft_resto_iters_; 00259 00261 bool magic_steps_; 00264 bool accept_every_trial_step_; 00268 Index accept_after_max_steps_; 00273 bool expect_infeasible_problem_; 00278 Number expect_infeasible_problem_ctol_; 00283 Number expect_infeasible_problem_ytol_; 00284 00286 Number tiny_step_tol_; 00287 00292 Number tiny_step_y_tol_; 00293 00295 Index watchdog_trial_iter_max_; 00297 Index watchdog_shortened_iter_trigger_; 00298 00301 bool start_with_resto_; 00303 00307 bool in_watchdog_; 00309 Index watchdog_shortened_iter_; 00311 Index watchdog_trial_iter_; 00313 Number watchdog_alpha_primal_test_; 00315 SmartPtr<const IteratesVector> watchdog_iterate_; 00317 SmartPtr<const IteratesVector> watchdog_delta_; 00319 Number last_mu_; 00321 00325 SmartPtr<const IteratesVector> acceptable_iterate_; 00326 Index acceptable_iteration_number_; 00328 00331 bool fallback_activated_; 00332 00337 bool rigorous_; 00338 00341 bool skipped_line_search_; 00342 00347 bool in_soft_resto_phase_; 00348 00351 Index soft_resto_counter_; 00352 00355 Index count_successive_shortened_steps_; 00356 00359 bool tiny_step_last_iteration_; 00360 00363 SmartPtr<BacktrackingLSAcceptor> acceptor_; 00364 SmartPtr<RestorationPhase> resto_phase_; 00365 SmartPtr<ConvergenceCheck> conv_check_; 00367 }; 00368 00369 } // namespace Ipopt 00370 00371 #endif