input: Write a python function to optimize the operation of a robot that finds the optimal path from a start cell to an end cell, minimizing the cost based on a given map function and cost map.
  assert optimize_robot(lambda x: [(x[0]+1, x[1]), (x[0], x[1]+1)], {(0,0): 1, (0,1): 2, (1,0): 2, (1,1): 1}) == [(0,0), (1,0), (1,1)]
  assert optimize_robot(lambda x: [(x[0]-1, x[1]), (x[0], x[1]-1)], {(0,0): 1, (-1,0): 2, (0,-1): 2, (-1,-1): 1}) == [(0,0), (-1,0), (-1,-1)]
  assert optimize_robot(lambda x: [(x[0]+1, x[1]), (x[0], x[1]+1)], {(0,0): 1, (0,1): 3, (1,0): 2, (1,1): 2}) == [(0,0), (1,0), (1,1)]
output: def optimize_robot(map_func, cost_map):
      import heapq
  
      def dijkstra(start, goal):
          pq = [(0, start)]
          costs = {start: 0}
          parents = {start: None}
          visited = set()
  
          while pq:
              current_cost, current_node = heapq.heappop(pq)
  
              if current_node in visited:
                  continue
  
              visited.add(current_node)
  
              if current_node == goal:
                  break
  
              for neighbor in map_func(current_node):
                  if neighbor in cost_map:
                      new_cost = current_cost + cost_map[neighbor]
                      if neighbor not in costs or new_cost < costs[neighbor]:
                          costs[neighbor] = new_cost
                          heapq.heappush(pq, (new_cost, neighbor))
                          parents[neighbor] = current_node
  
          return parents, costs
  
      start = min(cost_map, key=cost_map.get)
      goal = max(cost_map, key=cost_map.get)
      parents, costs = dijkstra(start, goal)
  
      path = []
      current = goal
      while current is not None:
          path.append(current)
          current = parents[current]
  
      return path[::-1]