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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!