Farama-Foundation/PettingZoo

[Proposal] Permit AECEnv and ParallelEnv to have AgentIDs other than `str`

pimpale opened this issue · 2 comments

Proposal

Currently, the only permitted AgentID type is the str type. The method types here use the AgentID type in some places, and str in others.

I propose to make AgentID a type variable like ObsType and ActionType, so that users can use other agent ids than strings.

Motivation

I'd like to use numbers to key my agents, since they don't have meaningful names. The documentation suggests doing this here as well. However, it feels a bit unwieldy to constantly convert strings to integers and vice versa.

Additionally, the current state of mixed AgentID and str types is inconsistent, and should be fixed to use AgentID everywhere.

Pitch

No response

Alternatives

The alternative would be prohibit the use of AgentIDs other than string. In that case, we should remove the AgentID type alias, and consistently use str everywhere in type signatures. However, I think this solution is overly restrictive.

Additional context

No response

Checklist

  • I have checked that there is no similar issue in the repo

This seems like a pretty reasonable thing but it would take a considerable amount of work in ensuring that the tests all work if the agent id isn’t a string.

If you or another contributor would like to submit a PR and include tests to check that it works then I’d be happy to accept it, but I won’t have the time personally.

Thanks for responding! I've created an initial PR for the change, and I'll add some tests soon.