64 if(
this != &other_plug_in)
134 case IndependentParametersInput:
136 return(
"IndependentParameters");
142 std::ostringstream buffer;
144 buffer <<
"OpenNN Exception: PlugIn class.\n"
145 <<
"std::string get_input_method_name(void) const method.\n"
146 <<
"Unknown inputs method.\n";
148 throw std::logic_error(buffer.str());
260 if(new_input_method ==
"IndependentParameters")
266 std::ostringstream buffer;
268 buffer <<
"OpenNN Exception: PlugIn class.\n"
269 <<
"void set_input_method(const std::string&) method.\n"
270 <<
"Unknown plug-in method: " << new_input_method <<
".\n";
272 throw std::logic_error(buffer.str());
341 case IndependentParametersInput:
349 std::ostringstream buffer;
351 buffer <<
"OpenNN Exception: PlugIn class.\n"
352 <<
"void write_input_file(const NeuralNetwork&) const method.\n"
353 <<
"Unknown input method.\n";
355 throw std::logic_error(buffer.str());
372 if(!independent_parameters_pointer)
374 std::ostringstream buffer;
376 buffer <<
"OpenNN Exception: PlugIn class.\n"
377 <<
"void write_input_file_independent_parameters(void) const method.\n"
378 <<
"Pointer to independent parameters is null.\n";
380 throw std::logic_error(buffer.str());
481 std::ostringstream buffer;
483 buffer <<
"OpenNN Exception: PlugIn class.\n"
484 <<
"void run_script(void) const.\n"
485 <<
"Batch file_name is empty.\n";
487 throw std::logic_error(buffer.str());
516 if(!output_file.is_open())
518 std::ostringstream buffer;
520 buffer <<
"OpenNN Exception: PlugIn class.\n"
521 <<
"Matrix<double> read_output_file_header(void) const method.\n"
522 <<
"Cannot open outputs file.\n";
524 throw std::logic_error(buffer.str());
528 getline(output_file, header);
567 std::ostringstream buffer;
569 buffer <<
"Plug-in\n"
580 <<
"Display: " <<
display <<
"\n";
582 return(buffer.str());
593 tinyxml2::XMLDocument* document =
new tinyxml2::XMLDocument;
595 std::ostringstream buffer;
597 tinyxml2::XMLElement* plug_in_element = document->NewElement(
"PlugIn");
599 document->InsertFirstChild(plug_in_element);
604 tinyxml2::XMLElement* independent_variables_number_element = document->NewElement(
"IndependentVariablesNumber");
605 plug_in_element->LinkEndChild(independent_variables_number_element);
610 tinyxml2::XMLText* independent_variables_number_text = document->NewText(buffer.str().c_str());
611 independent_variables_number_element->LinkEndChild(independent_variables_number_text);
617 tinyxml2::XMLElement* dependent_variables_number_element = document->NewElement(
"DependentVariablesNumber");
618 plug_in_element->LinkEndChild(dependent_variables_number_element);
623 tinyxml2::XMLText* dependent_variables_number_text = document->NewText(buffer.str().c_str());
624 dependent_variables_number_element->LinkEndChild(dependent_variables_number_text);
630 tinyxml2::XMLElement* input_method_element = document->NewElement(
"InputMethod");
631 plug_in_element->LinkEndChild(input_method_element);
635 tinyxml2::XMLText* input_method_text = document->NewText(input_method_name.c_str());
636 input_method_element->LinkEndChild(input_method_text);
642 tinyxml2::XMLElement* template_file_name_element = document->NewElement(
"TemplateFileName");
643 plug_in_element->LinkEndChild(template_file_name_element);
645 tinyxml2::XMLText* template_file_name_text = document->NewText(
template_file_name.c_str());
646 template_file_name_element->LinkEndChild(template_file_name_text);
652 tinyxml2::XMLElement* input_file_name_element = document->NewElement(
"InputFileName");
653 plug_in_element->LinkEndChild(input_file_name_element);
655 tinyxml2::XMLText* input_file_name_text = document->NewText(
input_file_name.c_str());
656 input_file_name_element->LinkEndChild(input_file_name_text);
662 tinyxml2::XMLElement* script_file_name_element = document->NewElement(
"BatchFileName");
663 plug_in_element->LinkEndChild(script_file_name_element);
665 tinyxml2::XMLText* script_file_name_text = document->NewText(
script_file_name.c_str());
666 script_file_name_element->LinkEndChild(script_file_name_text);
672 tinyxml2::XMLElement* output_file_name_element = document->NewElement(
"OutputFileName");
673 plug_in_element->LinkEndChild(output_file_name_element);
675 tinyxml2::XMLText* output_file_name_text = document->NewText(
output_file_name.c_str());
676 output_file_name_element->LinkEndChild(output_file_name_text);
682 tinyxml2::XMLElement* input_flags_element = document->NewElement(
"InputFlags");
683 plug_in_element->LinkEndChild(input_flags_element);
688 tinyxml2::XMLText* input_flags_text = document->NewText(buffer.str().c_str());
689 input_flags_element->LinkEndChild(input_flags_text);
695 tinyxml2::XMLElement* output_rows_number_element = document->NewElement(
"OutputRowsNumber");
696 plug_in_element->LinkEndChild(output_rows_number_element);
701 tinyxml2::XMLText* output_rows_number_text = document->NewText(buffer.str().c_str());
702 output_rows_number_element->LinkEndChild(output_rows_number_text);
708 tinyxml2::XMLElement* output_columns_number_element = document->NewElement(
"OutputColumnsNumber");
709 plug_in_element->LinkEndChild(output_columns_number_element);
714 tinyxml2::XMLText* output_columns_number_text = document->NewText(buffer.str().c_str());
715 output_columns_number_element->LinkEndChild(output_columns_number_text);
721 tinyxml2::XMLElement* display_element = document->NewElement(
"Display");
722 plug_in_element->LinkEndChild(display_element);
727 tinyxml2::XMLText* display_text = document->NewText(buffer.str().c_str());
728 display_element->LinkEndChild(display_text);
745 const tinyxml2::XMLElement* element = document.FirstChildElement(
"IndependentVariablesNumber");
749 const char* text = element->GetText();
757 catch(
const std::logic_error& e)
759 std::cout << e.what() << std::endl;
767 const tinyxml2::XMLElement* element = document.FirstChildElement(
"DependentVariablesNumber");
771 const char* text = element->GetText();
779 catch(
const std::logic_error& e)
781 std::cout << e.what() << std::endl;
789 const tinyxml2::XMLElement* input_method_element = document.FirstChildElement(
"InputMethod");
791 if(input_method_element)
793 const char* input_method_text = input_method_element->GetText();
795 if(input_method_text)
801 catch(
const std::logic_error& e)
803 std::cout << e.what() << std::endl;
811 const tinyxml2::XMLElement* template_file_name_element = document.FirstChildElement(
"TemplateFileName");
813 if(template_file_name_element)
815 const char* template_file_name_text = template_file_name_element->GetText();
817 if(template_file_name_text)
823 catch(
const std::logic_error& e)
825 std::cout << e.what() << std::endl;
833 const tinyxml2::XMLElement* input_file_name_element = document.FirstChildElement(
"InputFileName");
835 if(input_file_name_element)
837 const char* input_file_name_text = input_file_name_element->GetText();
839 if(input_file_name_text)
845 catch(
const std::logic_error& e)
847 std::cout << e.what() << std::endl;
855 const tinyxml2::XMLElement* script_file_name_element = document.FirstChildElement(
"BatchFileName");
857 if(script_file_name_element)
859 const char* script_file_name_text = script_file_name_element->GetText();
861 if(script_file_name_text)
867 catch(
const std::logic_error& e)
869 std::cout << e.what() << std::endl;
877 const tinyxml2::XMLElement* output_file_name_element = document.FirstChildElement(
"OutputFileName");
879 if(output_file_name_element)
881 const char* output_file_name_text = output_file_name_element->GetText();
883 if(output_file_name_text)
889 catch(
const std::logic_error& e)
891 std::cout << e.what() << std::endl;
924 const tinyxml2::XMLElement* display_element = document.FirstChildElement(
"Display");
928 const char* display_text = display_element->GetText();
934 std::string display_string(display_text);
938 catch(
const std::logic_error& e)
940 std::cout << e.what() << std::endl;
void set_script_file_name(const std::string &)
void set_input_file_name(const std::string &)
const std::string & get_output_file_name(void) const
Returns the name of the output file.
const std::string & get_input_file_name(void) const
Returns the name of the input file.
InputMethod input_method
Type of data to be entered in the mathematical model.
size_t output_columns_number
Number of columns in the output file.
const InputMethod & get_input_method(void) const
Returns the method for including the information into the input file.
const Vector< double > & get_parameters(void) const
Returns the values of the independent parameters.
const std::string & get_input_flag(const size_t &) const
InputMethod
Enumeration of available methods for introducing neural network data into the input file...
void set_input_flags(const Vector< std::string > &)
const std::string & get_script_file_name(void) const
Returns the name of the script file.
void write_input_file(const NeuralNetwork &) const
const std::string & get_template_file_name(void) const
Returns the name of the template file.
bool operator==(const PlugIn &) const
Matrix< double > read_output_file_header(void) const
void write_input_file_independent_parameters(const NeuralNetwork &) const
void set_display(const bool &)
std::string write_input_method(void) const
Returns a string with the name of the method for including the information into the input file...
std::string output_file_name
Name of output file.
std::string script_file_name
Name of script file.
size_t dependent_variables_number
Number of dependent variables defining the mathematical model.
bool display
Flag for displaying warnings.
std::string template_file_name
Name of template file.
void set_dependent_variables_number(const size_t &)
void set_output_file_name(const std::string &)
Matrix< double > calculate_solutions(const NeuralNetwork &) const
Vector< std::string > input_flags
Vector of flags in the input file.
IndependentParameters * get_independent_parameters_pointer(void) const
Returns a pointer to the independent parameters object composing this neural network.
const Vector< std::string > & get_input_flags(void) const
Returns the vector of input file flags.
void set_input_method(const InputMethod &)
std::string to_string(void) const
Returns a string representation of the current plug-in object.
std::string input_file_name
Name of input file.
Matrix< double > read_output_file(void) const
size_t independent_variables_number
Number of independent variables defining the mathematical model.
size_t output_rows_number
Number of rows in the output file.
PlugIn & operator=(const PlugIn &)
tinyxml2::XMLDocument * to_XML(void) const
void from_XML(const tinyxml2::XMLDocument &)
void set_template_file_name(const std::string &)
void set_independent_variables_number(const size_t &)
void run_script(void) const
This method runs the script needed for executing the mathematical model.