Modeling and Simulation of Impact and Control in Social Networks with Application to Marketing

: The problems of social networks analysis and calculation of the resulting opinions of network agents are considered. Algorithms for identifying strong subgroups and satellites as well as for calculating some quantitative characteristics of a network are implemented by the R programming language and tested on model examples. A new algorithm for calculating the resulting opinions of agents is developed by the R toolkit and tested on model examples. It is important that control actions that exert impact to the opinions should be applied exclusively to the members of strong subgroups (opinion leaders of a target audience), since they fully determine the stable resulting opinions of all network members. This approach allows saving control resources without signiﬁcantly a ﬀ ecting its e ﬃ ciency. Much attention is paid to the original models of optimal control (single subject) and conﬂict control (several competing subjects) under the assumption that the members of strong subgroups (opinion leaders) are already identiﬁed at the previous stage of network analysis. Models of optimal opinion control on networks are constructed and investigated by computer simulations using the author’s method of qualitatively representative scenarios. Di ﬀ erential game-based models of opinion control on networks with budget constraints in the form of equalities and inequalities are constructed and analytically investigated. All used notions, approaches and results of this paper are interpreted in terms of marketing problems.


Introduction
French [1] and Harary [2] proposed the pioneer models of influence in social networks. The most famous basic model, which is also adopted in this paper, belongs to De Groot [3]. Later on, a number of modifications and refinements of this model were presented, including, e.g., the case of time-dependent mutual influence of agents [4][5][6][7], the convergence conditions of opinions [8][9][10], the rate of convergence [4,10] and conditions of the resulting opinion (consensus) uniqueness [4,5].
In [11], the Markov model of influence in a social group described by a dynamic Bayesian network with a two-level structure (individual agents and the entire group) was introduced. This model is closely connected with a number of other models of the same class, e.g., mixed memory Markov models [12], implicit paired Markov models [13] and the tree-like models of dynamical systems [14].
The most complete survey of influence models over networks can be found in the monograph [15] and paper [16] by Jackson. Communication and coordination in social networks were analyzed in [17]. The papers [18][19][20] were dedicated to the modeling of the word-of-mouth effects. The relative influence and conflict control (competing control subjects) under the assumption that the members of strong subgroups (opinion leaders) are already identified at the previous stage of network analysis. Thus, the paper makes the following contributions: 1.
The problems of analyzing networks and calculating the resulting opinions of network agents are interpreted in terms of marketing problems. No doubt, they will find applications in other fields such as politics and sociology [47].

2.
Algorithms for identifying strong subgroups (representing opinion leaders) and satellites (other members of the target audience) as well as for calculating some quantitative characteristics of a network using the R programming language [48] are implemented and tested on model examples.

3.
A new algorithm for calculating the resulting opinions of agents is developed, implemented in the R language and tested on model examples. 4.
Models of optimal opinion control on networks are constructed and investigated by computer simulations using the author's method of qualitatively representative scenarios [49]. 5.
Differential game-based models of opinion control on networks with budget constraints in the form of equalities and inequalities are constructed and analytically investigated. Some marketing interpretations are made.
In Section 2, the basic model of influence in a social group is described, including an interpretation to marketing problems; in addition, the corresponding problems of analysis and prediction are formulated, and some illustrative examples are given. Sections 3 and 4 are dedicated to the analytical investigation of the optimal control problems and game-theoretic models of opinion control on networks, respectively. The results and possible future prospects are summarized in Section 5.

