OpenNN  2.2
Open Neural Networks Library
Public Member Functions | Protected Attributes | List of all members
OpenNN::MathematicalModel Class Reference

#include <mathematical_model.h>

Inheritance diagram for OpenNN::MathematicalModel:
OpenNN::OrdinaryDifferentialEquations OpenNN::PlugIn

Public Member Functions

 MathematicalModel (void)
 
 MathematicalModel (const tinyxml2::XMLDocument &)
 
 MathematicalModel (const std::string &)
 
 MathematicalModel (const MathematicalModel &)
 
virtual ~MathematicalModel (void)
 
virtual MathematicalModeloperator= (const MathematicalModel &)
 
virtual bool operator== (const MathematicalModel &) const
 
const size_t & get_independent_variables_number (void) const
 
const size_t & get_dependent_variables_number (void) const
 
size_t count_variables_number (void) const
 
const bool & get_display (void) const
 
void set (const MathematicalModel &)
 
void set_independent_variables_number (const size_t &)
 
void set_dependent_variables_number (const size_t &)
 
void set_display (const bool &)
 
virtual void set_default (void)
 
virtual Matrix< double > calculate_solutions (const NeuralNetwork &) const
 
virtual Vector< double > calculate_final_solutions (const NeuralNetwork &) const
 
virtual Matrix< double > calculate_dependent_variables (const NeuralNetwork &, const Matrix< double > &) const
 
virtual std::string to_string (void) const
 
void print (void) const
 
virtual tinyxml2::XMLDocument * to_XML (void) const
 
virtual void from_XML (const tinyxml2::XMLDocument &)
 
virtual void write_XML (tinyxml2::XMLPrinter &) const
 
void save (const std::string &) const
 
void load (const std::string &)
 
virtual void save_data (const NeuralNetwork &, const std::string &) const
 

Protected Attributes

size_t independent_variables_number
 
size_t dependent_variables_number
 
bool display
 

Detailed Description

This class represents the concept of mathematical model. A mathematical model is the base for learning in some types of problems, such as optimal control and inverse problems.

Definition at line 40 of file mathematical_model.h.

Constructor & Destructor Documentation

◆ MathematicalModel() [1/4]

OpenNN::MathematicalModel::MathematicalModel ( void  )
explicit

Default constructor. It constructs a default mathematical model object, with zero independent and dependent variables.

Definition at line 26 of file mathematical_model.cpp.

◆ MathematicalModel() [2/4]

OpenNN::MathematicalModel::MathematicalModel ( const tinyxml2::XMLDocument &  mathematical_model_document)
explicit

XML constructor. It creates a mathematical model and loads its members from a TinyXML document.

Parameters
mathematical_model_documentXML document containing the mathematical model members.

Definition at line 38 of file mathematical_model.cpp.

◆ MathematicalModel() [3/4]

OpenNN::MathematicalModel::MathematicalModel ( const std::string &  file_name)
explicit

File constructor. It creates a mathematical model and loads its members from a XML file.

Parameters
file_nameName of mathematical model XML file.

Definition at line 52 of file mathematical_model.cpp.

◆ MathematicalModel() [4/4]

OpenNN::MathematicalModel::MathematicalModel ( const MathematicalModel other_mathematical_model)

Copy constructor. It creates a mathematical model object and copies its members from another object.

Parameters
other_mathematical_modelMathematical model object to be copied.

Definition at line 66 of file mathematical_model.cpp.

◆ ~MathematicalModel()

OpenNN::MathematicalModel::~MathematicalModel ( void  )
virtual

Destructor. It does not delete any object.

Definition at line 77 of file mathematical_model.cpp.

Member Function Documentation

◆ calculate_dependent_variables()

Matrix< double > OpenNN::MathematicalModel::calculate_dependent_variables ( const NeuralNetwork ,
const Matrix< double > &   
) const
virtual

This virtual method returns the dependent variables solutions to the mathematical model, Needs to be derived, otherwise an exception is thrown.

Definition at line 276 of file mathematical_model.cpp.

◆ calculate_final_solutions()

Vector< double > OpenNN::MathematicalModel::calculate_final_solutions ( const NeuralNetwork ) const
virtual

This virtual method returns the final solutions of the mathematical model, which are given by the final independent and dependent variables. Needs to be derived, otherwise an exception is thrown.

Reimplemented in OpenNN::OrdinaryDifferentialEquations.

Definition at line 259 of file mathematical_model.cpp.

◆ calculate_solutions()

Matrix< double > OpenNN::MathematicalModel::calculate_solutions ( const NeuralNetwork ) const
virtual

This virtual method returns the solutions to the mathematical model, which are given by the independent and the dependent variables. Needs to be derived, otherwise an exception is thrown.

Reimplemented in OpenNN::OrdinaryDifferentialEquations, and OpenNN::PlugIn.

Definition at line 241 of file mathematical_model.cpp.

