GridSim 5.0 beta

gridsim.auction
Class OneSidedAuction

Object
  extended by Thread
      extended by Sim_entity
          extended by GridSimCore
              extended by GridSim
                  extended by Auction
                      extended by OneSidedAuction
All Implemented Interfaces:
Cloneable, Runnable
Direct Known Subclasses:
DutchAuction, EnglishAuction, FirstPriceSealedBidAuction, ReverseDutchAuction, ReverseEnglishAuction, ReverseFirstPriceSealedBidAuction

public abstract class OneSidedAuction
extends Auction

This class represents an one-sided auction. One-sided auctions send announcements of a good to be sold and receive bids from bidders. It can have several rounds.

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
OneSidedAuction(String auctionName, int auctionProtocol, double durationOfRounds, int totalRound)
          Default constructor
OneSidedAuction(String auctionName, int auctioneerID, int auctionProtocol, double durationOfRounds, int totalRound, Sim_port output)
          Default constructor
 
Method Summary
protected  void closeAuction()
          This method sets the auction as closed
 int currentRound()
          Returns the current round of the auction
 double getCurrentPrice()
          Returns the current price of this auction
protected  double getDurationOfRounds()
          Returns the duration of a round
 double getFinalPrice()
          Returns the final price achieved by the auction
 double getMaxPrice()
          Returns the maximum price of the auction
 double getMinPrice()
          Returns the minimun price of the auction
 int getNumberOfRounds()
          Returns the number of rounds of the auction
 double getReservePrice()
          Returns the reserve price
 int getWinner()
          Returns the winner's ID
abstract  void onClose(int round)
          Called when a round finishes
abstract  void onReceiveBid(MessageBid bid)
          Called when a bid is received.
abstract  void onReceiveRejectCallForBid(MessageRejectCallForBid mrej)
          Called when a reject bid is received.
abstract  void onStart(int round)
          Called when a round 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.
 boolean setCurrentPrice(double price)
          Sets the current price in the auction
 boolean setFinalPrice(double price)
          Sets the final price achieved in the auction
 boolean setMaxPrice(double price)
          Sets the maximum price for the auction
 boolean setMinPrice(double price)
          Sets the minimum price for the auction
 boolean setReservePrice(double price)
          Set the reserve price.
protected  boolean setWinner(int winnerID)
          Sets the winner ID
 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

OneSidedAuction

public OneSidedAuction(String auctionName,
                       int auctioneerID,
                       int auctionProtocol,
                       double durationOfRounds,
                       int totalRound,
                       Sim_port output)
                throws Exception
Default constructor

Parameters:
auctionName - A name for the auction
auctioneerID - the ID of the auctioneer
auctionProtocol - the auction protocol
durationOfRounds - duration in simulation time of each round
totalRound - the number of rounds
output - the auctioneer's output port
Throws:
Exception

OneSidedAuction

public OneSidedAuction(String auctionName,
                       int auctionProtocol,
                       double durationOfRounds,
                       int totalRound)
                throws Exception
Default constructor

Parameters:
auctionName - A name for the auction
auctionProtocol - the auction protocol
durationOfRounds - duration in simulation time of each round
totalRound - the number of rounds
Throws:
Exception
Method Detail

setWinner

protected boolean setWinner(int winnerID)
Sets the winner ID

Parameters:
winnerID -
Returns:
true if the winner's id is properly set
Pre Condition:
winnerID == some GridSim entity's ID || winnerID == -1 if there's no winner

getWinner

public int getWinner()
Returns the winner's ID

Returns:
the GridSim id of the winner

getDurationOfRounds

protected double getDurationOfRounds()
Returns the duration of a round

Returns:
the simulation time of a round

setReservePrice

public boolean setReservePrice(double price)
Set the reserve price. The auctioneer may not sell the good for less than the value specified in reserve price

Parameters:
price -
Returns:
true if the price is properly set
Pre Condition:
price >= 0.0D

getReservePrice

public double getReservePrice()
Returns the reserve price

Returns:
the reserve price of this auction

setFinalPrice

public boolean setFinalPrice(double price)
Sets the final price achieved in the auction

Parameters:
price -
Returns:
true if the price is properly set
Pre Condition:
price >= 0.0D

getFinalPrice

public double getFinalPrice()
Returns the final price achieved by the auction

Returns:
the final price achieved

currentRound

public int currentRound()
Returns the current round of the auction

Returns:
the active round

getNumberOfRounds

public int getNumberOfRounds()
Returns the number of rounds of the auction

Returns:
the number of rounds

setCurrentPrice

public boolean setCurrentPrice(double price)
Sets the current price in the auction

Parameters:
price -
Returns:
true if the price is properly set
Pre Condition:
price >= 0.0D

getCurrentPrice

public double getCurrentPrice()
Returns the current price of this auction

Returns:
the current price

setMinPrice

public boolean setMinPrice(double price)
Sets the minimum price for the auction

Parameters:
price - the minimun price for the auction
Returns:
true if the price is properly set
Pre Condition:
price >= 0.0D

getMinPrice

public double getMinPrice()
Returns the minimun price of the auction

Returns:
the minimun price

setMaxPrice

public boolean setMaxPrice(double price)
Sets the maximum price for the auction

Parameters:
price - the maximum price for the auction
Returns:
true if the price is properly set
Pre Condition:
price >= 0.0D

getMaxPrice

public double getMaxPrice()
Returns the maximum price of the auction

Returns:
the maximum 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(int round)
Called when a round is started

Parameters:
round - the number of the round that has started

onClose

public abstract void onClose(int round)
Called when a round finishes

Parameters:
round - the round that has finished

onStop

public abstract void onStop()
Called when the auction finishes


onReceiveBid

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

Parameters:
bid - the bid received by the auctioneer

onReceiveRejectCallForBid

public abstract void onReceiveRejectCallForBid(MessageRejectCallForBid mrej)
Called when a reject bid is received.

Parameters:
mrej - the reject received by the auctioneer

GridSim 5.0 beta

The University of Melbourne, Australia, 2009