net.sourceforge.jasa.report
Class DynamicSurplusReport

java.lang.Object
  extended by net.sourceforge.jasa.report.AbstractAuctionReport
      extended by net.sourceforge.jasa.report.AbstractMarketStatsReport
          extended by net.sourceforge.jasa.report.DynamicSurplusReport
All Implemented Interfaces:
java.io.Serializable, AuctionReport
Direct Known Subclasses:
PayoffReport

public class DynamicSurplusReport
extends AbstractMarketStatsReport

A historicalDataReport 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.

See Also:
Serialized Form
 

Field Summary
protected  double efficiency
           
protected  EquilibriumReportVariables equilibriaStats
          The historicalDataReport used to calculate the equilibrium price.
static java.lang.String P_DEF_BASE
           
static java.lang.String P_QUANTITY
           
protected  int quantity
          The quantity that each agent can theoretically trade per day.
static ReportVariable VAR_EFFICIENCY
           
 
Fields inherited from class net.sourceforge.jasa.report.AbstractAuctionReport
auction
 
Constructor Summary
DynamicSurplusReport()
           
 
Method Summary
 void calculate()
          Perform final calculations at the end of the market.
 double calculateTotalEquilibriumSurplus()
           
 double calculateTotalProfits()
           
 void compute(SimEvent event)
           
protected  double equilibriumSurplus(TokenTradingAgent agent, double ep, int quantity)
          Calculate the surplus available to the specified agent given the specified equilibrium price and quantity.
 double getEfficiency()
           
 double getEquilibriumProfits(AbstractTradingAgent agent)
           
 int getQuantity()
           
 java.util.Map<java.lang.Object,java.lang.Number> getVariableBindings()
           
 void initialise()
           
 void produceUserOutput()
           
 void reset()
           
 void setAuction(Market auction)
           
 void setQuantity(int quantity)
           
protected  void updateStats(AbstractTradingAgent agent, double lastSurplus)
          Increment the surplus available to the specified agent by the specified amount.
 
Methods inherited from class net.sourceforge.jasa.report.AbstractMarketStatsReport
eventOccurred
 
Methods inherited from class net.sourceforge.jasa.report.AbstractAuctionReport
getAuction, getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

equilibriaStats

protected EquilibriumReportVariables equilibriaStats
The historicalDataReport used to calculate the equilibrium price.


quantity

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


efficiency

protected double efficiency

P_DEF_BASE

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

P_QUANTITY

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

VAR_EFFICIENCY

public static final ReportVariable VAR_EFFICIENCY
Constructor Detail

DynamicSurplusReport

public DynamicSurplusReport()
Method Detail

setAuction

public void setAuction(Market auction)
Overrides:
setAuction in class AbstractAuctionReport

calculate

public void calculate()
Description copied from class: AbstractMarketStatsReport
Perform final calculations at the end of the market.

Specified by:
calculate in class AbstractMarketStatsReport

getEfficiency

public double getEfficiency()

compute

public void compute(SimEvent event)

getEquilibriumProfits

public double getEquilibriumProfits(AbstractTradingAgent agent)

calculateTotalEquilibriumSurplus

public double calculateTotalEquilibriumSurplus()

calculateTotalProfits

public double calculateTotalProfits()

updateStats

protected void updateStats(AbstractTradingAgent agent,
                           double lastSurplus)
Increment the surplus available to the specified agent by the specified amount.


equilibriumSurplus

protected double equilibriumSurplus(TokenTradingAgent agent,
                                    double ep,
                                    int quantity)
Calculate the surplus available to the specified agent given the specified equilibrium price and quantity.

Parameters:
agent - The agent to calculate theoretically available surplus to.
ep - The hypothetical equilibrium price
quantity - The hypothetical quantity that this agent is able to trade in any given day.

initialise

public void initialise()

reset

public void reset()

produceUserOutput

public void produceUserOutput()
Overrides:
produceUserOutput in class AbstractAuctionReport

getVariableBindings

public java.util.Map<java.lang.Object,java.lang.Number> getVariableBindings()
Overrides:
getVariableBindings in class AbstractAuctionReport

getQuantity

public int getQuantity()

setQuantity

public void setQuantity(int quantity)