1. Here is the change log for this assignment write-up. I will try to be descriptive in my log messages.

  2. You can also subscribe to this page and receive Emails when changes are made, though I doubt there will be many changes required.

  3. The grader tarball can be downloaded and used on an alamode machine to test your SIM.

  4. You may work with a partner, or you may work alone --- your choice. If you decide to partner up, one of you should send your instructor an Email saying as much --- deadline for this is 1 week before the due date.

Write a program SIM (meeting the usual requirements) that implements the Monte Carlo simulation for Stochastic Area Networks in section 2.4.4 of the text.

Input & Output

Your SIM program will take several arguments:

Argument

Value

1

File of $Uniform(0,1)$ values; use one of these if you like

2

Number of replications to run ($N$)

3

A text file describing the SAN (details below)

Your program should produce output such as (compared to the book's table on page 83, we are simply displaying the $\pi_k$ and $\hat{p}_a(\pi_k)$ columns):

OUTPUT    :a1/2,a2/3,a3/4,a4/6:    5.72632e-01
OUTPUT    :a1/3,a3/6:              1.81732e-02
OUTPUT    :a1/2,a2/5,a5/6:         1.51699e-03
OUTPUT    :a1/2,a2/3,a3/6:         9.45027e-02
OUTPUT    :a1/4,a4/6:              1.94422e-01
OUTPUT    :a1/3,a3/4,a4/6:         1.18930e-01

Note that the there is no specific order to the output,1 but you must provide an entry for all possible paths. The paths should be formatted without any intervening white space, beware:

OUTPUT    :a1/2, a2/3, a3/4, a4/6:  5.72632e-01

is no good

The value provided for each path is the critical path point estimate described in the book. Use at least 6 significant digits and scientific notation for the point estimates. The output above is nicely formatted into columns, but your results don't need to be (in fact I've prettied up the aforementioned output from my own results).

SAN Description Files

Consider the following network:

network-example.svg

this would be represented as a simple text file:

1 2 3
2 3 5
1 4 6
1 3 2
4 3 1.5
4 5 6
3 5 4

Per row, the first term is the source node, the second term is the destination node, and the third term is the upper bound for a $Uniform(a,b)$ distribution. For instance, the distribution for the a13 arc should be $Uniform(0,2)$. The largest numbered node in the second column (over all the nodes in the network) may always be considered the terminal node and node 1 will always be the single source node of the network.

Submit Your Work

Partners

You may complete this assignment with a partner from the course (but you may also work solo if you choose). Individual assessments (such as exams) may have questions specific to course programming assignments — so be sure you and your partner are truly working as a team and have a solid understanding of your submission's design and algorithms.

If you decide to partner, you must tell your instructor one week before the assignment due date. Only one of you should submit the assignment for grading. You will both be able to see the grading result from your own logins.

Checking and Submitting Your Work

Here are some things to double check your submission against:

  1. Your archive does not raise errors when "unrolling" with the ${SIMGRADING}/explode-subm script.

    tmpdir@alamode $ ls
    my-sim.zip
    tmpdir@alamode $ "${SIMGRADING}/explode-subm" -P SIM my-sim.zip ./here
  2. Your archive contains only the essential files, don't provide unneeded files

  3. Don't provide files that have been provided to you (such as uniform-0-1-00.dat); that would just be silly.

  4. Make sure the grader.sh script for the assignment runs to completion.

You aren't required to use .zip files, explode-subm knows about the usual suspects: .tar, .tar.gz, .tar.bz2 ...

When you are happy with your work, log into the course website and submit your project archive file for grading.

grader.sh

Students have access to the same script I'm providing the grader for testing your SIM. Here is how to use it:

First, download this tarball to your Mines Linux account ("alamode" machines!) and unroll it in a temporary directory.

$ ls criticalpath-student.*
criticalpath-student.tar.bz2
$ mkdir tmp
$ cd tmp
$ tar xjf ../criticalpath-student.tar.bz2

Second, set the SIMGRADING environmental variable with:

$ source ~khellman/SIMGRADING/setup.sh ~khellman/SIMGRADING

Now go to the directory holding your CriticalPath SIM (is it ~/sim/critpath or something else?) and execute the grader.sh script from the criticalpath-student.tar.bz2 resource.

$ cd ~/sim/critpath
$ ls SIM
SIM
$ ~/tmp/CriticalPath/grader.sh
:
:
:

You will need to read any messages from the script carefully, and you may need to hit ENTER several times throughout its course. This script checks for:

  1. missing tracefiles
  2. truncated tracefiles
  3. incorrect edge weight randomization
  4. correct reporting of multiple critical paths
  5. a result formatting
  6. and the difference between SIM results and expected results

The latter test generates PDFs files for your inspection. The red dots are the result of SIM point estimates using $N=1000$ replications; the blue dots are the expected results from eight $N=300$ trials. The $x$ coordinate for all plots are the point estimates from an $N=10000$ experiment. The grey line is the line of identity ($y=x$). Your SIM's red dots should be closer to the line of identity than most of the blue dots.

Here is an example of one of the plots generated by grader.sh:

san 1201 result

If you are concerned that some of your SIM's red dots are too far away from the line of identity, you can easily run grader.sh using a larger number of replications. This should bring your data closer to the $y=x$ --- if it doesn't you probably have a flawed SIM. To run with a larger $N$:
$ ~/tmp/CriticalPath/grader.sh . 2500
Note the first argument of a period (.), more usage details for grader.sh can be found with --help as the first argument.

The grader will use the same grader.sh script, but different SAN files. The network files included in criticalpath-student.tar.bz2 are representative of the network files used for grading.

Rubric

This work is worth 46 points.

Requirements

Points

Notes

Meets simulation course project requirements

10

Proper termination with missing or truncated input files

5

exit(1) for missing files or when random numbers run out

Proper edge allocation algorithm

5

$Uniform(a,b)$ once per edge per replication

Detects and reports multiple critical paths correctly

5

Output meets requirements (formatting of paths, point estimates)

5

san-leemis79.net results

5

san-1201 results

5

san-161009 results

5

Correct submission

1

  1. Because we have sort -n -k2 at our disposal (1)

Assignments/StochasticAreaNetworks/CriticalPath (last edited 2023-12-27 12:12:44 by khellman)