00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef LINE_SEARCH_FILTER_STEP_H
00030 #define LINE_SEARCH_FILTER_STEP_H
00031
00032 #include <list>
00033
00034 #include "MoochoPack_Types.hpp"
00035 #include "IterationPack_AlgorithmStep.hpp"
00036 #include "IterationPack_CastIQMember.hpp"
00037 #include "Teuchos_StandardCompositionMacros.hpp"
00038 #include "Teuchos_StandardMemberCompositionMacros.hpp"
00039
00040 #include "IterationPack_AlgorithmState.hpp"
00041
00042 namespace MoochoPack {
00043
00044
00045 class FilterEntry
00046 {
00047 public:
00048 FilterEntry( value_type new_f, value_type new_theta, int new_iter)
00049 : f(new_f), theta(new_theta), iter(new_iter) {}
00050
00051 value_type f;
00052 value_type theta;
00053 int iter;
00054 };
00055
00056
00057
00058 typedef std::list< FilterEntry > Filter_T;
00059
00060 const std::string FILTER_IQ_STRING = "LS_FilterEntries";
00061
00066 class LineSearchFilter_Step
00067 : public IterationPack::AlgorithmStep
00068 {
00069 public:
00070
00073
00075 static value_type F_MIN_UNBOUNDED;
00076
00078
00081
00086 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, gamma_theta );
00087
00092 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, gamma_f );
00093
00100 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, f_min );
00101
00106 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, gamma_alpha );
00107
00112 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, delta );
00113
00118 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, s_f );
00119
00124 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, s_theta );
00125
00131 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, theta_small_fact );
00132
00137 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, theta_max );
00138
00143 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, eta_f );
00144
00149 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, back_track_frac );
00150
00153 LineSearchFilter_Step(
00154 Teuchos::RCP<NLPInterfacePack::NLP> nlp
00155 ,const std::string obj_iq_name = "f"
00156 ,const std::string grad_obj_iq_name = "Gf"
00157 ,const value_type &gamma_theta = 1e-5
00158 ,const value_type &gamma_f = 1e-5
00159 ,const value_type &f_min = F_MIN_UNBOUNDED
00160 ,const value_type &gamma_alpha = 5e-2
00161 ,const value_type &delta = 1e-4
00162 ,const value_type &s_theta = 1.1
00163 ,const value_type &s_f = 2.3
00164 ,const value_type &theta_small_fact = 1e-4
00165 ,const value_type &theta_max = 1e10
00166 ,const value_type &eta_f = 1e-4
00167 ,const value_type &back_track_frac = 0.5
00168 );
00169
00171
00174 ~LineSearchFilter_Step();
00175
00177
00181 bool do_step( Algorithm& algo, poss_type step_poss,
00182 IterationPack::EDoStepType type,
00183 poss_type assoc_step_poss);
00185 void print_step( const Algorithm& algo, poss_type step_poss,
00186 IterationPack::EDoStepType type,
00187 poss_type assoc_step_poss, std::ostream& out,
00188 const std::string& leading_str ) const;
00190
00191 private:
00192
00193
00194
00195
00196
00197 CastIQMember<Filter_T> filter_;
00198
00200 CastIQMember<value_type> obj_f_;
00201
00203 CastIQMember<VectorMutable> grad_obj_f_;
00204
00205
00206 Teuchos::RCP<NLPInterfacePack::NLP> nlp_;
00207
00208
00209
00210
00211
00212 bool ValidatePoint(
00213 const IterQuantityAccess<VectorMutable>& x,
00214 const IterQuantityAccess<value_type>& f,
00215 const IterQuantityAccess<VectorMutable>* c,
00216 const IterQuantityAccess<VectorMutable>* h,
00217 const bool throw_excpt
00218 ) const;
00219
00220
00221 bool CheckFilterAcceptability(
00222 const value_type f,
00223 const value_type theta,
00224 const AlgorithmState& s
00225 ) const;
00226
00227
00228 bool CheckArmijo(
00229 const value_type Gf_t_dk,
00230 const value_type alpha_k,
00231 const IterQuantityAccess<value_type>& f_iq
00232 ) const;
00233
00234
00235 bool CheckFractionalReduction(
00236 const IterQuantityAccess<value_type>& f_iq,
00237 const value_type gamma_f_used,
00238 const value_type theta_kp1,
00239 const value_type theta_k
00240 ) const;
00241
00242
00243 void UpdatePoint(
00244 const VectorMutable& d,
00245 value_type alpha,
00246 IterQuantityAccess<VectorMutable>& x,
00247 IterQuantityAccess<value_type>& f,
00248 IterQuantityAccess<VectorMutable>* c,
00249 IterQuantityAccess<VectorMutable>* h,
00250 NLP& nlp
00251 ) const;
00252
00253
00254 value_type CalculateAlphaMin(
00255 const value_type gamma_f_used,
00256 const value_type Gf_t_dk,
00257 const value_type theta_k,
00258 const value_type theta_small
00259 ) const;
00260
00261
00262 value_type CalculateTheta_k(
00263 const IterQuantityAccess<VectorMutable>* c,
00264 const IterQuantityAccess<VectorMutable>* h,
00265 int k
00266 ) const;
00267
00268
00269 value_type CalculateGammaFUsed(
00270 const IterQuantityAccess<value_type> &f,
00271 const value_type theta_k,
00272 const EJournalOutputLevel olevel,
00273 std::ostream &out
00274 ) const;
00275
00276
00277 bool ShouldSwitchToArmijo(
00278 const value_type Gf_t_dk,
00279 const value_type alpha_k,
00280 const value_type theta_k,
00281 const value_type theta_small
00282 ) const;
00283
00284
00285 void UpdateFilter( IterationPack::AlgorithmState& s ) const;
00286
00287
00288
00289 void AugmentFilter(
00290 const value_type gamma_f_used,
00291 const value_type f_with_boundary,
00292 const value_type theta_with_boundary,
00293 IterationPack::AlgorithmState& s,
00294 const EJournalOutputLevel olevel,
00295 std::ostream &out
00296 ) const;
00297
00298 };
00299
00300 }
00301
00302 #endif // LINE_SEARCH_FILTER_STEP_H