Evolving Strategies for the Prisoner's Dilemma

ie.errity.pd
Class Rules

java.lang.Object
  |
  +--ie.errity.pd.Rules

public class Rules
extends java.lang.Object

This class represents the rules for a Game of the Prisoner's Dilemma.
Payoff Matrix used is

          -------------------------
          |Cooperate    |Defect   |
-----------------------------------
|Cooperate|     R,R     |   S,T   |
-----------------------------------
|Defect   |     T,S     |   P,P   |
-----------------------------------


Constructor Summary
Rules()
          Default constructor
Initialises rules as follows: Game Iterations = 100, T = 5, S = 0, R = 3, P = 1, Mutation probability = .95, Generations = 250, Number of Players = 50,
Rules(int it, int t, int s, int r, int p)
          Create new game rules with specified parameters
Rules(int it, int t, int s, int r, int p, double m, double c)
          Create new game rules with specified parameters
Rules(int it, int t, int s, int r, int p, double m, double c, int gen, int pl)
          Create new game rules with specified parameters
 
Method Summary
 double getCrossP()
           
 int getGenerations()
           
 int getIterations()
           
 double getMutateP()
           
 int getNumPlayers()
           
 int getP()
           
 int getR()
           
 int getS()
           
 int getT()
           
 void setCrossP(double cp)
           
 void setGenerations(int g)
           
 void setIterations(int it)
           
 void setMutateP(double mp)
           
 void setNumPlayers(int p)
           
 void setP(int p)
           
 void setR(int r)
           
 void setS(int s)
           
 void setT(int t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rules

public Rules()
Default constructor
Initialises rules as follows: Game Iterations = 100, T = 5, S = 0, R = 3, P = 1, Mutation probability = .95, Generations = 250, Number of Players = 50,


Rules

public Rules(int it,
             int t,
             int s,
             int r,
             int p)
Create new game rules with specified parameters

Parameters:
it - the number of PD games to play in an iterated PD
t - the T value for the above payoff matrix
s - the S value for the above payoff matrix
r - the R value for the above payoff matrix
p - the P value for the above payoff matrix

Rules

public Rules(int it,
             int t,
             int s,
             int r,
             int p,
             double m,
             double c)
Create new game rules with specified parameters

Parameters:
it - the number of PD games to play in an iterated PD
t - the T value for the above payoff matrix
s - the S value for the above payoff matrix
r - the R value for the above payoff matrix
p - the P value for the above payoff matrix
m - the probability of mutation
c - the probability of crossover

Rules

public Rules(int it,
             int t,
             int s,
             int r,
             int p,
             double m,
             double c,
             int gen,
             int pl)
Create new game rules with specified parameters

Parameters:
it - the number of PD games to play in an iterated PD
t - the T value for the above payoff matrix
s - the S value for the above payoff matrix
r - the R value for the above payoff matrix
p - the P value for the above payoff matrix
m - the probability of mutation
c - the probability of crossover
gen - the maximum number of generations
pl - the number of players
Method Detail

getIterations

public int getIterations()
Returns:
the number of PD games to play in an iterated PD

getT

public int getT()
Returns:
the T value for the above payoff matrix

getS

public int getS()
Returns:
the S value for the above payoff matrix

getR

public int getR()
Returns:
the R value for the above payoff matrix

getP

public int getP()
Returns:
the P value for the above payoff matrix

getMutateP

public double getMutateP()
Returns:
the probabilty of mutation

getCrossP

public double getCrossP()
Returns:
the probabilty of crossover

getNumPlayers

public int getNumPlayers()
Returns:
the number of players

getGenerations

public int getGenerations()
Returns:
the maximum number of generations

setIterations

public void setIterations(int it)
Parameters:
it - the number of PD games to play in an iterated PD

setT

public void setT(int t)
Parameters:
t - the T value for the above payoff matrix

setS

public void setS(int s)
Parameters:
s - the S value for the above payoff matrix

setR

public void setR(int r)
Parameters:
r - the R value for the above payoff matrix

setP

public void setP(int p)
Parameters:
p - the P value for the above payoff matrix

setMutateP

public void setMutateP(double mp)
Parameters:
mp - the probability of mutation

setCrossP

public void setCrossP(double cp)
Parameters:
cp - the probability of crossover

setNumPlayers

public void setNumPlayers(int p)
Parameters:
p - the number of players

setGenerations

public void setGenerations(int g)
Parameters:
g - the maximum number of generations

Andrew Errity [99086921]