Network Analysis and Calculation of Resulting Opinions of Agents
Following [50], we describe the basic model of influence in a social network. A group of n agents y 1 , . . . , y n makes a decision on some issue. At the initial time instant t = 0, each agent y i has some opinion x i (0) on this issue; the vector of initial opinions x 0 = x(0) = (x 1 (0), . . . , x n (0)) is given. Denote by a ij ≥ 0 the influence level of y i on y j (equivalently, the degree of trust of y j to y i ). Generally speaking, the values a ij can be called the coefficients of interaction of network agents. A network is described by an influence digraph D = (Y, A), Y = y 1 , . . . , y n , A = a ij n i,j=1 . We make the following assumptions: D remains invariable during the decision process; all decisions are made at discrete time instants t = 0, 1, 2, . . .; the opinions of different agents evolve in accordance with the rule a ij x i (t), j = 1, . . . , n. (1) The natural questions are: (ii) will the entire group converge to the same resulting opinion (consensus) A set of nodes y 1 , . . . , y k of an influence digraph D = (Y, A) will be called a strong subgroup if it represents a strong component of D that enters the node base B* of the condensation D*. Let us recall the definitions [50]. The subdigraph K of a digraph D = (Y, A) is called a strong component in D if it is (1) strongly connected; (2) generated by the respective set of nodes; (3) maximal by inclusion of nodes. The set B* is called a node base in a digraph D = (Y, A) if (1) for any node b ∈ Y\B* there is a node a ∈ B* such that there is a path from a to b; (2) B* is a minimal set having the property (1). The digraph D* = (Y*,B*) is called the condensation of a digraph D if(1) Y* = K 1 , . . . , K p , where K 1 , . . . , K p are strong components in D; (2) We compile a list of strong subgroups S 1 , . . . , S z and number all nodes sequentially, for the sake of definiteness in the following way: S 1 = y 11 , . . . , y 1n 1 , S 2 = y 21 , . . . , y 2n 2 , . . . , S z = y z1 , . . . , y zn z , where z is a number of strong subgroups. We also number the nodes from the transition set (i.e., all other nodes): T = y z+1,1 , . . . , y z+1,n z+1 . If a node y ij belongs to S i , then Therefore, the resulting opinion of each member of a strong subgroup depends on the initial opinions of its other members only, being the same for the entire subgroup. If a node y z+1, j belongs to T, then Thus, the resulting opinion of each member of a transition set (called satellite) depends on the opinions of all strong subgroup members. Other satellites have no impact on it. The resulting opinion is a linear convolution of the common resulting opinions of all strong subgroups [50].
The algorithms for identifying strong subgroups and satellites as well as for calculating the resulting opinions of agents were developed and implemented using the R programming language in [48]. Consider a model example to illustrate the above concepts and test the algorithms.
The strong subgroups and satellites obtained using the algorithm can be seen in Figure 2. Node 10 (analyst) has a strong influence on nodes 11-15 (programmers), that is, people from the same financial category, with the same interests, who communicate only with each other and with the analyst as a link between them and the rest of the staff. Nodes 6-8 (the first strong subgroup) correspond to the marketing and sales department. Node 9 is the project manager; node 2 is the implementation department (the second strong subgroup). The other nodes correspond to ordinary employees.
The resulting opinions of the agents calculated by the developed algorithm are given by Based on the analysis of the model example, we can conclude that the opinion leaders of this IT firm (except for the manager) are employees 2, 6, 7 and 8 becausethe sets {2} and {6,7,8} are strong subgroups. Despite the fact that the subgroup of employees 9-15 is quite large and has close communication, their resulting opinions are still formed by the leaders; moreover, employees 9 and 10 are a kind of bridge between this subgroup and the leaders. Accordingly, employees 2, 6-8 indirectly influence agents 11-15, forming their opinion.  One way or another, all employees listen to the opinion of leaders, changing their own ones; at the same time, the leaders listen to the opinions of each other (as in the case of employees 6-8), or do not change their opinion at all (as in the case of employee 2). Therefore, the opinions of the entire staffcan be controlled (e.g., for increasing the contribution to the gift) by affecting the opinions of employees 2, 6-8 only, not all the fifteen agents.
Summarizing the outcomes of this section, we note that influence models over networks can be used for solving analysis and prediction problems. The former class of problems includes identification of strong subgroups and satellites as well as calculation of quantitative characteristics of networks [51]. The latter class of problems is focused on predicting the opinion dynamics of social group members based on its structure identified in the course of analysis (Table 1).

