The Makefile and the server code so that your server, after startup (and outputting the 3 lines #nodes, #arcs, sum of arc durations), should enter its interactive mode:
It will read queries on stdin of the form (one query per line)
48.3456,2.3456->-56.9876,10.4500\n
Where each lat/lng will be the lat/lng of a node of the road graph (i.e. a lat/lng that is
the first or last point of the road, or a lat/lng that appears at least twice in the dataset
(possibly on the same road)).
-
If the query is valid (each lat/lng corresponds exactly to a node of the road graph),
your server should output on stdout the total duration of the shortest path on the
road graph between these nodes, in seconds (eg. 6345.23718).
I will verify the answer with a precision of 0.01. Be careful with that: cout << x doesn't output a double with a lot of accuracy. Use printf("%.6lf") instead.
-
If the lat/lngs are valid nodes of the graph, but there is no path, you server should output NO PATH
-
If the query is invalid (bad format, or invalid lat/lng, or lat/lng not found in the input data),
your server should output a line starting with INVALID on stdout.
Use test.sh to test your server: bash test.sh ./server. WARNING: it does not test everything. In particular, it does not verify the path description (i.e. the list of arc lengths along the path), it checks only the length of the shortest path. Also, it only sends one query! Your server must support multiple queries, I will test for that.
To get a better score, your server can, next to the total path duration, output the space-separated list of arc durations along the shortest path. Be careful: I want the natural order, i.e. if the shortest path is 0->1->2, I want the arc duration of 0->1, then the arc duration of 1->2.
The answer to one query should be on a single line. The answers to the next query will be on the next output line (and so on).