Coverage example
In [ ]:
Copied!
from DSSE import CoverageDroneSwarmSearch
from DSSE import CoverageDroneSwarmSearch
In [ ]:
Copied!
env = CoverageDroneSwarmSearch(
drone_amount=3,
render_mode="human",
disaster_position=(-24.02, -46.10), # (lat, long) some place near Florianópolis
pre_render_time=2, # hours to simulate
timestep_limit=100,
)
env = CoverageDroneSwarmSearch(
drone_amount=3,
render_mode="human",
disaster_position=(-24.02, -46.10), # (lat, long) some place near Florianópolis
pre_render_time=2, # hours to simulate
timestep_limit=100,
)
In [ ]:
Copied!
opt = {
"drones_positions": [(10,10),(20, 20),(30,30)],
}
opt = {
"drones_positions": [(10,10),(20, 20),(30,30)],
}
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
while env.agents:
step += 1
actions = random_policy(observations, env.agents)
observations, rewards, terminations, truncations, infos = env.step(actions)
print(f'{step} - {infos}')
step = 0
while env.agents:
step += 1
actions = random_policy(observations, env.agents)
observations, rewards, terminations, truncations, infos = env.step(actions)
print(f'{step} - {infos}')