-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
49 lines (38 loc) · 1.48 KB
/
Copy pathmain.py
File metadata and controls
49 lines (38 loc) · 1.48 KB
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
import sys
import os
import time
## importa classes
from environment import Env
from explorer import Explorer
from rescuer import Rescuer
def main(data_folder_name):
# Set the path to config files and data files for the environment
current_folder = os.path.abspath(os.getcwd())
data_folder = os.path.abspath(os.path.join(current_folder, data_folder_name))
# Instantiate the environment
env = Env(data_folder)
# config files for the agents
rescuer_file = os.path.join(data_folder, "rescuer_config.txt")
explorer_file = os.path.join(data_folder, "explorer_config.txt")
# Instantiate agents rescuer and explorer
resc1 = Rescuer(env, rescuer_file, 1)
resc2 = Rescuer(env, rescuer_file, 2)
resc3 = Rescuer(env, rescuer_file, 3)
resc4 = Rescuer(env, rescuer_file, 4)
# Explorer needs to know rescuer to send the map
# that's why rescuer is instatiated before
exp = Explorer(env, explorer_file, resc1, 1)
exp = Explorer(env, explorer_file, resc2, 2)
exp = Explorer(env, explorer_file, resc3, 3)
exp = Explorer(env, explorer_file, resc4, 4)
# Run the environment simulator
env.run()
if __name__ == '__main__':
""" To get data from a different folder than the default called data
pass it by the argument line"""
if len(sys.argv) > 1:
data_folder_name = sys.argv[1]
else:
data_folder_name = "data"
data_folder_name = os.path.join("datasets", "data_100x80_225vic")
main(data_folder_name)