00001 /****************************************************************************************************************/ 00002 /* */ 00003 /* OpenNN: Open Neural Networks Library */ 00004 /* www.opennn.cimne.com */ 00005 /* */ 00006 /* F I N A L S O L U T I O N S E R R O R 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 __FINALSOLUTIONSERROR_H__ 00017 #define __FINALSOLUTIONSERROR_H__ 00018 00019 // OpenNN includes 00020 00021 #include "../mathematical_model/mathematical_model.h" 00022 00023 #include "performance_functional.h" 00024 00025 // TinyXml includes 00026 00027 #include "../../parsers/tinyxml/tinyxml.h" 00028 00029 namespace OpenNN 00030 { 00031 00035 00036 class FinalSolutionsError : public PerformanceTerm 00037 { 00038 00039 public: 00040 00041 // DEFAULT CONSTRUCTOR 00042 00043 explicit FinalSolutionsError(void); 00044 00045 // NEURAL NETWORK CONSTRUCTOR 00046 00047 explicit FinalSolutionsError(NeuralNetwork*); 00048 00049 // MATHEMATICAL MODEL CONSTRUCTOR 00050 00051 explicit FinalSolutionsError(MathematicalModel*); 00052 00053 // NEURAL NETWORK AND MATHEMATICAL MODEL CONSTRUCTOR 00054 00055 explicit FinalSolutionsError(NeuralNetwork*, MathematicalModel*); 00056 00057 // XML CONSTRUCTOR 00058 00059 explicit FinalSolutionsError(TiXmlElement*); 00060 00061 // COPY CONSTRUCTOR 00062 00063 FinalSolutionsError(const FinalSolutionsError&); 00064 00065 // DESTRUCTOR 00066 00067 virtual ~FinalSolutionsError(void); 00068 00069 // ASSIGNMENT OPERATOR 00070 00071 FinalSolutionsError& operator = (const FinalSolutionsError&); 00072 00073 // EQUAL TO OPERATOR 00074 00075 bool operator == (const FinalSolutionsError&) const; 00076 00077 // METHODS 00078 00079 // Get methods 00080 00081 const Vector<double>& get_final_solutions_errors_weights(void) const; 00082 00083 const Vector<double>& get_target_final_solutions(void) const; 00084 00085 // Set methods 00086 00087 void set(void); 00088 00089 void set(NeuralNetwork*); 00090 void set(MathematicalModel*); 00091 void set(NeuralNetwork*, MathematicalModel*); 00092 00093 void set(const FinalSolutionsError&); 00094 00095 void set_mathematical_model_pointer(MathematicalModel*); 00096 00097 void set_final_solutions_errors_weights(const Vector<double>&); 00098 void set_final_solution_error_weight(const unsigned int&, const double&); 00099 00100 void set_target_final_solutions(const Vector<double>&); 00101 void set_target_final_solution(const unsigned int&, const double&); 00102 00103 void set_default(void); 00104 00105 // Checking methods 00106 00107 void check(void) const; 00108 00109 // Performance term methods 00110 00111 double calculate_evaluation(void) const; 00112 00113 double calculate_evaluation(const Vector<double>&) const; 00114 00115 std::string write_performance_term_type(void) const; 00116 00117 std::string write_information(void) const; 00118 00119 // Serialization methods 00120 00121 TiXmlElement* to_XML(void) const; 00122 void from_XML(TiXmlElement*); 00123 00124 private: 00125 00126 // MEMBERS 00127 00130 00131 Vector<double> target_final_solutions; 00132 00135 00136 Vector<double> final_solutions_errors_weights; 00137 00138 }; 00139 00140 } 00141 00142 #endif 00143 00144 00145 // OpenNN: Open Neural Networks Library. 00146 // Copyright (C) 2005-2012 Roberto Lopez 00147 // 00148 // This library is free software; you can redistribute it and/or 00149 // modify it under the terms of the GNU Lesser General Public 00150 // License as published by the Free Software Foundation; either 00151 // version 2.1 of the License, or any later version. 00152 // 00153 // This library is distributed in the hope that it will be useful, 00154 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00155 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00156 // Lesser General Public License for more details. 00157 00158 // You should have received a copy of the GNU Lesser General Public 00159 // License along with this library; if not, write to the Free Software 00160 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA