oxwhirl / smac

SMAC: The StarCraft Multi-Agent Challenge
MIT License
1.03k stars 228 forks source link

AssertionError: Agent X cannot perform action Y #115

Closed rayanehmi closed 12 months ago

rayanehmi commented 1 year ago

This error randomly happens during training. It comes from the starcraft2.py environment file : assert avail_actions[action] == 1.

I have had it with different algorithms from different authors (including PyMARL's QMIX). I have also tested using different machines and even using different OS. The only common factor seems to be SMAC.

This is a somewhat "rare" error which happens every 3rd-5th run on base maps. I am surprised there has not been an issue about it already : it may be related to some dependency being updated recently.

samvelyan commented 1 year ago

This happens when you perform an action which are not available at the current state of the environment. PyMARL checks the availability of actions before performing them. If you have checked available actions before executing them, this should not have happen.

More specifically, we use get_avail_actions() before selecting actions, which is basically a list made up from available actions of each agent using the get_avail_agent_actions() method. This later method is exactly what we check in our assertion statement.

With this all said, I think this is a framework related issue that you used.

In any case, I don't think we've seen this in our experiments that we have ran for years since smac has been released.

Would also be great to understand what exact situation that happened in (e.g. by printing situations or adding try-catch blocks). But given that this error is rare, I understand this would be difficult.

rayanehmi commented 12 months ago

Update : I couldn't reproduce the error on the original PyMARL library, so it is probably indeed a framework related issue. Using other frameworks, I tried printing relevant information like available actions at the time of the crashes but it really seems to be random-ish. Thank you for your answer, I will now close the issue ! image