Optimal Control over Networks
Thus, the main control hypothesis in both cases (a single subject or several competing subjects) is that control actions (marketing strategies) should be applied only to the members of strong subgroups (opinion leaders), since they alone determine the resulting opinions of all network members. In Section 3, we consider the models of optimal opinion control over networks in which a monopolistic firm is the subject of control. We assume that all opinion leaders have been already identified and the control actions are applied to them only.
More specifically, consider the optimal control problem The notations are the following: x t j ,x t+1 j are the opinions of agent j at time instants t, t + 1 respectively; u t j as the control action applied to agent j at a time instant t; R as the marketing budget of the firm; a ij as the coefficients of interaction of agents i and j; b j as the cost coefficient to control agent j; m as the number of strong subgroups members; n as the total number of agents; T as the time horizon; finally, ρ as the discount factor; x j0 is an initial opinion of the agent j.
Computer simulations with model (4)- (6) were performed to answer two questions as follows. First, is it possible to hypothesize that when introducing control (e.g., by rule (6)), the resulting opinions of all agents will still be determined only by the initial opinions of strong subgroups members, like in the case of the natural opinion dynamics (1)?
To answer this question, numerical experiments were carried out for three model examples [51] with different values of the model parameters. As an illustration we consider the following data set for the model example of Section 2: the marketing budget R = 60,000 (conditional units); the time horizons T = 200, 500, 20, 000; the total number of agents n = 15; the vector of initial opinions x 0 = (500, 900, 500, 400, 400, 500, 800, 500, 600, 400, 100, 200,200, 300, 500). For each agent, the control action was calculated by the formula u j = R T·n , j = 1, . . . , n. The resulting opinions and payoffs of the monopolistic firm are combined in Table 2. Here the second row corresponds to the impact exerted on all agents while the third row to the impact exerted on the strong subgroups members only. Table 2. Resulting opinions and payoffs in model example. In accordance with Table 2, the impact on the strong subgroups members only is more effective than the impact on all agents, both in terms of the payoff and the resulting opinions. Similar results were obtained for the other data sets, which gives an affirmative answer to the first question of the study.
The second question concerns the minimum number of simulation scenarios required for making an acceptable qualitative forecast. To answer this question, the author's method of qualitatively representative scenarios of simulation modeling was adopted; see [49].
A collection of scenarios QRS = u 1 , u 2 , . . . u m is said to be a set of qualitatively representative scenarios for the optimal control problem with an accuracy ∆ if: (a) for any two scenarios u i , u j ∈ QRS, (b) for any other scenario u l QRS there exists a scenario u j ∈ QRS such that We check that in the model example, the values T = {200, 500, 200,000} are a set of qualitatively representative scenarios. The corresponding data are presented in Table 3. The scenarios for which the conditions of qualitative representativeness were checked are set in boldface. Thus, the qualitative representativeness conditions in this example are really satisfied with an accuracy of ∆ = 19,000, which is small compared to the values of the payoffs. Similar checks were performed for the other parameters of this example (as well as of the two other model examples) and confirmed a proper choice of qualitatively representative scenarios in all cases.

Game-Theoretic Models of Opinion Control over Networks
In this section, we consider differential game-based models of opinion control over networks in which players are competing firms. We study the cases of budget constraints in the form of equality and inequality. In both cases, we compare the independent (individual) and cooperative behavior of players (the latter setup reduces the game-theoretic model to an optimal control problem). We use the Hamilton-Jacobi-Bellman equations and Lagrange's method of multipliers in the case of equality constraints, reducing the case of inequality constraints to it.

