Life and Death in the Broccolengeti
The purpose of this week is to combine it all in one big simulation: agents, resources, obstacles, life, and death. We're going to resurrect the Broccoli fiend simulation and then take some measurements of the macro characteristics as the simulation progresses.
This will be the last Simulation given to you. Next week you'll have a two week project where you get to choose what to simulate (we'll provide some choices).
Documentation for Java 1.5 is located at: Java 1.5 SE API.
Documentation for Java 1.6 is located at: Java 1.6 SE API
Re-implement the Broccoli Fiend simulation in the general framework. The simulation should have the following characteristics.
The Broccoli should be a resource, and each Broccoli resource should
have a max quantity that can be different for each object.
- The simulation is more interesting if the Broccoli grows back as a percentage of its current value. If the Broccoli is zero, it should get the value 0.1. Otherwise, it should grow back at the specified growth rate. 25% is a reasonable growth rate. Broccoli should not grow back if it was harvested last iteration, and it should never grow beyond its max quantity. Max quantities of 2-10 are reasonable.
- The Broccoli Fiend agents should have different metabolisms and different visions. You'll need to do some experimentation to find good values. Metabolism ranges from 0.5 to 1.5 are reasonable. Vision from 3-6 is reasonable.
- Given a metabolic rate, the Broccoli Fiend should eat broccoli proportional to the distance it travels. In other words, if the Broccoli agent moves a distance d, it should burn d * metabolism broccoli.
- A Broccoli Fiend should be able to harvest only a certain amount of broocli each turn (e.g. 2.0).
- If a Broccoli Fiend's broccoli level is 0 or less at the end of a turn (postUpdateRule) it dies and should leave the simulation.
- If a Broccoli Fiend has more than 10 * metabolism broccoli, and it harvested broccoli that turn, then it can spawn a new Broccoli Fiend Agent. The new agent should have metabolism and vision values close to the parent. You might try permitting each Agent to spawn only once.
- You need to come up with a strategy for the Broccoli Fiend Agents. It should probably combine both distance moved (longer is worse) and available broccoli (more is better). An agent should not be able to move farther than its vision.
The purpose of this simulation is to generate a number of plots showing the effects of changes in the simulation parameters.
- Initialize the simulation with N agents and 4N broccoli resources, all randomly distributed. What is the pattern of the simulation? Track the number of Broccoli Fiend agents and the overall amount of broccoli available. Show these plots superimposed. [Hint, you may want to override the Iterate function in the parent Simulation in order to make calculations that are Agent/Resource specific. You can use super.Iterate() to call the parent method and then run through the data to get what you need.
- Track the number of Broccoli Fiends over time. What is the carrying capacity of the landscape? Try initializing it with 3N and 5N broccoli plants. Come up with metabolism and vision ranges that provide for reasonably stable simulations.
- With the N/4N ratio, track the average metabolism and average vision of the population over time. Each iteration, write the number of agents, average metabolism, average vision, and amount of broccoli available on the Landscape out to a file. If you write the data for each iteration as a separate line and put commas between the numbers, you can read the file directly into Excel and generate simple graphs.
- Implement an obstacle class that does not let an agent cross it. Then do something like have two parts of your simulation with different amounts of broccoli and see if different kinds of agents result. Look up the term punctuated equilibrium with respect to evolution.
- Color your Broccoli Fiend agents so that the color indicates how hungry they are.
- Explore the ranges of metabolism, broccoli regrowth, and vision and see what happens.
Make your writeup for the project a wiki page in your personal space. If you have questions about making a wiki page, stop by my office or ask in lab.
Your writeup should have a simple format.
- A brief description of the overall task, in your own words.
- As explanation of your solution, focusing on the interesting bits. The most interesting bits for this week are your quantitative results. Your agent's strategy for picking where to go is also interesting.. Any extensions you did are interesting.
- Printouts, pictures, or results to show what you did. You can do screen captures of your terminal to show the initial and final landscapes.
- Other results to demonstrate extensions you undertook.
- A brief conclusion and description of what you learned.
Once you have written up your assignment, give the page the label:
You can give any page a label when you're editing it using the label field at the bottom of the page.
Do not put code on your writeup page or anywhere it can be publicly accessed. To hand in code, please put it on the Academics server in your folder within the COMP/CS231 directory.