wpimath/src/main/java/edu/wpi/first/math/optimization/SimulatedAnnealing.java
woah, cool.
wpimath/src/main/java/edu/wpi/first/math/optimization/SimulatedAnnealing.java
woah, cool.
For those confused by the lack of context, WPILib 2024 will ship a simulated annealing optimization problem solver and a traveling salesman problem solver.
Solving optimization problems involves tweaking input variables to try to minimize some cost function. Simulated annealing is good for solving optimization problems with many local minima and a very large search space (it’s a heuristic solver rather than an exact solver like, say, SQP or interior-point method). Simulated annealing is a popular choice for solving the traveling salesman problem, a problem where you’re trying to find the shortest ordered list of destinations. The class in WPILib supports a list of Pose2ds.
Oh did someone port my java to c++ a year later
What are some possible usages for these solvers?
Yea, I cleaned it up and got it merged.
See my edited post.
eg
Cool to see this made it in!
Can you provide an example for FRC usage for this?
A classic example would be finding the optimal path through a field with objects to avoid when given a starting and ending point. Some discussion on the topic in an FRC context can be found in other threads like this: Finding Optimal Path Through Game Objects
Many years ago I used my simulated annealing program (basically from Scientific America, IIRC) for computer generated pairings for a large Secret Santa gift exchange. Had rules, for example, exchange with kids within X years of age of each other and adults-to-adults, no exchanges within the same family (different last name), etc.
For those interested in the history of this feature - it was originally a personal project on the FRC discord, which we then suggested upstreaming. It took a couple years, but was never forgotten, and here it is now!
Remember that you, too, can provide major feature additions to WPILib - all you need to do is open a PR and talk about it with the other contributors. I strongly recommend that anyone graduating from FRC who wants to stay involved consider doing so through this kind of contribution - it’s good resume fodder, too.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.