|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.ac.liv.auction.agent.AbstractTradingAgent
An abstract class representing a simple agent trading in a round-robin auction. Traders of this type deal in a single commodity for which they have a well-defined valuation.
Parameters
| base.isseller boolean |
(is this agent a seller) |
| base.strategy class |
(the trading strategy to use) |
| base.initialstock int >= 0 |
(the initial quantity of the commoditiy possessed by this agent) |
| base.initialfunds double |
(the initial funds) |
| base.valuer class, inherits uk.ac.liv.auction.agent.Valuer |
(the valuation policy to use) |
| base.group int >= 0 |
(the group that this agent belongs to) |
RoundRobinAuction,
Serialized Form| Field Summary | |
protected Shout |
currentShout
The current shout for this trader. |
protected double |
funds
The amount of money this agent posseses. |
protected AgentGroup |
group
The arbitrary grouping that this agent belongs to. |
protected long |
id
Unique id for this trader. |
protected double |
initialFunds
The initial amount of money for this agent |
protected int |
initialStock
The initial stock of this agent |
protected boolean |
isSeller
Flag indicating whether this trader is a seller or buyer. |
protected double |
lastProfit
The profit made in the last round. |
protected boolean |
lastShoutAccepted
Did the last shout we place in the auction result in a transaction? |
static java.lang.String |
P_DEFAULT_STRATEGY
|
static java.lang.String |
P_GROUP
|
static java.lang.String |
P_INITIAL_FUNDS
|
static java.lang.String |
P_INITIAL_STOCK
|
static java.lang.String |
P_IS_SELLER
Parameter names used when initialising from parameter db |
static java.lang.String |
P_STRATEGY
|
static java.lang.String |
P_VALUER
|
protected double |
profits
The total profits to date |
protected int |
stock
The number of items of stock this agent posseses. |
protected Strategy |
strategy
The bidding strategy for this trader. |
protected ValuationPolicy |
valuer
The valuer for this agent. |
| Constructor Summary | |
AbstractTradingAgent()
Construct a truthful buyer with no money and no funds. |
|
AbstractTradingAgent(int stock,
double funds)
|
|
AbstractTradingAgent(int stock,
double funds,
double privateValue,
boolean isSeller)
Construct a trader with given stock level and funds. |
|
AbstractTradingAgent(int stock,
double funds,
double privateValue,
boolean isSeller,
Strategy strategy)
|
|
| Method Summary | |
abstract boolean |
active()
Determine whether or not this trader is active. |
void |
auctionClosed(AuctionEvent event)
|
void |
auctionOpen(AuctionEvent event)
|
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)
|
abstract 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. |
void |
eventOccurred(AuctionEvent event)
|
Shout |
getCurrentShout()
|
double |
getFunds()
|
AgentGroup |
getGroup()
|
long |
getId()
|
double |
getLastProfit()
Return the profit made in the most recent auction round. |
double |
getProfits()
|
int |
getStock()
|
Strategy |
getStrategy()
|
double |
getValuation(Auction auction)
|
ValuationPolicy |
getValuationPolicy()
|
void |
giveFunds(AbstractTradingAgent seller,
double amount)
|
void |
informOfBuyer(Auction auction,
TradingAgent buyer,
double price,
int quantity)
This method is used by a buyer to notify a seller that one of its bids has been successful. |
void |
informOfSeller(Auction auction,
Shout winningShout,
TradingAgent seller,
double price,
int quantity)
This method is used by an auction to notify a buyer that one of its bids has been successful. |
protected void |
initialise()
|
boolean |
isBuyer()
|
boolean |
isSeller()
|
boolean |
lastShoutAccepted()
|
void |
pay(double amount)
This method is invoked by a buyer on a seller when it wishes to transfer funds. |
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 |
reset()
Reinitialise our state to the original settings. |
void |
roundClosed(AuctionEvent event)
|
void |
setGroup(AgentGroup group)
|
void |
setIsSeller(boolean isSeller)
|
void |
setPrivateValue(double privateValue)
|
void |
setStrategy(Strategy strategy)
|
void |
setup(ec.util.ParameterDatabase parameters,
ec.util.Parameter base)
Initialise this object from a parameter database. |
void |
setValuationPolicy(ValuationPolicy valuer)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected int stock
protected int initialStock
protected double funds
protected double initialFunds
protected ValuationPolicy valuer
protected long id
protected boolean isSeller
protected Strategy strategy
protected double lastProfit
protected double profits
protected boolean lastShoutAccepted
protected Shout currentShout
protected AgentGroup group
public static final java.lang.String P_IS_SELLER
public static final java.lang.String P_STRATEGY
public static final java.lang.String P_INITIAL_STOCK
public static final java.lang.String P_INITIAL_FUNDS
public static final java.lang.String P_VALUER
public static final java.lang.String P_GROUP
public static final java.lang.String P_DEFAULT_STRATEGY
| Constructor Detail |
public AbstractTradingAgent(int stock,
double funds,
double privateValue,
boolean isSeller)
stock - The quantity of stock for this trader.funds - The amount of money for this trader.privateValue - The private value of the commodity traded by this trader.isSeller - Whether or not this trader is a seller.
public AbstractTradingAgent(int stock,
double funds,
double privateValue,
boolean isSeller,
Strategy strategy)
public AbstractTradingAgent(int stock,
double funds)
public AbstractTradingAgent()
| Method Detail |
public void setup(ec.util.ParameterDatabase parameters,
ec.util.Parameter base)
Parameterizable
setup in interface Parameterizablepublic void requestShout(Auction auction)
requestShout in interface TradingAgentauction - The auction in which to tradepublic void eventOccurred(AuctionEvent event)
eventOccurred in interface AuctionEventListenerpublic void roundClosed(AuctionEvent event)
public void endOfDay(AuctionEvent event)
public void auctionOpen(AuctionEvent event)
public void auctionClosed(AuctionEvent event)
public Shout getCurrentShout()
public void purchaseFrom(Auction auction,
AbstractTradingAgent seller,
int quantity,
double price)
public void giveFunds(AbstractTradingAgent seller,
double amount)
public void pay(double amount)
amount - The total amount of money to give to the seller
public int deliver(Auction auction,
int quantity,
double price)
quantity - The number of items of stock to transferpublic long getId()
public double getFunds()
public int getStock()
protected void initialise()
public void reset()
Resetable
reset in interface Resetablepublic double getValuation(Auction auction)
public void setPrivateValue(double privateValue)
public boolean isSeller()
isSeller in interface TradingAgentpublic boolean isBuyer()
isBuyer in interface TradingAgentpublic void setStrategy(Strategy strategy)
public void setIsSeller(boolean isSeller)
public Strategy getStrategy()
public double getLastProfit()
public double getProfits()
public int determineQuantity(Auction auction)
public java.lang.Object protoClone()
protoClone in interface Prototypeable
public void informOfSeller(Auction auction,
Shout winningShout,
TradingAgent seller,
double price,
int quantity)
TradingAgent
informOfSeller in interface TradingAgentseller - The seller whose ask has been matchedprice - The price of the goods as determined by the auction
public void informOfBuyer(Auction auction,
TradingAgent buyer,
double price,
int quantity)
TradingAgent
informOfBuyer in interface TradingAgentpublic boolean lastShoutAccepted()
public ValuationPolicy getValuationPolicy()
public void setValuationPolicy(ValuationPolicy valuer)
public AgentGroup getGroup()
public void setGroup(AgentGroup group)
public abstract double equilibriumProfits(Auction auction,
double equilibriumPrice,
int quantity)
public abstract boolean active()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||