edu.cuny.cat.market.accepting
Class HistoryBasedAcceptingPolicy

java.lang.Object
  extended by edu.cuny.cat.market.AuctioneerPolicy
      extended by edu.cuny.cat.market.accepting.ShoutAcceptingPolicy
          extended by edu.cuny.cat.market.accepting.OnlyNewShoutDecidingAcceptingPolicy
              extended by edu.cuny.cat.market.accepting.HistoryBasedAcceptingPolicy
All Implemented Interfaces:
AuctionEventListener, edu.cuny.config.param.Parameterizable, edu.cuny.obj.Resetable

public class HistoryBasedAcceptingPolicy
extends OnlyNewShoutDecidingAcceptingPolicy

This accepting policy calculates the probability of a shout to be matched as GDStrategy does based on HistoricalReport, and compares it against a specified threshold. If the probability is higher than the threshold, the shout will be accepted; otherwise rejected.

Parameters

base .threshold
0 <=double <=1 (0.5 by default)
(the threshold probability to accept a shout)
base .history
(the parameter base for HistoricalReport used by this policy)

Default Base

history_based_accepting

Version:
$Revision: 1.6 $
Author:
Jinzhong Niu

Field Summary
static double DEFAULT_THRESHOLD
           
static java.lang.String P_DEF_BASE
           
static java.lang.String P_HISTORY
           
static java.lang.String P_THRESHOLD
           
protected  HistoricalReport report
           
protected  double threshold
           
 
Fields inherited from class edu.cuny.cat.market.AuctioneerPolicy
auctioneer
 
Constructor Summary
HistoryBasedAcceptingPolicy()
           
 
Method Summary
protected  double calculateProbability(Shout shout)
           
 void check(Shout shout)
          accepts only those shouts that will be matched with a probability higher than threshold.
 void eventOccurred(AuctionEvent event)
           
 void reset()
          TODO: currently historicalreport resets itself on game starting, which should be changed to comply with the principle followed elsewhere.
 void setup(edu.cuny.config.param.ParameterDatabase parameters, edu.cuny.config.param.Parameter base)
           
 java.lang.String toString()
           
 
Methods inherited from class edu.cuny.cat.market.accepting.OnlyNewShoutDecidingAcceptingPolicy
check
 
Methods inherited from class edu.cuny.cat.market.AuctioneerPolicy
getAuctioneer, initialize, setAuctioneer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

P_DEF_BASE

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

P_HISTORY

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

P_THRESHOLD

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

DEFAULT_THRESHOLD

public static final double DEFAULT_THRESHOLD
See Also:
Constant Field Values

threshold

protected double threshold

report

protected HistoricalReport report
Constructor Detail

HistoryBasedAcceptingPolicy

public HistoryBasedAcceptingPolicy()
Method Detail

setup

public void setup(edu.cuny.config.param.ParameterDatabase parameters,
                  edu.cuny.config.param.Parameter base)
Specified by:
setup in interface edu.cuny.config.param.Parameterizable
Overrides:
setup in class AuctioneerPolicy

reset

public void reset()
TODO: currently historicalreport resets itself on game starting, which should be changed to comply with the principle followed elsewhere. It does not seem to hurt if historicalreport is reset here one more time.

Specified by:
reset in interface edu.cuny.obj.Resetable
Overrides:
reset in class AuctioneerPolicy

check

public void check(Shout shout)
           throws IllegalShoutException
accepts only those shouts that will be matched with a probability higher than threshold.

Specified by:
check in class OnlyNewShoutDecidingAcceptingPolicy
Parameters:
shout - the shout being checked.
Throws:
IllegalShoutException
See Also:
OnlyNewShoutDecidingAcceptingPolicy.check(edu.cuny.cat.core.Shout)

calculateProbability

protected double calculateProbability(Shout shout)

eventOccurred

public void eventOccurred(AuctionEvent event)
Specified by:
eventOccurred in interface AuctionEventListener
Overrides:
eventOccurred in class AuctioneerPolicy

toString

public java.lang.String toString()
Overrides:
toString in class AuctioneerPolicy