1 Introduction

On November 14, 2019, The world celebrated International Diabetes Day on which the World Health Organization (WHO) [1] and the International Diabetes Federation (IDF) [2] have chosen the theme “Family and diabetes” with the slogan “Diabetes is important for the whole family ”. The International Diabetes Day has an objective the raising of awareness about this disease and its complications by focusing on prevention, adoption of a healthy lifestyle, early examination, especially for people who are subject to diabetes.

According to the International Diabetes Federation [2], statistics indicate that more than 463 million people with diabetes in 2019 and that 50 percent of people suffer from diabetes are not aware of being a subject to disease. And these numbers increase exponetially every year. The number of people with diabetes is expected to reach 578 million in 2030 and 700 million in 2045.

Diabetes increases the possibility to be affected by other serious illnesses, especially respiratory illnesses like the SARS-CoV-2 virus. According to the American Diabetes Association (ADA) [42], people with diabetes are at higher risk for viral infections. According to the Scientific Federation of Diabetics [33], In response to the current COVID-19 pandemic, governments of many countries have restricted the movements of their citizens, confining them to their family environment. facilities such as, gymnasiums, sports centers and swimming pools are closed. Therefore, the inactivity and the lack of exercising have caused many people to gain excessive weight which will put them at a high of developing diabetes [34,35,36,37,38,39,40,41].

Diabetes can be caused by two main factors, genetics and/ or lifestyle. Lifestyle manifested in malnutrition which stem from poverty, and social factors that can result from work place and family problems. These factors inter alia may lead to diabetic complications such as, kidney failure, vision loss and others.

In recent years, a large amount of research has been conducted in relation to diabetes in general and in mathematics particularly. These mathematical models aim at understanding and analyzing the dynamics of diabetics. In a related research work, in 2004 Boutayeb et al. [3] introduced introduced the diabetes complication (DC) model to find out how many changes of diabetics without complications (D) and diabetics with complications (C). In the DC model the number of new patients (incidence) of diabetes is assumed to be constant. In 2007 Derouich et al. [4] proposed a A population model of diabetes and prediabetes using a system of ordinary differential equations. In 2014 Derouich et al. [4] proposed also an optimal control approach modeling the evolution from pre-diabetes to diabetes with and without complications. They showed the existence of an optimal control and then used a numerical implicit finite-difference method to monitor the size of population in each compartment. Their model shows that, using optimal control, the number of diabetics with and without complications can be significantly reduced in a period of 10 years. In 2018 Permatasar et al. [8] proposed Mathematical model to elaborate the prevalence of diabetics has been determined by diabetes complication (DC) model. In the DC model, people with diabetes were classified into two compartments, uncomplicated diabetics (D) and complicated diabetics (C). Diabetes is known as a disease caused by lifestyle and genetic factors. A bad lifestyle leads a susceptible individual to become a diabetic. Bad lifestyle is strongly influenced by risky social interaction. In the other side, a genetic factor is the main cause of the diabetes genetic disorder birth. Consider these both factors, the DC model was developed into a susceptible diabetes complication (SDC) model. Susceptible individuals were involved in the calculation of risky interactions. The SDC model is a first order nonlinear differential equation. The number and the change of individuals in each compartment can be determined from the solution of this model. In this paper, the SDC model is applied to predict changes of diabetics prevalence in the United States. As a result, the SDC model is good enough to predict the prevalence, and Al Helal et al. [32] Insulin injections and exercise scheduling for individuals with diabetes: an optimal control model. In 2019 Kouidere et al. [5] introduced a Discrete Time to the Dynamics of a Population of Diabetics with Highlighting the Impact of Living Environment, and Anarina et al. [18, 19] studied the dynamics of glucose, insulin, and free fatty acids with time delay: the impact of bariatric surgery on type 2 diabetes mellitus. In 2020 Kouidere et al. [6] In order to have realistic model. They proposed to study an optimal control approach with delay in state and control variables in a discrete mathematical model of kouidere et al. [5], that time with delay represent the measuring the extent of interaction with the means of treatment or awareness campaigns. Also, many researches have focused on this topic and other related topics, and Sweatman et al. [14] introduce a mathematical model of diabetes and diet-related lipid metabolism, leptin sensitivity, insulin sensitivity and VLDLTG clearance predict pathways to health and type II diabetes, and also Auni Aslah Mat Daud et al. [46] proposed a mathematical model of the population dynamics of DM during pregnancy is developed and analyzed. Four independent variables have been considered, namely the numbers of nonpregnancy nondiabetic women, diabetic nonpregnant women, diabetic pregnant women and diabetic pregnant women with complication. The model is described by a system of ordinary differential equations. The stability of the equilibrium point is analyzed using Routh-Hurwitz criteria. The model is numerically simulated using MATLAB to verify the analytical results. The model has only one nonnegative equilibrium point which is asymptotically stable. The equilibrium solution is further investigated using simple sensitivity analysis. The results of simple sensitivity analysis of the equilibrium solution suggest the key parameters of the model. The equilibrium point of the model indicates the influential parameters that can be controlled to address the issue. Also, many researches have focused on this topic and other related topics [7,8,9, 16, 20,21,22].

According th World Health Organization (WHO) [43], the number of incidences of diabetes is not constant and tends to increase every year. The increase is due to the lifestyle of the world’s population. One of the factors influencing lifestyle is social interaction. Social interaction is a significant factor affecting lifestyle changes so as to increase the potential of a healthy-susceptible individual into diabetics [44]. In addition, the incidence of diabetes is also often associated with genetic factors from parents who have a history of diabetes [45]. However, they did not take into account the negative impact of the socio-environmental factors according to age groups, that is the aim of this paper.

The increase in the number of diabetics is related to several factors. Diabetes is caused by unhealthy lifestyles such as, the lack of physical activity, unhealthy eating patterns, and other unhealthy habits. Diabetics who have experienced complications are already aware of their poor heath conditions. In contrast, diabetics without complications were unable to lead a healthy lifestyle, especially in undiagnosed cases. The influence of society on diabetes varies vis-à-vis their ages. the closer people are in age, the more influencial they become towards one another. In addition to the foregoing, the aim of this paper is to shed light on socio-environmental such as behavioral, social, and economic factors; these factors can be controlled in contrast to genetic factors that are difficult to control because diabetes cannot be cured, but one can control the rate of glucose in the blood by virtue of a balanced diet. The extent to which people who do not suffer from diabeties negatively impact diabetics when both groups belong to the same age group. The extent to which people who do not suffer from diabeties negatively impact diabetics when both groups do not belong to different age group.

As previously indicated in discrete mathematical modeling of Kouidere et al., diabetics were divided into two main groups, namely: diabetics due to genetic factors P, diabetics due to behavioral and economic factors in which the entourage plays a crutial role E. furthermore, diabetics without complications D and diabetics with complications C. can be added to the mix. And that was elaborated in detail in the methodology section.

Besides the aforementioned works, we will study a mathematical modeling of the dynamics of a population of diabetics which contains the following additions: * A discrete-age continuous mathematical modeling, * Dividing age into multiple age intervals.

We note, as mentioned above, that most researches about diabetes and its complications focusing on continuous and discrete time models and describing differential equations. Recently, more and more attention has been paid to the study of optimal control. (see [12, 24,25,26,27,28,29,30,31] ...and references cited There).

In Sect. 2 of this paper, we presented the PEDC continuous mathematical model and we gave some basic properties, and we presented the optimal control problem for the proposed model where we gave some results concerning the existence of the optimal controls and we characterized these optimal controls using Pontryagin’s maximum principle. In Sect. 3, we proposed mathematical model with multiple age and optimal control where we gave some result concerning the existence of the optimal control and we characterized the optimal controls. We gave numerical simulations, in Sect. 4. Finally, we concluded the paper in Sect. 5.

2 Methods

2.1 Description of the model

We considered a mathematical model PEDC that described the dynamics of a population of diabetics with highlighting the effect of lifestyle. by divided the population N into four compartments: P is Number of pre-diabetic peopole through genetics factors (Genetic predisposition), E is represented the Pre-diabetics due to the negative impact of socio-environmental factors on diabetics ( without Genetic predisposition), D is represented the number of diabetics without complications, C is represented the number of diabetics with complications (Complication as Cardiovascular disease, Foot damage, neuropathy, nephropathy and retinopathy). The total population of individuals, N(t) at time t is given as: \(N(t)=N_{1}(t)+N_{2}(t)=P(t)+D(t)+C(t)+E(t)\). The graphical representation of the proposed model is shown in Fig. 1.

