|
MoochoPack : Framework for Large-Scale Optimization Algorithms Version of the Day
|
00001 // @HEADER 00002 // *********************************************************************** 00003 // 00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization 00005 // Copyright (2003) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 // @HEADER 00028 00029 #include <assert.h> 00030 #include <math.h> 00031 00032 #include "MoochoPack_FeasibilityStepReducedStd_StrategySetOptions.hpp" 00033 00034 // Define the options 00035 namespace { 00036 00037 const int local_num_options = 2; 00038 00039 enum local_EOptions { 00040 QP_OBJECTIVE 00041 ,QP_TESTING 00042 }; 00043 00044 const char* local_SOptions[local_num_options] = { 00045 "qp_objective" 00046 ,"qp_testing" 00047 }; 00048 00049 } 00050 00051 namespace MoochoPack { 00052 00053 FeasibilityStepReducedStd_StrategySetOptions::FeasibilityStepReducedStd_StrategySetOptions( 00054 FeasibilityStepReducedStd_Strategy* target 00055 , const char opt_grp_name[] ) 00056 : OptionsFromStreamPack::SetOptionsFromStreamNode( 00057 opt_grp_name, local_num_options, local_SOptions ) 00058 , OptionsFromStreamPack::SetOptionsToTargetBase< 00059 FeasibilityStepReducedStd_Strategy >( target ) 00060 {} 00061 00062 void FeasibilityStepReducedStd_StrategySetOptions::setOption( 00063 int option_num, const std::string& option_value ) 00064 { 00065 typedef FeasibilityStepReducedStd_Strategy target_t; 00066 switch( (local_EOptions)option_num ) { 00067 case QP_OBJECTIVE: 00068 { 00069 const std::string &option = option_value.c_str(); 00070 if( option == "OBJ_MIN_FULL_STEP" ) 00071 target().qp_objective( target_t::OBJ_MIN_FULL_STEP ); 00072 else if( option == "OBJ_MIN_NULL_SPACE_STEP" ) 00073 target().qp_objective( target_t::OBJ_MIN_NULL_SPACE_STEP ); 00074 else if( option == "OBJ_RSQP" ) 00075 target().qp_objective( target_t::OBJ_RSQP ); 00076 else 00077 throw std::invalid_argument( "Error, incorrect value for " 00078 "\"qp_objective\". Only the options " 00079 "OBJ_MIN_FULL_STEP, OBJ_MIN_NULL_SPACE_STEP, and OBJ_RSQP" 00080 " are available" ); 00081 break; 00082 } 00083 case QP_TESTING: 00084 { 00085 const std::string &option = option_value.c_str(); 00086 if( option == "QP_TEST_DEFAULT" ) 00087 target().qp_testing( target_t::QP_TEST_DEFAULT ); 00088 else if( option == "QP_TEST" ) 00089 target().qp_testing( target_t::QP_TEST ); 00090 else if( option == "QP_NO_TEST" ) 00091 target().qp_testing( target_t::QP_NO_TEST ); 00092 else 00093 throw std::invalid_argument( "Error, incorrect value for " 00094 "\"qp_testing\". Only the options " 00095 "QP_TEST_DEFAULT, QP_TEST, and QP_NO_TEST " 00096 "are available" ); 00097 break; 00098 } 00099 default: 00100 TEST_FOR_EXCEPT(true); // Local error only? 00101 } 00102 } 00103 00104 } // end namespace MoochoPack
1.7.4