Monday, May 23, 2011

My Generations Project and Prisoner's Dilemma

Apologies for the lack of recent posts. I have been 'learning technical stuff' mostly at work and mostly not in a form that can be easily shared. I have recently found the time to start a new project I call Generations - a python program I am developing to simulate some aspects of natural economy and natural selection.

Recently I re-read Richard Dawkins' The Selfish Gene and Robert Wright's The Moral Animal and was fascinated by the idea that computer simulations could tell us useful information about effective behavioral strategies, how those strategies prosper and in turn what effect these strategies may have on their own effectiveness and that of other strategies.

Currently this initial version of my program only simulates Prisoner's Dilemma. Wikipedia describes the Prisoner's Dilemma scenario, a classic game from the field of Game Theory, like this:
Two suspects are arrested by the police. The police have insufficient evidence for a conviction, and, having separated the prisoners, visit each of them to offer the same deal. If one testifies for the prosecution against the other (defects) and the other remains silent (cooperates), the defector goes free and the silent accomplice receives the full one-year sentence. If both remain silent, both prisoners are sentenced to only one month in jail for a minor charge. If each betrays the other, each receives a three-month sentence. Each prisoner must choose to betray the other or to remain silent. Each one is assured that the other would not know about the betrayal before the end of the investigation. How should the prisoners act?
Prisoner's Dilemma is an example of a non-zero-sum game, meaning that players are not attempting to beat other players, just achieve the best outcome for themselves. That is to say: winning doesn't automatically imply the other player or players have lost. When played repeatedly and scored (ie. 'Iterative Prisoner's Dilemma') the interesting question becomes which strategy, if any, is the most successful against the widest range of counter-strategies. Always cooperate? Always defect? Some mixture of the two?


The relevance of this game to the field of Darwinism (which both Dawkins and Wright were asserting) is that this situation of deciding to trust (or abuse trust) is a good abstraction of the issues underlying reciprocal altruism, one of the motivators of altruistic (or 'nice') behaviour in the neo-Darwinist worldview. Both Dawkins and Wright discussed a competition held in the 1970s and again in the early 1980's where Robert Alexrod challenged interested parties to design strategies for the game and test them out against the strategies of other players.

I am running my own tournament of sorts within Generations. Instead of the prisoner analogy however, my program simulates 'critters' adopting different strategies and receiving or losing 'food' as a result of the success or failure at the prisoner's dilemma game. I have currently implemented the following strategies:

  • Sucker, who always cooperates blindly
  • Cheater, who always defects
  • Random, who randomly cooperates or defects
  • Grudger, who cooperates with anyone who has never defected against them, and
  • Tit-For-Tat, who cooperates initially but punishes defections in the previous round by another player with a defection in the current round. 
My ratio of scoring for defection and cooperation is arbitrary and by default the simulation runs over 1500 iterations. The most successful strategies so far are Grudger and Tit-For-Tat, With Grudger always just beating out Tit-for-Tat. 

In Alexrod's tournament, Tit-for-Tat was judged the winner. One reason why my simulation might be playing out differently is that I have precisely one critter for each strategy, and whereas once bitten Grudger will never trust random again, Tit-for-Tat will 'trust' Random again after a random cooperation. 

The specific economic rewards I have assigned might also be making a difference. 

In the real-world, less successful 'critters' would reproduce in proportion with their success, and their hereditary strategies would be passed on their offspring. Critters with bad strategies would shrink as a proportion of the population, altering the dynamics of which strategy is more effective. Simulating this, as well as some other strategies I found on the Wikipedia page, is what I will do next.

In the meantime, you can get my Generations program on Github. Use the v*-PD tags to download the Prisoner's Dilemma only versions - I will be adding decidedly un-Prisoner's Dilemma elements (ie. other ways to simulate critters) in the near future. The current PD tag is v1.0-PD.

Let me know if you have questions, or comments. 

3 comments:

  1. The service of the store is very good, I have been answering questions without any temper.replica rolex watch uk Very good shopping experience. Come back next time. When I received this watch, I thought it was a good replica watch. replica rolex explorer watch I like this online store, this watch is simple and generous. Very satisfied with this purchase.

    ReplyDelete
  2. A totally inert substance when cured, concrete is literally emission-free and will not emit any gas, toxic compounds or volatile organic compounds.
    Ames commercial concrete contractors

    ReplyDelete
  3. More and more content are now available online about concrete works.
    Visit our website

    ReplyDelete