Model 1 (budget constraint in form of equality)
First, consider the independent behavior of the players. The problem of firm i has the form where serial numbers j and i are associated with agents and firms, respectively; N and r give the total number of agents and firms, respectively; the other notations are the same as in Section 3. Different firms separately decide which agents of strong subgroups to influence. Therefore, we let b i j = 0 if firm i does not affect agent j.
We write the Hamilton-Jacobi-Bellman equation where µ is the Lagrange multiplier. After simple transformations, we obtain Let the Bellman functions be linear: Then Equation (9) can be written as Equalizing the factors at the identical powers of x, we arrive at the differential equations for the factors at x, j = 1, 2, . . . , N, and for the free term. Now, we write the system of Equation (11) in matrix form: where A is the influence matrix; the column vector α consists of the factors α j , j = 1, 2, . . . , N; I denotes an identity matrix of compatible dimensions; finally, ε is the N-dimensional column vector of unities.
Solving the system of differential Equations (13) gives The column vector of the integration constants can be found from the boundary-value conditions As a result, We solve Equation (12) by the method of variation of constants: Then and hence it follows that Because and consequently Therefore, For t = 0, Thus, where α j (0), j = 1, 2, . . . , N, are the components of the vector α(0); see (14). It remains to solve an isoperimetric problem: for each firm i, allocate resources over time so that the i-th term of (15) achieves maximum, The Lagrange function for this problem is given by The Euler equation takes the form Hence, The Lagrange multiplier can be calculated from the budget constraint We have: Finally, With independent behavior, the payoff of each player makes up where α j (0) are the components of vector (14), j = 1, 2, . . . , N.
Substituting the expression of R t i into (10), we obtain the optimal control formula Now, consider the cooperative behavior of the players, under which the original game is reduced to the optimal control problem where serial numbers j and i are associated with agents and firms, respectively; N and r give the total number of agents and firms, respectively. Different firms separately decide which agents of strong subgroups to influence. Therefore, we let b i j = 0 if firm i does not affect agent j. We write the Hamilton-Jacobi-Bellman equation subject to the constraint r i=1 N j=1 u i j x j (t) = R t . Maximization over u i j , i = 1, 2, . . . , r, j = 1, 2, . . . , N, yields where µ is the Lagrange multiplier. Then for any 1 ≤ i 1 , i 2 ≤ r and 1 ≤ j 1 , j 2 ≤ N, and hence Let the Bellman function be linear: By analogy with the previous case, we may write Equation (16) as Equalizing the factors at the identical powers of x, we arrive at the differential equations for the factors at x, j = 1, 2, . . . , N, and for the free term. Now, we write the system of Equation (18) in matrix form: where A is the influence matrix; the column vector α consists of the factors α j , j = 1, 2, . . . , N; I denotes an identity matrix of compatible dimensions; finally, ε is the N-dimensional column vector of unities.
Solving the system of differential Equation (20) gives Due to the boundary-value conditions We solve Equation (19) by the method of variation of constants: which gives we have Therefore, For t = 0, where α j (0), j = 1, 2, . . . , N, are the components of the vector α(0); see (21). Once again, it remains to solve a simple isoperimetric problem: allocate resources over time so that the last term of (22) achieves maximum.
The Lagrange function for this problem is given by The Euler equation takes the form Hence, The Lagrange multiplier can be calculated from the budget constraint We have 1 Finally, In the case of cooperative behavior, the total payoff makes up where α j (0) are the components of vector (21), j = 1, 2, . . . , N. Substituting the expression of R t into (17), we obtain the optimal control formula Let us compare the payoffs in the cases of independent behavior and cooperation of the players. With independent behavior, the total payoff is given by In other words, we have to compare the term for the case of independent behavior with the term for the case of cooperation.
In accordance with the Holder inequality, for r pairs of positive numbers u i , v i , i = 1, 2, . . . , r, if p < 1, p 0 and 1 p + 1 q = 1. Denoting and letting p = q = 2, by the Holder inequality we establish that i.e., the total payoff of all firms with independent behavior does not exceed its counterpart in the case of their cooperation.

