|
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_LineSearchWatchDog_StepSetOptions.hpp" 00035 #include "OptionsFromStreamPack_StringToBool.hpp" 00036 00037 // Define the options 00038 namespace { 00039 00040 const int local_num_options = 2; 00041 00042 const char options_group_name[] = "LineSearchWatchDog"; 00043 00044 enum local_EOptions { 00045 OPT_KKT_ERR_THESHOLD, 00046 FEAS_KKT_ERR_THESHOLD 00047 }; 00048 00049 const char* local_SOptions[local_num_options] = { 00050 "opt_kkt_err_threshold", 00051 "feas_kkt_err_threshold" 00052 }; 00053 00054 } 00055 00056 namespace MoochoPack { 00057 00058 LineSearchWatchDog_StepSetOptions::LineSearchWatchDog_StepSetOptions( 00059 LineSearchWatchDog_Step* target ) 00060 : OptionsFromStreamPack::SetOptionsFromStreamNode( 00061 options_group_name, local_num_options, local_SOptions ) 00062 , OptionsFromStreamPack::SetOptionsToTargetBase< 00063 LineSearchWatchDog_Step >( target ) 00064 {} 00065 00066 void LineSearchWatchDog_StepSetOptions::setOption( 00067 int option_num, const std::string& option_value ) 00068 { 00069 switch( (local_EOptions)option_num ) { 00070 case OPT_KKT_ERR_THESHOLD: { 00071 target().opt_kkt_err_threshold( ::fabs( ::atof( option_value.c_str() ) ) ); 00072 break; 00073 } 00074 case FEAS_KKT_ERR_THESHOLD: { 00075 target().feas_kkt_err_threshold( ::fabs( ::atof( option_value.c_str() ) ) ); 00076 break; 00077 } 00078 default: 00079 TEST_FOR_EXCEPT(true); // Local error only? 00080 } 00081 } 00082 00083 } // end namespace MoochoPack 00084 00085 #endif // 0
1.7.4