In Exercise P8.4 , drivers picked up passengers at random. Try improving that scheme. Are drivers
Question:
In Exercise •• P8.4 , drivers picked up passengers at random. Try improving that scheme. Are drivers better off picking passengers that want to go as far as possible along their route? Is it worth looking at stations along the route to optimize the loading plan? Come up with a solution that increases average revenue per mile.
Data from exercise P8.4
Simulate a car sharing system in which car commuters pick up and drop off passengers at designated stations. Assume that there are 30 such stations, one at every mile along a route. At each station, randomly generate a number of cars and passengers, each of them with a desired target station.
Each driver picks up three random passengers whose destination is on the way to the car’s destination, drops them off where requested, and picks up more if possible. A driver gets paid per passenger per mile. Run the simulation 1,000 times and report the average revenue per mile.
Use classes Car, Passenger, Station, and Simulation in your solution.
••
Step by Step Answer: