aea.decision_
maker.gop
This module contains the decision maker class.
GoalPursuitReadiness Objects
class GoalPursuitReadiness()
The goal pursuit readiness.
Status Objects
class Status(Enum)
The enum of the readiness status.
In particular, it can be one of the following:
- Status.READY: when the agent is ready to pursuit its goal
- Status.NOT_READY: when the agent is not ready to pursuit its goal
__
init__
| __init__() -> None
Instantiate the goal pursuit readiness.
is_
ready
| @property
| is_ready() -> bool
Get the readiness.
update
| update(new_status: Status) -> None
Update the goal pursuit readiness.
Arguments:
new_status
: the new status
Returns:
None
OwnershipState Objects
class OwnershipState(BaseOwnershipState)
Represent the ownership state of an agent (can proxy a ledger).
__
init__
| __init__() -> None
Instantiate an ownership state object.
Arguments:
decision_maker
: the decision maker
set
| set(amount_by_currency_id: CurrencyHoldings = None, quantities_by_good_id: GoodHoldings = None, **kwargs: Any, ,) -> None
Set values on the ownership state.
Arguments:
amount_by_currency_id
: the currency endowment of the agent in this state.quantities_by_good_id
: the good endowment of the agent in this state.
apply_
delta
| apply_delta(delta_amount_by_currency_id: Dict[str, int] = None, delta_quantities_by_good_id: Dict[str, int] = None, **kwargs: Any, ,) -> None
Apply a state update to the ownership state.
This method is used to apply a raw state update without a transaction.
Arguments:
delta_amount_by_currency_id
: the delta in the currency amountsdelta_quantities_by_good_id
: the delta in the quantities by good
Returns:
None
is_
initialized
| @property
| is_initialized() -> bool
Get the initialization status.
amount_
by_
currency_
id
| @property
| amount_by_currency_id() -> CurrencyHoldings
Get currency holdings in this state.
quantities_
by_
good_
id
| @property
| quantities_by_good_id() -> GoodHoldings
Get good holdings in this state.
is_
affordable_
transaction
| is_affordable_transaction(terms: Terms) -> bool
Check if the transaction is affordable (and consistent).
E.g. check that the agent state has enough money if it is a buyer or enough holdings if it is a seller. Note, the agent is the sender of the transaction message by design.
Arguments:
terms
: the transaction terms
Returns:
True if the transaction is legal wrt the current state, false otherwise.
is_
affordable
| is_affordable(terms: Terms) -> bool
Check if the tx is affordable.
Arguments:
terms
: the transaction terms
Returns:
whether the transaction is affordable or not
update
| update(terms: Terms) -> None
Update the agent state from a transaction.
Arguments:
terms
: the transaction terms
Returns:
None
apply_
transactions
| apply_transactions(list_of_terms: List[Terms]) -> "OwnershipState"
Apply a list of transactions to (a copy of) the current state.
Arguments:
list_of_terms
: the sequence of transaction terms.
Returns:
the final state.
__
copy__
| __copy__() -> "OwnershipState"
Copy the object.
Preferences Objects
class Preferences(BasePreferences)
Class to represent the preferences.
__
init__
| __init__() -> None
Instantiate an agent preference object.
set
| set(exchange_params_by_currency_id: ExchangeParams = None, utility_params_by_good_id: UtilityParams = None, **kwargs: Any, ,) -> None
Set values on the preferences.
Arguments:
exchange_params_by_currency_id
: the exchange params.utility_params_by_good_id
: the utility params for every asset.
is_
initialized
| @property
| is_initialized() -> bool
Get the initialization status.
Returns True if exchange_params_by_currency_id and utility_params_by_good_id are not None.
exchange_
params_
by_
currency_
id
| @property
| exchange_params_by_currency_id() -> ExchangeParams
Get exchange parameter for each currency.
utility_
params_
by_
good_
id
| @property
| utility_params_by_good_id() -> UtilityParams
Get utility parameter for each good.
logarithmic_
utility
| logarithmic_utility(quantities_by_good_id: GoodHoldings) -> float
Compute agent's utility given her utility function params and a good bundle.
Arguments:
quantities_by_good_id
: the good holdings (dictionary) with the identifier (key) and quantity (value) for each good
Returns:
utility value
linear_
utility
| linear_utility(amount_by_currency_id: CurrencyHoldings) -> float
Compute agent's utility given her utility function params and a currency bundle.
Arguments:
amount_by_currency_id
: the currency holdings (dictionary) with the identifier (key) and quantity (value) for each currency
Returns:
utility value
utility
| utility(quantities_by_good_id: GoodHoldings, amount_by_currency_id: CurrencyHoldings) -> float
Compute the utility given the good and currency holdings.
Arguments:
quantities_by_good_id
: the good holdingsamount_by_currency_id
: the currency holdings
Returns:
the utility value.
marginal_
utility
| marginal_utility(ownership_state: BaseOwnershipState, delta_quantities_by_good_id: Optional[GoodHoldings] = None, delta_amount_by_currency_id: Optional[CurrencyHoldings] = None, **kwargs: Any, ,) -> float
Compute the marginal utility.
Arguments:
ownership_state
: the ownership state against which to compute the marginal utility.delta_quantities_by_good_id
: the change in good holdingsdelta_amount_by_currency_id
: the change in money holdings
Returns:
the marginal utility score
utility_
diff_
from_
transaction
| utility_diff_from_transaction(ownership_state: BaseOwnershipState, terms: Terms) -> float
Simulate a transaction and get the resulting utility difference (taking into account the fee).
Arguments:
ownership_state
: the ownership state against which to apply the transaction.terms
: the transaction terms.
Returns:
the score.
is_
utility_
enhancing
| is_utility_enhancing(ownership_state: BaseOwnershipState, terms: Terms) -> bool
Check if the tx is utility enhancing.
Arguments:
ownership_state
: the ownership state against which to apply the transaction.terms
: the transaction terms
Returns:
whether the transaction is utility enhancing or not
__
copy__
| __copy__() -> "Preferences"
Copy the object.
DecisionMakerHandler Objects
class DecisionMakerHandler(BaseDecisionMakerHandler)
This class implements the decision maker.
SigningDialogues Objects
class SigningDialogues(BaseSigningDialogues)
This class keeps track of all oef_search dialogues.
__
init__
| __init__(self_address: Address, **kwargs: Any) -> None
Initialize dialogues.
Arguments:
self_address
: the address of the entity for whom dialogues are maintained
Returns:
None
StateUpdateDialogues Objects
class StateUpdateDialogues(BaseStateUpdateDialogues)
This class keeps track of all oef_search dialogues.
__
init__
| __init__(self_address: Address, **kwargs: Any) -> None
Initialize dialogues.
Arguments:
self_address
: the address of the entity for whom dialogues are maintained
Returns:
None
__
init__
| __init__(identity: Identity, wallet: Wallet) -> None
Initialize the decision maker.
Arguments:
identity
: the identitywallet
: the wallet
handle
| handle(message: Message) -> None
Handle an internal message from the skills.
Arguments:
message
: the internal message
Returns:
None