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, ndim); 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, ndim); Resampled path |
Source code in sgptools/utils/tsp.py
run_tsp(nodes, num_vehicles=1, max_dist=25, depth=1, resample=None, start_nodes=None, end_nodes=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, ndim); 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_nodes |
ndarray
|
(# num_vehicles, ndim); Optionl array of start nodes from which to start each vehicle's solution path |
None
|
end_nodes |
ndarray
|
(# num_vehicles, ndim); Optionl array of end nodes at which to end each vehicle's 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 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
|