## T2b-dtspn - Data collection path planning with curvature-constrained trajectory - Dubins TSPN

The main task is to implement two approaches solving the curvature-constrained Traveling Salesman Problem with neighborhoods.

 Deadline November 30th, 2019, 23:59 PST Points 5 Label in BRUTE T2b-dtspn Files to submit archive with DTSPNSolverDecoupled.py and DTSPNSolverNoonBean.py Resources T2b-dtspn resource pack (updated 22.11.19)

### Decoupled Approach

In the DTSPNSolverDecoupled.plan_tour function implement the decoupled solution for the Dubins TSP with Neighborhoods (DTSPN) with disk-shaped regions.

The decoupled approach comprises the following basic steps

1. Estimate sequence of visits by Euclidean TSP connecting centers of the regions.
2. For each region, sample boundary points and heading angles.
3. Find the shortest feasible tour comprising Dubins maneuvers connecting the regions, where the sequence of visits is estimated from the ETSP.

Notice, the number of heading and position samples is not defined. Your task is also to try various values and submit a code with a reasonable number of samples.

The DTSPNSolverDecoupled.plan_tour function has the following prescription

class DTSPNSolverDecoupled(DTSPNSolver.DTSPNSolver):

...

"""
Compute a DTSPN tour using the decoupled approach.

Parameters
----------
goals: list (float, float)
list of the TSP goal coordinates
neighborhood of TSP goals
turning radius for the Dubins vehicle model

Returns
-------
list (float,float,float)
tour as a list of robot configurations (x,y,phi), each corresponding to a TSP goal
"""

n = len(goals)
self.distances = np.zeros((n,n))
self.paths = {}
'''
TODO - homework
- Compute the distance between the individual goals
'''
print ('TODO distances')
self.distances = np.ones(self.distances.shape)

sequence = self.compute_TSP_sequence()

'''
TODO - homework
- Sample the configurations ih the goal areas
- Find the shortest tour
'''
print ('TODO sampling')
selected_configurations = []
for a in range(n):
selected_configurations.append ( ( goals[sequence[a]], goals[sequence[a]], math.pi ) )
return selected_configurations

### Noon-Bean Transform Approach

In the DTSPNSolverNoonBean.plan_tour function implement the Noon-Bean trasnform solution for the Dubins TSP with Neighborhoods (DTSPN) with disk-shaped regions.

The Noon-Bean approach comprises the following basic steps

1. For each region, sample boundary points and heading angles.
2. Construct a distance matrix using the Noon-Bean transform ( Lecture 5. Multi-goal (data collection) planning) where the individual regions correspond to the NoonBean's Generalized TSP sets.
3. Find the shortest feasible tour created from Dubins maneuvers by solving the Asymmetric TSP problem characterized by the distance matrix.

Notice, the number of heading and position samples is not defined. Your task is also to try various values and submit a code with a reasonable number of samples.

The DTSPNSolverNoonBean.plan_tour function has the following prescription

class DTSPNSolverNoonBean(DTSPNSolver.DTSPNSolver):

...

"""
Compute a DTSPN tour using the NoonBean approach.

Parameters
----------
goals: list (float, float)
list of the TSP goal coordinates
neighborhood of TSP goals
turning radius for the Dubins vehicle model

Returns
-------
list (float,float,float)
tour as a list of robot configurations (x,y,phi), each corresponding to a TSP goal
"""

n = len(goals)
self.distances = np.zeros((n,n))

'''
TODO - Noon-Bean approach
'''

print ('TODO - Noon-Bean')

configurations = []
for goal in goals:
configurations.append((goal,goal,math.pi))

return configurations

### Appendix

#### Installation of the Prepared Dependencies

First, download prepared codes and configuration files. Then, download and compile the LKH solver (implementation of the Lin–Kernighan heuristic algorithm) and the GDIP Dubins library as follows

cd lkh
./install.sh
cd -

cd gdip
./install.sh
cd -

#### Generalized Dubins Interval Problem 