Skip to content

Commit 294fa5e

Browse files
committed
代码
1 parent 86447d0 commit 294fa5e

1 file changed

Lines changed: 126 additions & 27 deletions

File tree

RX-GMV.py

Lines changed: 126 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,45 +1090,144 @@ def process_step(self, all_states_objects_dict, global_metrics, global_env_facto
10901090
'y3_asp': 6, 'h1_pos': 4, 'h2_inn': 6, 'h3_ris': 3, 's1_tru': 7, 's2_rep': 5},
10911091
{'name_zh': "保守长者", 'name_en': "ConservativeElder", 'b1_res': 7, 'b2_lim': 2, 'y1_cla': 6, 'y2_dri': 3,
10921092
'y3_asp': 5, 'h1_pos': 3, 'h2_inn': 2, 'h3_ris': 1, 's1_tru': 6, 's2_rep': 6},
1093+
### ADDED: 新增特色角色 ###
1094+
{'name_zh': "远见创新者", 'name_en': "VisionaryInnovator",
1095+
'b1_res': 3.0, 'b2_lim': 4.0, 'y1_cla': 7.5, 'y2_dri': 8.5, 'y3_asp': 9.5,
1096+
'h1_pos': 7.0, 'h2_inn': 8.5, 'h3_ris': 7.0, 's1_tru': 6.5, 's2_rep': 4.0},
1097+
1098+
{'name_zh': "迷茫探索者", 'name_en': "WanderingExplorer",
1099+
'b1_res': 4.5, 'b2_lim': 4.0, 'y1_cla': 3.0, 'y2_dri': 5.5, 'y3_asp': 3.5,
1100+
'h1_pos': 6.0, 'h2_inn': 4.0, 'h3_ris': 6.0, 's1_tru': 5.0, 's2_rep': 4.5},
1101+
1102+
{'name_zh': "务实建设者", 'name_en': "PragmaticBuilder",
1103+
'b1_res': 6.5, 'b2_lim': 2.5, 'y1_cla': 8.0, 'y2_dri': 7.0, 'y3_asp': 6.0,
1104+
'h1_pos': 5.5, 'h2_inn': 6.5, 'h3_ris': 4.0, 's1_tru': 7.5, 's2_rep': 6.5},
1105+
1106+
{'name_zh': "愤世批评家", 'name_en': "CynicalCritic",
1107+
'b1_res': 3.5, 'b2_lim': 6.0, 'y1_cla': 7.0, 'y2_dri': 5.0, 'y3_asp': 7.5,
1108+
'h1_pos': 4.0, 'h2_inn': 5.5, 'h3_ris': 3.0, 's1_tru': 4.0, 's2_rep': 5.0},
1109+
### END ADDED ###
10931110
]
10941111

10951112
neighbor_config_gm456 = {
1096-
"CollaborativeLeader": ["Opportunist", "DiligentArtisan", "ConservativeElder"],
1097-
"Opportunist": ["CollaborativeLeader", "Loner"],
1098-
"DiligentArtisan": ["CollaborativeLeader", "ConservativeElder"],
1099-
"Loner": ["Opportunist"],
1100-
"ConservativeElder": ["CollaborativeLeader", "DiligentArtisan"]
1113+
# 原有角色
1114+
"Loner": ["Opportunist", "WanderingExplorer"], # 孤僻者可能只与少数特定类型的人有联系
1115+
"CollaborativeLeader": ["Opportunist", "DiligentArtisan", "ConservativeElder", "VisionaryInnovator",
1116+
"PragmaticBuilder"], # 领导者连接广泛的建设性角色
1117+
"Opportunist": ["CollaborativeLeader", "Loner", "VisionaryInnovator", "WanderingExplorer", "CynicalCritic"],
1118+
# 投机者寻找各种可能性
1119+
"DiligentArtisan": ["CollaborativeLeader", "PragmaticBuilder", "ConservativeElder"], # 工匠与务实和传统角色
1120+
"ConservativeElder": ["CollaborativeLeader", "DiligentArtisan", "PragmaticBuilder"], # 长者与稳定和传统角色
1121+
1122+
# 新增角色
1123+
"VisionaryInnovator": ["CollaborativeLeader", "Opportunist", "WanderingExplorer"], # 创新者可能寻求领导者、吸引投机者,或与探索者交流
1124+
"WanderingExplorer": ["Loner", "Opportunist", "VisionaryInnovator", "CynicalCritic"], # 迷茫者可能与孤僻者、投机者、创新者或批评家有交集
1125+
"PragmaticBuilder": ["CollaborativeLeader", "DiligentArtisan", "ConservativeElder", "VisionaryInnovator"],
1126+
# 建设者与领导者、工匠、长者,也可能与创新者合作将其理念落地
1127+
"CynicalCritic": ["Loner", "Opportunist", "WanderingExplorer"] # 批评家可能与孤僻者、投机者(发现可批评之处)、迷茫者有联系
11011128
}
11021129

