2 #include <lemon/smart_graph.h>
10 using namespace lemon;
32 int main(
int argc,
char **argv)
34 GRAPH_TYPEDEFS(SmartGraph);
36 ifstream graphFile(argv[1]);
39 if (
string(argv[2]) ==
"GRA") {
48 cout <<
"Graph reading time: " << timer.
elapsed() << endl;
51 int n = countNodes(g);
52 cout <<
"Total nodes: " << n << endl;
53 cout <<
"Total edges: " << countEdges(g) << endl;
56 cout <<
"Using greedy nearest:" << endl;
59 cout <<
"Creation elapsed time: " << greedyNearest.
creationTime() << endl;
61 cout <<
"Initialisation elapsed time: " << greedyNearest.
initTime() << endl;
64 cout <<
"Algorithm running time: " << greedyNearest.
runTime() << endl;
65 cout <<
"Max colours: " << greedyNearest.maxK() << endl;
66 cout <<
"Colours used: " << greedyNearest.totalColours() << endl;
67 cout <<
"LCA value: " << greedyNearest.lcaValue() << endl;
70 cout <<
"Could not find a solution!" << endl;
74 cout <<
"Using simulated annealing:" << endl;
77 coloursSA(g, 0, atoi(argv[3]));
78 cout <<
"Creation elapsed time: " << coloursSA.
creationTime() << endl;
79 coloursSA.
init(atoi(argv[4]), atoi(argv[5]), atoi(argv[6]), atof(argv[7]));
80 cout <<
"Initialisation elapsed time: " << coloursSA.
initTime() << endl;
82 coloursSA.initialSolution(greedyNearest.colouring());
87 cout <<
"Algorithm running time: " << coloursSA.
runTime() << endl;
88 cout <<
"Max colours: " << coloursSA.maxK() << endl;
89 cout <<
"Colours used: " << coloursSA.totalColours() << endl;
90 cout <<
"LCA value: " << coloursSA.lcaValue() << endl;
93 cout <<
"Could not find a solution!" << endl;
GraphFormat
Available graph formats.
double initialSolutionTime()
Retrieve the duration of setting the initial solution.
void readGraph(Graph &g, GraphFormat f=RMF, IS &in=std::cin)
Read a graph.
double runTime()
Retrieve the duration of running the algorithm.
virtual MinLCAStatus run()
Run the algorithm.
Definitions for a simulated annealing approach changing the colours.
Solution has been found after running.
Default namespace Default namespace for MinLCA algorithms.
Class for timing MinLCA algorithms.
Functions for reading graphs and getting graph properties.
double initTime()
Retrieve the duration of initialising the algorithm.
double creationTime()
Retrieve the duration of instantiating the algorithm class.
Contains the definitions for timing MinLCA algorithms.
double elapsed() const
Retrieve elapsed time.
Class for timing MinLCA optimisation algorithms.
int main(int argc, char **argv)
Main function.
void init(Args &&...args)
Reset the data structures of the algorithm.
Contains the definitions for timing MinLCA optimisation algorithms.
Namespace for util functions and classes.