RandomConcensusOfferingPolicy
- class negmas.gb.RandomConcensusOfferingPolicy(strategies, prob=None, *, negotiator=None)[source]
Bases:
ConcensusOfferingPolicy
Offers a random response from the list of strategies (different strategy every time).
Attributes Summary
Methods Summary
__call__
(state)Call self as a function.
after_join
(nmi)A call back called after joining a negotiation to confirm wwe joined.
after_proposing
(state, offer)Called after proposing
after_responding
(state, offer, response[, ...])Called before offering
before_proposing
(state)Called before proposing
before_responding
(state, offer[, source])Called before offering
can_join
(nmi, state, *[, preferences, ufun, ...])A call back called before joining a negotiation to confirm that we can join it.
decide
(indices, responses)Called to make a final decsision given the decisions of the stratgeis with indices
indices
(seefilter
for filtering rules)filter
(indx, offer)Called with the decision of each strategy in order.
on_leave
(state)A call back called after leaving a negotiation.
on_mechanism_error
(state)A call back called whenever an error happens in the mechanism.
on_negotiation_end
(state)A call back called at each negotiation end
on_negotiation_start
(state)A call back called at each negotiation start
on_partner_ended
(partner)Called when a partner ends the negotiation.
on_partner_joined
(partner)Called when a partner joins the negotiation.
on_partner_left
(partner)Called when a partner leaves the negotiation.
on_partner_proposal
(state, partner_id, offer)A callback called by the mechanism when a partner proposes something
on_partner_refused_to_propose
(state, partner_id)A callback called by the mechanism when a partner refuses to propose
on_partner_response
(state, partner_id, ...)A callback called by the mechanism when a partner responds to some offer
on_preferences_changed
(changes)Called to inform the component that the ufun has changed and the kinds of change that happened.
on_round_end
(state)A call back called at each negotiation round end
on_round_start
(state)A call back called at each negotiation round start
propose
(state)Propose an offer or None to refuse.
set_negotiator
(negotiator)Sets the negotiator of which this component is a part.
Attributes Documentation
- negotiator
- prob: list[float] | None
- strategies: list[OfferingPolicy]
Methods Documentation
- __call__(state)
Call self as a function.
- Return type:
Outcome | None
- after_join(nmi)
A call back called after joining a negotiation to confirm wwe joined.
- Return type:
- after_proposing(state, offer)
Called after proposing
- after_responding(state, offer, response, source=None)
Called before offering
- before_proposing(state)
Called before proposing
- before_responding(state, offer, source=None)
Called before offering
- can_join(nmi, state, *, preferences=None, ufun=None, role='negotiator')
A call back called before joining a negotiation to confirm that we can join it.
- Return type:
- decide(indices, responses)[source]
Called to make a final decsision given the decisions of the stratgeis with indices
indices
(seefilter
for filtering rules)- Return type:
Outcome | None
- filter(indx, offer)
Called with the decision of each strategy in order.
- Return type:
FilterResult
- Remarks:
Two decisions need to be made:
Should we continue trying other strategies
Should we save this result.
- on_mechanism_error(state)
A call back called whenever an error happens in the mechanism. The error and its explanation are accessible in
state
- Return type:
- on_partner_ended(partner)
Called when a partner ends the negotiation.
Note that the negotiator owning this component may never receive this offer. This is only receivd if the mechanism is sending notifications on every offer.
- on_partner_joined(partner)
Called when a partner joins the negotiation.
This is only receivd if the mechanism is sending notifications.
- on_partner_left(partner)
Called when a partner leaves the negotiation.
This is only receivd if the mechanism is sending notifications.
- on_partner_proposal(state, partner_id, offer)
A callback called by the mechanism when a partner proposes something
- Parameters:
state (
GBState
) –MechanismState
giving the state of the negotiation when the offer was porposed.partner_id (
str
) – The ID of the agent who proposedoffer (
tuple
) – The proposal.
- Return type:
- Remarks:
Will only be called if
enable_callbacks
is set for the mechanism
- on_partner_refused_to_propose(state, partner_id)
A callback called by the mechanism when a partner refuses to propose
- Parameters:
state (
GBState
) –MechanismState
giving the state of the negotiation when the partner refused to offer.partner_id (
str
) – The ID of the agent who refused to propose
- Return type:
- Remarks:
Will only be called if
enable_callbacks
is set for the mechanism
- on_partner_response(state, partner_id, outcome, response)
A callback called by the mechanism when a partner responds to some offer
- Parameters:
state (
GBState
) –MechanismState
giving the state of the negotiation when the partner responded.partner_id (
str
) – The ID of the agent who respondedresponse (
ResponseType
) – The response
- Return type:
- Remarks:
Will only be called if
enable_callbacks
is set for the mechanism
- on_preferences_changed(changes)
Called to inform the component that the ufun has changed and the kinds of change that happened.
- propose(state)
Propose an offer or None to refuse.
- Parameters:
- Return type:
- Returns:
The outcome being proposed or None to refuse to propose
- Remarks:
Caches results for the same thread and step. If called multiple times for the same thread and step, it will do the computations only once.
Caching is useful when the acceptance strategy calls the offering strategy