jadex.bdi.planlib.protocols.dutchauction
Class DAInitiatorPlan

java.lang.Object
  extended by jadex.bdi.runtime.impl.AbstractPlan
      extended by jadex.bdi.runtime.Plan
          extended by jadex.bdi.planlib.protocols.AbstractInitiatorPlan
              extended by jadex.bdi.planlib.protocols.dutchauction.DAInitiatorPlan
All Implemented Interfaces:
ISuspendable, java.io.Serializable

public class DAInitiatorPlan
extends AbstractInitiatorPlan

This plan implements the initiator of the "FIPA Dutch Auction Interaction Protocol Specification" (XC00032 - Experimental) A dutch auction is one where the auctioneer starts with a high start price and continually lowers it until the first bidder accepts the price.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class jadex.bdi.runtime.Plan
Plan.SyncResultListener
 
Field Summary
protected  IMessageEvent start
          The initial message.
 
Fields inherited from class jadex.bdi.runtime.Plan
lis
 
Fields inherited from class jadex.bdi.runtime.impl.AbstractPlan
interpreter, planinit
 
Constructor Summary
DAInitiatorPlan()
           
 
Method Summary
protected  void announceAuction(java.lang.Object auctiondesc, java.util.List receivers, java.lang.String convid)
          Announce the planned auction.
protected  void announceAuctionEnd(java.util.List receivers, java.lang.String convid, java.lang.Object winning_offer, IComponentIdentifier winner)
          Announce the end of the auction to all participants that did not leave the auction.
 void body()
          The plan body.
protected  java.lang.Object[] decideIteration(java.lang.Object cfp_info, java.lang.Object[] history)
          Decide about the next iteration.
protected  void evaluateAuctionResults(AuctionDescription auctiondesc, java.lang.Object cfp_info, java.lang.Object[] history, IComponentIdentifier winner, java.lang.Object winning_offer)
          Evaluate the auction results and decide about participation.
protected  IMessageEvent getInitialMessage()
          Get the initial message.
protected  void sendCFP(java.lang.Object cfp, java.lang.String convid, java.util.List receivers)
          Send cfps to all receivers.
protected  void waitForAuctionStart(AuctionDescription auctiondesc, java.util.List receivers)
          Wait for the auction start time.
protected  IComponentIdentifier waitForProposals(java.lang.Object cfp, long roundtimeout, java.util.List receivers)
          Wait for proposals of participants.
 
Methods inherited from class jadex.bdi.planlib.protocols.AbstractInitiatorPlan
aborted, getTimeout
 
Methods inherited from class jadex.bdi.runtime.Plan
createWaitAbstraction, dispatchSubgoalAndWait, dispatchSubgoalAndWait, failed, getMonitor, isEventRegisteredInWaitqueue, passed, resume, sendMessageAndWait, sendMessageAndWait, suspend, waitFor, waitForCondition, waitForCondition, waitForEver, waitForExternalCondition, waitForExternalCondition, waitForFactAdded, waitForFactAdded, waitForFactAddedOrRemoved, waitForFactAddedOrRemoved, waitForFactChanged, waitForFactChanged, waitForFactRemoved, waitForFactRemoved, waitForGoal, waitForGoal, waitForGoal, waitForGoal, waitForInternalEvent, waitForInternalEvent, waitForMessageEvent, waitForMessageEvent, waitForReply, waitForReply, waitForTick, waitForWaitAbstraction, waitForWaitAbstraction
 
Methods inherited from class jadex.bdi.runtime.impl.AbstractPlan
createComponentIdentifier, createComponentIdentifier, createComponentIdentifier, createExpression, createExpression, createGoal, createInternalEvent, createMessageEvent, dispatchInternalEvent, dispatchSubgoal, dispatchTopLevelGoal, endAtomic, fail, fail, fail, getBeliefbase, getBody, getClock, getComponentIdentifier, getComponentName, getDispatchedElement, getEventbase, getException, getExpression, getExpressionbase, getExternalAccess, getFlyweight, getGoalbase, getInterpreter, getLifecycleState, getLogger, getParameter, getParameters, getParameterSet, getParameterSets, getPlanbase, getPlanElement, getPropertybase, getRCapability, getReason, getRPlan, getScope, getState, getTime, getType, getWaitqueue, hasParameter, hasParameterSet, killAgent, sendMessage, startAtomic, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

start

protected IMessageEvent start
The initial message.

Constructor Detail

DAInitiatorPlan

public DAInitiatorPlan()
Method Detail

body

public void body()
The plan body.

Specified by:
body in class Plan

announceAuction

protected void announceAuction(java.lang.Object auctiondesc,
                               java.util.List receivers,
                               java.lang.String convid)
Announce the planned auction.

Parameters:
auctiondesc - the auction description.
receivers - The receivers.
convid - The conversation id.

waitForAuctionStart

protected void waitForAuctionStart(AuctionDescription auctiondesc,
                                   java.util.List receivers)
Wait for the auction start time.

Parameters:
auctiondesc - The auction description.
receivers - The receivers.

sendCFP

protected void sendCFP(java.lang.Object cfp,
                       java.lang.String convid,
                       java.util.List receivers)
Send cfps to all receivers.

Parameters:
cfp - The cfp.
convid - The conversation id.
receivers - The receivers.

decideIteration

protected java.lang.Object[] decideIteration(java.lang.Object cfp_info,
                                             java.lang.Object[] history)
Decide about the next iteration.

Parameters:
cfp_info - The cfp info.
history - The history.
Returns:
The new cfp and cfp_info as an object array.

waitForProposals

protected IComponentIdentifier waitForProposals(java.lang.Object cfp,
                                                long roundtimeout,
                                                java.util.List receivers)
Wait for proposals of participants.

Parameters:
cfp - the cfp.
roundtimeout - The round timeout.
receivers - The receivers.
Returns:
The message of the winner.

evaluateAuctionResults

protected void evaluateAuctionResults(AuctionDescription auctiondesc,
                                      java.lang.Object cfp_info,
                                      java.lang.Object[] history,
                                      IComponentIdentifier winner,
                                      java.lang.Object winning_offer)
Evaluate the auction results and decide about participation.

Parameters:
auctiondesc - The auction description.
cfp_info - The cfp info.
history - The historz of cfps.
winner - the winner.
winning_offer - The winning offer.

announceAuctionEnd

protected void announceAuctionEnd(java.util.List receivers,
                                  java.lang.String convid,
                                  java.lang.Object winning_offer,
                                  IComponentIdentifier winner)
Announce the end of the auction to all participants that did not leave the auction.

Parameters:
receivers - The receivers.
convid - The conversation id.
winning_offer - The winning offer.

getInitialMessage

protected IMessageEvent getInitialMessage()
Get the initial message.

Specified by:
getInitialMessage in class AbstractInitiatorPlan


Copyright © 2010. All Rights Reserved.