\section{Introduction}
\vspace{-\spaceSec em}

Natural resources like fisheries, groundwater basins, and grazing pastures, as well as technological resources like irrigation systems and access to geosynchronous orbit are all common-pool resources (CPRs). It is difficult or impossible for agents to exclude one another from accessing them. But whenever an agent obtains an individual benefit from such a resource, the remaining amount available for appropriation by others is ever-so-slightly diminished. These two seemingly-innocent properties of CPRs combine to yield numerous subtle problems of motivation in organizing collective action~\cite{hardin1968tragedy, ostrom1990governing, ostrom1999revisiting, dietz2003struggle}. The necessity of organizing groups of humans for effective CPR appropriation, combined with its notorious difficulty, has shaped human history. It remains equally critical today.

Renewable natural resources\footnote{Natural resources may or may not be renewable. However, this paper is only concerned with those that are.} have a stock component and a flow component~\cite{gordon1954economic, smith1968economics, gardner1990nature, ostrom1990governing}. Agents may choose to appropriate resources from the flow. However, the magnitude of the flow depends on the state of the stock\footnote{CPR appropriation problems are concerned with the allocation of the flow. In contrast, CPR \emph{provision} problems concern the supply of the stock. This paper only addresses the appropriation problem and we will say no more about CPR provision. See~\cite{gardner1990nature, ostrom1990governing} for more on the distinction between the two problems.}. Over-appropriation negatively impacts the stock, and thus has a negative impact on future flow. Agents secure individual rewards when they appropriate resource units from a CPR. However, the cost of such appropriation, felt via its impact on the CPR stock, affects all agents in the community equally. Economic theory predicts that as long as each individual's share of the marginal social cost is less than their marginal gain from appropriating an additional resource unit, agents will continue to appropriate from the CPR. If such over-appropriation continues unchecked for too long then the CPR stock may become depleted, thus cutting off future resource flows. Even if an especially clever agent were to realize the trap, they still could not unilaterally alter the outcome by restraining their own behavior. In other words, CPR appropriation problems have socially-deficient Nash equilibria. In fact, the choice to appropriate is typically dominant over the choice to show restraint (e.g. \cite{schelling1973hockey}). No matter what the state of the CPR stock, agents prefer to appropriate additional resources for themselves over the option of showing restraint, since in that case they receive no individual benefit but still endure the cost of CPR exploitation by others.

