21.07.2013 Views

The El Farol Bar Problem for next generation systems

The El Farol Bar Problem for next generation systems

The El Farol Bar Problem for next generation systems

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>The</strong> <strong>El</strong> <strong>Farol</strong> <strong>Bar</strong> <strong>Problem</strong> <strong>for</strong> <strong>next</strong> <strong>generation</strong><br />

<strong>systems</strong><br />

Athanasios Papakonstantinou<br />

Dissertation submitted <strong>for</strong> the MSc in Mathematics<br />

with Modern Applications<br />

Department of Mathematics<br />

August 2006<br />

Supervisor Dr. Maziar Nekovee, BT Research


Contents<br />

1. Chaos, Complexity and Irish Music 1<br />

1.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1<br />

1.2. <strong>The</strong> <strong>El</strong> <strong>Farol</strong> <strong>Bar</strong> <strong>Problem</strong> (EFBP) . . . . . . . . . . . . . . . . . 4<br />

1.3. Modelling the original problem . . . . . . . . . . . . . . . . . . . 5<br />

1.4. Game <strong>The</strong>ory Definitions . . . . . . . . . . . . . . . . . . . . . . . 7<br />

2. Previous Approaches to the <strong>El</strong> <strong>Farol</strong> 9<br />

2.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9<br />

2.2. Approaches to EFBP . . . . . . . . . . . . . . . . . . . . . . . . . 9<br />

2.2.1. Minority Game . . . . . . . . . . . . . . . . . . . . . . . . 9<br />

2.2.2. Evolutionary Learning . . . . . . . . . . . . . . . . . . . . 11<br />

2.2.3. Stochastic Adaptive Learning . . . . . . . . . . . . . . . . 13<br />

3. Analysis and Extension of the Stochastic Algorithm 23<br />

3.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23<br />

3.2. Taxing/Payoffs Algorithms . . . . . . . . . . . . . . . . . . . . . . 23<br />

3.2.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . 23<br />

3.2.2. Fairness and Efficiency . . . . . . . . . . . . . . . . . . . . 29<br />

3.3. Budget Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . 31<br />

3.3.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . 31<br />

3.3.2. Fairness and Efficiency . . . . . . . . . . . . . . . . . . . . 34<br />

4. Case Study: Multiple <strong>Bar</strong>s in Santa Fe 37<br />

5. Conclusions 43<br />

A. C Code <strong>for</strong> the <strong>El</strong> <strong>Farol</strong> <strong>Bar</strong> <strong>Problem</strong> 47<br />

ii


List of Figures<br />

1.1. <strong>Bar</strong> attendance in the first 100 weeks [1]. . . . . . . . . . . . . . . 5<br />

2.1. Behaviour of the average attendance (Top) and of the fluctuations<br />

(bottom) in the <strong>El</strong> <strong>Farol</strong> problem with L = 60 seats, ā = 1/2 and<br />

m = 2, 3, 6 from left to right [2]. . . . . . . . . . . . . . . . . . . . 10<br />

2.2. Mean weekly attendance <strong>for</strong> all 300 trials[3]. . . . . . . . . . . . . 12<br />

2.3. <strong>The</strong> attendance in a typical trial[3]. . . . . . . . . . . . . . . . . . 12<br />

2.4. <strong>The</strong> normalised one-step transition matrix[3]. . . . . . . . . . . . 13<br />

2.5. <strong>The</strong> overall attendance and the probabilities <strong>for</strong> each of the M<br />

agents <strong>for</strong> ‘partial in<strong>for</strong>mation’, ‘full in<strong>for</strong>mation’ and ‘signs’ algorithms.<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17<br />

2.6. histograms <strong>for</strong> partial and full info algorithms. . . . . . . . . . . . 18<br />

2.7. fairness and efficiency plots <strong>for</strong> original algorithms. . . . . . . . . 20<br />

2.8. standard deviation off attendance <strong>for</strong> original algorithms. . . . . . 21<br />

3.1. histograms <strong>for</strong> partial and full info taxing algorithms. . . . . . . . 25<br />

3.2. <strong>The</strong> overall attendance and the probabilities <strong>for</strong> each of the M<br />

agents <strong>for</strong> ’partial’ in<strong>for</strong>mation tax, modified tax algorithms and<br />

the full in<strong>for</strong>mation tax algorithm. . . . . . . . . . . . . . . . . . 26<br />

3.3. fairness and efficiency plots <strong>for</strong> taxing algorithms. . . . . . . . . . 30<br />

3.4. standard deviation off attendance <strong>for</strong> taxing algorithms. . . . . . . 31<br />

3.5. histograms <strong>for</strong> budget algorithms (b = 10, w = 0/6). . . . . . . . . 32<br />

3.6. <strong>The</strong> overall attendance and the probabilities <strong>for</strong> each of the M<br />

agents <strong>for</strong> budget (budget= 10) and modified budget (budget= 10,<br />

wait=3, 6) algorithms. . . . . . . . . . . . . . . . . . . . . . . . . 33<br />

3.7. standard deviation off attendance <strong>for</strong> budget algorithms. . . . . . 34<br />

3.8. fairness and efficiency plots <strong>for</strong> budget algorithms. . . . . . . . . . 35<br />

4.1. <strong>The</strong> overall attendance and the probabilities <strong>for</strong> each of the M<br />

agents <strong>for</strong> each bar. . . . . . . . . . . . . . . . . . . . . . . . . . . 38<br />

4.2. <strong>The</strong> cumulative attendance <strong>for</strong> all three bars. . . . . . . . . . . . . 39<br />

4.3. Agent attendances <strong>for</strong> each bar . . . . . . . . . . . . . . . . . . . 40<br />

4.4. payoff probabilities <strong>for</strong> each bar and cumulative payoff probability<br />

<strong>for</strong> the 3-bar version . . . . . . . . . . . . . . . . . . . . . . . . . 41<br />

iv


List of Tables<br />

1.1. <strong>The</strong> Prisoner’s Dilemma in matrix <strong>for</strong>m with utility pay-offs. . . . 8<br />

2.1. Behaviour of the ‘partial in<strong>for</strong>mation’ algorithm. . . . . . . . . . . 16<br />

2.2. Behaviour of the ‘full in<strong>for</strong>mation’ algorithm. . . . . . . . . . . . . 16<br />

2.3. Behaviour of the ‘signs’ algorithm. . . . . . . . . . . . . . . . . . 18<br />

2.4. standard deviation and mean of payoff probabilities <strong>for</strong> original<br />

algorithms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19<br />

3.1. Behaviour of the ‘tax’ algorithm with ctax = 6. . . . . . . . . . . . 24<br />

3.2. Simulation results <strong>for</strong> various values of ctax, cp. . . . . . . . . . . . 25<br />

3.3. standard deviation and mean of payoff probabilities <strong>for</strong> taxing algorithms.<br />

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29<br />

3.4. Behaviour of the ‘modified budget’ algorithm <strong>for</strong> budget=10 and<br />

staying at home=6. . . . . . . . . . . . . . . . . . . . . . . . . . . 32<br />

3.5. Simulation results <strong>for</strong> budget algorithms. . . . . . . . . . . . . . . 32<br />

3.6. standard deviation and mean of payoff probabilities <strong>for</strong> budget<br />

algorithms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34<br />

4.1. mean and std <strong>for</strong> all bars. . . . . . . . . . . . . . . . . . . . . . . 39<br />

vi


Acknowledgements<br />

I would like to dedicate this dissertation to my parents Costantinos and Valentini<br />

Papakonstantinou . I want to thank them <strong>for</strong> giving me the opportunity to study<br />

in the UK and <strong>for</strong> always supporting me in all my decisions.<br />

Special thanks to my supervisor in BT Research, Maziar Nekovee, <strong>for</strong> his help<br />

and guidance. He was a very valuable source of in<strong>for</strong>mation and always available<br />

when I needed him. Also Keith Briggs in BT Research was very helpful and this<br />

is very much appreciated.<br />

Futhermore, I would like to thank all the friends in York and in Ipswich <strong>for</strong><br />

this last year, as well as all friends in Greece.<br />

vi


Chapter 1<br />

Chaos, Complexity and Irish<br />

Music<br />

1.1 Overview<br />

<strong>The</strong>re is a common misconception that complexity and chaos are synonymous.<br />

Besides the nonlinearities that occur in both <strong>systems</strong>, the other properties those<br />

two areas of mathematics share are disambiguity in definitions and having many<br />

interesting and different applications.<br />

Although a definition of chaos that everyone would accept does not exist,<br />

almost everyone agrees to three properties a chaotic system should have: Chaos<br />

is aperiodic long-term behaviour in a deterministic system that exhibits sensitive<br />

dependence on initial conditions[4]. A time evolving property such as the move of<br />

tectonic plates or planets, the temperature or any weather characteristic or even<br />

the price movements in stock markets or dreams and emotions [5] may display<br />

chaotic behaviour.<br />

Chaos is often related to complexity, but does not follow from it in all cases.<br />

Chaos might be occurring when studying phenomena as they progress in time,<br />

but when the same phenomena are examined from a microscopic point of view<br />

then, the interaction of the various parts of which the system is consisted creates<br />

patterns and not ‘erratic’ chaotic behaviour. This is where complexity enters.<br />

It is rather difficult to define complexity in mathematical terms, although<br />

there is a measure of complexity there is no other way to give mathematical<br />

definition. Dictionaries might be useful in this quest <strong>for</strong> defining complexity.<br />

According to an online Dictionary by Ox<strong>for</strong>d University Press, complex is an adjective<br />

used to describe nouns which ‘are consisted of different and connected<br />

parts’. An even more precise definition is ‘consisted of interconnected or interwoven<br />

parts.’[6] That means, that in order to understand the behaviour of a complex<br />

system we should understand the behaviour of each part, as well as how they interact<br />

to <strong>for</strong>m the behaviour of the whole. Our incapacity to describe the whole<br />

1


2 CHAPTER 1. CHAOS, COMPLEXITY AND IRISH MUSIC<br />

without describing each part combined with the necessity to relate each part with<br />

another when describing makes the study of complex <strong>systems</strong> very difficult.<br />

Finally, based on [6] an attempt to <strong>for</strong>malise all the above definitions can be<br />

made: a complex system is a system <strong>for</strong>med out of many components whose behaviour<br />

is emergent,that is, the behaviour of the system cannot be simply inferred<br />

only from the behaviour of its components. <strong>The</strong> amount of in<strong>for</strong>mation needed<br />

to describe the behaviour of such a system is a measure of its complexity. If the<br />

number of the possible states the system could have is Ω and it is needed to<br />

specify in which state it is in, then the number of binary digits needed to specify<br />

this state is related to the number of the possible states:<br />

I = log 2(Ω) (1.1.1)<br />

In order to realise which state the system is in, all the possible states must<br />

be examined. <strong>The</strong> fact that the unique representation of each state requires<br />

a number equal to the number of the states, leads to the conclusion that the<br />

number of states of the representation is equal to the number possible states of<br />

the system. For a string of N bits, there are 2 N possible states, there<strong>for</strong>e:<br />

Ω = 2 N ⇔ N = I (1.1.2)<br />

<strong>The</strong>re are many applications of complex <strong>systems</strong>, in statistical physics, meteorology,<br />

geology, biology, engineering, economics, even social sciences and psychology.<br />

In all sciences we could find <strong>systems</strong> that could be dismantled in their<br />

core components and study each part and the system as a whole simultaneously.<br />

It is very interesting trying to examine and <strong>for</strong>ecast the behaviour of <strong>systems</strong><br />

that consist of human beings, <strong>systems</strong> like a family, or a business, or even a government.<br />

Humans have the capacity to learn and to constantly evolve, making<br />

models that deal with them unrealistic and of no use if this property is not taken<br />

into consideration. <strong>The</strong>re<strong>for</strong>e the need to model this human behaviour created<br />

the complex adaptive <strong>systems</strong> (CAS). <strong>The</strong> most common definition and universally<br />

approved is the one given by one of its founders, John H. Holland of Santa<br />

Fe Institute: ‘A Complex Adaptive System (CAS) is a dynamic network of many<br />

agents (which may represent cells, species, individuals, firms, nations) acting in<br />

parallel, constantly acting and reacting to what the other agents are doing. <strong>The</strong><br />

control of a CAS tends to be highly dispersed and decentralised. If there is to<br />

be any coherent behaviour in the system, it has to arise from competition and<br />

cooperation among the agents themselves. <strong>The</strong> overall behaviour of the system is<br />

the result of a huge number of decisions made every moment by many individual<br />

agents’[7]. It is even more intriguing that CAS do not appear only in human<br />

networks but wherever there is a system with interacting elements. It could be<br />

cells in a cellular automaton, ions in a spin glass or even cells in an immune<br />

system[8]. A complex adaptive system besides the property of complexity, has<br />

the properties of emergence and self-organisation.


1.1. OVERVIEW 3<br />

Emergence occurs when agents that operate in the same environment start<br />

to interact which each other. <strong>The</strong> number of the interactions increases when<br />

the number of agents increases, this leads to the appearance of new types of<br />

behaviour. This process can result to an increase of the complexity and since it<br />

is an internal property of the system and not managed by an outside source, it<br />

is a ‘self-organised’ process.<br />

<strong>The</strong> subject of this dissertation is the study and expansion of a famous complex<br />

adaptive system known as <strong>El</strong> <strong>Farol</strong> <strong>Bar</strong> <strong>Problem</strong> which was introduced by<br />

