jmadem
Class MADeMAgArch

java.lang.Object
  extended by jason.architecture.AgArch
      extended by jmadem.MADeMAgArch

public class MADeMAgArch
extends jason.architecture.AgArch

Basic architecture for a Jason agent performing MADeM decisions.

Author:
Francisco Grimaldo

Nested Class Summary
(package private)  class MADeMAgArch.BidTimeout
          Handles bid timeout for a specific decision making.
 
Field Summary
private  java.lang.String agName
          Agent name
private  java.util.logging.Logger logger
          Class logger
private  java.util.concurrent.ConcurrentMap<java.lang.Integer,DecisionData> mademData
          Data managed by MADeM for every decision being performed: id_decision, agents involved, allocations, utility functions considered, bids...
private  java.util.concurrent.ConcurrentMap<jason.asSyntax.Atom,java.lang.Float> personalWeights
          Personal weights representing the internal attitude of the agent towards other individuals.
private  int tout
          Maximum waiting time for bids (in milliseconds).
private  java.util.concurrent.ConcurrentMap<jason.asSyntax.Atom,UtilityFunctionInt> utilityFunctions
          Utility functions repository
private  java.util.concurrent.ConcurrentMap<jason.asSyntax.Atom,java.lang.Float> utilityWeights
          Utility weights representing the importance given to each point of view in the multi-modal agent decision making.
private  Cuf welfare
          Social welfare considered by the agent
 
Constructor Summary
MADeMAgArch()
           
 
Method Summary
 boolean addUtilityFunction(java.lang.String uFuncName)
          Registers a new utility function in the MADeM agent.
 void bid(java.lang.String auctioneer, jason.asSyntax.Literal madem_auction)
          Bids over a set of allocations coming from an auctioneer according to the specified utility function.
 void checkMail()
          Filters MADeM messages out of the agent Mailbox.
 java.util.concurrent.ConcurrentMap<jason.asSyntax.Atom,java.lang.Float> getPersonalWeights()
          Gets the personal weights of the MADeM agent.
 int getTimeout()
          Gets bid timeout (in milliseconds).
 float getUtility(java.lang.String auctioneer, Allocation allocation, jason.asSyntax.Atom uFunc)
          Obtains the utility value given by a specific utility function.
 java.util.Set<jason.asSyntax.Atom> getUtilityFunctionNames()
          Gets the names of the utility functions previously registered in the MADeM agent.
 java.util.concurrent.ConcurrentMap<jason.asSyntax.Atom,java.lang.Float> getUtilityWeights()
          Gets the utility weights of the MADeM agent.
 java.lang.String getWelfare()
          Gets the social welfare of the MADeM agent.
 void initAg(java.lang.String agClass, jason.mas2j.ClassParameters bbPars, java.lang.String asSrc, jason.runtime.Settings stts)
          MADeM agent initiator.
 void processBid(java.lang.String bidder, jason.asSyntax.Literal madem_bid)
          Process an external bid related to a certain decision.
 boolean removeUtilityFunction(java.lang.String uFuncName)
          Removes a utility function previously registered in the MADeM agent.
 boolean setPersonalWeights(java.util.concurrent.ConcurrentMap<jason.asSyntax.Atom,java.lang.Float> new_pw)
          Changes the personal weights of the MADeM agent towards the other agents.
 boolean setTimeout(int new_tout)
          Changes bid timeout to a new positive value.
 boolean setUtilityWeights(java.util.concurrent.ConcurrentMap<jason.asSyntax.Atom,java.lang.Float> new_uw)
          Changes the utility weights of the MADeM agent.
 void setWelfare(Cuf new_sw)
          Changes social welfare of the MADeM agent.
 int startMADeMDecision(jason.asSyntax.ListTermImpl ags, jason.asSyntax.ListTermImpl allocs, jason.asSyntax.ListTermImpl uFuncs)
          Starts a MADeM decision using the internal parameters of the agent.
 int startMADeMDecision(jason.asSyntax.ListTermImpl ags, jason.asSyntax.ListTermImpl allocs, jason.asSyntax.ListTermImpl uFuncs, java.util.concurrent.ConcurrentMap<jason.asSyntax.Atom,java.lang.Float> pW, java.util.concurrent.ConcurrentMap<jason.asSyntax.Atom,java.lang.Float> uW, Cuf sw, int tout)
          Starts a MADeM decision by specifying all its parameters.
 void winnerDeterminationProblem(int id_decision)
          Solves the winner determination problem for a specific decision.
 