Model 2 (budget constraint in form of inequality)
First, consider the independent behavior of the players. The problem of firm i has the form where serial numbers j and i are associated with agents and firms, respectively; N and r give the total number of agents and firms, respectively. Different firms separately decide which agents of strong subgroups to influence. Therefore, we let b i j = 0 if firm i does not affect agent j. For solving this problem with inequality constraints, consider the following set of problems with equality constraints: a lj x l (t), x j (0) = x j0 , j = 1, 2, . . . , N, with an arbitrary value of the parameter R i , 0 ≤ R i ≤ i . Later, we will choose an appropriate value of R i for which the solution is achieved. By analogy with the previous case, we calculate the payoff of each player i with independent behavior in the form where α j (0) are the components of the vector α(0) = e (A−ρI)T − I (A − ρI) −1 ε,j = 1, 2, . . . , N, and also the optimal control action Now, we get back to the original statement of the problem with inequality constraints, trying to find for which value of the parameter R i from the range [0, i ] the payoff of firm i achieves maximum. From this point onwards, R t i denotes the costs of firm i at a time instant t, while R i are the total costs over the entire time horizon (taking into account the discounting effect). Moreover, we assume that the total costs R i are distributed over time, i.e., for any R i the function R t i is chosen in an optimal way. As a matter of fact, we varied the resulting solution in R t i for each R i . Thus, we consider the problem subject to the constraint 0 ≤ R i ≤ i . The first-order optimality condition with respect to R i yields Hence, the optimal total costs of firm i are given by To proceed, we study the cooperative behavior of the players, which reduces the original game to the optimal control problem where serial numbers j and i are associated with agents and firms, respectively; N and r give the total number of agents and firms, respectively. Different firms separately decide which agents of strong subgroups to influence. Therefore, we let b i j = 0 if firm i does not affect agent j. For solving this problem with inequality constraints, consider the following set of problems with equality constraints: with an arbitrary value of the parameter R, 0 ≤ R ≤ . Later, we will choose an appropriate value of R for which the optimal solution is achieved. By analogy with the previous case, we calculate the payoff of each player i with cooperative behavior in the form where α j (0) are the coordinates of the vector α(0) = e (A−ρI)T − I (A − ρI) −1 ε, j = 1, 2, . . . , N, and the optimal control action Reverting to the original statement of the problem with inequality constraints, we find for which value of the parameter R from the range [0, ] the total payoff achieves maximum. From this point onwards, R t denotes the total costs at a time instant t, while R are the total costs over the entire time horizon (taking into account the discounting effect). Moreover, we assume that the total costs R are distributed over time, i.e., for any R the function R t is chosen in an optimal way. (As a matter of fact, we varied the resulting solution in R t for each R.) Thus, we consider the problem subject to the constraint 0 ≤ R ≤ . The first-order optimality condition with respect to R yields Hence, the optimal total costs are given by Thus, the total payoff has the following form: in the first case, We compare the total payoffs in the cases of independent behavior and cooperation of the players.
First, we do it for the problem with equality constraints and In this problem, the total payoff in the case of cooperation is described by formula (25); in the case of independent behavior, by formula (24). In other words, we have to compare the term in (24) for the case of independent behavior with the term (25) for the case of cooperation.

Lemma 1.
In the problem with equality constraints, the total payoff of all firms with independent behavior does not exceed its counterpart in the case of their cooperation.
Proof. In accordance with the Holder inequality, for r pairs of positive numbers u i , v i , i = 1, 2, . . . , r, if p < 1, p 0 and 1 p + 1 q = 1. Denoting and letting p = q = 2, by the Holder inequality we establish that i.e., in the problem with equality constraints, the total payoff of all firms with independent behavior does not exceed its counterpart in the case of their cooperation. The proof of this lemma is complete.
Let us consider the problem with inequality constraints, i.e., r i=1 i = . We introduce the following terminology.
If firm i with independent behavior satisfies the inequality dt ≤ 4 i , then it will be said that firm i has enough marketing resources. Otherwise, i.e., dt > 4 i , it will be said that firm i has a lack of marketing resources. If in the case of cooperation the inequality dt ≤ 4 holds, then it will be said that there are enough marketing resources in total, both in the cases of cooperative and independent behavior. Otherwise (meaning that the opposite inequality is true), it will be said that there is a lack of marketing resources in total, in both cases. As before, i denotes the total quantity of marketing resource allocated to firm i while R i the total quantity of marketing resource used by firm i in the optimal solution. In the same fashion, in the case of cooperation, denotes the total quantity of marketing resource of all firms while R the total quantity of marketing resource used in the optimal solution. In the case of independent behavior, if firm i has a lack of marketing resources, then i = R i and its payoff monotonically depends on i ; if firm i has enough marketing resources, then i > R i and its payoff becomes independent of R i (as a result, marketing resources are redundant and the shadow price of marketing resource µ is 0). In the case of cooperation, if there is a lack of marketing resources in total, then = R and the total payoff monotonically depends on ; if there are enough marketing resources in total, then = R and the total payoff becomes independent of = R (as a result, marketing resources are redundant and the shadow price of marketing resource µ is 0). In terms of resource availability, four cases are possible as follows: (1) There are enough marketing resources in total, and they are allocated among the firms so that each firm has enough marketing resources. In this case, the total payoff of all firms with independent behavior coincides with the total payoff in the case of their cooperation. (2) There are enough marketing resources in total, but they are poorly allocated among the firms: some firms have a lack of marketing resources. In this case, the total quantity of marketing resource used by the firms in independent behavior is less than the total quantity of marketing resource used in cooperation. On the interval corresponding to the lack of marketing resources, the dependence of payoffs on the quantity of resource used is strictly monotonic; hence, the total payoff of all firms with independent behavior is smaller than the total payoff in the case of their cooperation. (3) There is a lack of marketing resources in total, but they are allocated so that some firms have enough marketing resources. In this case, the total quantity of marketing resource used by the firms in independent behavior is smaller than the total quantity of marketing resource used in cooperation. Consequently, the total payoff of all firms with independent behavior is smaller than the total payoff in the case of cooperation. (4) Each firm has a lack of marketing resources. Then, there is a lack of marketing resources in total.
In this case, by the lemma the total payoff of all firms with independent behavior does not exceed the total payoff in the case of cooperation.
Thus, the models of influence and control in social groups have the following applications in marketing; see Table 4 [46].

