The applet requires Java 1.4.1 or higher. It will not run on Windows 95 or Mac OS 8 or 9. Mac users must have OS X 10.2.6 or higher and use a browser that supports Java 1.4. (Safari works, IE does not. Mac OS X comes with Safari. Open Safari and set it as your default web browser under Safari/Preferences/General.) On other operating systems, you may obtain the latest Java plugin from Sun's Java site.

created with NetLogo

view/download model file: simple_oil_market.nlogo

The model represents a simple oil market. It has three kinds of breeds, which are: buyers and two different sellers. The first sellers named sellers1 represent the OPEC member and the second named sellers2 represent the non OPEC member. The interaction between buyers and sellers is simulated by observing single supply and demand functions and then aggregating them.

The model evaluates equilibrium price and quantity in short term and long one.

Every turtles (agents) have a single linear demand referred to the buyers and supply function referred to the sellers. Initial price is fixed randomly in range (0, 20). Linear functions are generated according to the equation:

y = a - bx ; demand function

y = c + dx ; supply function for sellers2

y = constant ; supply function for seller1. The quantity is managed by a slider.

where:

y is the quantity,

and

x is the price.

The coefficients a, b, c and d are random. Single demand (supply) function is defined choosing values a, b, c, d. They represent intercept and slope of the line.

These values are generated through uniformly distributed shocks in the parameters:

- demand function for short term

a = (alpha + ((random-normal 0 1) * w)

b = (1 + ((random-normal 0 1) * k)

- demand function for the long term

a = (alpha + ((random-normal 0 1) * w)

b = (4 + ((random-normal 0 1) * k)

- for supply function

set c (beta + ((random-float 1) - 0.5)* v)

set d (2 + ((random-float 1) - 0.5)* h)

To aggregate the functions, the exchange procedure, given two prices (in the model 5 and 15), add up single quantities to obtain two points of the aggregate demand and supply. With these points the curve is obtained by interpolation. Setting aggregate demand equal to aggregate supply, we obtain equilibrium price and quantity.

Before pushing SETUP, it is possible to modify any parameter with the appropriate slider or to insert values in the input cells:

Canals : are the patches where turtles can exchange

buyer_number : number of buyers

seller_number_1 : number of sellers 1 (OPEC)

seller_number_2: number of sellers 2 (non OPEC)

OPEC_offer: quantity of single seller 1

alpha : constant of demand function intercept

beta : constant of supply function intercept

w: to increase range of variation in single demand intercept

k: to increase range of variation in single demand slope

v: to increase range of variation in single supply intercept

h: to increase range of variation in single supply slope

except the first four sliders, all the other inputs can be changed while the simulation is running.

The switcher long term, allows to pass from short term to long one during the simulation.

After setting parameters and number of agents, the button SETUP can be pushed. In this way turtles are created and the initial price is fixed randomly.

The GO button will start the simulation.

Modifying parameters which influence intercept, the equilibrium price and quantity have an increase in volatility, and a major increment in quantity is noticed.

Changing the OPEC offer quantity makes a consistent price variation during the simulation.

Hence, during the simulation, the variation of parameters alpha and gamma could be interpreted as a "shock" in the aggregated demand and aggregated supply, which modify the equilibrium price.

Passing form short term to long one it's possible to see the difference in variation of price, quantity and the other variables.

The model can be improved in different ways in order to show a more accurate and realistic market, for example, using agents with non-linear demand and supply function or raising the number of variable that determinate the real market function.

This model was created as a project work for the course of "Computer Science, Simulation and Economics" (2007-2008) held by Professor Pietro Terna, at the Faculty of Economics, University of Turin.