the economist W. B. Arthur in 1994[1]. <strong>El</strong> <strong>Farol</strong> is a bar in Santa Fe in New Mexico<br />

which plays each Thursday Irish music. People enjoy visiting it and hearing<br />

some quality music but eventually it becomes overcrowded, so people stop enjoying<br />

themselves. Each customer decides independently whether to attend or not,<br />

based on a set of predictors. This scenario provides a simplified mathematical<br />

model of a class of congestion and coordination problems that arise in modern<br />

In<strong>for</strong>mation and Communications Technology (ICT) <strong>systems</strong>.<br />

One application of great interest is networks of cognitive radios, where agents<br />

compete with each other <strong>for</strong> the same resource (RF spectrum). Cognitive radios<br />

are autonomous agents that have the ability to sense the external environment,<br />

learn from history and make intelligent decisions in order to optimise their per<strong>for</strong>mance<br />

and adjust better to the environment[9]. Another application is internet<br />

when a large number of people try to visit the same web page or access the same<br />

ftp server simultaneously and independently.<br />

In this first chapter, the original Arthur’s EFBP is defined and analysed. In<br />

the end of the chapter, some basic Game <strong>The</strong>ory concepts are explained and<br />

defined.<br />

In chapter two, various different approaches to the <strong>El</strong> <strong>Farol</strong> <strong>Bar</strong> problem are<br />

reviewed. First it is viewed as a minority game and various techniques from<br />

statistical mechanics are implemented. Also strategies are redefined using a binary<br />

approach as an attempt to reduce complexity. <strong>The</strong> <strong>next</strong> approach tries to<br />

overcome the restrictive strategies using an evolutionary learning algorithm and<br />

viewing the problem as a Markov stochastic process. <strong>The</strong> last approach suggests<br />

a very simple adaptive algorithm which is based on the maximisation of the<br />

probability of attendance <strong>for</strong> each agent. <strong>The</strong>re are no specific strategies to guide<br />

agents during their decision process, only their intention to attend the bar.<br />

In chapter three, the last algorithm is analysed in depth. In this original work,<br />

the stochastic adaptive learning algorithm is extended and several derivatives of<br />

it are examined as an attempt to deal with the unfairness or low efficiency issues<br />

that occurred in some cases with the original algorithm. Considerable ef<strong>for</strong>t was<br />

put in order to define the stationary state of one variation. Also fairness and<br />

efficiency are defined and measured both from the bar management’s and agent’s<br />

point of view.<br />

In chapter four, it is examined whether three bars in the same town would<br />

affect the agents ways of entertainment. <strong>The</strong>y attempt to enter the bars in a


4 CHAPTER 1. CHAOS, COMPLEXITY AND IRISH MUSIC<br />

random order, but their decision is made using the original algorithm.<br />

1.2 <strong>The</strong> <strong>El</strong> <strong>Farol</strong> <strong>Bar</strong> <strong>Problem</strong> (EFBP)<br />

Arthur in his paper, tries to predict the bar’s attendance. He assumed that the<br />

number of the resindents of Santa Fe or prospective clients of the bar is 100 and<br />

60 as the maximum number of the clients the bar should have so it could not be<br />

overcrowded. <strong>The</strong>n he answered the above question mentioning that if a person<br />

expects fewer than or equal to 60 to show up, he attends the bar, otherwise he<br />

stays at home. Each person cannot communicate with others, so no one has any<br />

in<strong>for</strong>mation about the intentions of everybody else. <strong>The</strong>y only have access to the<br />

number of the clients of the previous weeks.<br />

But there is more than one model, based on the numbers of the previous<br />

weeks, which can be used to predict the current week’s attendance. This makes<br />

a rational solution impossible and the problem from the client’s point of view<br />

ill-defined. But even if there was only one model, or due to mysterious reasons<br />

the clients managed to have common <strong>for</strong>ecasts, the model would fail. If most of<br />

the people believe that the bar will be overcrowded, then they will not attend<br />

leaving the bar almost empty. <strong>The</strong> opposite will happen if most of them think<br />

that the bar will have less than 60 customers.<br />

In order to overcome problems such as this, Arthur issued the use of ‘predictors’.<br />

A predictor is a function that maps the in<strong>for</strong>mation of d-recent attendances<br />

into a prediction <strong>for</strong> the <strong>next</strong> attendance. Arthur suggested that although there<br />

are many predictors, each individual has a set of k predictors in his disposal which<br />

will guide him through the decision process. Each client will decide whether to<br />

go to the bar or not, according to the most accurate predictor in his set, which<br />

will be called ‘active predictor’. Inaccurate predictors do not affect the long term<br />

behaviour of the system, since they will rarely achieve the status of ‘active’ predictor,<br />

there<strong>for</strong>e will be rarely used from the clients. <strong>The</strong> predictors that were<br />

actually used in the original problem are described in subsection 1.3.<br />

<strong>The</strong> results of the computational experiment are shown in fig 1.1. <strong>The</strong>se results<br />

indicate a tendency of the mean attendance to converge to 60. It seems that<br />

the predictors self-organise into an equilibrium pattern or ‘ecology’[1]. <strong>The</strong> active<br />

predictors <strong>for</strong>ecast above 60 with propability 0.4 and below 60 with propability<br />

0.6. In terms of game theory, the above mixed strategy is a Nash equilibrium.<br />

(Game theory terms like Nash equilibrium, strategies, repeated games and other<br />

are defined in subsection 1.4.)<br />

<strong>The</strong> EFBP is a congested resource problem, because the final decision of an<br />

agent (this is how clients, customers or individuals who decide whether or not<br />

they should attend <strong>El</strong> <strong>Farol</strong> <strong>Bar</strong> are going to be referred from now on) depends<br />

on the decision of the other agents. In other words they compete <strong>for</strong> a resource.<br />

This congestion appears in many real life <strong>systems</strong> like the internet where the


1.3. MODELLING THE ORIGINAL PROBLEM 5<br />

Figure 1.1: <strong>Bar</strong> attendance in the first 100 weeks [1].<br />

users compete <strong>for</strong> bandwith or roads and highways. <strong>The</strong> source of congestion,<br />

in a deterministic framework like EFBP, is the inability of agents to coordinate<br />

their actions[10], since there is a lack of a centralised mechanism that could guide<br />

them. In order to understand better and analyse such <strong>systems</strong> the traditional<br />

perfect, logical, deductive rationality has given its place to bounded rationality.<br />

<strong>The</strong> agents make their decision based on incomplete knowledge, they know that<br />

they have access to limited in<strong>for</strong>mation and do their best to fight this uncertainty<br />

using a combination of rational rules and empirical evidence.<br />

1.3 Modelling the original problem<br />

Now that Arthur’s original EFBP is explained (section 1.2) the model can be<br />

summarised as following:<br />

Suppose that there are N agents that have to decide whether they will or not<br />

attend the bar, and L is the maximum number of clients the bar can accommodate,<br />

be<strong>for</strong>e becoming overcrowded. Arthur wanted to predict the binary action<br />

of the i th customer denoted by a i ∈ {0, 1}, where 1 stands <strong>for</strong> going to the bar<br />

and 0 is not going. <strong>The</strong> total attendance is A = a i .<br />

As mentioned above, the only in<strong>for</strong>mation available to the agents is the number<br />

of the customers of the bar, the previous d weeks:<br />

It = {A(t − d), . . . , A(t − 2), A(t − 1)} (1.3.1)<br />

A predictor is a function I ∈ [0, N] d → [0, N]. <strong>The</strong>re are (N + 1) (N+1)d<br />

predictors [2] <strong>The</strong> number of the possible predictors that could be used is rather<br />

large, that is why a selection of S predictors is used. Arthur used the following<br />

predictors:


6 CHAPTER 1. CHAOS, COMPLEXITY AND IRISH MUSIC<br />

1. <strong>The</strong> same attendace as k weeks ago:<br />

A(It) = A(t − k),<br />

where k in the original models 1, 2 and 5. (k-period cycle detectors)<br />

2. A mirror image around 50% of last week’s attendance:<br />

3. A fixed predictor:<br />

A(It) = N − A(t − 1)<br />

A(It) = 67<br />

4. A rounded average of the last four weeks:<br />

A(It) = 1/4<br />

4<br />

A(t − r)<br />

5. A rounded and bound by 0 and N, last 8 weeks trend, computed using the<br />

least squares method.:<br />

r=1<br />

A(It) = min([trend{A8}] + , N)[11]<br />

Each predictor has a score associated to it, which evolves according to:<br />

Ui,s(t + 1) = Ui,s(t) + Θ{[Ai,s(It) − L][A(t) − L]}[2]<br />

Where, s ∈ [1, S], Ai,s(It) the s t h predictor <strong>for</strong> i t h customer and Θ is the Heaviside<br />

function (Θ(x) = 0 <strong>for</strong> x < 0 and Θ(x) = 1 <strong>for</strong> x ≥ 0).<br />

Also the predictor s used by i th customer is given by:<br />

and<br />

si(t) = argmax s ′Ui,s ′(t)<br />

ai(t) = Θ[L − Ai,si(t)(It)]<br />

where, argmax xf(x) is the value of x <strong>for</strong> which, f(x) gets its maximum value.


1.4. GAME THEORY DEFINITIONS 7<br />

1.4 Game <strong>The</strong>ory Definitions<br />

Games and solutions<br />

A game is a description of strategic interaction that includes the constraints on the<br />

actions the players can take and the players interests, without actually specifying<br />

the actions that the players do take[12]. A solution is how rational people play<br />

the game. A ‘rational solution’ corresponds to a set of unique strategies (plans<br />

<strong>for</strong> player’s actions) <strong>for</strong> each player that they will have no rational reasons to<br />

regret choosing[13].<br />

Best reply strategy<br />

A strategy <strong>for</strong> player, Ri is best reply(or best response) to C’s strategy Cj if it<br />

gives R the largest pay-off, provided that C has played the game.<br />

Pure and mixed strategies<br />

Pure strategy is the simplest kind of strategy, where someone chooses a specific<br />

course of action. However there might be a case where there is uncertainty<br />

about which best pure strategy to choose, due to lack of in<strong>for</strong>mation or any<br />

other reason. At those cases, the pure strategy is chosen following a random<br />

probability distribution. This type of strategy is called mixed strategy. A more<br />

strict definition follows:<br />

If a player has N available pure strategies (S1, S2, . . . , SN), a mixed strategy M<br />

is defined by the probabilities (p1, p2, . . . , pN) of each strategy to be selected[13].<br />

For M to be well defined the sum of the probabilities should be equal to one.<br />

Nash equilibrium<br />

<strong>The</strong> outcome of strategies Ri <strong>for</strong> player R and Cj <strong>for</strong> player C is a Nash equilibrium<br />

of the game, and thus a potential solution if Ri and Cj are the best solutions<br />

to each other. In a way player R chooses Ri because he is expecting C to chose<br />

Cj (and vice verse). When people select Nash equilibrium strategies there is no<br />

guarantee that they will be happy. <strong>The</strong>re is however a guarantee that they will<br />

have no reason to change it.<br />

Nash equilibrium in pure strategies<br />

Let G be a game, which involves N players. Each player chooses among a finite<br />

set of strategies Si: That is, player i (i = 1, . . . , N) has access to strategy set<br />

Si from which he/she chooses strategy σi ∈ Si. A set of pure strategies S =<br />

(σ1, σ2, . . . , σi, . . . , σN) constitutes a Nash equilibrium if and only if pure strategy<br />

σi is a best reply to the combination of the strategies of all other players in S <strong>for</strong><br />

all i = 1, . . . , N[13].<br />

Nash equilibrium in mixed strategies<br />

Mixed strategies are in Nash equilibrium, when there is not any strategy available<br />

the player could choose in order to improve his/her expected utility.


8 CHAPTER 1. CHAOS, COMPLEXITY AND IRISH MUSIC<br />

Example of Nash equilibrium:Prisoner’s Dilemma<br />

This is a very known example in game theory about two arrested suspects <strong>for</strong> a<br />

crime. <strong>The</strong>y are put in different cells and are promised that if someone confesses,<br />

he will be freed and used as a witness against the other, who will be sentenced<br />

to four years. If they both confess, they receive a three year sentence and if<br />

nobody confesses they will be convicted <strong>for</strong> a year, due to lack of evidence. <strong>The</strong><br />

problem is represented in a matrix <strong>for</strong>m in table 1.1, using utility payoffs. For<br />

Cooperate Defect<br />

Cooperate 3,3 0,4<br />

Defect 4,0 1,1<br />

Table 1.1: <strong>The</strong> Prisoner’s Dilemma in matrix <strong>for</strong>m with utility pay-offs.<br />

each player action ‘D’ (Defect) dominates action ‘C’ (Cooperate). Comparing<br />

the first numbers in each column or the second numbers in each row, shows that<br />

no matter what player 1 (column) chooses, player 2 (row) will win by choosing<br />

Defect, since the reward (utility payoff) is higher. This demonstrates that action<br />

(D,D) is a unique Nash equilibrium.<br />

Pareto improvement and efficiency<br />

Pareto improvement is when an agent chooses a strategy that will have no negative<br />

effects on the others. A system is Pareto efficient or Pareto optimal, when no<br />

Pareto improvements can be made. In other words, in a Pareto efficient system<br />

no individual can make an improvement without worsening the others.<br />

Repeated games<br />

