Menu

Objectives Sort Items List Respect Property Find Shortest Paths Given Nodes Develop Readab Q43799303

Objectives

  1. Sort items in a list with respect to a property.
  2. Find the shortest paths between given nodes.
  3. Develop readable and documented algorithms for businessapplications.

Scenario

Your team is working on an application for an online shoppingcompany that sells different kinds of products and ships them viacargo companies. The company recently added new product groups totheir portfolio, such as grocery and dairy, and began offeringprivilege programs to their customers, wherein they can getproducts delivered within a day. They are planning to hire/usetheir own drivers for such products and customers.

One of your team members is working on transforming data fromthe streets and addresses of the map to the node and edgestructures of a graph. Your ShortestDeliveryPath class will receivethe data as nodes, which represent delivery points or intersectionof roads, and edges, which represent the roads of the map.

The driver’s route will be from the warehouse, which is alwaysnode 1, to the first delivery point (node 2), and then from thereto the next delivery point, and so on (node n), until all thepackages are delivered. Since the application needs to sortdeliveries with respect to the due delivery time, the app needs tocalculate the shortest path more than once. For this, you will beusing the Floyd–Warshall algorithm to calculate all shortest pathpairs at once. You need to modify the FloydWarshall class to storethe street names and print the names of the streets on theroute.

Details of deliveries will be held in Shipment class. You willbe using the deliveryTimeDue variable to set the delivery timelimit and the toNode variable to set the delivery node. fromNode isalways 1, representing the warehouse from where the driver begins.But in practice, the delivery person will get all packages from thewarehouse before beginning work and will deliver each packagesequentially. Thus, in practice fromNode will change depending onthe location of the delivery person, but this variable does notneed to be updated.

Best Practices

  1. Get familiar with the Floyd–Warshall algorithm and itsapplication in this project and add any getters and setters thatyou need.
  2. Get familiar with the Shipment.java class and add any gettersand setters that you need.
  3. For easy readability, use full variable names instead of short2-3 character abbreviation.
  4. For code reusability, develop separate methods whenavailable.

Tasks

Develop theprintPath(int fromNode, int toNode) method inFloydWarshall class for printing names of the roads on the shortestpath form fromNode to toNode.

Add the following methods to the FloydWarshall class:

public String[][] getNameOfStreets() { return nameOfStreets;}

public int[][] getAdjacencyMatrix() { return adjacencyMatrix;}

public int[][] getNextToMatrix() { return comeFromMatrix; }

Develop the getDeliveryRoute(FloydWarshall graph,ArrayList<Shipment> deliveryList) method inShortestDeliveryPath class as the main method.

Your customer wants you to develop a heuristic optimizationmethod that will find possible delivery stops on the road, providedthere is enough time for the remaining deliveries. Using thisapproach, they want you to check any for possible early deliverieson the route that you previously calculated, within the deliverytime limits.

In addition, to avoid confusion, they want the barcode of thepackage to be printed after the name of the last road that leads tothat delivery point. Thus, barcode numbers will indicate when adelivery is to be made while going through the given route. Forexample: “San Carlos St (7654382) 20th St (764256682) Service RdWinter Pl (2051025601) Winter Pl Rancho Drive (105142566) SpruceAve (4561378)” indicates that deliveries need to be made at SanCarlos St, 20th St, Winter Pl, Rancho Drive, and Spruce Ave. ThePseudo Code of the heuristic algorithm is shown in theBonusPsuedocode.java file included in the project.

Use the following formula to calculate the new estimateddelivery time:

New Delivery Time = start Time + (length of the route up to the destination) / speed + (number of the stopdeliver points up to destination + 1) x (delivery processing time),

Expert Answer


Answer to Objectives Sort items in a list with respect to a property. Find the shortest paths between given nodes. Develop readabl…

OR