Package edu.wpi.first.math.path
Class TravelingSalesman
java.lang.Object
edu.wpi.first.math.path.TravelingSalesman
Given a list of poses, this class finds the shortest possible route that visits each pose exactly
 once and returns to the origin pose.
- 
Constructor SummaryConstructorsConstructorDescriptionConstructs a traveling salesman problem solver with a cost function defined as the 2D distance between poses.Constructs a traveling salesman problem solver with a user-provided cost function.
- 
Method Summary
- 
Constructor Details- 
TravelingSalesmanpublic TravelingSalesman()Constructs a traveling salesman problem solver with a cost function defined as the 2D distance between poses.
- 
TravelingSalesmanConstructs a traveling salesman problem solver with a user-provided cost function.- Parameters:
- cost- Function that returns the cost between two poses. The sum of the costs for every pair of poses is minimized.
 
 
- 
- 
Method Details- 
solveFinds the path through every pose that minimizes the cost. The first pose in the returned array is the first pose that was passed in.- Type Parameters:
- Poses- A Num defining the length of the path and the number of poses.
- Parameters:
- poses- An array of Pose2ds the path must pass through.
- iterations- The number of times the solver attempts to find a better random neighbor.
- Returns:
- The optimized path as an array of Pose2ds.
 
 
-