00001 /****************************************************************************************************************/ 00002 /* */ 00003 /* OpenNN: Open Neural Networks Library */ 00004 /* www.opennn.cimne.com */ 00005 /* */ 00006 /* 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 __SOLUTIONSERROR_H__ 00017 #define __SOLUTIONSERROR_H__ 00018 00019 // OpenNN includes 00020 00021 #include "../utilities/numerical_integration.h" 00022 00023 #include "performance_functional.h" 00024 00025 namespace OpenNN 00026 { 00027 00033 00034 class SolutionsError : public PerformanceTerm 00035 { 00036 00037 public: 00038 00039 // DEFAULT CONSTRUCTOR 00040 00041 explicit SolutionsError(void); 00042 00043 // NEURAL NETWORK CONSTRUCTOR 00044 00045 explicit SolutionsError(NeuralNetwork*); 00046 00047 // DATA SET CONSTRUCTOR 00048 00049 explicit SolutionsError(MathematicalModel*); 00050 00051 // GENERAL CONSTRUCTOR 00052 00053 explicit SolutionsError(NeuralNetwork*, MathematicalModel*); 00054 00055 // XML CONSTRUCTOR 00056 00057 explicit SolutionsError(TiXmlElement*); 00058 00059 // COPY CONSTRUCTOR 00060 00061 SolutionsError(const SolutionsError&); 00062 00063 // ASSIGNMENT OPERATOR 00064 00065 SolutionsError& operator = (const SolutionsError&); 00066 00067 // EQUAL TO OPERATOR 00068 00069 bool operator == (const SolutionsError&) const; 00070 00071 // DESTRUCTOR 00072 00073 virtual ~SolutionsError(void); 00074 00075 // ENUMERATIONS 00076 00078 00079 enum SolutionsErrorMethod{SolutionsErrorSum, SolutionsErrorIntegral}; 00080 00081 // METHODS 00082 00083 // Get methods 00084 00085 const SolutionsErrorMethod& get_solutions_error_method(void) const; 00086 std::string write_solutions_error_method(void) const; 00087 00088 const Vector<double>& get_solutions_errors_weights(void) const; 00089 const double& get_solution_error_weight(const unsigned int&) const; 00090 00091 // Set methods 00092 00093 void set(const SolutionsError&); 00094 00095 void set_solutions_error_method(const SolutionsErrorMethod&); 00096 void set_solutions_error_method(const std::string&); 00097 00098 void set_solutions_errors_weights(const Vector<double>&); 00099 void set_solution_error_weight(const unsigned int&, const double&); 00100 00101 void set_default(void); 00102 00103 // Target trajectories methods 00104 00105 virtual Matrix<double> calculate_target_dependent_variables(const Matrix<double>&) const; 00106 00107 // Checking methods 00108 00109 void check(void) const; 00110 00111 // Constraints methods 00112 00113 double calculate_solutions_error_sum(void) const; 00114 double calculate_solutions_error_integral(void) const; 00115 00116 virtual double calculate_evaluation(void) const; 00117 virtual double calculate_evaluation(const Vector<double>&) const; 00118 00119 std::string write_performance_term_type(void) const; 00120 00121 std::string write_information(void) const; 00122 00123 // Serialization methods 00124 00125 virtual void print(void) const; 00126 00127 TiXmlElement* to_XML(void) const; 00128 void from_XML(TiXmlElement*); 00129 00130 protected: 00131 00133 00134 NumericalIntegration numerical_integration; 00135 00137 00138 SolutionsErrorMethod solutions_error_method; 00139 00141 00142 Vector<double> solutions_errors_weights; 00143 00144 }; 00145 00146 } 00147 00148 #endif 00149 00150 00151 // OpenNN: Open Neural Networks Library. 00152 // Copyright (C) 2005-2012 Roberto Lopez 00153 // 00154 // This library is free software; you can redistribute it and/or 00155 // modify it under the terms of the GNU Lesser General Public 00156 // License as published by the Free Software Foundation; either 00157 // version 2.1 of the License, or any later version. 00158 // 00159 // This library is distributed in the hope that it will be useful, 00160 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00161 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00162 // Lesser General Public License for more details. 00163 00164 // You should have received a copy of the GNU Lesser General Public 00165 // License along with this library; if not, write to the Free Software 00166 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA