ConstrainedOptPack_QPSolverRelaxedTesterSetOptions.cpp

Go to the documentation of this file.
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 "ConstrainedOptPack_QPSolverRelaxedTesterSetOptions.hpp"
00033 
00034 // Define the options
00035 namespace {
00036 
00037   const int local_num_options = 6;
00038 
00039   enum local_EOptions {
00040     OPT_WARNING_TOL
00041     ,OPT_ERROR_TOL
00042     ,FEAS_WARNING_TOL
00043     ,FEAS_ERROR_TOL
00044     ,COMP_WARNING_TOL
00045     ,COMP_ERROR_TOL
00046   };
00047 
00048   const char* local_SOptions[local_num_options] = {
00049       "opt_warning_tol"
00050       ,"opt_error_tol"
00051       ,"feas_warning_tol"
00052       ,"feas_error_tol"
00053       ,"comp_warning_tol"
00054       ,"comp_error_tol"
00055   };
00056 
00057 }
00058 
00059 namespace ConstrainedOptPack {
00060 
00061 QPSolverRelaxedTesterSetOptions::QPSolverRelaxedTesterSetOptions(
00062         QPSolverRelaxedTester* target
00063       , const char opt_grp_name[] )
00064   : OptionsFromStreamPack::SetOptionsFromStreamNode(
00065         opt_grp_name, local_num_options, local_SOptions )
00066     , OptionsFromStreamPack::SetOptionsToTargetBase<
00067       QPSolverRelaxedTester >( target )
00068 {}
00069 
00070 void QPSolverRelaxedTesterSetOptions::setOption(
00071   int option_num, const std::string& option_value )
00072 {
00073   typedef QPSolverRelaxedTester target_t;
00074   switch( (local_EOptions)option_num ) {
00075       case OPT_WARNING_TOL:
00076       target().opt_warning_tol(::fabs(::atof(option_value.c_str())));
00077       break;
00078       case OPT_ERROR_TOL:
00079       target().opt_error_tol(::fabs(::atof(option_value.c_str())));
00080       break;
00081       case FEAS_WARNING_TOL:
00082       target().feas_warning_tol(::fabs(::atof(option_value.c_str())));
00083       break;
00084       case FEAS_ERROR_TOL:
00085       target().feas_error_tol(::fabs(::atof(option_value.c_str())));
00086       break;
00087       case COMP_WARNING_TOL:
00088       target().comp_warning_tol(::fabs(::atof(option_value.c_str())));
00089       break;
00090       case COMP_ERROR_TOL:
00091       target().comp_error_tol(::fabs(::atof(option_value.c_str())));
00092       break;
00093     default:
00094       TEST_FOR_EXCEPT(true);  // Local error only?
00095   }
00096 }
00097 
00098 } // end namespace ConstrainedOptPack

Generated on Thu Sep 18 12:35:15 2008 for MOOCHO (Single Doxygen Collection) by doxygen 1.3.9.1