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 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 };
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 };
00159
00160
00161 }
00162
00163 #endif // CHECK_CONVERGENCE_STRATEGY_H