marketplace
Class BestBuyerAgent

java.lang.Object
  |
  +--ciagent.CIAgent
        |
        +--marketplace.BuyerAgent
              |
              +--marketplace.BestBuyerAgent

public class BestBuyerAgent
extends BuyerAgent
implements Effector

The BestBuyerAgent class implements a buyer agent with the best negotiating skills in the marketplace application.

See Also:
Serialized Form

Field Summary
protected  RuleVariable firstOffer
           
protected  Offer offer
           
protected  RuleVariable offerDelta
           
protected  BooleanRuleBase rb
           
protected  RuleVariable spread
           
 
Fields inherited from class marketplace.BuyerAgent
current, inventory, msg, negotiations, pending, totalSpent, wishList
 
Fields inherited from class ciagent.CIAgent
agentPlatform, children, DEFAULT_ASYNCTIME, DEFAULT_SLEEPTIME, name, parent, traceLevel
 
Constructor Summary
BestBuyerAgent()
          Creates a BestBuyerAgent object.
BestBuyerAgent(java.lang.String name)
          Creates a BestBuyerAgent object with the given name.
 
Method Summary
 long effector(java.lang.Object obj, java.lang.String eName, java.lang.String args)
          Method effector used by action rules in rule base to make or accept offers
 void initBestBuyerRuleBase()
          Initializes the BestBuyer rule base.
 void initialize()
          Initializes the rule base for this buyer agent.
(package private)  void negotiate(Offer offer, BuySellMessage msg)
          Uses the rule base and forward chaining to decide whether to accept an offer or make a counter offer.
 
Methods inherited from class marketplace.BuyerAgent
getTaskDescription, process, processCIAgentEvent, processMessage, processTimerPop
 
Methods inherited from class ciagent.CIAgent
addAgent, addCIAgentEventListener, addPropertyChangeListener, getAgent, getAgentPlatform, getAgents, getAsyncTime, getChildren, getCustomizerClass, getDisplayName, getName, getParent, getSleepTime, getState, getTraceLevel, notifyCIAgentEventListeners, postCIAgentEvent, processAsynchronousEvents, removeAgent, removeCIAgentEventListener, removePropertyChangeListener, reset, resumeAgentProcessing, setAgentPlatform, setAsyncTime, setName, setParent, setSleepTime, setState, setTraceLevel, startAgentProcessing, stopAgentProcessing, suspendAgentProcessing, trace
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rb

protected BooleanRuleBase rb

offerDelta

protected RuleVariable offerDelta

spread

protected RuleVariable spread

firstOffer

protected RuleVariable firstOffer

offer

protected Offer offer
Constructor Detail

BestBuyerAgent

public BestBuyerAgent()
Creates a BestBuyerAgent object.

BestBuyerAgent

public BestBuyerAgent(java.lang.String name)
Creates a BestBuyerAgent object with the given name.
Parameters:
name - the String object that contains the name
Method Detail

initialize

public void initialize()
Initializes the rule base for this buyer agent.
Overrides:
initialize in class BuyerAgent

effector

public long effector(java.lang.Object obj,
                     java.lang.String eName,
                     java.lang.String args)
Method effector used by action rules in rule base to make or accept offers
Specified by:
effector in interface Effector
Parameters:
obj - the Object object that implements the effector
eName - the String object that contains the effector name
args - the String object that contains the effector arguments
Returns:
the long value that represents the status of the effector execution

negotiate

void negotiate(Offer offer,
               BuySellMessage msg)
Uses the rule base and forward chaining to decide whether to accept an offer or make a counter offer.
Parameters:
offer - the Offer object that contains the current offer
msg - the BuySellMessage object
Overrides:
negotiate in class BuyerAgent

initBestBuyerRuleBase

public void initBestBuyerRuleBase()
Initializes the BestBuyer rule base.