45 #include "ConstrainedOptPack_QPSolverRelaxedQPSchurSetOptions.hpp"
46 #include "OptionsFromStreamPack_StringToBool.hpp"
51 const int local_num_options = 22;
56 ,INEQUALITY_PICK_POLICY
71 ,ITER_REFINE_AT_SOLUTION
74 ,PIVOT_WRONG_INERTIA_TOL
78 const char* local_SOptions[local_num_options] = {
81 ,
"inequality_pick_policy"
92 ,
"iter_refine_min_iter"
93 ,
"iter_refine_max_iter"
94 ,
"iter_refine_opt_tol"
95 ,
"iter_refine_feas_tol"
96 ,
"iter_refine_at_solution"
99 ,
"pivot_wrong_inertia_tol"
105 namespace ConstrainedOptPack {
109 ,
const char opt_grp_name[] )
110 : OptionsFromStreamPack::SetOptionsFromStreamNode(
111 opt_grp_name, local_num_options, local_SOptions )
112 , OptionsFromStreamPack::SetOptionsToTargetBase<
117 int option_num,
const std::string& option_value )
119 using OptionsFromStreamPack::StringToBool;
122 switch( (local_EOptions)option_num ) {
123 case MAX_QP_ITER_FRAC:
124 target().max_qp_iter_frac(std::fabs(std::atof(option_value.c_str())));
126 case MAX_REAL_RUNTIME:
127 target().max_real_runtime(std::fabs(std::atof(option_value.c_str())));
129 case INEQUALITY_PICK_POLICY:
130 if( option_value ==
"ADD_BOUNDS_THEN_MOST_VIOLATED_INEQUALITY" )
131 target().inequality_pick_policy( constr_t::ADD_BOUNDS_THEN_MOST_VIOLATED_INEQUALITY );
132 else if( option_value ==
"ADD_BOUNDS_THEN_FIRST_VIOLATED_INEQUALITY" )
133 target().inequality_pick_policy( constr_t::ADD_BOUNDS_THEN_FIRST_VIOLATED_INEQUALITY );
134 else if( option_value ==
"ADD_MOST_VIOLATED_BOUNDS_AND_INEQUALITY" )
135 target().inequality_pick_policy( constr_t::ADD_MOST_VIOLATED_BOUNDS_AND_INEQUALITY );
137 throw std::invalid_argument(
"QPSolverRelaxedQPSchurSetOptions::"
138 "setOption(...) : Error, only the values of\n"
139 " ADD_BOUNDS_THEN_MOST_VIOLATED_INEQUALITY\n"
140 ", ADD_BOUNDS_THEN_FIRST_VIOLATED_INEQUALITY and"
141 " ADD_MOST_VIOLATED_BOUNDS_AND_INEQUALITY \nare valid for the option"
142 " \"QPSolverRelaxedQPSchur::inequality_pick_policy\"" );
145 target().bounds_tol(std::fabs(std::atof(option_value.c_str())));
148 target().inequality_tol(std::fabs(std::atof(option_value.c_str())));
151 target().equality_tol(std::fabs(std::atof(option_value.c_str())));
154 target().loose_feas_tol(std::fabs(std::atof(option_value.c_str())));
156 case DUAL_INFEAS_TOL:
157 target().dual_infeas_tol(std::fabs(std::atof(option_value.c_str())));
159 case HUGE_PRIMAL_STEP:
160 target().huge_primal_step(std::fabs(std::atof(option_value.c_str())));
163 target().huge_dual_step(std::fabs(std::atof(option_value.c_str())));
166 target().bigM(std::fabs(std::atof(option_value.c_str())));
169 target().warning_tol(std::fabs(std::atof(option_value.c_str())));
172 target().error_tol(std::fabs(std::atof(option_value.c_str())));
175 case ITER_REFINE_MIN_ITER:
176 target().iter_refine_min_iter(std::abs(std::atoi(option_value.c_str())));
178 case ITER_REFINE_MAX_ITER:
179 target().iter_refine_max_iter(std::abs(std::atoi(option_value.c_str())));
181 case ITER_REFINE_OPT_TOL:
182 target().iter_refine_opt_tol(std::fabs(std::atof(option_value.c_str())));
184 case ITER_REFINE_FEAS_TOL:
185 target().iter_refine_feas_tol(std::fabs(std::atof(option_value.c_str())));
187 case ITER_REFINE_AT_SOLUTION:
188 target().iter_refine_at_solution(StringToBool(
"iter_refine_at_solution", option_value.c_str() ));
190 case PIVOT_WARNING_TOL:
191 target().pivot_warning_tol(std::fabs(std::atof(option_value.c_str())));
193 case PIVOT_SINGULAR_TOL:
194 target().pivot_singular_tol(std::fabs(std::atof(option_value.c_str())));
196 case PIVOT_WRONG_INERTIA_TOL:
197 target().pivot_wrong_inertia_tol(std::fabs(std::atof(option_value.c_str())));
200 if( option_value ==
"USE_INPUT_ARG" )
201 target().print_level( target_t::USE_INPUT_ARG );
202 else if( option_value ==
"NO_OUTPUT" )
203 target().print_level( target_t::NO_OUTPUT );
204 else if( option_value ==
"OUTPUT_BASIC_INFO" )
205 target().print_level( target_t::OUTPUT_BASIC_INFO );
206 else if( option_value ==
"OUTPUT_ITER_SUMMARY" )
207 target().print_level( target_t::OUTPUT_ITER_SUMMARY );
208 else if( option_value ==
"OUTPUT_ITER_STEPS" )
209 target().print_level( target_t::OUTPUT_ITER_STEPS );
210 else if( option_value ==
"OUTPUT_ACT_SET" )
211 target().print_level( target_t::OUTPUT_ACT_SET );
212 else if( option_value ==
"OUTPUT_ITER_QUANTITIES" )
213 target().print_level( target_t::OUTPUT_ITER_QUANTITIES );
215 throw std::invalid_argument(
"QPSolverRelaxedQPSchurSetOptions::"
216 "setOption(...) : Error, only the values of USE_INPUT_ARG, NO_OUTPUT"
217 ", OUTPUT_BASIC_INFO, OUTPUT_ITER_SUMMARY\n"
218 ", OUTPUT_ITER_STEPS, OUTPUT_ACT_SET and"
219 " OUTPUT_ITER_QUANTITIES \nare valid for the option"
220 " \"QPSolverRelaxedQPSchur::print_level\"" );
Solves Quadratic Programming (QP) problems using QPSchur.
QPSolverRelaxedQPSchurSetOptions(QPSolverRelaxedQPSchur *target=0, const char opt_grp_name[]="QPSolverRelaxedQPSchur")
Constraints subclass that is used to represent generic varaible bounds, and general inequality and eq...
void setOption(int option_num, const std::string &option_value)
Overridden from SetOptionsFromStreamNode.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)