Open TachikakaMin opened 2 weeks ago
Hi! The is_active
flag indicates whether agents have already reached their targets, and this applies specifically to the "disappear on target" scenario (i.e., when on_target='finish'
). In this case, non-active agents will not block others.
To answer the second question – it depends on the collision system in POGEMA. The movement you described is possible (for both agents) when using the soft collision system. However, if we use the block_both
collision system, agent_1
will remain in its initial position. In both cases, agent_2
will be able to move to cell C, since it's not occupied by anyone.
Here is a small illustrative example:
from pogema import BatchAStarAgent, GridConfig, pogema_v0
def main():
for collision_system in ['block_both', 'soft']:
print(f'Collision system: {collision_system}')
env = pogema_v0(grid_config=GridConfig(map="""...""", num_agents=2, size=4, obs_radius=2,
observation_type='POMAPF', on_target='nothing',
agents_xy=[[0, 0], [0, 1]], targets_xy=[[0, 1], [0, 2]],
collision_system=collision_system))
agent = BatchAStarAgent()
obs, _ = env.reset()
env.render()
env.step(agent.act(obs))
env.render()
if __name__ == '__main__':
main()
Which will produce:
Collision system: block_both
. . . . . . .
. .
. 0 1 |1| .
. .
. . . . . . .
. . . . . . .
. .
. 0 |0| 1 .
. .
. . . . . . .
Collision system: soft
. . . . . . .
. .
. 0 1 |1| .
. .
. . . . . . .
. . . . . . .
. .
. . 0 1 .
. .
. . . . . . .
Hi,
https://github.com/CognitiveAISystems/pogema/blob/a655e6a69acc85e1f5b7449a60d9b0dab815b87e/pogema/envs.py#L229-L242
What is is_active meaning?
What will happen if agent1 in A goes to B, agent2 in B goes to C? A---B---C
A is "blocked", B is "blocked", C is "visited", So it seems agent1 can't go to B?
@Tviskaron
Thanks.