Methods inherited from class jason.architecture.AgArch
act, broadcast, canSleep, getAgName, getArchInfraTier, getCycleNumber, getTS, isRunning, perceive, sendMsg, setArchInfraTier, setCycleNumber, setTS, sleep, stopAg
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private java.util.logging.Logger logger
Class logger


agName

private java.lang.String agName
Agent name


utilityFunctions

private java.util.concurrent.ConcurrentMap<jason.asSyntax.Atom,UtilityFunctionInt> utilityFunctions
Utility functions repository


utilityWeights

private java.util.concurrent.ConcurrentMap<jason.asSyntax.Atom,java.lang.Float> utilityWeights
Utility weights representing the importance given to each point of view in the multi-modal agent decision making.


personalWeights

private java.util.concurrent.ConcurrentMap<jason.asSyntax.Atom,java.lang.Float> personalWeights
Personal weights representing the internal attitude of the agent towards other individuals.


welfare

private Cuf welfare
Social welfare considered by the agent


tout

private int tout
Maximum waiting time for bids (in milliseconds). After timeout, the agent decides according to the bids it has collected and its own preferences.


mademData

private java.util.concurrent.ConcurrentMap<java.lang.Integer,DecisionData> mademData
Data managed by MADeM for every decision being performed: id_decision, agents involved, allocations, utility functions considered, bids...

Constructor Detail

MADeMAgArch

public MADeMAgArch()
Method Detail

initAg

public void initAg(java.lang.String agClass,
                   jason.mas2j.ClassParameters bbPars,
                   java.lang.String asSrc,
                   jason.runtime.Settings stts)
            throws jason.JasonException
MADeM agent initiator. Creates the agent class defined by agClass, default is jason.asSemantics.Agent. The agent class will parse the source code, create the transition system (TS), ...

Overrides:
initAg in class jason.architecture.AgArch
Parameters:
agClass - agent class definition
bbPars - agent class parameters
asSrc - AgentSpeak source code
stts - MAS Runtime Settings for an Agent
Throws:
jason.JasonException

addUtilityFunction

public boolean addUtilityFunction(java.lang.String uFuncName)
Registers a new utility function in the MADeM agent.

Parameters:
uFuncName - name of the utility function to be added
Returns:
true if the utility function was correctly added, false otherwise

removeUtilityFunction

public boolean removeUtilityFunction(java.lang.String uFuncName)
Removes a utility function previously registered in the MADeM agent.

Parameters:
uFuncName - name of the utility function to be removed
Returns:
true if the utility function was correctly removed, false otherwise

getUtilityFunctionNames

public java.util.Set<jason.asSyntax.Atom> getUtilityFunctionNames()
Gets the names of the utility functions previously registered in the MADeM agent.

Returns:
the utility function names in the form of a Set

startMADeMDecision

public int startMADeMDecision(jason.asSyntax.ListTermImpl ags,
                              jason.asSyntax.ListTermImpl allocs,
                              jason.asSyntax.ListTermImpl uFuncs)
Starts a MADeM decision using the internal parameters of the agent.

Parameters:
ags - names of the agents involved in the decision
allocs - allocations being considered as solutions for the decision problem
uFuncs - names of the different utility functions to pay attention to
Returns:
the identifier of the MADeM decision or -1 when any error occurs

startMADeMDecision

