## "Agent Walras."

The applet requires Java 5 or higher. Java must be enabled in your browser settings. Mac users must have Mac OS X 10.4 or higher. Windows and Linux users may obtain the latest Java from Oracle's Java site.

Here you can find an introduction to the Agent Walras application.

## WHAT IS IT?

This program is aimed in simulating a discrete time and simplified version of a walrasian auction market model.

## HOW IT WORKS

The bidders are created and then provided each of an initial desired amount and of an initial stock of the good.Through the initial price - decided by the user - the auctioneer derives from the initial owned and desired amounts the market demand, the market supply and so the excess demand. Then, it adjusts the price positively if the excess demand is positive, negatively if the excess demand is negative and the cycle
is repeated

## HOW TO USE IT

Click the setup button to set up the bidders and the auctioneer.

With the “n-of-bidders” slider you can choose the number of bidders;

with the “desire” and the “endowments” sliders you can choose the mean of the two normal random variable from which the initial desired amount and the initial owned amount of each bidder is drawn;

with “endowments_variance” and “desire_variance” you can set the related variance;

with “p_adj_parameter” you define the proportion of the excess demand used by the auctioneer to adjust the price tick by tick;

with “price_sensitivity” you define the sensitivity to price of the demand and the supply of the good;

with the “auctioneer_orientation” chooser you decide whether the auctioneer stops the bargaining when the excess demand function hits the zero or not.

Now you can click the go button and see the behavior of the system under the given specification.

## THINGS TO NOTICE

Check in which occasions the system succeed in stabilizing itself in an excess-demandprice couple for which the Walras law holds.
Another interesting thing is recognizing the finite difference equation that describes the behavior of the system.

## EXTENDING THE MODEL

It could be interesting to change the distribution of the desires and endowments random variables and check the robustness of the behavior of the system to similar changes.

In the present specification, the modulus of the price sensitivity parameter is the same for the demand and the supply, a possible change may be to make them differ also in modulus.

## CREDITS AND REFERENCES

Cowell, Frank A. Microeconomics: Principles and Analysis. Edited by Oxford University Press (2005)

Walras, Leon. Éléments d’économie politique pure. Italian translation used: Elementi di economia politica pura. Edited by Il Sole 24 Ore (2010)

# CODE