1130+
### MODIFIED: Enriched event_definitions_gm456 ###
11031131
event_definitions_gm456 = [
1104-
{'name': "经济周期波动", 'trigger_type': "probabilistic",
1105-
'trigger_params': {'prob': 0.03, 'env_prob_mod_key': 'econ_cycle_event_mod'}, 'target_selector': "all",
1106-
'effects': [
1107-
{'dim': 'b1_resource', 'type': 'multiply_abs', 'val': random.choice([0.92, 1.08]), 'rand_range': 0.03}],
1108-
'chain_event_name': "市场情绪波动", 'chain_event_delay': 1, 'chain_event_prob': 0.4},
1109-
{'name': "市场情绪波动", 'trigger_type': "none", 'trigger_params': {}, 'target_selector': "all",
1110-
'effects': [{'dim': 'mood', 'type': 'add_abs', 'val': random.uniform(-0.3, 0.3), 'rand_range': 0.1}]},
1111-
{'name': "行业革新", 'trigger_type': "probabilistic", 'trigger_params': {'prob': 0.015},
1112-
'target_selector': {'type': 'random_n', 'n': 1},
1113-
'effects': [{'dim': 'h2_innovation', 'type': 'add_abs', 'val': 1.5, 'rand_range': 0.2},
1132+
# --- 经济与资源类事件 ---
1133+
{'name': "经济繁荣周期", 'trigger_type': "probabilistic",
1134+
'trigger_params': {'prob': 0.02, 'env_prob_mod_key': 'econ_cycle_event_mod'}, # OK
1135+
'target_selector': "all",
1136+
'effects': [{'dim': 'b1_resource', 'type': 'multiply_abs', 'val': 1.15, 'rand_range': 0.05},
1137+
{'dim': 'mood', 'type': 'add_abs', 'val': 0.2, 'rand_range': 0.1}],
1138+
'duration': 3, 'chain_event_name': "投资机会涌现", 'chain_event_delay': 1, 'chain_event_prob': 0.6},
1139+
1140+
{'name': "经济衰退周期", 'trigger_type': "probabilistic",
1141+
'trigger_params': {'prob': 0.025, 'env_prob_mod_key': 'econ_cycle_event_mod'}, # OK
1142+
'target_selector': "all",
1143+
'effects': [{'dim': 'b1_resource', 'type': 'multiply_abs', 'val': 0.85, 'rand_range': 0.05},
1144+
{'dim': 'mood', 'type': 'add_abs', 'val': -0.25, 'rand_range': 0.1},
1145+
{'dim': 'h1_possibilities', 'type': 'multiply_abs', 'val': 0.9, 'rand_range': 0.05}],
1146+
'duration': 4, 'chain_event_name': "社会动荡加剧", 'chain_event_delay': 2, 'chain_event_prob': 0.3},
1147+
1148+
{'name': "资源意外发现", 'trigger_type': "probabilistic",
1149+
'trigger_params': {'prob': 0.01}, # OK
1150+
'target_selector': {'type': 'random_n', 'n': 2},
1151+
'effects': [{'dim': 'b1_resource', 'type': 'add_abs', 'val': 2.5, 'rand_range': 0.3},
11141152
{'dim': 'h1_possibilities', 'type': 'add_abs', 'val': 1.0, 'rand_range': 0.2}]},
1115-
{'name': "信任危机 (全局)", 'trigger_type': "conditional_global",
1116-
'trigger_params': {'dim': 'avg_s1_trust', 'op': '<', 'val': 3.8, 'source': 'metrics'}, 'target_selector': "all",
1117-
'effects': [{'dim': 's1_trustworthiness', 'type': 'add_abs', 'val': -0.6, 'rand_range': 0.1}], 'duration': 3,
1153+
1154+
# --- 技术与创新类事件 ---
1155+
{'name': "颠覆性技术突破", 'trigger_type': "probabilistic",
1156+
'trigger_params': {'prob': 0.008}, # OK
1157+
'target_selector': {'type': 'conditional_individual', 'dim': 'h2_innovation', 'op': '>', 'val': 7.0, 'max_targets': 1},
1158+
'effects': [{'dim': 'h2_innovation', 'type': 'set_abs', 'val': 9.5},
1159+
{'dim': 'h1_possibilities', 'type': 'add_abs', 'val': 2.5, 'rand_range': 0.2},
1160+
{'dim': 's2_reputation', 'type': 'add_abs', 'val': 2.0, 'rand_range': 0.2}],
1161+
'one_time': True, 'chain_event_name': "行业格局重塑", 'chain_event_delay': 3, 'chain_event_prob': 0.8},
1162+
1163+
{'name': "行业格局重塑", 'trigger_type': "none",
1164+
'trigger_params': {}, # OK (added in previous fix)
1165+
'target_selector': "all",
1166+
'effects': [{'dim': 'b2_limitation', 'type': 'add_abs', 'val': 0.5, 'rand_range': 0.3},
1167+
{'dim': 'h1_possibilities', 'type': 'add_abs', 'val': 0.5, 'rand_range':0.2}],
1168+
'duration': 5},
1169+
1170+
# --- 社会与认知类事件 ---
1171+
{'name': "信任重建倡议", 'trigger_type': "conditional_global",
1172+
'trigger_params': {'dim': 'avg_s1_trust', 'op': '<', 'val': 3.5, 'source': 'metrics'}, # OK
1173+
'target_selector': "all",
1174+
'effects': [{'dim': 's1_trustworthiness', 'type': 'add_abs', 'val': 0.3, 'rand_range': 0.1},
1175+
{'dim': 'mood', 'type': 'add_abs', 'val': 0.1, 'rand_range': 0.05}],
1176+
'duration': 4, 'one_time': True},
1177+
1178+
{'name': "谣言与误解", 'trigger_type': "probabilistic",
1179+
'trigger_params': {'prob': 0.02}, # OK
1180+
'target_selector': {'type': 'random_n', 'n': 3},
1181+
'effects': [{'dim': 's1_trustworthiness', 'type': 'add_abs', 'val': -0.8, 'rand_range': 0.2},
1182+
{'dim': 'perception_accuracy', 'type': 'multiply_abs', 'val': 0.7, 'rand_range': 0.1}],
1183+
'duration': 3, 'chain_event_name': "信任危机加剧", 'chain_event_delay': 1, 'chain_event_prob': 0.25},
1184+
1185+
{'name': "信任危机加剧", 'trigger_type': "none",
1186+
'trigger_params': {}, # OK (added in previous fix)
1187+
'target_selector': "all",
1188+
'effects': [{'dim': 's1_trustworthiness', 'type': 'add_abs', 'val': -0.3, 'rand_range':0.1}],
1189+
'duration': 2},
1190+
1191+
{'name': "外部共同威胁", 'trigger_type': "probabilistic",
1192+
'trigger_params': {'prob': 0.012}, # OK
1193+
'target_selector': "all",
1194+
'effects': [{'dim': 'b2_limitation', 'type': 'add_abs', 'val': 1.0, 'rand_range': 0.2},
1195+
{'dim': 'mood', 'type': 'add_abs', 'val': -0.3, 'rand_range':0.1}],
1196+
'duration': 5},
1197+
1198+
{'name': "社会思潮启蒙", 'trigger_type': "probabilistic", # Changed from conditional_individual to simplify trigger
1199+
'trigger_params': {'prob': 0.005}, # OK
1200+
'target_selector': {'type': 'conditional_individual', 'dim':'y1_clarity', 'op':'<', 'val':5.0, 'max_targets':2},
1201+
'effects': [{'dim': 'y1_clarity', 'type': 'add_abs', 'val': 2.0, 'rand_range': 0.3},
1202+
{'dim': 'y3_aspiration', 'type': 'add_abs', 'val': 1.5, 'rand_range':0.2}],
11181203
'one_time': True},
1204+
1205+
# --- 个体特殊机遇/危机 (原有事件的调整或保留) ---
1206+
{'name': "投资机会涌现", 'trigger_type': "none", # Triggered by chain
1207+
'trigger_params': {}, # OK
1208+
'target_selector': {'type': 'conditional_individual', 'dim':'h3_risk_appetite', 'op':'>', 'val':5.0, 'max_targets':3},
1209+
'effects': [{'dim': 'b1_resource', 'type': 'add_abs', 'val': 1.0, 'rand_range': 0.5},
1210+
{'dim': 'h1_possibilities', 'type': 'add_abs', 'val': 0.5, 'rand_range': 0.3}]},
1211+
1212+
{'name': "社会动荡加剧", 'trigger_type': "none", # Triggered by chain
1213+
'trigger_params': {}, # OK
1214+
'target_selector': {'type': 'conditional_individual', 'dim':'s1_trustworthiness', 'op':'<', 'val':4.0, 'max_targets':2},
1215+
'effects': [{'dim': 's2_reputation', 'type': 'add_abs', 'val': -1.0, 'rand_range': 0.3},
1216+
{'dim': 'b2_limitation', 'type': 'add_abs', 'val': 0.7, 'rand_range': 0.2}]},
1217+
11191218
{'name': "资源枯竭警告", 'trigger_type': "conditional_individual",
1120-
'trigger_params': {'dim': 'b1_resource', 'op': '<', 'val': 1.0},
1121-
'target_selector': {'type': 'conditional_individual', 'dim': 'b1_resource', 'op': '<', 'val': 1.0,
1122-
'max_targets': 3},
1219+
'trigger_params': {'dim': 'b1_resource', 'op': '<', 'val': 1.0}, # OK
1220+
'target_selector': {'type': 'conditional_individual', 'dim': 'b1_resource', 'op': '<', 'val': 1.0, 'max_targets': 3},
11231221
'effects': [{'dim': 'b2_limitation', 'type': 'add_abs', 'val': 0.5, 'rand_range': 0.2},
1124-
{'dim': 'y2_drive', 'type': 'add_abs', 'val': -0.3, 'rand_range': 0.1}], 'duration': 2,
1125-
'one_time': False},
1222+
{'dim': 'y2_drive', 'type': 'add_abs', 'val': -0.3, 'rand_range': 0.1}],
1223+
'duration': 2, 'one_time': False},
1224+
11261225
{'name': "极端情绪爆发", 'trigger_type': "conditional_individual",
1127-
'trigger_params': {'dim': 'mood', 'op': '<', 'val': -0.85},
1226+
'trigger_params': {'dim': 'mood', 'op': '<', 'val': -0.85}, # OK (was fixed)
11281227
'target_selector': {'type': 'mood_based', 'op': '<', 'val': -0.8, 'max_targets': 2},
1129-
'effects': [{'dim': 'h3_risk_appetite', 'type': 'add_abs', 'val': random.choice([-1.0, 1.5]), 'rand_range': 0.3},
1130-
{'dim': 'y2_drive', 'type': 'multiply_abs', 'val': random.choice([0.7, 1.3])}], 'one_time': True}
1131-
]
1228+
'effects': [{'dim': 'h3_risk_appetite', 'type': 'add_abs', 'val': random.choice([-1.0, 1.5]), 'rand_range':0.3},
1229+
{'dim': 'y2_drive', 'type': 'multiply_abs', 'val': random.choice([0.7, 1.3])}],
1230+
'one_time':True }]
11321231

11331232
default_evolution_params_gm455_complete = {
11341233
'learning_rate': 0.05, 'noise_level': 0.015,

0 commit comments

Comments
 (0)