178 const Eigen::Vector2f& startingPosition)
const
180 const std::vector<Eigen::Vector2f> startPt{startingPosition};
183 std::vector<Eigen::Vector2f> points =
184 ranges::views::concat(startPt, pts) | ranges::to<std::vector<Eigen::Vector2f>>();
191 ARMARX_ERROR <<
"TSP solver failed to find a solution.";
196 ARMARX_INFO <<
"TSP tour cost (millimeters): " << cost;
202 ranges::views::transform(tour,
203 [&points](std::int64_t idx)
noexcept
204 {
return points.at(
static_cast<std::size_t
>(idx)); }) |
205 ranges::to<std::vector<Eigen::Vector2f>>();
208 orderedPoints.erase(orderedPoints.begin());
210 orderedPoints.erase(orderedPoints.end() - 1);
212 auto orderIndices = tour |
213 ranges::views::transform([](std::int64_t idx)
noexcept
214 {
return static_cast<std::size_t
>(idx); }) |
215 ranges::to<std::vector<std::size_t>>();
218 orderIndices.erase(orderIndices.begin());
220 orderIndices.erase(orderIndices.end() - 1);
223 for (
auto& idx : orderIndices)
229 return Result{.orderedPoints = orderedPoints, .orderIndices = orderIndices};