COSC 2010 / 2100 Data Structures
Fall 2018
Homework Assignment #5: The Percolation Variations
Due: Wednesday, October 3rd, 11:59PM CST
Submit: Turn in all of your Java source files using the
turnin command on Morbius, "turnin
all.java my.java files.java ...", listing instead the names of each
Java source file. You must include a class called PercRunner that contains the main program for this assignment.
Work may be completed in teams of two. The names of both partners
must appear in a comment block at the top of your files for credit to
be given.
Background
This project continues the percolation simulation built in the previous project. We expand upon this work in two significant ways. First, we add two new types of percolation flow to the simulation. Second, we will run many concurrent simulations in order to find the probability tipping point at which a given grid size is more likely to be saturated by the fluid than not.
PercRunner
The top-level class for this project is called PercRunner. PercRunner should take five items on a single line of input:
- grid size - a non-negative integer taken to be the length and width of the square simulation grid,
- runs - a positive integer indicating how many Monte Carlo simulations should be performed for each probability value,
- granularity - a positive integer denoting how many divisions of the probability range (0.0 to 1.0) should be simulated,
- threads - number of concurrent threads to launch, and
- fluid type - an integer between 1 and 3 that indicates which of
of the three fluid types (see below) to simulate.
The output of your program will consist of two lines:
Percolation tipping point p = p
Elapsed Time = t
where p is a double value probability, like 0.451, and t is a time in seconds, like 0.004.
Fluid Types
The first fluid type is highly viscous, and percolates only
vertically, not horizontally. Thus, flow from top to bottom will
occur only when a complete column is unblocked.
The second fluid type will percolate horizontally and vertically,
as in the previous project
The third fluid type flows more easily through crevices, and thus
percolates horizontally, vertically, and also diagonally in all four
directions.
Notes
- Test your classes with a wide variety of grid sizes, fluids and
granularity. What happens to the overall elapsed time as the number
of threads is increased?
- Because there is a wide variety of randomness in this assignment,
TA-Bot will not provide fixed answers, only display your output for
the tests.
Back
[Revised 2018 Sep 28 10:39 DWB]