00001 00002 /* */ 00003 /* OpenNN: Open Neural Networks Library */ 00004 /* www.opennn.cimne.com */ 00005 /* */ 00006 /* I N P U T S O U T P U T S I N F O R M A T I O N C L A S S H E A D E R */ 00007 /* */ 00008 /* Roberto Lopez */ 00009 /* International Center for Numerical Methods in Engineering (CIMNE) */ 00010 /* Technical University of Catalonia (UPC) */ 00011 /* Barcelona, Spain */ 00012 /* E-mail: rlopez@cimne.upc.edu */ 00013 /* */ 00014 /****************************************************************************************************************/ 00015 00016 #ifndef __INPUTSOUTPUTSINFORMATION_H__ 00017 #define __INPUTSOUTPUTSINFORMATION_H__ 00018 00019 // System includes 00020 00021 #include <string> 00022 00023 // OpenNN includes 00024 00025 #include "../utilities/vector.h" 00026 #include "../utilities/matrix.h" 00027 00028 // TinyXml includes 00029 00030 #include "../../parsers/tinyxml/tinyxml.h" 00031 00032 namespace OpenNN 00033 { 00034 00037 00038 class InputsOutputsInformation 00039 { 00040 00041 public: 00042 00043 // DEFAULT CONSTRUCTOR 00044 00045 explicit InputsOutputsInformation(void); 00046 00047 // INPUTS AND OUTPUTS NUMBER CONSTRUCTOR 00048 00049 explicit InputsOutputsInformation(const unsigned int&, const unsigned int&); 00050 00051 00053 00054 // XML CONSTRUCTOR 00055 00056 explicit InputsOutputsInformation(TiXmlElement*); 00057 00058 00059 // COPY CONSTRUCTOR 00060 00061 InputsOutputsInformation(const InputsOutputsInformation&); 00062 00063 // DESTRUCTOR 00064 00065 virtual ~InputsOutputsInformation(void); 00066 00067 // ASSIGNMENT OPERATOR 00068 00069 InputsOutputsInformation& operator = (const InputsOutputsInformation&); 00070 00071 // EQUAL TO OPERATOR 00072 00073 bool operator == (const InputsOutputsInformation&) const; 00074 00075 // METHOD 00076 00077 bool is_empty(void) const; 00078 00080 00081 inline unsigned int count_inputs_number(void) const 00082 { 00083 return(inputs_name.size()); 00084 } 00085 00087 00088 inline int count_outputs_number(void) const 00089 { 00090 return(outputs_name.size()); 00091 } 00092 00093 // Input variables information 00094 00095 const Vector<std::string>& get_inputs_name(void) const; 00096 const std::string& get_input_name(const unsigned int&) const; 00097 00098 const Vector<std::string>& get_inputs_units(void) const; 00099 const std::string& get_input_units(const unsigned int&) const; 00100 00101 const Vector<std::string>& get_inputs_description(void) const; 00102 const std::string& get_input_description(const unsigned int&) const; 00103 00104 // Output variables information 00105 00106 const Vector<std::string>& get_outputs_name(void) const; 00107 const std::string& get_output_name(const unsigned int&) const; 00108 00109 const Vector<std::string>& get_outputs_units(void) const; 00110 const std::string& get_output_units(const unsigned int&) const; 00111 00112 const Vector<std::string>& get_outputs_description(void) const; 00113 const std::string& get_output_description(const unsigned int&) const; 00114 00115 // Variables information 00116 00117 Vector< Vector<std::string>* > get_information(void); 00118 00119 // Display messages 00120 00121 const bool& get_display(void) const; 00122 00123 // SET METHODS 00124 00125 void set(void); 00126 void set(const unsigned int&, const unsigned int&); 00127 void set(const Vector< Vector<std::string> >&); 00128 void set(const InputsOutputsInformation&); 00129 00130 void set_inputs_number(const unsigned int&); 00131 void set_outputs_number(const unsigned int&); 00132 00133 virtual void set_default(void); 00134 00135 // Input variables information 00136 00137 void set_inputs_name(const Vector<std::string>&); 00138 void set_input_name(const unsigned int&, const std::string&); 00139 00140 void set_inputs_units(const Vector<std::string>&); 00141 void set_input_units(const unsigned int&, const std::string&); 00142 00143 void set_inputs_description(const Vector<std::string>&); 00144 void set_input_description(const unsigned int&, const std::string&); 00145 00146 // Output variables information 00147 00148 void set_outputs_name(const Vector<std::string>&); 00149 void set_output_name(const unsigned int&, const std::string&); 00150 00151 void set_outputs_units(const Vector<std::string>&); 00152 void set_output_units(const unsigned int&, const std::string&); 00153 00154 void set_outputs_description(const Vector<std::string>&); 00155 void set_output_description(const unsigned int&, const std::string&); 00156 00157 // Variables information 00158 00159 void set_information(const Vector< Vector<std::string> >&); 00160 00161 void set_display(const bool&); 00162 00163 void initialize_random(void); 00164 00165 00166 Vector<std::string> write_default_inputs_name(void) const; 00167 Vector<std::string> write_default_outputs_name(void) const; 00168 00169 // Serialization methods 00170 00171 std::string to_string(void) const; 00172 00173 virtual TiXmlElement* to_XML(void) const; 00174 virtual void from_XML(TiXmlElement*); 00175 00176 protected: 00177 00178 // MEMBERS 00179 00181 00182 Vector<std::string> inputs_name; 00183 00185 00186 Vector<std::string> inputs_units; 00187 00189 00190 Vector<std::string> inputs_description; 00191 00193 00194 Vector<std::string> outputs_name; 00195 00197 00198 Vector<std::string> outputs_units; 00199 00201 00202 Vector<std::string> outputs_description; 00203 00205 00206 bool display; 00207 }; 00208 00209 } 00210 00211 #endif 00212 00213 00214 // OpenNN: Open Neural Networks Library. 00215 // Copyright (C) 2005-2012 Roberto Lopez 00216 // 00217 // This library is free software; you can redistribute it and/or 00218 // modify it under the terms of the GNU Lesser General Public 00219 // License as published by the Free Software Foundation; either 00220 // version 2.1 of the License, or any later version. 00221 // 00222 // This library is distributed in the hope that it will be useful, 00223 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00224 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00225 // Lesser General Public License for more details. 00226 00227 // You should have received a copy of the GNU Lesser General Public 00228 // License along with this library; if not, write to the Free Software 00229 00230 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00231