TSP
sgptools.utils.tsp
resample_path(waypoints, num_inducing=10)
Function to map path with arbitrary number of waypoints to inducing points path with fixed number of waypoints
Parameters:
Name | Type | Description | Default |
---|---|---|---|
waypoints |
ndarray
|
(num_waypoints, n_dim); waypoints of path from vrp solver |
required |
num_inducing |
int
|
Number of inducing points (waypoints) in the returned path |
10
|
Returns:
Name | Type | Description |
---|---|---|
points |
ndarray
|
(num_inducing, n_dim); Resampled path |
Source code in sgptools/utils/tsp.py
run_tsp(nodes, num_vehicles=1, max_dist=25, depth=1, resample=None, start_idx=None, end_idx=None, time_limit=10)
Method to run TSP/VRP with arbitrary start and end nodes, and without any distance constraint
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nodes |
ndarray
|
(# nodes, n_dim); Nodes to visit |
required |
num_vehicles |
int
|
Number of robots/vehicles |
1
|
max_dist |
float
|
Maximum distance allowed for each path when handling mutli-robot case |
25
|
depth |
int
|
Internal parameter used to track re-try recursion depth |
1
|
resample |
int
|
Each solution path will be resampled to have
|
None
|
start_idx |
list
|
Optionl list of start node indices from which to start the solution path |
None
|
end_idx |
list
|
Optionl list of end node indices from which to start the solution path |
None
|
time_limit |
int
|
TSP runtime time limit in seconds |
10
|
Returns:
Name | Type | Description |
---|---|---|
paths |
ndarray
|
Solution paths |
distances |
list
|
List of path lengths |
Source code in sgptools/utils/tsp.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|