CS 261 Homework 8 - Space Port Simulation

Due Mon Apr 28 at 11:59pm

Overview

In this assignment, you will have a chance to experiment with different implementations of HashMaps, testing the effects of different hashing algorithms, methods for dealing with collisions, and other parameters.

But in order to make things a little more interesting, you'll be experimenting with the effects of HashMap implementations in the context of a system simulation. Simulations are one of the most common uses of computer programs and advanced data structures--we develop a "model" (like an ADT) of the system at work, and then test that model with a sequence of sample inputs to see how it behaves and changes over time. This is very helpful both for understanding the model, understanding the phenomenon the model represents, and even testing whether the model is accurate or not!

For this assignment, you will be implementing HashMaps to model a few different Intergalactic Space Ports! Ships will arrive and be "docked" at your space port in a particular berth, eventually leaving when the pilot's business is concluded. You'll be keeping track of how many "collisions" occur between ships, either when bringing a ship into dock, or ferrying people to the proper berth. Furthermore, the Authorities who run the space port are highly worried about piracy and the transporation of dangerous goods, and so have a policy that involves random "inspections" of docked ships for illegally smuggled goods. (Of course, the security theater means that the inspections aren't implemented very cleanly, and they Authorities have a habit of trying to inspect ships that aren't actually in port---and searching for the non-existent ship involves colliding with those already docked!) Finally, you'll keep trac of the amount of space required for berths in your spaceport, since your parking garage is on prime galactic real estate.

This assignment should be completed individually. You are welcome to ask for help from me, or from your classmates (but remember to follow the Gilligan's Island rule)! Note that much of the code for this assignment can be adapted from chapter 7 of the textbook or from class lecture code, so it should be straightforward to write (and doable in the relatively short time provided).

Objectives

Necessary Files

You will need a copy of the Hwk8.zip file. This file contains a pile of classes to get you started. Since the goal of this assignment is to experiment with HashMaps, I've provided the framework for running the simulation---however, you can improve this simulation as an extension to the assignment!

The zip file contains the following classes:

The zip file also contains a couple of simulations to test with--these are squences of "events" (arrivals, departures, etc) that your simulation will run. simulation0.txt contains the most basic example of events--you are also welcome to modify this to test other cases (e.g., when particular ships arrive/leave/etc.). simulation1.txt contains a sequence of ~1000 "events" (arrivals, departures, etc), and simulation2.txt contains ~15000.

Lastly, the zip contains the README for the assignment, which you will need to fill out. You will need to do some actual analysis and writing for this readme, so don't forget it!

Assignment Details

You will be creating a number of new classes for this assignment. However, they should be pretty straightforward, and you can use inheritance to avoid code duplication!

Timeline

This assignment involves a few moving parts, but most of the work (implementing HashMaps) can be adapted from the textbook and the lecture code, allowing you to focus in on tracking the statistics of the simulation. But since we'll be continuing to talk about HashMaps, you may consider completing this assignment in the following order:

Extensions

There are a number of extensions you can include, for possible 10 pts of extra credit this time!

Submitting

BEFORE YOU SUBMIT: make sure your code is fully documented and functional! If your code doesn't run, I can't give you credit! Your name should be in the class comment at the top of each class.

Submit all your classes to the Hwk8 submission folder on hedwig. Make sure you upload your work to the correct folder!. You should upload your entire src folder with all your classes. Be sure to complete the provided README.txt file with details about your program--this is a really important part of the assignment!

The homework is due at midnight on Monday, Apr 28.

Grading

This assignment will be graded on approximately the following criteria: