pycityagent 2.0.0a49__cp310-cp310-macosx_11_0_arm64.whl → 2.0.0a51__cp310-cp310-macosx_11_0_arm64.whl
Sign up to get free protection for your applications and to get access to all the features.
- pycityagent/__init__.py +12 -3
- pycityagent/agent/__init__.py +9 -0
- pycityagent/agent/agent.py +324 -0
- pycityagent/{agent.py → agent/agent_base.py} +41 -345
- pycityagent/cityagent/bankagent.py +28 -16
- pycityagent/cityagent/firmagent.py +63 -25
- pycityagent/cityagent/governmentagent.py +35 -19
- pycityagent/cityagent/initial.py +38 -28
- pycityagent/cityagent/memory_config.py +240 -128
- pycityagent/cityagent/nbsagent.py +82 -36
- pycityagent/cityagent/societyagent.py +155 -72
- pycityagent/simulation/agentgroup.py +2 -2
- pycityagent/simulation/simulation.py +94 -55
- pycityagent/tools/__init__.py +11 -0
- pycityagent/{workflow → tools}/tool.py +3 -1
- pycityagent/workflow/__init__.py +0 -5
- pycityagent/workflow/block.py +12 -10
- {pycityagent-2.0.0a49.dist-info → pycityagent-2.0.0a51.dist-info}/METADATA +1 -2
- {pycityagent-2.0.0a49.dist-info → pycityagent-2.0.0a51.dist-info}/RECORD +23 -20
- {pycityagent-2.0.0a49.dist-info → pycityagent-2.0.0a51.dist-info}/LICENSE +0 -0
- {pycityagent-2.0.0a49.dist-info → pycityagent-2.0.0a51.dist-info}/WHEEL +0 -0
- {pycityagent-2.0.0a49.dist-info → pycityagent-2.0.0a51.dist-info}/entry_points.txt +0 -0
- {pycityagent-2.0.0a49.dist-info → pycityagent-2.0.0a51.dist-info}/top_level.txt +0 -0
@@ -11,22 +11,32 @@ import logging
|
|
11
11
|
|
12
12
|
logger = logging.getLogger("pycityagent")
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
14
|
+
|
15
|
+
class GovernmentAgent(InstitutionAgent):
|
16
|
+
def __init__(
|
17
|
+
self,
|
18
|
+
name: str,
|
19
|
+
llm_client: Optional[LLM] = None,
|
20
|
+
simulator: Optional[Simulator] = None,
|
21
|
+
memory: Optional[Memory] = None,
|
22
|
+
economy_client: Optional[EconomyClient] = None,
|
23
|
+
messager: Optional[Messager] = None,
|
24
|
+
avro_file: Optional[dict] = None,
|
25
|
+
) -> None:
|
26
|
+
super().__init__(
|
27
|
+
name=name,
|
28
|
+
llm_client=llm_client,
|
29
|
+
simulator=simulator,
|
30
|
+
memory=memory,
|
31
|
+
economy_client=economy_client,
|
32
|
+
messager=messager,
|
33
|
+
avro_file=avro_file,
|
34
|
+
)
|
25
35
|
self.initailzed = False
|
26
36
|
self.last_time_trigger = None
|
27
37
|
self.time_diff = 30 * 24 * 60 * 60
|
28
38
|
self.forward_times = 0
|
29
|
-
|
39
|
+
|
30
40
|
async def month_trigger(self):
|
31
41
|
now_time = await self.simulator.get_time()
|
32
42
|
if self.last_time_trigger is None:
|
@@ -36,25 +46,31 @@ class GovernmentAgent(InstitutionAgent):
|
|
36
46
|
self.last_time_trigger = now_time
|
37
47
|
return True
|
38
48
|
return False
|
39
|
-
|
49
|
+
|
40
50
|
async def gather_messages(self, agent_ids, content):
|
41
51
|
infos = await super().gather_messages(agent_ids, content)
|
42
|
-
return [info[
|
52
|
+
return [info["content"] for info in infos]
|
43
53
|
|
44
54
|
async def forward(self):
|
45
55
|
if await self.month_trigger():
|
46
56
|
citizens = await self.memory.get("citizens")
|
47
57
|
while True:
|
48
|
-
agents_forward = await self.gather_messages(citizens,
|
58
|
+
agents_forward = await self.gather_messages(citizens, "forward")
|
49
59
|
if np.all(np.array(agents_forward) > self.forward_times):
|
50
60
|
break
|
51
61
|
await asyncio.sleep(1)
|
52
62
|
citizens_agent_id = await self.memory.get("citizens_agent_id")
|
53
|
-
incomes = await self.gather_messages(citizens,
|
54
|
-
_, post_tax_incomes = await self.economy_client.calculate_taxes_due(
|
55
|
-
|
63
|
+
incomes = await self.gather_messages(citizens, "income_currency") # uuid
|
64
|
+
_, post_tax_incomes = await self.economy_client.calculate_taxes_due(
|
65
|
+
self._agent_id, citizens_agent_id, incomes, enable_redistribution=False
|
66
|
+
)
|
67
|
+
for uuid, income, post_tax_income in zip(
|
68
|
+
citizens, incomes, post_tax_incomes
|
69
|
+
):
|
56
70
|
tax_paid = income - post_tax_income
|
57
71
|
await self.send_message_to_agent(uuid, f"tax_paid@{tax_paid}")
|
58
72
|
self.forward_times += 1
|
59
73
|
for uuid in citizens:
|
60
|
-
await self.send_message_to_agent(
|
74
|
+
await self.send_message_to_agent(
|
75
|
+
uuid, f"government_forward@{self.forward_times}"
|
76
|
+
)
|
pycityagent/cityagent/initial.py
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
import random
|
2
|
-
|
2
|
+
|
3
|
+
from pycityagent.cityagent import (BankAgent, FirmAgent, GovernmentAgent,
|
4
|
+
NBSAgent, SocietyAgent)
|
5
|
+
|
3
6
|
|
4
7
|
async def initialize_social_network(simulation):
|
5
8
|
"""
|
@@ -7,25 +10,27 @@ async def initialize_social_network(simulation):
|
|
7
10
|
"""
|
8
11
|
try:
|
9
12
|
print("Initializing social network...")
|
10
|
-
|
13
|
+
|
11
14
|
# 定义可能的关系类型
|
12
15
|
relation_types = ["family", "colleague", "friend"]
|
13
|
-
|
16
|
+
|
14
17
|
# 获取所有智能体ID
|
15
18
|
agent_ids = simulation.agent_uuids
|
16
19
|
for agent_id in agent_ids:
|
17
20
|
# 为每个智能体随机选择2-5个好友
|
18
21
|
num_friends = random.randint(2, 5)
|
19
22
|
possible_friends = [aid for aid in agent_ids if aid != agent_id]
|
20
|
-
friends = random.sample(
|
21
|
-
|
23
|
+
friends = random.sample(
|
24
|
+
possible_friends, min(num_friends, len(possible_friends))
|
25
|
+
)
|
26
|
+
|
22
27
|
# 初始化好友关系
|
23
28
|
await simulation.update(agent_id, "friends", friends)
|
24
|
-
|
29
|
+
|
25
30
|
# 初始化与每个好友的关系类型和关系强度
|
26
31
|
relationships = {}
|
27
32
|
relation_type_map = {}
|
28
|
-
|
33
|
+
|
29
34
|
for friend_id in friends:
|
30
35
|
# 随机选择关系类型
|
31
36
|
relation_type = random.choice(relation_types)
|
@@ -36,31 +41,36 @@ async def initialize_social_network(simulation):
|
|
36
41
|
strength = random.randint(40, 70) # 同事关系强度中等
|
37
42
|
else: # friend
|
38
43
|
strength = random.randint(30, 80) # 朋友关系强度范围较广
|
39
|
-
|
44
|
+
|
40
45
|
relationships[friend_id] = strength
|
41
46
|
relation_type_map[friend_id] = relation_type
|
42
|
-
|
47
|
+
|
43
48
|
# 更新关系强度和类型
|
44
49
|
await simulation.update(agent_id, "relationships", relationships)
|
45
50
|
await simulation.update(agent_id, "relation_types", relation_type_map)
|
46
|
-
|
51
|
+
|
47
52
|
# 初始化空的聊天历史和互动记录
|
48
|
-
await simulation.update(
|
49
|
-
|
50
|
-
|
53
|
+
await simulation.update(
|
54
|
+
agent_id, "chat_histories", {friend_id: [] for friend_id in friends}
|
55
|
+
)
|
56
|
+
await simulation.update(
|
57
|
+
agent_id, "interactions", {friend_id: [] for friend_id in friends}
|
58
|
+
)
|
59
|
+
|
51
60
|
print("Social network initialization completed!")
|
52
61
|
return True
|
53
|
-
|
62
|
+
|
54
63
|
except Exception as e:
|
55
64
|
print(f"Error initializing social network: {str(e)}")
|
56
65
|
return False
|
57
|
-
|
66
|
+
|
67
|
+
|
58
68
|
async def bind_agent_info(simulation):
|
59
69
|
"""
|
60
70
|
绑定智能体的信息,包括公民、公司、政府、银行和NBS的ID
|
61
71
|
"""
|
62
72
|
print("Binding agent info...")
|
63
|
-
infos = await simulation.gather(
|
73
|
+
infos = await simulation.gather("id")
|
64
74
|
citizen_uuids = await simulation.filter(types=[SocietyAgent])
|
65
75
|
firm_uuids = await simulation.filter(types=[FirmAgent])
|
66
76
|
government_uuids = await simulation.filter(types=[GovernmentAgent])
|
@@ -80,19 +90,19 @@ async def bind_agent_info(simulation):
|
|
80
90
|
elif k in nbs_uuids:
|
81
91
|
nbs_id = v
|
82
92
|
for citizen_uuid in citizen_uuids:
|
83
|
-
await simulation.update(citizen_uuid,
|
84
|
-
await simulation.update(citizen_uuid,
|
85
|
-
await simulation.update(citizen_uuid,
|
86
|
-
await simulation.update(citizen_uuid,
|
93
|
+
await simulation.update(citizen_uuid, "firm_id", firm_id)
|
94
|
+
await simulation.update(citizen_uuid, "government_id", government_id)
|
95
|
+
await simulation.update(citizen_uuid, "bank_id", bank_id)
|
96
|
+
await simulation.update(citizen_uuid, "nbs_id", nbs_id)
|
87
97
|
for firm_uuid in firm_uuids:
|
88
|
-
await simulation.update(firm_uuid,
|
89
|
-
await simulation.update(firm_uuid,
|
98
|
+
await simulation.update(firm_uuid, "employees", citizen_uuids)
|
99
|
+
await simulation.update(firm_uuid, "employees_agent_id", citizen_agent_ids)
|
90
100
|
for government_uuid in government_uuids:
|
91
|
-
await simulation.update(government_uuid,
|
92
|
-
await simulation.update(government_uuid,
|
101
|
+
await simulation.update(government_uuid, "citizens", citizen_uuids)
|
102
|
+
await simulation.update(government_uuid, "citizens_agent_id", citizen_agent_ids)
|
93
103
|
for bank_uuid in bank_uuids:
|
94
|
-
await simulation.update(bank_uuid,
|
95
|
-
await simulation.update(bank_uuid,
|
104
|
+
await simulation.update(bank_uuid, "citizens", citizen_uuids)
|
105
|
+
await simulation.update(bank_uuid, "citizens_agent_id", citizen_agent_ids)
|
96
106
|
for nbs_uuid in nbs_uuids:
|
97
|
-
await simulation.update(nbs_uuid,
|
98
|
-
print("Agent info binding completed!")
|
107
|
+
await simulation.update(nbs_uuid, "firm_id", firm_id)
|
108
|
+
print("Agent info binding completed!")
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import random
|
2
|
-
from
|
2
|
+
from collections import deque
|
3
|
+
|
3
4
|
import numpy as np
|
4
5
|
import pycityproto.city.economy.v2.economy_pb2 as economyv2
|
5
|
-
from
|
6
|
+
from mosstool.map._map_util.const import AOI_START_ID
|
6
7
|
|
7
8
|
pareto_param = 8
|
8
9
|
payment_max_skill_multiplier = 950
|
@@ -13,46 +14,63 @@ clipped_skills = np.minimum(pmsm, (pmsm - 1) * pareto_samples + 1)
|
|
13
14
|
sorted_clipped_skills = np.sort(clipped_skills, axis=1)
|
14
15
|
agent_skills = list(sorted_clipped_skills.mean(axis=0))
|
15
16
|
|
17
|
+
|
16
18
|
def memory_config_societyagent():
|
17
19
|
EXTRA_ATTRIBUTES = {
|
18
|
-
"city":
|
19
|
-
|
20
|
+
"city": "New York",
|
20
21
|
# 需求信息
|
21
|
-
"type": (str,
|
22
|
-
"needs": (
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
"type": (str, "citizen"),
|
23
|
+
"needs": (
|
24
|
+
dict,
|
25
|
+
{
|
26
|
+
"hungry": random.random(), # 饥饿感
|
27
|
+
"tired": random.random(), # 疲劳感
|
28
|
+
"safe": random.random(), # 安全需
|
29
|
+
"social": random.random(), # 社会需求
|
30
|
+
},
|
31
|
+
True,
|
32
|
+
),
|
28
33
|
"current_need": (str, "none", True),
|
29
34
|
"current_plan": (list, [], True),
|
30
35
|
"current_step": (dict, {"intention": "", "type": ""}, True),
|
31
|
-
"execution_context"
|
36
|
+
"execution_context": (dict, {}, True),
|
32
37
|
"plan_history": (list, [], True),
|
33
|
-
|
34
38
|
# cognition
|
35
|
-
"emotion": (
|
39
|
+
"emotion": (
|
40
|
+
dict,
|
41
|
+
{
|
42
|
+
"sadness": 5,
|
43
|
+
"joy": 5,
|
44
|
+
"fear": 5,
|
45
|
+
"disgust": 5,
|
46
|
+
"anger": 5,
|
47
|
+
"surprise": 5,
|
48
|
+
},
|
49
|
+
True,
|
50
|
+
),
|
36
51
|
"attitude": (dict, {}, True),
|
37
52
|
"thought": (str, "Currently nothing good or bad is happening", True),
|
38
53
|
"emotion_types": (str, "Relief", True),
|
39
54
|
"incident": (list, [], True),
|
40
|
-
|
41
|
-
"
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
55
|
+
"city": (str, "Texas", True),
|
56
|
+
"work_skill": (
|
57
|
+
float,
|
58
|
+
random.choice(agent_skills),
|
59
|
+
True,
|
60
|
+
), # 工作技能, 即每小时的工资
|
61
|
+
"tax_paid": (float, 0.0, True), # 纳税
|
62
|
+
"consumption_currency": (float, 0.0, True), # 月消费
|
63
|
+
"goods_demand": (int, 0, True),
|
46
64
|
"goods_consumption": (int, 0, True),
|
47
|
-
"work_propensity": (float, 0.0, True),
|
65
|
+
"work_propensity": (float, 0.0, True),
|
48
66
|
"consumption_propensity": (float, 0.0, True),
|
49
|
-
"income_currency": (float, 0.0, True),
|
67
|
+
"income_currency": (float, 0.0, True), # 月收入
|
50
68
|
"to_income": (float, 0.0, True),
|
51
69
|
"to_consumption_currency": (float, 0.0, True),
|
52
70
|
"firm_id": (int, 0, True),
|
53
71
|
"government_id": (int, 0, True),
|
54
72
|
"bank_id": (int, 0, True),
|
55
|
-
|
73
|
+
"nbs_id": (int, 0, True),
|
56
74
|
"dialog_queue": (deque(maxlen=3), [], True),
|
57
75
|
"firm_forward": (int, 0, True),
|
58
76
|
"bank_forward": (int, 0, True),
|
@@ -61,142 +79,236 @@ def memory_config_societyagent():
|
|
61
79
|
"forward": (int, 0, True),
|
62
80
|
"depression": (float, 0.0, True),
|
63
81
|
"ubi_opinion": (list, [], True),
|
64
|
-
|
65
|
-
#social
|
82
|
+
# social
|
66
83
|
"friends": (list, [], True), # 好友列表
|
67
84
|
"relationships": (dict, {}, True), # 与每个好友的关系强度
|
68
85
|
"relation_types": (dict, {}, True),
|
69
86
|
"chat_histories": (dict, {}, True), # 所有聊天历史记录
|
70
87
|
"interactions": (dict, {}, True), # 所有互动记录
|
71
|
-
"to_discuss":(dict, {}, True),
|
72
|
-
|
88
|
+
"to_discuss": (dict, {}, True),
|
73
89
|
# economy
|
74
90
|
"working_experience": (list, [], True),
|
75
91
|
"work_hour_month": (float, 160, True),
|
76
92
|
"work_hour_finish": (float, 0, True),
|
77
|
-
|
78
93
|
# mobility
|
79
94
|
"environment": (str, "The environment outside is good", True),
|
80
95
|
}
|
81
96
|
|
82
97
|
PROFILE = {
|
83
|
-
"name": random.choice(
|
98
|
+
"name": random.choice(
|
99
|
+
[
|
100
|
+
"Alice",
|
101
|
+
"Bob",
|
102
|
+
"Charlie",
|
103
|
+
"David",
|
104
|
+
"Eve",
|
105
|
+
"Frank",
|
106
|
+
"Grace",
|
107
|
+
"Helen",
|
108
|
+
"Ivy",
|
109
|
+
"Jack",
|
110
|
+
"Kelly",
|
111
|
+
"Lily",
|
112
|
+
"Mike",
|
113
|
+
"Nancy",
|
114
|
+
"Oscar",
|
115
|
+
"Peter",
|
116
|
+
"Queen",
|
117
|
+
"Rose",
|
118
|
+
"Sam",
|
119
|
+
"Tom",
|
120
|
+
"Ulysses",
|
121
|
+
"Vicky",
|
122
|
+
"Will",
|
123
|
+
"Xavier",
|
124
|
+
"Yvonne",
|
125
|
+
"Zack",
|
126
|
+
]
|
127
|
+
),
|
84
128
|
"gender": random.choice(["male", "female"]),
|
85
129
|
"age": random.randint(18, 65),
|
86
|
-
"education": random.choice(
|
87
|
-
|
88
|
-
|
130
|
+
"education": random.choice(
|
131
|
+
["Doctor", "Master", "Bachelor", "College", "High School"]
|
132
|
+
),
|
133
|
+
"skill": random.choice(
|
134
|
+
[
|
135
|
+
"Good at problem-solving",
|
136
|
+
"Good at communication",
|
137
|
+
"Good at creativity",
|
138
|
+
"Good at teamwork",
|
139
|
+
"Other",
|
140
|
+
]
|
141
|
+
),
|
142
|
+
"occupation": random.choice(
|
143
|
+
[
|
144
|
+
"Student",
|
145
|
+
"Teacher",
|
146
|
+
"Doctor",
|
147
|
+
"Engineer",
|
148
|
+
"Manager",
|
149
|
+
"Businessman",
|
150
|
+
"Artist",
|
151
|
+
"Athlete",
|
152
|
+
"Other",
|
153
|
+
]
|
154
|
+
),
|
89
155
|
"family_consumption": random.choice(["low", "medium", "high"]),
|
90
156
|
"consumption": random.choice(["sightly low", "low", "medium", "high"]),
|
91
|
-
"personality": random.choice(
|
92
|
-
|
157
|
+
"personality": random.choice(
|
158
|
+
["outgoint", "introvert", "ambivert", "extrovert"]
|
159
|
+
),
|
160
|
+
"income": "0",
|
93
161
|
"currency": random.randint(1000, 100000),
|
94
162
|
"residence": random.choice(["city", "suburb", "rural"]),
|
95
|
-
"race": random.choice(
|
96
|
-
|
97
|
-
|
163
|
+
"race": random.choice(
|
164
|
+
[
|
165
|
+
"Chinese",
|
166
|
+
"American",
|
167
|
+
"British",
|
168
|
+
"French",
|
169
|
+
"German",
|
170
|
+
"Japanese",
|
171
|
+
"Korean",
|
172
|
+
"Russian",
|
173
|
+
"Other",
|
174
|
+
]
|
175
|
+
),
|
176
|
+
"religion": random.choice(
|
177
|
+
["none", "Christian", "Muslim", "Buddhist", "Hindu", "Other"]
|
178
|
+
),
|
179
|
+
"marital_status": random.choice(
|
180
|
+
["not married", "married", "divorced", "widowed"]
|
181
|
+
),
|
98
182
|
}
|
99
183
|
|
100
184
|
BASE = {
|
101
|
-
"home": {
|
102
|
-
|
185
|
+
"home": {
|
186
|
+
"aoi_position": {"aoi_id": AOI_START_ID + random.randint(1000, 10000)}
|
187
|
+
},
|
188
|
+
"work": {
|
189
|
+
"aoi_position": {"aoi_id": AOI_START_ID + random.randint(1000, 10000)}
|
190
|
+
},
|
103
191
|
}
|
104
192
|
|
105
193
|
return EXTRA_ATTRIBUTES, PROFILE, BASE
|
106
194
|
|
195
|
+
|
107
196
|
def memory_config_firm():
|
108
|
-
EXTRA_ATTRIBUTES = {
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
197
|
+
EXTRA_ATTRIBUTES = {
|
198
|
+
"type": (int, economyv2.ORG_TYPE_FIRM),
|
199
|
+
"price": (float, float(np.mean(agent_skills))),
|
200
|
+
"inventory": (int, 0),
|
201
|
+
"employees": (list, []),
|
202
|
+
"employees_agent_id": (list, []),
|
203
|
+
"nominal_gdp": (list, []), # useless
|
204
|
+
"real_gdp": (list, []),
|
205
|
+
"unemployment": (list, []),
|
206
|
+
"wages": (list, []),
|
207
|
+
"prices": (list, [float(np.mean(agent_skills))]),
|
208
|
+
"working_hours": (list, []),
|
209
|
+
"depression": (list, []),
|
210
|
+
"consumption_currency": (list, []),
|
211
|
+
"income_currency": (list, []),
|
212
|
+
"locus_control": (list, []),
|
213
|
+
"bracket_cutoffs": (
|
214
|
+
list,
|
215
|
+
list(np.array([0, 9875, 40125, 85525, 163300, 207350, 518400]) / 12),
|
216
|
+
),
|
217
|
+
"bracket_rates": (list, [0.1, 0.12, 0.22, 0.24, 0.32, 0.35, 0.37]),
|
218
|
+
"interest_rate": (float, 0.03),
|
219
|
+
"citizens": (list, []),
|
220
|
+
"citizens_agent_id": (list, []),
|
221
|
+
"firm_id": (int, 0),
|
222
|
+
}
|
223
|
+
return EXTRA_ATTRIBUTES, {"currency": 1e12}, {}
|
224
|
+
|
130
225
|
|
131
226
|
def memory_config_government():
|
132
|
-
EXTRA_ATTRIBUTES = {
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
227
|
+
EXTRA_ATTRIBUTES = {
|
228
|
+
"type": (int, economyv2.ORG_TYPE_GOVERNMENT),
|
229
|
+
# 'bracket_cutoffs': (list, list(np.array([0, 97, 394.75, 842, 1607.25, 2041, 5103])*100/12)),
|
230
|
+
"bracket_cutoffs": (
|
231
|
+
list,
|
232
|
+
list(np.array([0, 9875, 40125, 85525, 163300, 207350, 518400]) / 12),
|
233
|
+
),
|
234
|
+
"bracket_rates": (list, [0.1, 0.12, 0.22, 0.24, 0.32, 0.35, 0.37]),
|
235
|
+
"citizens": (list, []),
|
236
|
+
"citizens_agent_id": (list, []),
|
237
|
+
"nominal_gdp": (list, []), # useless
|
238
|
+
"real_gdp": (list, []),
|
239
|
+
"unemployment": (list, []),
|
240
|
+
"wages": (list, []),
|
241
|
+
"prices": (list, [float(np.mean(agent_skills))]),
|
242
|
+
"working_hours": (list, []),
|
243
|
+
"depression": (list, []),
|
244
|
+
"consumption_currency": (list, []),
|
245
|
+
"income_currency": (list, []),
|
246
|
+
"locus_control": (list, []),
|
247
|
+
"inventory": (int, 0),
|
248
|
+
"interest_rate": (float, 0.03),
|
249
|
+
"price": (float, float(np.mean(agent_skills))),
|
250
|
+
"employees": (list, []),
|
251
|
+
"employees_agent_id": (list, []),
|
252
|
+
"firm_id": (int, 0),
|
253
|
+
}
|
254
|
+
return EXTRA_ATTRIBUTES, {"currency": 1e12}, {}
|
255
|
+
|
155
256
|
|
156
257
|
def memory_config_bank():
|
157
|
-
EXTRA_ATTRIBUTES = {
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
258
|
+
EXTRA_ATTRIBUTES = {
|
259
|
+
"type": (int, economyv2.ORG_TYPE_BANK),
|
260
|
+
"interest_rate": (float, 0.03),
|
261
|
+
"citizens": (list, []),
|
262
|
+
"citizens_agent_id": (list, []),
|
263
|
+
"bracket_cutoffs": (
|
264
|
+
list,
|
265
|
+
list(np.array([0, 9875, 40125, 85525, 163300, 207350, 518400]) / 12),
|
266
|
+
), # useless
|
267
|
+
"bracket_rates": (list, [0.1, 0.12, 0.22, 0.24, 0.32, 0.35, 0.37]),
|
268
|
+
"inventory": (int, 0),
|
269
|
+
"nominal_gdp": (list, []), # useless
|
270
|
+
"real_gdp": (list, []),
|
271
|
+
"unemployment": (list, []),
|
272
|
+
"wages": (list, []),
|
273
|
+
"prices": (list, [float(np.mean(agent_skills))]),
|
274
|
+
"working_hours": (list, []),
|
275
|
+
"depression": (list, []),
|
276
|
+
"consumption_currency": (list, []),
|
277
|
+
"income_currency": (list, []),
|
278
|
+
"locus_control": (list, []),
|
279
|
+
"price": (float, float(np.mean(agent_skills))),
|
280
|
+
"employees": (list, []),
|
281
|
+
"employees_agent_id": (list, []),
|
282
|
+
"firm_id": (int, 0),
|
283
|
+
}
|
284
|
+
return EXTRA_ATTRIBUTES, {"currency": 1e12}, {}
|
285
|
+
|
179
286
|
|
180
287
|
def memory_config_nbs():
|
181
|
-
EXTRA_ATTRIBUTES = {
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
288
|
+
EXTRA_ATTRIBUTES = {
|
289
|
+
"type": (int, economyv2.ORG_TYPE_NBS),
|
290
|
+
"nominal_gdp": (list, []),
|
291
|
+
"real_gdp": (list, []),
|
292
|
+
"unemployment": (list, []),
|
293
|
+
"wages": (list, []),
|
294
|
+
"prices": (list, [float(np.mean(agent_skills))]),
|
295
|
+
"working_hours": (list, []),
|
296
|
+
"depression": (list, []),
|
297
|
+
"consumption_currency": (list, []),
|
298
|
+
"income_currency": (list, []),
|
299
|
+
"locus_control": (list, []),
|
300
|
+
"citizens": (list, []),
|
301
|
+
"citizens_agent_id": (list, []),
|
302
|
+
"firm_id": (int, 0),
|
303
|
+
"bracket_cutoffs": (
|
304
|
+
list,
|
305
|
+
list(np.array([0, 9875, 40125, 85525, 163300, 207350, 518400]) / 12),
|
306
|
+
), # useless
|
307
|
+
"bracket_rates": (list, [0.1, 0.12, 0.22, 0.24, 0.32, 0.35, 0.37]),
|
308
|
+
"inventory": (int, 0),
|
309
|
+
"interest_rate": (float, 0.03),
|
310
|
+
"price": (float, float(np.mean(agent_skills))),
|
311
|
+
"employees": (list, []),
|
312
|
+
"employees_agent_id": (list, []),
|
313
|
+
}
|
314
|
+
return EXTRA_ATTRIBUTES, {}, {}
|