agents. Those unpenalized consequences are called *externality*. There can be both positive externality and negative externality. Under positive externality, agents are lacking motivations to do things that are good for the society. Under negative externality, agents are lacking motivations to prevent things that are bad for the society. In the epidemic model, there are negative externality with infected agents.

To improve social welfare, we need to “internalize" externality, i.e., add penalty for “spreading" the disease. Now let us redefine agent $i$’s run-time cost as $$\label{eq: shaped cost}
\tilde l_{i,k} = x_{i,k+1} + \alpha_i p(u_{i,k}) + x_{i,k} q(u_{i,k}),$$ where $q(\cdot)$ is a monotonically increasing function. The last term $x_{i,k}q(u_{i,k})$ does not affect healthy agents since $x_{i,k} = 0$, but adds a penalty for infected agents if they choose large activity level. One candidate function for $q(u)$ is $1-(1-u)^{m_k}$. In the real world, such “cost shaping" using $q$ can be achieved through social norms or government regulation. The expected cost becomes $$\label{eq: expected cost tilde}
\mathbb{E}[\tilde l_{i,k} ]  = \left\{\begin{array}{ll}
1-\Pi_{j\in\mathcal{I}_k} (1-\min\{u_i,u_j\}) + \alpha_i p(u_{i,k}) & \text{if }x_{i,k} = 0\\
1 + \alpha_i p(u_{i,k}) + q(u_{i,k}) & \text{if }x_{i,k} = 1
\end{array}\right.$$ Suppose the function $q$ is well tuned such that the 