A food service centre has an agent responsible for delivering food to multiple locations in the city. The agent needs to plan an efficient route to deliver food to the following four destinations: Nethaji Nagar, Gandhi Street, Nehru Street and Kamarajar Nagar. After completing the deliveries, the agent must return to their home to have his lunch.
Given:
ï‚· The locations of the food service center, the four destinations (Nethaji Nagar, Gandhi Street, Nehru Street, and Kamarajar Nagar), and the agent's home.
ï‚· The distances between each pair of locations.
Your task is to implement an algorithm that finds the optimal route for the food delivery agent. The algorithm should take into account the following constraints:
1. The agent must visit each of the four destinations exactly once.
2. The agent must start the route from the food service center.
3. After visiting all four destinations, the agent must return to their home.
4. The total distance travelled should be minimized.
Use the following algorithms to solve the stated problem:
1. Iterative Deepening A*