scml.scml2020.agents ==================== .. py:module:: scml.scml2020.agents Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/scml/scml2020/agents/bcse/index /autoapi/scml/scml2020/agents/decentralizing/index /autoapi/scml/scml2020/agents/do_nothing/index /autoapi/scml/scml2020/agents/indneg/index /autoapi/scml/scml2020/agents/moving/index /autoapi/scml/scml2020/agents/random/index /autoapi/scml/scml2020/agents/reactive/index /autoapi/scml/scml2020/agents/satisficer/index Attributes ---------- .. autoapisummary:: scml.scml2020.agents.__all__ Classes ------- .. autoapisummary:: scml.scml2020.agents.RandomAgent scml.scml2020.agents.DoNothingAgent scml.scml2020.agents.IndependentNegotiationsAgent scml.scml2020.agents.MarketAwareIndependentNegotiationsAgent scml.scml2020.agents.BuyCheapSellExpensiveAgent scml.scml2020.agents.MarketAwareBuyCheapSellExpensiveAgent scml.scml2020.agents.DecentralizingAgent scml.scml2020.agents.IndDecentralizingAgent scml.scml2020.agents.DecentralizingAgentWithLogging scml.scml2020.agents.MarketAwareDecentralizingAgent scml.scml2020.agents.MarketAwareIndDecentralizingAgent scml.scml2020.agents.ReactiveAgent scml.scml2020.agents.MarketAwareReactiveAgent scml.scml2020.agents.MovingRangeAgent scml.scml2020.agents.MarketAwareMovingRangeAgent scml.scml2020.agents.SatisficerAgent Package Contents ---------------- .. py:class:: RandomAgent(*args, **kwargs) Bases: :py:obj:`scml.scml2020.agents.indneg.IndependentNegotiationsAgent` An agent that negotiates randomly. .. py:method:: create_ufun(is_seller: bool, issues=None, outcomes=None) Creates a utility function .. py:class:: DoNothingAgent(name: str | None = None, type_postfix: str = '', preferences: negmas.preferences.Preferences | None = None, ufun: negmas.preferences.UtilityFunction | None = None) Bases: :py:obj:`scml.scml2020.agent.SCML2020Agent` An agent that does nothing for the whole length of the simulation .. py:method:: respond_to_negotiation_request(initiator: str, issues: List[negmas.Issue], annotation: Dict[str, Any], mechanism: negmas.NegotiatorMechanismInterface) -> Optional[negmas.Negotiator] Called whenever another agent requests a negotiation with this agent. :param initiator: The ID of the agent that requested this negotiation :param issues: Negotiation issues :param annotation: Annotation attached with this negotiation :param mechanism: The `NegotiatorMechanismInterface` interface to the mechanism to be used for this negotiation. :returns: None to reject the negotiation, otherwise a negotiator .. py:method:: sign_all_contracts(contracts: List[negmas.Contract]) -> List[Optional[str]] Signs all contracts .. py:method:: on_contracts_finalized(signed: List[negmas.Contract], cancelled: List[negmas.Contract], rejectors: List[List[str]]) -> None Called for all contracts in a single step to inform the agent about which were finally signed and which were rejected by any agents (including itself) :param signed: A list of signed contracts. These are binding :param cancelled: A list of cancelled contracts. These are not binding :param rejectors: A list of lists where each of the internal lists gives the rejectors of one of the cancelled contracts. Notice that it is possible that this list is empty which means that the contract other than being rejected by any agents (if that was possible in the specific world). Remarks: The default implementation is to call `on_contract_signed` for singed contracts and `on_contract_cancelled` for cancelled contracts .. py:method:: step() Called by the simulator at every simulation step .. py:method:: init() Called to initialize the agent **after** the world is initialized. the AWI is accessible at this point. .. py:method:: on_agent_bankrupt(agent: str, contracts: List[negmas.Contract], quantities: List[int], compensation_money: int) -> None Called whenever a contract is nullified (because the partner is bankrupt) :param agent: The ID of the agent that went bankrupt. :param contracts: All future contracts between this agent and the bankrupt agent. :param quantities: The actual quantities that these contracts will be executed at. :param compensation_money: The compensation money that is already added to the agent's wallet (if ANY). Remarks: - compensation_money will be nonzero iff immediate_compensation is enabled for this world .. py:method:: on_failures(failures: List[scml.scml2020.common.Failure]) -> None Called whenever there are failures either in production or in execution of guaranteed transactions :param failures: A list of `Failure` s. .. py:method:: on_negotiation_failure(partners: List[str], annotation: Dict[str, Any], mechanism: negmas.NegotiatorMechanismInterface, state: negmas.MechanismState) -> None Called whenever a negotiation ends without agreement .. py:method:: on_negotiation_success(contract: negmas.Contract, mechanism: negmas.NegotiatorMechanismInterface) -> None Called whenever a negotiation ends with agreement .. py:method:: on_contract_cancelled(contract: negmas.Contract, rejectors: List[str]) -> None Called whenever at least a partner did not sign the contract .. py:method:: on_contract_executed(contract: negmas.Contract) -> None Called after successful contract execution for which the agent is one of the partners. .. py:method:: on_contract_breached(contract: negmas.Contract, breaches: List[negmas.Breach], resolution: Optional[negmas.Contract]) -> None Called after complete processing of a contract that involved a breach. :param contract: The contract :param breaches: All breaches committed (even if they were resolved) :param resolution: The resolution contract if re-negotiation was successful. None if not. .. py:class:: IndependentNegotiationsAgent(*args, **kwargs) Bases: :py:obj:`scml.scml2020.components.negotiation.IndependentNegotiationsManager`, :py:obj:`scml.scml2020.components.prediction.FixedTradePredictionStrategy`, :py:obj:`scml.scml2020.components.trading.ReactiveTradingStrategy`, :py:obj:`scml.scml2020.world.SCML2020Agent` Implements the base class for agents that negotiate independently with different partners. These agents do not take production capacity, availability of materials or any other aspects of the simulation into account. They are to serve only as baselines. Remarks: - `IndependentNegotiationsAgent` agents assume that each production process has one input type with the same index as itself and one output type with one added to the index (i.e. process $i$ takes product $i$ as input and creates product $i+1$ as output. - It does not assume that all lines have the same production cost (it uses the average cost though). - It does not assume that the agent has a single production process. .. py:method:: acceptable_unit_price(step: int, sell: bool) -> int Returns the maximum/minimum acceptable unit price for buying/selling at the given time-step :param step: Simulation step :param sell: Sell or buy .. py:method:: target_quantity(step: int, sell: bool) -> int Returns the target quantity to sell/buy at a given time-step :param step: Simulation step :param sell: Sell or buy .. py:class:: MarketAwareIndependentNegotiationsAgent(*args, buying_margin=None, selling_margin=None, min_price_margin=0.5, max_price_margin=0.5, **kwargs) Bases: :py:obj:`scml.scml2020.components.signing.KeepOnlyGoodPrices`, :py:obj:`IndependentNegotiationsAgent` Implements the base class for agents that negotiate independently with different partners using trading/catalog prices to control signing These agents do not take production capacity, availability of materials or any other aspects of the simulation into account. They are to serve only as baselines. Remarks: - `IndependentNegotiationsAgent` agents assume that each production process has one input type with the same index as itself and one output type with one added to the index (i.e. process $i$ takes product $i$ as input and creates product $i+1$ as output. - It does not assume that all lines have the same production cost (it uses the average cost though). - It does not assume that the agent has a single production process. .. py:class:: BuyCheapSellExpensiveAgent(*args, **kwargs) Bases: :py:obj:`scml.scml2020.agents.indneg.IndependentNegotiationsAgent` An agent that tries to buy cheap and sell expensive but does not care about production scheduling. .. py:method:: create_ufun(is_seller: bool, issues=None, outcomes=None) Creates a utility function .. py:class:: MarketAwareBuyCheapSellExpensiveAgent(*args, buying_margin=None, selling_margin=None, min_price_margin=0.5, max_price_margin=0.5, **kwargs) Bases: :py:obj:`scml.scml2020.agents.indneg.MarketAwareIndependentNegotiationsAgent`, :py:obj:`BuyCheapSellExpensiveAgent` An agent that tries to buy cheap and sell expensive but does not care about production scheduling. .. py:class:: DecentralizingAgent(*args, negotiator_type: Union[negmas.SAONegotiator, str] = AspirationNegotiator, negotiator_params: Optional[Dict[str, Any]] = None, **kwargs) Bases: :py:obj:`_NegotiationCallbacks`, :py:obj:`scml.scml2020.components.StepNegotiationManager`, :py:obj:`scml.scml2020.components.trading.PredictionBasedTradingStrategy`, :py:obj:`scml.scml2020.components.SupplyDrivenProductionStrategy`, :py:obj:`scml.scml2020.world.SCML2020Agent` A negotiation manager that controls a controller and another for selling for every timestep :param negotiator_type: The negotiator type to use to manage all negotiations :param negotiator_params: Paramters of the negotiator Provides: - `all_negotiations_concluded` Requires: - `acceptable_unit_price` - `target_quantity` - OPTIONALLY `target_quantities` Hooks Into: - `init` - `respond_to_negotiation_request` Remarks: - `Attributes` section describes the attributes that can be used to construct the component (passed to its `__init__` method). - `Provides` section describes the attributes (methods, properties, data-members) made available by this component directly. Note that everything provided by the bases of this components are also available to the agent (Check the `Bases` section above for all the bases of this component). - `Requires` section describes any requirements from the agent using this component. It defines a set of methods or properties/data-members that must exist in the agent that uses this component. These requirement are usually implemented as abstract methods in the component - `Abstract` section describes abstract methods that MUST be implemented by any descendant of this component. - `Hooks Into` section describes the methods this component overrides calling `super` () which allows other components to hook into the same method (by overriding it). Usually callbacks starting with `on_` are hooked into this way. - `Overrides` section describes the methods this component overrides without calling `super` effectively disallowing any other components after it in the MRO to call this method. Usually methods that do some action (i.e. not starting with `on_`) are overridden this way. .. py:class:: IndDecentralizingAgent(*args, negotiator_type: Union[negmas.SAONegotiator, str] = AspirationNegotiator, negotiator_params: Optional[Dict[str, Any]] = None, **kwargs) Bases: :py:obj:`_NegotiationCallbacks`, :py:obj:`scml.scml2020.components.IndependentNegotiationsManager`, :py:obj:`scml.scml2020.components.trading.PredictionBasedTradingStrategy`, :py:obj:`scml.scml2020.components.SupplyDrivenProductionStrategy`, :py:obj:`scml.scml2020.world.SCML2020Agent` A negotiation manager that manages independent negotiators that do not share any information once created :param negotiator_type: The negotiator type to use to manage all negotiations :param negotiator_params: Parameters of the negotiator Requires: - `create_ufun` - `acceptable_unit_price` - `target_quantity` - OPTIONALLY `target_quantities` Hooks Into: - `respond_to_negotiation_request` Remarks: - `Attributes` section describes the attributes that can be used to construct the component (passed to its `__init__` method). - `Provides` section describes the attributes (methods, properties, data-members) made available by this component directly. Note that everything provided by the bases of this components are also available to the agent (Check the `Bases` section above for all the bases of this component). - `Requires` section describes any requirements from the agent using this component. It defines a set of methods or properties/data-members that must exist in the agent that uses this component. These requirement are usually implemented as abstract methods in the component - `Abstract` section describes abstract methods that MUST be implemented by any descendant of this component. - `Hooks Into` section describes the methods this component overrides calling `super` () which allows other components to hook into the same method (by overriding it). Usually callbacks starting with `on_` are hooked into this way. - `Overrides` section describes the methods this component overrides without calling `super` effectively disallowing any other components after it in the MRO to call this method. Usually methods that do some action (i.e. not starting with `on_`) are overridden this way. .. py:method:: create_ufun(is_seller: bool, issues=None, outcomes=None) Creates a utility function .. py:class:: DecentralizingAgentWithLogging(*args, **kwargs) Bases: :py:obj:`_NegotiationCallbacks`, :py:obj:`scml.scml2020.components.StepNegotiationManager`, :py:obj:`scml.scml2020.components.trading.PredictionBasedTradingStrategy`, :py:obj:`scml.scml2020.components.SupplyDrivenProductionStrategy`, :py:obj:`scml.scml2020.world.SCML2020Agent` A negotiation manager that controls a controller and another for selling for every timestep :param negotiator_type: The negotiator type to use to manage all negotiations :param negotiator_params: Paramters of the negotiator Provides: - `all_negotiations_concluded` Requires: - `acceptable_unit_price` - `target_quantity` - OPTIONALLY `target_quantities` Hooks Into: - `init` - `respond_to_negotiation_request` Remarks: - `Attributes` section describes the attributes that can be used to construct the component (passed to its `__init__` method). - `Provides` section describes the attributes (methods, properties, data-members) made available by this component directly. Note that everything provided by the bases of this components are also available to the agent (Check the `Bases` section above for all the bases of this component). - `Requires` section describes any requirements from the agent using this component. It defines a set of methods or properties/data-members that must exist in the agent that uses this component. These requirement are usually implemented as abstract methods in the component - `Abstract` section describes abstract methods that MUST be implemented by any descendant of this component. - `Hooks Into` section describes the methods this component overrides calling `super` () which allows other components to hook into the same method (by overriding it). Usually callbacks starting with `on_` are hooked into this way. - `Overrides` section describes the methods this component overrides without calling `super` effectively disallowing any other components after it in the MRO to call this method. Usually methods that do some action (i.e. not starting with `on_`) are overridden this way. .. py:class:: MarketAwareDecentralizingAgent(*args, buying_margin=None, selling_margin=None, min_price_margin=0.5, max_price_margin=0.5, **kwargs) Bases: :py:obj:`scml.scml2020.components.prediction.MarketAwareTradePredictionStrategy`, :py:obj:`_NegotiationCallbacks`, :py:obj:`scml.scml2020.components.MovingRangeNegotiationManager`, :py:obj:`scml.scml2020.components.trading.PredictionBasedTradingStrategy`, :py:obj:`scml.scml2020.components.signing.KeepOnlyGoodPrices`, :py:obj:`scml.scml2020.components.SupplyDrivenProductionStrategy`, :py:obj:`scml.scml2020.world.SCML2020Agent` Predicts an amount based on publicly available market information. Falls back to fixed prediction if no information is available Hooks Into: - `internal_state` - `on_contracts_finalized` Remarks: - `Attributes` section describes the attributes that can be used to construct the component (passed to its `__init__` method). - `Provides` section describes the attributes (methods, properties, data-members) made available by this component directly. Note that everything provided by the bases of this components are also available to the agent (Check the `Bases` section above for all the bases of this component). - `Requires` section describes any requirements from the agent using this component. It defines a set of methods or properties/data-members that must exist in the agent that uses this component. These requirement are usually implemented as abstract methods in the component - `Abstract` section describes abstract methods that MUST be implemented by any descendant of this component. - `Hooks Into` section describes the methods this component overrides calling `super` () which allows other components to hook into the same method (by overriding it). Usually callbacks starting with `on_` are hooked into this way. - `Overrides` section describes the methods this component overrides without calling `super` effectively disallowing any other components after it in the MRO to call this method. Usually methods that do some action (i.e. not starting with `on_`) are overridden this way. .. py:class:: MarketAwareIndDecentralizingAgent(*args, buying_margin=None, selling_margin=None, min_price_margin=0.5, max_price_margin=0.5, **kwargs) Bases: :py:obj:`scml.scml2020.components.signing.KeepOnlyGoodPrices`, :py:obj:`scml.scml2020.components.prediction.MarketAwareTradePredictionStrategy`, :py:obj:`IndDecentralizingAgent` Signs all contracts that have good prices Overrides: - `sign_all_contracts` .. attribute:: - buying_margin The margin from the catalog price to allow for buying. The agent will never buy at a price higher than the catalog price by more than this margin (relative to catalog price). .. attribute:: - selling_margin The margin from the catalog price to allow for selling. The agent will never sell at a price lower than the catalog price by more than this margin (relative to catalog price). Remarks: - `Attributes` section describes the attributes that can be used to construct the component (passed to its `__init__` method). - `Provides` section describes the attributes (methods, properties, data-members) made available by this component directly. Note that everything provided by the bases of this components are also available to the agent (Check the `Bases` section above for all the bases of this component). - `Requires` section describes any requirements from the agent using this component. It defines a set of methods or properties/data-members that must exist in the agent that uses this component. These requirement are usually implemented as abstract methods in the component - `Abstract` section describes abstract methods that MUST be implemented by any descendant of this component. - `Hooks Into` section describes the methods this component overrides calling `super` () which allows other components to hook into the same method (by overriding it). Usually callbacks starting with `on_` are hooked into this way. - `Overrides` section describes the methods this component overrides without calling `super` effectively disallowing any other components after it in the MRO to call this method. Usually methods that do some action (i.e. not starting with `on_`) are overridden this way. .. py:class:: ReactiveAgent(*args, negotiator_type: Union[negmas.SAONegotiator, str] = AspirationNegotiator, negotiator_params: Optional[Dict[str, Any]] = None, **kwargs) Bases: :py:obj:`scml.scml2020.components.StepNegotiationManager`, :py:obj:`scml.scml2020.components.trading.ReactiveTradingStrategy`, :py:obj:`scml.scml2020.components.production.TradeDrivenProductionStrategy`, :py:obj:`scml.scml2020.components.FixedTradePredictionStrategy`, :py:obj:`scml.scml2020.world.SCML2020Agent` A negotiation manager that controls a controller and another for selling for every timestep :param negotiator_type: The negotiator type to use to manage all negotiations :param negotiator_params: Paramters of the negotiator Provides: - `all_negotiations_concluded` Requires: - `acceptable_unit_price` - `target_quantity` - OPTIONALLY `target_quantities` Hooks Into: - `init` - `respond_to_negotiation_request` Remarks: - `Attributes` section describes the attributes that can be used to construct the component (passed to its `__init__` method). - `Provides` section describes the attributes (methods, properties, data-members) made available by this component directly. Note that everything provided by the bases of this components are also available to the agent (Check the `Bases` section above for all the bases of this component). - `Requires` section describes any requirements from the agent using this component. It defines a set of methods or properties/data-members that must exist in the agent that uses this component. These requirement are usually implemented as abstract methods in the component - `Abstract` section describes abstract methods that MUST be implemented by any descendant of this component. - `Hooks Into` section describes the methods this component overrides calling `super` () which allows other components to hook into the same method (by overriding it). Usually callbacks starting with `on_` are hooked into this way. - `Overrides` section describes the methods this component overrides without calling `super` effectively disallowing any other components after it in the MRO to call this method. Usually methods that do some action (i.e. not starting with `on_`) are overridden this way. .. py:method:: acceptable_unit_price(step: int, sell: bool) -> int Returns the maximum/minimum acceptable unit price for buying/selling at the given time-step :param step: Simulation step :param sell: Sell or buy .. py:method:: target_quantity(step: int, sell: bool) -> int Returns the target quantity to sell/buy at a given time-step :param step: Simulation step :param sell: Sell or buy .. py:method:: target_quantities(steps: Tuple[int, int], sell: bool) -> numpy.ndarray Implemented for speed but not really required .. py:class:: MarketAwareReactiveAgent(*args, buying_margin=None, selling_margin=None, min_price_margin=0.5, max_price_margin=0.5, **kwargs) Bases: :py:obj:`scml.scml2020.components.signing.KeepOnlyGoodPrices`, :py:obj:`ReactiveAgent` Signs all contracts that have good prices Overrides: - `sign_all_contracts` .. attribute:: - buying_margin The margin from the catalog price to allow for buying. The agent will never buy at a price higher than the catalog price by more than this margin (relative to catalog price). .. attribute:: - selling_margin The margin from the catalog price to allow for selling. The agent will never sell at a price lower than the catalog price by more than this margin (relative to catalog price). Remarks: - `Attributes` section describes the attributes that can be used to construct the component (passed to its `__init__` method). - `Provides` section describes the attributes (methods, properties, data-members) made available by this component directly. Note that everything provided by the bases of this components are also available to the agent (Check the `Bases` section above for all the bases of this component). - `Requires` section describes any requirements from the agent using this component. It defines a set of methods or properties/data-members that must exist in the agent that uses this component. These requirement are usually implemented as abstract methods in the component - `Abstract` section describes abstract methods that MUST be implemented by any descendant of this component. - `Hooks Into` section describes the methods this component overrides calling `super` () which allows other components to hook into the same method (by overriding it). Usually callbacks starting with `on_` are hooked into this way. - `Overrides` section describes the methods this component overrides without calling `super` effectively disallowing any other components after it in the MRO to call this method. Usually methods that do some action (i.e. not starting with `on_`) are overridden this way. .. py:class:: MovingRangeAgent(*args, price_weight=0.7, utility_threshold=0.9, time_threshold=0.9, time_horizon=0.1, min_price_margin=0.5, max_price_margin=0.5, **kwargs) Bases: :py:obj:`scml.scml2020.components.MovingRangeNegotiationManager`, :py:obj:`scml.scml2020.components.trading.PredictionBasedTradingStrategy`, :py:obj:`scml.scml2020.components.SupplyDrivenProductionStrategy`, :py:obj:`scml.scml2020.world.SCML2020Agent` My negotiation strategy :param price_weight: The relative importance of price in the utility calculation. :param utility_threshold: The fraction of maximum utility above which all offers will be accepted. :param time_threshold: The fraction of the negotiation time after which any valid offers will be accepted. :param time_range: The time-range for each controller as a fraction of the number of simulation steps Hooks Into: - `init` - `step` Remarks: - `Attributes` section describes the attributes that can be used to construct the component (passed to its `__init__` method). - `Provides` section describes the attributes (methods, properties, data-members) made available by this component directly. Note that everything provided by the bases of this components are also available to the agent (Check the `Bases` section above for all the bases of this component). - `Requires` section describes any requirements from the agent using this component. It defines a set of methods or properties/data-members that must exist in the agent that uses this component. These requirement are usually implemented as abstract methods in the component - `Abstract` section describes abstract methods that MUST be implemented by any descendant of this component. - `Hooks Into` section describes the methods this component overrides calling `super` () which allows other components to hook into the same method (by overriding it). Usually callbacks starting with `on_` are hooked into this way. - `Overrides` section describes the methods this component overrides without calling `super` effectively disallowing any other components after it in the MRO to call this method. Usually methods that do some action (i.e. not starting with `on_`) are overridden this way. .. py:class:: MarketAwareMovingRangeAgent(*args, min_price_margin=0.5, max_price_margin=0.5, **kwargs) Bases: :py:obj:`scml.scml2020.components.prediction.MarketAwareTradePredictionStrategy`, :py:obj:`MovingRangeAgent` Predicts an amount based on publicly available market information. Falls back to fixed prediction if no information is available Hooks Into: - `internal_state` - `on_contracts_finalized` Remarks: - `Attributes` section describes the attributes that can be used to construct the component (passed to its `__init__` method). - `Provides` section describes the attributes (methods, properties, data-members) made available by this component directly. Note that everything provided by the bases of this components are also available to the agent (Check the `Bases` section above for all the bases of this component). - `Requires` section describes any requirements from the agent using this component. It defines a set of methods or properties/data-members that must exist in the agent that uses this component. These requirement are usually implemented as abstract methods in the component - `Abstract` section describes abstract methods that MUST be implemented by any descendant of this component. - `Hooks Into` section describes the methods this component overrides calling `super` () which allows other components to hook into the same method (by overriding it). Usually callbacks starting with `on_` are hooked into this way. - `Overrides` section describes the methods this component overrides without calling `super` effectively disallowing any other components after it in the MRO to call this method. Usually methods that do some action (i.e. not starting with `on_`) are overridden this way. .. py:class:: SatisficerAgent(*args, target_productivity=1.0, satisfying_profit=0.15, acceptable_loss=0.02, price_range=0.4, concession_rate_price=1.0, concession_rate_quantity=1.0, concession_rate_time=1.0, market_share=1, horizon=5, **kwargs) Bases: :py:obj:`scml.scml2020.agent.SCML2020Agent` A simple monolithic agent that tries to *carefully* make small profit every step. :param target_productivity: The productivity level targeted by the agent defined as the fraction of its lines to be active per step. :param satisfying_profit: A profit amount considered satisfactory. Used when deciding negotiation agenda and signing to decide if a price is a good price (see `_good_price()`). A fraction of the trading price. :param acceptable_loss: A fraction of trading price that the seller/buyer is willing to go under/over the current trading price during negotiation. :param price_range: The total range around the trading price for negotiation agendas. :param concession_rate_price: The exponent of the consession curve for price. :param concession_rate_quantity: The exponent of the consession curve for quantity. :param concession_rate_time: The exponent of the consession curve for time. :param market_share: An integer specifying the expected share of the agent in the market. The agent will assume that it can get up to (market_share / (n_competitors + market_share -1)) of all sales and supplies where `n_competitors` is the number of agents at the same production level. Setting it to 1 means that the agent assumes it will get the same amount of trade as all other agents. Setting it to infinity means that the agent will assume it will take all the trade in the market :param horizon: Time horizon for negotiations. If None, the exogenous_contracts_revelation horizon will be used .. py:attribute:: horizon :value: 5 .. py:attribute:: satisfying_profit :value: 0.15 .. py:attribute:: target_productivity :value: 1.0 .. py:attribute:: price_range :value: 0.4 .. py:attribute:: ep :value: 1.0 .. py:attribute:: eq :value: 1.0 .. py:attribute:: et :value: 1.0 .. py:attribute:: acceptable_loss :value: 0.02 .. py:attribute:: last_q .. py:attribute:: last_t .. py:attribute:: market_share :value: 1 .. py:method:: init() Called once .. py:method:: before_step() Called at at the BEGINNING of every production step (day) .. py:method:: step() Called at the end of the day. Will request all negotiations .. py:method:: respond_to_negotiation_request(initiator, issues, annotation, mechanism) Called whenever another agent requests a negotiation with this agent. :param initiator: The ID of the agent that requested this negotiation :param issues: Negotiation issues :param annotation: Annotation attached with this negotiation :param mechanism: The `NegotiatorMechanismInterface` interface to the mechanism to be used for this negotiation. :returns: None to reject the negotiation, otherwise a negotiator .. py:method:: sign_all_contracts(contracts) Signs all contracts .. py:method:: on_contracts_finalized(signed, cancelled, rejectors) Called for all contracts in a single step to inform the agent about which were finally signed and which were rejected by any agents (including itself) :param signed: A list of signed contracts. These are binding :param cancelled: A list of cancelled contracts. These are not binding :param rejectors: A list of lists where each of the internal lists gives the rejectors of one of the cancelled contracts. Notice that it is possible that this list is empty which means that the contract other than being rejected by any agents (if that was possible in the specific world). Remarks: The default implementation is to call `on_contract_signed` for singed contracts and `on_contract_cancelled` for cancelled contracts .. py:method:: do_production() -> int .. py:method:: propose(state: negmas.sao.SAOState, ami: negmas.sao.SAONMI, is_selling: bool, is_requested: bool) Used to propose to the opponent :param state: mechanism state including current round :param ami: Agent-mechanism-interface for accessing the negotiation mechanism :param offer: The offer proposed by the partner :param is_selling: Whether the agent is selling to this partner :param is_requested: Whether the agent requested this negotiation .. py:method:: respond(state, ami, is_selling, is_requested) Responds to an offer from one partner. :param state: mechanism state including current round :param ami: Agent-mechanism-interface for accessing the negotiation mechanism :param offer: The offer proposed by the partner :param is_selling: Whether the agent is selling to this partner :param is_requested: Whether the agent requested this negotiation Remarks: - The main idea is to accept offers that are within the quantity limits for the delivery day if its price is good enough for the current stage of the negotiation. - During negotiation, the agent starts accepting highest/lowest prices for selling/buying and gradually conceeds to the minimally acceptable price (`good_price`) defined as being `acceptable_loss` above/below the trading price for buying/selling. .. py:method:: on_negotiation_failure(partners, annotation, mechanism, state) Called when a negotiation fails .. py:method:: on_negotiation_success(contract, mechanism) Called when a negotiation fails .. py:method:: _remove_tentative_offer(selling, partner) Removes my last offer from the tentative offers .. py:method:: _is_good_price(is_selling: bool, u: float, slack: float = 0.0) Checks whether a price is good relative to current trading prices, and satisfying profit (with possible slack). .. py:data:: __all__