Conclusions
Social networks have been a popular object of mathematical modeling and computer simulation since the second half of the 20th century. There are various approaches to the mathematical modeling and simulation of networks, based on a diverse mathematical apparatus, including discrete and continuous, deterministic and stochastic models of different nature. Among them are graph-theoretic and dynamical systems models, optimization and optimal control problems, and game-theoretic models, as well as the gene-environment models, eco-finance models, Markov switching models, and rumor propagation models.
This paper develops the basic De Groot model and formulates the problems of analysis, prediction, optimal and conflict control in social groups with a given network of interactions. These problems have been interpreted in terms of marketing applications and also illustrated on a model example. At the stage of structural analysis, the target audience is segmented into strong subgroups and satellites. The initial opinions of strong subgroups members (opinion leaders) determine both the common resulting opinions of strong subgroups and the individual resulting opinions of satellites, which in fact solves the prediction problem.
In the authors' opinion, the solution of the analysis and prediction problems is only the first stage of an integrated approach to the study of social networks that forms input data for the second stage. Namely, a natural continuation is to formulate and solve optimal and conflict control problems for the opinions of network agents. As is stressed above, it suffices to exert control actions only on the members of strong subgroups (opinion leaders) identified at the analysis stage, which allows saving control resources while significantly affecting its efficiency.
In general, the following conclusions can be made:

1.
A system of descriptive, optimal control, and game-theoretic models for a conceptual analysis of social networks in various fields has been constructed. The marketing interpretation of the results has been given as an example. In this case, one or more influence agents model the competitive firms as marketing agents, and the basic agents describe the target audience of this/those influence agent(s). Of course, applications to politics, organizational and regional control, and other areas are also possible.

2.
Algorithms for analyzing the network and calculating the resulting opinions of agents have been developed, implemented in the R programming language and tested on model examples.

3.
Computer simulations of the optimal opinion control problems over networks have been performed using model examples in the domain of marketing and the hypothesis of sufficient impact on the members of strong subgroups (opinion leaders of the target audience) has been experimentally confirmed. The qualitatively representative scenarios of simulation have been identified.

4.
Explicit solutions to the differential games of opinion control over networks with marketing budget constraints in the form of equalities and inequalities have been analytically constructed. For the case of inequalities, a special method for solving the problem has been proposed.

5.
A comparative analysis of the independent and cooperative behavior of the players has been carried out, and the results have been interpreted in terms of marketing problems. In the sense of total payoff, cooperation is more profitable. Some conclusions regarding the optimal allocation of the marketing budget have been made. Namely, there are four possible cases in terms of the marketing resources availability: when there are enough marketing resources in total or not, and when each firm has enough resources, or some firms have a lack of marketing resources. The posed game theoretic problem is solved for all cases.
In the future, the problems of optimal and conflict control should be supplemented with the viability conditions, which establish social requirements to a controlled active dynamic system. Typically, these requirements contradict the direct economic interests of control subjects and therefore can be included in the problem statement either with the voluntary self-restriction of the subjects (social responsibility), or by introducing an additional control authority (principal) that will ensure viability through administrative or economic impact on other control subjects. Both options lead to the consideration of dynamic games with state-space constraints.
We are going to investigate dynamic game-theoretic models of opinion control over networks for the cases of independent and cooperative behavior and a hierarchy of players under various nonlinear control actions. Undoubtedly, the development of a simulation approach based on the method of qualitatively representative scenarios for the problems of opinion control and resource allocation over networks will make sense as well. Also, the study of uncertainty in various aspects is of great interest. Funding: The work is supported by the Russian Science Foundation, project #17-19-01038.

Conflicts of Interest:
The authors declare no conflict of interest.