Fig. 1
figure 1

A model diagram of the dynamics of population diabetics

Hence, we presented the PEDC diabetic mathematical model by the following system of differential equations:

$$\begin{aligned} \left\{ \begin{array}{l} \frac{dP(t)}{dt}=I_{1}-( \ \mu + \ \beta _{1}+\beta _{3})P(t) \\ \frac{dE(t)}{dt}=I_{2}-(\mu +\gamma )E(t) \\ \frac{dD(t)}{dt}=\beta _{1}P(t)+\gamma E(t)-\alpha \frac{D(t)E(t)}{N}-(\mu +\beta _{2})D(t) \\ \frac{dC(t)}{dt}=\beta _{3}P(t)+\beta _{2}D(t)+\alpha \frac{D(t)E(t)}{N} -(\mu +\delta )C(t) \end{array} \right. \end{aligned}$$
(1)

with \(P(0)\ge 0,\) \(D(0)\ge 0,\) \(E(0)\ge 0,\) \(C(0)\ge 0\) are the given initial states.

  • \(\mu \): Natural death rate (Natural mortality is not due to diabetes and its complications).

  • \(I_{1}\): Denote the incidence of pre-diabetes due to genetics factors.

  • \(I_{2}\): Denote the incidence of pre-diabetes due to lifestyle (living environment).

  • \(\beta _{1}\): The rate of pre-diabetics who has been diabetics without complications.

  • \(\beta _{2}\): The rate of diabetics whose complications are cured.

  • \(\beta _{3}\): The rate of diabetics become diabetics with complication through the sudden sock.

  • \(\gamma \): The rate of diabetics people probability of developing diabetes through the negative effect of socio-environmental factors on diabetics.

  • \(\delta \): Mortality rate due to complications.

  • \(\alpha \): The rate of negative effect of socio-environmental factors E(t) on diabetics people D(t)( According to Hill et al. [47], the interaction between individuals without diabetes E(t) who have unhealthy lifestyles and diabetics without complications D(t) leads to negative health outcomes for those with diabetes).

2.2 Basic properties of the model

2.2.1 Positivity of solutions

Theorem 1

If \(P\left( 0\right) \ge 0~,E\left( 0\right) \ge 0,D\left( 0\right) \ge 0\) and \(\mathbf {C}(0)>0\), the solutions \(P\left( t\right) , \) \(E\left( t\right) ,\) \(D\left( t\right) \) and \(\mathbf {C}(t)\) of system (1) are positive for all \(t\ge 0\).

Proof

We have according to the first equation of the system (1) that

$$\begin{aligned}&\frac{dP(t)}{dt} = I_{1}-(\mu +\beta _{1}+\beta _{3})P(t) \\&\quad \ge -(\mu +\beta _{1}+\beta _{3})P(t) \\&\frac{dP(t)}{dt}+(\ \mu +\beta _{1}+\beta _{3})P(t)\ge 0 \end{aligned}$$

The both sides of the last inequality are multiplied by \(\exp \left( (\mu +\beta _{1}+\beta _{3})t\right) ~\), we obtain

$$\begin{aligned} \exp \left( (\mu +\beta _{1}+\beta _{3})t\right) \cdot \frac{dP(t)}{dt}+(\ \mu +\beta _{1}+\beta _{3})\exp \left( (\mu +\theta _{1}+\theta _{2})t\right) \cdot P(t)\ge 0 \end{aligned}$$

So,

$$\begin{aligned} \frac{d}{dt}\left( \exp ((\mu +\beta _{1}+\beta _{3})t).P(t)\right) \ge 0 \end{aligned}$$

Integrating this inequality from 0 to t gives: \(\int \nolimits _{0}^{t} \frac{d}{ds}\left( \exp ((\mu +\beta _{1}+\beta _{3})s)\cdot P(s)\right) ds\ge 0\).

Then \(P(t)\ge P(0)\exp \left( -(\mu +\beta _{1}+\beta _{3})t\right) >0 \)

Similarly, we prove that E(t),  D(t) and C(t) are positive for all \(t\ge 0\). \(\square \)

2.2.2 Invariant region

Theorem 2

The set \(\varOmega =\left\{ \left( P,E,D,C\right) \in \mathbb {R} ^{4}/0\le P+E+D+C\le \frac{I}{\mu }\right\} \) positively invariant under system (1) with initial conditions \(P\left( 0\right) \ge 0~,\) \( E\left( 0\right) \ge 0,\) \(D\left( 0\right) \ge 0\) and \(\mathbf {C}\left( 0\right) \ge 0.\)

Proof

By adding the equations of system (1), we obtain

$$\begin{aligned} \frac{dN}{dt}= & {} I-\mu N-\delta C\le I-\mu N \\&\Longrightarrow&~N(t)\le \frac{I}{\mu }+N(0)e^{-\mu t} \end{aligned}$$

where \(I=I_{1}+I_{2}\) that I is the sum of the recruitment rates \(I_{1}\) and \(I_{2}\), and N(0) represents the initial values of the total population.

Thus, \(\lim \limits _{t\rightarrow \infty }\sup N(t)=\frac{I}{\mu }\). It implies that the region \(\varOmega \) is a positively invariant set for system ( 1). So, we only need to consider the dynamics of the system on the set \(\varOmega \). \(\square \)

2.2.3 Exictence of solutions

Theorem 3

The system (1) that satisfies a given initial condition \(\left( P\left( 0\right) ~,E\left( 0\right) ,D\left( 0\right) ,C\left( 0\right) \right) \) has a unique solution.

Proof

Let \(X=\left( \begin{array}{c} P\left( t\right) \\ E\left( t\right) \\ D\left( t\right) \\ \mathbf {C}\left( t\right) \end{array} \right) \) and \(\varphi \left( X\right) =\left( \begin{array}{c} \frac{dP\left( t\right) }{dt} \\ \frac{dE\left( t\right) }{dt} \\ \frac{dD\left( t\right) }{dt} \\ \frac{d\mathbf {C}\left( t\right) }{dt} \end{array} \right) \)

The system (1) can be rewritten in the following form:

$$\begin{aligned} \varphi (X)=\overset{.}{X}=AX+B(X) \end{aligned}$$
(2)

where

$$\begin{aligned} A=\left( \begin{array}{cccc} -( \ \mu + \ \beta _{1}+ \ \beta _{3}) &{} 0 &{} 0 &{} 0 \\ 0 &{} -\mu -\gamma &{} 0 &{} 0 \\ \beta _{1} &{} \gamma &{} -\mu -\beta _{2} &{} 0 \\ \beta _{3} &{} 0 &{} \beta _{2} &{} -\mu -\delta \end{array} \right) \end{aligned}$$

and

$$\begin{aligned} B(X)=\left( \begin{array}{c} I_{1} \\ I_{2} \\ -\alpha \frac{D(t)E(t)}{N} \\ \alpha \frac{D(t)E(t)}{N} \end{array} \right) \end{aligned}$$

The second term on the right-hand side of (2) satisfies:

$$\begin{aligned} B(X_{1})-B(X_{2})= & {} \left( \begin{array}{c} I_{1} \\ I_{2} \\ -\alpha \frac{D_{1}(t)E_{1}(t)}{N_{1}} \\ \alpha \frac{D_{1}(t)E_{1}(t)}{N_{1}} \end{array} \right) -\left( \begin{array}{c} I_{1} \\ I_{2} \\ -\alpha \frac{D_{2}(t)E_{2}(t)}{N_{2}} \\ \alpha \frac{D_{2}(t)E_{2}(t)}{N_{2}} \end{array} \right) \\= & {} \left( \begin{array}{c} I_{1}-I_{1} \\ I_{2}-I_{2} \\ -\alpha \frac{D_{1}(t)E_{1}(t)}{N_{1}}+\alpha \frac{D_{2}(t)E_{2}(t)}{N_{2}} \\ \alpha \frac{D_{1}(t)E_{1}(t)}{N_{1}}-\alpha \frac{D_{2}(t)E_{2}(t)}{N_{2}} \end{array} \right) \\= & {} \left( \begin{array}{c} 0 \\ 0 \\ -\alpha \frac{D_{1}(t)E_{1}(t)}{N_{1}}+\alpha \frac{D_{2}(t)E_{2}(t)}{N_{2}} \\ \alpha \frac{D_{1}(t)E_{1}(t)}{N_{1}}-\alpha \frac{D_{2}(t)E_{2}(t)}{N_{2}} \end{array} \right) \end{aligned}$$

Therefore

$$\begin{aligned} \left\| B(X_{1})-B(X_{2})\right\|\le & {} 2\alpha \left\| \frac{D_{1}(t)E_{1}(t)}{N_{1}(t)}-\frac{D_{2}(t)E_{2}(t)}{N_{2}(t)}\right\| \\\le & {} \frac{2\alpha }{N_{1}(t)N_{2}(t)}\left\| D_{1}(t)E_{1}(t)N_{2}(t)-D_{2}(t)E_{2}(t)N_{1}(t)\right\| \\\le & {} \frac{2\alpha }{N_{1}(t)N_{2}(t)}\left\| D_{1}(t)E_{1}(t)N_{2}(t)-D_{1}(t)E_{1}(t)N_{1}(t)\right. \\&\left. +D_{1}(t)E_{1}(t)N_{1}(t)-D_{2}(t)E_{2}(t)N_{1}(t)\right\| \\\le & {} \frac{2\alpha }{N_{1}(t)N_{2}(t)}\left\| D_{1}(t)E_{1}(t)\left( N_{2}(t)-N_{1}(t)\right) \right. \\&\left. +N_{1}(t)(D_{1}(t)E_{1}(t)-D_{2}(t)E_{2}(t))\right\| \\\le & {} 2\alpha \left( \left\| D_{1}(t)E_{1}(t)\right\| \left\| N_{2}(t)-N_{1}(t)\right\| +\left\| N_{1}(t)\right\| \right. \\&\left. \left\| D_{1}(t)E_{1}(t)-D_{2}(t)E_{2}(t)\right\| \right) \\\le & {} 2\alpha \left( \left\| D_{1}(t)E_{1}(t)\right\| \left\| N_{2}(t)-N_{1}(t)\right\| \right. \\&\left. +\left\| N_{1}(t)\right\| \left\| D_{1}(t)E_{1}(t)-D_{1}(t)E_{2}(t)+D_{1}(t)E_{2}(t)-D_{2}(t)E_{2}(t)\right\| \right) \\\le & {} 2\alpha \left( \left\| D_{1}(t)E_{1}(t)\right\| \left\| N_{2}(t)-N_{1}(t)\right\| \right. \\&\left. +\left\| N_{1}(t)\right\| \left\| D_{1}(t)\left( E_{1}(t)-E_{2}(t)\right) +\left( D_{1}(t)-D_{2}(t)\right) E_{2}(t)\right\| \right) \\\le & {} 2\alpha \left( \left\| D_{1}(t)\right\| \left\| E_{1}(t)\right\| \left\| N_{2}(t)-N_{1}(t)\right\| \right. \\&\left. +\left\| N_{1}(t)\right\| \left( \left\| D_{1}(t)\right\| \left\| E_{1}(t)-E_{2}(t)\right\| +\left\| D_{1}(t)-D_{2}(t)\right\| \left\| E_{2}(t)\right\| \right) \right) \\\le & {} 2\alpha \left( (\frac{I}{\mu })^{2}\left\| N_{2}(t)-N_{1}(t)\right\| +(\frac{I}{\mu })^{2}\left\| E_{1}(t)-E_{2}(t)\right\| \right. \\&\left. +(\frac{I}{\mu })^{2})\left\| D_{1}(t)-D_{2}(t)\right\| \right) \\\le & {} M.\left\| X_{1}-X_{2}\right\| \end{aligned}$$

