scml.std.agents.greedy

Module Contents

Classes

GreedyOneShotAgent

A greedy agent based on OneShotAgent

GreedySyncAgent

A greedy agent based on OneShotSyncAgent

GreedyStdAgent

A greedy agent based on StdAgent

class scml.std.agents.greedy.GreedyOneShotAgent(*args, concession_exponent=None, acc_price_slack=float('inf'), step_price_slack=None, opp_price_slack=None, opp_acc_price_slack=None, range_slack=None, **kwargs)[source]

Bases: scml.oneshot.agent.OneShotAgent

A greedy agent based on OneShotAgent

Parameters:
  • concession_exponent – A real number controlling how fast does the agent concede on price.

  • acc_price_slack – The allowed slack in price limits compared with best prices I got so far

  • step_price_slack – The allowed slack in price limits compared with best prices I got this step

  • opp_price_slack – The allowed slack in price limits compared with best prices I got so far from a given opponent in this step

  • opp_acc_price_slack – The allowed slack in price limits compared with best prices I got so far from a given opponent so far

  • range_slack – Always consider prices above (1-range_slack) of the best possible prices good enough.

Remarks:
  • A concession_exponent greater than one makes the agent concede super linearly and vice versa

init()[source]

Initialize the quantities and best prices received so far

before_step()[source]

Initialize the quantities and best prices received for next step

on_negotiation_success(contract, mechanism)[source]

Record sales/supplies secured

propose(negotiator_id: str, state, source=None) negmas.Outcome | None[source]

Proposes an offer to one of the partners.

Parameters:
  • negotiator_id – ID of the negotiator (and partner)

  • state – Mechanism state including current step

Returns:

an outcome to offer.

respond(negotiator_id, state, source=None) negmas.ResponseType[source]

Responds to an offer from one of the partners.

Parameters:
  • negotiator_id – ID of the negotiator (and partner)

  • state – Mechanism state including current step

Returns:

A response type which can either be reject, accept, or end negotiation.

Remarks:

default behavior is to accept only if the current offer is the same or has a higher utility compared with what the agent would have proposed in the given state and reject otherwise

best_offer(negotiator_id)[source]
_needed(negotiator_id)[source]
_is_selling(nmi)[source]
_is_good_price(nmi, state, price)[source]

Checks if a given price is good enough at this stage

_find_good_price(nmi, state)[source]

Finds a good-enough price conceding linearly over time

_price_range(nmi)[source]

Limits the price by the best price received

_th(step, n_steps)[source]

calculates a descending threshold (0 <= th <= 1)

class scml.std.agents.greedy.GreedySyncAgent(*args, threshold=None, **kwargs)[source]

Bases: scml.oneshot.agent.OneShotSyncAgent, GreedyOneShotAgent

A greedy agent based on OneShotSyncAgent

before_step()[source]

Called at the beginning of every step.

Remarks:
  • Use this for any proactive code that needs to be done every simulation step.

first_proposals()[source]

Decide a first proposal on every negotiation. Returning None for a negotiation means ending it.

counter_all(offers, states) dict[source]

Respond to a set of offers given the negotiation state of each.

_needs()[source]

Returns both input and output needs

propose(negotiator_id, state)[source]

Proposes an offer to one of the partners.

Parameters:
  • negotiator_id – ID of the negotiator (and partner)

  • state – Mechanism state including current step

Returns:

an outcome to offer.

respond(negotiator_id, state, source='')[source]

Responds to an offer from one of the partners.

Parameters:
  • negotiator_id – ID of the negotiator (and partner)

  • state – Mechanism state including current step

Returns:

A response type which can either be reject, accept, or end negotiation.

Remarks:

default behavior is to accept only if the current offer is the same or has a higher utility compared with what the agent would have proposed in the given state and reject otherwise

class scml.std.agents.greedy.GreedyStdAgent(*args, concession_exponent=None, acc_price_slack=float('inf'), step_price_slack=None, opp_price_slack=None, opp_acc_price_slack=None, range_slack=None, future_threshold=0.9, production_target=0.75, **kwargs)[source]

Bases: scml.std.agent.StdAgent

A greedy agent based on StdAgent

Parameters:
  • concession_exponent – A real number controlling how fast does the agent concede on price.

  • acc_price_slack – The allowed slack in price limits compared with best prices I got so far

  • step_price_slack – The allowed slack in price limits compared with best prices I got this step

  • opp_price_slack – The allowed slack in price limits compared with best prices I got so far from a given opponent in this step

  • opp_acc_price_slack – The allowed slack in price limits compared with best prices I got so far from a given opponent so far

  • range_slack – Always consider prices above (1-range_slack) of the best possible prices good enough.

  • production_target – Fraction of production capacity to be secured in advance

Remarks:
  • A concession_exponent greater than one makes the agent concede super linearly and vice versa

init()[source]

Initialize the quantities and best prices received so far

before_step()[source]

Initialize the quantities and best prices received for next step

on_negotiation_success(contract, mechanism)[source]

Record sales/supplies secured

propose(negotiator_id: str, state, source=None) negmas.Outcome | None[source]

Proposes an offer to one of the partners.

Parameters:
  • negotiator_id – ID of the negotiator (and partner)

  • state – Mechanism state including current step

Returns:

an outcome to offer.

respond(negotiator_id, state, source=None) negmas.ResponseType[source]

Responds to an offer from one of the partners.

Parameters:
  • negotiator_id – ID of the negotiator (and partner)

  • state – Mechanism state including current step

Returns:

A response type which can either be reject, accept, or end negotiation.

Remarks:

default behavior is to accept only if the current offer is the same or has a higher utility compared with what the agent would have proposed in the given state and reject otherwise

best_offer(negotiator_id)[source]
_future_needs(negotiator_id, t)[source]
_needed(negotiator_id)[source]
_is_selling(nmi)[source]
_is_good_price(nmi, state, offer)[source]

Checks if a given price is good enough at this stage

_find_good_price(nmi, state, offer)[source]

Finds a good-enough price conceding linearly over time

_price_range(nmi, offer)[source]

Limits the price by the best price received

_th(step, n_steps)[source]

calculates a descending threshold (0 <= th <= 1)