cogames 0.3.49__py3-none-any.whl → 0.3.64__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cogames/cli/client.py +60 -6
- cogames/cli/docsync/__init__.py +0 -0
- cogames/cli/docsync/_nb_md_directive_processing.py +180 -0
- cogames/cli/docsync/_nb_md_sync.py +103 -0
- cogames/cli/docsync/_nb_py_sync.py +122 -0
- cogames/cli/docsync/_three_way_sync.py +115 -0
- cogames/cli/docsync/_utils.py +76 -0
- cogames/cli/docsync/docsync.py +156 -0
- cogames/cli/leaderboard.py +112 -28
- cogames/cli/mission.py +64 -53
- cogames/cli/policy.py +46 -10
- cogames/cli/submit.py +268 -67
- cogames/cogs_vs_clips/cog.py +79 -0
- cogames/cogs_vs_clips/cogs_vs_clips_mapgen.md +19 -16
- cogames/cogs_vs_clips/cogsguard_reward_variants.py +153 -0
- cogames/cogs_vs_clips/cogsguard_tutorial.py +56 -0
- cogames/cogs_vs_clips/evals/README.md +10 -16
- cogames/cogs_vs_clips/evals/cogsguard_evals.py +81 -0
- cogames/cogs_vs_clips/evals/diagnostic_evals.py +49 -444
- cogames/cogs_vs_clips/evals/difficulty_variants.py +13 -326
- cogames/cogs_vs_clips/evals/integrated_evals.py +5 -45
- cogames/cogs_vs_clips/evals/spanning_evals.py +9 -180
- cogames/cogs_vs_clips/mission.py +187 -146
- cogames/cogs_vs_clips/missions.py +46 -137
- cogames/cogs_vs_clips/procedural.py +8 -8
- cogames/cogs_vs_clips/sites.py +107 -3
- cogames/cogs_vs_clips/stations.py +198 -186
- cogames/cogs_vs_clips/tutorial_missions.py +1 -1
- cogames/cogs_vs_clips/variants.py +25 -476
- cogames/device.py +13 -1
- cogames/{policy/scripted_agent/README.md → docs/SCRIPTED_AGENT.md} +82 -58
- cogames/evaluate.py +18 -30
- cogames/main.py +1434 -243
- cogames/maps/canidate1_1000.map +1 -1
- cogames/maps/canidate1_1000_stations.map +2 -2
- cogames/maps/canidate1_500.map +1 -1
- cogames/maps/canidate1_500_stations.map +2 -2
- cogames/maps/canidate2_1000.map +1 -1
- cogames/maps/canidate2_1000_stations.map +2 -2
- cogames/maps/canidate2_500.map +1 -1
- cogames/maps/canidate2_500_stations.map +2 -2
- cogames/maps/canidate3_1000.map +1 -1
- cogames/maps/canidate3_1000_stations.map +2 -2
- cogames/maps/canidate3_500.map +1 -1
- cogames/maps/canidate3_500_stations.map +2 -2
- cogames/maps/canidate4_500.map +1 -1
- cogames/maps/canidate4_500_stations.map +2 -2
- cogames/maps/cave_base_50.map +2 -2
- cogames/maps/diagnostic_evals/diagnostic_agile.map +2 -2
- cogames/maps/diagnostic_evals/diagnostic_agile_hard.map +2 -2
- cogames/maps/diagnostic_evals/diagnostic_charge_up.map +2 -2
- cogames/maps/diagnostic_evals/diagnostic_charge_up_hard.map +2 -2
- cogames/maps/diagnostic_evals/diagnostic_chest_navigation1.map +2 -2
- cogames/maps/diagnostic_evals/diagnostic_chest_navigation1_hard.map +2 -2
- cogames/maps/diagnostic_evals/diagnostic_chest_navigation2.map +2 -2
- cogames/maps/diagnostic_evals/diagnostic_chest_navigation2_hard.map +2 -2
- cogames/maps/diagnostic_evals/diagnostic_chest_navigation3.map +2 -2
- cogames/maps/diagnostic_evals/diagnostic_chest_navigation3_hard.map +2 -2
- cogames/maps/diagnostic_evals/diagnostic_chest_near.map +2 -2
- cogames/maps/diagnostic_evals/diagnostic_chest_search.map +2 -2
- cogames/maps/diagnostic_evals/diagnostic_chest_search_hard.map +2 -2
- cogames/maps/diagnostic_evals/diagnostic_extract_lab.map +2 -2
- cogames/maps/diagnostic_evals/diagnostic_extract_lab_hard.map +2 -2
- cogames/maps/diagnostic_evals/diagnostic_memory.map +2 -2
- cogames/maps/diagnostic_evals/diagnostic_memory_hard.map +2 -2
- cogames/maps/diagnostic_evals/diagnostic_radial.map +2 -2
- cogames/maps/diagnostic_evals/diagnostic_radial_hard.map +2 -2
- cogames/maps/diagnostic_evals/diagnostic_resource_lab.map +2 -2
- cogames/maps/diagnostic_evals/diagnostic_unclip.map +2 -2
- cogames/maps/evals/eval_balanced_spread.map +9 -5
- cogames/maps/evals/eval_clip_oxygen.map +9 -5
- cogames/maps/evals/eval_collect_resources.map +9 -5
- cogames/maps/evals/eval_collect_resources_hard.map +9 -5
- cogames/maps/evals/eval_collect_resources_medium.map +9 -5
- cogames/maps/evals/eval_divide_and_conquer.map +9 -5
- cogames/maps/evals/eval_energy_starved.map +9 -5
- cogames/maps/evals/eval_multi_coordinated_collect_hard.map +9 -5
- cogames/maps/evals/eval_oxygen_bottleneck.map +9 -5
- cogames/maps/evals/eval_single_use_world.map +9 -5
- cogames/maps/evals/extractor_hub_100x100.map +9 -5
- cogames/maps/evals/extractor_hub_30x30.map +9 -5
- cogames/maps/evals/extractor_hub_50x50.map +9 -5
- cogames/maps/evals/extractor_hub_70x70.map +9 -5
- cogames/maps/evals/extractor_hub_80x80.map +9 -5
- cogames/maps/machina_100_stations.map +2 -2
- cogames/maps/machina_200_stations.map +2 -2
- cogames/maps/machina_200_stations_small.map +2 -2
- cogames/maps/machina_eval_exp01.map +2 -2
- cogames/maps/machina_eval_template_large.map +2 -2
- cogames/maps/machinatrainer4agents.map +2 -2
- cogames/maps/machinatrainer4agentsbase.map +2 -2
- cogames/maps/machinatrainerbig.map +2 -2
- cogames/maps/machinatrainersmall.map +2 -2
- cogames/maps/planky_evals/aligner_avoid_aoe.map +28 -0
- cogames/maps/planky_evals/aligner_full_cycle.map +28 -0
- cogames/maps/planky_evals/aligner_gear.map +24 -0
- cogames/maps/planky_evals/aligner_hearts.map +24 -0
- cogames/maps/planky_evals/aligner_junction.map +26 -0
- cogames/maps/planky_evals/exploration_distant.map +28 -0
- cogames/maps/planky_evals/maze.map +32 -0
- cogames/maps/planky_evals/miner_best_resource.map +26 -0
- cogames/maps/planky_evals/miner_deposit.map +24 -0
- cogames/maps/planky_evals/miner_extract.map +26 -0
- cogames/maps/planky_evals/miner_full_cycle.map +28 -0
- cogames/maps/planky_evals/miner_gear.map +24 -0
- cogames/maps/planky_evals/multi_role.map +28 -0
- cogames/maps/planky_evals/resource_chain.map +30 -0
- cogames/maps/planky_evals/scout_explore.map +32 -0
- cogames/maps/planky_evals/scout_gear.map +24 -0
- cogames/maps/planky_evals/scrambler_full_cycle.map +28 -0
- cogames/maps/planky_evals/scrambler_gear.map +24 -0
- cogames/maps/planky_evals/scrambler_target.map +26 -0
- cogames/maps/planky_evals/stuck_corridor.map +32 -0
- cogames/maps/planky_evals/survive_retreat.map +26 -0
- cogames/maps/training_facility_clipped.map +2 -2
- cogames/maps/training_facility_open_1.map +2 -2
- cogames/maps/training_facility_open_2.map +2 -2
- cogames/maps/training_facility_open_3.map +2 -2
- cogames/maps/training_facility_tight_4.map +2 -2
- cogames/maps/training_facility_tight_5.map +2 -2
- cogames/maps/vanilla_large.map +2 -2
- cogames/maps/vanilla_small.map +2 -2
- cogames/pickup.py +183 -0
- cogames/play.py +166 -33
- cogames/policy/chaos_monkey.py +54 -0
- cogames/policy/nim_agents/__init__.py +27 -10
- cogames/policy/nim_agents/agents.py +121 -60
- cogames/policy/nim_agents/thinky_eval.py +35 -222
- cogames/policy/pufferlib_policy.py +67 -32
- cogames/policy/starter_agent.py +184 -0
- cogames/policy/trainable_policy_template.py +4 -1
- cogames/train.py +51 -13
- cogames/verbose.py +2 -2
- cogames-0.3.64.dist-info/METADATA +1842 -0
- cogames-0.3.64.dist-info/RECORD +159 -0
- cogames-0.3.64.dist-info/licenses/LICENSE +21 -0
- cogames-0.3.64.dist-info/top_level.txt +2 -0
- metta_alo/__init__.py +0 -0
- metta_alo/job_specs.py +17 -0
- metta_alo/policy.py +16 -0
- metta_alo/pure_single_episode_runner.py +75 -0
- metta_alo/py.typed +0 -0
- metta_alo/rollout.py +322 -0
- metta_alo/scoring.py +168 -0
- cogames/maps/diagnostic_evals/diagnostic_assembler_near.map +0 -49
- cogames/maps/diagnostic_evals/diagnostic_assembler_search.map +0 -49
- cogames/maps/diagnostic_evals/diagnostic_assembler_search_hard.map +0 -89
- cogames/policy/nim_agents/common.nim +0 -887
- cogames/policy/nim_agents/install.sh +0 -1
- cogames/policy/nim_agents/ladybug_agent.nim +0 -984
- cogames/policy/nim_agents/nim_agents.nim +0 -55
- cogames/policy/nim_agents/nim_agents.nims +0 -14
- cogames/policy/nim_agents/nimby.lock +0 -3
- cogames/policy/nim_agents/racecar_agents.nim +0 -884
- cogames/policy/nim_agents/random_agents.nim +0 -68
- cogames/policy/nim_agents/test_agents.py +0 -53
- cogames/policy/nim_agents/thinky_agents.nim +0 -717
- cogames/policy/scripted_agent/baseline_agent.py +0 -1049
- cogames/policy/scripted_agent/demo_policy.py +0 -244
- cogames/policy/scripted_agent/pathfinding.py +0 -126
- cogames/policy/scripted_agent/starter_agent.py +0 -136
- cogames/policy/scripted_agent/types.py +0 -235
- cogames/policy/scripted_agent/unclipping_agent.py +0 -476
- cogames/policy/scripted_agent/utils.py +0 -385
- cogames-0.3.49.dist-info/METADATA +0 -406
- cogames-0.3.49.dist-info/RECORD +0 -136
- cogames-0.3.49.dist-info/top_level.txt +0 -1
- {cogames-0.3.49.dist-info → cogames-0.3.64.dist-info}/WHEEL +0 -0
- {cogames-0.3.49.dist-info → cogames-0.3.64.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type: mettagrid.map_builder.ascii.AsciiMapBuilder.Config
|
|
2
|
+
map_data: |-
|
|
3
|
+
###########
|
|
4
|
+
#.........#
|
|
5
|
+
#..@......#
|
|
6
|
+
#.........#
|
|
7
|
+
#..M..&...#
|
|
8
|
+
#.........#
|
|
9
|
+
###########
|
|
10
|
+
char_to_map_name:
|
|
11
|
+
"#": wall
|
|
12
|
+
".": empty
|
|
13
|
+
"@": agent.agent
|
|
14
|
+
"M": miner_station
|
|
15
|
+
"S": scout_station
|
|
16
|
+
"A": aligner_station
|
|
17
|
+
"X": scrambler_station
|
|
18
|
+
"C": carbon_extractor
|
|
19
|
+
"O": oxygen_extractor
|
|
20
|
+
"G": germanium_extractor
|
|
21
|
+
"I": silicon_extractor
|
|
22
|
+
"J": junction
|
|
23
|
+
"&": hub
|
|
24
|
+
"=": chest
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
type: mettagrid.map_builder.ascii.AsciiMapBuilder.Config
|
|
2
|
+
map_data: |-
|
|
3
|
+
#########
|
|
4
|
+
#.......#
|
|
5
|
+
#..@....#
|
|
6
|
+
#.......#
|
|
7
|
+
#..M....#
|
|
8
|
+
#.......#
|
|
9
|
+
#..C....#
|
|
10
|
+
#.......#
|
|
11
|
+
#########
|
|
12
|
+
char_to_map_name:
|
|
13
|
+
"#": wall
|
|
14
|
+
".": empty
|
|
15
|
+
"@": agent.agent
|
|
16
|
+
"M": miner_station
|
|
17
|
+
"S": scout_station
|
|
18
|
+
"A": aligner_station
|
|
19
|
+
"X": scrambler_station
|
|
20
|
+
"C": carbon_extractor
|
|
21
|
+
"O": oxygen_extractor
|
|
22
|
+
"G": germanium_extractor
|
|
23
|
+
"I": silicon_extractor
|
|
24
|
+
"J": junction
|
|
25
|
+
"&": hub
|
|
26
|
+
"=": chest
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type: mettagrid.map_builder.ascii.AsciiMapBuilder.Config
|
|
2
|
+
map_data: |-
|
|
3
|
+
#############
|
|
4
|
+
#...........#
|
|
5
|
+
#..@........#
|
|
6
|
+
#...........#
|
|
7
|
+
#..M........#
|
|
8
|
+
#...........#
|
|
9
|
+
#..C........#
|
|
10
|
+
#...........#
|
|
11
|
+
#..&........#
|
|
12
|
+
#...........#
|
|
13
|
+
#############
|
|
14
|
+
char_to_map_name:
|
|
15
|
+
"#": wall
|
|
16
|
+
".": empty
|
|
17
|
+
"@": agent.agent
|
|
18
|
+
"M": miner_station
|
|
19
|
+
"S": scout_station
|
|
20
|
+
"A": aligner_station
|
|
21
|
+
"X": scrambler_station
|
|
22
|
+
"C": carbon_extractor
|
|
23
|
+
"O": oxygen_extractor
|
|
24
|
+
"G": germanium_extractor
|
|
25
|
+
"I": silicon_extractor
|
|
26
|
+
"J": junction
|
|
27
|
+
"&": hub
|
|
28
|
+
"=": chest
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type: mettagrid.map_builder.ascii.AsciiMapBuilder.Config
|
|
2
|
+
map_data: |-
|
|
3
|
+
#######
|
|
4
|
+
#.....#
|
|
5
|
+
#..@..#
|
|
6
|
+
#.....#
|
|
7
|
+
#..M..#
|
|
8
|
+
#.....#
|
|
9
|
+
#######
|
|
10
|
+
char_to_map_name:
|
|
11
|
+
"#": wall
|
|
12
|
+
".": empty
|
|
13
|
+
"@": agent.agent
|
|
14
|
+
"M": miner_station
|
|
15
|
+
"S": scout_station
|
|
16
|
+
"A": aligner_station
|
|
17
|
+
"X": scrambler_station
|
|
18
|
+
"C": carbon_extractor
|
|
19
|
+
"O": oxygen_extractor
|
|
20
|
+
"G": germanium_extractor
|
|
21
|
+
"I": silicon_extractor
|
|
22
|
+
"J": junction
|
|
23
|
+
"&": hub
|
|
24
|
+
"=": chest
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type: mettagrid.map_builder.ascii.AsciiMapBuilder.Config
|
|
2
|
+
map_data: |-
|
|
3
|
+
#################
|
|
4
|
+
#...............#
|
|
5
|
+
#..@.@.@.@......#
|
|
6
|
+
#...............#
|
|
7
|
+
#..M..S..A..X...#
|
|
8
|
+
#...............#
|
|
9
|
+
#..C..=..J..&...#
|
|
10
|
+
#...............#
|
|
11
|
+
#...............#
|
|
12
|
+
#...............#
|
|
13
|
+
#################
|
|
14
|
+
char_to_map_name:
|
|
15
|
+
"#": wall
|
|
16
|
+
".": empty
|
|
17
|
+
"@": agent.agent
|
|
18
|
+
"M": miner_station
|
|
19
|
+
"S": scout_station
|
|
20
|
+
"A": aligner_station
|
|
21
|
+
"X": scrambler_station
|
|
22
|
+
"C": carbon_extractor
|
|
23
|
+
"O": oxygen_extractor
|
|
24
|
+
"G": germanium_extractor
|
|
25
|
+
"I": silicon_extractor
|
|
26
|
+
"J": junction
|
|
27
|
+
"&": hub
|
|
28
|
+
"=": chest
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type: mettagrid.map_builder.ascii.AsciiMapBuilder.Config
|
|
2
|
+
map_data: |-
|
|
3
|
+
###############
|
|
4
|
+
#.............#
|
|
5
|
+
#..@..........#
|
|
6
|
+
#.............#
|
|
7
|
+
#..M..........#
|
|
8
|
+
#.............#
|
|
9
|
+
#..C..O.......#
|
|
10
|
+
#.............#
|
|
11
|
+
#..G..I.......#
|
|
12
|
+
#.............#
|
|
13
|
+
#..&..........#
|
|
14
|
+
#.............#
|
|
15
|
+
###############
|
|
16
|
+
char_to_map_name:
|
|
17
|
+
"#": wall
|
|
18
|
+
".": empty
|
|
19
|
+
"@": agent.agent
|
|
20
|
+
"M": miner_station
|
|
21
|
+
"S": scout_station
|
|
22
|
+
"A": aligner_station
|
|
23
|
+
"X": scrambler_station
|
|
24
|
+
"C": carbon_extractor
|
|
25
|
+
"O": oxygen_extractor
|
|
26
|
+
"G": germanium_extractor
|
|
27
|
+
"I": silicon_extractor
|
|
28
|
+
"J": junction
|
|
29
|
+
"&": hub
|
|
30
|
+
"=": chest
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type: mettagrid.map_builder.ascii.AsciiMapBuilder.Config
|
|
2
|
+
map_data: |-
|
|
3
|
+
###############
|
|
4
|
+
#.............#
|
|
5
|
+
#.............#
|
|
6
|
+
#.............#
|
|
7
|
+
#.............#
|
|
8
|
+
#.............#
|
|
9
|
+
#.............#
|
|
10
|
+
#..@..........#
|
|
11
|
+
#.............#
|
|
12
|
+
#..S..........#
|
|
13
|
+
#.............#
|
|
14
|
+
#.............#
|
|
15
|
+
#.............#
|
|
16
|
+
#.............#
|
|
17
|
+
###############
|
|
18
|
+
char_to_map_name:
|
|
19
|
+
"#": wall
|
|
20
|
+
".": empty
|
|
21
|
+
"@": agent.agent
|
|
22
|
+
"M": miner_station
|
|
23
|
+
"S": scout_station
|
|
24
|
+
"A": aligner_station
|
|
25
|
+
"X": scrambler_station
|
|
26
|
+
"C": carbon_extractor
|
|
27
|
+
"O": oxygen_extractor
|
|
28
|
+
"G": germanium_extractor
|
|
29
|
+
"I": silicon_extractor
|
|
30
|
+
"J": junction
|
|
31
|
+
"&": hub
|
|
32
|
+
"=": chest
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type: mettagrid.map_builder.ascii.AsciiMapBuilder.Config
|
|
2
|
+
map_data: |-
|
|
3
|
+
#########
|
|
4
|
+
#.......#
|
|
5
|
+
#..@....#
|
|
6
|
+
#.......#
|
|
7
|
+
#..S....#
|
|
8
|
+
#.......#
|
|
9
|
+
#########
|
|
10
|
+
char_to_map_name:
|
|
11
|
+
"#": wall
|
|
12
|
+
".": empty
|
|
13
|
+
"@": agent.agent
|
|
14
|
+
"M": miner_station
|
|
15
|
+
"S": scout_station
|
|
16
|
+
"A": aligner_station
|
|
17
|
+
"X": scrambler_station
|
|
18
|
+
"C": carbon_extractor
|
|
19
|
+
"O": oxygen_extractor
|
|
20
|
+
"G": germanium_extractor
|
|
21
|
+
"I": silicon_extractor
|
|
22
|
+
"J": junction
|
|
23
|
+
"&": hub
|
|
24
|
+
"=": chest
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type: mettagrid.map_builder.ascii.AsciiMapBuilder.Config
|
|
2
|
+
map_data: |-
|
|
3
|
+
#################
|
|
4
|
+
#...............#
|
|
5
|
+
#..@............#
|
|
6
|
+
#...............#
|
|
7
|
+
#..X............#
|
|
8
|
+
#...............#
|
|
9
|
+
#..=............#
|
|
10
|
+
#...............#
|
|
11
|
+
#..........J....#
|
|
12
|
+
#...............#
|
|
13
|
+
#################
|
|
14
|
+
char_to_map_name:
|
|
15
|
+
"#": wall
|
|
16
|
+
".": empty
|
|
17
|
+
"@": agent.agent
|
|
18
|
+
"M": miner_station
|
|
19
|
+
"S": scout_station
|
|
20
|
+
"A": aligner_station
|
|
21
|
+
"X": scrambler_station
|
|
22
|
+
"C": carbon_extractor
|
|
23
|
+
"O": oxygen_extractor
|
|
24
|
+
"G": germanium_extractor
|
|
25
|
+
"I": silicon_extractor
|
|
26
|
+
"J": junction
|
|
27
|
+
"&": hub
|
|
28
|
+
"=": chest
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type: mettagrid.map_builder.ascii.AsciiMapBuilder.Config
|
|
2
|
+
map_data: |-
|
|
3
|
+
#########
|
|
4
|
+
#.......#
|
|
5
|
+
#..@....#
|
|
6
|
+
#.......#
|
|
7
|
+
#..X....#
|
|
8
|
+
#.......#
|
|
9
|
+
#########
|
|
10
|
+
char_to_map_name:
|
|
11
|
+
"#": wall
|
|
12
|
+
".": empty
|
|
13
|
+
"@": agent.agent
|
|
14
|
+
"M": miner_station
|
|
15
|
+
"S": scout_station
|
|
16
|
+
"A": aligner_station
|
|
17
|
+
"X": scrambler_station
|
|
18
|
+
"C": carbon_extractor
|
|
19
|
+
"O": oxygen_extractor
|
|
20
|
+
"G": germanium_extractor
|
|
21
|
+
"I": silicon_extractor
|
|
22
|
+
"J": junction
|
|
23
|
+
"&": hub
|
|
24
|
+
"=": chest
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
type: mettagrid.map_builder.ascii.AsciiMapBuilder.Config
|
|
2
|
+
map_data: |-
|
|
3
|
+
#############
|
|
4
|
+
#...........#
|
|
5
|
+
#..@........#
|
|
6
|
+
#...........#
|
|
7
|
+
#..X..=.....#
|
|
8
|
+
#...........#
|
|
9
|
+
#........J..#
|
|
10
|
+
#...........#
|
|
11
|
+
#############
|
|
12
|
+
char_to_map_name:
|
|
13
|
+
"#": wall
|
|
14
|
+
".": empty
|
|
15
|
+
"@": agent.agent
|
|
16
|
+
"M": miner_station
|
|
17
|
+
"S": scout_station
|
|
18
|
+
"A": aligner_station
|
|
19
|
+
"X": scrambler_station
|
|
20
|
+
"C": carbon_extractor
|
|
21
|
+
"O": oxygen_extractor
|
|
22
|
+
"G": germanium_extractor
|
|
23
|
+
"I": silicon_extractor
|
|
24
|
+
"J": junction
|
|
25
|
+
"&": hub
|
|
26
|
+
"=": chest
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type: mettagrid.map_builder.ascii.AsciiMapBuilder.Config
|
|
2
|
+
map_data: |-
|
|
3
|
+
#########
|
|
4
|
+
#..@....#
|
|
5
|
+
#.......#
|
|
6
|
+
#.####..#
|
|
7
|
+
#.......#
|
|
8
|
+
#..####.#
|
|
9
|
+
#.......#
|
|
10
|
+
#.####..#
|
|
11
|
+
#.......#
|
|
12
|
+
#..####.#
|
|
13
|
+
#.......#
|
|
14
|
+
#.####..#
|
|
15
|
+
#.......#
|
|
16
|
+
#..M..C.#
|
|
17
|
+
#########
|
|
18
|
+
char_to_map_name:
|
|
19
|
+
"#": wall
|
|
20
|
+
".": empty
|
|
21
|
+
"@": agent.agent
|
|
22
|
+
"M": miner_station
|
|
23
|
+
"S": scout_station
|
|
24
|
+
"A": aligner_station
|
|
25
|
+
"X": scrambler_station
|
|
26
|
+
"C": carbon_extractor
|
|
27
|
+
"O": oxygen_extractor
|
|
28
|
+
"G": germanium_extractor
|
|
29
|
+
"I": silicon_extractor
|
|
30
|
+
"J": junction
|
|
31
|
+
"&": hub
|
|
32
|
+
"=": chest
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
type: mettagrid.map_builder.ascii.AsciiMapBuilder.Config
|
|
2
|
+
map_data: |-
|
|
3
|
+
###############
|
|
4
|
+
#.............#
|
|
5
|
+
#.............#
|
|
6
|
+
#.............#
|
|
7
|
+
#..&..........#
|
|
8
|
+
#.............#
|
|
9
|
+
#...........@.#
|
|
10
|
+
#..M..........#
|
|
11
|
+
###############
|
|
12
|
+
char_to_map_name:
|
|
13
|
+
"#": wall
|
|
14
|
+
".": empty
|
|
15
|
+
"@": agent.agent
|
|
16
|
+
"M": miner_station
|
|
17
|
+
"S": scout_station
|
|
18
|
+
"A": aligner_station
|
|
19
|
+
"X": scrambler_station
|
|
20
|
+
"C": carbon_extractor
|
|
21
|
+
"O": oxygen_extractor
|
|
22
|
+
"G": germanium_extractor
|
|
23
|
+
"I": silicon_extractor
|
|
24
|
+
"J": junction
|
|
25
|
+
"&": hub
|
|
26
|
+
"=": chest
|
|
@@ -36,9 +36,9 @@ char_to_map_name:
|
|
|
36
36
|
".": empty
|
|
37
37
|
"B": clipped_carbon_extractor
|
|
38
38
|
"N": clipped_oxygen_extractor
|
|
39
|
-
"+":
|
|
39
|
+
"+": junction
|
|
40
40
|
"@": agent.agent
|
|
41
|
-
"&":
|
|
41
|
+
"&": hub
|
|
42
42
|
"=": chest
|
|
43
43
|
"F": clipped_germanium_extractor
|
|
44
44
|
"R": clipped_silicon_extractor
|
cogames/maps/vanilla_large.map
CHANGED
cogames/maps/vanilla_small.map
CHANGED
cogames/pickup.py
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Optional
|
|
6
|
+
|
|
7
|
+
import numpy as np
|
|
8
|
+
import typer
|
|
9
|
+
from rich.console import Console
|
|
10
|
+
from rich.table import Table
|
|
11
|
+
|
|
12
|
+
from metta_alo.rollout import run_multi_episode_rollout
|
|
13
|
+
from metta_alo.scoring import (
|
|
14
|
+
VorTotals,
|
|
15
|
+
allocate_counts,
|
|
16
|
+
overall_value_over_replacement,
|
|
17
|
+
summarize_vor_scenario,
|
|
18
|
+
value_over_replacement,
|
|
19
|
+
)
|
|
20
|
+
from mettagrid import MettaGridConfig
|
|
21
|
+
from mettagrid.mapgen.mapgen import MapGen
|
|
22
|
+
from mettagrid.policy.policy import PolicySpec
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@dataclass(frozen=True)
|
|
26
|
+
class PickupScenario:
|
|
27
|
+
candidate_count: int
|
|
28
|
+
pool_counts: list[int]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@dataclass(frozen=True)
|
|
32
|
+
class PickupScenarioResult:
|
|
33
|
+
scenario: PickupScenario
|
|
34
|
+
candidate_mean: Optional[float]
|
|
35
|
+
replacement_mean: Optional[float]
|
|
36
|
+
replay_paths: list[str]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def pickup(
|
|
40
|
+
console: Console,
|
|
41
|
+
candidate_spec: PolicySpec,
|
|
42
|
+
pool_specs: list[PolicySpec],
|
|
43
|
+
*,
|
|
44
|
+
env_cfg: MettaGridConfig,
|
|
45
|
+
mission_name: str,
|
|
46
|
+
episodes: int,
|
|
47
|
+
seed: int,
|
|
48
|
+
map_seed: Optional[int],
|
|
49
|
+
action_timeout_ms: int,
|
|
50
|
+
save_replay_dir: Optional[Path],
|
|
51
|
+
candidate_label: Optional[str] = None,
|
|
52
|
+
pool_labels: Optional[list[str]] = None,
|
|
53
|
+
) -> None:
|
|
54
|
+
num_cogs = env_cfg.game.num_agents
|
|
55
|
+
effective_map_seed = map_seed if map_seed is not None else seed
|
|
56
|
+
if effective_map_seed is not None:
|
|
57
|
+
map_builder = getattr(env_cfg.game, "map_builder", None)
|
|
58
|
+
if isinstance(map_builder, MapGen.Config):
|
|
59
|
+
map_builder.seed = effective_map_seed
|
|
60
|
+
policy_specs = [candidate_spec, *pool_specs]
|
|
61
|
+
|
|
62
|
+
scenarios: list[PickupScenario] = [
|
|
63
|
+
PickupScenario(
|
|
64
|
+
candidate_count=candidate_count,
|
|
65
|
+
pool_counts=allocate_counts(num_cogs - candidate_count, [1.0] * len(pool_specs), allow_zero_total=True),
|
|
66
|
+
)
|
|
67
|
+
for candidate_count in range(num_cogs, -1, -1)
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
console.print("[bold cyan]Pickup Evaluation[/bold cyan]")
|
|
71
|
+
console.print(f"[dim]Mission: {mission_name} | cogs={num_cogs} | episodes={episodes} | seed={seed}[/dim]")
|
|
72
|
+
candidate_display = candidate_label or candidate_spec.name
|
|
73
|
+
pool_display = pool_labels or [spec.name for spec in pool_specs]
|
|
74
|
+
|
|
75
|
+
console.print(f"Candidate: [bold]{candidate_display}[/bold]")
|
|
76
|
+
console.print("Pool: " + ", ".join(f"{idx + 1}:{label}" for idx, label in enumerate(pool_display)))
|
|
77
|
+
|
|
78
|
+
results: list[PickupScenarioResult] = []
|
|
79
|
+
totals = VorTotals()
|
|
80
|
+
rng = np.random.default_rng(seed)
|
|
81
|
+
|
|
82
|
+
with typer.progressbar(scenarios, label="Simulating") as progress:
|
|
83
|
+
for scenario in progress:
|
|
84
|
+
assignments = np.repeat(np.arange(len(policy_specs)), [scenario.candidate_count, *scenario.pool_counts])
|
|
85
|
+
|
|
86
|
+
rollout, replay_paths = run_multi_episode_rollout(
|
|
87
|
+
policy_specs=policy_specs,
|
|
88
|
+
assignments=assignments,
|
|
89
|
+
env_cfg=env_cfg,
|
|
90
|
+
episodes=episodes,
|
|
91
|
+
seed=seed,
|
|
92
|
+
max_action_time_ms=action_timeout_ms,
|
|
93
|
+
replay_dir=save_replay_dir,
|
|
94
|
+
rng=rng,
|
|
95
|
+
device="cpu",
|
|
96
|
+
)
|
|
97
|
+
summary = summarize_vor_scenario(
|
|
98
|
+
rollout,
|
|
99
|
+
candidate_policy_index=0,
|
|
100
|
+
candidate_count=scenario.candidate_count,
|
|
101
|
+
)
|
|
102
|
+
results.append(
|
|
103
|
+
PickupScenarioResult(
|
|
104
|
+
scenario=scenario,
|
|
105
|
+
candidate_mean=summary.candidate_mean,
|
|
106
|
+
replacement_mean=summary.replacement_mean,
|
|
107
|
+
replay_paths=replay_paths,
|
|
108
|
+
)
|
|
109
|
+
)
|
|
110
|
+
totals.update(scenario.candidate_count, summary)
|
|
111
|
+
|
|
112
|
+
table = Table(show_header=True, header_style="bold magenta")
|
|
113
|
+
table.add_column("Scenario")
|
|
114
|
+
table.add_column("Candidate", justify="right")
|
|
115
|
+
table.add_column("Pool Mix", justify="right")
|
|
116
|
+
table.add_column("Score", justify="right")
|
|
117
|
+
|
|
118
|
+
for result in results:
|
|
119
|
+
scenario = result.scenario
|
|
120
|
+
pool_mix = "/".join(str(count) for count in scenario.pool_counts)
|
|
121
|
+
short_mission = mission_name.split(".")[-1] if "." in mission_name else mission_name
|
|
122
|
+
scenario_name = f"{short_mission}-c{scenario.candidate_count}-r{sum(scenario.pool_counts)}"
|
|
123
|
+
if scenario.candidate_count == 0:
|
|
124
|
+
score = result.replacement_mean
|
|
125
|
+
else:
|
|
126
|
+
score = result.candidate_mean
|
|
127
|
+
score_text = f"{score:.2f}" if score is not None else "-"
|
|
128
|
+
table.add_row(
|
|
129
|
+
scenario_name,
|
|
130
|
+
str(scenario.candidate_count),
|
|
131
|
+
pool_mix,
|
|
132
|
+
score_text,
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
console.print("\n[bold cyan]Scenario Scores[/bold cyan]")
|
|
136
|
+
console.print(table)
|
|
137
|
+
|
|
138
|
+
if totals.replacement_mean is None:
|
|
139
|
+
console.print("[yellow]No replacement baseline available (missing c0 scenario).[/yellow]")
|
|
140
|
+
if save_replay_dir:
|
|
141
|
+
console.print(f"[dim]Replays saved to {save_replay_dir}[/dim]")
|
|
142
|
+
return
|
|
143
|
+
|
|
144
|
+
console.print(f"\n[bold cyan]Replacement Baseline[/bold cyan] {totals.replacement_mean:.2f}")
|
|
145
|
+
|
|
146
|
+
vor_table = Table(show_header=True, header_style="bold magenta")
|
|
147
|
+
vor_table.add_column("Candidate Count", justify="right")
|
|
148
|
+
vor_table.add_column("Candidate Score", justify="right")
|
|
149
|
+
vor_table.add_column("VOR", justify="right")
|
|
150
|
+
|
|
151
|
+
for result in results:
|
|
152
|
+
scenario = result.scenario
|
|
153
|
+
if scenario.candidate_count == 0:
|
|
154
|
+
continue
|
|
155
|
+
if result.candidate_mean is None:
|
|
156
|
+
candidate_score = None
|
|
157
|
+
vor = None
|
|
158
|
+
else:
|
|
159
|
+
candidate_score = result.candidate_mean
|
|
160
|
+
vor = value_over_replacement(candidate_score, totals.replacement_mean)
|
|
161
|
+
|
|
162
|
+
candidate_text = f"{candidate_score:.2f}" if candidate_score is not None else "-"
|
|
163
|
+
vor_text = f"{vor:.2f}" if vor is not None else "-"
|
|
164
|
+
vor_table.add_row(str(scenario.candidate_count), candidate_text, vor_text)
|
|
165
|
+
|
|
166
|
+
console.print("\n[bold cyan]Value Over Replacement[/bold cyan]")
|
|
167
|
+
console.print(vor_table)
|
|
168
|
+
|
|
169
|
+
overall_vor = overall_value_over_replacement(
|
|
170
|
+
totals.total_candidate_weighted_sum,
|
|
171
|
+
totals.total_candidate_agents,
|
|
172
|
+
totals.replacement_mean,
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
if overall_vor is not None:
|
|
176
|
+
console.print(f"\n[bold cyan]Overall VOR[/bold cyan] {overall_vor:.2f}")
|
|
177
|
+
|
|
178
|
+
if pool_specs:
|
|
179
|
+
pool_names = ", ".join(spec.name for spec in pool_specs)
|
|
180
|
+
console.print(f"[dim]Pool order for mix column: {pool_names}[/dim]")
|
|
181
|
+
|
|
182
|
+
if save_replay_dir:
|
|
183
|
+
console.print(f"[dim]Replays saved to {save_replay_dir}[/dim]")
|