|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectde.upb.swtpra05.group03.shuttle.MarginController
Controls the margin and its selfadopting according to the success rate of the last offers.
| Field Summary | |
protected static float |
DEFAULT_MARGIN
default value |
protected static float |
DEFAULT_MARGIN_STEP_DOWN
default value |
protected static float |
DEFAULT_MARGIN_STEP_UP
default value |
protected static float |
DEFAULT_MAX_OFFER_SUCCESS_RATE
default value |
protected static float |
DEFAULT_MIN_MARGIN
default value |
protected static float |
DEFAULT_MIN_OFFER_SUCCESS_RATE
default value |
protected static int |
DEFAULT_OBSERVATION_RATE
default observation rate |
protected static boolean |
DEFAULT_SELF_ADOPTING
default value |
protected static float |
FIRST_ORDER_MARGIN
margin to get the first order |
protected boolean |
firstOrderMargin
always return FIRST_ORDER_MARGIN if we havn't any order before |
private static java.util.logging.Logger |
log
Logger for debugging |
protected float |
margin
current margin used to calculate an offer |
protected int |
marginStepCounter
counts relative how often the margin is in- decreased |
protected float |
marginStepDown
the step how much to decrease margin |
protected float |
marginStepUp
the step how much to increase margin |
protected float |
maxOfferSuccessRate
if offerSuccessRate is greater than this the margin will be increased |
protected float |
minMargin
minimal margin, used for selfAdopting of margin |
protected float |
minOfferSuccessRate
if offerSuccessRate is lower than this the margin will be decreased |
protected int |
observationRate
The Rate how many Offers are observed |
protected java.util.LinkedList |
offerList
This list contains the success of the last offers. |
protected float |
offerSuccessRate
the offerSuccessRate |
protected boolean |
selfAdopting
flag for self adopting of margin |
protected static de.upb.swtpra.kernel.id.OrderID |
WON_ID
The WON_ID is placed at the location where the orderID of an order was that is won |
| Constructor Summary | |
MarginController()
Constructor |
|
| Method Summary | |
protected void |
assignOrder(de.upb.swtpra.kernel.message.AssignOrder msg)
If an offer is successfull, this method is called and it replaces the entry in the Queue so that the offer is signed as successfull |
protected void |
checkSuccessRate()
Checks the SuccessRate and adpats the margin if necessary |
protected int |
countWonOffers()
counts how often a value is present in the queue |
float |
getMargin()
Gets the current margin to calculate an offer |
int |
getMarginStepCounter()
|
float |
getMinMargin()
|
void |
init(ModuleContainerInterface container)
Initializes this module. |
boolean |
isSelfAdopting()
|
protected void |
makeOffer(de.upb.swtpra.kernel.message.MakeOffer msg)
Reacts on MakeOffer messages to be send by the shuttle by
adjusting the offerList. |
float |
marginStep()
|
void |
newMessageReceived(de.upb.swtpra.kernel.message.Message msg)
React on the received message of the shuttle or not. |
void |
newMessageSent(de.upb.swtpra.kernel.message.Message msg)
React on the message sent by the shuttle or not. |
protected void |
newShuttleParams(ApplyNewShuttleParamsMessage paramsMsg)
updates MinMargin, MarginStep, Margin & selfAdopting if an ApplyNewShuttleParamsMessage is received |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final float DEFAULT_MARGIN
protected static final boolean DEFAULT_SELF_ADOPTING
protected static final float DEFAULT_MIN_MARGIN
protected static final float DEFAULT_MARGIN_STEP_UP
protected static final float DEFAULT_MARGIN_STEP_DOWN
protected static final float DEFAULT_MIN_OFFER_SUCCESS_RATE
protected static final float DEFAULT_MAX_OFFER_SUCCESS_RATE
protected static final int DEFAULT_OBSERVATION_RATE
protected static final float FIRST_ORDER_MARGIN
protected int marginStepCounter
private static final java.util.logging.Logger log
protected float margin
protected boolean selfAdopting
protected float minMargin
protected float marginStepUp
protected float marginStepDown
protected float offerSuccessRate
protected float minOfferSuccessRate
protected float maxOfferSuccessRate
protected int observationRate
protected java.util.LinkedList offerList
protected static final de.upb.swtpra.kernel.id.OrderID WON_ID
protected boolean firstOrderMargin
| Constructor Detail |
public MarginController()
| Method Detail |
public void init(ModuleContainerInterface container)
Module
init in interface Modulecontainer - The module manager which contain all modulespublic void newMessageReceived(de.upb.swtpra.kernel.message.Message msg)
ShuttleModule
newMessageReceived in interface ShuttleModulemsg - The received message of the shuttlepublic void newMessageSent(de.upb.swtpra.kernel.message.Message msg)
SentModule
newMessageSent in interface SentModulemsg - The message sent by the shuttleprotected void newShuttleParams(ApplyNewShuttleParamsMessage paramsMsg)
paramsMsg - ApplyNewShuttleParamsMessagepublic float getMargin()
MarginControllerInterface
getMargin in interface MarginControllerInterfaceprotected void makeOffer(de.upb.swtpra.kernel.message.MakeOffer msg)
MakeOffer messages to be send by the shuttle by
adjusting the offerList.
msg - The MakeOffer messageprotected void assignOrder(de.upb.swtpra.kernel.message.AssignOrder msg)
msg - msg that contains the id of the order that has been wonprotected void checkSuccessRate()
protected int countWonOffers()
public float getMinMargin()
public boolean isSelfAdopting()
public float marginStep()
public int getMarginStepCounter()
getMarginStepCounter in interface MarginControllerInterface
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||