Features of ‘one-shot’ games like ‘Prisoner’s Dilemma’ are the total lack of cooperation<br />

and the inability to study how each player’s actions affect the others as<br />

time progresses. <strong>The</strong> model of a repeated game is designed to examine long term<br />

interaction, based on the idea that a player will take into account other players<br />

estimated future behaviour, when planning his current strategy. This theory tries<br />

to isolate types of strategies that support mutually desirable outcomes in every<br />

game and punishes players with undesirable behaviour. ‘Folk’ theorems [12] give<br />

the conditions under which the set of the payments, that are acquired when in<br />

equilibrium, will consist of nearly all reasonable payoff profiles. With the use of<br />

these theorems it is proved acceptable results cannot be sustained if player are<br />

‘short-sighted’ and only look after their own interests.


Chapter 2<br />

Previous Approaches to the <strong>El</strong><br />

<strong>Farol</strong><br />

2.1 Overview<br />

In this section, various different approaches to <strong>El</strong> <strong>Farol</strong> <strong>Bar</strong> <strong>Problem</strong> are reviewed.<br />

Furthermore, three ways to extend the original model and analyse it using a<br />

different perspective, are introduced.<br />

2.2 Approaches to EFBP<br />

2.2.1 Minority Game<br />

In this approach, results known from minority games and tools of statistical<br />

mechanics are used <strong>for</strong> EFB model analysis. A minority game is a binary game<br />

where N (N:odd) players must choose one of the two sides independently and<br />

those on the minority side win. Players use a set of strategies, based on the past,<br />

to make their selections [14]. <strong>The</strong> greatest difference of this model with Arthur’s<br />

is the introduction of strategies instead of predictors. A strategy is a function<br />

a(I) from [0, N] m like predictors, but to {0, 1} instead to [0, N]. In other words<br />

strategies estimate if an agent should visit or not the bar, based on the previous<br />

history of attendance but in terms of ones (below the level of attendance) and<br />

zeros (above it). This is of great importance since the number of strategies is<br />

2N+1d which is significantly less from the number of the predictors <strong>for</strong> large N.<br />

This could be denoted as:<br />

which will depend only on the in<strong>for</strong>mation<br />

a µ<br />

s,i = Θ[L − As,i(It)] (2.2.1)<br />

µ(t) = {Θ[L − A(t − 1)], . . . , Θ[L − A(t − d)]} (2.2.2)<br />

9


10 CHAPTER 2. PREVIOUS APPROACHES TO THE EL FAROL<br />

<strong>The</strong>re are only 22d [2] strategies of this type, which is even less from 2N+1d and<br />

independent from N. Each agent is assigned S strategies drawn from the pool<br />

with distribution: P (a) ≡ Prob{a µ<br />

s,i } = āδ(a − 1) + (1 − ā)δ(a). For this model<br />

to work, it is considered that on average clients attend the bar with a frequency<br />

L/N. This leads to ā ≈ L/N, where ā is the average of a µ<br />

s,i .<br />

Figure 2.1, illustrates what happens to the model when L, ā and m remain<br />

fixed, while the number of agents N increases. <strong>The</strong> top graph shows that when<br />

Nā ≈ L, the attendance converges to the com<strong>for</strong>t level, while as m is increasing<br />

the area where 〈A〉 ≈ L is shrinking.<br />

Another feature of this approach is that it measures wasted resources which<br />

appear when the bar is under or over utilised. Although A(t) equals L on average,<br />

the amount of unexploited resources (A(t) < L) or over-exploited resources<br />

(A(t) > L), is equal to the distance |A(t) − L|. Thus, the quality of the cooperation<br />

of the agents is measured by:<br />

where 〈. . . 〉 is the average on the stationary state.<br />

σ 2 = 〈(A − L) 2 〉 (2.2.3)<br />

Figure 2.1: Behaviour of the average attendance (Top) and of the fluctuations<br />

(bottom) in the <strong>El</strong> <strong>Farol</strong> problem with L = 60 seats, ā = 1/2 and m = 2, 3, 6<br />

from left to right [2].<br />

On the bottom part of figure 2.1 it is shown that <strong>for</strong> small m, σ 2 /N is at is<br />

peak at the point where āN = L, while as m increases the maximum is getting<br />

shallower until it is disappeared <strong>for</strong> m = 6. This leads to the conclusion that, <strong>for</strong><br />

larger values of m, the efficiency increases. More in<strong>for</strong>mation about this model<br />

can be found in [2].


2.2. APPROACHES TO EFBP 11<br />

2.2.2 Evolutionary Learning<br />

This approach is based on the fact, that since EFBP is a case where inductive<br />

reasoning and bounded rationality are experienced, models based on a closed set<br />

of strategies are inadequate. It introduces a stochastic element, since new models<br />

are created by randomly varying existing ones, as well as a selective process which<br />

eliminates the ineffectual models.<br />

Suppose that, like in Arthur’s original experiment, each agent is given k = 10<br />

predictive models. For simplicity these models are autoregressive and their output<br />

unsigned and rounded. According to [3] <strong>for</strong> the i th individual their j th predictor’s<br />

output is given by:<br />

ˆx i ⎛<br />

<br />

<br />

j(n) = round ⎝<br />

<br />

aij(0) +<br />

l i j<br />

t=1<br />

a i ⎞<br />

<br />

<br />

j(t)x(n − t) ⎠<br />

<br />

(2.2.4)<br />

<br />

where x(n − t) is the attendance on week (n − t), l i j is the number of lag terms in<br />

the j th predictor of individual i, a i j(t) is the coefficient <strong>for</strong> the lag t steps in the<br />

past, and a i j(0) is the constant term of the AR model.<br />

<strong>The</strong> absolute value and the rounded output makes sure that no negative values<br />

are assigned and all predictions above 100 were set to 100 according to the<br />

original model. For each individual the number of lag terms is chosen uni<strong>for</strong>mly<br />

from the integers {1, . . . , 10} [3]. Be<strong>for</strong>e the prediction of the attendance of the<br />

current week, each individual evolves its set of models <strong>for</strong> ten <strong>generation</strong>s. This<br />

procedure, analysed in [3], is synopsised in the following five steps:<br />

1. As it was mentioned above, each agent chooses from 10 models. In this stage<br />

an offspring is created <strong>for</strong> each agents k th model. Lag in the offsprings from<br />

parents j is set to be one or ten. If l i j = 1 then l i j − 1 is not allowed, while if<br />

it is equal to ten, l i j + 1 is not allowed. <strong>The</strong> AR coefficients of the offspring<br />

are generated with the addition of a zero mean Gaussian variable with<br />

standard deviation (std) equal to 0.1. Any newly generated AR coefficients,<br />

are chosen by sampling <strong>for</strong>m N(0, 0.1). In the end of this stage, there are<br />

ten parent and ten offspring AR models assigned to each individual.<br />

2. In this stage, the 20 models assigned to each agent are evaluated based<br />

on the sum of the squared errors made during the prediction of the bar’s<br />

attendance in the last 12 weeks.<br />

3. For each agent, the ten models with the least error are selected and set as<br />

parents <strong>for</strong> the <strong>next</strong> <strong>generation</strong>.<br />

4. If less than ten <strong>generation</strong>s are conducted, then it starts over again from<br />

stage 1. Otherwise the best model <strong>for</strong> each agent is used to predict current<br />

week’s bar attendance.


12 CHAPTER 2. PREVIOUS APPROACHES TO THE EL FAROL<br />

5. If the maximum number of weeks is achieved the algorithm ends, if else,<br />

the predicted attendance is recorded and the simulations starts over again<br />

from stage 1.<br />

Figure 2.2: Mean weekly attendance <strong>for</strong> all 300 trials[3].<br />

Figure 2.3: <strong>The</strong> attendance in a typical trial[3].<br />

<strong>The</strong> results of this procedure being repeated 300 times, are shown in figure<br />

2.2. <strong>The</strong> mean weekly attendance <strong>for</strong> the first 12 weeks was 59.5, but <strong>for</strong> the<br />

<strong>next</strong> 50 weeks, large oscillations appeared until week 100. From 100 to 982 (end)<br />

weeks, the behaviour of the model could be described as ‘transient’. <strong>The</strong> mean<br />

attendance was 56.3155 and std was 1.0456, which is statistically significantly<br />

different (p < 0.01)[3] from the results of the Arthur’s original paper. None of<br />

the 300 trials showed convergence to 60 and the results of each trial were similar<br />

with those illustrated in figure 2.3.<br />

<strong>The</strong> dynamics of this system do not provide useful results about the model’s<br />

overall behaviour. That is why stochastic models based on Markov chains were


2.2. APPROACHES TO EFBP 13<br />

Figure 2.4: <strong>The</strong> normalised one-step transition matrix[3].<br />

used. <strong>The</strong> weekly attendance is the system’s ‘state’ in a simple first-order random<br />

process. Each of the attendance transitions from week to week <strong>for</strong> all the 300<br />

trials were tabulated and the transition matrix in fig 2.4 was <strong>for</strong>med. It was also<br />

proved that the system has the Markov property by executing 300 additional<br />

trials and recording each final weekly attendance at week 982. <strong>The</strong> cumulative<br />

distribution of these attendances is similar to the cumulative distribution function<br />

after the summing of the limiting probability masses calculated from raising the<br />

transition matrix to a large number.<br />

2.2.3 Stochastic Adaptive Learning<br />

In Arthur’s original paper each agent tries to predict how many others will attend<br />

<strong>El</strong> <strong>Farol</strong> <strong>Bar</strong>. Each individual decides based on a set of strategies (predictors)<br />

which estimate the attendance of the <strong>Bar</strong>. Approaches 1 and 2 mentioned in<br />

subsections 2.2.1 and 2.2.2 also use similar methods, although they try to refine<br />

the decision process. In this approach it is shown that there is no need <strong>for</strong> the<br />

agents to use different strategies and change them trying to find which is the more<br />

accurate. <strong>The</strong> problem is considered in stochastic terms instead of deterministic<br />

and a simple adaptive learning algorithm is implemented. <strong>The</strong> main advantage<br />

of this method is that the algorithm is more simple and the decision process is<br />

less complex[10] since the agents do not decide based on the decision of all the<br />

others but based only on their recent experiences in the <strong>Bar</strong>.<br />

<strong>The</strong> agents have identical payoffs, b is the payoff <strong>for</strong> attending a noncrowded<br />

bar, g <strong>for</strong> attending a crowded bar and f <strong>for</strong> staying at home. Without loss<br />

of generality h is considered to be zero. <strong>The</strong>re are two strategies: either the<br />

agent attends the bar and receives payment b or g according to the attendance


14 CHAPTER 2. PREVIOUS APPROACHES TO THE EL FAROL<br />

of the bar, or he stays at home and receives no payment. In a mixed strategy<br />

equilibrium the expected payment of following one action is equal to the expected<br />

payment of following the other. This could be denoted as following:<br />

g P(N −i ≤ N − 1) + b P(N −i > N − 1) = 0 ⇔<br />

P(N −i ≤ N − 1) = b<br />

b − g<br />

where, b,g are the payoffs, M the total number of players, N the total observed<br />

attendance, N −i the observed attendance without agent i and N the maximum<br />

capacity of an uncrowded bar.<br />

Using a deterministic setting where agents would only use pure strategies<br />

has the disadvantage that each agent must predict the attendance, based on the<br />

predictions of the others. This generates results with a high level of noise and high<br />

deviation. In this bounded rational model, the adaptive learning rule depends<br />

only on the history of the decisions of each single one agent.<br />

To overcome this problem a common sense concept is taken into consideration:<br />

people in general prefer to experience good times, tend to repeat the enjoyable<br />

and minimise the unpleasant[10]. So according to this if an agent initially attends<br />

the bar p percent of time, he will increase this if the bar is uncrowded or will<br />

decrease this the bar is crowded. As time goes by , agents gather in<strong>for</strong>mation<br />

about the attendance of the bar, in the <strong>for</strong>m of the parameter p which differs<br />

<strong>for</strong> each ith agent. If k is the iteration counter (time), pi the probability that<br />

ith agent attends and µ the parameter that defines the degree of change of pi<br />

according to the attendance, then the number of agents attending at time k is<br />

given by:<br />

M<br />

N(k) − xi(k) (2.2.5)<br />

i=1<br />

where xi(k) are independent Bernoulli random variables that are equal to one<br />

with probability pi(k) and equal to zero otherwise[10]. <strong>The</strong> following simple<br />

algorithm describes the evolution of pi(k):<br />

⎧<br />

⎪⎨ 0, pi(k) − µ(N(k) − N )xi(k) < 0<br />

pi(k + 1) = 1, pi(k) − µ(N(k) − N )xi(k) > 1<br />

⎪⎩<br />

pi(k) − µ(N(k) − N )xi(k), otherwise<br />

(2.2.6)<br />

At each timestep k the agent attends the <strong>Bar</strong> with a probability pi(k) after<br />

tossing a biased coin. If the bar is uncrowded N(k)−N is added to pi(k), while if<br />

it is crowded N(k) − N is subtracted. Also pi(k) ∈ [0, 1] since it is a probability.<br />

If the agent does not attend the bar, xi(k) = 0 leads to pi(k + 1) = pi(k).For<br />

now on the algorithm 2.2.6 will be referred as ‘partial in<strong>for</strong>mation’ because the<br />

agents make their decision relying only on their previous experience. But this


2.2. APPROACHES TO EFBP 15<br />

