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