00001 /* 00002 Teem - an open source evolutionary software framework 00003 http://lis.epfl.ch/resources/Teem 00004 Stephane Magnenat <stephane.magnenat@epfl.ch>, 00005 Antoine Beyeler <antoine.beyeler@epfl.ch>, 00006 and other contributors. See AUTHORS for details 00007 Laboratory of Intelligent Systems, EPFL, Lausanne 00008 00009 This program is free software; you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation; either version 2 of the License, or 00012 (at your option) any later version. 00013 00014 This program is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program; if not, write to the Free Software 00021 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00022 */ 00023 00024 #ifndef __PARAMETERGENOTYPEDECODER_H 00025 #define __PARAMTERGENOTYPEDECODER_H 00026 00027 #include "GenotypeDecoder.h" 00028 00033 namespace Teem 00034 { 00035 00059 class ParameterGenotypeDecoder : public GenotypeDecoder 00060 { 00061 public: 00063 ParameterGenotypeDecoder(const std::string &root); 00065 virtual ~ParameterGenotypeDecoder() { } 00066 00068 virtual Genome* createGenome(); 00069 00071 virtual Controller* decode(Genome *genome); 00072 00074 double getParameter(const std::string &key) 00075 { 00076 assert(parameters.find(key) != parameters.end()); 00077 return parameters[key].value; 00078 } 00079 00080 protected: 00082 struct ParamDesc 00083 { 00084 An::Point range; 00085 bool log; 00086 double value; 00087 }; 00088 00090 std::map<std::string, ParamDesc> parameters; 00091 }; 00092 } 00093 00094 #endif