MoochoPack_LineSearchFilter_Step.hpp

00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
00005 //                  Copyright (2003) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
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 // structure for storing filter points 
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 typedef std::list< FilterEntry > Filter_T;
00057 const std::string FILTER_IQ_STRING = "LS_FilterEntries";
00058 
00063 class LineSearchFilter_Step
00064   : public IterationPack::AlgorithmStep // doxygen needs full path
00065 {
00066 public:
00067     
00070 
00072   static value_type F_MIN_UNBOUNDED;
00073   
00075   
00078   
00083   STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, gamma_theta )
00084 
00085   
00089   STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, gamma_f )
00090 
00097   STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, f_min )
00098 
00103   STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, gamma_alpha )
00104 
00109   STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, delta )
00110   
00115   STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, s_f )
00116 
00121   STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, s_theta )
00122 
00128   STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, theta_small_fact )
00129 
00134   STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, theta_max )
00135 
00140   STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, eta_f )
00141 
00146   STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, back_track_frac )
00147 
00150   LineSearchFilter_Step(
00151     Teuchos::RefCountPtr<NLPInterfacePack::NLP> nlp
00152     ,const std::string         obj_iq_name      = "f"
00153     ,const std::string         grad_obj_iq_name = "Gf"
00154     ,const value_type          &gamma_theta      = 1e-5
00155     ,const value_type          &gamma_f          = 1e-5
00156     ,const value_type          &f_min            = F_MIN_UNBOUNDED
00157     ,const value_type          &gamma_alpha      = 5e-2
00158     ,const value_type          &delta            = 1e-4
00159     ,const value_type          &s_theta          = 1.1
00160     ,const value_type          &s_f              = 2.3
00161     ,const value_type          &theta_small_fact = 1e-4 
00162     ,const value_type          &theta_max        = 1e10
00163     ,const value_type          &eta_f            = 1e-4
00164     ,const value_type          &back_track_frac  = 0.5
00165     );
00166 
00168   
00171   ~LineSearchFilter_Step();
00172 
00174 
00178   bool do_step( Algorithm& algo, poss_type step_poss,
00179                 IterationPack::EDoStepType type,
00180                 poss_type assoc_step_poss);
00182   void print_step( const Algorithm& algo, poss_type step_poss,
00183                    IterationPack::EDoStepType type,
00184                    poss_type assoc_step_poss, std::ostream& out,
00185                    const std::string& leading_str ) const;
00187 
00188 private:
00189 
00190   // /////////////////////////////
00191   // Private data members
00192 
00193   // Private Data
00194   CastIQMember<Filter_T> filter_;
00195 
00197   CastIQMember<value_type> obj_f_;
00198 
00200   CastIQMember<VectorMutable> grad_obj_f_;
00201 
00202   // nlp to use for calculations
00203   Teuchos::RefCountPtr<NLPInterfacePack::NLP> nlp_;
00204 
00205   // /////////////////////////////
00206   // Private member functions
00207 
00208   // Validate input parameters - fix if possible
00209   bool ValidatePoint(
00210     const IterQuantityAccess<VectorMutable>& x,
00211     const IterQuantityAccess<value_type>& f,
00212     const IterQuantityAccess<VectorMutable>* c,
00213     const IterQuantityAccess<VectorMutable>* h,
00214     const bool throw_excpt
00215     ) const;
00216 
00217   // Check that new point is not within taboo region of filter
00218   bool CheckFilterAcceptability(
00219     const value_type f, 
00220     const value_type theta,
00221     const AlgorithmState& s
00222     ) const;
00223   
00224   // Check the Armijo condition on f
00225   bool CheckArmijo(
00226     const value_type Gf_t_dk, 
00227     const value_type alpha_k, 
00228     const IterQuantityAccess<value_type>& f_iq
00229     ) const;
00230 
00231   // Check if f or c has sufficient reduction
00232   bool CheckFractionalReduction(
00233     const IterQuantityAccess<value_type>& f_iq,
00234     const value_type gamma_f_used,
00235     const value_type theta_kp1, 
00236     const value_type theta_k
00237     ) const;
00238 
00239   // Calculate the new point given d and alpha
00240   void UpdatePoint(
00241     const VectorMutable& d,
00242     value_type alpha, 
00243     IterQuantityAccess<VectorMutable>& x,
00244     IterQuantityAccess<value_type>& f,
00245     IterQuantityAccess<VectorMutable>* c,
00246     IterQuantityAccess<VectorMutable>* h,
00247     NLP& nlp
00248     ) const;
00249 
00250   // Calculate the minimum alpha before hitting restoration phase
00251   value_type CalculateAlphaMin(
00252     const value_type gamma_f_used,
00253     const value_type Gf_t_dk, 
00254     const value_type theta_k,
00255     const value_type theta_small
00256     ) const;
00257 
00258   // Calculate the constraint norm
00259   value_type CalculateTheta_k(
00260     const IterQuantityAccess<VectorMutable>* c,
00261     const IterQuantityAccess<VectorMutable>* h,
00262     int k
00263     ) const;
00264 
00265   // Calculate the value of gamma_k to use
00266   value_type CalculateGammaFUsed(
00267     const IterQuantityAccess<value_type> &f,
00268     const value_type theta_k,
00269     const EJournalOutputLevel olevel,
00270     std::ostream &out
00271     ) const;
00272 
00273   // decide if we should switch to Armijo for objective
00274   bool ShouldSwitchToArmijo(
00275     const value_type Gf_t_dk,
00276     const value_type alpha_k,
00277     const value_type theta_k,
00278     const value_type theta_small
00279     ) const;
00280 
00281   // Update the filter from the last iteration
00282   void UpdateFilter( IterationPack::AlgorithmState& s ) const;
00283 
00284   // Update the filter from the last iteration and Augment it with
00285   // the new point
00286   void AugmentFilter(
00287     const value_type gamma_f_used,
00288     const value_type f_with_boundary,
00289     const value_type theta_with_boundary,
00290     IterationPack::AlgorithmState& s,
00291     const EJournalOutputLevel olevel,
00292     std::ostream &out
00293     ) const;
00294     
00295 };  // end class LineSearchFilter_Step
00296 
00297 } // end namespace MoochoPack 
00298 
00299 #endif  // LINE_SEARCH_FILTER_STEP_H

Generated on Thu Sep 18 12:34:28 2008 for MoochoPack : Framework for Large-Scale Optimization Algorithms by doxygen 1.3.9.1