Trucks simulation
Trucks simulation
The transport simulation project in Java is a comprehensive project for an algorithms and data structures class. The project is designed to create a two-dimensional map that measures miles, where different trucks of various sizes can move between different locations to pick up and drop off shipments. The simulation is broken down into hourly increments, where trucks are either moving towards their destination, picking up a shipment at a specific source location, unloading a shipment of goods at a specified destination, or waiting for an empty loading dock at a destination to unload a shipment.
The simulation is configured from a file, and a central clock object will tick off the hours executing the truck move method in turn, pulling from a queue storing the trucks. To ensure that the trucks implement the correct methods, an interface will be implemented. Similarly, every location will be visited to perform any needed actions and record any required information.
Trucks and warehouses will be represented as objects of the appropriate class. At the start of the simulation, warehouses and trucks will be randomly created. Warehouses will have between one and three loading docs, randomly chosen, where trucks can drop-off and receive shipments. Trucks will come in three different sizes for carrying one, two, or three loads of cargo.
The simulation will be finished when the last truck has made its last delivery. When the simulation is finished, the program needs to perform an analysis of the data and indicate how efficient that particular model run was. The simulation will need to run with four different configurations, each with ten different random seeds. Each configuration should be greatly different from the others.
When a truck reaches a warehouse for pickup or drop-off, it must wait for a loading dock to become empty. If there are other trucks waiting for a loading dock, then the truck must wait its turn. Thus, trucks must access loading docks in the order of arrival.
A class will need to be created for drawing a dynamic map showing both the warehouse and truck locations. The dynamic map will keep each object type in a generic linked-list data structure. Both the truck and warehouse objects will implement the specified interface so that the dynamic-map can store the items in a common data structure.
The project will generate a report on truck and warehouse activity, recording what actions were taken and how efficiently the system ran. All specified interfaces must be implemented, and all data structures will be designed and implemented by the programmer as a generic linked-list. Three different types of trucks will inherit from a parent class, and the design must be well divided across several classes where each class has one specific functionality. Input configuration will be stored in a file and read into the simulation at the beginning of the model run. There should be a logging file, capturing all activity coming out of the system, which can be used for debugging. All output data will be written to data files for later examination.

Source code