uk.ac.liv.auction.stats
Class DynamicSurplusReport

java.lang.Object
  extended byuk.ac.liv.auction.stats.AbstractAuctionReport
      extended byuk.ac.liv.auction.stats.AbstractMarketStatsReport
          extended byuk.ac.liv.auction.stats.DynamicSurplusReport
All Implemented Interfaces:
AuctionEventListener, AuctionReport, Parameterizable, Resetable
Direct Known Subclasses:
PayoffReport

public class DynamicSurplusReport
extends AbstractMarketStatsReport
implements Resetable

A report that keeps track of the surplus available to each agent in theoretical equilibrium. The equilibrium price is recomputed at the end of each day, thus this class can be used to keep track of theoretically available surplus even when supply and demand are changing over time. Each agent is assumed to be hypothetically able to trade the specified quantity of units in each day.

Version:
$Revision: 1.4 $
Author:
Steve Phelps

Field Summary
protected  EquilibriumReport equilibriaStats
           
static java.lang.String P_QUANTITY
           
protected  int quantity
          The quantity that each agent can theoretically trade per day.
 
Fields inherited from class uk.ac.liv.auction.stats.AbstractAuctionReport
auction
 
Constructor Summary
DynamicSurplusReport()
           
 
Method Summary
 void calculate()
           
 double calculateTotalEquilibriumSurplus()
           
protected  double equilibriumSurplus(AbstractTradingAgent agent, double ep, int quantity)
           
 void eventOccurred(AuctionEvent event)
           
 double getEquilibriumProfits(AbstractTradingAgent agent)
           
 int getQuantity()
           
 java.util.Map getVariables()
          Returns a Map of all of the variables that are produced in the report.
 void initialise()
           
 void produceUserOutput()
          Produce the final report for the user.
 void recalculate(AuctionEvent event)
           
 void reset()
          Reinitialise our state to the original settings.
 void setAuction(RoundRobinAuction auction)
          Specify the auction to be used when generating the report.
 void setQuantity(int quantity)
           
 void setup(ec.util.ParameterDatabase parameters, ec.util.Parameter base)
          Initialise this object from a parameter database.
protected  void updateStats(AbstractTradingAgent agent, double lastSurplus)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

equilibriaStats

protected EquilibriumReport equilibriaStats

quantity

protected int quantity
The quantity that each agent can theoretically trade per day. This should normally be set equal to agents' trade entitlement.


P_QUANTITY

public static final java.lang.String P_QUANTITY
See Also:
Constant Field Values
Constructor Detail

DynamicSurplusReport

public DynamicSurplusReport()
Method Detail

setup

public void setup(ec.util.ParameterDatabase parameters,
                  ec.util.Parameter base)
Description copied from interface: Parameterizable
Initialise this object from a parameter database.

Specified by:
setup in interface Parameterizable

setAuction

public void setAuction(RoundRobinAuction auction)
Description copied from interface: AuctionReport
Specify the auction to be used when generating the report.

Specified by:
setAuction in interface AuctionReport
Overrides:
setAuction in class AbstractAuctionReport

eventOccurred

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

calculate

public void calculate()
Specified by:
calculate in class AbstractMarketStatsReport

recalculate

public void recalculate(AuctionEvent event)

getEquilibriumProfits

public double getEquilibriumProfits(AbstractTradingAgent agent)

calculateTotalEquilibriumSurplus

public double calculateTotalEquilibriumSurplus()

updateStats

protected void updateStats(AbstractTradingAgent agent,
                           double lastSurplus)

equilibriumSurplus

protected double equilibriumSurplus(AbstractTradingAgent agent,
                                    double ep,
                                    int quantity)

initialise

public void initialise()

reset

public void reset()
Description copied from interface: Resetable
Reinitialise our state to the original settings.

Specified by:
reset in interface Resetable

produceUserOutput

public void produceUserOutput()
Description copied from interface: AuctionReport
Produce the final report for the user. Implementors can do whatever they see fit, for example by writing a report on stdout, or they may choose to do nothing.

Specified by:
produceUserOutput in interface AuctionReport

getVariables

public java.util.Map getVariables()
Description copied from interface: AuctionReport
Returns a Map of all of the variables that are produced in the report. The Map maps variables, represented by objects of type ReportVariable, onto values, which may be of any class. If no variables are produced by this report then an empty Map is returned.

Specified by:
getVariables in interface AuctionReport
See Also:
ReportVariable

getQuantity

public int getQuantity()

setQuantity

public void setQuantity(int quantity)