oxwhirl / smac

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

Set `max_cycles` to PettingZoo env properly #110

Closed mansicer closed 1 year ago

mansicer commented 1 year ago

The max_cycles value in PettingZoo env will be used to provide truncated signals for env.step return. However, this property requires to be manually set when creating the env. This PR proposes to set max_cycles according to SMAC's get_map_params function to acquire the correct value of maximal episode steps.

mansicer commented 1 year ago

In the current implementation, the max_cycles parameter of the function will be useless. Could you please address this?

I suggest to set the default value of max_cycles to None. When this parameter is not specified, we can set it according to to map parameters. When it is manually set, there will be two results:

  1. max_cycles < actual episode limited length. Env will return truncated = True when reaching max_cycles. That can be a choice if the user want to run SMAC tasks with shorter horizons.
  2. max_cycles >= actual episode limited length. Env will return terminated = True when reaching the actual episode limited length.

I believe both cases could be reasonable.

samvelyan commented 1 year ago

Thanks for the contribution @mansicer!