where \(M=2\alpha \left( (\frac{I}{\mu })^{2}+(\frac{I}{\mu })^{2}+(\frac{I}{ \mu })^{2}\right) \), and M is some positive constants, independent of the state variables \( P\left( t\right) ,~E\left( t\right) ,~D\left( t\right) \) and C(t).

then \(\left\| \varphi (X_{1})-\varphi (X_{2})\right\| \le V.\left\| X_{1}-X_{2}\right\| ~\)

where \(V=\max (M,\left\| A\right\| )<\infty \).

Thus, it follows that the function \( \varphi \) is uniformly Lipschitz continuous. the restriction on \(P\left( t\right) \ge 0~,~E\left( t\right) \ge 0,\) \(D\left( t\right) \ge 0\) and \( \mathbf {C}(t)\ge 0,\) we see that a solution of the system (1) exists [17]. \(\square \)

2.3 The optimal control Problem

2.3.1 Formulation of the optimal control problem

The strategy of control that has been adopted consists of an awareness program to minimize the negative effect of behavioral factors on diabetics without complication. Our main aim is to minimize the number of people evolving from the stage of pre-diabetes to the stages of diabetes with and without complications. In this model, we included three controls u(t), v(t) and w(t) for \(t\in [0,T]\). The first control is symbolized by u represented treatment, Its role is manifested in treating the complications of diabetes, and overcoming them, which gives an opportunity to control the level of glucose in the blood at a given time t. The second control v represented the awareness program through media and education, by raising awareness of the seriousness of the negative impact of behavioral factors on diabetics without complication D. The third control w represented the awareness program, through raising awareness of non-diabetics about the negative imapct of behavioral, economic and social factors that lead to diabetes at a given time t.

