CS 216 - Data Structures
Homework #4

Due: Wednesday 2/27 at the beginning of class

NOTE: This work is to be done in pairs.

Monte Carlo Simulation

1. Customizing MCInvest: [Complete and submit individually.] Take the Monte Carlo investing simulation (MCInvest.java) that we developed in class and customize it for your personal set of assumptions.  Submit via paper, README, or MCInvest block comment a justification for your parameter choices (e.g. work years, savings rate, withdrawal rate, income replacement fraction, etc.) and describe any additional modifications you make to the simulation model.  This is an opportunity to invest significant thought into choices in your near future that will significantly impact you and your family in the distant future.  That's right: Here's an opportunity to get credit for taking the time to plan for your retirement investment strategy beyond graduation.

2. Rebalancing Illustration: (Note: The following scenario is not realistic, but rather illustrative.  In the real world, asset classes with similar returns are often highly correlated.  Rebalancing among asset classes with different returns drags performance towards the lesser return, yet serves to keep the asset proportions and thus the expected volatility stable as opposed to an expected increase over time as high risk - high reward assets grow out of proportion.)

Consider the following scenario:  Two non-correlated domestic equity (stock) funds, A and B, had the same return geometric mean (1.093281) and standard deviation (0.202191) from 1928-2010.  That is, returns in Java may be computed as 1.093281 + random.nextGaussian() * 0.202191, where random is an object of type Random.

Suppose one investor starts with half invested in A and half invested in B.  A and B experience the same set of returns over 40 years, but in different random order.

Another investor rebalances once a year back to the initial 50%/50% balance between amounts in A and B.  Assuming that the beginning balance is 1 (.5 each in A and B), use Monte Carlo simulation (1,000,000 trials) to estimate and print the expected final balances for non-rebalancing and rebalancing scenarios.

Implementation notes: In an array of length 40, generate 40 years of returns for fund A as described above. Then clone (copy) the array for B and shuffle it using the Fisher-Yates Shuffle.

A Taste of AI - Part II

3. Depth-Limited Search: Implement depth-limited search in DepthLimitedSearcher.java (extending Searcher), which has a constructor that takes a depth limit.

4. Iterative-Deepening Depth-First Search: Implement iterative-deepening depth-first search in IDDFSearcher.java.  The implementation will make use of your DepthLimitedSearcher.