TSPLIB
|
Transforms the instances of the TSPLIB to the xml structure. More...
#include <iostream>
#include <stdexcept>
#include <string>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <xercesc/util/XMLException.hpp>
#include <xercesc/dom/DOMException.hpp>
#include <xercesc/util/OutOfMemoryException.hpp>
#include "TransformConstantsClassesAndFunctions.hpp"
Go to the source code of this file.
Functions | |
int | main (int argc, char *argv[]) |
Variables | |
XERCES_CPP_NAMESPACE_USE const vector< vector< double > >::size_type | N_THRESHOLD = 4000 |
Transforms the instances of the TSPLIB to the xml structure.
Transforms the instances of the TSPLIB to the xml structure. The instance has to be a symmetric or asymmetric travelling salesman problem instance. Every keyword must be on a new line and is allowed to be used only once. Note that the symbol ":" has to follow the keywords immediately. The order possibilities of the input keywords are: 1) "NAME:", "TYPE:" (= "TSP"), "COMMENT:", "DIMENSION:", "EDGE_WEIGHT_TYPE:" (= "GEO"), ("EDGE_WEIGHT_FORMAT:" (= "FUNCTION"),) DISPLAY_DATA_TYPE:" (= "COORD_DISPLAY"), "NODE_COORD_SECTION", coordinates, "EOF", 2) "NAME:", "TYPE:", "COMMENT:", "DIMENSION:", "EDGE_WEIGHT_TYPE:" (= "EUC_2D" / "CEIL_2D"), "NODE_COORD_SECTION", coordinates, "EOF", 3) "NAME:", "TYPE:", "COMMENT:", "DIMENSION:", "EDGE_WEIGHT_TYPE:" (= "ATT"), "NODE_COORD_SECTION", coordinates, "EOF", 4) "NAME:", "TYPE:" (= "TSP"), "COMMENT:", "DIMENSION:", "EDGE_WEIGHT_TYPE:" (= "EXPLICIT"), "EDGE_WEIGHT_FORMAT:" (= "FULL_MATRIX"), "EDGE_WEIGHT_SECTION", matrix entries, "EOF", 5) "NAME:", "TYPE:" (= "TSP"), "COMMENT:", "DIMENSION:", "EDGE_WEIGHT_TYPE:" (= "EXPLICIT"), "EDGE_WEIGHT_FORMAT:" (= "FULL_MATRIX"), "TAG_DISPLAY_DATA_TYPE" (= "TWOD_DISPLAY"), "EDGE_WEIGHT_SECTION", matrix entries, DISPLAY_DATA_SECTION, coordinates, "EOF", 6) "NAME:", "TYPE:" (= "TSP"), "COMMENT:", "DIMENSION:", "EDGE_WEIGHT_TYPE:" (= "EXPLICIT"), "EDGE_WEIGHT_FORMAT:" (= "LOWER_DIAG_ROW"), "EDGE_WEIGHT_SECTION", matrix entries, "EOF", 7) "NAME:", "TYPE:" (= "TSP"), "COMMENT:", "DIMENSION:", "EDGE_WEIGHT_TYPE:" (= "EXPLICIT"), "EDGE_WEIGHT_FORMAT:" (= "LOWER_DIAG_ROW"), "TAG_DISPLAY_DATA_TYPE" (= "TWOD_DISPLAY"), "EDGE_WEIGHT_SECTION", matrix entries, DISPLAY_DATA_SECTION, coordinates, "EOF", 8) "NAME:", "TYPE:" (= "TSP"), "COMMENT:", "DIMENSION:", "EDGE_WEIGHT_TYPE:" (= "EXPLICIT"), "EDGE_WEIGHT_FORMAT:" (= "UPPER_ROW"), "EDGE_WEIGHT_SECTION", matrix entries, "EOF", 9) "NAME:", "TYPE:" (= "TSP"), "COMMENT:", "DIMENSION:", "EDGE_WEIGHT_TYPE:" (= "EXPLICIT"), "EDGE_WEIGHT_FORMAT:" (= "UPPER_ROW"), "TAG_DISPLAY_DATA_TYPE" (= "TWOD_DISPLAY"), "EDGE_WEIGHT_SECTION", matrix entries, DISPLAY_DATA_SECTION, coordinates, "EOF", 10) "NAME:", "TYPE:" (= "ATSP"), "COMMENT:", "DIMENSION:", "EDGE_WEIGHT_TYPE:" (= "EXPLICIT"), "EDGE_WEIGHT_FORMAT:" (= "FULL_MATRIX"), "NODE_COORD_SECTION", matrix entries, "EOF". The program uses 2 different strategies to create the XML file. The choice which one will be used is determined by the value of the N_THRESHOLD constant.
Definition in file TransformTSPLIB.cpp.
int main | ( | int | argc, |
char * | argv[] | ||
) |
The main function.
argc | Number of elements in the array argv, in particular 1 or 4. |
argv | Name of the running program or name of the running program, the name of the input file and the name of the output file. |
Definition at line 95 of file TransformTSPLIB.cpp.
References TransformInstance::getN(), INPUT_FILE_FILENAME_EXTENSION_ATSP, INPUT_FILE_FILENAME_EXTENSION_TSP, N_THRESHOLD, OUTPUT_FILE_FILENAME_EXTENSION, readInputFileTSPLIB(), writeOutputFile(), and writeOutputFileWithoutUsingAParser().
XERCES_CPP_NAMESPACE_USE const vector<vector<double> >::size_type N_THRESHOLD = 4000 |
A threshold value of the size of the graph (i.e. of the number of vertices) which determines if the program uses the safe method to create the xml file or the quicker method which provides no guarantee that the output file is a valid XML file.
Definition at line 81 of file TransformTSPLIB.cpp.
Referenced by main().