Physical goods and services¶
Goods¶
An agent can access a good with self['cookies']
or
self['money']
.
self.create(money, 15)
creates moneyself.destroy(money, 10)
destroys money- goods can be given, taken, sold and bought
self['money']
returns the quantity an agent possesses
Services¶
Services are like goods, but the need to be declared as services
in the simulation abce.__init__.service()
.
In this function one declares a good that creates the other good and
how much. For example if one has self['adults'] = 2
, one could
get 16 hours of labor every day. simulation.declare_service('adults', 8, 'labor')
.
-
class
abce.goods.
Goods
(id, agent_parameters, simulation_parameters, group, trade_logging, database, check_unchecked_msgs, expiring, perishable, resource_endowment, start_round=None)[source]¶ Bases:
object
Each agent can access his goods. self[‘good_name’] shows the quantity of goods of a certain type an agent owns. Goods can be a string or any other python object.
-
create
(good, quantity)[source]¶ creates quantity of the good out of nothing
Use create with care, as long as you use it only for labor and natural resources your model is macro-economically complete.
- Args:
- ‘good’: is the name of the good quantity: number
-
create_timestructured
(good, quantity)[source]¶ creates quantity of the time structured good out of nothing. For example:
self.creat_timestructured('capital', [10,20,30])
Creates capital. 10 units are 2 years old 20 units are 1 year old and 30 units are new.
It can alse be used with a quantity instead of an array. In this case the amount is equally split on the years.:
self.create_timestructured('capital', 60)
In this case 20 units are 2 years old 20 units are 1 year old and 20 units are new.
- Args:
- ‘good’:
- is the name of the good
- quantity:
- an arry or number
-
destroy
(good, quantity=None)[source]¶ destroys quantity of the good. If quantity is omitted destroys all
Args:
'good': is the name of the good quantity (optional): number
Raises:
NotEnoughGoods: when goods are insufficient
-
not_reserved
(good)[source]¶ Returns the amount of goods that are not reserved for a trade
- Args:
- good
-
possession
(good)[source]¶ returns how much of good an agent possesses.
- Returns:
- A number.
possession does not return a dictionary for self.log(…), you can use self.possessions([…]) (plural) with self.log.
Example:
if self['money'] < 1: self.financial_crisis = True if not(is_positive(self['money']): self.bancrupcy = True
-