Java Reference
In-Depth Information
The benefit of simulations is that we can undertake experiments that we could not do with the real
system, either because we have no control over the real thing (for instance, the weather) or because
it is too costly, too dangerous, or irreversible in case of disaster. We can use the simulation to inves-
tigate the behavior of the system under certain circumstances or to investigate “what if” questions.
An example of the use of environmental simulations is to try to predict the effects of human
activity on natural habitats. Consider the case of a national park containing endangered spe-
cies and a proposal to build a freeway through the middle of it, completely separating the two
halves. The supporters of the freeway proposal claim that splitting the park in half will lead
to little actual land loss and make no difference to the animals in it, but environmentalists
claim otherwise. How can we tell what the effect is likely to be without building the freeway?
Simulation is one option. An essential question in all cases of this kind will be, of course, “How
good is the simulation?” One can “prove” just about anything with an ill-designed simulation.
Gaining trust in it through controlled experiments will be essential.
The issue in this particular case boils down to whether it is significant for the survival of a spe-
cies to have a single, connected habitat area or whether two disjoint areas (with the same total
size as the other) are just as good. Rather than building the freeway first and then observing
what happens, we will try to simulate the effect in order to make a well-informed decision. 1
Our simulation will necessarily be simpler than the scenario we have described, because we are
using it mainly to illustrate new features of object-oriented design and implementation. Therefore,
it will not have the potential to simulate accurately many aspects of nature, but some of the simu-
lation's characteristics are nonetheless interesting. In particular, it will demonstrate the structure
of typical simulations. In addition, its accuracy may surprise you; it would be a mistake to equate
greater complexity with greater accuracy. It is often the case that a simplified model of something
can provide greater insight and understanding than a more complex one, from which it is often
difficult to isolate the underlying mechanisms—or even be sure that the model is valid.
10.2
The foxes-and-rabbits simulation
The simulation scenario we have chosen to work with in this chapter uses the freeway example
from above as its basis. It involves tracking populations of foxes and rabbits within an enclosed
field. This is just one particular example of what are known as predator-prey simulations. Such
simulations are often used to model the variation in population sizes that result from a preda-
tor species feeding on a prey species. A delicate balance exists between such species. A large
population of prey will potentially provide plenty of food for a small population of predators.
However, too many predators could kill off all the prey and leave the hunters with nothing
to eat. Population sizes could also be affected by the size and nature of the environment. For
instance, a small, enclosed environment could lead to overcrowding and make it easy for the
predators to locate their prey, or a polluted environment could reduce the stock of prey and pre-
vent even a modest population of predators from surviving. Because predators in one context
are themselves often prey for other species (think of cats, birds, and worms, for instance), loss
of one part of the food chain can have dramatic effects on the survival of other parts.
1
In this particular case, by the way, size does matter: the size of a natural park has a significant impact on
its usefulness as a habitat for animals.
 
 
Search WWH ::




Custom Search