{'fraction_non_alphanumeric': 0.029895429246078596, 'fraction_numerical': 0.009529431607353686, 'mean_word_length': 5.004303797468355, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Evolutionary prisoner's dilemma games on the network with punishment and opportunistic partner switching

Punishment and partner switching are two well-studied mechanisms that support the evolution of cooperation. Observation of human behaviour suggests that the extent to which punishment is adopted depends on the usage of alternative mechanisms, including partner switching. In this study, we investigate the combined effect of punishment and partner switching in evolutionary prisoner's dilemma games conducted on a network. In the model, agents are located on the network and participate in the prisoner's dilemma games with punishment. In addition, they can opportunistically switch interaction partners to improve their payoff. Our Monte Carlo simulation showed that a large frequency of punishers is required to suppress defectors when the frequency of partner switching is low. In contrast, cooperation is the most abundant strategy when the frequency of partner switching is high regardless of the strength of punishment. Interestingly, cooperators become abundant not because they avoid the cost of inflicting punishment and earn a larger average payoff per game but rather because they have more numerous opportunities to be referred as a role agent by defectors. Our results imply that the fluidity of social relationships has a profound effect on the adopted strategy in maintaining cooperation.


Introduction
The evolution of cooperation is an actively studied subject in the biological and physical sciences [1][2][3]. Social efficiency can be enhanced if each individual pays the cost of cooperation in helping other individuals. However, individuals can maximise their own benefit by enjoying the fruits of others' cooperative behaviour without paying the cost of cooperation. This temptation to free-ride on the cooperation of others makes cooperation vulnerable against defectors. The tension between social efficiency and individual welfare is called 'social dilemma' and is analysed within the framework of (evolutionary) game theory.
In this paper, we examined the combined effect of two mechanisms adopted in previous literature-punishment and partner switching. Punishment is an additional strategy that is appended to standard social dilemma games, the strategies of which are limited to cooperation or defection (free-riding) [16]. Punishers not only pay the cost of cooperation but also incur a cost in punishing defectors. Experimental studies have shown that appending a punishment strategy enhances the level of cooperation [17][18][19]. This observation raises another evolutionary puzzle because there are no incentives for each individual to bear the cost of punishment. Cooperators in particular are called second-order free-riders because they only incur the cost of cooperation and avoid the burden of imposing punishment [20]. Researchers have explained the evolution of punishment by referring to group selection [21], reputation [22][23][24], spatial interaction [25][26][27][28][29][30][31][32] and a combination of these multiple mechanisms [33].
Despite its importance, punishment is not always the dominant solution in solving the social dilemma problem when other options are available [34]. Field research of human behaviour has indicated that the severing of social ties with free-riders is more widely observed than the costly imposition of punishment [35]. The effects of the modifications of social relationships have been studied extensively under the framework of the co-evolutionary game [36,37]. Models of the evolutionary games on the (social) network assume that agents are located on the network and that game interactions occur with neighbours who are connected by links [13][14][15]. Co-evolutionary game models consider the possibility that agents sever the links with current neighbours and construct new links on the basis of the strategy and payoff from the games in which they have participated [38][39][40][41][42][43][44][45][46][47][48][49][50][51][52][53][54]. These models showed that sufficient opportunities for link adaptation can foster the evolution of cooperation. Human experiments also showed that opportunities for partner switching induce higher cooperation levels [55][56][57][58][59]. The co-evolutionary framework is applied to other social phenomena, including consensus formation [60] and the evolution of fairness [61][62][63][64].
Here we introduce the partner switching mechanism and punishment strategy to the prisoner's dilemma game (PDG) on a network. By conducting Monte Carlo experiments we showed that punishers can repress defectors without partner switching if the strength of the punishment is high. In contrast, cooperation is the most abundant strategy when the frequency of link adaptation is high regardless of the strength of the punishment. Notably, a high frequency of cooperators is achieved without their gaining a higher average payoff per game than that gained by punishers. Our simulation outcomes-to be shown in detail shortly-imply that the distinction between punishers and second-order free-riders is blurred in the co-evolutionary PDG.
In what follows, we first explain the PDG with network evolution and punishment. Then, we present the results of the simulation. In the last section, we discuss the implications of our results.

Model
In the standard version of the PDG, agents have two strategies: cooperation (C) and defection (D). Cooperators incur a cost in helping other agents, while defectors do not.
The burden of the cooperation cost leads to the cooperators being at a payoff disadvantage in comparison with defectors, and cooperators become extinct without the support of additional mechanisms. In this study, we use the extended version of the PDG that includes the punishment (P ) strategy. Punishers pay the cost of cooperation in the same manner that cooperators do. In addition, after observing the partner's choice (C or D), punishers incur the cost of sanction (γ) to apply a fine (α) to defectors. Using the rescaled payoff matrix [13] and appending the punishment strategy, the payoff matrix of a studied game is given by [29]: where b is the temptation to defect (1 < b < 2). Cooperators are called second-order free-riders because they do not incur the cost of punishment.
Next, we explain the evolutionary process of the strategy and network structure within which the game is played. We consider a set of N agents who are placed on the network. Links between nodes (agents) represent social relationships (game interactions) existing between two agents. Initially, agents are located on a homogeneous network (average degree, k ), where each agent's neighbour is randomly decided [65]. Each agent's strategy is uniformly distributed.
The Monte Carlo simulation consists of two kinds of events: strategy updating events and partner switching events. Strategy updating events occur with the probability 1 − w. In strategy updating events, one link is chosen randomly [44,66], and the roles of two connected agents (focal or role) are also determined randomly. The focal agent may imitate the role agent's strategy on the basis of the comparison of payoffs from games. In particular, each agent participates in PDG with punishment with all the neighbours and accumulates payoffs. Next, the payoffs are compared and the focal agent imitates the strategy of the role agent with a probability derived by the following equation: where Π f (Π r ) denotes the accumulated payoff of the focal (role) agent. The β is the intensity of selection (β → 0 im-The strategy of a focal agent neighbour potential new neighbour Table 1 The combinations of the strategy of a focal agent, a randomly selected current neighbour and a randomly selected potential new neighbour (current non-neighbour) that lead to link adaptation are shown. Link adaptation does not occur in other cases because payoff improvement is not achieved.
plies the random adoption of a strategy, whereas β → ∞ implies the deterministic imitation). In the following analysis, we set the value of β to 0.1, which implies that agents tend to adopt a strategy that results in a higher payoff, but the possibility of 'irrational' imitation is also allowed. We assume that with probability µ, mutation occurs in strategy updating events and that a focal agent adopts one strategy randomly [27]. The possibility of mutation ensures that the resultant distribution of strategies is robust against small perturbations. Partner switching (link adaptation) events occur with the probability w, and one randomly chosen focal agent may cut a relationship with one randomly selected current neighbour and construct a relationship with one randomly selected non-neighbour. Following standard literature [37], we assume that agents modify social relationships on the basis of the strategy that other agents adopt. In particular, the focal agent severs the link with one randomly selected current neighbour and reconnects that link with one randomly selected non-neighbour (potential new neighbour) if the rewiring realises the strict improvement in payoff (combinations of strategies that result in link adaptation are shown in Table 1; see also payoff matrix (1)). In this regard, agents depend on local knowledge (information on neighbours' strategies) as well as reputational knowledge (information on non-neighbours' strategies) [58].
In link adaptation events, for example, a focal cooperator (punisher) switches partners when a selected neighbour is a defector and a selected non-neighbour is a cooperator or a punisher because an interaction with this player (a new neighbour) results in a larger payoff. This is the same for a focal defector if we assume that the fine of punishment is not large enough for a focal defector to prefer defectors over punishers in game interactions (b − α > 0). In addition, a defector can sever the partnership with a punisher and establish a link with a cooperator. In contrast, when the fine of punishment is large (b − α < 0), defectors prefer cooperators over defectors, defectors over punishers and modify partnerships accordingly. Partner switching does not occur in other cases because the link rewiring lowers the payoff or does not change the situation. We call this link adaptation rule 'opportunistic partner switching' because agents seek to improve their gain by finding more beneficial interactions. We report mainly the results with b − α > 0 because the basic result is the same in either case. We briefly mention the case where b − α < 0 at the end of the Results section and explain why both cases reach similar results. In the simulation, we imposed the restriction that the link to an agent who has only one neighbour may not be severed so that all agents can participate in the PDG [41].

