Execute config 02
In [ ]:
Copied!
from DSSE import CoverageDroneSwarmSearch
from DSSE import CoverageDroneSwarmSearch
In [ ]:
Copied!
env = CoverageDroneSwarmSearch(
drone_amount=1,
render_mode="human",
prob_matrix_path='../data/config_02.npy',
timestep_limit=100
)
env = CoverageDroneSwarmSearch(
drone_amount=1,
render_mode="human",
prob_matrix_path='../data/config_02.npy',
timestep_limit=100
)
In [ ]:
Copied!
opt = {
"drones_positions": [(0, 0)],
}
opt = {
"drones_positions": [(0, 0)],
}
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(infos)
step = 0
while env.agents:
step += 1
actions = random_policy(observations, env.agents)
observations, rewards, terminations, truncations, infos = env.step(actions)
print(infos)
print(infos["drone0"])