-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
77 lines (53 loc) · 1.6 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
"""
Main.py
Options to select:
- singleangets: a simple example of BridgeConnection on a Cartpole 1D example
- multiagents: a simple example of BridgeConnection on a
"""
from tests.single_agents import single_agents
from tests.multiagents import multiagents
from argparse import ArgumentParser
from unray_bridge.envs.bridge_env import MultiAgentBridgeEnv
from unray_bridge.envs.spaces import BridgeSpaces
from unray_bridge.multiagents_config import MultiEnvCreator
from unray_bridge.envs.envs.MultiAgentArena import get_config
import numpy as np
single_env = get_config()
creator = MultiEnvCreator(single_env, amount_of_envs=1)
env_config = creator.get_multienv_config_dict()
env = MultiAgentBridgeEnv(
name = "multiagent-arena",
ip = 'localhost',
port = 10011,
config = env_config
)
# Actions test
action = {
'agent-1:1': np.array([2]),
'agent-2:1': np.array([0]),
'agent-1:2': np.array([1]),
'agent-2:2': np.array([3]),
}
action2 = {
'agent-1:1': np.array([2]),
'agent-2:1': np.array([0]),
'agent-1:2': np.array([1]),
'agent-2:2': np.array([3]),
}
action3 = {
'agent-1:1': np.array([2]),
'agent-2:1': np.array([3]),
'agent-1:2': np.array([1]),
'agent-2:2': np.array([3]),
}
action4 = {
'agent-1': np.array([2]),
'agent-2': np.array([2])
}
if __name__ == "__main__":
env.step(action)
print("------------------------------------------")
env.step(action2)
print("------------------------------------------")
env.step(action3)
print("------------------------------------------")