Execute config 01
In [ ]:
Copied!
from DSSE import CoverageDroneSwarmSearch
import pandas as pd
from DSSE import CoverageDroneSwarmSearch
import pandas as pd
In [ ]:
Copied!
env = CoverageDroneSwarmSearch(
drone_amount=1,
render_mode="human",
prob_matrix_path='../data/config_01.npy',
timestep_limit=200
)
env = CoverageDroneSwarmSearch(
drone_amount=1,
render_mode="human",
prob_matrix_path='../data/config_01.npy',
timestep_limit=200
)
In [ ]:
Copied!
opt = {
"drones_positions": [(20, 20)],
}
opt = {
"drones_positions": [(20, 20)],
}
In [ ]:
Copied!
def random_policy(obs, agents):
actions = {}
for agent in agents:
actions[agent] = env.action_space(agent).sample()
return actions
def random_policy(obs, agents):
actions = {}
for agent in agents:
actions[agent] = env.action_space(agent).sample()
return actions
In [ ]:
Copied!
observations, info = env.reset(options=opt)
observations, info = env.reset(options=opt)
In [ ]:
Copied!
step = 0
infos_list = []
step = 0
infos_list = []
In [ ]:
Copied!
while env.agents:
step += 1
actions = random_policy(observations, env.agents)
observations, rewards, terminations, truncations, infos = env.step(actions)
info = infos['drone0']
info['step'] = step
infos_list.append(info)
print(info)
while env.agents:
step += 1
actions = random_policy(observations, env.agents)
observations, rewards, terminations, truncations, infos = env.step(actions)
info = infos['drone0']
info['step'] = step
infos_list.append(info)
print(info)
In [ ]:
Copied!
df = pd.DataFrame(infos_list)
df.to_csv('../results/data_drone_1_config_1.csv', index=False)
df = pd.DataFrame(infos_list)
df.to_csv('../results/data_drone_1_config_1.csv', index=False)