## 3 Supervised Selection of the Control Gains
### Updating Algorithms
* 25 Step 3:
* 26 While \(J_{active}^{loc}(t)=\min\bigg{(}J_{qj}^{loc}(t_{i





function involves on normalized subpopulations then it is worsening through time as it decreases along the current inter- switching time interval compared to the above one._
3. _It can be noticed that there is only a model, which is also the active one by borrowing the nomenclature of the above algorithms, whose gains are adapted through successive switches, after the initialization steps where four models are involved. Therefore, the testing time instants to update the controller gains can be simplified to be run at a constant sampling period\(T_{s}\)._

The basic corresponding pseudo-code is reflected in the subsequent Algorithm 4. ```
1 Step 0:
2 Fix initial gains and incremental gains \(k_{V}(0)\geq 0\), \(k_{T}(0)\geq 0\), \(\Delta k_{V}\geq 0\), \(\Delta k_{V}\geq 0\), \(\rho_{V}\geq 0\) and \(\rho_{T}\geq 0\) with \(max(k_{V}(0),\,k_{T}(0))>0\) and \(max(\Delta k_{V},\,\Delta k_{T})>0\). Fix also design real parameters \(\rho_{V}\geq 0\) and \(\rho_{T}\geq 0\) which can optionally make the incremental control gains to converge asymptotically to zero as time tends to infinity. 3 Fix an initial set \(\mathrm{M}(0)\) of four models set of elements \(m_{ij}(0)=m_{ij}\big{(}0,\,p_{ij}(0)\big{)}\); \(i,j=1,2\) with respective parameterizations: \(p_{11}(0)=(\beta,\,\gamma,\,k_{V}(0)\,,\,k_{T}(0))^{T}\); \(p_{12}(0)=(\beta,\,\gamma,\,k_{V}(0)+\Delta k_{V}(0),\,k_{T}(0))^{T}\) \(p_{21}(0)=(\beta,\,\gamma,\,k_{V}(0),\,k_{T}(0)+\Delta k_{T}(0))^{T}\); \(p_{22}(0)=(\beta,\,\gamma,\,k_{V}(0)+\Delta k_{V}(0),\,k_{T}(0)+\Delta k_{T}( 0))^{T}\)  Choose the initial active controlled model \(m_{active}(1)=m_{11}(0)\) for \(m_{00}(0)\in\mathrm{M}(0)\), that is the parameterization defined for \(i=j=0\) and \(t_{1}=0\), and fix identical initial conditions \(I_{ij}(0)=I(0)\), \(S_{ij}(0)=1-I(0)\) and \(R_{ij}(0)=0\); \(i\in\overline{n}_{V}\cup\,\{0\}\); \(j\in\overline{n}_{T}\cup\,\{0\}\). 4 Step 1:
5 For \(i<3\) do Steps 1 to 4 of Algorithm 1. Otherwise go to Step 2
6 Step 2:
7 For \(i\geq 3\) do
8\(\Delta k_{V}(t_{i})=\mathrm{sgn}(k_{V}(t_{i-1})-k_{V}(t_{i-2}))\times\mathrm{ sgn}(J(t_{i-1})-J(t_{i-3}))\Delta k_{V}e^{-\rho_{V}t_{i}}\)
9\(\widetilde{k}_{V}(t_{i})=k_{V}(t_{i-1})+\Delta k_{V}(t_{i})\)
10\(\Delta k_{T}(t_{i})=\mathrm{sgn}(k_{T}(t_{i-1})-k_{T}(t_{i-2}))\times\mathrm{ sgn}(J(t_{i-1})-J(t_{i-3}))\Delta k_{T}e^{-\rho_{V}t_{i}}\)
11\(\widetilde{k}_{T}(t_{i})=k_{T}(t_{i-1})+\Delta k_{T}(t_{i})\)
12\(k_{T}(t_{i})=\max\big{(}0,\,\widetilde{k}_{T}(t_{i})\big{)}\)
13\(i\gets i+1\)
14\(t_{i}\gets t_{i}+T_{s}\)
15 Step 3:
16 Go to Step 2 while \(t_{i}\leq t_{end}-T_{\min}\) else go to end. ```

**Algorithm 4** The switching time instants to update the parameterization are integer multiples of a prefixed basic minimum constant sampling interval

Remarks 8: _Algorithm 4 can be further modified by using variable inter-switching periods and a time-varying set of models with the selection of an active one to each new switched sampling instant. In this way, equations in Algorithm 4 are modified as follows:_

\[\widetilde{k}_{V}(t_{i})=k_{V}(t_{i-1})+\mathrm{sgn}(k_{V}(t_{i-1})-k_{V}(t_ {i-2}))\]

\[\times\mathrm{sgn}\bigg{(}\frac{1}{t_{i-1}-t_{i-2}}J_{active}(t_{i-1})-\frac{1 }{t_{i-2}-t_{i-3}}J_{active}(t_{i-3})\bigg{)}\Delta k_{V}e^{-\rho_{V}t_{i}} \tag{10}\]

\[\widetilde{k}_{T}(t_{i})=k_{T}(t_{i-1})-\mathrm{sgn}(k_{T}(t_{i-1})-k_{T}(t_{i- 2}))\]

\[\times\mathrm{sgn}\bigg{(}\frac{1}{t_{i-1}-t_{i-2}}J_{active}(t_{i-1})-\frac{1 }{t_{i-2}-t_{i-3}}J_{active}(t_{i-3})\bigg{)}\Delta k_{T}e^{-\rho_{T}t_{i}} \tag{11}\]The controller gains are updated by taking average active losses along the tested intervals since, in this case, the switching time instants are variable. ## 4 Simulation Results

This Section contains some simulation examples illustrating the switching algorithms introduced in Section 3. Thus, consider the model described by (1)-(3) with parameters given by \(\beta=2.5\) and \(\gamma=0.79\) in days \({}^{-1}\).