|
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_MeritFunc_ModifiedL1LargerSteps_AddedStepSetOptions.hpp" 00035 #include "OptionsFromStreamPack_StringToBool.hpp" 00036 00037 // Define the options 00038 namespace { 00039 00040 const int local_num_options = 5; 00041 00042 const char options_group_name[] = "MeritFuncModifiedL1LargerSteps"; 00043 00044 enum local_EOptions { 00045 AFTER_K_ITER, 00046 OBJ_INCREASE_THRESHOLD, 00047 MAX_POS_PENALTY_INCREASE, 00048 POS_TO_NEG_PENALTY_INCREASE, 00049 INCR_MULT_FACTOR 00050 }; 00051 00052 const char* local_SOptions[local_num_options] = { 00053 "after_k_iter", 00054 "obj_increase_threshold", 00055 "max_pos_penalty_increase", 00056 "pos_to_neg_penalty_increase", 00057 "incr_mult_factor" 00058 }; 00059 00060 } 00061 00062 namespace MoochoPack { 00063 00064 MeritFunc_ModifiedL1LargerSteps_AddedStepSetOptions::MeritFunc_ModifiedL1LargerSteps_AddedStepSetOptions( 00065 MeritFunc_ModifiedL1LargerSteps_AddedStep* target ) 00066 : OptionsFromStreamPack::SetOptionsFromStreamNode( 00067 options_group_name, local_num_options, local_SOptions ) 00068 , OptionsFromStreamPack::SetOptionsToTargetBase< 00069 MeritFunc_ModifiedL1LargerSteps_AddedStep >( target ) 00070 {} 00071 00072 void MeritFunc_ModifiedL1LargerSteps_AddedStepSetOptions::setOption( 00073 int option_num, const std::string& option_value ) 00074 { 00075 switch( (local_EOptions)option_num ) { 00076 case AFTER_K_ITER: { 00077 target().after_k_iter( ::atoi( option_value.c_str() ) ); 00078 break; 00079 } 00080 case OBJ_INCREASE_THRESHOLD: { 00081 target().obj_increase_threshold( ::atof( option_value.c_str() ) ); 00082 break; 00083 } 00084 case MAX_POS_PENALTY_INCREASE: { 00085 target().max_pos_penalty_increase( ::fabs( ::atof( option_value.c_str() ) ) ); 00086 break; 00087 } 00088 case POS_TO_NEG_PENALTY_INCREASE: { 00089 target().pos_to_neg_penalty_increase( ::fabs( ::atof( option_value.c_str() ) ) ); 00090 break; 00091 } 00092 case INCR_MULT_FACTOR: { 00093 target().incr_mult_factor( ::fabs( ::atof( option_value.c_str() ) ) ); 00094 break; 00095 } 00096 default: 00097 TEST_FOR_EXCEPT(true); // Local error only? 00098 } 00099 } 00100 00101 } // end namespace MoochoPack 00102 00103 #endif // 0
1.7.4