public int startMADeMDecision(jason.asSyntax.ListTermImpl ags,
                              jason.asSyntax.ListTermImpl allocs,
                              jason.asSyntax.ListTermImpl uFuncs,
                              java.util.concurrent.ConcurrentMap<jason.asSyntax.Atom,java.lang.Float> pW,
                              java.util.concurrent.ConcurrentMap<jason.asSyntax.Atom,java.lang.Float> uW,
                              Cuf sw,
                              int tout)
Starts a MADeM decision by specifying all its parameters.

Parameters:
ags - names of the agents involved in the decision
allocs - allocations being considered as solutions for the decision problem
uFuncs - names of the different utility functions to pay attention to
pW - personal weights to be applied over external preferences
uW - utility weights in the multi-modal decision
sw - type of social welfare being considered
tout - timeout for getting bids (in milliseconds)
Returns:
the identifier of the MADeM decision or -1 when any error occurs

checkMail

public void checkMail()
Filters MADeM messages out of the agent Mailbox.

Overrides:
checkMail in class jason.architecture.AgArch

setTimeout

public boolean setTimeout(int new_tout)
Changes bid timeout to a new positive value.

Parameters:
new_tout - new timeout value (in milliseconds)
Returns:
true if Timeout was correctly changed, false otherwise

getTimeout

public int getTimeout()
Gets bid timeout (in milliseconds).

Returns:
the bid timeout (in milliseconds) used by the MADeM agent

setWelfare

public void setWelfare(Cuf new_sw)
Changes social welfare of the MADeM agent.

Parameters:
new_sw - new social welfare

getWelfare

public java.lang.String getWelfare()
Gets the social welfare of the MADeM agent.

Returns:
the name of the social welfare

setPersonalWeights

public boolean setPersonalWeights(java.util.concurrent.ConcurrentMap<jason.asSyntax.Atom,java.lang.Float> new_pw)
Changes the personal weights of the MADeM agent towards the other agents.

Parameters:
new_pw - new personal weights
Returns:
true if Personal Weights were correctly changed, false otherwise

getPersonalWeights

public java.util.concurrent.ConcurrentMap<jason.asSyntax.Atom,java.lang.Float> getPersonalWeights()
Gets the personal weights of the MADeM agent.

Returns:
the personal weights being used by de MADeM agent in the form of a ConcurrentMap

setUtilityWeights

public boolean setUtilityWeights(java.util.concurrent.ConcurrentMap<jason.asSyntax.Atom,java.lang.Float> new_uw)
Changes the utility weights of the MADeM agent.

Parameters:
new_uw - new utility weights
Returns:
true if Utility Weights were correctly changed, false otherwise

getUtilityWeights

public java.util.concurrent.ConcurrentMap<jason.asSyntax.Atom,java.lang.Float> getUtilityWeights()
Gets the utility weights of the MADeM agent.

Returns:
the utility weights being used by de MADeM agent in the form of a ConcurrentMap

bid

public void bid(java.lang.String auctioneer,
                jason.asSyntax.Literal madem_auction)
Bids over a set of allocations coming from an auctioneer according to the specified utility function.

Parameters:
auctioneer - agent asking for preference
madem_auction - allocations and utility functions being considered

processBid

public void processBid(java.lang.String bidder,
                       jason.asSyntax.Literal madem_bid)
Process an external bid related to a certain decision.

Parameters:
bidder - name of the agent who sent the bid
madem_bid - bid containing bidder's preferences

getUtility

public float getUtility(java.lang.String auctioneer,
                        Allocation allocation,
                        jason.asSyntax.Atom uFunc)
Obtains the utility value given by a specific utility function.

Parameters:
auctioneer - agent asking for preference
allocation - allocation being evaluated
uFunc - name of the utility function being considered
Returns:
the utility value assigned to the allocation. Utility values are between [0, 1]; 0 meaning no preference and 1 meaning the highest preference

winnerDeterminationProblem

public void winnerDeterminationProblem(int id_decision)
Solves the winner determination problem for a specific decision.

Parameters:
id_decision - Identifier of the decision being solved