• So far in this course we have focused a lot on applications
that rely on simultaneous equations or finding the
maximum or minimum of a function.
• Since they rely on mathematical analysis, these are called
• For some purposes, analytic methods are roundabout.
• For showing that something (a market equilibrium, for
example) exists, some people (including a few
mathematicians and economists) would prefer a
• That means we show that the object exists, and investigate
it otherwise, by constructing an instance of it.
• A few mathematicians go so far as to reject any
proofs of the existence of an object (an infinite
number, for example) unless the proof constructs
• This probably goes too far -- but constructive
methods can contribute something to our
understanding of our models.
• Probably this is why Leon Walras proposed the
“tatonnement” model of market equilibrium.
• As we have seen, we can think of a market equilibrium as
the simultaneous solution of supply and demand equations.
• But -- some economists of Walras’ time wondered -- could
real human beings find their way to a market equilibrium
without sitting down and solving simultaneous equations?
• (After all, we don’t observe them doing that!)
• More generally -- Walras wondered -- is there any process
that would bring buyers and sellers to a market
• And if so, does it look anything like what real human
beings do in markets?
• Walras proposed the tatonnement process, a
sort of idealized auction process.
• (Tatonnement is French for “groping.”
– An “auctioneer” starts by choosing a price at
– The “auctioneer” then polls the suppliers and
demanders asking what they would want to buy
or sell at that price.
– The “auctioneer” computes the excess demand
reported by the suppliers and demanders.
• If excess demand is positive then he raises the price
a little bit.
• If excess demand is negative (there is excess supply)
he reduces the price a little bit.
– The “auctioneer” repeats until excess demand is
– Trading then takes place at the market-clearing
• Since the tatonnement process generates a market-
clearing price, it can be thought of as a
constructive model. However, it is a bit
• Another, somewhat less hypothetical constructive
model is a computer simulation.
• In computer simulation, we construct a program
that (perhaps!) generates the object we are
interested in, such as a market-clearing price.
• In agent-based computer simulation, we write a program
that simulates a population of agents (buyers and sellers,
for instance) and their interactions.
• Research along these lines has been done in economics
since the early 1990’s.
• The economists were following the example of biologists
who constructed models of “artificial life.”
• For example, an entomologist and a computer programmer
constructed a simulation model of an anthill, modelling
each ant as an individual who acted according to very
simple rules. The virtual anthill they created was realistic.
Object-Oriented Programming 1
• While it is not a requirement, agent and artificial
life simulations are often written in object-oriented
• In object-oriented languages much of the program
code is organized into objects.
• Each object has properties (such as numerical
variables) and methods, which are semi-
independent programs that can be run to transform
• Each object is an instance of a class.
Object-Oriented Programming 2
• Each instance of a particular class has the same range of
properties and the same methods, although the specific
values of some of the properties may differ from one
instance to another.
• For example, in the simulated anthill,
– The simple rules of ant behavior were methods all
members of the ant class could compute.
– All members of the ant class had properties of relative
location -- near or far from the center of the anthill,
though some were nearer and some further.
– When ants interacted, their methods and their relative
location caused them to move, resulting in different
relative locations (transforming the properties).
• In economics, the agents may have methods to
buy, sell, produce, consume, save, invest, attack,
defend, and do similar things we think real
economic agents do.
• Their properties may include endowments of
money and resources, utility, the prices they ask or
are willing to pay, and so on.
• To illustrate the idea, we have an agent-based
simulation of Walras’ tattonement process.
Two Kinds of Agents 1
Two Kinds of Agents 2
• By default there are • Agents maximize a Cobb-
– 100 buyers with 100 Douglas utility function
dollars each – Alpha is the exponent
– 100 sellers with 10 for consumer goods
units of consumer good – Beta for money
each • The simulation continues
• The starting price is until excess demand is less
random by default but can than 0.0001 of demand, or
be set, as here. 100 steps, whichever is
• All defaults can be set. first.
Here is some of the code for a “buyer” agent.
Here is the code that uses that method to get
the individual agent’s contribution to demand.
Record of tattonement process:
The random number seed was 13242
The starting price for the tattonement is 2
At round 1 price is 2 and excess demand is 1000.
At round 2 price is 3.472414 and excess demand is 469.9602.
At round 3 price is 3.644472 and excess demand is 435.9703.
At round 4 price is 6.199451 and excess demand is 153.2615.
At round 34 price is 9.99861 and excess demand is 0.0347461.
At round 35 price is 9.999093 and excess demand is 0.0226661.
About “Random Numbers”
• Random numbers seem to play a part in
many real economic processes.
• In simulations we usually substitute a series
of pseudorandom numbers.
• A sequence of pseudorandom numbers is a
series generated by a deterministic
algorithm -- not random at all, but …
• A number in a pseudorandom sequence depends on some
previous numbers in the sequence -- but via very complex
rules that make it seem unpredictable.
• A good pseudorandom sequence will closely approximate
the properties of a real random distribution, such as a
normal distribution -- mean, variance, and higher mements
and so on.
• However, if we start with the same starting point, the
algorithm will always give us the same sequence.
• This starting point is called the “random seed.”
• Here are two sequences of 56023 66066
• Each is approximately 6.865967 4.079626
normal with mean 5 and 9.287109 9.688747
standard deviation 2.5
• Their seeds are shown at 5.772239 2.198776
the top. 1.663438 14.09368
• The seeds 56023 and 10.22548 0.7177999
66066 indirectly 4.801075 3.515518
determine the starting -0.1978917 6.170837
points for the two
In the Tattonement
• Random numbers may not play any role in the
tattonement at all.
• In this version, though, the size of the step taken
by the auctioneer depends partly on a random
• As a result, the exact sequence of steps to the
equilibrium depends on the random seed.
• If we experiment with it, we will find that it
doesn’t matter -- but that is an important thing to
The Interface, Again
Try it -- set
• Comparisons such as that are a way that we
can learn from simulations.
• As you see, the interface for this simulation
allows you to reset a number of parameters,
so that you can explore the difference made
by those changes.
• This is a very simplified simulation. We could
make it more realistic by, for example,
– Allowing different buyers and sellers to have different
endowments and utility functions,
– Allowing for mistakes and/or learning by the agents,
– Matching buyers and sellers at random and letting them
trade at non-equilibrium prices.
• Many simulations of more complex economic
processes include these phenomena.
• Constructive methods can contribute to our understanding
of mathematical models.
• Walras’ “tatonnement” provides an example in economics.
• Agent-based computer simulation is a particularly rich and
powerful constructive method.
• We can, for example, construct a computer simulation of
tatonnment that will generate the whole process and
demonstrate how it converges (close) to the equilibrium