PROBLEM DESCRIPTION: FUPIRP is a motorized robot that sits on a flat plane of polar ice and takes a four ice core samples every day. The four locations are determined at random, but are all within 50 meters on the X and Y axis of the point where the probe came to rest. The software you are writing will determine the shortest path that the probe can possibly take to reach all four points.
The FUPIRP always travels in a straight line between sites. There are no
obstructions on
the polar plane for it to avoid.
Consider the following diagram:
The FUPIRP must move from the origin to all 4 sites in the order that makes for the overall shortest path.
The FUPIRP *will not* necessarily move from Site 1, to Site 2, etc.
The FUPIRP comes to rest at the last point reached, it does not return to the origin.
This is a variation of a travelling salesman problem. The expected solution
will use brute force, which is appropriate in this case (the number of
points are very small, and the cost of making the FUPIRP travel an
imperfect path is very expensive). A brute force solution calculates all
possible paths, and picks the shortest one. Numerous other potential
solutions exist.
There are two parts to this solution.
First, construct the view FUPIRP_PATHS which represents all vertices in a connected graph; that is to say,
a straight line vertex between every site and every other site.
HINT: All the math required for this is at http ://www.mathopenref.com/coorddist.html
Second, construct the stored procedure GET_SHORTEST_FURIRP_PATH which will output (select) a result set
as follows:
Distance ThePath
-------------- -------------------------------------------------------------------------------------------------------------
123.58 Original Position (0, 0) --> Site 1 (10, -10) --> Site 2 (18, 17) --> Site 4 (2, 45) --> Site 3 (-46, 35)
(1 row(s) affected)
HINT: This is the correct solution given the points shown in the example...