cogames-agents 0.0.0.7__cp312-cp312-macosx_11_0_arm64.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_agents/__init__.py +0 -0
- cogames_agents/evals/__init__.py +5 -0
- cogames_agents/evals/planky_evals.py +415 -0
- cogames_agents/policy/__init__.py +0 -0
- cogames_agents/policy/evolution/__init__.py +0 -0
- cogames_agents/policy/evolution/cogsguard/__init__.py +0 -0
- cogames_agents/policy/evolution/cogsguard/evolution.py +695 -0
- cogames_agents/policy/evolution/cogsguard/evolutionary_coordinator.py +540 -0
- cogames_agents/policy/nim_agents/__init__.py +20 -0
- cogames_agents/policy/nim_agents/agents.py +98 -0
- cogames_agents/policy/nim_agents/bindings/generated/libnim_agents.dylib +0 -0
- cogames_agents/policy/nim_agents/bindings/generated/nim_agents.py +215 -0
- cogames_agents/policy/nim_agents/cogsguard_agents.nim +555 -0
- cogames_agents/policy/nim_agents/cogsguard_align_all_agents.nim +569 -0
- cogames_agents/policy/nim_agents/common.nim +1054 -0
- cogames_agents/policy/nim_agents/install.sh +1 -0
- cogames_agents/policy/nim_agents/ladybug_agent.nim +954 -0
- cogames_agents/policy/nim_agents/nim_agents.nim +68 -0
- cogames_agents/policy/nim_agents/nim_agents.nims +14 -0
- cogames_agents/policy/nim_agents/nimby.lock +3 -0
- cogames_agents/policy/nim_agents/racecar_agents.nim +844 -0
- cogames_agents/policy/nim_agents/random_agents.nim +68 -0
- cogames_agents/policy/nim_agents/test_agents.py +53 -0
- cogames_agents/policy/nim_agents/thinky_agents.nim +677 -0
- cogames_agents/policy/nim_agents/thinky_eval.py +230 -0
- cogames_agents/policy/scripted_agent/README.md +360 -0
- cogames_agents/policy/scripted_agent/__init__.py +0 -0
- cogames_agents/policy/scripted_agent/baseline_agent.py +1031 -0
- cogames_agents/policy/scripted_agent/cogas/__init__.py +5 -0
- cogames_agents/policy/scripted_agent/cogas/context.py +68 -0
- cogames_agents/policy/scripted_agent/cogas/entity_map.py +152 -0
- cogames_agents/policy/scripted_agent/cogas/goal.py +115 -0
- cogames_agents/policy/scripted_agent/cogas/goals/__init__.py +27 -0
- cogames_agents/policy/scripted_agent/cogas/goals/aligner.py +160 -0
- cogames_agents/policy/scripted_agent/cogas/goals/gear.py +197 -0
- cogames_agents/policy/scripted_agent/cogas/goals/miner.py +441 -0
- cogames_agents/policy/scripted_agent/cogas/goals/scout.py +40 -0
- cogames_agents/policy/scripted_agent/cogas/goals/scrambler.py +174 -0
- cogames_agents/policy/scripted_agent/cogas/goals/shared.py +160 -0
- cogames_agents/policy/scripted_agent/cogas/goals/stem.py +60 -0
- cogames_agents/policy/scripted_agent/cogas/goals/survive.py +100 -0
- cogames_agents/policy/scripted_agent/cogas/navigator.py +401 -0
- cogames_agents/policy/scripted_agent/cogas/obs_parser.py +238 -0
- cogames_agents/policy/scripted_agent/cogas/policy.py +525 -0
- cogames_agents/policy/scripted_agent/cogas/trace.py +69 -0
- cogames_agents/policy/scripted_agent/cogsguard/CLAUDE.md +517 -0
- cogames_agents/policy/scripted_agent/cogsguard/README.md +252 -0
- cogames_agents/policy/scripted_agent/cogsguard/__init__.py +74 -0
- cogames_agents/policy/scripted_agent/cogsguard/aligned_junction_held_investigation.md +152 -0
- cogames_agents/policy/scripted_agent/cogsguard/aligner.py +333 -0
- cogames_agents/policy/scripted_agent/cogsguard/behavior_hooks.py +44 -0
- cogames_agents/policy/scripted_agent/cogsguard/control_agent.py +323 -0
- cogames_agents/policy/scripted_agent/cogsguard/debug_agent.py +533 -0
- cogames_agents/policy/scripted_agent/cogsguard/miner.py +589 -0
- cogames_agents/policy/scripted_agent/cogsguard/options.py +67 -0
- cogames_agents/policy/scripted_agent/cogsguard/parity_metrics.py +36 -0
- cogames_agents/policy/scripted_agent/cogsguard/policy.py +1967 -0
- cogames_agents/policy/scripted_agent/cogsguard/prereq_trace.py +33 -0
- cogames_agents/policy/scripted_agent/cogsguard/role_trace.py +50 -0
- cogames_agents/policy/scripted_agent/cogsguard/roles.py +31 -0
- cogames_agents/policy/scripted_agent/cogsguard/rollout_trace.py +40 -0
- cogames_agents/policy/scripted_agent/cogsguard/scout.py +69 -0
- cogames_agents/policy/scripted_agent/cogsguard/scrambler.py +350 -0
- cogames_agents/policy/scripted_agent/cogsguard/targeted_agent.py +418 -0
- cogames_agents/policy/scripted_agent/cogsguard/teacher.py +224 -0
- cogames_agents/policy/scripted_agent/cogsguard/types.py +381 -0
- cogames_agents/policy/scripted_agent/cogsguard/v2_agent.py +49 -0
- cogames_agents/policy/scripted_agent/common/__init__.py +0 -0
- cogames_agents/policy/scripted_agent/common/geometry.py +24 -0
- cogames_agents/policy/scripted_agent/common/roles.py +34 -0
- cogames_agents/policy/scripted_agent/common/tag_utils.py +48 -0
- cogames_agents/policy/scripted_agent/demo_policy.py +242 -0
- cogames_agents/policy/scripted_agent/pathfinding.py +126 -0
- cogames_agents/policy/scripted_agent/pinky/DESIGN.md +317 -0
- cogames_agents/policy/scripted_agent/pinky/__init__.py +5 -0
- cogames_agents/policy/scripted_agent/pinky/behaviors/__init__.py +17 -0
- cogames_agents/policy/scripted_agent/pinky/behaviors/aligner.py +400 -0
- cogames_agents/policy/scripted_agent/pinky/behaviors/base.py +119 -0
- cogames_agents/policy/scripted_agent/pinky/behaviors/miner.py +632 -0
- cogames_agents/policy/scripted_agent/pinky/behaviors/scout.py +138 -0
- cogames_agents/policy/scripted_agent/pinky/behaviors/scrambler.py +433 -0
- cogames_agents/policy/scripted_agent/pinky/policy.py +570 -0
- cogames_agents/policy/scripted_agent/pinky/services/__init__.py +7 -0
- cogames_agents/policy/scripted_agent/pinky/services/map_tracker.py +808 -0
- cogames_agents/policy/scripted_agent/pinky/services/navigator.py +864 -0
- cogames_agents/policy/scripted_agent/pinky/services/safety.py +189 -0
- cogames_agents/policy/scripted_agent/pinky/state.py +299 -0
- cogames_agents/policy/scripted_agent/pinky/types.py +138 -0
- cogames_agents/policy/scripted_agent/planky/CLAUDE.md +124 -0
- cogames_agents/policy/scripted_agent/planky/IMPROVEMENTS.md +160 -0
- cogames_agents/policy/scripted_agent/planky/NOTES.md +153 -0
- cogames_agents/policy/scripted_agent/planky/PLAN.md +254 -0
- cogames_agents/policy/scripted_agent/planky/README.md +214 -0
- cogames_agents/policy/scripted_agent/planky/STRATEGY.md +100 -0
- cogames_agents/policy/scripted_agent/planky/__init__.py +5 -0
- cogames_agents/policy/scripted_agent/planky/context.py +68 -0
- cogames_agents/policy/scripted_agent/planky/entity_map.py +152 -0
- cogames_agents/policy/scripted_agent/planky/goal.py +107 -0
- cogames_agents/policy/scripted_agent/planky/goals/__init__.py +27 -0
- cogames_agents/policy/scripted_agent/planky/goals/aligner.py +168 -0
- cogames_agents/policy/scripted_agent/planky/goals/gear.py +179 -0
- cogames_agents/policy/scripted_agent/planky/goals/miner.py +416 -0
- cogames_agents/policy/scripted_agent/planky/goals/scout.py +40 -0
- cogames_agents/policy/scripted_agent/planky/goals/scrambler.py +174 -0
- cogames_agents/policy/scripted_agent/planky/goals/shared.py +160 -0
- cogames_agents/policy/scripted_agent/planky/goals/stem.py +49 -0
- cogames_agents/policy/scripted_agent/planky/goals/survive.py +96 -0
- cogames_agents/policy/scripted_agent/planky/navigator.py +388 -0
- cogames_agents/policy/scripted_agent/planky/obs_parser.py +238 -0
- cogames_agents/policy/scripted_agent/planky/policy.py +485 -0
- cogames_agents/policy/scripted_agent/planky/tests/__init__.py +0 -0
- cogames_agents/policy/scripted_agent/planky/tests/conftest.py +66 -0
- cogames_agents/policy/scripted_agent/planky/tests/helpers.py +152 -0
- cogames_agents/policy/scripted_agent/planky/tests/test_aligner.py +24 -0
- cogames_agents/policy/scripted_agent/planky/tests/test_miner.py +30 -0
- cogames_agents/policy/scripted_agent/planky/tests/test_scout.py +15 -0
- cogames_agents/policy/scripted_agent/planky/tests/test_scrambler.py +29 -0
- cogames_agents/policy/scripted_agent/planky/tests/test_stem.py +36 -0
- cogames_agents/policy/scripted_agent/planky/trace.py +69 -0
- cogames_agents/policy/scripted_agent/types.py +239 -0
- cogames_agents/policy/scripted_agent/unclipping_agent.py +461 -0
- cogames_agents/policy/scripted_agent/utils.py +381 -0
- cogames_agents/policy/scripted_registry.py +80 -0
- cogames_agents/py.typed +0 -0
- cogames_agents-0.0.0.7.dist-info/METADATA +98 -0
- cogames_agents-0.0.0.7.dist-info/RECORD +128 -0
- cogames_agents-0.0.0.7.dist-info/WHEEL +6 -0
- cogames_agents-0.0.0.7.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
from ctypes import *
|
|
2
|
+
import os, sys
|
|
3
|
+
|
|
4
|
+
dir = os.path.dirname(sys.modules["nim_agents"].__file__)
|
|
5
|
+
if sys.platform == "win32":
|
|
6
|
+
libName = "nim_agents.dll"
|
|
7
|
+
elif sys.platform == "darwin":
|
|
8
|
+
libName = "libnim_agents.dylib"
|
|
9
|
+
else:
|
|
10
|
+
libName = "libnim_agents.so"
|
|
11
|
+
dll = cdll.LoadLibrary(os.path.join(dir, libName))
|
|
12
|
+
|
|
13
|
+
class NimAgentsError(Exception):
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
class SeqIterator(object):
|
|
17
|
+
def __init__(self, seq):
|
|
18
|
+
self.idx = 0
|
|
19
|
+
self.seq = seq
|
|
20
|
+
def __iter__(self):
|
|
21
|
+
return self
|
|
22
|
+
def __next__(self):
|
|
23
|
+
if self.idx < len(self.seq):
|
|
24
|
+
self.idx += 1
|
|
25
|
+
return self.seq[self.idx - 1]
|
|
26
|
+
else:
|
|
27
|
+
self.idx = 0
|
|
28
|
+
raise StopIteration
|
|
29
|
+
|
|
30
|
+
def nim_agents_init_chook():
|
|
31
|
+
dll.nim_agents_nim_agents_init_chook()
|
|
32
|
+
|
|
33
|
+
def start_measure():
|
|
34
|
+
dll.nim_agents_start_measure()
|
|
35
|
+
|
|
36
|
+
def end_measure():
|
|
37
|
+
dll.nim_agents_end_measure()
|
|
38
|
+
|
|
39
|
+
class RandomPolicy(Structure):
|
|
40
|
+
_fields_ = [("ref", c_ulonglong)]
|
|
41
|
+
|
|
42
|
+
def __bool__(self):
|
|
43
|
+
return self.ref != None
|
|
44
|
+
|
|
45
|
+
def __eq__(self, obj):
|
|
46
|
+
return self.ref == obj.ref
|
|
47
|
+
|
|
48
|
+
def __del__(self):
|
|
49
|
+
dll.nim_agents_random_policy_unref(self)
|
|
50
|
+
|
|
51
|
+
def __init__(self, environment_config):
|
|
52
|
+
result = dll.nim_agents_new_random_policy(environment_config.encode("utf8"))
|
|
53
|
+
self.ref = result
|
|
54
|
+
|
|
55
|
+
def step_batch(self, agent_ids, num_agent_ids, num_agents, num_tokens, size_token, raw_observations, num_actions, raw_actions):
|
|
56
|
+
dll.nim_agents_random_policy_step_batch(self, agent_ids, num_agent_ids, num_agents, num_tokens, size_token, raw_observations, num_actions, raw_actions)
|
|
57
|
+
|
|
58
|
+
class ThinkyPolicy(Structure):
|
|
59
|
+
_fields_ = [("ref", c_ulonglong)]
|
|
60
|
+
|
|
61
|
+
def __bool__(self):
|
|
62
|
+
return self.ref != None
|
|
63
|
+
|
|
64
|
+
def __eq__(self, obj):
|
|
65
|
+
return self.ref == obj.ref
|
|
66
|
+
|
|
67
|
+
def __del__(self):
|
|
68
|
+
dll.nim_agents_thinky_policy_unref(self)
|
|
69
|
+
|
|
70
|
+
def __init__(self, environment_config):
|
|
71
|
+
result = dll.nim_agents_new_thinky_policy(environment_config.encode("utf8"))
|
|
72
|
+
self.ref = result
|
|
73
|
+
|
|
74
|
+
def step_batch(self, agent_ids, num_agent_ids, num_agents, num_tokens, size_token, raw_observations, num_actions, raw_actions):
|
|
75
|
+
dll.nim_agents_thinky_policy_step_batch(self, agent_ids, num_agent_ids, num_agents, num_tokens, size_token, raw_observations, num_actions, raw_actions)
|
|
76
|
+
|
|
77
|
+
class RaceCarPolicy(Structure):
|
|
78
|
+
_fields_ = [("ref", c_ulonglong)]
|
|
79
|
+
|
|
80
|
+
def __bool__(self):
|
|
81
|
+
return self.ref != None
|
|
82
|
+
|
|
83
|
+
def __eq__(self, obj):
|
|
84
|
+
return self.ref == obj.ref
|
|
85
|
+
|
|
86
|
+
def __del__(self):
|
|
87
|
+
dll.nim_agents_race_car_policy_unref(self)
|
|
88
|
+
|
|
89
|
+
def __init__(self, environment_config):
|
|
90
|
+
result = dll.nim_agents_new_race_car_policy(environment_config.encode("utf8"))
|
|
91
|
+
self.ref = result
|
|
92
|
+
|
|
93
|
+
def step_batch(self, agent_ids, num_agent_ids, num_agents, num_tokens, size_token, raw_observations, num_actions, raw_actions):
|
|
94
|
+
dll.nim_agents_race_car_policy_step_batch(self, agent_ids, num_agent_ids, num_agents, num_tokens, size_token, raw_observations, num_actions, raw_actions)
|
|
95
|
+
|
|
96
|
+
class LadybugPolicy(Structure):
|
|
97
|
+
_fields_ = [("ref", c_ulonglong)]
|
|
98
|
+
|
|
99
|
+
def __bool__(self):
|
|
100
|
+
return self.ref != None
|
|
101
|
+
|
|
102
|
+
def __eq__(self, obj):
|
|
103
|
+
return self.ref == obj.ref
|
|
104
|
+
|
|
105
|
+
def __del__(self):
|
|
106
|
+
dll.nim_agents_ladybug_policy_unref(self)
|
|
107
|
+
|
|
108
|
+
def __init__(self, environment_config):
|
|
109
|
+
result = dll.nim_agents_new_ladybug_policy(environment_config.encode("utf8"))
|
|
110
|
+
self.ref = result
|
|
111
|
+
|
|
112
|
+
def step_batch(self, agent_ids, num_agent_ids, num_agents, num_tokens, size_token, raw_observations, num_actions, raw_actions):
|
|
113
|
+
dll.nim_agents_ladybug_policy_step_batch(self, agent_ids, num_agent_ids, num_agents, num_tokens, size_token, raw_observations, num_actions, raw_actions)
|
|
114
|
+
|
|
115
|
+
class CogsguardPolicy(Structure):
|
|
116
|
+
_fields_ = [("ref", c_ulonglong)]
|
|
117
|
+
|
|
118
|
+
def __bool__(self):
|
|
119
|
+
return self.ref != None
|
|
120
|
+
|
|
121
|
+
def __eq__(self, obj):
|
|
122
|
+
return self.ref == obj.ref
|
|
123
|
+
|
|
124
|
+
def __del__(self):
|
|
125
|
+
dll.nim_agents_cogsguard_policy_unref(self)
|
|
126
|
+
|
|
127
|
+
def __init__(self, environment_config):
|
|
128
|
+
result = dll.nim_agents_new_cogsguard_policy(environment_config.encode("utf8"))
|
|
129
|
+
self.ref = result
|
|
130
|
+
|
|
131
|
+
def step_batch(self, agent_ids, num_agent_ids, num_agents, num_tokens, size_token, raw_observations, num_actions, raw_actions):
|
|
132
|
+
dll.nim_agents_cogsguard_policy_step_batch(self, agent_ids, num_agent_ids, num_agents, num_tokens, size_token, raw_observations, num_actions, raw_actions)
|
|
133
|
+
|
|
134
|
+
class CogsguardAlignAllPolicy(Structure):
|
|
135
|
+
_fields_ = [("ref", c_ulonglong)]
|
|
136
|
+
|
|
137
|
+
def __bool__(self):
|
|
138
|
+
return self.ref != None
|
|
139
|
+
|
|
140
|
+
def __eq__(self, obj):
|
|
141
|
+
return self.ref == obj.ref
|
|
142
|
+
|
|
143
|
+
def __del__(self):
|
|
144
|
+
dll.nim_agents_cogsguard_align_all_policy_unref(self)
|
|
145
|
+
|
|
146
|
+
def __init__(self, environment_config):
|
|
147
|
+
result = dll.nim_agents_new_cogsguard_align_all_policy(environment_config.encode("utf8"))
|
|
148
|
+
self.ref = result
|
|
149
|
+
|
|
150
|
+
def step_batch(self, agent_ids, num_agent_ids, num_agents, num_tokens, size_token, raw_observations, num_actions, raw_actions):
|
|
151
|
+
dll.nim_agents_cogsguard_align_all_policy_step_batch(self, agent_ids, num_agent_ids, num_agents, num_tokens, size_token, raw_observations, num_actions, raw_actions)
|
|
152
|
+
|
|
153
|
+
dll.nim_agents_nim_agents_init_chook.argtypes = []
|
|
154
|
+
dll.nim_agents_nim_agents_init_chook.restype = None
|
|
155
|
+
|
|
156
|
+
dll.nim_agents_start_measure.argtypes = []
|
|
157
|
+
dll.nim_agents_start_measure.restype = None
|
|
158
|
+
|
|
159
|
+
dll.nim_agents_end_measure.argtypes = []
|
|
160
|
+
dll.nim_agents_end_measure.restype = None
|
|
161
|
+
|
|
162
|
+
dll.nim_agents_random_policy_unref.argtypes = [RandomPolicy]
|
|
163
|
+
dll.nim_agents_random_policy_unref.restype = None
|
|
164
|
+
|
|
165
|
+
dll.nim_agents_new_random_policy.argtypes = [c_char_p]
|
|
166
|
+
dll.nim_agents_new_random_policy.restype = c_ulonglong
|
|
167
|
+
|
|
168
|
+
dll.nim_agents_random_policy_step_batch.argtypes = [RandomPolicy, c_void_p, c_longlong, c_longlong, c_longlong, c_longlong, c_void_p, c_longlong, c_void_p]
|
|
169
|
+
dll.nim_agents_random_policy_step_batch.restype = None
|
|
170
|
+
|
|
171
|
+
dll.nim_agents_thinky_policy_unref.argtypes = [ThinkyPolicy]
|
|
172
|
+
dll.nim_agents_thinky_policy_unref.restype = None
|
|
173
|
+
|
|
174
|
+
dll.nim_agents_new_thinky_policy.argtypes = [c_char_p]
|
|
175
|
+
dll.nim_agents_new_thinky_policy.restype = c_ulonglong
|
|
176
|
+
|
|
177
|
+
dll.nim_agents_thinky_policy_step_batch.argtypes = [ThinkyPolicy, c_void_p, c_longlong, c_longlong, c_longlong, c_longlong, c_void_p, c_longlong, c_void_p]
|
|
178
|
+
dll.nim_agents_thinky_policy_step_batch.restype = None
|
|
179
|
+
|
|
180
|
+
dll.nim_agents_race_car_policy_unref.argtypes = [RaceCarPolicy]
|
|
181
|
+
dll.nim_agents_race_car_policy_unref.restype = None
|
|
182
|
+
|
|
183
|
+
dll.nim_agents_new_race_car_policy.argtypes = [c_char_p]
|
|
184
|
+
dll.nim_agents_new_race_car_policy.restype = c_ulonglong
|
|
185
|
+
|
|
186
|
+
dll.nim_agents_race_car_policy_step_batch.argtypes = [RaceCarPolicy, c_void_p, c_longlong, c_longlong, c_longlong, c_longlong, c_void_p, c_longlong, c_void_p]
|
|
187
|
+
dll.nim_agents_race_car_policy_step_batch.restype = None
|
|
188
|
+
|
|
189
|
+
dll.nim_agents_ladybug_policy_unref.argtypes = [LadybugPolicy]
|
|
190
|
+
dll.nim_agents_ladybug_policy_unref.restype = None
|
|
191
|
+
|
|
192
|
+
dll.nim_agents_new_ladybug_policy.argtypes = [c_char_p]
|
|
193
|
+
dll.nim_agents_new_ladybug_policy.restype = c_ulonglong
|
|
194
|
+
|
|
195
|
+
dll.nim_agents_ladybug_policy_step_batch.argtypes = [LadybugPolicy, c_void_p, c_longlong, c_longlong, c_longlong, c_longlong, c_void_p, c_longlong, c_void_p]
|
|
196
|
+
dll.nim_agents_ladybug_policy_step_batch.restype = None
|
|
197
|
+
|
|
198
|
+
dll.nim_agents_cogsguard_policy_unref.argtypes = [CogsguardPolicy]
|
|
199
|
+
dll.nim_agents_cogsguard_policy_unref.restype = None
|
|
200
|
+
|
|
201
|
+
dll.nim_agents_new_cogsguard_policy.argtypes = [c_char_p]
|
|
202
|
+
dll.nim_agents_new_cogsguard_policy.restype = c_ulonglong
|
|
203
|
+
|
|
204
|
+
dll.nim_agents_cogsguard_policy_step_batch.argtypes = [CogsguardPolicy, c_void_p, c_longlong, c_longlong, c_longlong, c_longlong, c_void_p, c_longlong, c_void_p]
|
|
205
|
+
dll.nim_agents_cogsguard_policy_step_batch.restype = None
|
|
206
|
+
|
|
207
|
+
dll.nim_agents_cogsguard_align_all_policy_unref.argtypes = [CogsguardAlignAllPolicy]
|
|
208
|
+
dll.nim_agents_cogsguard_align_all_policy_unref.restype = None
|
|
209
|
+
|
|
210
|
+
dll.nim_agents_new_cogsguard_align_all_policy.argtypes = [c_char_p]
|
|
211
|
+
dll.nim_agents_new_cogsguard_align_all_policy.restype = c_ulonglong
|
|
212
|
+
|
|
213
|
+
dll.nim_agents_cogsguard_align_all_policy_step_batch.argtypes = [CogsguardAlignAllPolicy, c_void_p, c_longlong, c_longlong, c_longlong, c_longlong, c_void_p, c_longlong, c_void_p]
|
|
214
|
+
dll.nim_agents_cogsguard_align_all_policy_step_batch.restype = None
|
|
215
|
+
|