```;-----------------------------;;  THE INTRODUCTION  ;;---------------------------------------------------------

breed [bidders bidder]                                ;; defines the "bidders", i.e. the agents which will take part to the auction

breed [auctioneer]                                    ;; defines the "auctioneer", i.e. the agent which will be the arbiter of the auction

auctioneer-own [desired_amount                        ;; the desired amount of the bidders

owned_amount                          ;; the endowments of the bidders, constant over time
]

bidders-own [pre_check_desired_amount                 ;; the random variable which is at the base of the agent's desired amount
pre_check_owned_amount                   ;; the random variable which will be at the base of the agent's owned amount
owned_amount
desired_amount
]

globals [sum_desired_amount
sum_owned_amount
effective_demand                             ;; not to be intended as the standard economic concept of effective demand (the demand
;; of an agent which is constrained in another market) but simply as the amount the

effective_supply                             ;; the same reasonement as above

effective_demand_in_t                        ;; the updated effective supply
effective_supply_in_t                        ;; the updated effective demand
price_t-1
price
excess_demand                                ;; the excess demand, further defined in the walrsian way
excess_demand_in_t-1
]

;-----------------------------;;  THE SETUP  ;;---------------------------------------------------------

to setup

clear-all
reset-ticks

create-bidders n-of-bidders                                                       ;; allows the user to decide the number of players in the auction through the "n-of-businessmen" slider

[set pre_check_owned_amount random-normal endowments endowments_variance        ;; I define the individual endowments as realizations from a random variable
;; which is normally distributed with MEAN defined by the "endowments" slider
;; and VARIANCE defined by the "desire_variance" slider

if pre_check_owned_amount >= 0                                                ;; the procedure at the left is aimed to avoid the case of negative endowments:
[ set owned_amount pre_check_owned_amount                                   ;; if the random assignement of endowment to the x-th bidder is negative, it is
]                                                                           ;; substituted by a zero.
if pre_check_owned_amount < 0
[ set owned_amount 0
]

set sum_owned_amount (sum_owned_amount + owned_amount)                         ;; the aggregate endowments

set shape "person"
setxy random-xcor random-ycor

set pre_check_desired_amount random-normal desire desire_variance              ;; I define the individual desired amount as a realization of a random variable
;; which is normally distributed with MEAN defined by the "desire" slider
;; and VARIANCE defined by the "desire_variance" slider

set desired_amount (pre_check_desired_amount - owned_amount)                   ;; with this, I define if the agent is or is not a net demander
;; on this base, it will contribute negatively or positively to the aggregate demand.
;; The agent will be "dressed" in blue if a net supplier, in red if a net demander,
;; in grey if a neutral agent
if desired_amount > 0
[set color red
]
if desired_amount = 0
[set color grey
]
if desired_amount < 0
[set color blue
]

set sum_desired_amount (sum_desired_amount + desired_amount)                   ;; the aggregate demand
]

create-auctioneer 1

[set price initial_price                                                                 ;; I create the auctioneer, just one agent settled in the center of the monitor
;; and aimed in checking the aggregate market demand of the agents
;; defining the price of our good

set effective_demand (sum_desired_amount - price_sensitivity * price)                   ;; The aggregate demand, as a function of the price, the user may modify the
;; demand responsiveness to the price through the "price_sensitivity" slider.

set effective_supply ((sum_owned_amount / 2) + price_sensitivity * price)               ;; The aggregate supply, as a function of the price.the user may modify the
;; supply responsiveness to the price through the "price_sensitivity" slider.
;; The aggregate stock is halved to avoid to have an aggregate supply
;; greater then the aggregate stock. Economically, such halving may be justified
;; by a precautional behavior of the sellers, thwarted by mean of the price.

if effective_supply <= sum_owned_amount

[ set effective_supply effective_supply                                               ;; This procedure (the present and the next 4 row)is needed to avoid
]                                                                                     ;; that, even after the halving of the aggregate stock, the effective supply
;; is greater than the sum of the stocks.

if effective_supply > sum_owned_amount

[ set effective_supply sum_owned_amount
]

if price = 0                                                                           ;; I avoid the irrational case of positive supply when the price is null
[ set effective_supply 0
]

set excess_demand (effective_demand - effective_supply)
set shape "turtle"
setxy 0 0
]

end

;-----------------------------;;  THE AUCTION  ;;---------------------------------------------------------

to go                                                         ;; THE CYCLE THROUGH WHICH THIS AUCTION MODEL OPERATES TIME BY TIME
;; Each of the following two instruction will be accurately defined below.

priceShout
update

if auctioneer_orientation = "dirigiste" and ticks > 10         ;; When this option is selected, the auctioneer waits ten ticks (time units), then stops the market
;; as it sees that a positive excess demand is followed by a null negative excess demand.
;; Otherwise, the chooser is setted at "laissez-faire" and the auctioneer doesn't stop the market.
[if excess_demand * excess_demand_in_t-1 <= 0
[stop
]
]

tick                                                       ;; Update the ticks' counter
end

to priceShout

[ set price_t-1 price                                                   ;; the old excess demand and the old prices are recorded as "excess_demand_in_t-1" and "price_t-1"
set excess_demand_in_t-1 excess_demand

set price (price_t-1 + p_adj_parameter * excess_demand_in_t-1)        ;; The price variable is adjusted proportionally to the excess demand, through
;; a price adjustment parameter ("p_adj_parameter") modifiable via a slider by the user

if price >= 0                                                         ;; if the resulting price is greater than zero, the adjustment is accepted
[set price price
]

if price < 0                                                          ;; if the resulting price is smaller than zero, the price variable is equated to zero
;; by default; negative price makes no sense.
[set price 0
]
]

end

to update

[ set effective_demand_in_t (sum_desired_amount - price_sensitivity * price)        ;; the auctioneer updates the aggregate demand
set effective_supply_in_t (((sum_owned_amount / 2) + price_sensitivity * price))  ;; and the aggregate supply

if effective_supply <= sum_owned_amount                                          ;; another time, to avoid impossible value of the aggregate supply

[ set effective_supply effective_supply
]
if effective_supply > sum_owned_amount
[ set effective_supply sum_owned_amount
]

if price = 0                                                                     ;; nobody would like to sell something when the price is null
[ set effective_supply 0
]

]

set excess_demand (effective_demand_in_t - effective_supply_in_t)                    ;; the excess demand is updated to its new value.

;-----------------------------;;  THE END ;) ;;---------------------------------------------------------
end
```