uk.ac.liv.auction.zi
Class ZITraderAgent

java.lang.Object
  extended byuk.ac.liv.auction.agent.AbstractTradingAgent
      extended byuk.ac.liv.auction.zi.ZITraderAgent
All Implemented Interfaces:
AuctionEventListener, java.lang.Cloneable, Parameterizable, Prototypeable, Resetable, java.io.Serializable, TradingAgent

public class ZITraderAgent
extends AbstractTradingAgent
implements java.io.Serializable

Class for "Zero Intelligence" (ZI) trader agents. Agents of this type have a finite trade entitlement, which determines how many units they are able to trade in a given trading period. ZITraderAgents become inactive once their intitial trade entitlement is used up, and their trade entitlement is restored at the end of each day.

See:

"Minimal Intelligence Agents for Bargaining Behaviours in Market-based Environments" Dave Cliff 1997.

and "An experimental study of competitive market behaviour", Smith, V.L. 1962 in The Journal of Political Economy, vol 70.

Parameters

base.initialtradeentitlement
int >= 0
(the number of units of commodity that this agent is allowed to trade)

Version:
$Revision: 1.22 $
Author:
Steve Phelps
See Also:
Serialized Form

Field Summary
protected  int initialTradeEntitlement
          The initial value of tradeEntitlement
protected  boolean isActive
           
protected  boolean lastShoutSuccessful
          Flag indicating whether the last shout resulted in a transaction.
static java.lang.String P_ACTIVATION_PROBABILITY
           
static java.lang.String P_INITIAL_TRADE_ENTITLEMENT
           
protected  int quantityTraded
          The number of units traded to date
protected  int tradeEntitlement
          The number of units this agent is entitlted to trade in this trading period.
 
Fields inherited from class uk.ac.liv.auction.agent.AbstractTradingAgent
currentShout, funds, group, id, initialFunds, initialStock, isSeller, lastProfit, lastShoutAccepted, P_DEFAULT_STRATEGY, P_GROUP, P_INITIAL_FUNDS, P_INITIAL_STOCK, P_IS_SELLER, P_STRATEGY, P_VALUER, profits, stock, strategy, valuer
 
Constructor Summary
ZITraderAgent()
           
ZITraderAgent(double privateValue, int tradeEntitlement, boolean isSeller)
           
ZITraderAgent(int stock, double funds, double privateValue, int tradeEntitlement, boolean isSeller)
           
 
Method Summary
 boolean active()
          Determine whether or not this trader is active.
 int deliver(Auction auction, int quantity, double price)
          This method is invoked by a seller on a buyer when it is transfering stock
 int determineQuantity(Auction auction)
           
 void endOfDay(AuctionEvent event)
           
 double equilibriumProfits(Auction auction, double equilibriumPrice, int quantity)
          Calculate the hypothetical surplus this agent will receive if the market had cleared uniformly at the specified equilibrium price and quantity.
 int getInitialTradeEntitlement()
           
 int getQuantityTraded()
           
 int getTradeEntitlement()
           
 void informOfSeller(Auction auction, Shout winningShout, TradingAgent seller, double price, int quantity)
          Default behaviour for winning ZI bidders is to purchase unconditionally.
protected  void initialise()
           
 java.lang.Object protoClone()
           
 void purchaseFrom(Auction auction, AbstractTradingAgent seller, int quantity, double price)
           
 void requestShout(Auction auction)
          Place a shout in the auction as determined by our currently configured strategy.
 void sellUnits(Auction auction, int numUnits)
           
 void setInitialTradeEntitlement(int initialTradeEntitlement)
           
 void setTradeEntitlement(int tradeEntitlement)
           
 void setup(ec.util.ParameterDatabase parameters, ec.util.Parameter base)
          Initialise this object from a parameter database.
 java.lang.String toString()
           
 
