GridSim 5.0 beta

gridsim.auction
Class DoubleAuction

Object
  extended by Thread
      extended by Sim_entity
          extended by GridSimCore
              extended by GridSim
                  extended by Auction
                      extended by 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

Nested Class Summary
 
Nested classes/interfaces inherited from class Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class Auction
outputPort
 
Fields inherited from class GridSim
GRIDSIM_VERSION_STRING, PAUSE
 
Fields inherited from class GridSimCore
input, NETWORK_TYPE, output
 
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 Auction
body, broadcastMessage, getAttribute, getAttributes, getAuctioneerID, getAuctionID, getAuctionProtocol, getBidders, getOutputPort, getStartingTime, setAttribute, setAuctioneerID, setAuctionID, setAuctionProtocol, setBidders, setOutputPort, setStartingTime
 
Methods inherited from class GridSim
clock, disableDebugMode, enableDebugMode, getAdvancedReservationList, getEntityId, getEntityName, getEntityName, getEntityName, getGISId, getGridInfoServiceEntityId, getGridResourceList, getGridSimShutdownEntityId, getGridStatisticsEntityId, getNetworkType, getNumFreePE, getNumFreePE, getNumPE, getNumPE, getResourceCharacteristics, getResourceDynamicInfo, getSimulationCalendar, getSimulationStartDate, getVisualizer, gridletCancel, gridletCancel, gridletMove, gridletMove, gridletPause, gridletPause, gridletReceive, gridletReceive, gridletReceive, gridletResume, gridletResume, gridletStatus, gridletStatus, gridletSubmit, gridletSubmit, gridletSubmit, gridSimHold, init, init, init, initNetworkType, isDebugModeEnabled, isResourceExist, isResourceExist, isTraceEnabled, pauseSimulation, pauseSimulation, receiveEventObject, receiveEventObject, recordStatistics, recordStatistics, recordStatistics, recordStatistics, resourceSupportAR, resourceSupportAR, resumeSimulation, setGIS, shutdownGridStatisticsEntity, shutdownUserEntity, startGridSimulation, startGridSimulation, stopGridSimulation
 
Methods inherited from class GridSimCore
finalizeGridSimulation, getLink, getPingResult, isNetworked, ping, ping, ping, ping, pingBlockingCall, pingBlockingCall, pingBlockingCall, pingBlockingCall, send, send, send, send, send, send, setBackgroundTraffic, setBackgroundTraffic, terminateIOEntities
 
Methods inherited from class 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, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class Object
equals, finalize, 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 5.0 beta

The University of Melbourne, Australia, 2009