Results
To investigate the results of the evolutionary process, we conducted Monte Carlo simulations. The simulation continued for 10000 × N periods in the first place, and we averaged the values of following 20000 × N periods to calculate the quantities of interest. Our main interest is in the frequency of each strategy (ρ C , ρ D and ρ P ). We report the average of five independent simulations for each combination of parameters to enhance statistical accuracy. In the analysis, we varied the values of w and α and basically utilised the values b = 1.15 and γ = 0.05 because utilising other game parameters did not change the qualitative pattern.
First, in providing an overview of the basic results of the simulation, we report the frequency of cooperative individuals (ρ C + ρ P ) as a function of the temptation to defect (b). Figure 1 shows that cooperation deteriorates with small b when partner switching is slow (w = 0.1) and the punishment fine is small (α = 0.1). Defectors who exploit cooperators and punishers to achieve a larger payoff can proliferate in the population. The figure also shows that both partner switching and harsh punishment can help cooperative agents. A more gradual decrease of cooperators and punishers was observed with harsher also helped cooperators and punishers: they predominated over defectors with larger b until a discontinuous drop was observed.
To elaborate the effects of partner switching and punishment, we report ρ C and ρ P as a function of w for different values of α in Fig. 2. Panel (a) shows the result of harsh punishment (α = 0.51), and only the existence of a strong punisher is sufficient to outperform defectors. Defectors are suppressed without fast partner switching (small w). In this situation, a certain number of punishers is required because cooperators cannot resist the invasion by mutant defectors. Defectors acquire higher payoff in each game and cooperators diminish their frequency without the support of punishers. The panel also shows that the frequency of cooperators increases as the value of w becomes larger. Panel (b) shows the results of weak punishment (α = 0.17), and defectors proliferate when w is small. However, a discontinuous increase in ρ C and ρ P is observed as w exceeds the specific value. In addition, the cooperator is the winner of the evolutionary process in this phase, and the frequency of cooperators is larger than that of punishers. The frequency of cooperators is about twice that of punishers with this combination of parameters.
To provide the comprehensive explanation of the patterns that were observed in Fig. 2, we report ρ C and ρ P in the w − α space in Fig. 3. When w is small evolutionary outcomes are dependent on the strength of punishment: larger α is required for the evolution of cooperation and punishment. Note that the required efficiency of punishment (α/γ) depends on the cost of punishment (γ). In In contrast, we confirmed that, when γ is large (γ = 0.30), relatively less efficient punishment (α = 0.88) is sufficient to repress defectors without partner switching. When w is sufficiently large, defectors diminish in frequency regardless of the size of α. This result is not surprising because many previous studies have shown that fast partner switching can support the evolution of cooperation without punishment. The novel finding here is that the winners of the evolutionary process in this situation are cooperators.
The result indicating that cooperators outperform punishers when the frequency of partner switching is high may seem to be a natural one because cooperators are second-order free-riders, and they do not incur the cost of punishment. However, the mechanism that supports the proliferation of cooperation is more intricate. To understand the evolutionary process, we first compute the average payoff per game for each strategy (π C , π D , π P ) and report the time-series of their differences (π C − π D and π C − π P ) in Fig. 4. The figure shows that cooperators earn a larger payoff than do defectors. Although defec- Period/N Differences in average payoff π C − π D π C − π P Fig. 4 Payoff difference (π C − π D and π C − π P ) as a function of time. We calculated the mean values for every N period. Payoff for cooperators exceeded that of defectors in the early rounds of the simulation. In contrast, the advantages for cooperators over punishers disappeared at the early stages of the simulation. Parameters: N = 50000, k = 8, b = 1.15, γ = 0.05, α = 0.17, w = 0.4, β = 0.1, µ = 0.005.
tors earn a larger payoff by free-riding at the outset of the simulation, this advantage deteriorates rapidly. Previous studies have pointed out that an assortment of cooperators is the key to the success of the cooperators in evolutionary games on the network and that the assortment is helped by partner switching because cooperators can sever the relationships with defectors [42].
The figure also shows that cooperators earn a larger payoff than punishers during the early stages of the simulation process. Because only punishers incur the cost of punishment, second-order free-riders (that is, cooperators) acquire larger payoff. However, the advantage for cooperators disappears quickly, and they earn a smaller payoff than punishers. (This situation does not appear in the case of well-mixed populations where punishers gain a smaller average payoff than do cooperators as long as defectors exist.) This disadvantage for cooperators is the result of the opportunistic link adaptation mechanism. To achieve a larger payoff by avoiding the fine of punishment, defectors sever their relationships with punishers and create new links with cooperators. Consequently, punishers can avoid the burden of interactions with defectors although they earn a smaller payoff than cooperators once they participate in interactions with defectors. The co-evolutionary process thus improves the absolute payoff as well as average payoff per game of punishers. In addition, although cooperators do not suffer from decreases in absolute payoff due to partnerships with defectors, link adaptation leads to the transfer of the risk of invasion by defectors to cooperators. The partner switching mechanism thus changes the situations where cooperators just free-ride on punishers.
Paradoxically, links with defectors support the evolutionary success of cooperators. Because defectors' relationships with cooperators and punishers are severed, they suffer from a lower average payoff per game, as well as a smaller number of games in which they can participate. Consequently, transitions from defection to cooperation or punishment are facilitated. However, cooperators enjoy the larger benefit from this transition. We counted the number of times defectors adopt cooperation (n D→C ) and punishment (n D→P ) and report the time-series of their ratio (n D→C /n D→P ) in Fig. 5. The figure shows that the number of transitions from defectors to cooperators is larger than that from defectors to punishers. The advantage for cooperators is prominent even if we consider the ratio of strategy frequency (ρ C /ρ P ) that is also plotted in Fig. 5. Although more cooperators than punishers adopt a defective strategy, the larger number of relationships with defectors leads to the proliferation of cooperators because the absolute number of transitions to cooperator is larger than that of transitions to defector.
This advantage for cooperators stems from the fact that partnership with defectors supports cooperators by securing larger opportunities to enforce their strategy on defectors. Because defectors sever their relationships with punishers, defectors and punishers tend to be segregated and strategy transmission between these two types of agents becomes rare. In contrast, since those with severed links to punishers are connected to cooperators, cooperators have a greater number of opportunities to be referred as a role agent and for their strategies to be copied by de- fectors. These patterns are verified by the ratio of n D−C to n D−P . Here, n D−C (n D−P ) denotes the number of times that strategy updating events between a focal defector and a role cooperator (punisher) occurred. As shown in Fig. 5, strategy updating events between focal defectors and role cooperators occurred more frequently and cooperators have larger opportunities to enforce their strategy. Once the partner switching mechanism achieves the payoff dominance over defectors, a link with defectors brings cooperators the opportunities of proliferation rather than the risk of invasion.
In addition, connection with defectors is beneficial for cooperators regarding the number of games in which they can participate. In the short term, interactions with defectors result in zero payoff and are not immediately beneficial for cooperators. However, once defectors turn into cooperators, cooperators can enjoy the positive payoff from a larger number of games, which also helps cooperators to effectively enforce their strategy on defectors. Figure 5 shows that n D→C /n D→P is slightly larger than n D−C /n D−P , which implies that cooperators who earn a larger payoff exploit the opportunities of strategy enforcement more effectively.
We confirmed that the same pattern is observed when α is large although the result is not reported here. Because harsh punishment diminishes the number of defectors, the effective frequency of link adaptation is lowered. How- ever, the advantage of being imitated by defectors more frequently is achieved when w is large enough and cooperators proliferate as we observed in Fig. 2 and 3. Last, we consider the case where the fine of punishment is larger than the temptation to defect (b − α < 0) and defectors prefer interactions with defectors over those with punishers. Figure 6 reports the resultant frequency of each strategy as a function of w when punishment is strong (α = 1.5). The pattern that was observed in Panel (a) of Fig. 2 is replicated: punishers are required when w is small, whereas cooperators achieve a larger frequency when w is large. Although focal defectors prefer interactions with defectors over those with punishers, cooperators remain the most preferred interaction partner. Consequently, cooperators still have a large number of opportunities to enforce their strategy on defectors when w is large.

