Programming
Workshop

Spring 2007
course
navigation

history - random thoughts

Feb 22, 2007

evolution of cooperative behavior project ... general discussion of what Jim has in mind :
I want us, as a class, over the next month, to do a programming project using Java as the language, that looks at "evolution" and "competition" as a search strategy to find the "best" strategy in a prisoner's dilemma-like situation.
The payoff matrix below gives an idea of what we're talking about. The deatils aren't fixed yet.

prisoner's dilemma

See http://en.wikipedia.org/wiki/Prisoner's_dilemma

payoff matrix ( value to A , value to B ) higher numbers are better B cooperates B aggressive ------------------------------------- A cooperates ( 5, 5 ) ( -2, 15 ) ------------------------------------- A is aggressive ( 15, -2 ) ( 1, 1 )

what do we do next ?

Ricard

Define the final output you want better.

Jim

I want a fairly flexible system that allows us to evaluate algorithms for doing this in a repetive setting. I'd like the algorithms to have the possibility of "evolving" if we'd like, and I'd like to be able to look at different scenarios (do the players get an ID from others, do they die if they lose too many encounters, etc. ).

thinking out load

(This has changed from the original; I've chosen simpler names and gone for direct inheritence rather than an interface.)
class PrisonersDilemma { /* has main() method for project; manages everything else */ } class Player { /* define an API for an entity that plays this game */ } class RandomPlayer extends Player { /* a simple stupid one : just make random choices */ } class Players { /* collection of Players */ } class Judge { /* Run competitions between players */ } class Game { /* Let players ask for info about the game, implement a single round of play, and define any other constants or utiltity routines */ } class TrivialTestEngine { /* framework and classes for doing testing */ } class Tests { /* tests for each module */ }
Next steps: decide on some methods and data for these things, design tests, and start putting together the simplest version we can. Use that as a basis for thinking about the next more complicated version.

Feb 26

Monday night I started writing code; finished a first pass at Player.java and Game.java.
Also renamed classes discussed earler, set up a package/file system, and moved the test suit here.
Next:

March 15

I've been working on this at home off and on for the last few days.

~ April 2

Created rsync script (runs manually from laptop) to keep the server and laptop versions of this project consistent. (However, version tags only update from server's subversion saves.)

April 4

Cleaned up Tests for random player; turned off diagnostics; random player looks solid.
Time to put in somthing to let two of 'em go against each other, and then have a collection of 'em play with results of overall competition.
Moved getUniqueId into Player class; feels better.
Maybe show the class tomorrow where this is...

April 5

Added and tested Game.play() method in class. Decided to update player scores rather than return anything. Tested that player scores start at zero.
Found that to test it we wanted a Player who would always cooperate, not just one who would always defect (which is what it used to be), so we changed Player to be able to do that. Added tests for that ... and it all looks OK.
Coming next: competitions of many players

April 1

In class: started to implement a Tournament class. Looked up collection possibilities; decided (arbitrarily) to use ArrayList for players.


$Id: history.wiki 12775 2007-04-17 15:23:12Z mahoney $