MoochoPack_MeritFunc_PenaltyParamUpdate_AddedStepSetOptions.cpp

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 
00031 #include "MoochoPack_MeritFunc_PenaltyParamUpdate_AddedStepSetOptions.hpp"
00032 #include "OptionsFromStreamPack_StringToBool.hpp"
00033 
00034 // Define the options
00035 namespace {
00036 
00037   const int local_num_options = 4;
00038 
00039   const char options_group_name[] = "MeritFuncPenaltyParamUpdate";
00040 
00041   enum local_EOptions {
00042       SMALL_MU,
00043       MIN_MU_RATIO,
00044       MULT_FACTOR,
00045       KKT_NEAR_SOL
00046   };
00047 
00048   const char* local_SOptions[local_num_options] = {
00049       "small_mu",
00050       "min_mu_ratio",
00051       "mult_factor",
00052       "kkt_near_sol"
00053   };
00054 
00055 }
00056 
00057 namespace MoochoPack {
00058 
00059 MeritFunc_PenaltyParamUpdate_AddedStepSetOptions::MeritFunc_PenaltyParamUpdate_AddedStepSetOptions(
00060       MeritFunc_PenaltyParamUpdate_AddedStep* target )
00061   : OptionsFromStreamPack::SetOptionsFromStreamNode(
00062         options_group_name, local_num_options, local_SOptions )
00063     , OptionsFromStreamPack::SetOptionsToTargetBase<
00064       MeritFunc_PenaltyParamUpdate_AddedStep >( target )
00065 {}
00066 
00067 void MeritFunc_PenaltyParamUpdate_AddedStepSetOptions::setOption(
00068   int option_num, const std::string& option_value )
00069 {
00070   switch( (local_EOptions)option_num ) {
00071     case SMALL_MU: {
00072       target().small_mu( std::atof( option_value.c_str() ) );
00073       break;
00074     }
00075     case MIN_MU_RATIO: {
00076       target().min_mu_ratio( std::atof( option_value.c_str() ) );
00077       break;
00078     }
00079     case MULT_FACTOR: {
00080       target().mult_factor( std::atof( option_value.c_str() ) );
00081       break;
00082     }
00083     case KKT_NEAR_SOL: {
00084       target().kkt_near_sol( std::atof( option_value.c_str() ) );
00085       break;
00086     }
00087     default:
00088       TEST_FOR_EXCEPT(true);  // Local error only?
00089   }
00090 }
00091 
00092 } // end namespace MoochoPack 

Generated on Wed May 12 21:32:13 2010 for MoochoPack : Framework for Large-Scale Optimization Algorithms by  doxygen 1.4.7