edu.cuny.cat.stat
Class PayoffReport

java.lang.Object
  extended by edu.cuny.cat.stat.PayoffReport
All Implemented Interfaces:
AuctionEventListener, GameReport, edu.cuny.config.param.Parameterizable, edu.cuny.stat.Report<AuctionEvent>, java.util.EventListener

public class PayoffReport
extends java.lang.Object
implements GameReport, edu.cuny.config.param.Parameterizable

This class aims to support an ecological simulation of a set of specialists in an all-round cat game. It uses the past normalized payoffs of specialists to control how frequently (in terms of days) the same set of specialists participate in the game this time.

It reads in the past normalized payoffs from the last line of a .CSV file and uses the payoffs as probability thresholds to control whether a specialist should be banned to reflect restrict on its participation.

At the end of the game, game scores of specialists are normalized and appended to the the .CSV file as the latest payoffs.

In this way, one run of the cat game represents a simulation of one generation.

TODO: note that the scores from ScoreReport is the cumulative score across games, not for the last game only. So temporarily, force it to reset scores when a new game starts.

Version:
$Revision: 1.8 $
Author:
Jinzhong Niu

Field Summary
static char DEFAULT_SEPARATOR
           
protected  java.lang.String inputFileName
          the name of the payoff file; if existing, contains previous normalized payoffs
protected  java.lang.String outputFileName
           
static java.lang.String P_INPUTFILE
           
static java.lang.String P_OUTPUTFILE
           
protected  edu.cuny.util.io.CSVWriter writer
           
 
Fields inherited from interface edu.cuny.cat.stat.GameReport
ACCEPTED, ASK, BID, CONVERGENCE_COEFFICIENT, EFFICIENCY, EQUILIBRIUM, FEE, Formatter, GLOBAL, MARKETSHARE, MAX, MEAN, MIN, PLACED, PRICE, PROFIT, PROFIT_DISPERSION, QUANTITY, SCORE, SHOUT, SPECIALIST, STDEV, TOTAL, TRADER, TRANSACTION, TRANSACTIONRATE, VALUE
 
Constructor Summary
PayoffReport()
           
 
Method Summary
protected  void applyPossblePenalties()
          apply probablistic day banning penalty to specialists that are supposed to have less presence in the game.
protected  void closeWriter()
           
 void eventOccurred(AuctionEvent event)
           
protected  void generateHeader()
          TODO: writes the IDs of specialists and an initial even payoffs to the beginning of the payoff file.
protected  double getAbsolutePayoff(java.lang.String specialistId)
           
 java.util.Map<edu.cuny.stat.ReportVariable,?> getVariables()
           
protected  boolean initPreviousPayoffs()
          reads in the previous payoffs of specialists.
protected  void initRandomGenerators()
           
protected  void initScoreReport()
           
protected  void initWriter()
           
 void produceUserOutput()
           
protected  void setPayoffs(java.util.List<java.lang.Double> payoffList)
          initialize the probabilities of participation based on payoffs of the previous game.
 void setup(edu.cuny.config.param.ParameterDatabase parameters, edu.cuny.config.param.Parameter base)
           
 java.lang.String toString()
           
protected  void writePayoffs()
          writes normalized payoffs of the ending game to payoff file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

P_INPUTFILE

public static final java.lang.String P_INPUTFILE
See Also:
Constant Field Values

P_OUTPUTFILE

public static final java.lang.String P_OUTPUTFILE
See Also:
Constant Field Values

DEFAULT_SEPARATOR

public static final char DEFAULT_SEPARATOR
See Also:
Constant Field Values

writer

protected edu.cuny.util.io.CSVWriter writer

inputFileName

protected java.lang.String inputFileName
the name of the payoff file; if existing, contains previous normalized payoffs


outputFileName

protected java.lang.String outputFileName
Constructor Detail

PayoffReport

public PayoffReport()
Method Detail

setup

public void setup(edu.cuny.config.param.ParameterDatabase parameters,
                  edu.cuny.config.param.Parameter base)
Specified by:
setup in interface edu.cuny.config.param.Parameterizable

generateHeader

protected void generateHeader()
TODO: writes the IDs of specialists and an initial even payoffs to the beginning of the payoff file.


setPayoffs

protected void setPayoffs(java.util.List<java.lang.Double> payoffList)
initialize the probabilities of participation based on payoffs of the previous game.

Parameters:
payoffList -

initPreviousPayoffs

protected boolean initPreviousPayoffs()
reads in the previous payoffs of specialists.

Returns:
true if successfully obtains payoffs of previous run; or false otherwise.

initWriter

protected void initWriter()

closeWriter

protected void closeWriter()

getAbsolutePayoff

protected double getAbsolutePayoff(java.lang.String specialistId)

writePayoffs

protected void writePayoffs()
writes normalized payoffs of the ending game to payoff file. When the payoffs are not available, actually uses 1 for all specialists.


initScoreReport

protected void initScoreReport()

initRandomGenerators

protected void initRandomGenerators()

applyPossblePenalties

protected void applyPossblePenalties()
apply probablistic day banning penalty to specialists that are supposed to have less presence in the game.


eventOccurred

public void eventOccurred(AuctionEvent event)
Specified by:
eventOccurred in interface AuctionEventListener

produceUserOutput

public void produceUserOutput()
Specified by:
produceUserOutput in interface edu.cuny.stat.Report<AuctionEvent>

getVariables

public java.util.Map<edu.cuny.stat.ReportVariable,?> getVariables()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object