|
MoochoPack : Framework for Large-Scale Optimization Algorithms Version of the Day
|
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 CHECK_CONVERGENCE_STRATEGY_H 00030 #define CHECK_CONVERGENCE_STRATEGY_H 00031 00032 #include "MoochoPack_Types.hpp" 00033 #include "Teuchos_StandardMemberCompositionMacros.hpp" 00034 #include "OptionsFromStreamPack_SetOptionsFromStreamNode.hpp" 00035 #include "OptionsFromStreamPack_SetOptionsToTargetBase.hpp" 00036 00037 namespace MoochoPack { 00038 00047 class CheckConvergence_Strategy 00048 { 00049 public: 00050 00051 enum EOptErrorCheck 00052 { 00053 OPT_ERROR_REDUCED_GRADIENT_LAGR, 00054 OPT_ERROR_GRADIENT_LAGR 00055 }; 00056 00060 STANDARD_MEMBER_COMPOSITION_MEMBERS( EOptErrorCheck, opt_error_check ); 00061 00062 enum EScaleKKTErrorBy 00063 { 00064 SCALE_BY_ONE, 00065 SCALE_BY_NORM_2_X, 00066 SCALE_BY_NORM_INF_X 00067 }; 00068 00072 STANDARD_MEMBER_COMPOSITION_MEMBERS( EScaleKKTErrorBy, scale_opt_error_by ); 00073 00074 00078 STANDARD_MEMBER_COMPOSITION_MEMBERS( EScaleKKTErrorBy, scale_feas_error_by ); 00079 00080 00084 STANDARD_MEMBER_COMPOSITION_MEMBERS( EScaleKKTErrorBy, scale_comp_error_by ); 00085 00086 00090 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, scale_opt_error_by_Gf ); 00091 00093 CheckConvergence_Strategy( 00094 EOptErrorCheck opt_error_check = OPT_ERROR_REDUCED_GRADIENT_LAGR, 00095 EScaleKKTErrorBy scale_opt_error_by = SCALE_BY_ONE, 00096 EScaleKKTErrorBy scale_feas_error_by = SCALE_BY_ONE, 00097 EScaleKKTErrorBy scale_comp_error_by = SCALE_BY_ONE, 00098 bool scale_opt_error_by_Gf = true 00099 ); 00100 00102 virtual bool Converged( Algorithm& _algo)=0; 00103 00105 virtual void print_step( const Algorithm& _algo, std::ostream& out, const std::string& L ) const =0; 00106 00107 00108 }; // end interface CheckConvergence_Strategy 00109 00110 00141 class CheckConvergence_StrategySetOptions 00142 : public OptionsFromStreamPack::SetOptionsFromStreamNode, 00143 public OptionsFromStreamPack::SetOptionsToTargetBase< 00144 CheckConvergence_Strategy > 00145 { 00146 public: 00147 00149 CheckConvergence_StrategySetOptions( 00150 CheckConvergence_Strategy* target = 0 00151 , const char opt_grp_name[] = "CheckConvergenceStrategy" ); 00152 00153 protected: 00154 00156 void setOption( int option_num, const std::string& option_value ); 00157 00158 }; // end class CheckConvergence_Strategy 00159 00160 00161 } // end namespace MoochoPack 00162 00163 #endif // CHECK_CONVERGENCE_STRATEGY_H
1.7.4