OpenNN  2.2
Open Neural Networks Library
solutions_error.h
1 /****************************************************************************************************************/
2 /* */
3 /* OpenNN: Open Neural Networks Library */
4 /* www.artelnics.com/opennn */
5 /* */
6 /* 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 */
7 /* */
8 /* Roberto Lopez */
9 /* Artelnics - Making intelligent use of data */
11 /* */
12 /****************************************************************************************************************/
13 
14 #ifndef __SOLUTIONSERROR_H__
15 #define __SOLUTIONSERROR_H__
16 
17 // System includes
18 
19 #include <iostream>
20 #include <fstream>
21 #include <cmath>
22 #include <sstream>
23 #include <string>
24 #include <limits>
25 
26 // OpenNN includes
27 
28 #include "numerical_integration.h"
29 
30 #include "performance_term.h"
31 
32 // TinyXml includes
33 
34 #include "../tinyxml2/tinyxml2.h"
35 
36 namespace OpenNN
37 {
38 
44 
46 {
47 
48 public:
49 
50  // DEFAULT CONSTRUCTOR
51 
52  explicit SolutionsError(void);
53 
54  // NEURAL NETWORK CONSTRUCTOR
55 
56  explicit SolutionsError(NeuralNetwork*);
57 
58  // DATA SET CONSTRUCTOR
59 
61 
62  // GENERAL CONSTRUCTOR
63 
65 
66  // XML CONSTRUCTOR
67 
68  explicit SolutionsError(const tinyxml2::XMLDocument&);
69 
70  // COPY CONSTRUCTOR
71 
73 
74  // ASSIGNMENT OPERATOR
75 
77 
78  // EQUAL TO OPERATOR
79 
80  bool operator == (const SolutionsError&) const;
81 
82  // DESTRUCTOR
83 
84  virtual ~SolutionsError(void);
85 
86  // ENUMERATIONS
87 
89 
90  enum SolutionsErrorMethod{SolutionsErrorSum, SolutionsErrorIntegral};
91 
92  // METHODS
93 
94  // Get methods
95 
97  std::string write_solutions_error_method(void) const;
98 
100  const double& get_solution_error_weight(const size_t&) const;
101 
102  // Set methods
103 
104 // void set(const SolutionsError&);
105 
107  void set_solutions_error_method(const std::string&);
108 
110  void set_solution_error_weight(const size_t&, const double&);
111 
112  void set_default(void);
113 
114  // Target trajectories methods
115 
117 
118  // Checking methods
119 
120  void check(void) const;
121 
122  // Constraints methods
123 
124  double calculate_solutions_error_sum(void) const;
125  double calculate_solutions_error_integral(void) const;
126 
127  virtual double calculate_performance(void) const;
128  virtual double calculate_performance(const Vector<double>&) const;
129 
130  std::string write_performance_term_type(void) const;
131 
132  std::string write_information(void) const;
133 
134  // Serialization methods
135 
136  virtual void print(void) const;
137 
138  tinyxml2::XMLDocument* to_XML(void) const;
139  void from_XML(const tinyxml2::XMLDocument&);
140 
141 protected:
142 
144 
146 
148 
150 
152 
154 
155 };
156 
157 }
158 
159 #endif
160 
161 
162 // OpenNN: Open Neural Networks Library.
163 // Copyright (c) 2005-2015 Roberto Lopez.
164 //
165 // This library is free software; you can redistribute it and/or
166 // modify it under the terms of the GNU Lesser General Public
167 // License as published by the Free Software Foundation; either
168 // version 2.1 of the License, or any later version.
169 //
170 // This library is distributed in the hope that it will be useful,
171 // but WITHOUT ANY WARRANTY; without even the implied warranty of
172 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
173 // Lesser General Public License for more details.
174 
175 // You should have received a copy of the GNU Lesser General Public
176 // License along with this library; if not, write to the Free Software
177 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
std::string write_solutions_error_method(void) const
Returns a string with the name of the method for computing the solutions error.
const Vector< double > & get_solutions_errors_weights(void) const
Returns the weights for every single solution error, corresponding to a dependent variable...
tinyxml2::XMLDocument * to_XML(void) const
Returns a representation of the solutions error object, in XML format.
const SolutionsErrorMethod & get_solutions_error_method(void) const
Returns the method for computing the solutions error.
virtual Matrix< double > calculate_target_dependent_variables(const Matrix< double > &) const
Returns the default target solution matrix.
SolutionsErrorMethod solutions_error_method
Method used to compute the error between the mathematical model solutions and the target solutions...
void set_solutions_error_method(const SolutionsErrorMethod &)
SolutionsErrorMethod
Enumeration of the different methods to compute the errors between the mathematical model solutions a...
Vector< double > solutions_errors_weights
Weights for the different dependent variables errors.
double calculate_solutions_error_integral(void) const
bool operator==(const SolutionsError &) const
std::string write_performance_term_type(void) const
Returns a string with the name of the solutions error performance type, "SOLUTIONS_ERROR".
const double & get_solution_error_weight(const size_t &) const
Returns the weight for a single solution error, corresponding to a dependent variable.
void check(void) const
std::string write_information(void) const
NumericalIntegration numerical_integration
Numerical integration object.
double calculate_solutions_error_sum(void) const
virtual double calculate_performance(void) const
Returns the objective value of a neural network according to the solutions error on a mathematical mo...
void set_solution_error_weight(const size_t &, const double &)
virtual void print(void) const
Prints to the screen the string representation of this solutions error object.
SolutionsError & operator=(const SolutionsError &)
void set_solutions_errors_weights(const Vector< double > &)
void from_XML(const tinyxml2::XMLDocument &)