Professional Documents
Culture Documents
fully edited. Content may change prior to final publication. Citation information: DOI
10.1109/ACCESS.2019.2938191, IEEE Access
Date of publication xxxx 00, 0000, date of current version xxxx 00, 0000.
Digital Object Identifier ACCESS.2019.DOI
A MATLAB-based Mean-Field-Type
Games Toolbox: Continuous-Time
Version
J. BARREIRO-GOMEZ, (Senior Member, IEEE), AND H. TEMBINE,(Senior Member, IEEE)
Learning & Game Theory Laboratory, New York University Abu Dhabi
Corresponding author: Julian Barreiro-Gomez (e-mail:jbarreiro@nyu.edu).
I. INTRODUCTION
EAN-FIELD-TYPE GAMES (MFTG) are a class of
M stochastic games considering, in the cost functional
and system-state dynamics, the distribution of both the sys-
tem state and control inputs (strategies). This type of games
involving distribution-dependent variables are getting special
attention because they incorporate not only mean terms,
but also variance terms within the optimization problem.
Thus, MFTG are tightly associated with the mean-variance
paradigm introduced in [4], and therefore, MFTGs become
a crucial game-theoretical tool in the field of risk-aware
engineering. Different methods to solve MFTG have been
extensively studied. Some of these methods are Stochastic
Maximum Principle [5]–[7], Dynamic Programming Princi-
ple [8], Wiener Chaos Expansion [9], and the Direct Method
[10]–[15]. Depending on the selected methodology to solve
the aforementioned game-theoretical problem, one might
obtain a solution expressed in terms of either Ordinary or
Partial Differential Equations. In this regard, there is also an
increasing interest in the appropriate tool for simulating the
MFTG, which is the main objective that this paper addresses.
A. CONTRIBUTION
The main contribution of this paper consists of an user
friendly MatLab-based MFTG toolbox composed of several
functions to solve Non-Cooperative, Fully-Cooperative and FIGURE 1: Complete functions set of the MatLab-based
MFTG toolbox
Co-opetitive Linear-Quadratic MFTG for both scalar and
matrix values (see Table 1), and considering an arbitrary
number of decision-makers. The complete set of functions
VOLUME 4, 2016 1
This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI
10.1109/ACCESS.2019.2938191, IEEE Access
J. Barreiro-Gomez and H. Tembine : A MATLAB-based Mean-Field-Type Games Toolbox: Continuous Time Version
FIGURE 2: General diagram corresponding to the main three functions of the MFTG MatLab-based toolbox.
composing the proposed MatLab-based MFTG toolbox is user-friendly toolbox to solve the main Mean-Field-Type
presented in Figure 1, which can be downloaded together Game problems neither in the scalar-valued nor the matrix-
with the numerical examples presented in this paper (see valued version. Finally, we show an example illustrating how
Section V). It is important to point out that, the solutions to perform simulations with the proposed toolbox.
for the shown problems in this paper have been already
discussed and presented in [1], [2] and [3]. We have incor-
B. SIGNIFICANCE OF THE TOOLBOX
porated throughout this paper the statement corresponding
to the main results in Mean-Field-Type Games, e.g., Non- The development of toolboxes is motivated by the need to fa-
Cooperative, Fully-Cooperative and Co-opetitive, in order to cilitate obtaining results when well-established mathematical
make the manuscript self-contained. Thus, the inputs and procedures have been already studied. Toolboxes have been
outputs of the toolbox are easy to understand and to apply. developed in several different fields and have considerably
Hence, we briefly present the problem statement and its semi- improved the research pace. Among all the different types of
explicit solution. Afterwards, we present the corresponding tools we can find the following: tools that allow designing
proposed MatLab-based function describing its inputs and or modeling in a systematic manner, e.g., the modeling of
outputs. To the best of our knowledge, there is not available joint contact mechanics [16], tools that facilitate the plot of
results, e.g., the generation of medical images [17], and/or
2 VOLUME 4, 2016
This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI
10.1109/ACCESS.2019.2938191, IEEE Access
J. Barreiro-Gomez and H. Tembine : A MATLAB-based Mean-Field-Type Games Toolbox: Continuous Time Version
tools allowing the analysis of systems’ performance [18]. START Setting of Parameters
In particular, the toolbox that is proposed in this paper
concerns to the game, learning and automatic control theory Simulation Parameters:
as presented next. • Simulation steps
As previously mentioned, there are several alternatives to
• Initial condition estimation
solve the Mean-Field-Type Game problems addressed in this
manuscript obtaining different mathematical representations System parameters
of the solutions with diverse complexities. For instance, some Cost functional parameters
approaches allow solving the aforementioned problems in
terms of partial differential equations (PDEs). In contrast, Semi-explicit solution
Direct Method allows solving the underlying problems in a
Construction of ODEs
semi-explicit way, i.e., obtaining ordinary differential equa-
Setting boundary conditions
tions (ODEs). Depending on the complexity of the solution
Solving ODEs
and the selected method, numerical solutions are required. In
[1], the fact that the Direct Method can be used to improve
Results
numerical methods in mean-field-type game theory has been
discussed. In this regard, the toolbox presented in this paper Computing the evolution of:
significantly contributes to enhance the numerical methods. • Optimal strategies
• Expectation of optimal strategies
C. STRUCTURE OF THE PAPER
This paper is organized as follows. Section II introduces • System states
the three main functions that compose each one of the • Expectation of system states
MFTG approaches, i.e., problem setup, generation of so-
• Optimal cost
lution and presentation of results. Section III presents the
scalar-valued MFTG for non-cooperative, fully-cooperative
and co-opetitive scenarios, including numerical examples. Publications of results
Then, Section IV presents the matrix-valued MFTG for both
non-cooperative and fully-cooperative scenarios, including
numerical examples. Section V shows how to freely obtain END
the proposed MatLab-based MFTG Toolbox. Finally, con- FIGURE 3: Flow-Chart of the MAtLab functions
cluding remarks are drawn in Section VI.
II. STRUCTURE OF THE FUNCTIONS each one of the examples presented at each section through-
The MatLab-based MFTG toolbox is classified depending on out this paper. The Problem_setup_..._MFTG.m func-
the type of MFTG problem as shown in Table 1. Each classi- tion creates a structure containing all these parameters under
fication is composed by three main functions as presented the name Input_Data.
in Figure 2, i.e., a problem setup, generation of solution,
and finally a presentation of results. These three functions B. GENERATION OF SOLUTION
are described next together with some examples. We also This function is the core of the MFTG Toolbox. There
present a general flow chart/workflow in Figure 3, of the is a function in charge of computing the solution for
proposed toolbox as it has been presented for other MatLab- each one of the MFTG problems. This main functions
based tools, e.g., [16] [17]. Moreover, we also provide some receive the structure Input_Data from the function
specific and short MatLab scripts in order to illustrate how Problem_setup_..._MFTG.m, and returns a structure
user-friendly the toolbox is as in [19], and present some under the name Output_Data incorporating the evolution
respective pseudocodes. of the system states and its expectation, the evolution of the
optimal control inputs for each one of the players and its
A. PROBLEM SETUP expectation, the evolution of the Riccati equations, and the
For each one of the scenarios, there is a function under optimal costs for all the players.
the name Problem_setup_..._MFTG.m where the user
should provide information about the MFTG problem, e.g., C. PRESENTATION OF RESULTS
the number of players, the parameters corresponding to the Finally, the last main function of the MFTG Toolbox cor-
system dynamics, and the cost functions; and also informa- responds to Figures_MFTG_....p. Such function is in
tion for simulation purposes, i.e., the time steps along the charge of the presentation of results, i.e., it receives the struc-
time horizon and a guess about the initial conditions for the ture Output_Data from the core function that solves the
ordinary differential equations. All these parameters depend MFTG problem, and returns several organized plots with the
on the specific MFTG problem, and details can be found in corresponding labels. These results can be seen throughout
VOLUME 4, 2016 3
This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI
10.1109/ACCESS.2019.2938191, IEEE Access
J. Barreiro-Gomez and H. Tembine : A MATLAB-based Mean-Field-Type Games Toolbox: Continuous Time Version
A. NON-COOPERATIVE APPROACH
subject to
for all i ∈ N , where αi , βi , γi , and δi solve the following
X differential equations:
dx = b0 + b1 x + b̄1 E[x] + b2j uj + b̄2j E[uj ] dt
j∈N
X b22j b2
α̇i = −2b1 αi − qi + 2αi αj + 2i αi2 ,
+ σ0 dB, rj ri
j∈N \{i}
x(0) := x0 , 2
X b2j + b̄2j
β̇i = −2 b1 + b̄1 βi − qi − q̄i + 2βi βj
where qi , qi + q̄i ∈ R≥0 , ri , ri + r̄i ∈ R>0 , and (rj + r̄j )
j∈N \{i}
b0 , b1 , b̄1 , b2j , b̄2j , σ0 ∈ R, for all j ∈ N . Moreover, B 2
denotes a standard Brownian motion; and E[x] and E[uj ] b2i + b̄2i
+ β2,
denote the expected value of the system state and the j th (ri + r̄i ) i
control input, respectively. 2
b2j + b̄2j
X
γ̇i = −b0 βi − b1 + b̄1 γi + βi γj
(rj + r̄j )
j∈N \{i}
1) Semi-Explicit Solution 2 2
X b2j + b̄2j b2i + b̄2i
+ γi βj + βi (t)γi ,
The solution for the one-dimentional Non-Cooperative (rj + r̄j ) (ri + r̄i )
j∈N \{i}
MFTG is stated in Proposition 1 next. 2
1 2
X b2j + b̄2j
Proposition 1 (Result presented in [1]): The feedback- δ̇i = −b0 γi − αi σ0 + γi γj
strategies linear-quadratic mean-field-type Nash equilibrium 2 (rj + r̄j )
j∈N \{i}
for the Non-Cooperative Problem, and the optimal costs are 2
1 b2i + b̄2i
given by: + γ2,
2 (ri + r̄i ) i
b2i
u∗i = E[u∗i ] − αi (x − E[x]) , where αi (T ) = qi , βi (T ) = qi + q̄i , and γi = δi = 0.
ri
b2i + b̄2i h i
E[u∗i ] = − βi E[x] + γi , 2) MatLab-based MFTG Toolbox Example
(ri + r̄i ) We present a three-player example corresponding to
1 2 1
Li (u∗1 , . . . , u∗n ) = αi (0) (x0 − E[x0 ]) + βi (0)E[x0 ]2 the scalar-valued non-cooperative MFTG problem. No-
2 2 tice that, the MatLab script, corresponding to the ex-
+ γi (0)E[x0 ] + δi (0), ample, follows the pseudocode presented in Figure 4.
4 VOLUME 4, 2016
This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI
10.1109/ACCESS.2019.2938191, IEEE Access
J. Barreiro-Gomez and H. Tembine : A MATLAB-based Mean-Field-Type Games Toolbox: Continuous Time Version
2.5 0 0.4
x
Optimal Strategies
1
2 Ex 2
System State
-0.2 0.3 3
1.5 u1
Eu1
1 u2
-0.4 Eu2 0.2
0.5 u3
Eu3
0 -0.6 0.1
0 0.5 1 1.5 2 0 0.5 1 1.5 2 0 0.5 1 1.5 2
time [s] time [s] time [s]
(a) (b) (c)
0.04 0.8
1 1 1
0.4 2 2 2
0.03 0.6
3 3 3
0.3
0.02 0.4
0.2
0.01 0.2
0.1
0 0 0
0 0.5 1 1.5 2 0 0.5 1 1.5 2 0 0.5 1 1.5 2
time [s] time [s] time [s]
(d) (e) (f)
FIGURE 5: Results corresponding to the LQ Scalar-Valued Non-Cooperative MFTG example. These plots are generated by the
MatLab function Figures_MFTG_ScNonCoop.p
VOLUME 4, 2016 5
This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI
10.1109/ACCESS.2019.2938191, IEEE Access
J. Barreiro-Gomez and H. Tembine : A MATLAB-based Mean-Field-Type Games Toolbox: Continuous Time Version
Cost
Output_Data.alpha_r n × hh
Output_Data.beta_r n × hh 1
Output_Data.gamma_r n × hh 0.5
Output_Data.delta_r n × hh
Output_Data.x_r 1 × hh 0
1 2 3
Output_Data.Ex_r 1 × hh
Player
Output_Data.u_r n × hh
Output_Data.Eu_r n × hh FIGURE 8: Costs of the player in the LQ Scalar-Valued
Cooperative MFTG example. This plot is generated by the
Output_Data.L n MatLab function Figures_MFTG_ScCoop.p
This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI
10.1109/ACCESS.2019.2938191, IEEE Access
J. Barreiro-Gomez and H. Tembine : A MATLAB-based Mean-Field-Type Games Toolbox: Continuous Time Version
3 0 0.6
x
Optimal Strategies
0
Ex
System State
2 u1
-1 0.4
Eu1
u2
1 Eu2
-2 u3 0.2
Eu3
0
0 0.5 1 1.5 2 0 0.5 1 1.5 2 0 0.5 1 1.5 2
time [s] time [s] time [s]
(a) (b) (c)
0.2 0 0
0 0.5 1 1.5 2 0 0.5 1 1.5 2 0 0.5 1 1.5 2
time [s] time [s] time [s]
(d) (e) (f)
FIGURE 7: Results corresponding to the LQ Scalar-Valued Fully-Cooperative MFTG. These plots are generated by the MatLab
function Figures_MFTG_ScCoop.p
Listing 3: Problem Setup function for the LQ Scalar-Valued TABLE 3: Detail output data for the LQ Scalar-Valued Fully-
Fully-Cooperative MFTG example Cooperative MFTG
1 %%%%%%%%%% Simulation Parameters %%%%%%%%%%%
2 T = 2 ; % Simulation time Output Data Dimensions
3 hh = 1000 ; % Number of simulation-steps
4 %%%%% System-State-Dynamics Parameters %%%%% Output_Data.time 1 × hh
5 n = 3 ; % number of players Output_Data.alpha_r 1 × hh
6 b0 = 2 ; Output_Data.beta_r 1 × hh
7 b1 = -0.5 ;
8 bb1 = -0.5 ; Output_Data.gamma_r 1 × hh
9 b2 = [1 2 3] ; % b2 = [b_{21},...,b_{2n}] Output_Data.delta_r 1 × hh
10 bb2 = [1 2 3] ; % bb2 = ... Output_Data.x_r 1 × hh
[\bar{b}_{21},...,\bar{b}_{2n}]
11 s = 2 ; % \sigma_0 Output_Data.Ex_r 1 × hh
12 %%%%%%%% Cost functional Parameters %%%%%%%% Output_Data.u_r n × hh
13 r = [3 2 1] ; % r = [r_1,...,r_n] Output_Data.Eu_r n × hh
14 br = [3 2 1] ; % \bar{r} = ...
[\bar{r}_1,...,\bar{r}_n] Output_Data.L n
15 q = [0.2 0.2 0.2] ; % q = [q_1,...,q_n]
16 bq = [0.3 0.3 0.3] ; % \bar{q} = ...
[\bar{q}_1,...,\bar{q}_n]
17 q_T = [0.1 0.2 0.3] ; % q(T) = ... main function cooperative_MFTG.p, which returns the
[q_1(T),...,q_n(T)] data presented in Table 3.
18 bq_T = [0.3 0.2 0.1] ; % \bar{q}(T) = ...
[\bar{q}_1(T),...,\bar{q}_n(T)]
19 %%%%%%%%%%%% Initial Conditions %%%%%%%%%%%%
20 x0 = 3 ; % initial condition Listing 4: Complete simulation of the LQ Scalar-Valued Fully-
21 Ex0 = x0 ; % initial condition Cooperative MFTG example
22 variables0 = [ones(4,1);x0;Ex0] ; 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 clear all; close all ; clc
24 Input_Data = struct('T',T,'hh',hh,'n',n,... 3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25 'b0',b0,'b1',b1,'bb1',bb1,'b2',b2,... 4 Problem_setup_cooperative_MFTG
26 'bb2',bb2,'s',s,'r',r,'br',br,... 5 [Output_Data] = ...
27 'q',q,'bq',bq,'q_T',q_T,'bq_T',bq_T,... cooperative_MFTG(Input_Data) ;
28 'x0',x0,'Ex0',Ex0,'variables0',variables0) ; 6 Figures_MFTG_ScCoop(Output_Data)
29 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Now, we present the main MatLab script to solve Finally, the function Figures_MFTG_ScCoop.p gen-
the scalar-valued fully-cooperative MFTG problem from erates the Figures 7 and 8 where the complete solution of the
the function MAIN_cooperative_MFTG.m evoking the game can be seen. Note that the boundary conditions for the
VOLUME 4, 2016 7
This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI
10.1109/ACCESS.2019.2938191, IEEE Access
J. Barreiro-Gomez and H. Tembine : A MATLAB-based Mean-Field-Type Games Toolbox: Continuous Time Version
1 X
λij qj x2 (T ) + q̄j E[x(T )]2
+
2
j∈N \{i}
1 T
Z
λii qi x2 + q̄i E[x]2 dt
+
2 0
1 T
Z
λii ri u2i + r̄i E[ui ]2 dt
+
2 0
1 T X
Z
λij qj x2 + q̄j E[x]2 dt
+
2 0
j∈N \{i}
1 T X
Z
λij rj u2j + r̄j E[uj ]2 dt,
+
2 0
j∈N \{i}
C
min E Li (u1 , . . . , un , Λi ) ,
ui ∈Ui
subject to
X
dx = b0 + b1 x + b̄1 E[x] + b2j uj + b̄2j E[uj ] dt
j∈N
+ σ0 dB,
x(0) = x0 ,
where qi , qi + q̄i ∈ R≥0 , ri , ri + r̄i ∈ R>0 , and
FIGURE 9: Pseudocode corresponding to the co-opetitive b0 , b1 , b̄1 , b2j , b̄2j , σ0 ∈ R, for all j ∈ N . Moreover, B
MFTG parameters settings. denotes a standard Brownian motion; and E[x] and E[uj ]
denote the expected value of the system state and the j th
control input, respectively.
Riccati equations are satisfied.
This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI
10.1109/ACCESS.2019.2938191, IEEE Access
J. Barreiro-Gomez and H. Tembine : A MATLAB-based Mean-Field-Type Games Toolbox: Continuous Time Version
6 b0 = 1 ;
8 7 b1 = -2 ;
8 bb1 = -2 ;
6 9 b2 = [1 2 3 4 5] ; % b2 = [b_{21},...,b_{2n}]
10 bb2 = [1 2 3 4 5] ; % bb2 = ...
Cost
[\bar{b}_{21},...,\bar{b}_{2n}]
4 11 s = 5 ; % \sigma_0
12 %%%%%%%% Cost functional Parameters %%%%%%%%
2 13 lambda = [1 0.1 0.2 0.3 0.4 ;
14 0.1 1 0.2 0.3 0.4 ;
15 0.1 0.2 1 0.3 0.4 ;
0 16 0.1 0.2 0.3 1 0.4 ;
1 2 3 4 5 17 0.1 0.2 0.3 0.4 1 ] ; % ...
Player coopetitive parameters
18 r = [1.1 1.2 1.3 1.4 1.5] ; % r = ...
FIGURE 11: Costs of the player in the LQ Scalar-Valued [r_1,...,r_n]
Co-Opetitive MFTG example. This plot is generated by the 19 br = [1.1 1.2 1.3 1.4 1.5] ; % \bar{r} = ...
MatLab function Figures_MFTG_ScCo_Op.p [\bar{r}_1,...,\bar{r}_n]
20 q = [1 2 3 4 5] ; % q = [q_1,...,q_n]
2 21 bq = [1 2 3 4 5] ; % \bar{q} = ...
X b2j + b̄2j [\bar{q}_1,...,\bar{q}_n]
+ 2βi βj 22 q_T = [0.1 0.2 0.3 0.4 0.5] ; % q(T) = ...
λjj (rj + r̄j ) [q_1(T),...,q_n(T)]
j∈N \{i}
2 2 23 bq_T = [0.1 0.1 0.1 0.1 0.1] ; % ...
X b2j + b̄2j 2 b2i + b̄2i \bar{q}(T) = ...
− λij 2 β + β2, [\bar{q}_1(T),...,\bar{q}_n(T)]
λjj (rj + r̄j ) j λii (ri + r̄i ) i 24 %%%%%%%%%%%% Initial Conditions %%%%%%%%%%%%
j∈N \{i}
25 x0 = 4 ; % initial condition
γ̇i = −b0 βi − b1 + b̄1 γi 26 Ex0 = x0 ; % initial condition
2 27 variables0 = [ones(4*n,1);x0;Ex0] ;
X b2j + b̄2j 28 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ (βi γj + γi βj ) 29 Input_Data = struct('T',T,'hh',hh,'n',n,...
λjj (rj + r̄j ) 'b0',b0,'b1',b1,'bb1',bb1,'b2',b2,...
j∈N \{i} 30
2 2 31 'bb2',bb2,'s',s,'r',r,'br',br,...
X b2j + b̄2j b2i + b̄2i 32 'q',q,'bq',bq,'q_T',q_T,'bq_T',bq_T,...
− λij 2 βj (t)γj + β i γi , 33 'x0',x0,'Ex0',Ex0,'variables0',variables0,...
λjj (rj + r̄j ) λii (ri + r̄i ) 'lambda',lambda) ;
j∈N \{i} 34
2 35 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1 2
X b2j + b̄2j
δ̇i = −b0 γi − αi σ0 + γi γj We present the function MAIN_coopetitive_MFTG.m
2 λjj (rj + r̄j )
j∈N \{i} for the scalar-valued co-opetitive MFTG problem, which
2 2
1 X b2j + b̄2j 1 b2i + b̄2i evokes the function coopetitive_MFTG.p that is in
2
− λij 2 γ + γ2, charge of solving the game and that returns the data presented
2 λjj (rj + r̄j ) j 2 λii (ri + r̄i ) i
j∈N \{i} in Table 4.
P P
where αi (T ) = j∈N λij qj , βi (T ) = j∈N λij (qj + q̄j ),
and γi = δi = 0.
Listing 6: Complete simulation of the LQ Scalar-Valued Co-
2) MatLab-based MFTG Toolbox Example Opetitive MFTG
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Figure 9 presents Algorithm 2, corresponding to the 2 clear all; close all ; clc
pseudocode for the setting of parameters for the co- 3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
opetitive scenario. Following the previously mentioned 4 Problem_setup_coopetitive_MFTG
5 [Output_Data] = ...
pseudocode, we present a five-player example corre- coopetitive_MFTG(Input_Data) ;
sponding to the scalar-valued co-opetitive MFTG prob- 6 Figures_MFTG_ScCo_Op(Output_Data) ;
lem. Next, we present the MatLab script corresponding 7 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
to the problem setup from the function under the name Finally, the function Figures_MFTG_ScCo_Op.p
Problem_setup_coopetitive_MFTG.m. Notice that generates the Figures 10 and 11, where it can be observed
the setup for this game scenario requires an extra input that the trajectories fulfill the respective boundary conditions.
corresponding to the co-opetitive parameters λ ∈ Rn×n .
IV. MATRIX-VALUED MEAN-FIELD-TYPE GAMES
Listing 5: Problem Setup function for the LQ Scalar-Valued Now, system dynamics that represent the evolution of a
Co-Opetitive MFTG matrix-valued state are considered, and considering that the
1 %%%%%%%%%% Simulation Parameters %%%%%%%%%%% players’ choices are also given by matrix-valued control
2 T = 1 ; % Simulation time inputs. Figure 12 presents the Algorithm 3, that is the general
3 hh = 1000 ; % Number of simulation-steps
4 %%%%% System-State-Dynamics Parameters %%%%% pseudocode corresponding to the setting of parameters for
5 n = 5 ; % number of players both the matrix-valued non-cooperative and matrix-valued
VOLUME 4, 2016 9
This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI
10.1109/ACCESS.2019.2938191, IEEE Access
J. Barreiro-Gomez and H. Tembine : A MATLAB-based Mean-Field-Type Games Toolbox: Continuous Time Version
4 2 0.8
x u1
Optimal Strategies
1
3 Ex Eu1 2
System State
0 u2
0.6 3
2 Eu2
4
u3
-2 5
Eu3
1 u4 0.4
-4 Eu4
0 u5
Eu5
-1 -6 0.2
0 0.5 1 0 0.5 1 0 0.5 1
time [s] time [s] time [s]
(a) (b) (c)
1 0.01 5
1 1
2 4 2
0.8
3 3
4 3 4
0.6 5 0.005 1 5
2 2
3
0.4 4 1
5
0.2 0 0
0 0.5 1 0 0.5 1 0 0.5 1
time [s] time [s] time [s]
(d) (e) (f)
FIGURE 10: Results corresponding to the LQ Scalar-Valued Co-Opetitive MFTG Example. These plots are generated by the
MatLab function Figures_MFTG_ScCo_Op.p
This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI
10.1109/ACCESS.2019.2938191, IEEE Access
J. Barreiro-Gomez and H. Tembine : A MATLAB-based Mean-Field-Type Games Toolbox: Continuous Time Version
1 X
+ (Pi∗ + Pi )B2j Rj−1∗ B2j
∗
(Pj∗ + Pj ),
4
j∈N \{i}
VOLUME 4, 2016 11
This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI
10.1109/ACCESS.2019.2938191, IEEE Access
J. Barreiro-Gomez and H. Tembine : A MATLAB-based Mean-Field-Type Games Toolbox: Continuous Time Version
Optimal Strategies u1
Optimal Strategies u2
x1 0
System State x
6 Ex1 0.1
u11 u21
x2 -0.05 Eu11 Eu21
4 Ex2 u12 0 u22
x3 -0.1 Eu12 Eu22
2 Ex3 u13 -0.1 u23
x4 Eu13 Eu23
-0.15 u14 -0.2 u24
Ex4
0 Eu14 Eu24
-0.2 -0.3
0 1 2 3 0 1 2 3 0 1 2 3
time [s] time [s] time [s]
(a) (b) (c)
2 4 1
P11 P21
P12 P22
Riccati bP1
Riccati P1
Riccati P2
1 P13 2 P23 0.5
P14 P24
bP11
0 0 0 bP12
bP13
bP14
-1 -2 -0.5
0 1 2 3 0 1 2 3 0 1 2 3
time [s] time [s] time [s]
(d) (e) (f)
3 20 25
1
2 2 20
15
Riccati bP2
1 15
Cost
10
0 bP21 10
bP22
5
-1 bP23 5
bP24
-2 0 0
0 1 2 3 0 1 2 3 1 2
time [s] time [s] Player
(g) (h) (i)
FIGURE 13: Results corresponding to the LQ Matrix-Valued Non-Cooperative MFTG. These plots are generated by the MatLab
function Figures_MFTG_MaNonCoop.p
This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI
10.1109/ACCESS.2019.2938191, IEEE Access
J. Barreiro-Gomez and H. Tembine : A MATLAB-based Mean-Field-Type Games Toolbox: Continuous Time Version
VOLUME 4, 2016 13
This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI
10.1109/ACCESS.2019.2938191, IEEE Access
J. Barreiro-Gomez and H. Tembine : A MATLAB-based Mean-Field-Type Games Toolbox: Continuous Time Version
6 0
Optimal Strategies u1
Optimal Strategies u2
x1
0 u21
System State x
Ex1
x2 u11 Eu21
4 -0.5
Eu11
Ex2 -5 u22
x3 u12
Eu22
Ex3 Eu12
2 -10 u13 u23
x4 -1
Eu13 Eu23
Ex4
-15 u14 u24
0 Eu14 Eu24
-20 -1.5
0 0.5 1 1.5 2 0 0.5 1 1.5 2 0 0.5 1 1.5 2
time [s] time [s] time [s]
(a) (b) (c)
10 15 200
0
10
5 150
Riccati bP
Riccati P
5
0 100
P01 0 bP01
P02 bP02
-5 50
P03 -5 bP03
P04 bP04
-10 -10 0
0 0.5 1 1.5 2 0 0.5 1 1.5 2 0 0.5 1 1.5 2
time [s] time [s] time [s]
(d) (e) (f)
FIGURE 14: Results corresponding to the LQ Matrix-Valued Cooperative MFTG example. These plots are generated by the
MatLab function Figures_MFTG_MaCoop.p
41 bQ0_T = zeros(d,d) ;
42 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
300
43 for i = 1 : n
44 Q0 = Q0 + Q(:,:,i) ;
45 Q0_T = Q0_T + Q_T(:,:,i) ; 200
Cost
14 VOLUME 4, 2016
This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI
10.1109/ACCESS.2019.2938191, IEEE Access
J. Barreiro-Gomez and H. Tembine : A MATLAB-based Mean-Field-Type Games Toolbox: Continuous Time Version
ACKNOWLEDGMENT
We gratefully acknowledge support from U.S. Air Force
Office of Scientific Research under grant number FA9550-
17-1-0259
REFERENCES
[1] T. Duncan and H. Tembine. Linear-quadratic mean-field-type games: A
direct method. Games, 9(7), 2018.
[2] J. Barreiro-Gomez ; T. E. Duncan ; H. Tembine. Co-opetitive linear-
quadratic mean-field-type games. IEEE Transactions on Cybernetics, DOI:
10.1109/TCYB.2019.2901006, 2019.
[3] J. Barreiro-Gomez, T. Duncan, and H. Tembine. Matrix-valued mean-
field-type games: Risk-sensitive, adversarial, and risk-neutral linear-
quadratic case. arXiv preprint arXiv:1904.11346, 2019.
[4] H. Markowitz. Portfolio selection. The Journal of Finance, 7:77–91, 1952.
[5] B. Djehiche, H. Tembine, and R. Tempone. A stochastic maximum
principle for risk-sensitive mean-field type control. IEEE Transactions on
Automatic Control, 60(10):2640–2649, 2015. JULIAN BARREIRO-GOMEZ received his B.S.
[6] J. Yong. Linear-quadratic optimal control problems for mean-field stochas- degree (cum laude) in Electronics Engineering
tic differential equations. SIAM Journal on Control and Optimization, from Universidad Santo Tomas (USTA), Bogota,
51(4):2809–2838, 2013. Colombia, in 2011. He received the MSc. degree
[7] M. Tang and Q. Meng. Linear-quadratic optimal control problems for in Electrical Engineering and the Ph.D. degree
mean-field stochastic differential equations with jumps. Asian Journal of in Engineering from Universidad de Los Andes
Control, 21(3):1–15, 2019. (UAndes), Bogota, Colombia, in 2013 and 2017,
[8] H. Pham. Linear quadratic optimal control of conditional mckean- respectively. He received the Ph.D. degree (cum
vlasov equation with random coefficients and applications. Probability, laude) in Automatic, Robotics and Computer Vi-
Uncertainty and Quantitative Risk, 1(7):1–26, 2016. sion from the Technical University of Catalonia
[9] H. Tembine. Uncertainty quantification in mean-field-type teams and (UPC), Barcelona, Spain, in 2017; the best Ph.D. thesis in control engi-
games. In Proceedings of the IEEE Control Conference on Decision and neering 2017 award from the Spanish National Committee of Automatic
Control (CDC), pages 4418–4423, Osaka, Japan, 2015. Control (CEA) and Springer; and the EECI Ph.D. Award from the European
[10] T. E. Duncan and B. Pasik-Duncan. Solvable stochastic differential games
Embedded Control Institute in recognition to the best Ph.D. thesis in Europe
in rank one compact symmetric spaces. International Journal of Control.
in the field of Control for Complex and Heterogeneous Systems 2017.
[11] T. E. Duncan. Linear exponential quadratic stochastic differential games.
IEEE Transactions on Automatic Control, 61(2016):2550–2552, 2016. He received the ISA Transactions Best Paper Award 2018 in Recognition
[12] T. E. Duncan and B. Pasik-Duncan. Linear-quadratic fractional gaussian to the best paper published in the previous year. He is currently a Post-
control. SIAM Journal of Control and Optimization, 51(2013):4604–4619, Doctoral Associate in the Learning & Game Theory Laboratory at the New
2013. York University in Abu Dhabi (NYUAD), United Arab Emirates. His main
[13] T. E. Duncan and B. Pasik-Duncan. Linear-exponential-quadratic control research interests are Mean-Field-Type Games, Risk-Aware Engineering,
for stochastic equations in a hilbert space. Dynamic Systems and Applica- Constrained Evolutionary Game Dynamics, Distributed Optimization, and
tions, 21. Distributed Predictive Control
VOLUME 4, 2016 15
This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI
10.1109/ACCESS.2019.2938191, IEEE Access
J. Barreiro-Gomez and H. Tembine : A MATLAB-based Mean-Field-Type Games Toolbox: Continuous Time Version
16 VOLUME 4, 2016
This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/.