00001 /****************************************************************************************************************/ 00002 /* */ 00003 /* OpenNN: Open Neural Networks Library */ 00004 /* www.opennn.cimne.com */ 00005 /* */ 00006 /* V A R I A B L E 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 __VARIABLESINFORMATION_H__ 00017 #define __VARIABLESINFORMATION_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 00033 namespace OpenNN 00034 { 00035 00039 00040 class VariablesInformation 00041 { 00042 00043 public: 00044 00045 // DEFAULT CONSTRUCTOR 00046 00047 explicit VariablesInformation(void); 00048 00049 // VARIABLES NUMBER CONSTRUCTOR 00050 00051 explicit VariablesInformation(const unsigned int&); 00052 00053 // INPUT AND TARGET VARIABLES NUMBER 00054 00055 explicit VariablesInformation(const unsigned int&, const unsigned int&); 00056 00057 // XML CONSTRUCTOR 00058 00059 explicit VariablesInformation(TiXmlElement*); 00060 00061 // COPY CONSTRUCTOR 00062 00063 VariablesInformation(const VariablesInformation&); 00064 00065 // DESTRUCTOR 00066 00067 virtual ~VariablesInformation(void); 00068 00069 // ASSIGNMENT OPERATOR 00070 00071 VariablesInformation& operator = (const VariablesInformation&); 00072 00073 // EQUAL TO OPERATOR 00074 00075 bool operator == (const VariablesInformation&) const; 00076 00077 // METHODS 00078 00080 00081 inline const unsigned int& get_variables_number(void) const 00082 { 00083 return(variables_number); 00084 } 00085 00087 00088 inline unsigned int count_inputs_number(void) const 00089 { 00090 return(inputs_indices.size()); 00091 } 00092 00094 00095 inline unsigned int count_targets_number(void) const 00096 { 00097 return(targets_indices.size()); 00098 } 00099 00100 // Variables methods 00101 00102 const Vector<unsigned int>& get_inputs_indices(void) const; 00103 const Vector<unsigned int>& get_targets_indices(void) const; 00104 00105 // Information methods 00106 00107 const Vector<std::string>& get_names(void) const; 00108 const std::string& get_name(const unsigned int&) const; 00109 00110 const Vector<std::string>& get_units(void) const; 00111 const std::string& get_unit(const unsigned int&) const; 00112 00113 const Vector<std::string>& get_descriptions(void) const; 00114 const std::string& get_description(const unsigned int&) const; 00115 00116 const bool& get_display(void) const; 00117 00118 // Set methods 00119 00120 void set(void); 00121 void set(const unsigned int&); 00122 void set(const unsigned int&, const unsigned int&); 00123 void set(TiXmlElement*); 00124 00125 // Data methods 00126 00127 void set_variables_number(const unsigned int&); 00128 00129 // Variables methods 00130 00131 void set_inputs_indices(const Vector<unsigned int>&); 00132 void set_targets_indices(const Vector<unsigned int>&); 00133 00134 void set_input(void); 00135 void set_target(void); 00136 00137 void set_default_indices(void); 00138 00139 // Information methods 00140 00141 void set_names(const Vector<std::string>&); 00142 void set_name(const unsigned int&, const std::string&); 00143 00144 void set_units(const Vector<std::string>&); 00145 void set_units(const unsigned int&, const std::string&); 00146 00147 void set_descriptions(const Vector<std::string>&); 00148 void set_description(const unsigned int&, const std::string&); 00149 00150 void set_display(const bool&); 00151 00152 00153 Vector<std::string> arrange_inputs_units(void) const; 00154 Vector<std::string> arrange_targets_units(void) const; 00155 00156 Vector<std::string> arrange_inputs_name(void) const; 00157 Vector<std::string> arrange_targets_name(void) const; 00158 00159 Vector<std::string> arrange_inputs_description(void) const; 00160 Vector<std::string> arrange_targets_description(void) const; 00161 00162 Vector< Vector<std::string> > arrange_inputs_targets_information(void) const; 00163 00164 // Serialization methods 00165 00166 std::string to_string(void) const; 00167 00168 TiXmlElement* to_XML(void) const; 00169 void from_XML(TiXmlElement*); 00170 00171 00172 private: 00173 00174 // MEMBERS 00175 00177 00178 unsigned int variables_number; 00179 00181 00182 Vector<unsigned int> inputs_indices; 00183 00185 00186 Vector<unsigned int> targets_indices; 00187 00189 00190 Vector<std::string> names; 00191 00193 00194 Vector<std::string> units; 00195 00197 00198 Vector<std::string> descriptions; 00199 00201 00202 bool display; 00203 }; 00204 00205 } 00206 00207 #endif 00208 00209 // OpenNN: Open Neural Networks Library. 00210 // Copyright (C) 2005-2012 Roberto Lopez 00211 // 00212 // This library is free software; you can redistribute it and/or 00213 // modify it under the terms of the GNU Lesser General Public 00214 // License as published by the Free Software Foundation; either 00215 // version 2.1 of the License, or any later version. 00216 // 00217 // This library is distributed in the hope that it will be useful, 00218 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00219 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00220 // Lesser General Public License for more details. 00221 00222 // You should have received a copy of the GNU Lesser General Public 00223 // License along with this library; if not, write to the Free Software 00224 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA