53 const int local_num_options = 8;
57 CONSTR_NORM_THRESHOLD,
60 FORCED_CONSTR_REDUCTION,
66 const char* local_SOptions[local_num_options] = {
68 "constr_norm_threshold",
71 "forced_constr_reduction",
72 "forced_reduct_ratio",
79 namespace MoochoPack {
82 LineSearch2ndOrderCorrect_Step* target
83 ,
const char opt_grp_name[] )
84 : OptionsFromStreamPack::SetOptionsFromStreamNode(
85 opt_grp_name, local_num_options, local_SOptions )
86 , OptionsFromStreamPack::SetOptionsToTargetBase<
87 LineSearch2ndOrderCorrect_Step >( target )
93 typedef LineSearch2ndOrderCorrect_Step target_t;
97 const std::string &option = option_value.c_str();
98 if( option ==
"PRINT_USE_DEFAULT" )
99 target().newton_olevel( target_t::PRINT_USE_DEFAULT );
100 else if( option ==
"PRINT_NOTHING" )
101 target().newton_olevel( target_t::PRINT_NEWTON_NOTHING );
102 else if( option ==
"PRINT_SUMMARY_INFO" )
103 target().newton_olevel( target_t::PRINT_NEWTON_SUMMARY_INFO );
104 else if( option ==
"PRINT_STEPS" )
105 target().newton_olevel( target_t::PRINT_NEWTON_STEPS );
106 else if( option ==
"PRINT_VECTORS" )
107 target().newton_olevel( target_t::PRINT_NEWTON_VECTORS );
109 throw std::invalid_argument(
"Error, incorrect value for "
110 "\"newton_olevel\"." );
113 case CONSTR_NORM_THRESHOLD:
114 target().constr_norm_threshold(::fabs(::atof(option_value.c_str())));
116 case CONSTR_INCR_RATIO:
117 target().constr_incr_ratio(::fabs(::atof(option_value.c_str())));
120 target().after_k_iter(::
abs(::atoi(option_value.c_str())));
122 case FORCED_CONSTR_REDUCTION:
124 const std::string &option = option_value.c_str();
125 if( option ==
"LESS_X_D" )
126 target().forced_constr_reduction(target_t::CONSTR_LESS_X_D );
127 else if( option ==
"LESS_X" )
128 target().forced_constr_reduction( target_t::CONSTR_LESS_X );
130 throw std::invalid_argument(
"Error, incorrect value for "
131 "\"forced_constr_reduction\"." );
134 case FORCED_REDUCT_RATIO:
135 target().forced_reduct_ratio(::fabs(::atof(option_value.c_str())));
138 target().max_step_ratio(::fabs(::atof(option_value.c_str())));
140 case MAX_NEWTON_ITER:
141 target().max_newton_iter(::
abs(::atoi(option_value.c_str())));
void abs(DVectorSlice *vs_lhs, const DVectorSlice &vs_rhs)
vs_lhs = abs(vs_rhs)
LineSearch2ndOrderCorrect_Step & target()
LineSearch2ndOrderCorrect_StepSetOptions(LineSearch2ndOrderCorrect_Step *target=0, const char opt_grp_name[]="LineSearch2ndOrderCorrect")
void setOption(int option_num, const std::string &option_value)
Overridden from SetOptionsFromStreamNode.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
const std::string & option_value(OptionsGroup::const_iterator &itr)