void Perceptron::save(const char* filename)
{
   std::fstream file; 

   // Open file

   file.open(filename, std::ios::out);

   if(!file.is_open())
   {
      std::cerr << "Flood Error: Perceptron class." << std::endl
                << "void save(const char*) method." << std::endl
                << "Cannot open perceptron XML-type file." << std::endl;

      exit(1);
   }

   // Write file 

   file << to_XML(true);

   // Close file

   file.close();
}
void Perceptron::print(void)
{
   if(display)
   {
      std::cout << to_XML(true);
   }
}
void SimulatedAnnealingOrder::save(const std::string& file_name) const
{
   tinyxml2::XMLDocument* document = to_XML();

   document->SaveFile(file_name.c_str());

   delete document;
}
void TestingAnalysis::save(const std::string& file_name) const
{
    tinyxml2::XMLDocument* document = to_XML();

    document->SaveFile(file_name.c_str());

    delete document;
}
void KappaCoefficientOptimizationThreshold::save(const std::string& file_name) const
{
   tinyxml2::XMLDocument* document = to_XML();

   document->SaveFile(file_name.c_str());

   delete document;
}
void TrainingAlgorithm::save(const std::string& file_name) const
{
   tinyxml2::XMLDocument* document = to_XML();

   document->SaveFile(file_name.c_str());

   delete document;
}
void IncrementalOrder::save(const std::string& file_name) const
{
   tinyxml2::XMLDocument* document = to_XML();

   document->SaveFile(file_name.c_str());

   delete document;
}
void ModelSelection::save(const std::string& filename) const
{
   TiXmlDocument document;

   // Declaration

   TiXmlDeclaration* declaration = new TiXmlDeclaration("1.0", "", "");
   document.LinkEndChild(declaration);

   // Model selection element

   TiXmlElement* model_selection_element = to_XML();
   document.LinkEndChild(model_selection_element);

   // Save

   document.SaveFile(filename.c_str());
}
void TrainingAlgorithm::save(const std::string& filename) const
{
   std::ostringstream buffer;

   TiXmlDocument document;

   // Declaration

   TiXmlDeclaration* declaration = new TiXmlDeclaration("1.0", "", "");
   document.LinkEndChild(declaration);

   // Performance functional

   TiXmlElement* training_algorithm_element = to_XML();
   document.LinkEndChild(training_algorithm_element);

   document.SaveFile(filename.c_str());
}
void MathematicalModel::save(const std::string& filename) const
{
   TiXmlDocument document;

   // Declaration

   TiXmlDeclaration* declaration = new TiXmlDeclaration("1.0", "", "");
   document.LinkEndChild(declaration);

   // Mathematical model plug-in

   TiXmlElement* mathematical_model_plug_in_element = to_XML();
   document.LinkEndChild(mathematical_model_plug_in_element);

   // Save

   document.SaveFile(filename.c_str());

}
void ModelSelection::print(void) const
{
   std::cout << to_XML();
}