Methods inherited from class uk.ac.liv.auction.agent.AbstractTradingAgent
auctionClosed, auctionOpen, eventOccurred, getCurrentShout, getFunds, getGroup, getId, getLastProfit, getProfits, getStock, getStrategy, getValuation, getValuationPolicy, giveFunds, informOfBuyer, isBuyer, isSeller, lastShoutAccepted, pay, reset, roundClosed, setGroup, setIsSeller, setPrivateValue, setStrategy, setValuationPolicy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tradeEntitlement

protected int tradeEntitlement
The number of units this agent is entitlted to trade in this trading period.


initialTradeEntitlement

protected int initialTradeEntitlement
The initial value of tradeEntitlement


lastShoutSuccessful

protected boolean lastShoutSuccessful
Flag indicating whether the last shout resulted in a transaction.


quantityTraded

protected int quantityTraded
The number of units traded to date


isActive

protected boolean isActive

P_INITIAL_TRADE_ENTITLEMENT

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

P_ACTIVATION_PROBABILITY

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

ZITraderAgent

public ZITraderAgent()

ZITraderAgent

public ZITraderAgent(int stock,
                     double funds,
                     double privateValue,
                     int tradeEntitlement,
                     boolean isSeller)

ZITraderAgent

public ZITraderAgent(double privateValue,
                     int tradeEntitlement,
                     boolean isSeller)
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
Overrides:
setup in class AbstractTradingAgent

protoClone

public java.lang.Object protoClone()
Specified by:
protoClone in interface Prototypeable
Overrides:
protoClone in class AbstractTradingAgent

requestShout

public void requestShout(Auction auction)
Description copied from class: AbstractTradingAgent
Place a shout in the auction as determined by our currently configured strategy.

Specified by:
requestShout in interface TradingAgent
Overrides:
requestShout in class AbstractTradingAgent

initialise

protected void initialise()
Overrides:
initialise in class AbstractTradingAgent

endOfDay

public void endOfDay(AuctionEvent event)
Overrides:
endOfDay in class AbstractTradingAgent

active

public boolean active()
Description copied from class: AbstractTradingAgent
Determine whether or not this trader is active. Inactive traders do not place shouts in the auction, but do carry on learning through their strategy.

Specified by:
active in class AbstractTradingAgent
Returns:
true if the trader is active.

informOfSeller

public void informOfSeller(Auction auction,
                           Shout winningShout,
                           TradingAgent seller,
                           double price,
                           int quantity)
Default behaviour for winning ZI bidders is to purchase unconditionally.

Specified by:
informOfSeller in interface TradingAgent
Overrides:
informOfSeller in class AbstractTradingAgent

purchaseFrom

public void purchaseFrom(Auction auction,
                         AbstractTradingAgent seller,
                         int quantity,
                         double price)
Overrides:
purchaseFrom in class AbstractTradingAgent

deliver

public int deliver(Auction auction,
                   int quantity,
                   double price)
Description copied from class: AbstractTradingAgent
This method is invoked by a seller on a buyer when it is transfering stock

Overrides:
deliver in class AbstractTradingAgent
Parameters:
quantity - The number of items of stock to transfer

equilibriumProfits

public double equilibriumProfits(Auction auction,
                                 double equilibriumPrice,
                                 int quantity)
Description copied from class: AbstractTradingAgent
Calculate the hypothetical surplus this agent will receive if the market had cleared uniformly at the specified equilibrium price and quantity.

Specified by:
equilibriumProfits in class AbstractTradingAgent

sellUnits

public void sellUnits(Auction auction,
                      int numUnits)

getQuantityTraded

public int getQuantityTraded()

determineQuantity

public int determineQuantity(Auction auction)
Overrides:
determineQuantity in class AbstractTradingAgent

getTradeEntitlement

public int getTradeEntitlement()

setTradeEntitlement

public void setTradeEntitlement(int tradeEntitlement)

getInitialTradeEntitlement

public int getInitialTradeEntitlement()

setInitialTradeEntitlement

public void setInitialTradeEntitlement(int initialTradeEntitlement)

toString

public java.lang.String toString()