OpenNN::OrdinaryDifferentialEquations Class Reference

#include <ordinary_differential_equations.h>

Inheritance diagram for OpenNN::OrdinaryDifferentialEquations:

OpenNN::MathematicalModel

List of all members.

Public Types

enum  SolutionMethod { RungeKutta, RungeKuttaFehlberg }

Public Member Functions

 OrdinaryDifferentialEquations (void)
 OrdinaryDifferentialEquations (TiXmlElement *)
 OrdinaryDifferentialEquations (const std::string &)
 OrdinaryDifferentialEquations (const OrdinaryDifferentialEquations &)
virtual ~OrdinaryDifferentialEquations (void)
OrdinaryDifferentialEquationsoperator= (const OrdinaryDifferentialEquations &)
bool operator== (const OrdinaryDifferentialEquations &) const
const double & get_initial_independent_variable (void) const
const double & get_final_independent_variable (void) const
const Vector< double > & get_initial_dependent_variables (void) const
const double & get_initial_dependent_variable (const unsigned int &) const
const SolutionMethodget_solution_method (void) const
std::string write_solution_method (void) const
const unsigned int & get_points_number (void) const
const double & get_tolerance (void) const
const unsigned int & get_initial_size (void) const
const unsigned int & get_warning_size (void) const
const unsigned int & get_error_size (void) const
void set (const OrdinaryDifferentialEquations &)
void set_initial_independent_variable (const double &)
void set_final_independent_variable (const double &)
void set_initial_dependent_variables (const Vector< double > &)
void set_initial_dependent_variable (const unsigned int &, const double &)
void set_solution_method (const SolutionMethod &)
void set_solution_method (const std::string &)
void set_points_number (const unsigned int &)
void set_tolerance (const double &)
void set_initial_size (const unsigned int &)
void set_warning_size (const unsigned int &)
void set_error_size (const unsigned int &)
virtual void set_default (void)
virtual Vector< double > calculate_dependent_variables_dots (const NeuralNetwork &, const Vector< double > &) const =0
Matrix< double > calculate_Runge_Kutta_solution (const NeuralNetwork &) const
Vector< double > calculate_Runge_Kutta_final_solution (const NeuralNetwork &) const
Matrix< double > calculate_Runge_Kutta_Fehlberg_solution (const NeuralNetwork &) const
Vector< double > calculate_Runge_Kutta_Fehlberg_final_solution (const NeuralNetwork &) const
virtual Matrix< double > calculate_solutions (const NeuralNetwork &) const
virtual Vector< double > calculate_final_solutions (const NeuralNetwork &) const
std::string to_string (void) const
virtual TiXmlElement * to_XML (void) const
virtual void from_XML (TiXmlElement *)
virtual void save_data (const NeuralNetwork &, const std::string &) const

Protected Attributes

double initial_independent_variable
double final_independent_variable
Vector< double > initial_dependent_variables
SolutionMethod solution_method
unsigned int points_number
double tolerance
unsigned int initial_size
unsigned int warning_size
unsigned int error_size


Detailed Description

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

Definition at line 38 of file ordinary_differential_equations.h.


Member Enumeration Documentation

Enumeration of available methods for numerical integration of ordinary differential equations.

Definition at line 75 of file ordinary_differential_equations.h.


Constructor & Destructor Documentation

OpenNN::OrdinaryDifferentialEquations::OrdinaryDifferentialEquations ( void   )  [explicit]

Default constructor. It constructs a default ordinary differential equations object.

Definition at line 39 of file ordinary_differential_equations.cpp.

OpenNN::OrdinaryDifferentialEquations::OrdinaryDifferentialEquations ( TiXmlElement *  ordinary_differential_equations_element  )  [explicit]

XML constructor. It creates a ordinary differential equations mathematical modeel and loads its members from a Tiny XML element.

Parameters:
ordinary_differential_equations_element Pointer to a XML element containing the member data.

Definition at line 51 of file ordinary_differential_equations.cpp.

OpenNN::OrdinaryDifferentialEquations::OrdinaryDifferentialEquations ( const std::string &  filename  )  [explicit]

File constructor. It creates an ordinary differential equations mathematical model and loads its members from a XML file.

Parameters:
filename Name of XML file.

Definition at line 64 of file ordinary_differential_equations.cpp.

OpenNN::OrdinaryDifferentialEquations::OrdinaryDifferentialEquations ( const OrdinaryDifferentialEquations other_ordinary_differential_equations  ) 