◆ count_variables_number()

size_t OpenNN::MathematicalModel::count_variables_number ( void  ) const

Returns the total number variablesin the mathematical model. This is the sum of the numbers of independent and dependent variables.

Definition at line 151 of file mathematical_model.cpp.

◆ from_XML()

void OpenNN::MathematicalModel::from_XML ( const tinyxml2::XMLDocument &  document)
virtual

Deserializes a TinyXML document into this mathematical model object.

Parameters
documentXML document containing the member data.

Reimplemented in OpenNN::OrdinaryDifferentialEquations, and OpenNN::PlugIn.

Definition at line 425 of file mathematical_model.cpp.

◆ get_display()

const bool & OpenNN::MathematicalModel::get_display ( void  ) const

Returns true if messages from this class can be displayed on the screen, or false if messages from this class can't be displayed on the screen.

Definition at line 162 of file mathematical_model.cpp.

◆ load()

void OpenNN::MathematicalModel::load ( const std::string &  file_name)

Loads the members of the mathematical model from a XML file.

Parameters
file_nameName of mathematical model XML file.

Definition at line 530 of file mathematical_model.cpp.

◆ operator=()

MathematicalModel & OpenNN::MathematicalModel::operator= ( const MathematicalModel other_mathematical_model)
virtual

Assignment operator. It assigns to this object the members of an existing mathematical model object.

Parameters
other_mathematical_modelMathematical model object to be assigned.

Definition at line 88 of file mathematical_model.cpp.

◆ operator==()

bool OpenNN::MathematicalModel::operator== ( const MathematicalModel other_mathematical_model) const
virtual

Equal to operator. It compares this object with another object of the same class. It returns true if the members of the two objects have the same values, and false otherwise. @ param other_mathematical_model Mathematical model to be compared with.

Definition at line 109 of file mathematical_model.cpp.

◆ save()

void OpenNN::MathematicalModel::save ( const std::string &  file_name) const

Saves to a file the XML representation of the mathematical object.

Parameters
file_nameName of mathematical model XML file.

Definition at line 515 of file mathematical_model.cpp.

◆ save_data()

void OpenNN::MathematicalModel::save_data ( const NeuralNetwork ,
const std::string &   
) const
virtual
Todo:

Reimplemented in OpenNN::OrdinaryDifferentialEquations.

Definition at line 553 of file mathematical_model.cpp.

◆ set()

void OpenNN::MathematicalModel::set ( const MathematicalModel other_mathematical_model)

Sets the members of this mathematical model object with those from other mathematical model object.

Parameters
other_mathematical_modelMathematical model object to be copied.

Definition at line 173 of file mathematical_model.cpp.

◆ set_default()

void OpenNN::MathematicalModel::set_default ( void  )
virtual

Sets the following default values in the mathematical model:

  • Number of dependent variables: 0.
  • Number of independent variables: 0.
  • Display: True.

Reimplemented in OpenNN::OrdinaryDifferentialEquations, and OpenNN::PlugIn.

Definition at line 213 of file mathematical_model.cpp.

◆ set_dependent_variables_number()

void OpenNN::MathematicalModel::set_dependent_variables_number ( const size_t &  new_dependent_variables_number)

Sets the number of dependent variables in the mathematical model.

Parameters
new_dependent_variables_numberNumber of dependent variables.

Definition at line 198 of file mathematical_model.cpp.

◆ set_display()

void OpenNN::MathematicalModel::set_display ( const bool &  new_display)

Sets a new display value. If it is set to true messages from this class are to be displayed on the screen; if it is set to false messages from this class are not to be displayed on the screen.

Parameters
new_displayDisplay value.

Definition at line 229 of file mathematical_model.cpp.

◆ set_independent_variables_number()

void OpenNN::MathematicalModel::set_independent_variables_number ( const size_t &  new_independent_variables_number)

Sets the number of independent variables in the mathematical model.

Parameters
new_independent_variables_numberNumber of independent variables.

Definition at line 187 of file mathematical_model.cpp.

◆ to_XML()

tinyxml2::XMLDocument * OpenNN::MathematicalModel::to_XML ( void  ) const
virtual

Serializes the mathematical model object into a XML document of the TinyXML library. See the OpenNN manual for more information about the format of this document.

Reimplemented in OpenNN::OrdinaryDifferentialEquations, and OpenNN::PlugIn.

Definition at line 321 of file mathematical_model.cpp.

◆ write_XML()

void OpenNN::MathematicalModel::write_XML ( tinyxml2::XMLPrinter &  file_stream) const
virtual

Serializes the mathematical model object into a XML document of the TinyXML library without keep the DOM tree in memory. See the OpenNN manual for more information about the format of this document.

Reimplemented in OpenNN::OrdinaryDifferentialEquations, and OpenNN::PlugIn.

Definition at line 376 of file mathematical_model.cpp.


The documentation for this class was generated from the following files: