47 #include "ReducedHessianBFGSStd_StepSetOptions.h"
48 #include "OptionsFromStreamPack_StringToBool.hpp"
53 const int local_num_options = 5;
63 const char* local_SOptions[local_num_options] = {
64 "rescale_init_identity"
73 namespace MoochoPack {
75 ReducedHessianBFGSStd_StepSetOptions::ReducedHessianBFGSStd_StepSetOptions(
76 ReducedHessianBFGSStd_Step* target
77 ,
const char opt_grp_name[] )
78 : OptionsFromStreamPack::SetOptionsFromStreamNode(
79 opt_grp_name, local_num_options, local_SOptions )
80 , OptionsFromStreamPack::SetOptionsToTargetBase<
81 ReducedHessianBFGSStd_Step >( target )
84 void ReducedHessianBFGSStd_StepSetOptions::setOption(
85 int option_num,
const std::string& option_value )
87 using OptionsFromStreamPack::StringToBool;
88 typedef ReducedHessianBFGSStd_Step target_t;
89 switch( (local_EOptions)option_num ) {
90 case RESCALE_INIT_IDENTITY:
91 target().rescale_init_identity(
92 StringToBool(
"rescale_init_identity", option_value.c_str() ));
95 target().use_dampening(
96 StringToBool(
"use_dampening", option_value.c_str() ));
100 const std::string &option = option_value.c_str();
101 if( option ==
"DEFAULT" )
102 target().secant_testing( target_t::SECANT_TEST_DEFAULT );
103 else if( option ==
"TEST" )
104 target().secant_testing( target_t::SECANT_TEST_ALWAYS );
105 else if( option ==
"NO_TEST" )
106 target().secant_testing( target_t::SECANT_NO_TEST );
108 throw std::invalid_argument(
"Error, incorrect value for "
109 "\"secant_testing\"." );
112 case SECANT_WARNING_TOL:
113 target().secant_warning_tol(::fabs(::atof(option_value.c_str())));
115 case SECANT_ERROR_TOL:
116 target().secant_error_tol(::fabs(::atof(option_value.c_str())));
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)