algorithm could be modified in an attempt to generate results close to Arthur’s<br />

original algorithm. In the following ‘full in<strong>for</strong>mation’ algorithm the decisions are<br />

made after having a full record of attendance.<br />

⎧<br />

⎪⎨ 0, pi(k) − µ(N(k) − N ) < 0<br />

pi(k + 1) = 1,<br />

⎪⎩<br />

pi(k) − µ(N(k) − N ),<br />

pi(k) − µ(N(k) − N ) > 1<br />

otherwise<br />

(2.2.7)<br />

Both these algorithms rely solely on attendance and not on payoffs. A way to<br />

implement payoffs is setting the payoff <strong>for</strong> attending an uncrowded bar to µ and<br />

−µ <strong>for</strong> attending a crowded bar. If the payoff <strong>for</strong> staying at home is set to 0, the<br />

following algorithm depends on payoffs.<br />

⎧<br />

⎪⎨ 0, pi(k) − µsgn(N(k) − N )xi(k) < 0<br />

pi(k + 1) = 1, pi(k) − µsgn(N(k) − N )xi(k) > 1<br />

⎪⎩<br />

pi(k) − µsgn(N(k) − N )xi(k), otherwise<br />

(2.2.8)<br />

where sign is the following function:<br />

⎧<br />

⎪⎨ −1, (N(k) − N ) < 0<br />

sgn(N(k) − N ) = 0, (N(k) − N ) = 0<br />

⎪⎩<br />

1, (N(k) − N ) > 0<br />

<strong>The</strong> general behaviour of the ‘partial in<strong>for</strong>mation’ algorithm can be seen in<br />

the first two plots of figure 2.5. <strong>The</strong> simulation is run <strong>for</strong> M = 100, N = 60,<br />

µ = 0.01 and the initial probabilities follow a random uni<strong>for</strong>m distribution. After<br />

many iterations, the agents are separated into two groups with those of the first<br />

group attending every day, while those of the other do not attend at all, or attend<br />

very rarely. <strong>The</strong> observed attendance after many iterations is slightly below the<br />

Nash equilibrium point which is always equal to the maximum capacity of the<br />

uncrowded bar. Partial in<strong>for</strong>mation algorithm converges to a value near that<br />

point N − 1 and never reaches N , which is a Pareto efficient point <strong>for</strong> that<br />

algorithm since the only way <strong>for</strong> an agent to be in a better position is to worsen<br />

somebody else[15].<br />

This algorithm is heavily dependant on the value of µ. Its convergence is<br />

strongly affected by this parameter, <strong>for</strong> µ = 0.1, M = 100 and N = 60 it<br />

converges after 800 iterations, while <strong>for</strong> µ = 0.001, 13000 iterations were not<br />

enough. In order to explore the behaviour and the limitations of the algorithm<br />

a lighter version of the original C program was used. It is different from that in<br />

the Appendix, since it produces no files <strong>for</strong> plots and the only outputs are the<br />

average and standard deviation. A conclusion that could be drawn only from the<br />

simulations (Table: 2.1) is that the algorithm can handle relatively large numbers<br />

such as M = 10000, N = 6000, provided that µ is very small, in expense of


16 CHAPTER 2. PREVIOUS APPROACHES TO THE EL FAROL<br />

convergence time . But the conclusion is that only hardware limitations affect its<br />

behaviour.<br />

N /M 60/100 600/1000 6000/10000<br />

iterations 2 · 10 8 2 · 10 8 2 · 10 8<br />

µ 0.01 0.001 0.001<br />

average 59.00020 599.000142 5898.745966<br />

std 0.006524 0.052298 74.159661<br />

Table 2.1: Behaviour of the ‘partial in<strong>for</strong>mation’ algorithm.<br />

<strong>The</strong> comparison of the first two with the <strong>next</strong> two plots of figure 2.5 leads to<br />

the conclusion that agents coordinate successfully when they have access to partial<br />

in<strong>for</strong>mation instead of full in<strong>for</strong>mation. This happens due to the congestion,<br />

which comes as a result of the similar response of the agents who have available<br />

all the in<strong>for</strong>mation.<br />

<strong>The</strong> results of the full in<strong>for</strong>mation algorithm are very similar to Arthur’s<br />

original simulation (Figure:1.1). <strong>The</strong> mean attendance is 60 but the variation<br />

never settles down. Although the probabilities bounce randomly, they increase<br />

or decrease simultaneously. This proves the assumption made above, that when<br />

agents have access to full in<strong>for</strong>mation, they tend to have the same behaviour.<br />

<strong>The</strong> behaviour of the algorithm is summarised in table 2.2<br />

N /M 60/100 600/1000 6000/10000<br />

iterations 2 · 10 8 2 · 10 8 2 · 10 8<br />

µ 0.01 0.001 0.001<br />

average 60.00000 599.99999 5999.999994<br />

std 6.454943 18.371018 57.254445<br />

Table 2.2: Behaviour of the ‘full in<strong>for</strong>mation’ algorithm.<br />

<strong>The</strong> first and third plots in figure 2.5 show that ‘partial in<strong>for</strong>mation’ and<br />

‘signs’ algorithm have similar behaviour. A close look in the probabilities <strong>for</strong> each<br />

agent, reveals that the new algorithm inherits all the properties of the original.<br />

<strong>The</strong> only difference is that standard deviation is slightly greater, but that can be<br />

explained since the new algorithm converges after more iterations. With the same<br />

constants, more than 3000 iterations are needed <strong>for</strong> the algorithm to converge.<br />

<strong>The</strong> behaviour of the algorithm is summarised in table 2.3. It can be seen that<br />

this variation does not have any problems with large numbers, probably because<br />

it is more simple. Instead of using in every iteration the quantity N(k) − N , it<br />

uses sign(N(k) − N ).<br />

<strong>The</strong> histograms of the attendances (figure: 2.6) <strong>for</strong> partial and full in<strong>for</strong>mation<br />

algorithms show that they have a completely different distribution and indicate<br />

that attendances in full in<strong>for</strong>mation algorithm may follow normal distribution.


2.2. APPROACHES TO EFBP 17<br />

attendance<br />

attendance<br />

attendance<br />

100<br />

80<br />

60<br />

40<br />

20<br />

0<br />

0 500 1000 1500 2000 2500 3000<br />

time (iterations)<br />

100<br />

80<br />

60<br />

40<br />

20<br />

0<br />

0 500 1000 1500 2000 2500 3000<br />

time (iterations)<br />

100<br />

80<br />

60<br />

40<br />

20<br />

0<br />

0 1000 2000 3000 4000 5000<br />

time (iterations)<br />

probabities <strong>for</strong> each agent<br />

probabities <strong>for</strong> each agent<br />

probabities <strong>for</strong> each agent<br />

1.0<br />

0.8<br />

0.6<br />

0.4<br />

0.2<br />

0.0<br />

0 500 1000 1500 2000 2500 3000<br />

time (iterations)<br />

1.0<br />

0.8<br />

0.6<br />

0.4<br />

0.2<br />

0.0<br />

0 500 1000 1500 2000 2500 3000<br />

time (iterations)<br />

1.0<br />

0.8<br />

0.6<br />

0.4<br />

0.2<br />

0.0<br />

0 1000 2000 3000 4000 5000<br />

time (iterations)<br />

Figure 2.5: <strong>The</strong> overall attendance and the probabilities <strong>for</strong> each of the M agents<br />

<strong>for</strong> ‘partial in<strong>for</strong>mation’, ‘full in<strong>for</strong>mation’ and ‘signs’ algorithms.


18 CHAPTER 2. PREVIOUS APPROACHES TO THE EL FAROL<br />

frequency<br />

0 500 1000 1500 2000<br />

N /M 60/100 600/1000 6000/10000<br />

iterations 2 · 10 8 2 · 10 8 2 · 10 8<br />

µ 0.01 0.001 0.001<br />

average 59.000049 599.059126 5998.999914<br />

std 0.011685 0.286160 1.078615<br />

Table 2.3: Behaviour of the ‘signs’ algorithm.<br />

Histogram of attendances in partial info<br />

50 55 60<br />

attendances<br />

65<br />

frequency<br />

0 50 100 150 200<br />

Histogram of attendances in full info<br />

40 50 60<br />

attendances<br />

70 80<br />

Figure 2.6: histograms <strong>for</strong> partial and full info algorithms.<br />

Except from the fast convergence and the ability to handle large numbers, it<br />

is very important that some of the quantitive characteristics of the algorithms<br />

are examined too. It is necessary that tools to measure abstract terms like fairness<br />

and efficiency are developed. A fair outcome requires that agents with<br />

similar utilities have similar probabilities to attend the bar. A more strict definition<br />

would demand exact probabilities of attendance <strong>for</strong> agents with identical<br />

payoffs[16]. <strong>The</strong> algorithm, must also be efficient both <strong>for</strong> the agents and the bar<br />

management.<br />

Be<strong>for</strong>e proceeding to the tools used, utility payoff, which as a term was first<br />

introduced in Prisoner’s Dilemma definition in section 1.4, must be defined. Utility<br />

payoffs are the rewards or penalties that each agent has, after following a pure<br />

strategy. In this case, agents who attend a not crowded bar get a reward of 1,<br />

those who attend a crowded bar get a penalty of −1, while those who stay at<br />

home get nothing (reward=0):<br />

⎧<br />

⎪⎨ −1, xi(k) = 1, (N(k) − N ) > 0<br />

U(k) = 1, xi(k) = 1, (N(k) − N ) ≤ 0<br />

⎪⎩<br />

0, xi(k) = 0<br />

So, fairness and efficiency could be measured using the following methods based<br />

on utility functions:<br />

• efficiency is determined by the average payoff. <strong>The</strong> higher the average<br />

payoff probability is, the higher is the average reward <strong>for</strong> each player


2.2. APPROACHES TO EFBP 19<br />

• fairness is determined by the distribution of payoffs. A histogram which<br />

shows the creation of groups is a clear indication that the algorithm is<br />

unfair, similar conclusions could be drawn from the standard deviation.<br />

High values of std indicate that a significant number of agents has payoffs<br />

less than the average, while others have greater.<br />

<strong>The</strong>re are also other ways to measure fairness and efficiency, which have nothing<br />

to do with utility functions:<br />

• system’s efficiency is determined by the attendance’s std. A system is<br />

considered to be efficient, when the attendances are really close to system’s<br />

capacity.<br />

• system’s fairness can be also determined by the distribution of attendances<br />

<strong>for</strong> each agent. At each iteration of the algorithm, the decision of<br />

each agent is recorded. In the end of the algorithm it easy to calculate how<br />

many times each agent has attended the bar. Histogram or std could used<br />

in this case also.<br />

It is called system’s efficiency, because most bar managements have interest in<br />

keeping a stable attendance, with not many fluctuations which would leave the<br />

bar some days underutilised and some days overutilised. Although system’s fairness<br />

gives a good picture of the choices of each agent, the original fairness is more<br />

important since it is calculated from the utility payoffs. After all, it could be said,<br />

that what matters is the consequences of each agent’s action and the only way<br />

to measure it, is in terms of reward or penalty.<br />

Considering system’s fairness, it can be seen in figure 2.7 that both three<br />

algorithms are not fair. Agents are divided in two categories: 41 of them rarely<br />

attend the bar, and the rest of them attend it almost always. Although ‘partial<br />

in<strong>for</strong>mation with signs’ algorithm was designed as an improvement of the original<br />

one it inherits all of its properties. One of those properties is minimal attendance<br />

<strong>for</strong> 41 agents and maximal <strong>for</strong> the rest. It seems that from the agents point of<br />

view, this algorithm is more fair (Table: 2.4, stdsigns < stdpartial ), but in reality<br />

it is not. This is a result of the lower profits <strong>for</strong> the always attending group and<br />

not of a wider distribution of payoff probability.<br />

std mean<br />

partial 0.401591 0.4814233<br />

signs partial 0.3018023 0.36663<br />

full 0.02300045 −0.00500668<br />

Table 2.4: standard deviation and mean of payoff probabilities <strong>for</strong> original algorithms.<br />

<strong>The</strong> most fair algorithm regarding the agents is the full in<strong>for</strong>mation, indeed<br />

standard deviation of payoff probability is nearly zero but so is average payoff


20 CHAPTER 2. PREVIOUS APPROACHES TO THE EL FAROL<br />

probability. Nobody makes profit, nobody is happy, but everybody is content<br />

and they seem to have no intention of changing their strategy, all these are properties<br />

of Nash equilibrium points. But in terms of attendance ‘full in<strong>for</strong>mation<br />

algorithm’ is not absolutely fair, since again there is a classification of agents in<br />

two groups, although this time casual bargoers have a much wider distribution.<br />

frequency<br />

0 10 20 30 40<br />

frequency<br />

0 5 10 15 20<br />

frequency<br />

0 10 20 30<br />

partial in<strong>for</strong>mation<br />

0.0 0.2 0.4 0.6 0.8 1.0<br />

probability of attendance<br />

full in<strong>for</strong>mation<br />

0.2 0.3 0.4 0.5 0.6 0.7 0.8<br />

probability of attendance<br />

partial in<strong>for</strong>mation with signs<br />

0.0 0.2 0.4 0.6 0.8 1.0<br />

probability of attendance<br />

frequency<br />

0 10 20 30 40 50<br />

frequency<br />

0 1 2 3 4 5 6 7<br />

frequency<br />

0 5 10 15 20 25 30<br />

