Aptive Environmental wants to optimize a simplified technician schedule for a single day. Given travel times between stops, implement a function that returns the minimum total travel cost to start at the Aptive branch, visit every assigned stop exactly once, and return to the branch.
Write a function optimize_aptive_route(travel_times) where:
travel_times is an n x n matrix of non-negative integerstravel_times[i][j] is the cost to travel from stop i to stop j0 is the Aptive branch (start and end)If travel_times is empty, return 0. If the matrix is not square, contains negative values, or has inconsistent row lengths, raise ValueError.
Example 1
Input: travel_times = [[0,10,15,20],[10,0,35,25],[15,35,0,30],[20,25,30,0]]
Output: 80
Explanation: One optimal route is 0 -> 1 -> 3 -> 2 -> 0 with cost 10 + 25 + 30 + 15 = 80.
Example 2
Input: travel_times = [[0,5],[7,0]]
Output: 12
Explanation: The only valid route is 0 -> 1 -> 0.
0 <= n <= 12travel_times.length == ntravel_times[i].length == n0 <= travel_times[i][j] <= 10^60, but the algorithm should not rely on symmetry.