This is an OpenAI gym implementation of the Commons Game, a multi-agent environment proposed in A multi-agent reinforcement learning model of common-pool resource appropriation using gym as game engine.
We will use a Deep Q-Network (DQN) to train the agents in this environment, allowing them to learn optimal strategies for resource appropriation while balancing cooperation and competition. The DQN algorithm leverages deep learning to approximate the Q-value function, enabling agents to make decisions in this multi-agent setting.
To install cd
to the directory of the repository and run pip install -e .
The file main.py
contains a simple usage example where you can modify the map config, the size of its field of vision, the number of episodes and the action policy. To run the file cd
to the directory of the repository and run python main.py
.
The current version includes the results, it may be necessary to remove the metrics.csv
files and also create the result folders of the correspondent maps and methods to avoid errors.