partial in<strong>for</strong>mation<br />

0.0 0.2 0.4<br />

payoff probability<br />

0.6 0.8<br />

full in<strong>for</strong>mation<br />

−0.06 −0.04 −0.02 0.00 0.02 0.04 0.06<br />

payoff probability<br />

partial in<strong>for</strong>mation with signs<br />

0.0 0.1 0.2 0.3 0.4 0.5 0.6<br />

payoff probability<br />

Figure 2.7: fairness and efficiency plots <strong>for</strong> original algorithms.<br />

It is obvious that these results are open to different interpretations, and vary<br />

according to the objectives set each time. In general partial in<strong>for</strong>mation is the<br />

most appropriate algorithm if the objective is to maximise the average payoff <strong>for</strong><br />

each agent. It might be the most unfair of all, but even full in<strong>for</strong>mation is not<br />

fair enough to justify the minimal profits.<br />

Considering system’s efficiency, it can be seen in the cumulative plot of the<br />

running std <strong>for</strong> the original algorithms (Figure: 2.8), that ‘partial in<strong>for</strong>mation’<br />

has the least standard deviation and a negative slope. On the contrary ‘full


2.2. APPROACHES TO EFBP 21<br />

in<strong>for</strong>mation’ has a relatively high std, with no signs of improvement.<br />

standard deviation<br />

0 1 2 3 4 5 6<br />

original algorithms<br />

partial<br />

full<br />

signed<br />

0 500 1000 1500<br />

iterations<br />

2000 2500 3000<br />

Figure 2.8: standard deviation off attendance <strong>for</strong> original algorithms.


22 CHAPTER 2. PREVIOUS APPROACHES TO THE EL FAROL


Chapter 3<br />

Analysis and Extension of the<br />

Stochastic Algorithm<br />

3.1 Overview<br />

None of the previous three variations was proved to be fair and efficient. Fairness<br />

and efficiency seem to be contradicting terms. In this chapter, new variations<br />

of the stochastic adaptive learning algorithms that were presented in subsection2.2.3,<br />

are examined. <strong>The</strong> variations could be divided into two categories: the<br />

taxing/payoff algorithms which have to do with an adaptive change of µ and<br />

the budget algorithms, where the agents are <strong>for</strong>ced not to attend the bar after<br />

having attended it consecutively <strong>for</strong> a number of weeks, as a result of inadequate<br />

resources.<br />

3.2 Taxing/Payoffs Algorithms<br />

3.2.1 Overview<br />

<strong>The</strong> basic idea behind this algorithm is that in the system there are three types<br />

of agents. <strong>The</strong> ‘selfish’ who attend a bar regardless if it is crowded or not, those<br />

who attend an uncrowded bar and those who never attend the bar. ‘Partial in<strong>for</strong>mation’<br />

maximises the probability of attendance incrementing a small quantity<br />

to the original probability when the bar is uncrowded or subtracting it from the<br />

original probability when the bar is crowded. This quantity depends on µ which<br />

is constant. In this version (equations: 3.2.1), the parameter µtax is inserted so<br />

that selfish behaviour can be penalised. When a selfish agent attends a crowded<br />

bar, the quantity that is subtracted from the original probability is ctax times<br />

greater than in the ‘partial in<strong>for</strong>mation’ algorithm.<br />

Simulations indicated that <strong>for</strong> rather large values of ctax (ctax ≥ 8) the bar<br />

is underutilised (mean ≤ 58). <strong>The</strong> behaviour of this algorithm is summarised in<br />

23


24 CHAPTER 3. ANALYSIS AND EXTENSION OF THE STOCHASTIC ALGORITHM<br />

table 3.1 and in the first two plots of figure 3.2.<br />

N /M 60/100 600/1000<br />

iterations 2 · 10 8 2 · 10 8<br />

µ 0.01 0.001<br />

average 59.072334 598.99924<br />

std 0.259638 0.052933<br />

Table 3.1: Behaviour of the ‘tax’ algorithm with ctax = 6.<br />

This algorithm could be more fair <strong>for</strong> the agents if those who do not attend<br />

the bar were encouraged to attend it. By definition of the algorithm this cannot<br />

be done through the parameter µ, since there is no change <strong>for</strong> the probabilities<br />

pi of those who choose or perhaps are <strong>for</strong>ced not to attend.<br />

A rather aggressive way to change this, is to multiply these probabilities with<br />

a number close to 1. This way in every iteration the attendance probability <strong>for</strong><br />

all those that do not attend will slightly increase and finally they will ‘decide’ to<br />

attend the bar. That leads to the following equations <strong>for</strong> the partial algorithm<br />

with taxing:<br />

⎧<br />

0,<br />

⎪⎨<br />

where µppi(k) − µtax(N(k) − N )xi(k) < 0<br />

pi(k + 1) = 1,<br />

where µppi(k) − µtax(N(k) − N )xi(k) > 1<br />

⎪⎩<br />

pi(k) − µppi(k) − µtax(N(k) − N )xi(k), otherwise<br />

(3.2.1)<br />

µp and µtax are defined as following:<br />

<br />

1, xi(k) = 1<br />

µp =<br />

(3.2.2)<br />

cp, xi(k) = 0<br />

where i = 1 . . . M and c1 a constant which affects the degree pi is changing <strong>for</strong><br />

those agents that do not attend (xi(k) = 0)<br />

<br />

µ, N(k) ≤ N<br />

µtax =<br />

(3.2.3)<br />

ctaxµ, N(k) > N<br />

where c2 > 1 is a constant that defines the degree pi is changing <strong>for</strong> selfish agents<br />

who insist to attend even if the bar was crowded the previous time.<br />

<strong>The</strong> behaviour of this algorithm is summarised in the 3rd and 4th plots of<br />

figure 3.2. Simulations showed that in a reasonable taxed system (ctax ≥ 3),<br />

