45 #include "MoochoPack_NLPSolverClientInterfaceSetOptions.hpp"
46 #include "OptionsFromStreamPack_StringToBool.hpp"
51 const int local_num_options = 13;
61 NULL_SPACE_JOURNAL_OUTPUT_LEVEL,
66 CALC_MATRIX_INFO_NULL_SPACE_ONLY
69 const char* local_SOptions[local_num_options] = {
76 (
"journal_output_level"),
77 (
"null_space_journal_output_level"),
78 (
"journal_print_digits"),
80 (
"calc_conditioning"),
81 (
"calc_matrix_norms"),
82 (
"calc_matrix_info_null_space_only")
87 namespace MoochoPack {
91 ,
const char opt_grp_name[] )
92 : OptionsFromStreamPack::SetOptionsFromStreamNode(
93 opt_grp_name, local_num_options, local_SOptions )
94 , OptionsFromStreamPack::SetOptionsToTargetBase<
99 int option_num,
const std::string& option_value )
101 namespace ofsp = OptionsFromStreamPack;
102 using ofsp::StringToBool;
105 switch( (local_EOptions)option_num ) {
107 target().max_iter(std::abs(std::atoi(option_value.c_str())));
110 target().max_run_time(std::fabs(std::atof(option_value.c_str())));
113 target().opt_tol(std::fabs(std::atof(option_value.c_str())));
116 target().feas_tol(std::fabs(std::atof(option_value.c_str())));
119 target().comp_tol(std::fabs(std::atof(option_value.c_str())));
122 target().step_tol(std::fabs(std::atof(option_value.c_str())));
124 case JOURNAL_OUTPUT_LEVEL:
126 if( option_value ==
"PRINT_NOTHING" )
127 target().journal_output_level(PRINT_NOTHING);
128 else if( option_value ==
"PRINT_BASIC_ALGORITHM_INFO" )
129 target().journal_output_level(PRINT_BASIC_ALGORITHM_INFO);
130 else if( option_value ==
"PRINT_ALGORITHM_STEPS" )
131 target().journal_output_level(PRINT_ALGORITHM_STEPS);
132 else if( option_value ==
"PRINT_ACTIVE_SET" )
133 target().journal_output_level(PRINT_ACTIVE_SET);
134 else if( option_value ==
"PRINT_VECTORS" )
135 target().journal_output_level(PRINT_VECTORS);
136 else if( option_value ==
"PRINT_ITERATION_QUANTITIES" )
137 target().journal_output_level(PRINT_ITERATION_QUANTITIES);
140 true,std::invalid_argument
141 ,
"NLPSolverClientInterfaceSetOptions::setOption(...) : "
142 "Error, incorrect value \""<<option_value<<
"\" for \"journal_output_level\"." );
143 if((
int)
target().null_space_journal_output_level() <= (
int)PRINT_ALGORITHM_STEPS)
144 target().null_space_journal_output_level(
target().journal_output_level());
147 case NULL_SPACE_JOURNAL_OUTPUT_LEVEL:
149 if( option_value ==
"DEFAULT" )
150 target().null_space_journal_output_level(
target().journal_output_level());
151 else if( option_value ==
"PRINT_ACTIVE_SET" )
152 target().null_space_journal_output_level(PRINT_ACTIVE_SET);
153 else if( option_value ==
"PRINT_VECTORS" )
154 target().null_space_journal_output_level(PRINT_VECTORS);
155 else if( option_value ==
"PRINT_ITERATION_QUANTITIES" )
156 target().null_space_journal_output_level(PRINT_ITERATION_QUANTITIES);
159 true,std::invalid_argument
160 ,
"NLPSolverClientInterfaceSetOptions::setOption(...) : "
161 "Error, incorrect value \""<<option_value<<
"\" for \"null_space_journal_output_level\"." );
164 case JOURNAL_PRINT_DIGITS:
165 target().journal_print_digits(std::abs(std::atoi(option_value.c_str())));
169 StringToBool(
"check_results", option_value.c_str() )
172 case CALC_CONDITIONING:
173 target().calc_conditioning(
174 StringToBool(
"calc_conditioning", option_value.c_str() )
177 case CALC_MATRIX_NORMS:
178 target().calc_matrix_norms(
179 StringToBool(
"calc_matrix_norms", option_value.c_str() )
182 case CALC_MATRIX_INFO_NULL_SPACE_ONLY:
183 target().calc_matrix_info_null_space_only(
184 StringToBool(
"calc_matrix_info_null_space_only", option_value.c_str() )
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
NLPSolverClientInterfaceSetOptions(NLPSolverClientInterface *target=0, const char opt_grp_name[]="NLPSolverClientInterface")
void setOption(int option_num, const std::string &option_value)
Overridden from SetOptionsFromStreamNode.
This is the most basic interface that clients use to solve an NLP.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)