mango_library.negotiation.termination¶
Module, which implements a simple termination detection for negotiations. Here Huangs detection algorithm is used (10.1109/ICDCS.1989.37933).
It requires the distributed negotiation to have some kind of controller agent. In general this can often be the initiator.
Roles:
* NegotiationTerminationRole: role for the participants, hooks into sending messages,
adding the weight value
Messages:
* TerminationMessage: this message will be send to the controller, when an agent
considers itself as inactive.
- class mango_library.negotiation.termination.NegotiationTerminationRole(is_controller: bool = 0)¶
Role for negotiation participants. Will add the weight attribute to every coalition related message send.
- handle_msg(content, _: Dict[str, Any]) → None¶
Check whether a coalition related message has been received and manipulate the internal weight accordingly
- Parameters
content – the incoming message
meta – the meta data
- handle_term_msg(content: mango_library.negotiation.termination.TerminationMessage, _: Dict[str, Any]) → None¶
Handle the termination message.
- Parameters
content – the message
meta – meta data
- on_send(content, receiver_addr: Union[str, Tuple[str, int]], *, receiver_id: Optional[str] = None, create_acl: bool = False, acl_metadata: Optional[Dict[str, Any]] = None, mqtt_kwargs: Optional[Dict[str, Any]] = None)¶
Add the weight to every coalition related message
- Parameters
content – content of the message
receiver_addr – address
receiver_id – id of the receiver. Defaults to None.
create_acl – If you want to wrap the message in an ACL. Defaults to False.
acl_metadata – ACL meta data. Defaults to None.
mqtt_kwargs – Args for MQTT. Defaults to None.
- setup()¶
Lifecycle hook in, which will be called on adding the role to agent. The role context is known from hereon.
- class mango_library.negotiation.termination.TerminationMessage(weight: float, coalition_id: uuid.UUID, negotiation_id: uuid.UUID)¶
Message for sending the remaining weight to the controller
- property coalition_id: uuid.UUID¶
Return the coalition id the negotiation is referring to
- Returns
the coalition id
- property negotiation_id: uuid.UUID¶
Return the negotiation id
- Returns
the negotiation id
- property weight: float¶
Return the remaining weight
- Returns
remaining weight