Copy constructor. It creates an ordinary differential equations mathematical model object and copies its members from another object.

Parameters:
other_ordinary_differential_equations Ordinary differential equations object to be copied.

Definition at line 77 of file ordinary_differential_equations.cpp.

OpenNN::OrdinaryDifferentialEquations::~OrdinaryDifferentialEquations ( void   )  [virtual]

Destructor. It does not delete any object.

Definition at line 89 of file ordinary_differential_equations.cpp.


Member Function Documentation

OrdinaryDifferentialEquations & OpenNN::OrdinaryDifferentialEquations::operator= ( const OrdinaryDifferentialEquations other_ordinary_differential_equations  ) 

Assignment operator. It assigns to this object the members of an existing ordinary differential equations object.

Parameters:
other_ordinary_differential_equations Ordinary differential equations object to be assigned.

Definition at line 102 of file ordinary_differential_equations.cpp.

bool OpenNN::OrdinaryDifferentialEquations::operator== ( const OrdinaryDifferentialEquations other_ordinary_differential_equations  )  const

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.

Parameters:
other_ordinary_differential_equations Object to be compared with.

Definition at line 124 of file ordinary_differential_equations.cpp.

const double & OpenNN::OrdinaryDifferentialEquations::get_initial_independent_variable ( void   )  const

This method returns the initial value of the independent variable.

Definition at line 145 of file ordinary_differential_equations.cpp.

const double & OpenNN::OrdinaryDifferentialEquations::get_final_independent_variable ( void   )  const

This method returns the final value of the independent variable.

Definition at line 155 of file ordinary_differential_equations.cpp.

const Vector< double > & OpenNN::OrdinaryDifferentialEquations::get_initial_dependent_variables ( void   )  const

This method returns the initial values of the independent variables.

Definition at line 165 of file ordinary_differential_equations.cpp.

const double & OpenNN::OrdinaryDifferentialEquations::get_initial_dependent_variable ( const unsigned int &  i  )  const

This method returns the initial value of a single independent variable.

Parameters:
i Index of dependent variable.

Definition at line 176 of file ordinary_differential_equations.cpp.

const OrdinaryDifferentialEquations::SolutionMethod & OpenNN::OrdinaryDifferentialEquations::get_solution_method ( void   )  const

This method returns the numerical method to be used for integration of the ordinary differential equation.

Definition at line 186 of file ordinary_differential_equations.cpp.

std::string OpenNN::OrdinaryDifferentialEquations::write_solution_method ( void   )  const

This method returns a string with the name of the numerical method to be used for integration of the ordinary differential equation.

Definition at line 196 of file ordinary_differential_equations.cpp.

const unsigned int & OpenNN::OrdinaryDifferentialEquations::get_points_number ( void   )  const

This method returns the number of integration points in the Runge-Kutta method.

Definition at line 223 of file ordinary_differential_equations.cpp.

const double & OpenNN::OrdinaryDifferentialEquations::get_tolerance ( void   )  const

This method returns the tolerance in the Runge-Kutta-Fehlberg method.

Definition at line 233 of file ordinary_differential_equations.cpp.

const unsigned int & OpenNN::OrdinaryDifferentialEquations::get_initial_size ( void   )  const

This method returns the initial size to be reserved for the solutions in the Runge-Kutta-Fehlberg method.

Definition at line 243 of file ordinary_differential_equations.cpp.

const unsigned int & OpenNN::OrdinaryDifferentialEquations::get_warning_size ( void   )  const

This method returns a warning size for the solutions in the Runge-Kutta-Fehlberg method.

Definition at line 253 of file ordinary_differential_equations.cpp.

const unsigned int & OpenNN::OrdinaryDifferentialEquations::get_error_size ( void   )  const

This method returns an error size for the solutions in the Runge-Kutta-Fehlberg method.

Definition at line 263 of file ordinary_differential_equations.cpp.

void OpenNN::OrdinaryDifferentialEquations::set ( const OrdinaryDifferentialEquations other_ordinary_differential_equations  ) 

This method sets the members of this object to be the members of another object of the same class.

Parameters:
other_ordinary_differential_equations Object to be copied.

Definition at line 274 of file ordinary_differential_equations.cpp.

void OpenNN::OrdinaryDifferentialEquations::set_initial_independent_variable ( const double &  new_initial_independent_variable  ) 

This method sets the initial value for the independent variable.

Parameters:
new_initial_independent_variable Initial value for the independent variable.

