OpenNN  2.2
Open Neural Networks Library
Public Types | Public Member Functions | Private Attributes | List of all members
OpenNN::PlugIn Class Reference

#include <plug_in.h>

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

Public Types

enum  InputMethod { IndependentParametersInput }
 

Public Member Functions

 PlugIn (void)
 
 PlugIn (const tinyxml2::XMLDocument &)
 
virtual ~PlugIn (void)
 
PlugInoperator= (const PlugIn &)
 
bool operator== (const PlugIn &) const
 
const InputMethodget_input_method (void) const
 
std::string write_input_method (void) const
 
const std::string & get_template_file_name (void) const
 
const std::string & get_input_file_name (void) const
 
const std::string & get_script_file_name (void) const
 
const std::string & get_output_file_name (void) const
 
const Vector< std::string > & get_input_flags (void) const
 
const std::string & get_input_flag (const size_t &) const
 
void set_default (void)
 
void set_input_method (const InputMethod &)
 
void set_input_method (const std::string &)
 
void set_template_file_name (const std::string &)
 
void set_input_file_name (const std::string &)
 
void set_script_file_name (const std::string &)
 
void set_output_file_name (const std::string &)
 
void set_input_flags (const Vector< std::string > &)
 
void write_input_file (const NeuralNetwork &) const
 
void write_input_file_independent_parameters (const NeuralNetwork &) const
 
void run_script (void) const
 
Matrix< double > read_output_file (void) const
 
Matrix< double > read_output_file_header (void) const
 
Matrix< double > calculate_solutions (const NeuralNetwork &) const
 
std::string to_string (void) const
 
tinyxml2::XMLDocument * to_XML (void) const
 
void from_XML (const tinyxml2::XMLDocument &)
 
- Public Member Functions inherited from OpenNN::MathematicalModel
 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 Vector< double > calculate_final_solutions (const NeuralNetwork &) const
 
virtual Matrix< double > calculate_dependent_variables (const NeuralNetwork &, const Matrix< double > &) const
 
void print (void) const
 
void save (const std::string &) const
 
void load (const std::string &)
 
virtual void save_data (const NeuralNetwork &, const std::string &) const
 

Private Attributes

InputMethod input_method
 
std::string template_file_name
 
std::string input_file_name
 
std::string script_file_name
 
std::string output_file_name
 
Vector< std::string > input_flags
 
size_t output_rows_number
 
size_t output_columns_number
 

Additional Inherited Members

- Protected Attributes inherited from OpenNN::MathematicalModel
size_t independent_variables_number
 
size_t dependent_variables_number
 
bool display
 

Detailed Description

This method represents an external mathematical model which communicates with OpenNN by means of input and output files.

Definition at line 40 of file plug_in.h.

Constructor & Destructor Documentation

OpenNN::PlugIn::PlugIn ( void  )
explicit

Default constructor. It constructs a default plug-in object, with zero independent and dependent variables.

Definition at line 26 of file plug_in.cpp.

OpenNN::PlugIn::PlugIn ( const tinyxml2::XMLDocument &  plug_in_document)
explicit

XML constructor. It creates a plug-in and loads its members from a TinyXML document.

Parameters
plug_in_documentXML document containing the plug-in members.

Definition at line 38 of file plug_in.cpp.

OpenNN::PlugIn::~PlugIn ( void  )
virtual

Destructor. It does not delete any object.

Definition at line 49 of file plug_in.cpp.

Member Function Documentation

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

Returns the solutions to the mathematical model. which are given by the independent and the dependent variables. The process is as follows:

  • Write input file.
  • Run script.
  • Read output file.

Reimplemented from OpenNN::MathematicalModel.

Definition at line 551 of file plug_in.cpp.

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

Deserializes a TinyXML document into this plug-in object.

Parameters
documentXML document containing the member data.
Todo:

Reimplemented from OpenNN::MathematicalModel.

Definition at line 741 of file plug_in.cpp.

const std::string & OpenNN::PlugIn::get_input_flag ( const size_t &  i) const

Returns a single input file flag.

Parameters
iIndex of flag.

Definition at line 210 of file plug_in.cpp.

PlugIn & OpenNN::PlugIn::operator= ( const PlugIn other_plug_in)

Assignment operator. It assigns to this object the members of an existing plug-in object.

Parameters
other_plug_inPlug-in object to be assigned.

Definition at line 62 of file plug_in.cpp.

bool OpenNN::PlugIn::operator== ( const PlugIn other_plug_in) 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. @ param other_plug_in Plug-in to be compared with.

Definition at line 94 of file plug_in.cpp.

Matrix< double > OpenNN::PlugIn::read_output_file ( void  ) const

This method reads the output file from the mathematical model. Here the output file only contains a data matrix.

Definition at line 497 of file plug_in.cpp.

Matrix< double > OpenNN::PlugIn::read_output_file_header ( void  ) const

This method reads the output file from the mathematical model. Here the output file contains a header file and a data matrix.

Definition at line 510 of file plug_in.cpp.

void OpenNN::PlugIn::set_default ( void  )
virtual

Sets the following default values in this object:

  • Input method: Independent parameters input.
  • Input file_name: input.dat.
  • Script file_name: batch.bat.
  • Output file_name: output.dat.
  • Display: true.

Reimplemented from OpenNN::MathematicalModel.

Definition at line 227 of file plug_in.cpp.

void OpenNN::PlugIn::set_input_file_name ( const std::string &  new_input_file_name)

Sets the name of the input file.

Parameters
new_input_file_nameName of input file.

Definition at line 293 of file plug_in.cpp.

void OpenNN::PlugIn::set_input_flags ( const Vector< std::string > &  new_input_flags)

Sets the flags in the input file.

Parameters
new_input_flagsFlags strings.

Definition at line 326 of file plug_in.cpp.

void OpenNN::PlugIn::set_input_method ( const InputMethod new_input_method)

Sets the method for writting the input file.

Parameters
new_input_methodMethod for inputing the input file.

Definition at line 247 of file plug_in.cpp.

void OpenNN::PlugIn::set_input_method ( const std::string &  new_input_method)

Sets the method for writting the input file from a string.

Parameters
new_input_methodMethod for inputing the input file.

Definition at line 258 of file plug_in.cpp.

void OpenNN::PlugIn::set_output_file_name ( const std::string &  new_output_file_name)

Sets the name of the output file.

Parameters
new_output_file_nameName of output file.

Definition at line 315 of file plug_in.cpp.

void OpenNN::PlugIn::set_script_file_name ( const std::string &  new_script_file_name)

Sets the name of the script file.

Parameters
new_script_file_nameName of script file.

Definition at line 304 of file plug_in.cpp.

void OpenNN::PlugIn::set_template_file_name ( const std::string &  new_template_file_name)

Sets the name of the template file.

Parameters
new_template_file_nameName of template file.

Definition at line 282 of file plug_in.cpp.

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

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

Reimplemented from OpenNN::MathematicalModel.

Definition at line 591 of file plug_in.cpp.

void OpenNN::PlugIn::write_input_file ( const NeuralNetwork neural_network) const

Thise method writes the input file with values obtained from the neural network.

Parameters
neural_networkNeural network.

Definition at line 337 of file plug_in.cpp.

void OpenNN::PlugIn::write_input_file_independent_parameters ( const NeuralNetwork neural_network) const
Todo:

Definition at line 366 of file plug_in.cpp.


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