\begin{wrapfigure}{L}{0.35\textwidth}
\begin{subfigure}[b]{.99\linewidth}
\centering
\includegraphics[width=\linewidth]{LevelOpen.png}
\caption{Open map}\label{fig:LevelOpen}
\end{subfigure}\hfill
\begin{subfigure}[b]{.99\linewidth}
\centering
\includegraphics[width=\linewidth]{agent_obs.png}
\caption{Small map with agent's observation}\label{fig:agent_obs}
\end{subfigure}%
\caption{\textbf{(a)} The initial state of the commons game at the start of each episode on the large open map used in sections \ref{subsection:Emergent_social_outcome}, \ref{subsection:privatization}, and \ref{subsection:schelling}. Apples are green, walls are grey, and players are red or blue. \textbf{(b)} The initial state of the small map used for the single-agent experiment (Section  \ref{subsection:single-agent}). The size of the window of pixels a player receives as an observation is also shown.}
\label{fig:maps}
\end{wrapfigure}

Nevertheless, despite such pessimistic theoretical predictions, human communities frequently are able to self-organize to solve CPR appropriation problems~\cite{ostrom1990governing, ostrom1993coping, ostrom1999revisiting, dietz2003struggle}. A major goal of laboratory-based behavioral work in this area is to determine what it is about human behavior that makes this possible. Being based on behavioral game theory \cite{camerer1997progress}, most experimental work on human CPR appropriation behavior features highly abstracted environments where the only decision to make is how much to appropriate (e.g.~\cite{ostrom1994rules}). The advantage of such a setup is that the theoretical predictions of non-cooperative game theory are clear. However, this is achieved by sacrificing the opportunity to model spatial and temporal dynamics which are important in real-world CPRs \cite{ostrom1990governing}. This approach also downplays the role of trial-and-error learning.

One recent line of behavioral research on CPR appropriation features significantly more complex environments than the abstract matrix games that came before~\cite{janssen2008effect, janssen2008turfs, janssen2010lab, janssen2010introducing, janssen2013role}. In a typical experiment, a participant controls the movements of an on-screen avatar in a real-time video game-like environment that approximates a CPR with complex spatial and temporal dynamics. They are compensated proportionally to the amount of resources they collect. Interesting behavioral results have been obtained with this setup. For example, \cite{janssen2008turfs} found that participants often found cooperative solutions that relied on dividing the CPR into separate territories. However, due to the increased complexity of the environment model used in this new generation of experiments, the standard tools of non-cooperative game theory can no longer be used to generate predictions. 

We propose a new model of common-pool resource appropriation in which learning takes the center stage. It consists of two components: (1) a spatially and temporally dynamic CPR environment, similar to \cite{janssen2010lab}, and (2) a multi-agent system consisting of $N$ independent self-interested deep reinforcement learning agents. On the collective level, the idea is that self-organization to solve CPR appropriation problems works by smoothly adjusting over time the incentives felt by individual agents through a process akin to trial and error. This collective adjustment process is the aggregate result of all the many individual agents simultaneously learning how best to respond to their current situation. 

This model of CPR appropriation admits a diverse range of emergent social outcomes. Much of the present paper is devoted to developing methodology for analyzing such emergence. For instance, we show how behavior of groups may be characterized along four \emph{social outcome metrics} called: efficiency, equality, sustainability, and peace. We also develop an $N$-player empirical game-theoretic analysis that allows one to connect our model back to standard non-cooperative game theory. It allows one to determine classical game-theoretic properties like Nash equilibria for strategic games that emerge from learning in our model.

Our point is not to argue that we have a more realistic model than standard non-cooperative game theory. This is also a reductionist model. However, it emphasizes different aspects of real-world CPR problems. It makes different assumptions and thus may be expected to produce new insights for the general theory of CPR appropriation that were missed by the existing literature's focus on standard game theory models. Our results are broadly compatible with previous theory while also raising a new possibility, that trial-and-error learning may be a powerful mechanism for promoting sustainable use of the commons.

\vspace{-\spaceSec em}
\section{Modeling and analysis methods}
\vspace{-\spaceSec em}


\vspace{-\spaceSubSec em}
\subsection{The commons game}
\vspace{-\spaceSubSec em}
\label{subsection:commom_game}

The goal of the commons game is to collect ``apples'' (resources). The catch is that the apple regrowth rate (i.e. CPR flow) depends on the spatial configuration of the uncollected apples (i.e the CPR stock): the more nearby apples, the higher the regrowth rate. If all apples in a local area are harvested then none ever grow back---until the end of the episode (1000 steps), at which point the game resets to an initial state. The dilemma is as follows. The interests of the individual lead toward harvesting as rapidly as possible. However, the interests of the group as a whole are advanced when individuals refrain from doing so, especially in situations where many agents simultaneously harvest in the same local region. Such situations are precarious because the more harvesting agents there are, the greater the chance of bringing the local stock down to zero, at which point it cannot recover. 

\begin{wrapfigure}{l}{0.35\textwidth}
\begin{subfigure}[b]{.99\linewidth}
\centering
\includegraphics[width=\linewidth]{U_1_player.pdf}
\caption{Single agent return}\label{fig:utility_1player}
\end{subfigure}\hfill
\begin{subfigure}[b]{.99\linewidth}
\centering
\includegraphics[width=\linewidth]{OptimalPath.png}
\caption{Optimal path}\label{fig:optimal_path}
\end{subfigure}%
\caption{\textbf{(a)} Single-agent returns as a function of training steps. \textbf{(b)} The optimal resource appropriation policy for a single agent on this map. At convergence, the agent we study nearly learns this policy: \url{https://youtu.be/NnghJgsMxAY}. }
\vspace{-0 em}
\label{fig:single-agent}
\end{wrapfigure}

So far, the proposed commons game is quite similar to the dynamic game used in human behavioral experiments \cite{janssen2008effect, janssen2008turfs, janssen2010lab, janssen2010introducing, janssen2013role}. However, it departs in one notable way. In the behavioral work, especially \cite{janssen2010lab}, participants were given the option of paying a fee in order to fine another participant, reducing their score. In contrast, in our commons game, agents can tag one another with a ``time-out beam''.  Any agent caught in the path of the beam is removed from the game for 25 steps. Neither the tagging nor the tagged agent receive any direct reward or punishment from this. However, the tagged agent loses the chance to collect apples during its time-out period and the tagging agent loses a bit of time chasing and aiming, thus paying the  opportunity cost of foregone apple consumption. We argue that such a mechanism is more realistic because it has an effect within the game itself, not just on the scores.

The commons game is a partially-observable general-sum Markov Game~\cite{shapley1953stochastic, Littman94markovgames}. In each state of the game, agents take actions based on a partial observation of the state space and receive an individual reward. Agents must learn through experience an appropriate behavior policy while interacting with one another. 

In technical terms, we consider an $N$-player partially observable Markov game $\mathcal{M}$ defined on a finite set of states $\mathcal{S}$. The observation function $O: \mathcal{S} \times \{1,\dots,N\} \rightarrow \mathbb{R}^d$ specifies each player's $d$-dimensional view on the state space. In any state, players are allowed to take actions from the set $\mathcal{A}^1,\dots,\mathcal{A}^N$ (one for each player). As a result of their joint action $a^1,\dots,a^N \in \mathcal{A}^1,\dots,\mathcal{A}^N$ the state changes following the stochastic transition function $\mathcal{T}: \mathcal{S} \times \mathcal{A}^1 \times \cdots \times \mathcal{A}^N \rightarrow \Delta(\mathcal{S})$ (where $\Delta(\mathcal{S})$ denotes the set of discrete probability distributions over $\mathcal{S}$) and every player receives an individual reward  defined as $r^i: \mathcal{S} \times \mathcal{A}^1 \times \cdots \times \mathcal{A}^N \rightarrow \mathbb{R}$ for player $i$. Finally, let us write $\mathcal{O}^i = \{ o^i~|~s \in \mathcal{S}, o^i = O(s,i)\}$ be the observation space of player $i$.

Each agent learns, independently through their own experience of the environment, a behavior policy $\pi^i : \mathcal{O}^i \rightarrow \Delta(\mathcal{A}^i)$ (written $\pi(a^i|o^i)$) based on their own observation $o^i = O(s,i)$ and reward $r^i(s,a^1,\dots,a^N)$. For the sake of simplicity we will write $\vec{a} = (a^1,\dots,a^N)$, $\vec{o} = (o^1,\dots, o^N)$ and $\vec{\pi}(.|\vec{o}) = (\pi^1(.|o^1),\dots,\pi^N(.|o^N))$. Each agent's goal is to maximize a long term $\gamma$-discounted payoff defined as follow:
$$V_{\vec{\pi}}^i(s_0) = \mathbb{E} \left[ \sum \limits_{t=0}^{\infty} \gamma^t r^i(s_t, \vec{a}_t) | \vec{a}_t \sim \vec{\pi}_t, s_{t+1} \sim \mathcal{T}(s_t, \vec{a}_t) \right] $$
\vspace{-\spaceSubSec em}
\subsection{Deep multi-agent reinforcement learning}
\vspace{-\spaceSubSec em}
\label{subsection:deep_marl}

Multi-agent learning in Markov games is the subject of a large literature~\cite{Busoniu08MARL}, mostly concerned with the aim of \emph{prescribing} an optimal learning rule.  To that end, many algorithms have been proposed over the past decade to provide guarantees of convergence in specific settings. Some of them address the zero-sum two-player case~\cite{Littman94markovgames}, or attempt to solve the general-sum case~\cite{Hu98NashQ,Greenwald03CEQ}. Others study the emergence of cooperation in partially observable Markov decision processes~\cite{gmytrasiewicz2005framework, varakantham2009exploiting, yu2015emotional} but rely on knowledge of the model which is unrealistic when studying independent interaction. Our goal, as opposed to the \emph{prescriptive} agenda, is to describe the behaviour that emerges when agents learn in the presence of other learning agents. This agenda is called the \emph{descriptive} agenda in the categorization of Shoham \& al.~\cite{Shoham07}. To that end, we simulated $N$ independent agents, each simultaneously learning via the deep reinforcement learning algorithm of Mnih et al. (2015)~\cite{Mnih:2015}. 

Reinforcement learning algorithms learn a policy through experience balancing exploration of the environment and exploitation. These algorithms were developed for the single agent case and are applied independently here~\cite{leibo2017multiagent,Busoniu08MARL} even though this multi-agent context breaks the Markov assumption~\cite{Laurent11}. The algorithm we use is $Q$-learning with function approximation (i.e. DQN)~\cite{Mnih:2015}. In $Q$-learning, the policy of agent $i$ is implicitly represented through a state-action value function $Q^i(O(s,i),a)$ (also written $Q^i(s,a)$ in the following). The policy of agent $i$ is an $\epsilon$-greedy policy and is defined by $\pi^i(a| O(s,i)) = (1-\epsilon) \mathbf{1}_{a = \argmax \limits_a Q^i(s,a)} + \frac{\epsilon}{|A^i|}$. The parameter $\epsilon$ controls the amount of exploration. The $Q$-function $Q^i$ is learned to minimize the bellman residual $\|Q^i(o^i,a^i)-r^i-\max \limits_b Q^i(o'^i,b)\|$ on data collected through interaction with the environment $(o^i, a^i, r^i, o'^i)$ in $\{(o^i_t, a^i_t, r^i_t, o^i_{t+1})\}$ (where $o^i_t = O(s_t,i)$).


\vspace{-\spaceSubSec em}
\subsection{Social outcome metrics}
\vspace{-\spaceSubSec em}
\label{subsection:soms}
Unlike in single-agent reinforcement learning where the value function is the canonical metric of agent performance, in multi-agent systems with mixed incentives like the commons game, there is no scalar metric that can adequately track the state of the system (see e.g. \cite{Chalkiadakis03}). Thus we introduce four key social outcome metrics in order to summarize group behavior and facilitate its analysis.

Consider $N$ independent agents. Let $\{r^i_{t} ~ | ~ t = 1, \dots, T\} $ be the sequence of rewards obtained by the $i$-th agent over an episode of duration $T$. Likewise, let $\{o^i_{t} ~ | ~ t = 1, \dots T\}$ be the $i$-th agent's observation sequence. Its return is given by $R^i = \sum_{t=1}^T r^i_{t}$.

The \emph{Utilitarian metric} ($U$), also known as \emph{Efficiency}, measures the sum total of all rewards obtained by all agents. It is defined as the average over players of sum of rewards $R^i$. The \emph{Equality} metric ($E$) is defined using the Gini coefficient \cite{gini1912variabilita}. The \emph{Sustainability} metric ($S$) is defined as the average time at which the rewards are collected. The \emph{Peace} metric ($P$) is defined as the average number of untagged agent steps. 



\begin{minipage}{.25\textwidth}
\small
\begin{align*}
U = \mathop{\mathbb{E}}\left[\frac{\sum_{i=1}^N R^i}{T}\right],
\; E = 1 - \frac{\sum_{i=1}^N\sum_{j=1}^N |R^i - R^j|}{2N \sum_{i=1}^N R^i},
\; S = \mathop{\mathbb{E}} \left[\frac{1}{N} \sum_{i=1}^N t^i  \right]
\quad \textnormal{where}~~ t^i = \mathop{\mathbb{E}}[t ~|~ r^i_{t} > 0].
\end{align*}
\normalsize
\end{minipage}
\begin{minipage}{.48\textwidth}
\small
\begin{align*}
&P = \frac{\mathop{\mathbb{E}}\left[ NT - \sum_{i = 1}^N \sum_{t = 1}^T I(o^i_{t})   \right]}{T}
\quad\textnormal{where} ~~ I(o) = 
    \begin{cases}
        1 & ~ \textnormal{ if } o = \textnormal{time-out observation} \\
        0 & ~ \textnormal{otherwise}.
    \end{cases}
\end{align*}
\normalsize
\end{minipage}


\vspace{-\spaceSec em}
\section{Results}
\vspace{-\spaceSec em}

\vspace{-\spaceSubSec em}
\subsection{Sustainable appropriation in the single-agent case}
\label{subsection:single-agent}
\vspace{-\spaceSubSec em}

In principle, even a single agent, on its own, may learn a strategy that over-exploits and depletes its own private  resources. However, in the single-agent case, such a strategy could always be improved by individually adopting a more sustainable strategy. We find that, in practice, agents are indeed able to learn an efficient and sustainable appropriation policy in the single-agent case (Fig. \ref{fig:single-agent}).


\vspace{-\spaceSubSec em}
\subsection{Emergent social outcomes}
\label{subsection:Emergent_social_outcome}
\vspace{-\spaceSubSec em}
Now we consider the multi-agent case. Unlike in the single agent case where learning steadily improved returns (Fig. \ref{fig:single-agent}-a), in the multi-agent case, learning does not necessarily increase returns. The returns of a single agent are also a poor indicator of the group's behavior. Thus we monitor how the social outcome metrics that we defined in Section~\ref{subsection:soms} evolve over the course of training (Fig.~\ref{fig:12-agent}).

\begin{wrapfigure}{l}{0.45\textwidth}
\vspace{-1 em}
\centering
    \includegraphics[width=\linewidth]{SOMs_over_time_open_map_.pdf}
\caption{Evolution of the different social outcome metrics (Sec.\ref{subsection:soms}) over the course of training on the open map (Fig.\ref{fig:LevelOpen}) using a time-out beam of length $10$ and width $5$. From top to bottom is displayed, the utility metric ($U$), the sustainability metric ($S$), the equality metric ($E$), and the peace metric ($P$).}\label{fig:12-agent}
\vspace{-1 em}
\end{wrapfigure}

The system moves through 3 phases characterized by qualitatively different behaviors and social outcomes. Phase 1, which we may call \emph{na\"{\i}vety}, begins at the start of training and extends until $\approx$ 900 episodes. It is characterized by healthy CPR stocks (high apple density). Agents begin training by acting randomly, diffusing through the space and collecting apples whenever they happen upon them. Apples density is high enough that the overall utilitarian efficiency $(U)$ is quite high, and in fact is close to the max it will ever attain. As training progresses, agents learn to move toward regions of greater apple density in order to more efficiently harvest rewards. They detect no benefit from their tagging action and quickly learn not to use it. This can be seen as a steady increase in the peace metric $(P)$ (Fig. \ref{fig:12-agent}). In a video\footnote{learned policy after 100 episodes~\url{https://youtu.be/ranlu_9ooDw}.} of typical agent behavior in the na\"{\i}vety phase, it can be seen that apples remain plentiful (the CPR stock remains healthy) throughout the entire episode.

Phase 2, which we may call \emph{tragedy}, begins where na\"{\i}vety ends ($\approx$ episode 900), it is characterized by rapid and catastrophic depletion of CPR stock in each episode. The sustainability metric $(S)$, which had already been decreasing steadily with learning in the previous phase, now takes a sudden and drastic turn downward. It happens because agents have learned ``too well'' how to appropriate from the CPR. With each agent harvesting as quickly as they possibly can, no time is allowed for the CPR stock to recover. It quickly becomes depleted. As a result, utilitarian efficiency $(U)$ declines precipitously. At the low point, agents are collecting less than half as many apples per episode as they did at the very start of training---when they were acting randomly (Fig. \ref{fig:12-agent}). In a video\footnote{learned policy after 1100 episodes~\url{https://youtu.be/1xF1DoLxqyQ}.} of agent play at the height of the tragedy one can see that by $\approx 500$ steps into the (1100-step) episode, the stock has been completely depleted and no more apples can grow.

Phase 3, which we may call \emph{maturity}, begins when efficiency and sustainability turn the corner and start to recover again after their low point ($\approx$ episode 1500) and continues indefinitely. Initially, conflict breaks out when agents discover that, in situations of great apple scarcity, it is possible to tag another agent to prevent them from taking apples that one could otherwise take for themselves. As learning continues, this conflict expands in scope. Agents learn to tag one another in situations of greater and greater abundance. The peace metric $(P)$ steadily declines (Fig. \ref{fig:12-agent}). At the same time, efficiency $(U)$ and sustainability $(S)$ increase, eventually reaching and slightly surpassing their original level from before tragedy struck. How can efficiency and sustainability increase while peace declines? When an agent is tagged by another agent's beam, it gets removed from the game for 25 steps. Conflict between agents in the commons game has the effect of lowering the effective population size and thus relieving pressure on the CPR stock. With less agents harvesting at any given time, the survivors are free to collect with greater impunity and less risk of resource depletion. This effect is evident in a video\footnote{learned policy after 3900 episodes~\url{https://youtu.be/XZXJYgPuzEI}.} of agent play during the maturity phase. Note that the CPR stock is maintained through the entire episode. By contrast, in an analogous experiment with the tagging action disabled, the learned policies were much less sustainable (Supp. Fig.~\ref{fig:12-agent-notag}).


\begin{figure}[h]
\centering
\begin{subfigure}[b]{.43\linewidth}
\centering
\includegraphics[width=1.0\linewidth]{July13_texas_territorial_agent_scatter_plot_6000.pdf}
\caption{Territorial effect}\label{texas_territorial_effect}
\end{subfigure}
\begin{subfigure}[b]{.56\linewidth}
\includegraphics[width=1.0\linewidth]{histogram_equality.pdf}
\caption{Histogram of the equality metric on the territory maps}\label{histogram_equality}
\end{subfigure}
\caption{\textbf{(a)} Scatter plot of return by range size (variance of position) for individual agents in experiments with one tagging agent (red dots, one per random seed) and 11 non-tagging agents (blue dots, eleven per random seed). The tagging players collect more apples per episode than the others and remain in a smaller part of the map. This illustrates that the tagging players take over a territory and harvest sustainably within its boundary. \textbf{(b)} represents the distribution of the equality metric $(E)$ for different runs on four different maps with natural regions from which it may be possible to exclude other. The first map is the standard map from which others will be derived (Fig. \ref{LevelTerritoryNormal}). In the second apples are more concentrated on the top left corner and will respawn faster (Fig. \ref{LevelTerritoryUnequal}). the third is porous meaning it is harder for an agent to protect an area (Fig \ref{LevelTerritoryInvadable}). On the fourth map, the interiors walls are removed (Fig. \ref{LevelTerritoryNoWalls}). Figure \ref{histogram_equality} shows inequality rises in maps where players can exclude one another from accessing the commons.}\label{fig:territory}
\end{figure}

\vspace{-\spaceSubSec em}
\subsection{Sustainability and the emergence of exclusion}
\label{subsection:privatization}
\vspace{-\spaceSubSec em}

Suppose, by building a fence around the resource or some other means, access to it can be made exclusive to just one agent. Then that agent is called the owner and the resource is called a private good~\cite{ostrom1977public}. The owner is incentivized to avoid over-appropriation so as to safeguard the value of future resource flows from which they and they alone will profit. In accord with this, we showed above (Fig. \ref{fig:single-agent}) that sustainability can indeed be achieved in the single agent case. Next, we wanted to see if such a strategy could emerge in the  multi-agent case.

The key requirement is for agents to somehow be able to exclude one another from accessing part of the CPR, i.e. a region of the map. To give an agent the chance to exclude others we had to provide it with an advantage. Thus we ran an experiment where only one out of the twelve agents could use the tagging action. In this experiment, the tagging agent learned a policy of controlling a specific territory by using its time-out beam to exclude other agents from accessing it. The tagging agents roam over a smaller part of the map than the non-tagging agents but achieve better returns (Fig. \ref{fig:territory}a). This is because the non-tagging agents generally failed to organize a sustainable appropriation pattern and depleted the CPR stock in the area available to them (the majority of the map). The tagging agent, on the other hand, was generally able to maintain a healthy stock within its ``privatized'' territory\footnote{A typical episode where the tagging agent has a policy of excluding others from a region in the lower left corner of the map: \url{https://youtu.be/3iGnpijQ8RM}.}.

Interestingly, territorial solutions to CPR appropriation problems have emerged in real-world CPR problems, especially fisheries \cite{martin1979play, acheson2005spatial, turner2013territoriality}. Territories have also emerged spontaneously in laboratory experiments with a spatially and temporally dynamic commons game similar to the one we study here \cite{janssen2008turfs}.


\vspace{-\spaceSubSec em}
\subsection{Emergence of inequality}
\label{subsection:inequality}
\vspace{-\spaceSubSec em}

To further investigate the emergence of exclusion strategies using agents that all have the same abilities (all can tag), we created four new maps with natural regions enclosed by walls (see Supp. Fig.~\ref{fig:allmaps}). The idea is that it is much easier to exclude others from accessing a territory that has only a single entrance than one with multiple entrances or one with no walls at all. This manipulation had a large effect on the equality of outcomes. Easier exclusion led to greater inequality (Fig.~\ref{histogram_equality}). The lucky agent that was first to learn how to exclude others from ``its territory'' could then monopolize the lion's share of the rewards for a long time (Supp. Figs.~\ref{fig:best_over_others_normal} and~\ref{fig:best_over_others_unequal}). In one map with unequal apple density between the four regions, the other agents were never able to catch up and achieve returns comparable to the first-to-learn agent (Supp. Fig.~\ref{fig:best_over_others_unequal}). On the other hand, on the maps where exclusion was more difficult, there was no such advantage to being the first to learn (Supp. Figs.~\ref{fig:best_over_others_porous} and~\ref{fig:best_over_others_nowalls}).


\vspace{-\spaceSubSec em}
\subsection{Empirical game-theoretic analysis of emergent strategic incentives}
\label{subsection:schelling}
\vspace{-\spaceSubSec em}

We use empirical game theoretic analysis to characterize the strategic incentives facing agents at different points over the course of training. As in~\cite{leibo2017multiagent}, we use simulation to estimate the payoffs of an abstracted game in which agents choose their entire policy as a single decision with two alternatives. However, the method of~\cite{leibo2017multiagent} cannot be applied directly to the case of $N>2$ players that we study in this paper. Instead, we look at Schelling diagrams~\cite{schelling1973hockey}. They provide an intuitive way to summarize the strategic structure of a symmetric $N$-player $2$-action game where everyone's payoffs depend only on the number of others choosing one way or the other. Following Schelling's terminology, we refer to the two alternatives as $L$ and $R$ (left and right). We include in the appendix several examples of Schelling diagrams produced from experiments using different ways of assigning policies to $L$ and $R$ groups (Supp. Fig.~\ref{fig:Schelling_static}).

\begin{figure}[t]
\begin{subfigure}[b]{.48\linewidth}
\includegraphics[width=\linewidth]{July13_Schelling500.pdf}
\caption{Early training (after 500 episodes) Schelling diagram for $L=\text{taggers}$ and $R=\text{non-taggers}$}
\label{fig:Schelling500shoot}
\end{subfigure}\hfill
\begin{subfigure}[b]{.48\linewidth}
\centering
\includegraphics[width=\linewidth]{July13_Schelling3000.pdf}
\caption{Late training (after 3000 episodes) Schelling diagram for $L=\text{taggers}$ and $R=\text{non-taggers}$}
\label{fig:Schelling3000shoot}
\end{subfigure}%
\caption{Schelling diagram from early (\ref{fig:Schelling500shoot}) and late (\ref{fig:Schelling3000shoot}) in training for the experiment where $L=\text{taggers}$ and $R=\text{non-taggers}$.
}
\vspace{-1 em}
\label{fig:Schelling_temporal}
\end{figure}

In this section we restrict our attention to an experiment where $L$ is the choice of adopting a policy that uses the tagging action and $R$ the choice of a policy that does not tag. A Schelling diagram is interpreted as follows. The green curve is the average return obtained by a player choosing $L$ (a tagger) as a function of the number of players choosing $R$ (non-taggers). Likewise, the red curve is the average return obtained by a player choosing $R$ as a function of the number of other players also choosing $R$. The average return of all players is shown in blue. At the leftmost point, $|R|=0 \implies |L|=N$, the blue curve must coincide with the green one. At the rightmost point, $|R| = N \implies |L| = 0$, the blue curve coincides with the red curve.

\vspace{-1 mm}

Properties of the strategic game can be read off from the Schelling diagram. For example, in Fig.~\ref{fig:Schelling3000shoot} one can see that the choice of a tagging policy is dominant over the choice of a non-tagging policy since, for any $|R|$, the expected return of the $L$ group is always greater than that of the $R$ group. This implies that the Nash equilibrium is at $|R|=0$ (all players tagging). The Schelling diagram also shows that the collective maximum (blue curve's max) occurs when $|R|=7$. So the Nash equilibrium is socially-deficient in this case.

\vspace{-1 mm}

In addition to being able to describe the strategic game faced by agents at convergence, we can also investigate how the strategic incentives agents evolve over the course of learning. Fig.~\ref{fig:Schelling500shoot} shows that the strategic game after 500 training episodes is one with a \emph{uniform} negative externality. That is, no matter whether one is a tagger or a non-tagger, the effect of switching one additional other agent from the tagging group to the non-tagging group is to decrease returns. After 3000 training episodes the strategic situation is different (Fig.~\ref{fig:Schelling3000shoot}). Now, for $|R| > 5$, there is a \emph{contingent} externality. Switching one additional agent from tagging to non-tagging has a positive effect on the remaining taggers and a negative effect on the non-taggers (green and red curves have differently signed slopes). 

\vspace{-1 em}
\vspace{-\spaceSec em}
\section{Discussion}
\vspace{-\spaceSec em}

This paper describes how algorithms arising from reinforcement learning research may be applied to build new kinds of models for phenomena drawn from the social sciences. As such, this paper really has two audiences. For social scientists, the core conclusions are as follows. (1) Unlike most game theory-based approaches where modelers typically ``hand engineer'' specific strategies like tit-for-tat~\cite{Axelrod84} or win-stay-lose-shift~\cite{nowak1993strategy}, here agents must learn \emph{how} to implement their strategic decisions. This means that the resulting behaviors are emergent. For example, in this case the tragedy of the commons was ``solved'' by reducing the effective population size below the environment's carrying capacity, but this outcome was not assumed. (2) This model endogenizes exclusion. That is, it allows agents to learn strategies wherein they exclude others from a portion of the CPR. Then, in accord with predictions from economics~\cite{ostrom1990governing, acheson2005spatial, janssen2008turfs, turner2013territoriality}, sustainable appropriation strategies emerge more readily in the ``privatized'' zones than they do elsewhere. (3) Inequality emerges when exclusion policies are easier to implement. In particular, natural boundaries in the environment make inequality more likely to arise.

\vspace{-1 mm}

From the perspective of reinforcement learning research, the most interesting aspect of this model is that---despite the fact that all agents learn only toward their individual objectives---tracking individual rewards over the course of training is insufficient to characterize the state of the system. These results illustrate how multiple simultaneously learning agents may continually improve in ``competence'' without improving their expected discounted returns. Indeed, learning may even decrease returns in cases where too-competent agents end up depleting the commons. Without the social outcome metrics (efficiency, equality, sustainability, and peace) and other analyses employed here, such emergent events could not have been detected. This insight is widely applicable to other general-sum Markov games with mixed incentives (e.g.~\cite{kleimanWeiner2016, leibo2017multiagent}).

\vspace{-2 mm}

This is a reductionist approach. Notice what is conspicuously absent from the model we have proposed. The process by which groups of humans self-organize to solve CPR problems is usually conceptualized as one of rational negotiation (e.g.~\cite{ostrom1990governing}). People do things like bargain with one another, attempt to build consensus for collective decisions, think about each other's thoughts, and make arbitration appeals to local officials. The agents in our model can't do anything like that. Nevertheless, we still find it is sometimes possible for self-organization to resolve CPR appropriation problems. Moreover, examining the pattern of success and failure across variants of our model yields insights that appear readily applicable to understanding human CPR appropriation behavior. The question then is raised: how much of human cognitive sophistication is really needed to find adequate solutions to CPR appropriation problems? We note that nonhuman organisms also solve them~\cite{rankin2007tragedy}. This suggests that trial-and-error learning alone, without advanced cognitive capabilities may sometimes be sufficient for effective CPR appropriation.

\small{{
\bibliographystyle{plain}
