This page was automatically generated by NetLogo 4.0. Questions, problems? Contact

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

created with NetLogo

view/download model file: GA.nlogo


The model shows an enviroment with 1000 firms that have to choose the quantity to produce. The firms will decide how much to produce given the costs and the aggregate demand using a genetic algorithm. It is a simple model in which firms are not hyper rational but learn from what the other firms do. The system learns.
It is slow because it has to do a lot of computation.


The aggregate demand is given and the producing costs are the same for all firms. The market is competitive, the firms can sell only at the market price. The market price depends, given the demand function, on the overall production. The strategy (how much a generic firm produces) is codified by a binary string. The setup gives to each firm a random strategy. The firms will learn which is the optimal quantity to produce (the same for each firm since they face the same production costs and the same selling price) with a genetic algorithm. The black straight line is the optimal production when firms are hyper rational (know everything), the blu line is the mean production. It is interesting to see how the firms converge (quickly!) towards the optimal rational production.


When you setup the model the firms will have random strategies. The optimal strategy depends on the variable cost. If you change the variable cost the optimal strategy changes and the the firms will converge to the new optimal strategy.


Jakob Grazzini 2008. jakob.g(at)