$$\begin{aligned} \left\{ \begin{array}{l} \frac{dP(t)}{dt}=I_{1}-(\mu +\beta _{1}+\beta _{3})P(t) \\ \frac{dE(t)}{dt}=I_{2}-\mu E(t)-\gamma (1-w(t))E(t) \\ \frac{dD(t)}{dt}=\beta _{1}P(t)+\gamma (1-w(t))E(t)-\alpha \left( 1-v(t)\right) \frac{D(t)E(t)}{N}-(\mu +\beta _{2})D(t)+u(t)C(t) \\ \frac{dC(t)}{dt}=\beta _{3}P(t)+\beta _{2}D(t)+\alpha \left( 1-v(t)\right) \frac{D(t)E(t)}{N}-(\mu +\delta )C(t)-u(t)C(t) \end{array} \right. \end{aligned}$$
(3)

with \(P(0)\ge 0,\) \(D(0)\ge 0,\) \(E(0)\ge 0\) and \(C(0)\ge 0\)

2.3.2 The optimal control: existence and characterization

Our aim is to minimize the number of diabetics without complication individuals and the cost of vaccination program. Mathematically, it can be interpreted by optimisation of the objective functional

$$\begin{aligned} J(u,v,w)=C(T)-D(T)+\int \limits _{0}^{T}\left[ C(t)-D(t)+\frac{A}{2}u^{2}(t)+ \frac{B}{2}v^{2}(t)+\frac{G}{2}w^{2}(t)\right] dt\text { } \end{aligned}$$
(4)

where \(A>0\), \(B>0\) and \(G>0\) are the cost coefficients. They are selected to weigh the relative importance of u(t), v(t) and w(t) at time t. T is the final time.

In other words, we seek the optimals controls \(u^{*}\), \(v^{*}\) and \( w^{*}\) such that

$$\begin{aligned} J(u^{*},v^{*},w^{*})=\min _{\left( u,v,w\right) \in U}J(u,v,w) \end{aligned}$$
(5)

where U is the set of admissible controls defined by \(U=\{(u,v,w)/\) \(u_{min}\le u(t)\le u_{max}\), \(u_{min}\le v(t)\le u_{max}\) and \(w_{min}\le w(t)\le w_{max}/~t\in [0,T]\}\)

2.4 Existence of an optimal control

Theorem 4

Consider the control problem with system (3). There exists an optimal control \((u^{*},v^{*},~w^{*})\in U~\)such that \( J(u^{*},v^{*},~w^{*})=\min \limits _{\left( u,v,w\right) \in U}J(u,v,w)\)

Proof

The existence of the optimal control can be obtained using a result by Fleming and Rishel [16], checking the following steps :

  • The set of controls and corresponding state variables is nonempty. To prove this condition we use a simplified version of an existence result of Boyce and DiPrima ([15], Theorem 7.1.1)

    To prove that the set of controls and the corresponding state variables is nonempty, we will use a simplified version of an existence result  [15]. Let \(X_{i}^{\prime }=F_{X_{i}}(t,X_{1},\ldots ,X_{4})\) with \( i=1,\ldots ,4\) where \(\left( X_{1},\ldots ,X_{4}\right) =\left( P,E,D,C\right) \) where \(X_{1},X_{2},X_{3}\) and \(X_{4}\) form the right-hand side of the system of equations (10). Let uv and w for some constants and since all parameters are constants and \(X_{1},X_{2},X_{3}\) and \(X_{4}\) are continuous, then \(F_{P},F_{E},F_{D}\) and \(F_{C}\) are also continuous. Additionally, the partial derivatives \(\frac{\partial F_{X_{i}}}{ \partial X_{i}}\) with \(i=1,\ldots ,4\) are all continuous. therefore, there exists a unique solution \(\left( P,E,D,C\right) \) that satisfies the initial conditions. therefore, the set of controls and the corresponding state variables is nonempty and condition 1 is satisfied in U.

  • The control space \(U=\{(u,v,w)/\) \(u_{min}\le u(t)\le u_{max}\), \(u_{min}\le v(t)\le u_{max}\) and \(w_{min}\le w(t)\le w_{max}/~t\in [0,T]\}\) is convex and closed by definition (see appendix 1).

  • All the right hand sides of equations of system are continuous, bounded above by a sum of bounded control and state, and can be written as a linear function of u with coefficients depending on time and state.

  • The integrand in the objective functional \(C(t)-D(t)+\frac{A}{2} u^{2}(t)+\frac{B}{2}v^{2}(t)+\frac{G}{2}w^{2}(t)\) is clearly convex on U

    It rest to show that there exists constants \(\zeta _{1},\zeta _{2},\zeta _{3},\zeta _{4}>0,\)

    and \(\zeta \) such that \(C(t)-D(t)+\frac{A}{2}u^{2}(t)+\frac{B}{2}v^{2}(t)+ \frac{G}{2}w^{2}(t)\) satisfies

    $$\begin{aligned} C(t)-D(t)+\frac{A}{2}u^{2}(t)+\frac{B}{2}v^{2}(t)+\frac{G}{2}w^{2}(t)\ge \zeta _{1}+\zeta _{2}\left| u\right| ^{\zeta }+\zeta _{3}\left| v\right| ^{\zeta }+\zeta _{4}\left| w\right| ^{\zeta }. \end{aligned}$$

    The state variables being bounded, let \(\zeta _{1}=\frac{1}{2} \inf \limits _{t\in [0,T]}\left( C(t)-D(t)\right) ,\zeta _{2}=A,~\zeta _{3}=B,~\zeta _{4}=G\) and \(\zeta =2\) then it follows that:

    $$\begin{aligned} C(t)-D(t)+\frac{A}{2}u^{2}(t)+\frac{B}{2}v^{2}(t)+\frac{G}{2}w^{2}(t)\ge \zeta _{1}+\zeta _{2}\left| u\right| ^{\zeta }+\zeta _{3}\left| v\right| ^{\zeta }+\zeta _{4}\left| w\right| ^{\zeta }. \end{aligned}$$

    Then from Fleming and Rishel [16], we conclude that there exists an optimal control.\(\square \)

2.5 Characterization of the optimal control

In order to derive the necessary condition for optimal control, the Pontryagins maximum principle [13], given in was used. This principle converts into a problem of minimizing a Hamiltonian H(t) at time t defined by

$$\begin{aligned} H(t)=C(t)-D(t)+\frac{A}{2}u^{2}(t)+\frac{B}{2}v^{2}(t)+\frac{G}{2} \end{aligned}$$
(6)

where \(f_{i}\) is the right side of the differential equation of the ith state variable at time t.

Theorem 5

Given the optimals controls \((u^{*},v^{*},w^{*})\) and the solutions \(P^{*},E^{*},D^{*}\) and \(C^{*}\) of the corresponding state system (3), there exists adjoint variables \(\lambda _{1}(t),\) \(\lambda _{2}(t)\),\(\lambda _{3}(t)\) and \( \lambda _{4}(t)\) satisfying:

$$\begin{aligned} \lambda _{1}^{\prime }(t)= & {} -\frac{\partial H(t)}{\partial P(t)}=-\lambda _{1}(t)\left[ -\mu -\beta _{1}-\beta _{3}\right] -\lambda _{3}(t)\beta _{1}-\lambda _{4}(t)\beta _{3} \\ \lambda _{2}^{\prime }(t)= & {} -\frac{\partial H(t)}{\partial E(t)}=-\lambda _{2}(t)\left[ -\mu -\gamma (1-w(t))\right] \\&\quad -\lambda _{3}(t)\left[ \gamma (1-w(t))-\alpha (1-v(t))\frac{D(t)}{N}\right] \\&\quad -\lambda _{4}(t)(\alpha (1-v(t))\frac{D(t)}{N} \\ \lambda _{3}^{\prime }(t)= & {} -\frac{\partial H(t)}{\partial D(t)}=1-\lambda _{3}(t)\left[ -\alpha (1-v(t))\frac{E(t)}{N}+(-\mu -\beta _{2})\right] \\&\quad -\lambda _{4}(t)\left[ \alpha (1-v(t))\frac{E(t)}{N}+\beta _{2}\right] \\ \lambda _{4}^{\prime }(t)= & {} -\frac{\partial H(t)}{\partial C(t)}=-1-\lambda _{3}(t)\times u(t)-\lambda _{4}(t)\times (-\mu -\gamma -u(t)) \end{aligned}$$

With the transversality conditions at time T: \(\lambda _{1}(T)=0,~\lambda _{2}(T)=0,~\lambda _{3}(T)=1\) and \(\lambda _{4}(T)=-1.\)

Furthermore, for \(t\in [0,T]\), the optimal controls \(u^{*},v^{*}\) and \(w^{*}\) are given by

$$\begin{aligned} u^{*}&=\min \left( u_{max},\max \left( u_{min},\frac{(\lambda _{3}(t)-\lambda _{4}(t)) }{A}C^{*}(t)\right) \right) \end{aligned}$$
(7)
$$\begin{aligned} v^{*}&=\min \left( v_{max},\max \left( v_{min},\frac{(\lambda _{3}(t)-\lambda _{4}(t)) }{B}\times \frac{\alpha D^{*}(t)E^{*}(t)}{N}\right) \right) \end{aligned}$$
(8)
$$\begin{aligned} w^{*}&=\min \left( w_{max},\max \left( w_{min},\frac{(\lambda _{2}(t)-\lambda _{3}(t)) }{G}\times \gamma E^{*}(t)\right) \right) \end{aligned}$$
(9)

Proof

We use the Pontryagins maximum principle [13], for characterized the optimal controls. So, we defined the Hamiltonian H as follows:

$$\begin{aligned}&H(t) =C(t)-D(t)+\frac{A}{2}u^{2}(t)+\frac{B}{2}v^{2}(t)+\frac{G}{2} w^{2}(t)+\lambda _{1}(t)\left[ I_{1}-( \ \mu +\beta _{1}+\beta _{3})P(t)\right] \\&\quad +\lambda _{2}(t)\left[ I_{2}-\mu E(t)-\gamma (1-w(t))E(t)\right] +\lambda _{3}(t) \\&\qquad \left[ \beta _{1}P(t)+\gamma (1-w(t))E(t)-\alpha \left( 1-v(t)\right) \frac{D(t)E(t)}{N}-(\mu +\beta _{2})D(t)+u(t)C(t)\right] \\&\quad +\lambda _{4}(t)\left[ \beta _{3}P(t)+\beta _{2}D(t)+\alpha \left( 1-v(t)\right) \frac{D(t)E(t)}{N}-(\mu +\delta )C(t)-u(t)C(t)\right] \end{aligned}$$

At this case it is considered that N is constant. For \(t\in [0,T]\), the adjoint equations and transversality conditions can be obtained by using Pontryagin’s maximum principle [5, 10, 11, 13, 23] such that

$$\begin{aligned} \lambda _{1}^{\prime }(t)= & {} -\frac{\partial H(t)}{\partial P(t)}=-\lambda _{1}(t)\left[ -\mu -\beta _{1}-\beta _{3}\right] -\lambda _{3}(t)\beta _{1}-\lambda _{4}(t)\beta _{3} \\ \lambda _{2}^{\prime }(t)= & {} -\frac{\partial H(t)}{\partial E(t)}=-\lambda _{2}(t)\left[ -\mu -\gamma (1-w(t))\right] \\&\quad -\lambda _{3}(t)\left[ \gamma (1-w(t))-\alpha (1-v(t))\frac{D(t)}{N}\right] \\&\quad -\lambda _{4}(t)(\alpha (1-v(t))\frac{D(t)}{N} \\ \lambda _{3}^{\prime }(t)= & {} -\frac{\partial H(t)}{\partial D(t)}=1-\lambda _{3}(t)\left[ -\alpha (1-v(t))\frac{E(t)}{N}+(-\mu -\beta _{2})\right] \\&\quad -\lambda _{4}(t)\left[ \alpha (1-v(t))\frac{E(t)}{N}+\beta _{2}\right] \\ \lambda _{4}^{\prime }(t)= & {} -\frac{\partial H(t)}{\partial C(t)}=-1-\lambda _{3}(t)\times u(t)-\lambda _{4}(t)\times (-\mu -\gamma -u(t)) \end{aligned}$$

With the transversality conditions [48] at time T:

\(\lambda _{1}(T)=-\frac{\partial (C(T)-D(T))}{\partial P(T)}=0.\)

\(~\lambda _{2}(T)=-\frac{\partial (C(T)-D(T))}{\partial E(T)}=0,\)

\(~\lambda _{3}(T)=-\frac{\partial (C(T)-D(T))}{\partial D(T)}=1\)

and \(\lambda _{4}(T)=-\frac{\partial (C(T)-D(T))}{\partial C(T)}=-1.\)

For, \(t\in [0,T]\) the optimal controls u, v and w can be solved from the optimality condition

$$\begin{aligned} -\frac{\partial H(t)}{\partial u(t)}= & {} 0~\Rightarrow -Au(t)-(\lambda _{4}(t)-\lambda _{3}(t))C(t)=0 \\ -\frac{\partial H(t)}{\partial v(t)}= & {} 0\Rightarrow -Bv(t)-(\lambda _{4}(t)-\lambda _{3}(t))\frac{D(t)E(t)}{N}=0 \\ -\frac{\partial H(t)}{\partial w(t)}= & {} 0\Rightarrow -Gw(t)-(\lambda _{3}(t)-\lambda _{2}(t))\gamma E(t)=0 \end{aligned}$$

We have

$$\begin{aligned} u(t)= & {} \frac{(\lambda _{4}(t)-\lambda _{3}(t))}{A}C(t) \\ v(t)= & {} \frac{(\lambda _{4}(t)-\lambda _{3}(t))}{B}\times \frac{\alpha D(t)E(t) }{N} \\ w(t)= & {} \frac{(\lambda _{3}(t)-\lambda _{2}(t))}{G}\times \gamma E(t) \end{aligned}$$

By the bounds in U of the controls, it is easy to obtain \(\ u^{*},v^{*}\) and \(w^{*}\) are given by (16, 17, 18) in the form of system(3). \(\square \)

3 Mathematical modeling with multi age

In this section, the emphasis is on the impact of behavioral factors that can result from the influence that non-diabetics wield over diabetics without complications by age groups. The negative effect of a group of children under the age of 20 on each other behaviorally, or a group between the age of 18 and 50 years on each other, as well as a group over the age of 50. It will also highlight how different age groups affect others, just like adults and young adults. As we divided these age groups k into three main groups: The first category \(k = 1\) is less than 20 years old, the second category \(k = 2\) is between 20 years to 50 years, and the third category \(k = 3\) is over 50 years old.

The negative effect of no diabetics on diabetics within the same age

Diabetes is a chronic and deadly disease, it has its negative effects on the individual and society. As previously mentioned, the individual develops diabetes by genetic, behavioral, economic and social factors, according to IDF [2] In this section, we will highlight the negative effect of behavioral factors directly caused by people without diabetes. Influence of age groups of the same age as diabetics \(\frac{D_{k.k}(t)E_{k.k}(t)}{N}\) for \(k=1,2,3\). Children under 20 years old among themselves \(\frac{D_{1.1}(t)E_{1.1}(t)}{N}\), young people from 20 to 50 years old among themselves \(\frac{D_{2.2}(t)E_{2.2}(t)}{N}\), and adults over 50 years old among themselves \(\frac{D_{3.3}(t)E_{3.3}(t)}{N}\). These age groups will have a significant influence on the increase in complications of diabetics for several reasons, three of which are having the same age, having the same way of thinking and lacking the awarness of the dangers that diabetes may present.

The negative effect of no diabetics on diabetics within the different age

In this paragraph, we want to highlight the negative impact of behavioral factors of people who do not suffer from diabetes on diabetics from another age group \(\frac{D_{k.j}(t)E_{k.j}(t)}{N}\) for \(k=1,2,3\). Adults with children \(\frac{D_{3.1}(t)E_{3.1}(t)}{N}\) and vice versa \(\frac{D_{1.3}(t)E_{3.1}(t)}{N}\), young people with children \(\frac{D_{2.1}(t)E_{2.1}(t)}{N}\) and vice versa \(\frac{D_{1.2}(t)E_{1.2}(t)}{N}\), adults with young people \(\frac{D_{3.2}(t)E_{3.2}(t)}{N}\) and vice versa \(\frac{D_{2.3}(t)E_{2.3}(t)}{N}\). The graphical representation of the proposed model is shown in Fig. 2.

Fig. 2
figure 2

The figure represents the negative effect of lifestyle on diabetes without complications

The model is presented with age group k. Hence, we present the diabetic model by the following system of differential equations:

$$\begin{aligned} \left\{ \begin{array}{l} \frac{dP_{k}(t)}{dt}=\Lambda _{1}+(-\mu -\beta _{1}- \beta _{3})P_{k}(t) \\ \frac{dE_{k}(t)}{dt}=\Lambda _{2}+(-\mu -\gamma )E_{k}(t) \\ \frac{dD_{k}(t)}{dt}=\beta _{1}P_{k}(t)+\gamma E_{k}(t)-\sum \limits _{j=1}^{3}\alpha _{k.j}\frac{D_{k.j}(t)E_{k.j}(t)}{N} +(-\mu -\beta _{2})D_{k}(t) \\ \frac{dC_{k}(t)}{dt}=\beta _{3}P_{k}(t)+\beta _{2}D_{k}(t)+\sum \limits _{j=1}^{3}\alpha _{k.j}\frac{D_{k.j}(t)E_{k.j}(t)}{N }+(-\mu -\delta )C_{k}(t) \end{array} \right. \end{aligned}$$
(10)

with \(P_{k}(0)\ge 0,~D_{k}(0)\ge 0,\) \(E_{k}(0)\ge 0,\) \(C_{k}(0)\ge 0.\)

3.1 Basic properties of the model

3.1.1 Positivity of solutions

Theorem 6

If \(P_{k}\left( 0\right) \ge 0~,E_{k}\left( 0\right) \ge 0,D_{k}\left( 0\right) \ge 0\) and \(\mathbf {C}_{k}(0)>0\), the solutions \( P_{k}\left( t\right) ,\) \(E_{k}\left( t\right) ,\) \(D_{k}\left( t\right) \) and \(\mathbf {C}_{k}(t)\) of system (10) are positive for all \(t\ge 0\).

Proof

We have according to the first equation of the system (10) that

$$\begin{aligned}&\frac{dP_{k}(t)}{dt} = I_{1}-(\mu +\beta _{1}+\beta _{3})P_{k}(t) \\&\quad \ge -(\mu +\beta _{1}+\beta _{3})P_{k}(t) \\&\frac{dP_{k}(t)}{dt}+(\ \mu +\beta _{1}+\beta _{3})P_{k}(t)\ge 0 \end{aligned}$$

The both sides in last inequality are multiplied by \(\exp \left( (\mu +\beta _{1}+\beta _{3})t\right) ~\)

we obtain

$$\begin{aligned} \exp \left( (\mu +\beta _{1}+\beta _{3})t\right) .\frac{dP_{k}(t)}{dt}+(\ \mu +\beta _{1}+\beta _{3})\exp \left( (\mu +\theta _{1}+\theta _{2})t\right) .P_{k}(t)\ge 0 \end{aligned}$$

then \(\frac{d}{dt}\left( \exp ((\mu +\beta _{1}+\beta _{3})t).P_{k}(t)\right) \ge 0\)

Integrating this inequality from 0 to t gives: \(\int \limits _{0}^{t} \frac{d}{ds}\left( \exp ((\mu +\beta _{1}+\beta _{3})s).P_{k}(s)\right) ds\ge 0\)

then \(P_{k}(t)\ge P_{k}(0)\exp \left( -(\mu +\beta _{1}+\beta _{3})t\right) \)

\(\Longrightarrow ~P_{k}(t)>0.\)

Similarly, we prove that \(E_{k}\left( t\right) \ge 0,\) \(D_{k}\left( t\right) \ge 0\) and \(\mathbf {C}_{k}(t)\ge 0.\) \(\square \)

3.1.2 Invariant region

Theorem 7

The set \(\varOmega =\left\{ \left( P_{k},E_{k},D_{k},C_{k}\right) \in \mathbb {R}^{4}/0\le P_{k}+E_{k}+D_{k}+C_{k}\le \frac{I}{\mu }\right\} \) positively invariant under system (10) with initial conditions \( P_{k}\left( 0\right) \ge 0~,\) \(E_{k}\left( 0\right) \ge 0,\) \(D_{k}\left( 0\right) \ge 0\) and \(\mathbf {C}_{k}\left( 0\right) \ge 0.\)

Proof

By collecting system equations (10), we obtain

$$\begin{aligned} \frac{dN}{dt}= & {} I-\mu N-\delta C\le I-\mu N \\&\Longrightarrow&~N(t)\le \frac{I}{\mu }+N(0)e^{-\mu t} \end{aligned}$$

where \(I=I_{1}+I_{2}\), and N(0) represents the initial values of the total population.

Thus, \(\lim \limits _{t\rightarrow \infty }\sup N(t)=\frac{I}{\mu }\). It implies that the region \(\varOmega \) is a positively invariant set for system ( 10). So, we only need to consider the dynamics of the system on the set \(\varOmega \). \(\square \)

3.1.3 Existence of solutions

Theorem 8

The system (10) that satisfies a given initial condition \(\left( P_{k}\left( 0\right) ~,E_{k}\left( 0\right) ,D_{k}\left( 0\right) ,\mathbf {C} _{k}\left( 0\right) \right) \) has a unique solution.

Proof

Let \(X=\left( \begin{array}{c} P_{k}\left( t\right) \\ E_{k}\left( t\right) \\ D_{k}\left( t\right) \\ \mathbf {C}_{k}\left( t\right) \end{array} \right) \) and \(\varphi \left( X\right) =\left( \begin{array}{c} \frac{dP_{k}\left( t\right) }{dt} \\ \frac{dE_{k}\left( t\right) }{dt} \\ \frac{dD_{k}\left( t\right) }{dt} \\ \frac{d\mathbf {C}_{k}\left( t\right) }{dt} \end{array} \right) \)

so the system (10) can be rewritten in the following form:

$$\begin{aligned} \varphi (X)=\overset{.}{X}=AX+B(X) \end{aligned}$$
(11)

where

$$\begin{aligned} A=\left( \begin{array}{cccc} -( \ \mu + \ \beta _{1}+ \ \beta _{3}) &{} 0 &{} 0 &{} 0 \\ 0 &{} -\mu -\gamma &{} 0 &{} 0 \\ \beta _{1} &{} \gamma &{} -\mu -\beta _{2} &{} 0 \\ \beta _{3} &{} 0 &{} \beta _{2} &{} -\mu -\delta \end{array} \right) \end{aligned}$$

and

$$\begin{aligned} B(x)=\left( \begin{array}{c} I_{1} \\ I_{2} \\ -\alpha \frac{D_{k}(t)E_{k}(t)}{N} \\ \alpha \frac{D_{k}(t)E_{k}(t)}{N} \end{array} \right) \end{aligned}$$

The second term on the right-hand side of (11) satisfies

$$\begin{aligned} \left\| B(X_{1})-B(X_{2})\right\| \le M.\left\| X_{1}-X_{2}\right\| \end{aligned}$$

where M are some positive constants, independent of the state variables \( P_{k}\left( t\right) ,~E_{k}\left( t\right) ,D_{k}\left( t\right) \) and \( C_{k}(t)\).

Then \(\left\| \varphi (X_{1})-\varphi (X_{2})\right\| \le V.\left\| X_{1}-X_{2}\right\| ~\)Thus, it follows that the function \( \varphi \) is uniformly Lipschitz continuous. the restriction on \(P_{k}\left( t\right) \ge 0~,~E_{k}\left( t\right) \ge 0,\) \(D_{k}\left( t\right) \ge 0\) and \(\mathbf {C}_{k}(t)\ge 0,\) we see that a solution of the system (11) exists [17]. \(\square \)

4 Formulation of the model

We will follow the same strategy above to optimize mathematical modeling with multi category of age. We included three controls u(t), v(t) and w(t) for \(t\in [0,T]\), represented awarness program and treatment for diabetics people and sensitization about the negative impact of behavioral, economic and social factors.

$$\begin{aligned} \left\{ \begin{array}{l} \frac{dP_{k}(t)}{dt}=\Lambda _{1}+(-\mu -\beta _{1}- \beta _{3})P_{k}(t) \\ \frac{dE_{k}(t)}{dt}=\Lambda _{2}-\mu E_{k}(t)-\gamma (1-w_{k}(t))E_{k}(t) \\ \frac{dD_{k}(t)}{dt}=\beta _{1}P_{k}(t)+\gamma (1-w_{k}(t))E_{k}(t)-\sum \limits _{j=1}^{3}\alpha _{k.j}\left( 1-v_{k.j}(t)\right) \frac{D_{k.j}(t)E_{k.j}(t)}{N}\\ ~~~~~~~~~~~~~-(\mu +\beta _{2})D_{k}(t)+u_{k}(t)C_{k}(t) \\ \frac{dC_{k}(t)}{dt}=\beta _{3}P_{k}(t)+\beta _{2}D_{k}(t)+\sum \limits _{j=1}^{3}\alpha _{k.j}\left( 1-v_{k.j}(t)\right) \frac{D_{k.j}(t)E_{k.j}(t)}{N}-(\mu +\delta )C_{k}(t)\\ ~~~~~~~~~~~~~~-u_{k}(t)C_{k}(t) \end{array} \right. \end{aligned}$$
(12)

The problem is to minimize the objective functional

$$\begin{aligned} J(u,v,w)=C_{k}(T)-D_{k}(T)+\int \limits _{0}^{T}\left[ C_{k}(t)-D_{k}(t)+ \frac{A}{2}u^{2}(t)+\frac{B}{2}v^{2}(t)+\frac{G}{2}w^{2}(t)\right] dt\text { } \end{aligned}$$
(13)

where \(A>0\), \(B>0\) and \(G>0\) are the cost coefficients.they are selected to weigh the relative importance of u(t), v(t) and w(t) at time t. T is the final time.

In other words, we seek the optimals controls \(u^{*}\),\(v^{*}\) and \( w^{*}\) such that

$$\begin{aligned} J(u^{*},v^{*},w^{*})=\min _{\left( u,v,w\right) \in U}J(u,v,w) \end{aligned}$$
(14)

where U is the set of admissible controls defined by \(U=\{(u,v,w)/\) \(u_{min}\le u(t)\le u_{max}\), \(u_{min}\le v(t)\le u_{max}\) and \(w_{min}\le w(t)\le w_{max}/~t\in [0,T]\}\)

4.1 Existence of an optimal control

Theorem 9

Consider the control problem with system (12).

There exists an optimal control \((u^{*},v^{*},~w^{*})\in U^{3}~\) such that \(J(u^{*},v^{*},~w^{*})=\min \limits _{u,v,w\in U}J(u,v,w) \)

Proof

The existence of the optimal control can be obtained using a result by Fleming and Rishel [16], checking the following steps:

  • The set of controls and corresponding state variables is nonempty. To prove this condition we use a simplified version of an existence result of Boyce and DiPrima ([15], Theorem 7.1.1)

  • The control space \(U=\{(u,v,w)/\) \(u_{min}\le u(t)\le u_{max}\), \(u_{min}\le v(t)\le u_{max}\) and \(w_{min}\le w(t)\le w_{max}/~t\in [0,T]\}\) is convex and closed by definition.

  • All the right hand sides of equations of system are continuous, bounded above by a sum of bounded control and state, and can be written as a linear function of uv and w with coefficients depending on time and state.

  • The integrand in the objective functional \(C_{k}(t)-D_{k}(t)+\frac{A}{2 }u^{2}(t)+\frac{B}{2}v^{2}(t)+\frac{G}{2}w^{2}(t)\) is clearly convex on U

    It rest to show that there exists constants \(\zeta _{1},\zeta _{2},\zeta _{3},\zeta _{4}>0,\) and \(\zeta \)such that \(C_{k}(t)-D_{k}(t)+\frac{A}{2} u^{2}(t)+\frac{B}{2}v^{2}(t)+\frac{G}{2}w^{2}(t)\) satisfies

    $$\begin{aligned} C_{k}(t)-D_{k}(t)+\frac{A}{2}u^{2}(t)+\frac{B}{2}v^{2}(t)+\frac{G}{2} w^{2}(t)\ge \zeta _{1}+\zeta _{2}\left| u\right| ^{\zeta }+\zeta _{3}\left| v\right| ^{\zeta }+\zeta _{4}\left| w\right| ^{\zeta }. \end{aligned}$$

    The state variables being bounded, let \(\zeta _{1}=\frac{1}{2} \inf \limits _{t\in [0,T]}\left( C_{k}(t)-D_{k}(t)\right) ,\zeta _{2}=A,~\zeta _{3}=B,~\zeta _{4}=G\) and \(\zeta =2\) then it follows that:

    $$\begin{aligned} C_{k}(t)-D_{k}(t)+\frac{A}{2}u^{2}(t)+\frac{B}{2}v^{2}(t)+\frac{G}{2} w^{2}(t)\ge \zeta _{1}+\zeta _{2}\left| u\right| ^{\zeta }+\zeta _{3}\left| v\right| ^{\zeta }+\zeta _{4}\left| w\right| ^{\zeta }. \end{aligned}$$

    Then from Fleming and Rishel [16] we conclude that there exists an optimal control.\(\square \)

4.2 Characterization of the optimal control

In order to derive the necessary condition for optimal control, the pontryagins maximum principle [13], given in was used. This principle converts into a problem of minimizing a Hamiltonian H(t) at time t defined by

$$\begin{aligned} H(t)=C_{k}(t)-D_{k}(t)+\frac{A}{2}u^{2}(t)+\frac{B}{2}v^{2}(t)+\frac{G}{2} w^{2}(t)+\sum \limits _{i=1}^{4}\lambda _{i}\left( t\right) f_{i}(P_{k},E_{k},D_{k},C_{k}) \end{aligned}$$
(15)

where \(f_{i}\) is the right side of the differential equation of the ith state variable at time t.

Theorem 10

Given the optimals controls \((u^{*},v^{*},w^{*})\) and the solutions \(P_{k}^{*},E_{k}^{*},D^{*}\) and \(C_{k}^{*}\) of the corresponding state system (12), there exists adjoint variables \(\lambda _{1}(t),\) \(\lambda _{2}(t)\), \(\lambda _{3}(t)\) and \( \lambda _{4}(t)\) satisfying:

$$\begin{aligned} \lambda _{1}^{\prime }(t)= & {} -\lambda _{1}(t)\left[ -\mu -\beta _{1}-\beta _{3} \right] -\lambda _{3}(t)\beta _{1}-\lambda _{4}(t)\beta _{3} \\ \lambda _{2}^{\prime }(t)= & {} -\lambda _{2}(t)\left[ -\mu -\gamma (1-w(t))\right] \\&-\lambda _{3}(t)\left[ \gamma (1-w(t))-\sum \limits _{j=1}^{3}\alpha _{k.j}\left( 1-v_{k.j}(t)\right) \frac{D_{k.j}(t)}{N}\right] \\&-\lambda _{4}(t)\left[ \sum \limits _{j=1}^{3}\alpha _{k.j}\left( 1-v_{k.j}(t)\right) \frac{D_{k.j}(t)}{N})\right] \\ \lambda _{3}^{\prime }(t)= & {} 1-\lambda _{3}(t)\left[ -\sum \limits _{j=1}^{3} \alpha _{k.j}\left( 1-v_{k.j}(t)\right) \frac{E_{k.j}(t)}{N}+(-\mu -\beta _{2})\right] \\&-\lambda _{4}(t)\left[ \sum \limits _{j=1}^{3}\alpha _{k.j}\left( 1-v_{k.j}(t)\right) \frac{E_{k.j}(t)}{N}+\beta _{2}\right] \\ \lambda _{4}^{\prime }(t)= & {} -1-\lambda _{3}(t)\times u(t)-\lambda _{4}(t)\times (-\mu -\gamma -u(t)) \end{aligned}$$

With the transversality conditions at time T: \(\lambda _{1}(T)=0,~\lambda _{2}(T)=0,~\lambda _{3}(T)=1\) and \(\lambda _{4}(T)=-1.\)

Furthermore, for \(t\in [0,T]\), the optimals controls \(u^{*},v^{*}\) and \(w^{*}\) are given by

$$\begin{aligned} u^{*}&=\min \left( u_{max},\max \left( u_{min},\frac{(\lambda _{4}(t)-\lambda _{3}(t)) }{A}C^{*}_{k}(t)\right) \right) \end{aligned}$$
(16)
$$\begin{aligned} v^{*}&=\min \left( v_{max},\max \left( v_{min},\frac{(\lambda _{4}(t)-\lambda _{3}(t)) }{B}\times \frac{\alpha _{k.j}D^{*}_{k.j}(t)E^{*}_{k.j}(t)}{N}\right) \right) ~,~ \text {with }j\in \left\{ 1,,3\right\} \end{aligned}$$
(17)
$$\begin{aligned} w^{*}&=\min \left( w_{max},\max \left( w_{min},\frac{(\lambda _{3}(t)-\lambda _{2}(t)) }{G}\times \gamma E^{*}_{k}(t)\right) \right) \end{aligned}$$
(18)

Proof

We use the Pontryagins maximum principle [13], for characterized the optimal controls. So, we defined the Hamiltonian H as follows:

$$\begin{aligned} H(t)= & {} C_{k}(t)-D_{k}(t)+\frac{A}{2}u^{2}(t)+\frac{B}{2}v^{2}(t)+\frac{G}{2} w^{2}(t)\\&+\,\lambda _{1}(t)\left[ I_{1}+(-\mu -\beta _{1}- \beta _{3})P_{k}(t)\right] \\&+\,\lambda _{2}(t)\left[ I_{2}-\mu E_{k}(t)-\gamma (1-w(t))E_{k}(t)\right] \\&+\,\lambda _{3}(t)\left[ \beta _{1}P_{k}(t)+\gamma (1-w(t))E_{k}(t)\right. \\&\left. -\sum \limits _{j=1}^{3}\alpha _{k.j}\left( 1-v_{k.j}(t)\right) \frac{D_{k.j}(t)E_{k.j}(t)}{N}+(-\mu -\beta _{2})D_{k}(t)+u(t)C_{k}(t)\right] \\&+\,\lambda _{4}(t)\left[ \beta _{3}P_{k}(t)+\beta _{2}D_{k}(t)\right. \\&\left. +\,\sum \limits _{j=1}^{3}\alpha _{k.j}\left( 1-v_{k.j}(t)\right) \frac{D_{k.j}(t)E_{k.j}(t)}{N}+(-\mu -\delta )C_{k}(t)-u(t)C_{k}(t)\right] \end{aligned}$$

For \(t\in [0,T]\), the adjoint equations and transversality conditions can be obtained by using Pontryagin’s maximum principle [5, 10, 11, 13, 50] such that

$$\begin{aligned} \lambda _{1}^{\prime }(t)= & {} -\frac{\partial H(t)}{\partial P_{k}(t)}=-\lambda _{1}(t)\left[ -\mu -\beta _{1}-\beta _{3}\right] -\lambda _{3}(t)\beta _{1}-\lambda _{4}(t)\beta _{3} \\ \lambda _{2}^{\prime }(t)= & {} -\frac{\partial H(t)}{\partial E_{k}(t)}=-\lambda _{2}(t)\left[ -\mu -\gamma (1-w(t))\right] \\&-\lambda _{3}(t)\left[ \gamma (1-w(t))-\sum \limits _{j=1}^{3}\alpha _{k.j}\left( 1-v_{k.j}(t)\right) \frac{D_{k.j}(t)}{N}\right] \\&-\lambda _{4}(t)\left[ \sum \limits _{j=1}^{3}\alpha _{k.j}\left( 1-v_{k.j}(t)\right) \frac{D_{k.j}(t)}{N})\right] \\ \lambda _{3}^{\prime }(t)= & {} -\frac{\partial H(t)}{\partial D_{k}(t)}=1-\lambda _{3}(t)\left[ -\sum \limits _{j=1}^{3}\alpha _{k.j}\left( 1-v_{k.j}(t)\right) \frac{E_{k.j}(t)}{N}+(-\mu -\beta _{2})\right] \\&-\lambda _{4}(t)\left[ \sum \limits _{j=1}^{3}\alpha _{k.j}\left( 1-v_{k.j}(t)\right) \frac{ E_{k.j}(t)}{N}+\beta _{2}\right] \\ \lambda _{4}^{\prime }(t)= & {} -\frac{\partial H(t)}{\partial C_{k}(t)} =-1-\lambda _{3}(t)\times u(t)-\lambda _{4}(t)\times (-\mu -\gamma -u(t)) \end{aligned}$$

For, \(t\in [0,T]\) the optimal controls u, v and w can be solved from the optimality condition

$$\begin{aligned} -\frac{\partial H(t)}{\partial u(t)}= & {} 0~\Rightarrow -Au(t)-(\lambda _{4}(t)-\lambda _{3}(t))C_{k}(t)=0 \\ -\frac{\partial H(t)}{\partial v(t)}= & {} 0\Rightarrow -Bv(t)-(\lambda _{4}(t)-\lambda _{3}(t))\alpha _{k.j}\frac{D_{k.j}(t)E_{k.j}(t)}{N}=0 \\ -\frac{\partial H(t)}{\partial w(t)}= & {} 0\Rightarrow -Gw(t)-(\lambda _{3}(t)-\lambda _{2}(t))\gamma E_{k}(t)=0 \end{aligned}$$

we have

$$\begin{aligned} u(t)= & {} \frac{(\lambda _{3}(t)-\lambda _{4}(t))}{A}C_{k}(t)\\ v(t)= & {} \frac{(\lambda _{3}(t)-\lambda _{4}(t))}{B}\times \alpha _{k.j}\frac{ D_{k.j}(t)E_{k.j}(t)}{N} \\ w(t)= & {} \frac{(\lambda _{2}(t)-\lambda _{3}(t))}{G}\times \gamma E_{k}(t) \end{aligned}$$

By the bounds in U of the controls, it is easy to obtain \(\ u^{*},v^{*}\) and \(w^{*}\) are given by (16)–(18) in the form of system. \(\square \)

5 Numerical simulation

In this section, we investigate and compare numerical results of the following control strategies when applied for reducing the the negative effect of lifestyle on diabetics and miminizing the number complicated diabetics. Te strategies are

(i) Strategy 1: treatment with education and awareness program.

(ii) Strategy 2: the awareness program through media and education, by raising awareness of the seriousness of the negative impact of behavioral factors on diabetics without complication.

As explained in [51,52,53,54], the adjoint system is solved by using the backward in time finite-difference method with terminal conditions \(\lambda _{k}(T)=0\), where \(T=120\) months and initial conditions \(P(0)=6{,}660{,}000,~D(0)=10{,}200{,}000,E(0)=10{,}000{,}000,~C(0)=5{,}500{,}000\). The controls uv and w are considered to be bounded and the weights in the objective functional are estimated to be \(A=100\), \(B=100~\)and \(G=100.\). With initial value of controls and the initial condition \(X(0)=X^{0}\), the state solutions system is solved forward in time using the finite-difference method of order four. The update of the controls is done using a convex combination of the current and previous controls to obtain the new solution for X and \(\lambda \). The method continues by using these new updates aiming at finding a fixed point \((X,\lambda ,u')\) that \(u'=(u,v,w)\). This iterative process terminates when the last and preceding iterations are negligible close and the last iteration is the solution of the optimal problem. The parameter values in the state system and the objective function are obtained from different literatures and others are estimated depending on the dynamic of diabetic population as shown in Table 1. In this paper all plots for state variables are in the logarithmic form.

Different simulations can be performed using different parameter values in Table 1 taken from [5]:

Table 1 Parameter values used in numerical simulation

5.1 Senario without multi-age

5.1.1 Doing-nothing strategy

Proceeding from Fig. 3, Table 2 gave the evolution of the number of diabetics without and with complications without control after 120 months.

Fig. 3
figure 3

Evolution of the number of diabetics with and with complications without controls

Table 2 Evolution of the number of diabetics after 120 months

We note in Fig. 3 and Tables 2 and 1 that the number of diabetics without complications decreased from \(10.2\times 10^{6}\) to \( 4.83\times 10^{6}\) and that the number of diabetics with complications increased from 5.5\(\times 10^{6}\) to \(14.03\times 10^{7}\). These changes occured due to several reasons, including the sudden development of diabetes, lack of taking the necessary and appropriate precautions to reduce the disease, in addition to the effect of the behavioral factors of improper eating and unorganized diet and also due to family and work problems.

5.1.2 Optimal control strategy

Proceeding from Fig. 4, Table 3 gave the evolution of the number of diabetics without and with complications with control after 120 months.

Fig. 4
figure 4

Evolution of the number of diabetics with and without complications with controls

Table 3 Evolution of the number of diabetics after 120 months

Based on Fig. 4 and Table 3, we notice an increase in the rate of diabetics without complications from \(10.2\times 10^{6}\) to \(10.9\times 10^{6}\). The number of diabetics with complication increased from 5.5\(\times 10^{6}\) to \(7.24\times 10^{6} \), and also increase of rate E from \(10^{6}\) to \(10.9\times 10^{6}\) And by following the medical advice (as ACE inhibitors, acetaminophen, aspirin or ibuprofen [49]) and the psychological follow-up of diabetics, as happened in many awareness campaigns mediated by the behavior factors of diabetics to avoid the mentioned problems, whether family or private work as possible.

5.2 Scenario with multi-category of age

5.2.1 Doing-nothing strategy

Proceeding from Fig. 5, Table 4 gave the evolution of the number of diabetics with multi age without control after 120 months.

Fig. 5
figure 5

Evolution the rate of diabetics with and without complications without controls with effect of multi-ages

Table 4 Evolution of the number of diabetics with multi age after 120 months without controls

We noted from Fig. 5 and Table 4, we wanted to highlight the behavioral factors effecting diabetics when they are with both same and different age groups, so that we can notice the negative impact of these groups which led to a significant decrease in the number of diabetics without complications and at the same time an significant increase in the number of diabetics with complications, and this decrease can be interpreted by the fact that these groups do not take into account the dangers that diabetics can be exposed to by means of their ignorance of the aftermaths that their careless behaviors may have on diabetics.

5.2.2 Optimal control strategy

Proceeding from Fig. 6, Table 5 gave the evolution of the number of diabetics with multi age without control after 120 months.

Fig. 6
figure 6

Evolution of the number of diabetics with and without complications with controls with ages groups effect

Table 5 Evolution of the number of diabetics with multi age after 120 months with controls

In Fig. 6 and Table 5, compared to Fig. 4, we observe a slight decrease in the number of diabetics with complications and a noticeable rise in the number of diabetics without complications after making a diagnosis on the reasons leading to this dangerous development. This decrease occured due to awareness campaigns by both the state and specialized federations and NGOs, where all age groups are targeted and sensitized about the risks of the negative impact of the socio-environmental factors on diabetics according to their age. Those campaigns introduced the risks and complications of this disease so as to reduce the development of the disease from dangerous levels that are difficult to control, through a healthy diet, and keeping people as far away as possible from family and work problems as mentioned previously in Fig. 4.

Remark 1

We can also merge multiple assemblies as (u(t), v(t)) and  (u(t), v(t), w(t))  thus get a variety of results.

6 Conclusion

In this work, we studied a discrete age continuous mathematical model that describes the dynamics of diabetics population. We highlighted the negative impact of the people’s lifestyle and the socio-environmental where diabetics get influenced badly by non-diabetics. This negative impact has a direct consequence on the health of diabetics without complications which eventually leads to a rise in the forms of complications. The seriousness of complications can lead directly to death. We also divided diabetes patients into two categories: the first got the disease due to genetic factors and the second due to the negative impact of lifestyle. We have also divided the age groups into three groups; below 18 years old, between 18 and 50 years old, and over 50 years old. The goal is to find out how strong is influence of each group on the other. We have also suggested three optimal strategies to reduce the increase in the number of diabetic patients with complications and to reduce the negative impact of lifestyle on diabetic patients. We presented a new application of the theory of optimal control to reduce the impact of social and economic behavior of age groups on the health of diabetics through systematic differential equations, awareness campaigns as well as psychological treatment and follow-up. We applied the results of the control theory and we managed to obtain the characterizations of the optimal controls. The numerical simulation of the obtained results showed the effectiveness of the proposed control strategies.