edu.cuny.cat.market.accepting
Class HistoryBasedAcceptingPolicy
java.lang.Object
edu.cuny.cat.market.AuctioneerPolicy
edu.cuny.cat.market.accepting.ShoutAcceptingPolicy
edu.cuny.cat.market.accepting.OnlyNewShoutDecidingAcceptingPolicy
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
- Version:
- $Revision: 1.6 $
- Author:
- Jinzhong Niu
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
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
HistoryBasedAcceptingPolicy
public HistoryBasedAcceptingPolicy()
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