OpenNN  2.2
Open Neural Networks Library
mathematical_model.h
1 /****************************************************************************************************************/
2 /* */
3 /* OpenNN: Open Neural Networks Library */
4 /* www.artelnics.com/opennn */
5 /* */
6 /* M A T H E M A T I C A L M O D E L 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 __MATHEMATICALMODEL_H__
15 #define __MATHEMATICALMODEL_H__
16 
17 // System includes
18 
19 #include<fstream>
20 #include<iostream>
21 #include<string>
22 #include<sstream>
23 #include <time.h>
24 
25 // OpenNN includes
26 
27 #include "neural_network.h"
28 
29 #include "vector.h"
30 #include "matrix.h"
31 
32 namespace OpenNN
33 {
34 
39 
41 {
42 
43 public:
44 
45  // DEFAULT CONSTRUCTOR
46 
47  explicit MathematicalModel(void);
48 
49  // XML CONSTRUCTOR
50 
51  explicit MathematicalModel(const tinyxml2::XMLDocument&);
52 
53  // FILE CONSTRUCTOR
54 
55  explicit MathematicalModel(const std::string&);
56 
57  // COPY CONSTRUCTOR
58 
60 
61  // DESTRUCTOR
62 
63  virtual ~MathematicalModel(void);
64 
65  // ASSIGNMENT OPERATOR
66 
68 
69  // EQUAL TO OPERATOR
70 
71  virtual bool operator == (const MathematicalModel&) const;
72 
73  // METHODS
74 
75  // Get methods
76 
77  const size_t& get_independent_variables_number(void) const;
78  const size_t& get_dependent_variables_number(void) const;
79 
80  size_t count_variables_number(void) const;
81 
82  const bool& get_display(void) const;
83 
84  // Set methods
85 
86  void set(const MathematicalModel&);
87 
88  void set_independent_variables_number(const size_t&);
89  void set_dependent_variables_number(const size_t&);
90 
91  void set_display(const bool&);
92 
93  virtual void set_default(void);
94 
95  // Mathematical model
96 
97  virtual Matrix<double> calculate_solutions(const NeuralNetwork&) const;
98 
100 
102 
103 
104  // Serialization methods
105 
106  virtual std::string to_string(void) const;
107 
108  void print(void) const;
109 
110  virtual tinyxml2::XMLDocument* to_XML(void) const;
111  virtual void from_XML(const tinyxml2::XMLDocument&);
112 
113  void save(const std::string&) const;
114  void load(const std::string&);
115 
116  virtual void save_data(const NeuralNetwork&, const std::string&) const;
117 
118 protected:
119 
121 
123 
125 
127 
129 
130  bool display;
131 };
132 
133 }
134 
135 #endif
136 
137 
138 // OpenNN: Open Neural Networks Library.
139 // Copyright (c) 2005-2015 Roberto Lopez.
140 //
141 // This library is free software; you can redistribute it and/or
142 // modify it under the terms of the GNU Lesser General Public
143 // License as published by the Free Software Foundation; either
144 // version 2.1 of the License, or any later version.
145 //
146 // This library is distributed in the hope that it will be useful,
147 // but WITHOUT ANY WARRANTY; without even the implied warranty of
148 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
149 // Lesser General Public License for more details.
150 
151 // You should have received a copy of the GNU Lesser General Public
152 // License along with this library; if not, write to the Free Software
153 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
virtual Matrix< double > calculate_solutions(const NeuralNetwork &) const
void print(void) const
This method outputs to the console the string representation of the mathematical model.
virtual void from_XML(const tinyxml2::XMLDocument &)
const size_t & get_independent_variables_number(void) const
Returns the number of independent variables in the mathematical model.
void set(const MathematicalModel &)
virtual bool operator==(const MathematicalModel &) const
const size_t & get_dependent_variables_number(void) const
Returns the number of dependent variables in the mathematical model.
size_t count_variables_number(void) const
virtual tinyxml2::XMLDocument * to_XML(void) const
const bool & get_display(void) const
virtual Vector< double > calculate_final_solutions(const NeuralNetwork &) const
void save(const std::string &) const
virtual MathematicalModel & operator=(const MathematicalModel &)
virtual std::string to_string(void) const
Returns a string representation of the current mathematical model object.
virtual void save_data(const NeuralNetwork &, const std::string &) const
size_t dependent_variables_number
Number of dependent variables defining the mathematical model.
bool display
Flag for displaying warnings.
void set_dependent_variables_number(const size_t &)
virtual Matrix< double > calculate_dependent_variables(const NeuralNetwork &, const Matrix< double > &) const
size_t independent_variables_number
Number of independent variables defining the mathematical model.
void load(const std::string &)
void set_independent_variables_number(const size_t &)