smia.logic.negotiation_utils module¶
This class contains methods related to negotiation management of the SMIA.
- smia.logic.negotiation_utils.create_neg_cfp_msg(thread, targets, neg_requester_jid, neg_criteria)[source]¶
This method creates the FIPA-ACL CallForProposal (CFP) message that will be sent to all participants to start a negotiation.
- Parameters:
thread (str) – the thread of the ACL message.
targets (str) – the JIDs of the SPADE agents that are participating in the negotiation. Is it a string that has the JIDs divided by ‘,’
neg_requester_jid (str) – the JID of the SPADE agent that has requested the negotiation.
neg_criteria (str) – criteria of the negotiation.
- Returns:
SPADE message object FIPA-ACL-compliant.
- Return type:
spade.message.Message
- smia.logic.negotiation_utils.create_neg_propose_msg(thread, targets, neg_requester_jid, neg_criteria, neg_value)[source]¶
This method creates the FIPA-ACL propose message that will be sent to all participants in a negotiation to check their negotiation values against the value of this SMIA.
- Parameters:
thread (str) – the thread of the ACL message.
targets (str) – the JIDs of the SPADE agents that are participating in the negotiation. Is it a string that has the JIDs divided by ‘,’
neg_requester_jid (str) – the JID of the SPADE agent that has requested the negotiation.
neg_criteria (str) – criteria of the negotiation.
neg_value (str) – value of the negotiation.
- Returns:
SPADE message object FIPA-ACL-compliant.
- Return type:
spade.message.Message
- smia.logic.negotiation_utils.create_neg_response_msg(receiver, thread, service_id, service_type, winner)[source]¶
This method creates the FIPA-ACL message to respond to a negotiation request with its result.
- Parameters:
receiver (str) – the JID of the receiver of the ACL message, that it will be the requester of the negotiation.
thread (str) – the thread of the ACL message.
service_id (str) – the serviceID of the ACL message.
service_type (str) – the serviceType of the ACL message.
winner (str) – the JID of the winner of the negotiation.
- Returns:
SPADE message object FIPA-ACL-compliant.
- Return type:
spade.message.Message
- smia.logic.negotiation_utils.create_neg_json_to_store(neg_requester_jid, participants, neg_criteria, is_winner)[source]¶
This method creates the JSON object to be stored in the global object of the SMIA for the information of all negotiations in which it has participated.
- Parameters:
neg_requester_jid (str) – the JID of the SPADE agent that has requested the negotiation.
participants (str) – JIDs of the SPADE agents that have participated in the negotiation. Is it a string that has the JIDs divided by ‘,’
neg_criteria (str) – criteria of the negotiation.
is_winner (bool) – it determines whether the SMIA has been the winner of the negotiation.
- Returns:
object with all the information of the negotiation in JSON format.
- Return type:
dict
- smia.logic.negotiation_utils.create_intra_aas_neg_req_data(performative, ontology, thread, service_data)[source]¶
This method creates the dictionary with all the required data for an Intra AAS interaction request.
- Parameters:
performative (str) – performative of the FIPA-ACL message.
ontology (str) – ontology of the FIPA-ACL message.
thread (str) – thread of the FIPA-ACL message.
service_data (dict) – all the data of the service for the Intra AAS interaction request.
- Returns:
dictionary with all the information about the Intra AAS interaction request
- Return type:
dict
- smia.logic.negotiation_utils.add_value_and_unlock_neg_handling_behaviour(agent, thread, neg_value)[source]¶
This method adds the value to the HandleNegotiationBehaviour which is in charge of the negotiation with the given thread. Since this behaviour is waiting for this value, this method also unlocks its execution, so it can continue with its logic.
- Parameters:
agent (spade.agent.Agent) – the SPADE agent object that represents the SMIA.
thread (str) – the thread of the negotiation, which is its identifier.
neg_value (int) – value of the AAS in the negotiation-
- smia.logic.negotiation_utils.get_neg_intra_aas_request_by_thread(agent, thread)[source]¶
This method gets the data of an Intra AAS Interaction using the thread value. :param agent: the SPADE agent object that represents the SMIA. :type agent: agents.smia_agent :param thread: the thread of the negotiation, which is its identifier. :type thread: str
- Returns:
dictionary with all the information about the Intra AAS interaction request. None if it does not exist.
- Return type:
dict