Definition at line 303 of file ordinary_differential_equations.cpp.

void OpenNN::OrdinaryDifferentialEquations::set_final_independent_variable ( const double &  new_final_independent_variable  ) 

This method sets the final value for the independent variable.

Parameters:
new_final_independent_variable Final value for the independent variable.

Definition at line 314 of file ordinary_differential_equations.cpp.

void OpenNN::OrdinaryDifferentialEquations::set_initial_dependent_variables ( const Vector< double > &  new_initial_dependent_variables  ) 

This method sets the initial values for the dependent variables.

Parameters:
new_initial_dependent_variables Initial values for the dependent variables.

Definition at line 325 of file ordinary_differential_equations.cpp.

void OpenNN::OrdinaryDifferentialEquations::set_initial_dependent_variable ( const unsigned int &  i,
const double &  new_initial_dependent_variable 
)

This method sets the initial value for a single dependent variable.

Parameters:
i Index of dependent variable.
new_initial_dependent_variable Initial value for the corresponding dependent variable.

Definition at line 337 of file ordinary_differential_equations.cpp.

void OpenNN::OrdinaryDifferentialEquations::set_solution_method ( const SolutionMethod new_solution_method  ) 

This method sets the numerical method for calculating the solution to the ordinary differential equations. Available methos include the Runge-Kutta and Runge-Kutta-Fehlber methods.

Parameters:
new_solution_method Solution method.

Definition at line 349 of file ordinary_differential_equations.cpp.

void OpenNN::OrdinaryDifferentialEquations::set_solution_method ( const std::string &  new_solution_method  ) 

This method sets the numerical method for calculating the solution to the ordinary differential equations. Available methos include the Runge-Kutta and Runge-Kutta-Fehlber methods.

Parameters:
new_solution_method String with the name of the solution method ("RungeKutta" or "RungeKuttaFehlberg").

Definition at line 361 of file ordinary_differential_equations.cpp.

void OpenNN::OrdinaryDifferentialEquations::set_points_number ( const unsigned int &  new_points_number  ) 

This method sets the number of points in the Runge-Kutta method.

Parameters:
new_points_number Number of points.

Definition at line 389 of file ordinary_differential_equations.cpp.

void OpenNN::OrdinaryDifferentialEquations::set_tolerance ( const double &  new_tolerance  ) 

This method sets the tolerance in the Runge-Kutta-Fehlberg method.

Parameters:
new_tolerance Tolerance value.

Definition at line 400 of file ordinary_differential_equations.cpp.

void OpenNN::OrdinaryDifferentialEquations::set_initial_size ( const unsigned int &  new_initial_size  ) 

This method sets the initial size for the solution in the Runge-Kutta-Fehlberg method.

Parameters:
new_initial_size Initial solution size.

Definition at line 411 of file ordinary_differential_equations.cpp.

void OpenNN::OrdinaryDifferentialEquations::set_warning_size ( const unsigned int &  new_warning_size  ) 

This method sets a warning size for the solution in the Runge-Kutta-Fehlberg method.

Parameters:
new_warning_size Warning solution size.

Definition at line 422 of file ordinary_differential_equations.cpp.

void OpenNN::OrdinaryDifferentialEquations::set_error_size ( const unsigned int &  new_error_size  ) 

This method sets the error size for the solution in the Runge-Kutta-Fehlberg method.

Parameters:
new_error_size Error solution size.

Definition at line 433 of file ordinary_differential_equations.cpp.

void OpenNN::OrdinaryDifferentialEquations::set_default ( void   )  [virtual]

This method sets the following default values:

  • Independent variables number: 1.
  • Dependent variables number: 0.
  • Solution method: Runge-Kutta-Fehlberg.
  • Points number: 101.
  • Tolerance: 1e-6
  • Initial size: 1e3.
  • Warning size: 1e6.
  • Error size: 1e9.
  • Display: True.

Reimplemented from OpenNN::MathematicalModel.

Definition at line 454 of file ordinary_differential_equations.cpp.

virtual Vector<double> OpenNN::OrdinaryDifferentialEquations::calculate_dependent_variables_dots ( const NeuralNetwork ,
const Vector< double > &   
) const [pure virtual]

This pure virtual method calculates the derivatives of the dependent variables with respect to the independent variable.

Matrix< double > OpenNN::OrdinaryDifferentialEquations::calculate_Runge_Kutta_solution ( const NeuralNetwork neural_network  )  const

