Question: Shipping Network In this lab we will be constructing a network of entities that will be working together to solve the problem. Groups of entities
Shipping Network In this lab we will be constructing a network of entities that will be working together to solve the problem. Groups of entities and teams are very common all kinds of fields and other examples of this type of programming problem appear quite frequently. So the example we will be working with here in this lab is that of a shipping network. Cargo gets introduced to the system at any one of the nodes or sites in the system and from there will need to be carried from its source to destination. This will require the theoretical companies that own the sites to dispatch vehicles to collect the cargo. Cargo whose destination is a site that is beyond the current companys network will have to work together with the other companies to get the cargo to its destination. The following map and accompanying tables show the shipping routes between 4 shipping companies in a specific network.
Starting location Destination Cost Time A C 2 1 A B 2 1 B C 3 1.5 B D 5 1 B O 9 5 B G 6 3 C A 2 1 C E 4 1 D B 4 1.25 D C 6 3 D E 2 2 D G 1 1 E F 1 .5 E D 2 1.25 F E 1 .5 F C 3 4 F L 9 4.5 F H 8 2.25 G D 1 1.5 G Q 4 1 H E 10 1 H F 9 1 H J 4 1 H K 4 1 H P 15 3 J H 3 1 J K 4 1 J L 9 1 K H 4 1 K J 3 1 K N 9 1.25 L F 6 5 L M 1 1 M L 1 1 M J 3 1 M R 6 6 N K 8 3 N H 9 4 N R 4 2 N P 5 4 O D 5 1.5 O P 3 2 O Q 3 3 P O 3 2 P N 5 3 Q G 4 1 Q O 3 2 Q P 6 4 R M 6 6 R N 3 2
Provided here for understanding is a sample network. Your solution needs to be able to adjust to whatever size and shape the network is and take in and handle cargo deliveries on that network. There are 4 companies shown here in this example (Black, Blue, Red, Green), but again, your solution should allow for any amount of companies as well as any number of nodes/sites in the network. A text file should be used to hold list of routes in the table shown above. Each company has a number of cargo carrying vehicles these actually do the job of transporting the cargo. Each vehicle works for 1 of the companies may travel between the routes listed: such as A to C taking 1 hour and costing the company 2 currency units. The vehicle can then wait until there for new cargo order since the company owns the site or it may be transferred somewhere else to take another order. If a vehicle travels to a site that they do not own they may pickup any already waiting packages bound for their own company sites, but they may not wait at the site. The must move on back to there own sites to wait. - Challenge 1- The exception is company Red which allows any company vehicles to wait at their sites. If a vehicle for another company transfers cargo for that company both companies will split the cost evenly. Lets say we get an order that starts in B, and travels to D. Company Black will make 5 currency off of the order (as the table shows). While company Blacks vehicle is in site D, it finds that there is already waiting cargo that wants to be sent to C. Company Blue (which owns D) can allow Black to carry the cargo to C (cost 6) so both companies will split 3 currency units. Again, if a companys cargo vehicle goes to a rival company to get the cargo and return it to their site the 2 companies will share the cost. Because of this companies typically prefer to carry their own cargo, but in certain situations, it may be the best option. So to decide what to do with the cargo company Blue looks at its vehicles and if none are nearby then it will allow the Black company vehicle to take the cargo. Otherwise if there is a nearby vehicle that can take the cargo Blue will use their own vehicle (so they can get the full profit/cost of the transport). - Challenge 2 - Vehicles for companies Blue and Red can transfer a total of 3 cargos (we will ignore size of the cargo and weight for now) however Black and Green can only carry 2 cargos at a time. If a cargo is bound for a site that is beyond the companies network (say from A to H), the starting location company will transfer it to another company along the way and will leave the cargo for that company to finish the job. The company will get paid in full the portion of the trip it has completed and the other company (or companies) will get their share for the portion of the trip they contribute to. Challenge 3- Company Blue has an agreement with company Black and Green to allow their vehicles to move through their sites but the cost of the trip is split along the routes that belong to company Blue. Cargo that waits at the starting location will incur a penalty of .5 currency every hour the cargo waits. So companies would be willing to allow a rival company to carry the cargo to keep from incurring penalties if they have no available vehicles. Companies will not have to pay if the cargo waits too long the trip will just be free still using 1 of their vehicles for a free trip is not appealing for a company. This is the list of vehicle for the example scenario you will be completing: Company Black 2 vehicles (A, C) Company Blue 3 vehicles (E,F,G)




A F E B | M H D K N R Q Starting location A Destination Time 1 Cost 2 2 3 B 1 A B C D | | 1.5 1 B 9 B B O G 5 3 6 2 1 1 D E B 4 4 D D E 6 2 1.25 3 2 D G F 1 1 1 .5 E E D 2 1.25 F E 1 3 .5 4 F L . 9 8 4.5 2.25 1.5 D 1 4 1 -| |||1|1|1|1|1 Q E 10 1 F 9 1 1 K P 4 4 15 1 3 J 1 H K 3 4 SEL 1 1 L 9 4 K H 1 NGUISH (UNITED STATES . K K 1 1 r K L L N F 1.25 5 M 1 1 M L M J M R unwww uncowPP OWL 1 6 3 N 4 N N . R 2 P 4 N 0 1.5 D P 0 O P Q 2 3 2 0 P N Cost Starting location Q Destination G O Time 1 Q Q P | | | 2 4 6 M 6 R R N 2 A F E B | M H D K N R Q Starting location A Destination Time 1 Cost 2 2 3 B 1 A B C D | | 1.5 1 B 9 B B O G 5 3 6 2 1 1 D E B 4 4 D D E 6 2 1.25 3 2 D G F 1 1 1 .5 E E D 2 1.25 F E 1 3 .5 4 F L . 9 8 4.5 2.25 1.5 D 1 4 1 -| |||1|1|1|1|1 Q E 10 1 F 9 1 1 K P 4 4 15 1 3 J 1 H K 3 4 SEL 1 1 L 9 4 K H 1 NGUISH (UNITED STATES . K K 1 1 r K L L N F 1.25 5 M 1 1 M L M J M R unwww uncowPP OWL 1 6 3 N 4 N N . R 2 P 4 N 0 1.5 D P 0 O P Q 2 3 2 0 P N Cost Starting location Q Destination G O Time 1 Q Q P | | | 2 4 6 M 6 R R N 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
