47 namespace MoochoPack {
59 bool scale_opt_error_by_Gf
62 opt_error_check_(opt_error_check),
63 scale_opt_error_by_(scale_opt_error_by),
64 scale_feas_error_by_(scale_feas_error_by),
65 scale_comp_error_by_(scale_comp_error_by),
66 scale_opt_error_by_Gf_(scale_opt_error_by_Gf)
77 const int local_num_options = 4;
87 const char* local_SOptions[local_num_options] =
90 "scale_feas_error_by",
91 "scale_comp_error_by",
92 "scale_opt_error_by_Gf",
99 const char opt_grp_name[] )
101 OptionsFromStreamPack::SetOptionsFromStreamNode(
102 opt_grp_name, local_num_options, local_SOptions ),
103 OptionsFromStreamPack::SetOptionsToTargetBase<
117 case SCALE_OPT_ERROR_BY:
118 case SCALE_FEAS_ERROR_BY:
119 case SCALE_COMP_ERROR_BY:
121 const std::string &option = option_value.c_str();
124 if( option ==
"SCALE_BY_ONE" )
125 { scale_by = target_t::SCALE_BY_ONE; }
126 else if( option ==
"SCALE_BY_NORM_2_X" )
127 { scale_by = target_t::SCALE_BY_NORM_2_X; }
128 else if( option ==
"SCALE_BY_NORM_INF_X" )
129 { scale_by = target_t::SCALE_BY_NORM_INF_X; }
132 throw std::invalid_argument(
"Error, incorrect value for "
133 "\"scale_kkt_error_by\". Only the options "
134 "SCALE_BY_ONE, SCALE_BY_NORM_2_X, and SCALE_BY_NORM_INF_X "
141 target().scale_opt_error_by(scale_by);
145 target().scale_feas_error_by(scale_by);
149 target().scale_comp_error_by(scale_by);
155 "Unaccounted for option_num in CheckConvergence_Strategy.cpp"
161 case SCALE_OPT_ERROR_BY_GF:
163 target().scale_opt_error_by_Gf(
164 StringToBool(
"scale_opt_error_by_Gf", option_value.c_str() ) );
CheckConvergence_StrategySetOptions(CheckConvergence_Strategy *target=0, const char opt_grp_name[]="CheckConvergenceStrategy")
bool StringToBool(const char *opt_name, const char *str)
Convert a string "true" or "false" into bool #true# or #false#.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void setOption(int option_num, const std::string &option_value)
Overridden from SetOptionsFromStreamNode.
Strategy interface for performing convergence checks.
CheckConvergence_Strategy(EOptErrorCheck opt_error_check=OPT_ERROR_REDUCED_GRADIENT_LAGR, EScaleKKTErrorBy scale_opt_error_by=SCALE_BY_ONE, EScaleKKTErrorBy scale_feas_error_by=SCALE_BY_ONE, EScaleKKTErrorBy scale_comp_error_by=SCALE_BY_ONE, bool scale_opt_error_by_Gf=true)
CheckConvergence_Strategy & target()
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
const std::string & option_value(OptionsGroup::const_iterator &itr)