semitable / lb-foraging

Level-based Foraging (LBF): A multi-agent environment for RL
MIT License
151 stars 64 forks source link

other types of agents #7

Open shark939393 opened 2 years ago

shark939393 commented 2 years ago

how can I set players as q_agent? I want to use other types of agents

semitable commented 2 years ago

Repost of #5 and #6

Right now, the heuristic agents in the master branch are disabled and should not work. The only interface available in the master branch is the Gym's interface. I am not sure if it would be enough for you to train RL agents using that interface and then use the saved networks for any further work you might need. If that's the case, then you only need to split the tuple of observations//rewards/etc and feed them to your agents. Each call to the step function returns lists with size N (N being the number of agents) - i.e. second item in that list should go to the second agent.

That said, there is also the "heuristics" branch. It's been a while since I used it, so I am not sure what the state is (if it's buggy or outdated) but it should allow both the use of the heuristic agents and the gym interface. As far as I remember, in that branch the observation is returned as a tuple of the "gym friendly" and the "named tupled object" (which are two different formats). It should be a matter of feeding the correct type to the agents according to whether they need the old interface or the gym interface. If you need the heuristic agents, I would suggest starting from that branch or even checking out older commits.