large values of mp result in an underutilised bar (Table:3.2. An interpretation of<br />

this is that, although people are encouraged to attend, taxation prevents them


3.2. TAXING/PAYOFFS ALGORITHMS 25<br />

from doing so. Of course as someone would expect minimal taxation results in<br />

an overcrowded bar. Another interesting feature of this algorithm is, its almost<br />

rapid convergence, even when it is compared with the original.<br />

ctax 6 8 6 1 6<br />

cp 1 1.01 4 4 n/a (full info)<br />

average 58.929000 59.682000 49.002333 70.489000 58.165750<br />

std 1.382448 2.200574 0.437992 4.642286 4.851578<br />

Table 3.2: Simulation results <strong>for</strong> various values of ctax, cp.<br />

For the full in<strong>for</strong>mation tax algorithm there is no need of the parameter mp:<br />

⎧<br />

⎪⎨ 0, pi(k) − µtax(N(k) − N ) < 0<br />

pi(k + 1) = 1,<br />

⎪⎩<br />

pi(k) − µtax(N(k) − N ),<br />

pi(k) − µtax(N(k) − N ) > 1<br />

otherwise<br />

(3.2.4)<br />

<strong>The</strong> histograms of the attendances (figure 3.1) <strong>for</strong> partial and full in<strong>for</strong>mation<br />

taxing algorithms have much in common with those of the original algorithms<br />

and very few differences. Both full in<strong>for</strong>mation algorithms seem to follow the<br />

normal distribution, although in the partial in<strong>for</strong>mation taxing algorithm, value<br />

59 is dominating.<br />

frequency<br />

0 500 1000 1500 2000 2500 3000<br />

Histogram of attendances in modified tax partial info<br />

10 20 30 40<br />

attendances<br />

50 60 70<br />

frequency<br />

0 50 100 150 200 250<br />

Histogram of attendances in tax full info<br />

40 45 50 55<br />

attendances<br />

60 65 70<br />

Figure 3.1: histograms <strong>for</strong> partial and full info taxing algorithms.<br />

In [10] the solutions and convergence properties <strong>for</strong> the original algorithms<br />

are examined. After defining the equilibrium points, they are used to derive a<br />

set of deterministic ODE’s. <strong>The</strong> results concerning the nature of p(k) in steady<br />

state, are used in the analysis of the convergence behaviour and the stability<br />

properties of those ODE’s. Although the outputs of the simulations of the original<br />

algorithms can be reproduced and proved analytically, there are many reasons<br />

<strong>for</strong> making this procedure extremely difficult <strong>for</strong> the other variations.<br />

From the last plot in figure 3.2 there is an indication that probabilities might<br />

converge to a stationary state around 0.6. Although full in<strong>for</strong>mation algorithms<br />

are simpler cases, the adaptive behaviour of µtax(k) is a source of complexity.


26 CHAPTER 3. ANALYSIS AND EXTENSION OF THE STOCHASTIC ALGORITHM<br />

attendance<br />

attendance<br />

attendance<br />

100<br />

80<br />

60<br />

40<br />

20<br />

0<br />

0 500 1000 1500 2000 2500 3000<br />

time (iterations)<br />

100<br />

80<br />

60<br />

40<br />

20<br />

0<br />

0 500 1000 1500 2000 2500 3000<br />

time (iterations)<br />

100<br />

80<br />

60<br />

40<br />

20<br />

0<br />

0 500 1000 1500 2000 2500 3000<br />

time (iterations)<br />

probabities <strong>for</strong> each agent<br />

probabities <strong>for</strong> each agent<br />

probabities <strong>for</strong> each agent<br />

1.0<br />

0.8<br />

0.6<br />

0.4<br />

0.2<br />

0.0<br />

0 500 1000 1500 2000 2500 3000<br />

time (iterations)<br />

1.0<br />

0.8<br />

0.6<br />

0.4<br />

0.2<br />

0.0<br />

0 500 1000 1500 2000 2500 3000<br />

time (iterations)<br />

1.0<br />

0.8<br />

0.6<br />

0.4<br />

0.2<br />

0.0<br />

0 500 1000 1500 2000 2500 3000<br />

time (iterations)<br />

Figure 3.2: <strong>The</strong> overall attendance and the probabilities <strong>for</strong> each of the M agents<br />

<strong>for</strong> ’partial’ in<strong>for</strong>mation tax, modified tax algorithms and the full in<strong>for</strong>mation tax<br />

algorithm.


3.2. TAXING/PAYOFFS ALGORITHMS 27<br />

In the following a set of equations that describe the stationary state behaviour<br />

of the probabilities will be derived pi(k).<br />

<strong>The</strong> number of agents attending at time k is N(k) = M i=1 xi(k) and xi(k) are<br />

independent Bernoulli trials given by:<br />

<br />

1, pi(k)<br />

xi(k) =<br />

(3.2.5)<br />

0, 1 − pi(k)<br />

In the stationary state we have:<br />

pi(k + 1) = pi(k) ∀i ∈ N<br />

Taking the expectation values results to:<br />

E(pi(k + 1)) = E(pi(k)) ⇒ E(pi(k + 1)) − E(pi(k)) = 0 ⇒<br />

E(µtax(N(k) − N )) = 0<br />

N(k) is the number of agents attending at time k is equal to M i=1 xi(k), where<br />

xi(k) are independent Bernoulli trials.<br />

<strong>The</strong> expectation value is calculated using the following <strong>for</strong>mula:<br />

E(XY ) = <br />

fx,y(x, y)<br />

where X,Y random variables and fx,y(x, y) joined mass function. In this case<br />

Y = µtax and X = N(k) − N . By definition, Y = µtax is a function of N(k). So,<br />

Y = g(X) and fx,y(x, y) = fx(x, g(x)) = fx(x). Hence:<br />

E(µtax(N(k)) · (N(k) − N )) = <br />

(N(k) − N ) · µtax(N(k)) · fN(k)(N(k)) ⇒<br />

cµ <br />

N(k)>N<br />

N(k)−N<br />

(N(k) − N ) · fN(k)(N(k)) + µ <br />

cµ <br />

N(k)>N<br />

µ <br />

N(k)≤N<br />

x<br />

N(k)≤N<br />

N(k) · fN(k)(N(k)) − cµN <br />

(N(k) − N ) · fN(k)(N(k)) ⇒<br />

N(k)>N<br />

N(k) · fN(k)(N(k)) − µN <br />

N(k)≤N<br />

fN(k)(N(k))+<br />

fN(k)(N(k)) (3.2.6)<br />

Kolmogorov-Smirnov test indicated that z = N(k) might follow Poisson distribution<br />

f(z) = λz<br />

z! e−λ , with λ = E(z). Hence:<br />

E(f(z)) = <br />

zf(z) = <br />

zf(z) + <br />

zf(z) = λ ⇒<br />

z<br />

z≤N<br />

z>N


28 CHAPTER 3. ANALYSIS AND EXTENSION OF THE STOCHASTIC ALGORITHM<br />

<br />

zf(z) = λ − <br />

zf(z) (3.2.7)<br />

z≤N<br />

and:<br />

<br />

f(z) = 1 ⇒ <br />

f(z) + <br />

f(z) = 1 ⇒ <br />

f(z) = 1 − <br />

f(z) (3.2.8)<br />

z<br />

z≤N<br />

zN<br />

z>N<br />

z>N<br />

Since µ = 0, (3.2.9) becomes:<br />

<br />

zf(z)(c − 1) − N <br />

f(z)(c − 1) = N − λ (3.2.10)<br />

z>N<br />

z>N<br />

Since f(z) follows the Poisson distribution and after replacing z with N(k) and:<br />

and<br />

we get the final equation:<br />

A(λ, M) =<br />

B(λ, M) =<br />

M<br />

z>N<br />

M<br />

z>N<br />

z>N<br />

z≤N<br />

λ N(k)<br />

N(k)! e−λ<br />

N λN(k)<br />

N(k)! e−λ<br />

z>N<br />

z>N<br />

B(λ, M)(c − 1) − N A(λ, M)(c − 1) = N − λ (3.2.11)<br />

After solving equation (3.2.11), a λ should be found, which <strong>for</strong> M = 100<br />

and c = 8 should be equal or close to the average of attendances. With a<br />

numerical approximation of λ available, the values of pi in equilibrium point<br />

could be determined following a very simple procedure:<br />

M<br />

M<br />

λ = E(N(k) = E( xj(k)) = E( xj(k)) =<br />

j=1<br />

j=1<br />

M<br />

E(xj(k))<br />

Since xi(k) are Bernoulli trials with θ = pi(k) then E(xi(k)) = pi(k). Hence:<br />

λ =<br />

j=1<br />

M<br />

pj(k) (3.2.12)<br />

j=1<br />

It must be noted that c = 1 in equation (3.2.11) leads to M<br />

j=1 pj = N . So<br />

<strong>for</strong> this value of c the original result, mentioned in [10] was recovered.


3.2. TAXING/PAYOFFS ALGORITHMS 29<br />

3.2.2 Fairness and Efficiency<br />

Like ‘partial in<strong>for</strong>mation with taxing’ algorithm also here two groups of agents<br />

are created. Again 41 of them hardly ever attend and 59 almost always and <strong>for</strong><br />

those who do attend the profits are very close to 1 while <strong>for</strong> those who do not,<br />

profits are close to 0. In the modified version, although not attending agents are<br />

encouraged to attend with a slight increase of the probability pi the results are<br />

not significantly different. This time 40 stay at home almost always and 60 go<br />

to the bar. A larger pi will lead to more agents attending the bar, but there is<br />

also the potential danger of overcrowding. <strong>The</strong> second algorithm has a slightly<br />

better behaviour since most agents have a marginal raise in the profits and the<br />

differences in std are of no significance (Table: 3.3). Although these algorithms<br />

std mean<br />

partial info with taxing 0.4748791 0.57201<br />

modified partial info with taxing 0.4863357 0.5930867<br />

full info with taxing 0.04937645 0.1766167<br />

Table 3.3: standard deviation and mean of payoff probabilities <strong>for</strong> taxing algorithms.<br />

seem to be as unfair as the original, there is an indication that they might be<br />

slightly more efficient. <strong>The</strong> average value of payoff probabilities are larger in the<br />

taxing variation.<br />

But the suprise comes from the ‘full in<strong>for</strong>mation with taxing’ algorithm. As<br />

it can been seen in figure 3.3 one group has 99 agents with probabilities of attendance<br />

varying from 0.46 to 0.76 and only one agent never goes to the bar. Also<br />

compared to the original full in<strong>for</strong>mation algorithm, this one is more efficient<br />

from the agents point of view, since the payoff probability <strong>for</strong> those who attend<br />

varies from 0.08 to 0.27 and has an average of 0.1766167. On the contrary in the<br />

original full in<strong>for</strong>mation, the payoff probability varies from −0.05 to 0.04 with an<br />

average of −0.005 (figure: 2.7, table: 2.4). It can be said that the improvement<br />

is quite significant.<br />

As expected, the first two algorithms are better than the third in terms of<br />

<strong>systems</strong> efficiency, although are worse when compared with original ones. That<br />

happens because of the relatively high distribution. <strong>The</strong> two first have almost<br />

identical behaviour, although the effects of the slight increase of pi in the 2nd algorithm,<br />

are visible in (Figure: 3.4). <strong>The</strong> behaviour of the third taxing algorithm<br />

is almost identical with the behaviour of the original.


30 CHAPTER 3. ANALYSIS AND EXTENSION OF THE STOCHASTIC ALGORITHM<br />

frequency<br />

0 10 20 30 40 50<br />

frequency<br />

0 10 20 30 40 50<br />

frequency<br />

0 2 4 6 8<br />

partial in<strong>for</strong>mation with taxing<br />

0.0 0.2 0.4 0.6 0.8 1.0<br />

probability of attendance<br />

modified partial in<strong>for</strong>mation with taxing<br />

0.0 0.2 0.4 0.6 0.8 1.0<br />

probability of attendance<br />

full in<strong>for</strong>mation with taxing<br />

0.0 0.2 0.4<br />

probability of attendance<br />

0.6 0.8<br />

frequency<br />

0 10 20 30 40 50<br />

frequency<br />

0 10 20 30<br />

frequency<br />

0 1 2 3 4 5 6 7<br />

partial in<strong>for</strong>mation with taxing<br />

0.0 0.2 0.4 0.6 0.8 1.0<br />

payoff probability<br />

modified partial in<strong>for</strong>mation with taxing<br />

0.0 0.2 0.4 0.6 0.8 1.0<br />

payoff probability<br />

full in<strong>for</strong>mation with taxing<br />

0.00 0.05 0.10 0.15 0.20 0.25<br />

payoff probability<br />

Figure 3.3: fairness and efficiency plots <strong>for</strong> taxing algorithms.


3.3. BUDGET ALGORITHMS 31<br />

standard deviation<br />

0 5 10 15<br />

taxing algorithms<br />

taxing partial<br />

modified taxing partial<br />

taxing full<br />

0 500 1000 1500<br />

iterations<br />

2000 2500 3000<br />

Figure 3.4: standard deviation off attendance <strong>for</strong> taxing algorithms.<br />

3.3 Budget Algorithms<br />

3.3.1 Overview<br />

In this algorithm agents have a limited budget which does not allow them to<br />

attend the bar every night. In another version (‘modified budget algorithm’) of<br />

this algorithm they are <strong>for</strong>ced to stay at home after attending the bar several<br />

consecutive nights. This could be denoted as following:<br />

∀ i ∈ [1, M], k ∈ [1, n], if<br />

b<br />

xi(k − j) = b ⇒<br />

j=0<br />

xi(k + 1) = · · · = xi(k + w) = 0 (3.3.1)<br />

where b ∈ N is the constant that determines how many nights i-agent can attend<br />

the bar consecutively and w ∈ N the maximum nights an agent must stay indoors<br />

after having attended the bar <strong>for</strong> b nights<br />

<strong>The</strong> algorithm settles down after almost 2000 iterations, but it is very CPU<br />

intensive. In table 3.4 there are some results as well as the time needed <strong>for</strong> them.<br />

Although the so far algoririthms have given results <strong>for</strong> 2 · 10 8 iterations in almost<br />

3 days, this one <strong>for</strong> 2˙10 6 after 2 weeks has not given any result yet. <strong>The</strong> reason<br />

of this increase in CPU power is that instead of using an array of attendances in<br />

terms of 1 and 0 which is is initialised in every iteration and its size is equal to the<br />

number of the agents, it uses a matrix which contains the attendances <strong>for</strong> every<br />

iteration. That is a matrix with number of agents×iterations elements. Despite<br />

the fact that this algorithm is the most fair and efficient of all (see subsection:<br />

3.3.2), it might not be suitable <strong>for</strong> networks of hundreds of nodes, or in cases of<br />

large numbers, because in every iteration the columns of this matrix are scanned<br />

<strong>for</strong> sequences of 1’s. <strong>The</strong> <strong>next</strong> element or sequence of elements in the ‘modified<br />

budget’ is set to 0 reflecting the inability of the agents to attend the bar.<br />

As the ratio of budget to ‘nights staying at home’ reaches 1, the bar becomes<br />

underutilised. It is as if the town is hit by recession: when people experience


32 CHAPTER 3. ANALYSIS AND EXTENSION OF THE STOCHASTIC ALGORITHM<br />

N /M 60/100 60/100 60/100<br />

iterations 5000 4 · 10 4 2 · 10 6<br />

µ 0.01 0.01 0.001<br />

average 59.133400 58.161900 n/a yet<br />

std 0.999281 1.673139 n/a yet<br />

time 6 sec 5 min 2 weeks...<br />

Table 3.4: Behaviour of the ‘modified budget’ algorithm <strong>for</strong> budget=10 and<br />

staying at home=6.<br />

financial difficulties they do not attend bars. For values of this ratio much less<br />

than 1 the algorithm settles down almost instantly. If the budget is large the<br />

results are similar to the original ‘partial in<strong>for</strong>mation’ algorithm (Table: 3.5 and<br />

Figure: 3.6).<br />

frequency<br />

0 200 400 600<br />

budget 10 100 10 10 10<br />

waiting 0 0 3 10 6<br />

average 59.385200 59.287200 59.292000 48.981200 58.165750<br />

std 2.916301 1.132950 1.861538 7.423848 4.851578<br />

Table 3.5: Simulation results <strong>for</strong> budget algorithms.<br />

Histogram of attendances in budget with b=10<br />

35 40 45 50<br />

attendances<br />

55 60 65 70<br />

frequency<br />

0 200 400 600 800 1000<br />

Histogram of attendances in modified budget with b=10,w=6<br />

40 50<br />

attendances<br />

60 70<br />

Figure 3.5: histograms <strong>for</strong> budget algorithms (b = 10, w = 0/6).<br />

Although budget algorithms are a variation of the partial in<strong>for</strong>mation algorithm,<br />

their histograms (figure: 3.5) are quite different. Especially the first which has a<br />

wider distribution than the original one.


3.3. BUDGET ALGORITHMS 33<br />

probabities <strong>for</strong> each agent<br />

probabities <strong>for</strong> each agent<br />

probabities <strong>for</strong> each agent<br />

1.0<br />

0.8<br />

0.6<br />

0.4<br />

0.2<br />

0.0<br />

0 1000 2000 3000 4000 5000<br />

time (iterations)<br />

1.0<br />

0.8<br />

0.6<br />

0.4<br />

0.2<br />

0.0<br />

0<br />

1.0<br />

1000 2000<br />

time (iterations)<br />

3000 4000<br />

0.8<br />

0.6<br />

0.4<br />

0.2<br />

0.0<br />

0 1000 2000 3000 4000 5000<br />

time (iterations)<br />

attendance<br />

attendance<br />

attendance<br />

100<br />

80<br />

60<br />

40<br />

20<br />

0<br />

0 1000 2000 3000 4000 5000<br />

time (iterations)<br />

100<br />

80<br />

60<br />

40<br />

20<br />

0<br />

0<br />

100<br />

1000 2000<br />

time (iterations)<br />

3000 4000<br />

80<br />

60<br />

40<br />

20<br />

0<br />

0 1000 2000 3000 4000 5000<br />

time (iterations)<br />

Figure 3.6: <strong>The</strong> overall attendance and the probabilities <strong>for</strong> each of the M<br />

agents <strong>for</strong> budget (budget= 10) and modified budget (budget= 10, wait=3, 6)<br />

algorithms.


34 CHAPTER 3. ANALYSIS AND EXTENSION OF THE STOCHASTIC ALGORITHM<br />

3.3.2 Fairness and Efficiency<br />

In the first variation of the ‘budget algorithms’ the <strong>for</strong>mation of the two groups<br />

persists, although it is clear that this is the fairest partial in<strong>for</strong>mation algorithm<br />

considered so far, since only 34 agents decided to stay at home. <strong>The</strong> modified<br />

version of this algorithm improves it by resolving most of fairness and efficiency<br />

issues. Indeed, the more days agents have to stay at home in order to save<br />

resources, more people have thew opportunity to attend. <strong>The</strong> number of the<br />

always no attending agents goes from 23 in the 2nd example, to 6 in the 3rd one.<br />

<strong>The</strong> improved version is also more efficient <strong>for</strong> the agents (Figure: 3.8). For<br />

the first time, an algorithm can become fairer without becoming less efficient and<br />

vice versa. As days at home increase, standard deviation diminishes and payoff<br />

probability is raising (Table: 3.6). Like it was expected, <strong>for</strong>cing agents to stay<br />

at home after systematic visits, gives a chance <strong>for</strong> those that would have never<br />

thought to attend it and increases everybody’s profits. <strong>The</strong> only setback seems<br />

to be that, this increase of profits is made in expense of the bar management,<br />

since the average of attendance is around 58.<br />

days waiting std mean<br />

0 0.0953156 0.132056<br />

3 0.232645 0.42336<br />

6 0.1286092 0.471414<br />

Table 3.6: standard deviation and mean of payoff probabilities <strong>for</strong> budget algorithms.<br />

standard deviation<br />

0 2 4 6 8 10<br />

budget algorithms<br />

0 days at home<br />

3 days at home<br />

6 days at home<br />

0 1000 2000 3000 4000 5000<br />

iterations<br />

Figure 3.7: standard deviation off attendance <strong>for</strong> budget algorithms.<br />

<strong>The</strong> last two algorithms are more efficient when the interests of the bar are<br />

considered. <strong>The</strong>y have almost identical behaviour, although in figure: 3.7 it can<br />

be seen that the algorithm behaves slightly better <strong>for</strong> smaller values of the ‘staying<br />

at home’ constant. <strong>The</strong> std of the attendance <strong>for</strong> the original budget algorithm,<br />

seems to be stable, with no indication of improvement. <strong>The</strong> only problem is that


3.3. BUDGET ALGORITHMS 35<br />

frequency<br />

0 10 20 30 40 50<br />

frequency<br />

0 10 20 30 40<br />

frequency<br />

0 10 20 30 40<br />

budget algorithm<br />

0.0 0.2 0.4 0.6 0.8<br />

probability of attendance<br />

budget algorithm with 3 days at home<br />

0.0 0.2 0.4<br />

probability of attendance<br />

0.6 0.8<br />

budget algorithm with 6 days at home<br />

0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7<br />

probability of attendance<br />

frequency<br />

0 5 10 15<br />

frequency<br />

0 5 10 15 20 25 30 35<br />

frequency<br />

0 10 20 30<br />

budget algorithm<br />

0.00 0.05 0.10<br />

payoff probability<br />

0.15 0.20<br />

budget algorithm with 3 days at home<br />

0.0 0.1 0.2 0.3<br />

payoff probability<br />

0.4 0.5 0.6<br />

budget algorithm with 6 days at home<br />

0.0 0.1 0.2 0.3 0.4 0.5<br />

payoff probability<br />

Figure 3.8: fairness and efficiency plots <strong>for</strong> budget algorithms.<br />

although the fluctuations in standard deviations are lower when agents stay many<br />

days at home, the bar is underutilised. Considering system’s fairness and based<br />

on the histograms of figure:3.5 the first case, where w = 0 is the fairest, since the<br />

distribution of the attendances is wider.


36 CHAPTER 3. ANALYSIS AND EXTENSION OF THE STOCHASTIC ALGORITHM


Chapter 4<br />

Case Study: Multiple <strong>Bar</strong>s in<br />

Santa Fe<br />

What if the citizens of <strong>El</strong> <strong>Farol</strong> had a chance to choose from a pool of more than<br />

one bar? Would the same algorithms behave differently? In this chapter, the case<br />

of three bars is studied. <strong>The</strong> main intention is to see, if the extremely efficient<br />

‘partial in<strong>for</strong>mation’ algorithm can become more fair when three bars instead of<br />

one are available. Also this problem tends to be more realistic, since in most cases<br />

more than one choices exist. <strong>The</strong> rule used in the decision process by each agent,<br />

is based on a rather simplistic assumption that everybody prefers going out to<br />

staying at home. <strong>The</strong> decision is similar to the process described in subsection<br />

2.2.3. Only in this case, instead of using a biased coin to decide whether to attend<br />

the bar or not, the agent uses three distinct and slightly biased coins. Each coin<br />

corresponds to a bar, <strong>for</strong> example, if the first coin shows he should not attend,<br />

he tosses the second, if it shows not to attend again, he tosses the third and if it<br />

shows not to attend he stays at home.<br />

Instead of using only one fixed sequence of the three bars, 3! were used. At<br />

each iteration of the algorithm, after the probabilities of attendance have been<br />

calculated, a sequence of bars is chosen randomly.<br />

Simulations showed similar results to the one bar version. In order to achieve<br />

consistency the 6/10 ration is preserved and again µ is set to be 0.01. Santa Fe is<br />

now consisted of M = 300 citizens and has three bars, each one having a capacity<br />

of N = 60 <strong>for</strong> each one of them. Overall Nall = 180 which is the 60% of 300. As<br />

it is seen in table 4 and in figures 4.1 and 4.2 the behaviour of the algorithm is<br />

almost identical.<br />

37


38 CHAPTER 4. CASE STUDY: MULTIPLE BARS IN SANTA FE<br />

attendance <strong>for</strong> <strong>Bar</strong> 1<br />

attendance <strong>for</strong> <strong>Bar</strong> 2<br />

attendance <strong>for</strong> <strong>Bar</strong> 3<br />

100<br />

80<br />

60<br />

40<br />

20<br />

0<br />

0 500 1000 1500 2000 2500 3000<br />

time (iterations)<br />

100<br />

80<br />

60<br />

40<br />

20<br />

0<br />

0 500 1000 1500 2000 2500 3000<br />

time (iterations)<br />

100<br />

80<br />

60<br />

40<br />

20<br />

0<br />

0 500 1000 1500 2000 2500 3000<br />

time (iterations)<br />

probabities <strong>for</strong> each agent<br />

probabities <strong>for</strong> each agent<br />

probabities <strong>for</strong> each agent<br />

1.0<br />

0.8<br />

0.6<br />

0.4<br />

0.2<br />

0.0<br />

0 500 1000 1500 2000 2500 3000<br />

time (iterations)<br />

1.0<br />

0.8<br />

0.6<br />

0.4<br />

0.2<br />

0.0<br />

0 500 1000 1500 2000 2500 3000<br />

time (iterations)<br />

1.0<br />

0.8<br />

0.6<br />

0.4<br />

0.2<br />

0.0<br />

0 500 1000 1500 2000 2500 3000<br />

time (iterations)<br />

Figure 4.1: <strong>The</strong> overall attendance and the probabilities <strong>for</strong> each of the M agents<br />

<strong>for</strong> each bar.


overall attendance<br />

300<br />

250<br />

200<br />

150<br />

100<br />

50<br />

0<br />

0 500 1000 1500 2000 2500 3000<br />

time (iterations)<br />

Figure 4.2: <strong>The</strong> cumulative attendance <strong>for</strong> all three bars.<br />

µ = 0.01 mean std<br />

All <strong>Bar</strong>s 177.689333 3.052926<br />

<strong>Bar</strong> 1 59.190000 2.360598<br />

<strong>Bar</strong> 2 59.201667 2.207228<br />

<strong>Bar</strong> 3 59.297667 2.524133<br />

Table 4.1: mean and std <strong>for</strong> all bars.<br />

<strong>The</strong> shared characteristics with the original algorithms continue when proceeding<br />

to the fairness and efficiency analysis. Indeed, figure 4.3 indicates that<br />

there are no agents that would want to attend more than one bar regularly. Each<br />

bar has its set of very devoted customers, despite the randomised decision process.<br />

This plots (barplots) are used in [17] as a token of unfairness. This unfairness is<br />

even more clear in payoff probability figures (fig:4.4), where it is seen that 120<br />

agents have payoff probability close to 0, while 179 are very close to 0.8. It seems<br />

that even in a town with three bars, agents insist on behaving selfishly, when<br />

using a partial in<strong>for</strong>mation based algorithm.<br />

39


40 CHAPTER 4. CASE STUDY: MULTIPLE BARS IN SANTA FE<br />

attendance probability<br />

attendance probability<br />

attendance probability<br />

0.0 0.2 0.4 0.6 0.8 1.0<br />

0.0 0.2 0.4 0.6 0.8 1.0<br />

0.0 0.2 0.4 0.6 0.8 1.0<br />

<strong>Bar</strong> 1<br />

agents<br />

<strong>Bar</strong> 2<br />

agents<br />

<strong>Bar</strong> 3<br />

agents<br />

Figure 4.3: Agent attendances <strong>for</strong> each bar


frequency<br />

0 50 100 150 200<br />

frequency<br />

0 50 100 150 200<br />

Agent payoffs <strong>for</strong> <strong>Bar</strong> 1<br />

0.0 0.2 0.4<br />

payoff probability<br />

0.6 0.8<br />

Agent payoffs <strong>for</strong> <strong>Bar</strong> 3<br />

0.0 0.2 0.4<br />

payoff probability<br />

0.6 0.8<br />

frequency<br />

0 50 100 150 200<br />

frequency<br />

0 20 40 60 80<br />

Agent payoffs <strong>for</strong> <strong>Bar</strong> 2<br />

0.0 0.2 0.4<br />

payoff probability<br />

0.6 0.8<br />

Agent payoffs <strong>for</strong> all bars<br />

0.0 0.2 0.4<br />

payoff probability<br />

0.6 0.8<br />

Figure 4.4: payoff probabilities <strong>for</strong> each bar and cumulative payoff probability<br />

<strong>for</strong> the 3-bar version<br />

41


42 CHAPTER 4. CASE STUDY: MULTIPLE BARS IN SANTA FE


Chapter 5<br />

Conclusions<br />

As it was mentioned in the first chapter the objective of this dissertation was<br />

to analyse the <strong>El</strong> <strong>Farol</strong> <strong>Bar</strong> <strong>Problem</strong>, view the differences between various approaches<br />

and try to expand some of them. It is a typical complex adaptive system,<br />

in which agents interact with each other competing <strong>for</strong> the same resource.<br />

<strong>The</strong> first three solutions insist on Arthur’s original concept of predictors with<br />

minor variation. A closer look reveals, that the only difference they have is<br />

the definition of predictors. Arthur uses a close set of predictors, while Challet<br />

et all [2] introduce the use of binary strategies in an attempt to simplify the<br />

problem and Fogel et all [3] use evolutionary learning algorithms <strong>for</strong> a more<br />

precise, although slightly more complicated, definition of the predictors.<br />

Arthur’s belief that any solution should require agents that pursue different<br />

strategies[18] is abandoned in the stochastic adaptive solution, proposed by Bell<br />

et all in [10]. In partial in<strong>for</strong>mation algorithms and their variations, there is<br />

no need <strong>for</strong> the agents to make prediction about the attendance of the <strong>Bar</strong>.<br />

<strong>The</strong>y make their decisions based only on their own previous experience. In the<br />

full in<strong>for</strong>mation algorithm, agents do know the full record of attendances. <strong>The</strong><br />

behaviour of this algorithm is similar to the first three, although it does not<br />

require the use of predictors<br />

Partial in<strong>for</strong>mation algorithms are more efficient and always converge with<br />

a very low standard deviation. Un<strong>for</strong>tunately this happens due to their unfair<br />

nature, which resembles the ‘greedy’ concept behind this algorithm. Agents who<br />

take decisions based only on their previous experiences act extremely selfishly<br />

when competing <strong>for</strong> the same resource. Fairness and efficiency could be measured<br />

with the use of utility payoffs. <strong>The</strong> results showed that in partial in<strong>for</strong>mation algorithms<br />

two groups of agents were <strong>for</strong>med. Those who almost always attended,<br />

having an average payoff very close to 1.0 and those who almost never attended,<br />

who had a payoff near 0. It is clear that these behaviour is very unfair, especially<br />

when compared to full in<strong>for</strong>mation results, but it is also efficient since the average<br />

utility payoff <strong>for</strong> all agents was higher than the one of the full in<strong>for</strong>mation<br />

algorithm.<br />

43


44 CHAPTER 5. CONCLUSIONS<br />

Another negative aspect of these algorithms, is that they converge to N − 1,<br />

leaving always <strong>El</strong> <strong>Farol</strong> <strong>Bar</strong> slightly underutilised. But even in that case the losses<br />

<strong>for</strong> the bar management are less than the full in<strong>for</strong>mation algorithm because of<br />

its almost zero standrad deviation. Partial in<strong>for</strong>mation algorithms after their<br />

convergence have almost zero std and mean 59 while full in<strong>for</strong>mation has a mean<br />

of 60 but also std of 6.5.<br />

This algorithm could be divided in three parts. First comes the probability of<br />

attendance, which is affected by the µ parameter and determines the attendances.<br />

In order to introduce fairness and efficiency, each single one of those parts was<br />

altered.<br />

Directly changing the probabilities of attendance which exceeded a threshold,<br />

did not give better results. In this variation of the stochastic adaptive algorithms<br />

after several iterations another value of probability was assigned, if they were<br />

larger than an upper bound, or lower than a low bound. Despite the fact that this<br />

algorithm had countless variations, none of the simulations showed significantly<br />

good results. This aggressive way of changing the probabilities created more<br />

unfairness and less efficiency and that is why the results are not included in the<br />

report, although the code is included in the Appendix.<br />

<strong>The</strong> results were much better when taxation was implemented. Although<br />

the partial in<strong>for</strong>mation algorithms did not become more fair with the use of<br />

an adaptive µ, they become more effective. Full in<strong>for</strong>mation algorithms were<br />

more fair but also significantly more effective. But probably the best results<br />

came when agents were <strong>for</strong>ced to stay indoors after a succession of attendances.<br />

Partial in<strong>for</strong>mation with budget algorithm gave almost perfectly fair results and<br />

slightly less efficient than the original one. Although the results of the partial<br />

in<strong>for</strong>mation with budget were more than acceptable, this algorithm is very CPU<br />

intensive and demanding. Also the use of a budget meant that the system was<br />

no more a decentralised one, where agents made their own decisions. Although<br />

agents still do not need access to full record, a central mechanism which will<br />

ensure they do not spent their budget and that they will stay indoors as many<br />

days as needed, is necessary.<br />

Finally, the problem was re<strong>for</strong>mulated, so it could include three bars. Each<br />

agent was randomly assigned one sequence of bars, which changed in every iteration<br />

of the algorithm. Instead of deciding whether to go to <strong>El</strong> <strong>Farol</strong> or stay at<br />

home, he had to decide whether to go to the first bar of the sequence, second,<br />

third or stay at home. Despite the randomised sequence, the results were almost<br />

similar to the previous results.<br />

In all cases, it was shown that the original algorithms could be extended in<br />

many ways. <strong>The</strong>re is much work left to be done in this field. Papers [10], [17], [18]<br />

and [15] have mentioned only the first three variations of the stochastic adaptive<br />

learning algorithms (partial, full, partial with signs) and examined their convergence<br />

properties. <strong>The</strong> most important is that they could be used accordingly in<br />

order to fulfil a very versatile set of tasks. <strong>The</strong>y could be combined or used to


calculate attendances in a network of many nodes (bars) which accepts dynamically<br />

evolving population. <strong>The</strong> C code used to generate all the results, is modular<br />

enough so even more variations can be included. Also the mathematical <strong>for</strong>mulation<br />

of the algorithms make it possible to study their convergence properties,<br />

following the steps defined in the original paper[10] and further extended in this<br />

dissertation <strong>for</strong> the tax algorithms.<br />

45


46 CHAPTER 5. CONCLUSIONS


Appendix A<br />

C Code <strong>for</strong> the <strong>El</strong> <strong>Farol</strong> <strong>Bar</strong><br />

<strong>Problem</strong><br />

/***************************************************************************/<br />

/* Program that solves <strong>El</strong> <strong>Farol</strong> <strong>Bar</strong> problem based in paper: */<br />

/* Coordination Failure as a Source of Congestion in In<strong>for</strong>mation Networks */<br />

/* Ann M. Bell, William A. Sethares, James A. Bucklew */<br />

/* IEEE Trans. Signal Processing, 2003 */<br />

/***************************************************************************/<br />

/***************************************************************************/<br />

/* This source code is a part of MSc dissertation: */<br />

/* <strong>The</strong> <strong>El</strong> <strong>Farol</strong> <strong>Bar</strong> <strong>Problem</strong> <strong>for</strong> <strong>next</strong> <strong>generation</strong> <strong>systems</strong> */<br />

/* by Athanasios Papakonstantinou */<br />

/***************************************************************************/<br />

/* In order to compile and run this program, type the following from<br />

the directory the source is saved:<br />

gcc -Wall -lgsl -lgslcblas -lm demo3.c support.c modules.c debug.c */<br />

/* Bugs and known issues:<br />

i. Un<strong>for</strong>tunately the GSL C library is needed <strong>for</strong> the random generators.<br />

You can install it from yours distribution package management system. This<br />

remains to be fixed in the future, since this code intended to show quick<br />

results of many algorithms. It is No 1 priority, because I want the program<br />

to be portable.<br />

ii. To generate plots you must run the ef.sh script provided, and install the<br />

plotutils package.<br />

iii. Some algorithms can be very demanding. Especially budget algorithms. You<br />

should not use more than 20000 iterations. This is more a feature than a bug<br />

iv. This is not optimised code, the results <strong>for</strong> 2*10^8 iterations were calculated<br />

from a variation of this code, which does not produce any files <strong>for</strong> plotting<br />

v. <strong>The</strong>re is a total lack of substantial user’s interface. <strong>The</strong>re was no time <strong>for</strong><br />

47


48 APPENDIX A. C CODE FOR THE EL FAROL BAR PROBLEM<br />

that, see Bugs and known issues bullet "i". This will be fixed in the future but<br />

only if the code is uploaded in the internet<br />

vi. No other bugs are known. This code was compiled with gcc 4.1.1 in a<br />

Gentoo GNU/Linux box with 2.6.17-gentoo-r4 kernel and with gcc 3.4.6 in<br />

a MandrakeLinux 10.1 box with 2.6.8.1-12mdksmp kernel. */<br />

#include <br />

#include <br />

#include <br />

#include <br />

#include <br />

#include "elfarol.h"<br />

/*** *** prototypes section *** ***/<br />

/* function to write integers in files, used <strong>for</strong> plotting the attendaces,<br />

mean and running average of them */<br />

void writei_mean (char[], int, int[]);<br />

/* function to write floats in files, used <strong>for</strong> plotting probabilities */<br />

void writed(char[], int,int, int, float[]);<br />

/* function that is used in fairness plots! */<br />

void write_fair(char[],int[], int, int);<br />

/* module used in partial and full algorithms */<br />

float 1eq5 (float, float, int, int);<br />

/* module used in signed partial algorithm */<br />

float eq7 (float, float, float, int, int);<br />

/* module used in taxing algorithms */<br />

float tax (float, float, float, int, int);<br />

/* utility function - returns {-1 0 1} */<br />

int utility (int, int,int);<br />

/*** ***files section *** ***/<br />

#define attendance "att"<br />

#define propability "prop"<br />

#define fairness "fair"<br />

#define payoff "pay"<br />

/*** *** constant variables *** ***/<br />

//*** General Section ***<br />

const int M=100; //available agents in the system<br />

const int cp=60; //capacity of the bar (happy number)<br />

const int nt=3000; //no of iterations<br />

const float m=0.01; //the \mu parameter<br />

//** Taxing Algorithms **<br />

/* m1 is used <strong>for</strong> taxing selfish agents and m3 to encourage


those staying at home to attend the bar.*/<br />

const float m1=8;<br />

const float m3=1.01;<br />

//** Critical Values **<br />

/* up and down are the boundaries and d is used in the shuffle<br />

variation */<br />

const float up=0.9;<br />

const float down=0.1;<br />

const int d=2;<br />

//** Budget Algorithms **<br />

const int wait=10; //maximum waiting time<br />

/*** ***Main program *** ***/<br />

int main()<br />

{<br />

int i,k; //<strong>for</strong><br />

int *a_agent; //array of attendances<br />

float *p_agent //array of M propabilities <strong>for</strong> nt iterations<br />

int *god; //a_agent <strong>for</strong> all iterations<br />

int *a_total; //attendance after each iteration<br />

int *sgn; //array in partial sign algorithm<br />

float *tax_agent; //array in tax algorithm<br />

float *mu; //array full of \mu’s<br />

int *u_total; //array of total payoffs after each iteration<br />

int ans1,ans2; //Answers in interface<br />

int j,sum,l; //used in budget algorithms<br />

int max,max_out; //maximum attendances in budget<br />

const gsl_rng_type *T; //random generator<br />

gsl_rng *r; //random generator<br />

/* create a generator chosen by the environment variable<br />

GSL_RNG_TYPE */<br />

gsl_rng_env_setup();<br />

T = gsl_rng_default;<br />

r = gsl_rng_alloc (T);<br />

printf("How many agents should be viewed in probabilities plot?\n");<br />

scanf("%d",&ans2);<br />

/* Initializing variables i=0 and Initial Conditions IC */<br />

p_agent = (float *)malloc((M*nt)*sizeof(float));<br />

god = (int *)malloc((M*nt)*sizeof(int));<br />

a_total = (int *)malloc((nt)*sizeof(int));<br />

a_agent = (int *)malloc((M)*sizeof(int));<br />

sgn = (int *)malloc((nt)*sizeof(int));<br />

tax_agent = (float *)malloc((M)*sizeof(float));<br />

mu = (float *)malloc((M)*sizeof(float));<br />

u_total = (int *)malloc((M*nt)*sizeof(int));<br />

<strong>for</strong>(i=0; i


50 APPENDIX A. C CODE FOR THE EL FAROL BAR PROBLEM<br />

god[i]=9;<br />

}<br />

<strong>for</strong>(i=0; i


eak;<br />

//Algorithm 2 full in<strong>for</strong>mation algorithm<br />

case(2):<br />

<strong>for</strong>(i=1; i


52 APPENDIX A. C CODE FOR THE EL FAROL BAR PROBLEM<br />

if(p_agent[i*M+k]>gsl_ran_flat(r,0,1)) {a_agent[k]=1;god[i*M+k]=1;}<br />

else {a_agent[k]=0;god[i*M+k]=0;}<br />

}<br />

a_total[i]=sumar(M,a_agent);<br />

<strong>for</strong>(k=0; k


* In this bit, budget is implemented, god matrices columns are scanned <strong>for</strong><br />

sequences of 1’s which indicate continuous attendances. All unassigned<br />

values are equal to 9, so that not any sum of 1’s is equal to budget but<br />

only those that have the <strong>next</strong> after element unassigned (=9) This element<br />

is set equal to 99 */<br />

<strong>for</strong> (k=0;k


54 APPENDIX A. C CODE FOR THE EL FAROL BAR PROBLEM<br />

/* Uncomment <strong>for</strong> up/down shuffle */<br />

// if (p_agent[i*M+k]>up) {p_agent[i*M+k]=down;}<br />

// if (p_agent[i*M+k]up)<br />

{p_agent[i*M+k]=(1.0/d)*p_agent[i*M+k];}<br />

if (p_agent[i*M+k]


}<br />

/* This bit calculates the attendances. If the new god element is not 99<br />

then the attendance is as usual calculated by the probability. If it is to 99,<br />

it is so because it is after a sequence of attendances and this and the<br />

following w-1 must be set to 0 */<br />

<strong>for</strong>(k=0; kgsl_ran_flat(r,0,1)) {a_agent[k]=1;god[i*M+k]=1;}<br />

else {a_agent[k]=0;god[i*M+k]=0;}<br />

}<br />

else if(god[i*M+k]==99) {god[i*M+k]=0; a_agent[k]=0;}<br />

}<br />

a_total[i]=sumar(M,a_agent);<br />

<strong>for</strong>(k=0; k


56 APPENDIX A. C CODE FOR THE EL FAROL BAR PROBLEM<br />

}<br />

printf("5. Full info with taxing\n");<br />

printf("6. Partial info with budget\n");<br />

printf("7. Partial with critical values\n");<br />

printf("8. Partial with budget, exotic!\n");<br />

void writei_mean (char filename[], int array_len, int x[])<br />

{<br />

FILE *fptr;<br />

int i;<br />

float sum1; //sum1 is the trend, mean changes with considering every attendance<br />

float sum2; //sum2 is the mean of all iterations attendances<br />

sum1=0.0;<br />

sum2=0.0;<br />

fptr= fopen (filename, "w");<br />

if (fptr==NULL) {<br />

printf("Unable to open file,check directory permissions and try again\n");<br />

exit(-1);<br />

}<br />

<strong>for</strong> (i=0; i


void write_fair(char filename[],int a[], int array_len1, int array_len2)<br />

/* array_len1:M, array_len2:nt */<br />

{<br />

FILE *fptr;<br />

int i,j;<br />

float sum;<br />

fptr= fopen (filename, "w");<br />

if (fptr==NULL) {<br />

printf("Unable to open file,check directory permissions and try again\n");<br />

exit(-1);<br />

}<br />

<strong>for</strong> (i=0; i


58 APPENDIX A. C CODE FOR THE EL FAROL BAR PROBLEM


Bibliography<br />

[1] Arthur W. B. Inductive reasoning and bounded rationality: <strong>The</strong> el farol<br />

problem. Amer. Econ. Rev., 84:406–411, May 1994.<br />

[2] Marsili M. Challet D. and Ottino G. Shedding light on el farol. Game<br />

<strong>The</strong>ory and In<strong>for</strong>mation 0406002, f. EconWPA, June 2004. available at<br />

http://ideas.repec.org/p/wpa/wuwpga/0406002.html.<br />

[3] Chellapilla K Fogel D. B. and Angeline P. J. Inductive reasoning and<br />

bounded rationality reconsidered. IEEE Transactions on Evolutionary Computation,<br />

3(2), 1999.<br />

[4] Strogatz S. H. Nonlinear Dynamics and Chaos. Westview Press, 2000.<br />

[5] Goertzel B. From Complexity to Creativity, Computational Models of Evolutionary,<br />

Autopoietic and Cognitive Dynamics. Plenum Press, 1997.<br />

[6] <strong>Bar</strong>-Yam Y. Dynamics of complex <strong>systems</strong>. Westview Press, July 1993.<br />

[7] Waldrop M. M. Complexity: <strong>The</strong> Emerging Science at the Edge of Order<br />

and Chaos. Penguin Books Ltd, January 1994.<br />

[8] Arthur W. B. Complexity and the economy. Science, 284:107–109, April<br />

1999.<br />

[9] Nie N. and Comaniciu C. Adaptive channel allocation spectrum etiquette<br />

<strong>for</strong> cognitive radio networks, 2006.<br />

[10] Sethares W. A. Bell A. M. and Bucklew J. A. Coordination failure as a<br />

source of congestion in in<strong>for</strong>mation networks. IEEE Trans. Signal Processing,<br />

51(3):875–885, March 2003.<br />

[11] Garogalo M. <strong>The</strong> ’el farol bar problem’ in netlogo. Unpublished Draft.<br />

[12] Osborne M. J. and Rubinstein A. A Course in Game <strong>The</strong>ory. MIT Press,<br />

1994.<br />

[13] Hargreaves-Heap S. P. and Varoufakis Y. Game <strong>The</strong>ory, A critical text.<br />

Routledge, 2004.<br />

59


60 BIBLIOGRAPHY<br />

[14] Challet D. and Zhang Y.-C. Emergence of cooperation and organization in<br />

an evolutionary game. Physica A, 246:407–418, 1997.<br />

[15] Bell A. M. and Sethares W. A. <strong>The</strong> el farol problem and the internet:<br />

Congestion and coordination failure. Computing in Economics and Finance<br />

1999 812, Society <strong>for</strong> Computational Economics, March 1999. available at<br />

http://ideas.repec.org/p/sce/scecf9/812.html.<br />

[16] Greenwald A. Farago J. and Hall K. Fair and efficient solutions to the santa fe<br />

bar problem. http://www.clsp.jhu.edu/~khall/pubs/santafe_02.pdf.<br />

[17] Sivanadyan T. and Sethares W. A. A decentralized optimal solution to the<br />

‘minority game’. preprint submitted to Physica A, February 2006. http:<br />

//homepages.cae.wisc.edu/~thiagars/pdfs/MinorityGame.pdf.<br />

[18] Bell A. M. and Sethares W. A. Avoiding global congestion using decentralized<br />

adaptive agents. IEEE Transactions in Signal Processing, 49(11):2873–<br />

2879, November 2001.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!