This method calculate the numerical solution of the ordinary differential equations model using the Runge-Kutta method.

Parameters:
neural_network Neural network which represents the external inputs to the mathematical model.

Definition at line 479 of file ordinary_differential_equations.cpp.

Vector< double > OpenNN::OrdinaryDifferentialEquations::calculate_Runge_Kutta_final_solution ( const NeuralNetwork neural_network  )  const

This method calculate the solution at the final independent variable of the ordinary differential equations model using the Runge-Kutta method.

Parameters:
neural_network Neural network which represents the external inputs to the mathematical model.

Definition at line 571 of file ordinary_differential_equations.cpp.

Matrix< double > OpenNN::OrdinaryDifferentialEquations::calculate_Runge_Kutta_Fehlberg_solution ( const NeuralNetwork neural_network  )  const

This method calculate the numerical solution of the ordinary differential equations model using the Runge-Kutta method.

Parameters:
neural_network Neural network which represents the external inputs to the mathematical model.

Definition at line 661 of file ordinary_differential_equations.cpp.

Vector< double > OpenNN::OrdinaryDifferentialEquations::calculate_Runge_Kutta_Fehlberg_final_solution ( const NeuralNetwork neural_network  )  const

This method calculate the numerical solution of the ordinary differential equations model using the Runge-Kutta-Fehlberg method.

Parameters:
neural_network Neural network which represents the external inputs to the mathematical model.

Definition at line 894 of file ordinary_differential_equations.cpp.

Matrix< double > OpenNN::OrdinaryDifferentialEquations::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. This method needs to be derived, otherwise an exception is thrown.

Reimplemented from OpenNN::MathematicalModel.

Definition at line 1092 of file ordinary_differential_equations.cpp.

Vector< double > OpenNN::OrdinaryDifferentialEquations::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. This method needs to be derived, otherwise an exception is thrown.

Reimplemented from OpenNN::MathematicalModel.

Definition at line 1125 of file ordinary_differential_equations.cpp.

std::string OpenNN::OrdinaryDifferentialEquations::to_string ( void   )  const [virtual]

This method returns a string representation of the current ordinary differential equations object.

Reimplemented from OpenNN::MathematicalModel.

Definition at line 1160 of file ordinary_differential_equations.cpp.

TiXmlElement * OpenNN::OrdinaryDifferentialEquations::to_XML ( void   )  const [virtual]

This method serializes the ordinary differential equations object into a XML element of the TinyXML library. See the OpenNN manual for more information about the format of this element.

Reimplemented from OpenNN::MathematicalModel.

Definition at line 1187 of file ordinary_differential_equations.cpp.

void OpenNN::OrdinaryDifferentialEquations::from_XML ( TiXmlElement *  ordinary_differential_equations_element  )  [virtual]

This method deserializes a TinyXML element into this ordinary differential equations object.

Parameters:
ordinary_differential_equations_element Pointer to a XML element containing the member data.

Reimplemented from OpenNN::MathematicalModel.

Definition at line 1344 of file ordinary_differential_equations.cpp.

void OpenNN::OrdinaryDifferentialEquations::save_data ( const NeuralNetwork ,
const std::string &   
) const [virtual]

Todo:

Reimplemented from OpenNN::MathematicalModel.

Definition at line 1602 of file ordinary_differential_equations.cpp.


Member Data Documentation

Initial value for the only independent variable.

Definition at line 152 of file ordinary_differential_equations.h.

Final value for the only independent variable.

Definition at line 156 of file ordinary_differential_equations.h.

Initial values for the dependent variables.

Definition at line 160 of file ordinary_differential_equations.h.

Numerical integration method (Runge-Kutta or Runge-Kutta-Fehlberg).

Definition at line 164 of file ordinary_differential_equations.h.

Number of points in the Runge-Kutta method.

Definition at line 168 of file ordinary_differential_equations.h.

Tolerance in the Runge-Kutta-Fehlberg method.

Definition at line 172 of file ordinary_differential_equations.h.

Initial number of points in the Runge-Kutta-Fehlberg method.

Definition at line 176 of file ordinary_differential_equations.h.

Number of points at which the the Runge-Kutta-Fehlberg method displays a warning message.

Definition at line 180 of file ordinary_differential_equations.h.

Number of points at which the the Runge-Kutta-Fehlberg method throws an exception.

Definition at line 184 of file ordinary_differential_equations.h.


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

Generated on Sun Aug 26 11:58:17 2012 for OpenNN by  doxygen 1.5.9