Discussion
In this paper, we examined the evolutionary PDG with punishment and partner switching. Our simulation results showed that harsh punishment can suppress the proliferation of defectors even when the frequency of partner switching is low. Defectors also diminish in frequency when the frequency of partner switching is high, and cooperators outperform punishers in this situation. The advantage of cooperators in this situation is not derived from the fact that they do not incur the cost of punishment and acquire larger average payoff per game. In well-mixed populations or on the static network, cooperators are just second-order free-riders. With opportunities for partner switching, however, defectors try to sever their relationship with punishers and make connections with cooperators. This network evolution diminishes cooperators' payoff advantage over punishers. The advantage for cooperators results from the fact that they have more opportunities to enforce their strategy on defectors, thereby increasing the frequency of cooperators in their neighbourhood.
Our results showed that the abundance of each strategy in social dilemma differs depending on the frequency of partner switching. This fact suggests that the fluidity of social relationships has a profound effect on what strategy is favoured in the evolutionary process. A simple cooperation strategy is favoured with a high level of social fluidity, whereas the punishment strategy is favoured in the society with fixed social relationships. In addition, our model suggests that the normative distinction between punishers and second-order free-riders is not so clear because punishers can avoid interactions with defectors. This observation might be related to the fact that punishers do not necessarily enjoy positive reputations [67].
Although our model builds on the understanding of the combined effect of partner switching and punishment, further analysis is warranted. For example, anti-social punishment is indicated as another obstacle to the evolution of cooperation (punishment) [68] and an investigation into its effects may be required. In addition, adding a reward strategy [69,70] may lead to an interesting pattern. Furthermore, since the number of opportunities to enforce the strategy played a large role in the model, introducing other rules of strategy updating may be required [71][72][73]. We believe that this line of research will further deepen our understanding of the evolutionary origin of cooperation.