GridSim
v4.0

gridsim.auction
Class DoubleAuction

Object
  extended byThread
      extended byeduni.simjava.Sim_entity
          extended bygridsim.GridSimCore
              extended bygridsim.GridSim
                  extended bygridsim.auction.Auction
                      extended bygridsim.auction.DoubleAuction
All Implemented Interfaces:
Cloneable, Runnable
Direct Known Subclasses:
ContinuousDoubleAuction

public abstract class DoubleAuction
extends Auction

This class represents a double auction. Double auction are two-sided auctions in which both buyers and sellers can submit bids and asks respectivelly

Since:
GridSim Toolkit 4.0
Author:
Marcos Dias de Assuncao
See Also:
Auction, AuctionTags

Field Summary
 
Fields inherited from class gridsim.auction.Auction
outputPort
 
Fields inherited from class gridsim.GridSim
PAUSE, rand, SimulationStartDate
 
Fields inherited from class gridsim.GridSimCore
input, output
 
Fields inherited from class eduni.simjava.Sim_entity
 
Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DoubleAuction(String auctionName, int auctionProtocol, double durationOfAuction)
          Default constructor
DoubleAuction(String auctionName, int auctioneerID, int auctionProtocol, double durationOfAuction, Sim_port output)
          Default constructor
 
Method Summary
protected  void closeAuction()
          This method sets the auction as closed
protected  double getDurationOfAuction()
          Returns the duration of the auction
protected  void match(MessageAsk ask, MessageBid bid, double price)
          Invoked by the subclasses when a match of an ask and a bid is found.
abstract  void onReceiveAsk(MessageAsk ask)
          Called when a ask is sent by a provider.
abstract  void onReceiveBid(MessageBid bid)
          Called when a bid is received.
abstract  void onStart()
          Called when the auction is started
abstract  void onStop()
          Called when the auction finishes
protected  void processEvent(Sim_event ev)
          Processes events or services that are available for this Auctioneer
protected  void processOtherEvent(Sim_event ev)
          Overrides this method when making a new and different policy.
 void startAuction()
          This method is called to start the auction and initialize the necessary paramenters
 
Methods inherited from class gridsim.auction.Auction
body, broadcastMessage, getAttribute, getAttributes, getAuctioneerID, getAuctionID, getAuctionProtocol, getBidders, getOutputPort, getStartingTime, setAttribute, setAuctioneerID, setAuctionProtocol, setBidders, setOutputPort, setStartingTime
 
Methods inherited from class gridsim.GridSim
clock, Clock, getAdvancedReservationList, getEntityId, GetEntityId, getEntityName, GetEntityName, getEntityName, GetEntityName, getEntityName, getGISId, getGridInfoServiceEntityId, getGridResourceList, GetGridResourceList, getGridSimShutdownEntityId, getGridStatisticsEntityId, getNumFreePE, getNumFreePE, getNumPE, getNumPE, getResourceCharacteristics, GetResourceCharacteristics, getResourceDynamicInfo, GetResourceDynamicInformation, getSimulationCalendar, getSimulationStartDate, GetSimulationStartDate, GridInformationServiceEntityId, gridletCancel, gridletCancel, gridletMove, gridletMove, gridletPause, gridletPause, gridletReceive, GridletReceive, gridletReceive, gridletReceive, gridletResume, gridletResume, gridletStatus, gridletStatus, gridletSubmit, GridletSubmit, gridletSubmit, gridletSubmit, gridSimHold, GridSimHold, GridSimShutdownEntityId, GridStatisticsEntityId, init, init, init, Init, isResourceExist, isResourceExist, receiveEventObject, ReceiveEventObject, receiveEventObject, ReceiveEventObject, recordStatistics, RecordStatistics, recordStatistics, RecordStatistics, recordStatistics, RecordStatistics, recordStatistics, RecordStatistics, resourceSupportAR, resourceSupportAR, setGIS, shutdownGridStatisticsEntity, ShutdownGridStatisticsEntity, shutdownUserEntity, ShutdownUserEntity, Start, startGridSimulation, Stop, stopGridSimulation
 
Methods inherited from class gridsim.GridSimCore
finalize, finalizeGridSimulation, getLink, getPingResult, isNetworked, IsNetworked, ping, ping, ping, ping, pingBlockingCall, pingBlockingCall, pingBlockingCall, pingBlockingCall, send, Send, send, Send, send, Send, send, Send, send, Send, send, Send, setBackgroundTraffic, setBackgroundTraffic, TerminateInputOutputEntities, terminateIOEntities
 
Methods inherited from class eduni.simjava.Sim_entity
add_generator, add_param, add_port, clone, get_id, get_name, get_port, get_port, get_stat, run, send_on, set_invisible, set_stat, sim_cancel, sim_completed, sim_current, sim_get_next, sim_get_next, sim_hold_for, sim_hold, sim_pause_for, sim_pause_for, sim_pause_until, sim_pause_until, sim_pause, sim_process_for, sim_process_for, sim_process_until, sim_process_until, sim_process, sim_putback, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_select, sim_trace, sim_wait_for, sim_wait_for, sim_wait_for, sim_wait, sim_waiting, sim_waiting
 
Methods inherited from class Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DoubleAuction

public DoubleAuction(String auctionName,
                     int auctioneerID,
                     int auctionProtocol,
                     double durationOfAuction,
                     Sim_port output)
              throws Exception
Default constructor

Parameters:
auctionName - A name for the auction
auctioneerID - the ID of the auctioneer
auctionProtocol - the auction protocol
durationOfAuction - duration of the auction in simulation time
output - the port to be used as output of messages
Throws:
Exception

DoubleAuction

public DoubleAuction(String auctionName,
                     int auctionProtocol,
                     double durationOfAuction)
              throws Exception
Default constructor

Parameters:
auctionName - A name for the auction
auctionProtocol - the auction protocol
durationOfAuction - duration of the auction in simulation time
Throws:
Exception
Method Detail

getDurationOfAuction

protected double getDurationOfAuction()
Returns the duration of the auction

Returns:
the duration in simulation time of the auction

match

protected void match(MessageAsk ask,
                     MessageBid bid,
                     double price)
Invoked by the subclasses when a match of an ask and a bid is found. This method triggers an event to the auctioneer, who knows that a match was done.

Parameters:
ask - the ask that was matched
bid - the bid that was matched
price - the trade price

startAuction

public void startAuction()
This method is called to start the auction and initialize the necessary paramenters

Specified by:
startAuction in class Auction

closeAuction

protected void closeAuction()
This method sets the auction as closed


processEvent

protected void processEvent(Sim_event ev)
Processes events or services that are available for this Auctioneer

Specified by:
processEvent in class Auction
Parameters:
ev - a Sim_event object
Pre Condition:
ev != null
Post Condition:
$none

processOtherEvent

protected void processOtherEvent(Sim_event ev)
Overrides this method when making a new and different policy. This method is called by Auction.body() for incoming unknown tags.

Parameters:
ev - a Sim_event object
Pre Condition:
ev != null
Post Condition:
$none

onStart

public abstract void onStart()
Called when the auction is started


onStop

public abstract void onStop()
Called when the auction finishes


onReceiveAsk

public abstract void onReceiveAsk(MessageAsk ask)
Called when a ask is sent by a provider.

Parameters:
ask - the ask sent by the provider

onReceiveBid

public abstract void onReceiveBid(MessageBid bid)
Called when a bid is received.

Parameters:
bid - the bid received by the auctioneer

GridSim
v4.0

The University of Melbourne, Australia, 2006