Patent Publication Number: US-2021162127-A1

Title: Adaptive zone model predictive control with a glucose and velocity dependent dynamic cost function for an artificial pancreas

Description:
CROSS REFERENCE TO RELATED APPLICATION 
     This application is an International Application which claims the benefit under 35 U.S.C. § 119(e) to U.S. Provisional Application No. 62/686,931, filed on Jun. 19, 2018, the contents of that application are hereby incorporated by reference in their entirety. 
    
    
     STATEMENT REGARDING FEDERALLY SPONSORED RESEARCH 
     This invention was made with government support under NIH Grant Nos. UC4DK108483 and DP3DK104057 awarded by the National Institutes of Health (NIH). The government has certain rights in the invention. 
    
    
     FIELD 
     The present invention is directed to glucose control systems. More specifically, the present invention is directed towards glucose monitoring (CGM) sensors and continuous subcutaneous insulin infusion systems. 
     BACKGROUND 
     Diabetes is a metabolic disorder that afflicts tens of millions of people throughout the world. Diabetes results from the inability of the body to properly utilize and metabolize carbohydrates, particularly glucose. Normally, the finely-tuned balance between glucose in the blood and glucose in bodily tissue cells is maintained by insulin, a hormone produced by the pancreas which controls, among other things, the transfer of glucose from blood into body tissue cells. Upsetting this balance causes many complications and pathologies including heart disease, coronary and peripheral artery sclerosis, peripheral neuropathies, retinal damage, cataracts, hypertension, coma, and death from hypoglycemic shock. 
     In patients with insulin-dependent diabetes, the symptoms of the disease can be controlled by administering additional insulin (or other agents that have similar effects) by injection or by external or implantable insulin pumps. The “correct” insulin dosage is a function of the level of glucose in the blood. Ideally, insulin administration should be continuously readjusted in response to changes in blood glucose level. In diabetes management, “insulin” instructs the body&#39;s cells to take in glucose from the blood. “Glucagon” acts opposite to insulin, and causes the liver to release glucose into the blood stream. The “basal rate” is the rate of continuous supply of insulin provided by an insulin delivery device (pump). The “bolus” is the specific amount of insulin that is given to raise blood concentration of the insulin to an effective level when needed (as opposed to continuous). 
     Presently, systems are available for continuously monitoring blood glucose levels by implanting a glucose sensitive probe into the patient. Such probes measure various properties of blood or other tissues, including optical absorption, electrochemical potential, and enzymatic products. The output of such sensors can be communicated to a hand held device that is used to calculate an appropriate dosage of insulin to be delivered into the blood stream in view of several factors, such as a patient&#39;s present glucose level, insulin usage rate, carbohydrates consumed or to be consumed, and exercise, among others. These calculations can then be used to control a pump that delivers the insulin, either at a controlled basal rate, or as a bolus. When provided as an integrated system, the continuous glucose monitor, controller, and pump work together to provide continuous glucose monitoring and insulin pump control. 
     Such systems at present require intervention by a patient to calculate and control the amount of insulin to be delivered. However, there may be periods when the patient is not able to adjust insulin delivery. For example, when the patient is sleeping, he or she cannot intervene in the delivery of insulin, yet control of a patient&#39;s glucose level is still necessary. A system capable of integrating and automating the functions of glucose monitoring and controlled insulin delivery would be useful in assisting patients in maintaining their glucose levels, especially during periods of the day when they are unable to intervene. A closed-loop system, also called the “artificial pancreas (AP), consists of three components: a glucose monitoring device such as a continuous glucose monitor (“CGM”) that measures subcutaneous glucose concentration (“SC”); a titrating algorithm to compute the amount of analyte such as insulin and/or glucagon to be delivered; and one or more analyte pumps to deliver computed analyte doses subcutaneously. 
     In some known zone model predictive control (MPC) approaches to regulating glucose, the MPC penalizes the distance of predicted glucose states from a carefully designed safe zone based on clinical requirements. This helps avoid unnecessary control moves that reduce the risk of hypoglycemia. The zone MPC approach was originally developed based on an auto-regressive model with exogenous inputs, and was extended to consider a control-relevant state-space model and a diurnal periodic target zone. Specifically, an asymmetric cost function was utilized in the zone MPC to facilitate independent design for hyperglycemia and hypoglycemia. 
     Throughout the development and adaptation of the MPC approaches, different controller adaptation methods have been utilized for AP design. Earlier studies considered basal rate and meal bolus adaptation by using run-to-run approaches based on sparse blood glucose (BG) measurements. The availability of CGM further provided the opportunity of designing adaptive AP utilizing advanced feedback controllers. For instance, a nonlinear adaptive MPC has been proposed to maintain normoglycemia during fasting conditions using Bayesian model parameter estimation. In other examples, a generalized predictive control (GPC) approach that adopted a recursively updated subject model has been employed on a bi-hormone AP; this approach has also been explored to eliminate the need of meal or exercise announcements. 
     A model predictive iterative learning control approach has also been proposed to adapt controller behavior with patient&#39;s day-to-day lifestyle. In some approaches, a multiple model probabilistic predictive controller was developed to achieve improved meal detection and prediction. A dynamic insulin-on-board approach has also been proposed to compensate for the effect of diurnal insulin sensitivity variation. A switched linear parameter-varying approach was developed to adjust controller modes for hypoglycemia, hyperglycemia and euglycemia situations. A run-to-run approach was developed to adapt the basal insulin delivery rate and carbohydrate-to-insulin ratio by considering intra- and inter-day insulin sensitivity variability. 
     A major drawback in the proposed AP designs is the difficulty in achieving satisfactory blood glucose regulation in terms of hyperglycemia and hypoglycemia prevention through designing smart control algorithms. 
     SUMMARY 
     A system for the delivery of insulin to a patient is provided. The system includes a glucose sensor configured to provide a sensor glucose measurement signal representative of a real time glucose concentration. The system also includes an insulin delivery device configured to deliver insulin to a patient in response to control signals. The system also includes a controller programmed to receive the sensor glucose measurement signal from the glucose sensor. The sensor glucose measurement signal received indicates a concentration of the real time glucose concentration in a bloodstream. The controller is further configured to enact an impeding glycemia protocol based on a zone model predictive control (MPC) algorithm in response to the real time glucose concentration. The impeding glycemia protocol includes determining a relationship between predicted glucose concentrations, a rate of change of the predicted glucose concentrations, and a set of control parameters that determine insulin doses above and below a patient-specific basal rate. The relationship is designed offline without requiring online insulin or glucose data. 
     The controller is further configured to adapt the set of control parameters using the relationship determined. The controller is further configured to determine a dosage of glucose altering substance to administer, using the zone MPC algorithm with the control parameters, in real time. The controller is further configured to send a command to the insulin delivery device to administer the dosage of the glucose altering substance. 
     In some embodiments, the controller is further configured to decrease an insulin infusion increase rate in response to an increase of glucose state prediction when it is above a normal value, and decrease the insulin infusion increase rate in response to a decrease of glucose state prediction when the glucose state prediction is below the normal value. The controller is also configured to decrease the insulin infusion increase rate with the decrease of an absolute value of glucose velocity. 
     In some embodiments, the normal value is 110 mg/dL. The controller can also be configured to decrease insulin infusion to avoid hypoglycemia and decrease an insulin infusion increase rate in response to an increase of an absolute value of the glucose velocity. In other embodiments, the controller is further configured to process the data received at the glucose sensor to determine a set of real time glucose concentrations using a state observer to reduce the effect of noise on when measuring the real time glucose concentration. The set of real-time blood glucose measurements can be periodically determined by the glucose sensor. 
     In some embodiments, the set of parameters include control input penalties. The control input penalties can include separate sets of control input penalties for hyperglycemia and oglycemia. 
     In some embodiments, the glucose altering substance comprises at least one of insulin, pramlintide, or glucagon. 
     A method for providing closed loop adaptive glucose controller is also provided. The method includes receiving data from at least one glucose sensor, wherein the data received indicates a concentration of glucose in a bloodstream. The method also includes processing the data received to determine a real time glucose concentration and enacting an impeding glycemia protocol based on a zone model predictive control (MPC) algorithm in response to real time glucose concentration. The impeding glycemia protocol includes determining a relationship between predicted glucose concentrations, a rate of change of the predicted glucose concentrations, and a set of control parameters that determine insulin doses above and below a patient-specific basal rate. The method also includes adapting the set of control parameters using the relationships determined and determining a dosage of glucose altering substance to administer using the zone MPC algorithm with the control parameters in real time. The method also includes sending a command to a pump to administer the dosage of the glucose altering substance. 
     In some embodiments, the data is processed by a state observer to reduce noise on glucose concentration. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       The accompanying drawings, which are incorporated in and constitute a part of this specification, exemplify the embodiments of the present invention and, together with the description, serve to explain and illustrate principles of the invention. The drawings are intended to illustrate major features of the exemplary embodiments in a diagrammatic manner. The drawings are not intended to depict every feature of actual embodiments nor relative dimensions of the depicted elements, and are not drawn to scale. 
         FIG. 1A  illustrates a block diagram of a closed-loop insulin infusion system using a model predictive controller, in accordance with an embodiment of the disclosure; 
         FIG. 1B  illustrates a block diagram of a closed-loop insulin infusion system using a glucose measurement error model, in accordance with an embodiment of the disclosure; 
         FIG. 2  is a graphical illustration of the parameters θ +  and θ −  that impact the infusion rate of insulin, in accordance with an embodiment of the present embodiment; 
         FIG. 3  is a graphical illustration of a proposed adaptive method with the original zone-MPC developed for announced meals, in accordance with the present embodiment; 
         FIG. 4  is a graphical comparison between the proposed adaptive method with the original zone-MPC developed for unannounced meals, in accordance with an embodiment of the present embodiment; 
         FIG. 5  is a graphical illustration of the adaption of the parameters that control infusion of insulin based on the glucose concentration, in accordance with an embodiment of the present embodiment; and 
         FIG. 6  illustrates a process for providing a closed loop adaptive glucose controller, in accordance with an embodiment of the present disclosure. 
     
    
    
     In the drawings, the same reference numbers and any acronyms identify elements or acts with the same or similar structure or functionality for ease of understanding and convenience. To easily identify the discussion of any particular element or act, the most significant digit or digits in a reference number refer to the Figure number in which that element is first introduced. 
     DETAILED DESCRIPTION 
     The present invention is described with reference to the attached figures, where like reference numerals are used throughout the figures to designate similar or equivalent elements. The figures are not drawn to scale, and they are provided merely to illustrate an instant embodiment. Several embodiments are described below with reference to example applications for illustration. It should be understood that numerous specific details, relationships, and methods are set forth to provide a full understanding of the disclosure. One having ordinary skill in the relevant art, however, will readily recognize that the disclosed embodiments can be practiced without one or more of the specific details, or with other methods. In other instances, well-known structures or operations are not shown in detail to avoid obscuring the disclosure. The present disclosure is not limited by the illustrated ordering of acts or events, as some acts may occur in different orders and/or concurrently with other acts or events. Furthermore, not all illustrated acts or events are required to implement a methodology in accordance with the present disclosure. 
       FIG. 1A  a basic block diagram of a closed-loop system  20  for continuous glucose monitoring and for continuous subcutaneous insulin infusion using a model predictive controller  26 . The patient receives exogenous inputs, such as meals. The patient&#39;s glucose is measured  24 , evaluated by the model predictive controller (MPC) and is used by the MPC to control a delivery device, such as a pump  28 , to deliver medication to the patient to control blood glucose. 
     Referring now to  FIG. 1B , a control algorithm is used based on the model predictive control (“MPC”) paradigm to deliver insulin in a closed-loop fashion. Interstitial glucose measurement occurs and every five minutes, simulated real-time sensor glucose (“SG”)  24  was fed into the MPC controller  26 , which calculated subcutaneous glucose concentration (“SC”) insulin infusion for the insulin pump  28 . A dose calculator  45  is included in this embodiment. The MPC controller  26  adopts a compartment model of incorporating dynamic control penalty adaptation in the zone MPC cost function and a constant prediction model. The SC insulin infusion can include insulin, pramlintide, or glucagon. 
     The MPC controller  26  adopts this compartment model by exploiting the dynamic relationship between insulin infusion and the predicted state and trend of blood glucose concentration. This approach is motivated by known multi-zone MPC designs. However, unlike the known multi-zone MPC designs, the present disclosure considers a continuous dependence of the control penalty parameters on both predicted values and trends of blood glucose. Specifically, an adaptive MPC cost function is proposed based on the values and change rates of glucose predictions. Moreover, explicit maps are constructed from the glucose prediction and its change rate to the input penalty parameters in the cost function. In addition, improved in silico results are obtained by the proposed adaptive method compared with the original zone MPC, in terms of mean glucose level and percentage time in the safe range, without increasing the risk of hypoglycemia. 
     A. Zone MPC 
     A periodic zone MPC algorithm with velocity-weighting and velocity-penalty for artificial pancreas has been developed to achieve safe and satisfactory closed-loop blood glucose regulation for patients with type  1  diabetes mellitus (“T1DM”). The algorithm is performed every 5 minutes driven by glucose measurements. At a controller update time instant i, the control law of the zone MPC with velocity-weighting and velocity-penalty is obtained by solving the following con-strained optimization problem: 
     
       
         
           
             
               
                 
                   
                     u 
                     
                       
                         0 
                          
                         
                           : 
                         
                          
                         
                           N 
                           u 
                         
                       
                       - 
                       1 
                     
                     * 
                   
                    
                   
                       
                   
                    
                   
                     := 
                   
                    
                   
                       
                   
                    
                   arg 
                    
                   
                       
                   
                    
                   
                     
                       min 
                       
                         u 
                         
                           
                             0 
                              
                             
                               : 
                             
                              
                             
                               N 
                               u 
                             
                           
                           - 
                           1 
                         
                       
                     
                      
                     
                       J 
                        
                       
                         ( 
                         
                           
                             x 
                             i 
                           
                           , 
                           
                             u 
                             
                               
                                 0 
                                  
                                 
                                   : 
                                 
                                  
                                 
                                   N 
                                   u 
                                 
                               
                               - 
                               1 
                             
                           
                         
                         ) 
                       
                     
                   
                 
               
               
                 
                   ( 
                   1 
                   ) 
                 
               
             
           
         
       
     
     with cost function 
         J (˜,·)Σ k=1   N     p   ( ž   k   2   +Q ( v   k ) {circumflex over (z)}   k   2   +{circumflex over (D)}{circumflex over (v)}   k   2 )+Σ k=1   N     u     −1 ( {circumflex over (R)}û   k   2   +Ř{hacek over (u)}   k   2 )  (2)
 
     subject to constraints 
     
       
         
           
             
               
                 
                   
                     x 
                     0 
                   
                   = 
                   
                     x 
                     i 
                   
                 
               
               
                 
                   ( 
                   
                     3 
                      
                     a 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         
                           x 
                           
                             k 
                             + 
                             1 
                           
                         
                         = 
                         
                           
                             Ax 
                             k 
                           
                           + 
                           
                             Bu 
                             k 
                           
                         
                       
                     
                     
                       
                         ∀ 
                         
                           k 
                            
                           
                             ∈ 
                             
                               0 
                               : 
                               
                                 Np 
                                 - 
                                 1 
                               
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     3 
                      
                     b 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         
                           y 
                           k 
                         
                         = 
                         
                           
                             C 
                             y 
                           
                            
                           
                             x 
                             k 
                           
                         
                       
                     
                     
                       
                         ∀ 
                         
                           k 
                           ∈ 
                           
                             ℤ 
                             
                               0 
                               : 
                               Np 
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     3 
                      
                     c 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         
                           v 
                           k 
                         
                         = 
                         
                           
                             C 
                             v 
                           
                            
                           
                             x 
                             k 
                           
                         
                       
                     
                     
                       
                         ∀ 
                         
                           k 
                           ∈ 
                           
                             ℤ 
                             
                               0 
                               : 
                               Np 
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     3 
                      
                     d 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         
                           u 
                           k 
                         
                         ≤ 
                         
                           
                             ζ 
                             ^ 
                           
                           
                             i 
                             + 
                             k 
                           
                         
                       
                     
                     
                       
                         ∀ 
                         
                           k 
                           ∈ 
                           
                             ℤ 
                             
                               0 
                               : 
                               
                                 Nu 
                                 - 
                                 1 
                               
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     3 
                      
                     e 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         
                           u 
                           k 
                         
                         ≥ 
                         
                           
                             ζ 
                             ⋁ 
                           
                           
                             i 
                             + 
                             k 
                           
                         
                       
                     
                     
                       
                         ∀ 
                         
                           k 
                           ∈ 
                           
                             ℤ 
                             
                               0 
                               : 
                               
                                 Nu 
                                 - 
                                 1 
                               
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     3 
                      
                     f 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         
                           u 
                           k 
                         
                         = 
                         0 
                       
                     
                     
                       
                         ∀ 
                         
                           k 
                           ∈ 
                           
                             ℤ 
                             
                               Nu 
                               : 
                               
                                 Np 
                                 - 
                                 1 
                               
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     3 
                      
                     g 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         
                           z 
                           
                             k 
                             : 
                           
                         
                         := 
                         
                           Z 
                            
                           
                             ( 
                             
                               
                                 y 
                                 k 
                               
                               , 
                               
                                 i 
                                 + 
                                 k 
                               
                             
                             ) 
                           
                         
                       
                     
                     
                       
                         ∀ 
                         
                           k 
                           ∈ 
                           
                             ℤ 
                             
                               0 
                               : 
                               Np 
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     3 
                      
                     h 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         
                           
                             z 
                             ^ 
                           
                           k 
                         
                         := 
                         
                           max 
                            
                           
                             ( 
                             
                               
                                 z 
                                 k 
                               
                               , 
                               0 
                             
                             ) 
                           
                         
                       
                     
                     
                       
                         ∀ 
                         
                           k 
                           ∈ 
                           
                             ℤ 
                             
                               0 
                               : 
                               Np 
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     3 
                      
                     i 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         
                           
                             z 
                             ⋁ 
                           
                           k 
                         
                         := 
                         
                           min 
                            
                           
                             ( 
                             
                               
                                 z 
                                 k 
                               
                               , 
                               0 
                             
                             ) 
                           
                         
                       
                     
                     
                       
                         ∀ 
                         
                           k 
                           ∈ 
                           
                             ℤ 
                             
                               0 
                               : 
                               Np 
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     3 
                      
                     j 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         
                           
                             u 
                             ^ 
                           
                           k 
                         
                         := 
                         
                           max 
                            
                           
                             ( 
                             
                               
                                 u 
                                 k 
                               
                               , 
                               0 
                             
                             ) 
                           
                         
                       
                     
                     
                       
                         ∀ 
                         
                           k 
                           ∈ 
                           
                             ℤ 
                             
                               0 
                               : 
                               
                                 Nu 
                                 - 
                                 1 
                               
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     3 
                      
                     k 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         
                           
                             u 
                             ⋁ 
                           
                           k 
                         
                         := 
                         
                           min 
                            
                           
                             ( 
                             
                               
                                 z 
                                 k 
                               
                               , 
                               0 
                             
                             ) 
                           
                         
                       
                     
                     
                       
                         ∀ 
                         
                           k 
                           ∈ 
                           
                             ℤ 
                             
                               0 
                               : 
                               
                                 Nu 
                                 - 
                                 1 
                               
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     3 
                      
                     l 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         
                           
                             v 
                             ^ 
                           
                           k 
                         
                         := 
                         
                           max 
                            
                           
                             ( 
                             
                               
                                 v 
                                 k 
                               
                               , 
                               0 
                             
                             ) 
                           
                         
                       
                     
                     
                       
                         ∀ 
                         
                           k 
                           ∈ 
                           
                             ℤ 
                             
                               0 
                               : 
                               Np 
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     3 
                      
                     m 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     D 
                     ^ 
                   
                   = 
                   
                     { 
                     
                       
                         
                           
                             D 
                             &gt; 
                             0 
                           
                         
                         
                           
                             
                               
                                 if 
                                  
                                 
                                     
                                 
                                  
                                 
                                   
                                     y 
                                     ^ 
                                   
                                   0 
                                 
                               
                               + 
                               
                                 y 
                                 s 
                               
                             
                             ∈ 
                              
                           
                         
                       
                       
                         
                           0 
                         
                         
                           otherwise 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     3 
                      
                     n 
                   
                   ) 
                 
               
             
           
         
       
     
     In eq. (2), Q(v k ) denotes a velocity-dependent weighting matrix [8] satisfying 
     
       
         
           
             
               
                 
                   
                     Q 
                      
                     
                       ( 
                       v 
                       ) 
                     
                   
                   = 
                   
                     { 
                     
                       
                         
                           1 
                         
                         
                           
                             
                               if 
                                
                               
                                   
                               
                                
                               v 
                             
                             ≥ 
                             0 
                           
                         
                       
                       
                         
                           ϵ 
                         
                         
                           
                             
                               if 
                                
                               
                                   
                               
                                
                               v 
                             
                             ≤ 
                             1 
                           
                         
                       
                       
                         
                           
                             
                               1 
                               2 
                             
                              
                             
                               [ 
                               
                                 
                                   
                                     cos 
                                      
                                     v 
                                      
                                     π 
                                   
                                    
                                   
                                     ( 
                                     
                                       1 
                                       - 
                                       ϵ 
                                     
                                     ) 
                                   
                                 
                                 + 
                                 
                                   ( 
                                   
                                     1 
                                     + 
                                     ϵ 
                                   
                                   ) 
                                 
                               
                               ] 
                             
                           
                         
                         
                           otherwise 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   4 
                   ) 
                 
               
             
           
         
       
     
     Parameter Ď in (2) determines a glucose dependent cost on glucose velocity, and is defined in (3n) with  :=[140, 180] and D:=1000. The prediction horizon and control horizon satisfies N p :=9 and N u :=5, which correspond to 45 and 25 minutes, respectively, and the control input weighting parameters are set to {circumflex over (R)}:=6500 and Ř:=100, respectively. The state space model in (3b)-(3d) satisfies 
     
       
         
           
             
               A 
               := 
               
                 [ 
                 
                   
                     
                       
                         
                           p 
                           1 
                         
                         + 
                         
                           2 
                            
                           
                             p 
                             2 
                           
                         
                       
                     
                     
                       
                         
                           
                             - 
                             2 
                           
                            
                           
                             p 
                             1 
                           
                            
                           
                             p 
                             2 
                           
                         
                         - 
                         
                           p 
                           2 
                           2 
                         
                       
                     
                     
                       
                         
                           p 
                           1 
                         
                          
                         
                           p 
                           2 
                           2 
                         
                       
                     
                   
                   
                     
                       1 
                     
                     
                       0 
                     
                     
                       0 
                     
                   
                   
                     
                       0 
                     
                     
                       1 
                     
                     
                       0 
                     
                   
                 
                 ] 
               
             
             , 
             
               
 
             
              
             
               B 
               := 
               
                 
                   
                     
                       1800 
                        
                       
                           
                       
                        
                       K 
                     
                     
                       u 
                       TDI 
                     
                   
                    
                   
                     [ 
                     
                       
                         
                           1 
                         
                         
                           0 
                         
                         
                           0 
                         
                       
                     
                     ] 
                   
                 
                 • 
               
             
             , 
             
               
 
             
              
             
               
                 C 
                 y 
               
               := 
               
                 [ 
                 
                   
                     
                       0 
                     
                     
                       0 
                     
                     
                       1 
                     
                   
                 
                 ] 
               
             
             , 
             
               
 
             
              
             
               
                 C 
                 v 
               
               := 
               
                 [ 
                 
                   
                     
                       0.1 
                     
                     
                       0 
                     
                     
                       
                         - 
                         0.1 
                       
                     
                   
                 
                 ] 
               
             
             , 
             
               
 
             
              
             
               K 
               := 
               
                 90 
                  
                 
                   ( 
                   
                     
                       p 
                       1 
                     
                     - 
                     1 
                   
                   ) 
                 
                  
                 
                   
                     ( 
                     
                       
                         p 
                         2 
                       
                       - 
                       1 
                     
                     ) 
                   
                   2 
                 
               
             
             , 
             
               
                 p 
                 1 
               
               := 
               0.98 
             
             , 
             
               
                 p 
                 2 
               
               := 
               
                 0.96 
                  
                 
                   5 
                   . 
                 
               
             
           
         
       
     
     Here u TDI  denotes the subject-specific total daily insulin; {circumflex over (ζ)} i+k  and {hacek over (ζ)} i+k  in (3e)-(3f) denote the upper and lower bounds on the control input u k . In eq. (3h), the function Z (y, i) is defined as 
         Z ( Y,I ): {α 2   |Y −α∈[{circumflex over (ζ)} I ,{hacek over (ζ)} I ]},
 
     where [{circumflex over (ζ)} I ,{hacek over (ζ)} I ] represents the diurnal glucose target zone. In particular, we note that u k  in the MPC optimization problem denotes the relative correction of insulin infusion u abs,k  from the basal rate u basal , namely, u k :=u abs,k −u basal . As the amount of insulin infusion is non-negative, it holds that {hacek over (ζ)} i+k ≥u basal  and u k ≥−u basal . By definition, û k , and {hacek over (u)} k  indicate delivery rates above and below basal rate, respectively, and thus control input weighting parameters R and R separately penalize the costs of delivering insulin bolus above and below insulin. As short periods of time in hypoglycemia can lead to severe health risks such as seizures, coma and even death, the values of {circumflex over (R)} and Ř are chosen to satisfy {circumflex over (R)}&lt;&lt;Ř to ensure safety and encourage prompt pump suspension when providing less insulin does not cause severe hyperglycemia but does reduce the risk of hypoglycemia. 
     B. Adaptive Zone MPC Design 
     A few key parameters of the MPC algorithm (e.g., the prediction horizon N p , the control horizon N u  and the control input penalties {circumflex over (R)} and Ř) were set to constant. The present application demonstrates that improved performance can be obtained by further adapting some of these parameters. Since the choice of the prediction and control horizons depend on 1) the amount of model mismatch between the state space model in (3b)-(3d) and the subject to which the controller is applied and 2) the amount of computation resources allocated for solving the MPC optimization problem on an artificial pancreas, the design of {circumflex over (R)} and Ř parameters are the primal focus of the present disclosure. The design of {circumflex over (R)} and Ř parameters has a clear and more direct relation with the control performance—smaller values of {circumflex over (R)} and Ř correspond to more aggressive controller activity and vice versa. As a result, the present disclosure provides an efficient method of adapting the {circumflex over (R)} and Ř parameters, to achieve improved control performance in terms of percent time in safe range [70, 180a] mg/dL and average blood glucose level without increasing the risk of hypoglycemia. 
     The risk of insulin infusion on hypoglycemia varies with the state and trend of the subject&#39;s blood glucose concentration. When the glucose concentration rises above the safe range, the higher the blood glucose concentration, the more likely that a relatively large amount of insulin has been infused but has not appeared in plasma due to the delayed effect of subcutaneous insulin injection. Thus, it is more probable that the blood glucose is able to decrease to the safe range without further insulin infusion. 
     In this case, if the controller maintains the same degree of responsiveness, the delayed insulin effect would culminate in controller-induced hypoglycemia. The present disclosure addresses dynamically adjusting MPC weighing parameters, in tandem with IOB constraints to ensure enhanced safety. On the other hand, given the same glucose concentration but with a correctly-predicted rapidly increasing (rather than decreasing or almost stationary) trend, it is comparably safer to further infuse a cautiously-designed amount of insulin based on the predicted glucose trend, which indicates additional insulin is needed to regulate the excessive glucose. Based on these considerations, the values of {circumflex over (R)} and Ř should be adjusted in accordance with both the glucose state prediction y k  [obtained via (3b)-(3b)] and glucose velocity 
       μ k   :=y   k   −y   k−1   (5)
 
     to achieve improved glucose regulation. {circumflex over (R)}- and Ř-surfaces are designed along continuum values of glucose prediction y k  and velocity μ k . As a result, the MPC cost function switches from its original form in (2) to 
         J (⋅,⋅)=Σ k=1   N     p   ( ž   k   2   +Q ( v   k ) {circumflex over (z)}   k   2   +{circumflex over (D)}{circumflex over (v)}   k   2 )+Σ k=1   N     u     −1 ( {circumflex over (R)} (μ k   ,y   k ) û   k   2   +Ř (μ k   ,y   k ) {hacek over (u)}   k   2 )  (6)
 
     C. Design of {circumflex over (R)} (μ k , y k ) 
     From the definition of û k  in (3k), {circumflex over (R)}(μ k ,y k ) in (6) controls insulin infusion above the basal rate and is usually in effect when y k &gt;80. Due to the asymmetry of the blood glucose profile, however, it determines both glucose regulation performance and hypoglycemia risk and therefore is the major focus of parameter adaptation. To separately consider the scenarios of ascending and descending glucose sequences, {circumflex over (R)}(μ k ,y k ) is parameterized according to the sign of predicted glucose velocity μ k : 
     
       
         
           
             
               
                 
                   
                     
                       R 
                       ^ 
                     
                      
                     
                       ( 
                       
                         
                           μ 
                           k 
                         
                         , 
                         
                           y 
                           k 
                         
                       
                       ) 
                     
                   
                   := 
                   
                     { 
                     
                       
                         
                           
                             
                               
                                 R 
                                 ^ 
                               
                               + 
                             
                              
                             
                               ( 
                               
                                 
                                   μ 
                                   k 
                                 
                                 , 
                                 
                                   y 
                                   k 
                                 
                                 , 
                                 
                                   θ 
                                   + 
                                 
                               
                               ) 
                             
                           
                         
                         
                           
                             
                               
                                 if 
                                  
                                 
                                     
                                 
                                  
                                 
                                   μ 
                                   k 
                                 
                               
                               ≥ 
                               0 
                             
                             , 
                           
                         
                       
                       
                         
                           
                             
                               
                                 R 
                                 ^ 
                               
                               - 
                             
                              
                             
                               ( 
                               
                                 
                                   μ 
                                   k 
                                 
                                 , 
                                 
                                   y 
                                   k 
                                 
                                 , 
                                 
                                   θ 
                                   - 
                                 
                               
                               ) 
                             
                           
                         
                         
                           
                             
                               
                                 if 
                                  
                                 
                                     
                                 
                                  
                                 
                                   μ 
                                   k 
                                 
                               
                               &lt; 
                               0 
                             
                             , 
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   7 
                   ) 
                 
               
             
           
         
       
     
     where θ +  and θ −  are two vector-valued parameters that determine the relationship of {circumflex over (R)} +  and {circumflex over (R)} −  with μ k  and y k , respectively. In this work, {circumflex over (R)} + (μ k , y k , θ + ) and {circumflex over (R)} − (μ k , y k , θ − ) are designed by using an identical approach, but are parameterized with different parameters θ +  and θ −  due to their different roles in glucose regulation. Concretely, the principles of designing {circumflex over (R)} + (μ k , y k , θ + ) are to ensure that
     A1) given the same (positive) glucose velocity prediction, the responsiveness of the controller (in terms of in-creasing insulin infusion rate) should decrease with the increase of glucose state prediction when it is above its normal value (say, 110 mg/dL), and decrease with the decrease of glucose state prediction when it is below its normal value; and   A2) given the same glucose state prediction, the responsiveness of the controller should decrease with the decrease of the absolute value of glucose velocity.   

     On the other hand, the principles for {circumflex over (R)} − (μ k , y k , θ − ) design include
     B1) given a negative glucose velocity prediction, the controller should decrease insulin infusion to avoid hypoglycemia, and should be even more cautious when the corresponding glucose predictions are low or extremely high;   B2) given the same glucose prediction, the responsiveness of the controller should decrease with the increase of the absolute value of the glucose velocity.   

     These principles reflect the clinical safety requirements in blood glucose regulation, while still providing an opportunity to enhance control performance by exploiting glucose state and velocity dependent controller adaptation. To implement these principles, the present disclosure provides a two-step design approach:
     S1) build bowl-shaped y k -dependent upper and lower bounds for {circumflex over (R)} + (μ k , y k , θ + ) and {circumflex over (R)} − (μ k , y k , θ − ) by considering the two limiting cases μ k =0 and μ k →∞, respectively, so that items A1 and B1 in the design principles can be ensured;   S2) vary the values of these functions monotonically between the upper and lower bounds for different values of μ k , to accommodate principles A2 and B2.   

     Specifically, the upper and lower bounds    + (y k , θ + ) and    + (y k , θ + ) for {circumflex over (R)} + (μ k , y k , θ − ) are proposed as 
     
       
         
           
             
               
                 
                   
                     
                       
                         ℜ 
                         _ 
                       
                       + 
                     
                      
                     
                       ( 
                       
                         
                           y 
                           k 
                         
                         . 
                         
                           θ 
                           + 
                         
                       
                       ) 
                     
                   
                   := 
                   
                     { 
                     
                       
                         
                           
                             min 
                              
                             
                               { 
                               
                                 
                                   δ 
                                   H 
                                   + 
                                 
                                 , 
                                 
                                   
                                     exp 
                                      
                                     
                                       [ 
                                       
                                         
                                           [ 
                                           
                                             
                                               a 
                                               
                                                 1 
                                                  
                                                 H 
                                               
                                               + 
                                             
                                              
                                             
                                               ( 
                                               
                                                 
                                                   y 
                                                   k 
                                                 
                                                 - 
                                                 
                                                   η 
                                                   + 
                                                 
                                               
                                               ) 
                                             
                                           
                                           ] 
                                         
                                         
                                           α 
                                           H 
                                           + 
                                         
                                       
                                       ] 
                                     
                                   
                                   + 
                                   
                                     b 
                                     
                                       1 
                                        
                                       H 
                                     
                                     + 
                                   
                                 
                               
                               } 
                             
                           
                         
                         
                           
                             
                               
                                 if 
                                  
                                 
                                     
                                 
                                  
                                 
                                   y 
                                   k 
                                 
                               
                               ≥ 
                               
                                 η 
                                 + 
                               
                             
                             , 
                           
                         
                       
                       
                         
                           
                             min 
                              
                             
                               { 
                               
                                 
                                   δ 
                                   H 
                                   + 
                                 
                                 , 
                                 
                                   
                                     exp 
                                      
                                     
                                       [ 
                                       
                                         
                                           a 
                                           
                                             2 
                                              
                                             H 
                                           
                                           + 
                                         
                                          
                                         
                                           ( 
                                           
                                             
                                               η 
                                               + 
                                             
                                             - 
                                             
                                               y 
                                               k 
                                             
                                           
                                           ) 
                                         
                                       
                                       ] 
                                     
                                   
                                   + 
                                   
                                     b 
                                     
                                       2 
                                        
                                       H 
                                     
                                     + 
                                   
                                 
                               
                               } 
                             
                           
                         
                         
                           
                             
                               
                                 if 
                                  
                                 
                                     
                                 
                                  
                                 
                                   y 
                                   k 
                                 
                               
                               &lt; 
                               
                                 η 
                                 + 
                               
                             
                             , 
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   8 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         ℜ 
                         _ 
                       
                       + 
                     
                      
                     
                       ( 
                       
                         
                           y 
                           k 
                         
                         . 
                         
                           θ 
                           + 
                         
                       
                       ) 
                     
                   
                   := 
                   
                     { 
                     
                       
                         
                           
                             min 
                              
                             
                               { 
                               
                                 
                                   δ 
                                   L 
                                   + 
                                 
                                 , 
                                 
                                   
                                     exp 
                                      
                                     
                                       [ 
                                       
                                         
                                           [ 
                                           
                                             
                                               a 
                                               
                                                 1 
                                                  
                                                 L 
                                               
                                               + 
                                             
                                              
                                             
                                               ( 
                                               
                                                 
                                                   y 
                                                   k 
                                                 
                                                 - 
                                                 
                                                   η 
                                                   + 
                                                 
                                               
                                               ) 
                                             
                                           
                                           ] 
                                         
                                         
                                           α 
                                           L 
                                           + 
                                         
                                       
                                       ] 
                                     
                                   
                                   + 
                                   
                                     b 
                                     
                                       1 
                                        
                                       L 
                                     
                                     + 
                                   
                                 
                               
                               } 
                             
                           
                         
                         
                           
                             
                               
                                 if 
                                  
                                 
                                     
                                 
                                  
                                 
                                   y 
                                   k 
                                 
                               
                               ≥ 
                               
                                 η 
                                 + 
                               
                             
                             , 
                           
                         
                       
                       
                         
                           
                             min 
                              
                             
                               { 
                               
                                 
                                   δ 
                                   L 
                                   + 
                                 
                                 , 
                                 
                                   
                                     exp 
                                      
                                     
                                       [ 
                                       
                                         
                                           a 
                                           
                                             2 
                                              
                                             L 
                                           
                                           + 
                                         
                                          
                                         
                                           ( 
                                           
                                             
                                               η 
                                               + 
                                             
                                             - 
                                             
                                               y 
                                               k 
                                             
                                           
                                           ) 
                                         
                                       
                                       ] 
                                     
                                   
                                   + 
                                   
                                     b 
                                     
                                       2 
                                        
                                       L 
                                     
                                     + 
                                   
                                 
                               
                               } 
                             
                           
                         
                         
                           
                             
                               
                                 if 
                                  
                                 
                                     
                                 
                                  
                                 
                                   y 
                                   k 
                                 
                               
                               &lt; 
                               
                                 η 
                                 + 
                               
                             
                             , 
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   9 
                   ) 
                 
               
             
           
         
       
     
     respectively, with b 2H   + :=b 1H   + −1, b 2L   + :=b 1L   + −1 and δ H   + , a 1H   + , a 2H   + , b 1H   + , α H   + , δ L   + , a 1L   + , a 2L   + , b 1L   + , α L   +  and η +  being elements in θ + . Similarly, the upper and lower bounds    − (y k , θ − ) and    − (y k , θ − ) for {circumflex over (R)} − (μ k , y k , θ − ) are defined as 
     
       
         
           
             
               
                 
                   
                     
                       
                         ℜ 
                         _ 
                       
                       - 
                     
                      
                     
                       ( 
                       
                         
                           y 
                           k 
                         
                         . 
                         
                           θ 
                           - 
                         
                       
                       ) 
                     
                   
                   := 
                   
                     { 
                     
                       
                         
                           
                             min 
                              
                             
                               { 
                               
                                 
                                   δ 
                                   H 
                                   - 
                                 
                                 , 
                                 
                                   
                                     exp 
                                      
                                     
                                       [ 
                                       
                                         
                                           [ 
                                           
                                             
                                               a 
                                               
                                                 1 
                                                  
                                                 H 
                                               
                                               - 
                                             
                                              
                                             
                                               ( 
                                               
                                                 
                                                   y 
                                                   k 
                                                 
                                                 - 
                                                 
                                                   η 
                                                   - 
                                                 
                                               
                                               ) 
                                             
                                           
                                           ] 
                                         
                                         
                                           α 
                                           H 
                                           - 
                                         
                                       
                                       ] 
                                     
                                   
                                   + 
                                   
                                     b 
                                     
                                       1 
                                        
                                       H 
                                     
                                     - 
                                   
                                 
                               
                               } 
                             
                           
                         
                         
                           
                             
                               
                                 if 
                                  
                                 
                                     
                                 
                                  
                                 
                                   y 
                                   k 
                                 
                               
                               ≥ 
                               
                                 η 
                                 - 
                               
                             
                             , 
                           
                         
                       
                       
                         
                           
                             min 
                              
                             
                               { 
                               
                                 
                                   δ 
                                   H 
                                   - 
                                 
                                 , 
                                 
                                   
                                     exp 
                                      
                                     
                                       [ 
                                       
                                         
                                           a 
                                           
                                             2 
                                              
                                             H 
                                           
                                           - 
                                         
                                          
                                         
                                           ( 
                                           
                                             
                                               η 
                                               - 
                                             
                                             + 
                                             400 
                                             - 
                                             
                                               y 
                                               k 
                                             
                                           
                                           ) 
                                         
                                       
                                       ] 
                                     
                                   
                                   + 
                                   
                                     b 
                                     
                                       2 
                                        
                                       H 
                                     
                                     - 
                                   
                                 
                               
                               } 
                             
                           
                         
                         
                           
                             
                               
                                 if 
                                  
                                 
                                     
                                 
                                  
                                 
                                   y 
                                   k 
                                 
                               
                               &lt; 
                               
                                 η 
                                 - 
                               
                             
                             , 
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   10 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         ℜ 
                         _ 
                       
                       - 
                     
                      
                     
                       ( 
                       
                         
                           y 
                           k 
                         
                         . 
                         
                           θ 
                           - 
                         
                       
                       ) 
                     
                   
                   := 
                   
                     { 
                     
                       
                         
                           
                             min 
                              
                             
                               { 
                               
                                 
                                   δ 
                                   L 
                                   - 
                                 
                                 , 
                                 
                                   
                                     exp 
                                      
                                     
                                       [ 
                                       
                                         
                                           [ 
                                           
                                             
                                               a 
                                               
                                                 1 
                                                  
                                                 L 
                                               
                                               - 
                                             
                                              
                                             
                                               ( 
                                               
                                                 
                                                   y 
                                                   k 
                                                 
                                                 - 
                                                 
                                                   η 
                                                   - 
                                                 
                                               
                                               ) 
                                             
                                           
                                           ] 
                                         
                                         
                                           α 
                                           L 
                                           - 
                                         
                                       
                                       ] 
                                     
                                   
                                   + 
                                   
                                     b 
                                     
                                       1 
                                        
                                       L 
                                     
                                     - 
                                   
                                 
                               
                               } 
                             
                           
                         
                         
                           
                             
                               
                                 if 
                                  
                                 
                                     
                                 
                                  
                                 
                                   y 
                                   k 
                                 
                               
                               ≥ 
                               
                                 η 
                                 - 
                               
                             
                             , 
                           
                         
                       
                       
                         
                           
                             min 
                              
                             
                               { 
                               
                                 
                                   δ 
                                   L 
                                   - 
                                 
                                 , 
                                 
                                   
                                     exp 
                                      
                                     
                                       [ 
                                       
                                         
                                           a 
                                           
                                             2 
                                              
                                             L 
                                           
                                           - 
                                         
                                          
                                         
                                           ( 
                                           
                                             
                                               η 
                                               - 
                                             
                                             + 
                                             400 
                                             - 
                                             
                                               y 
                                               k 
                                             
                                           
                                           ) 
                                         
                                       
                                       ] 
                                     
                                   
                                   + 
                                   
                                     b 
                                     
                                       2 
                                        
                                       L 
                                     
                                     - 
                                   
                                 
                               
                               } 
                             
                           
                         
                         
                           
                             
                               
                                 if 
                                  
                                 
                                     
                                 
                                  
                                 
                                   y 
                                   k 
                                 
                               
                               &lt; 
                               
                                 η 
                                 - 
                               
                             
                             , 
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   11 
                   ) 
                 
               
             
           
         
       
     
     with b 2H   − :=b 1H   − −exp(400×a 2H   − ), b 2L   − :=b 1L   − −exp(400×a 2L   − ) and δ H   − , a 1H   − , a 2H   − , b 1H   − , α H   − , δ L   − , a 1L   − , a 2L   − , b 1L   − , α L   −  and η −  being elements of θ − . This completes Step S1. 
     Based on the bounds in (8)-(11), the velocity and state dependent weighting parameters {circumflex over (R)} + (μ k , y k , θ + ) and {circumflex over (R)} − (μ k , y k , θ − ) are evaluated according to 
         {circumflex over (R)}   + (μ k   ,y   k ,θ + ):=   + ( y   k ,θ + )+exp(−τ+μ k )[   + ( y   k ,θ + )−   + ( y   k ,θ + )],  (12)
 
         {circumflex over (R)}   − (μ k   ,y   k ,θ − ):=   − ( y   k ,θ − )−exp(−τμ k )[   − ( y   k ,θ − )−   − ( y   k ,θ − )],  (13)
 
     where τ +  and τ −  are elements in θ +  and θ − , respectively. This completes Step S2. 
     Now interpretations for {circumflex over (R)} + (μ k , y k , θ + ) and {circumflex over (R)} − (μ k , y k , θ − ) are provided through explaining their parameters θ +  and θ − , which are given by 
       θ + :=[δ H   +   ,a   1H   +   ,a   2H   +   ,b   1H   + ,α H   + ,δ L   +   ,a   1L   +   ,a   2L   +   ,b   1L   + ,α L   + ,τ + ,η + ]
 
       θ − :=[δ H   −   ,a   1H   −   ,a   2H   −   ,b   1H   − ,α H   − ,δ L   −   ,a   1L   −   ,a   2L   −   ,b   1L   − ,α L   − ,τ − ,η − ]
 
     To understand the roles of different parameters, we first note that the “+” and “−” symbols in the superscripts separately indicate the cases “μ k   0” and “μ k &lt;0”, and that “H” and “L” in the subscripts represent upper bounds and lower bounds, respectively. Second, τ +  and τ − control the decay rates of {circumflex over (R)} + (μ k , y k , θ + ) and {circumflex over (R)} − (μ k , y k , θ − ) with respect to glucose velocity μ k . See (12)-(13). For the rest of the parameters, θ +  and θ −  are each composed of different parameterizations of a simpler pattern [δ,a 1 ,a 2 ,b,α,η], which defines a bowl-shaped curve Y(y) composed of two exponential functions with saturation: 
     
       
         
           
             
               
                 
                   
                     Y 
                      
                     
                       ( 
                       y 
                       ) 
                     
                   
                   := 
                   
                     { 
                     
                       
                         
                           
                             
                               min 
                                
                               
                                 { 
                                 
                                   δ 
                                   , 
                                   
                                     
                                       exp 
                                        
                                       
                                         [ 
                                         
                                           
                                             a 
                                             2 
                                           
                                            
                                           
                                             ( 
                                             
                                               η 
                                               - 
                                               y 
                                               + 
                                                
                                             
                                             ) 
                                           
                                         
                                         ] 
                                       
                                     
                                     + 
                                     
                                       [ 
                                       
                                         
                                           b 
                                           1 
                                         
                                         - 
                                         
                                           exp 
                                            
                                           
                                             ( 
                                             
                                               
                                                 a 
                                                 2 
                                               
                                                
                                                
                                             
                                             ) 
                                           
                                         
                                       
                                       ] 
                                     
                                   
                                 
                                 } 
                               
                             
                             , 
                           
                         
                         
                           
                             
                               
                                 if 
                                  
                                 
                                     
                                 
                                  
                                 y 
                               
                               ≤ 
                               η 
                             
                             , 
                           
                         
                       
                       
                         
                           
                             
                               min 
                                
                               
                                 { 
                                 
                                   δ 
                                   , 
                                   
                                     
                                       exp 
                                        
                                       
                                         [ 
                                         
                                           
                                             
                                               a 
                                               1 
                                             
                                              
                                             
                                               ( 
                                               
                                                 y 
                                                 - 
                                                 η 
                                               
                                               ) 
                                             
                                           
                                           α 
                                         
                                         ] 
                                       
                                     
                                     + 
                                     
                                       b 
                                       1 
                                     
                                   
                                 
                                 } 
                               
                             
                             , 
                           
                         
                         
                           
                             otherwise 
                             , 
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   14 
                   ) 
                 
               
             
           
         
       
     
     In particular, δ determines the maximum (saturation) value of the curve, b 1  denotes the minimum value of the curve, a 1  and α determine the “steepness” of the “right-hand side” (namely, y&gt;η) exponential function, a 2  determines the “steepness” of the “left-hand side” exponential function, and η decides the conjunction point of the two exponential functions. Note that 1=0 for (8)-(9) and 1=400 for (10)-(11). 
     Based on the above interpretations, the parameters in θ +  and θ −  are designed for improved glucose regulation performance.  FIG. 2  is a graphical illustration of the parameters θ +  and θ −  that impact the infusion rate of insulin, in accordance with an embodiment of the present embodiment. The parameters θ +  and θ −  are iteratively optimized using the 10-patient cohort of the UVA/Padova simulator with the goal of achieving improved mean glucose values without increasing the risk of hypoglycemia, following a 24-hour in silico protocol with 3 unannounced meals of [50, 75, 75] g carbohydrate (CHO) at 08:00, 12:00 and 19:00, respectively. The obtained design also goes through stress tests for scenarios of different measurement noises, basal rate mismatches, secret insulin boluses (used to simulate the effect of exercise), and over/underestimated meal boluses. The values of the obtained parameters are provided in TABLE I.  FIG. 2  illustrates the relationship of {circumflex over (R)} + (μ k , y k , θ + ) and {circumflex over (R)} − (μ k , y k , θ − ) with glucose state y k  and glucose velocity μ k . 
     D. Design of Ř(μ k , y k ) 
     From (31), {circumflex over (R)}(μ k , y k ) affects insulin infusion below the basal rate, which critically determines controller actions when the glucose concentration drifts toward or falls into the hypoglycemia region (y k &lt;70 mg/dL). The proposed approach to designing {circumflex over (R)}(μ k , y k ) equally applies to Ř(μ k , y k ). As detailed above, Ř in (2) is usually set to a small value (Ř=100) to encourage proper pump suspensions to avoid hypoglycemia. To enhance this safety concern, it suffices to consider the following simple glucose-dependent multi-zone parameter adaptation formula: 
     
       
         
           
             
               
                 
                   
                     
                       
                         R 
                         ⋁ 
                       
                        
                       
                         ( 
                         
                           y 
                           k 
                         
                         ) 
                       
                     
                     : 
                   
                   = 
                   
                     { 
                     
                       
                         
                           
                             
                               1 
                                
                               0 
                                
                               0 
                             
                             , 
                           
                         
                         
                           
                             
                               
                                 if 
                                  
                                 
                                     
                                 
                                  
                                 
                                   y 
                                   k 
                                 
                               
                               &gt; 
                               
                                 1 
                                  
                                 4 
                                  
                                 0 
                               
                             
                             , 
                           
                         
                       
                       
                         
                           
                             
                               1 
                                
                               0 
                             
                             , 
                           
                         
                         
                           
                             
                               
                                 if 
                                  
                                 
                                     
                                 
                                  
                                 
                                   y 
                                   k 
                                 
                               
                               ∈ 
                               
                                   
                               
                                
                               
                                 [ 
                                 
                                   
                                     1 
                                      
                                     2 
                                      
                                     0 
                                   
                                   , 
                                   
                                     1 
                                      
                                     4 
                                      
                                     0 
                                   
                                 
                                 ] 
                               
                             
                             , 
                           
                         
                       
                       
                         
                           
                             1 
                             , 
                           
                         
                         
                           
                             
                               if 
                                
                               
                                   
                               
                                
                               
                                 y 
                                 k 
                               
                             
                             &lt; 
                             
                               1 
                                
                               2 
                                
                               
                                 0 
                                 . 
                               
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   15 
                   ) 
                 
               
             
           
         
       
     
     Here a short-hand notation Ř(y k ) is used instead of Ř(μ k , y k ) as the effect of glucose velocity is not considered in this case. The implication is that an active pump suspension strategy is enforced when the glucose prediction is conspicuously low, regardless of the glucose velocity μ k . 
     E. Implementation 
     In terms of implementation, the proposed adaptive MPC method basically replaces the original cost function in (2) with (6), which adds to the non-convexity of the MPC optimization problem. To ensure the convergence of the optimization algorithm and speed up the computation, a heuristic technique is introduced to implement the proposed adaptive MPC based on the physiological properties of the insulin-glucose metabolic process. To aid the description, the notation {⋅} i  is used to denote a data sequence obtained by the zone MPC at controller update time instant i (e.g., {y k :k∈   0:N     u     −1 } i ). The motivating observation is that a lag of 10-30 minutes exists between the plasma insulin concentrations and the effect of insulin. As the control horizon N u  is equal to 5 and the sampling time is 5 minutes, the predictions {y k :k∈   0:N     u     −1 } i  and {μ k :k∈   0:N     u     −1 } i  are dominated by the historical glucose measurements at time instant i rather than the optimal inputs {u k *} i . In this regard, {y k :k∈   0:N     u     −1 } i  and {μ k :k∈   0:N     u     −1 } i  is estimated with {y k :k∈   1:N     u   } i−1  and {y k −y k−1 :k∈   1:N     u   } i , respectively, and {{circumflex over (R)}(μ k ,y k ):k∈   0:N     u     −1 } i  is calculated based on the obtained estimates for {y k :k∈   0:N     u     −1 } i  and {μ k :k∈   0:N     u     −1 } i . An important property of these estimates is that they can be calculated before solving the MPC optimization problem [formed by (1), (6) and (3)] at time instant i and are constant during the solution procedure of the optimization problem. 
     As illustrated herein, the glucose velocity sequence {μ k } adopted herein differs from {v k } defined according to (3d), which is typically used to quantify the velocity weighting and velocity penalties. By definition, {μ k } provides a closer approximation of the velocity sequence of the noiseless glucose prediction {y k }. Another major consideration here, however, is to avoid introducing {μ k }-induced disturbances to the convergence of the {v k }-driven sequential optimization procedure utilized to solve non-convex MPC optimization problem. In particular, during the sequential optimization procedure, the sequence {v k } is updated in each iteration until the convergence conditions are satisfied. As the estimates for {μ k } remain constant and do not change with {v k } throughout this disclosure, the adopted {μ k } sequence does not affect the convergence of the sequential optimization algorithm. 
     The safety and effectiveness of the proposed method is evaluated on the 10-patient cohort of the FDA-accepted UVA/Padova metabolic simulator through comparisons with the original zone MPC.  FIG. 3  is a graphical illustration of a proposed adaptive method with the original zone-MPC developed for announced meals, in accordance with the present embodiment.  FIG. 4  is a graphical comparison between the proposed adaptive method with the original zone-MPC developed for unannounced meals, in accordance with an embodiment of the present embodiment. As an initial parameter, a 48-hour 6-meal protocol starting from 7:00 on Day 1 is considered. On each day, breakfast (50 g CHO), lunch (75 g CHO) and dinner (75 g CHO) are consumed at 8:00, 13:00 and 17:00, respectively. Two controllers are compared, including the original zone MPC and the proposed adaptive zone MPC with parameter setting in TABLE I. The performance of each controller is evaluated according to the introduced protocol for 10 times by considering random additive CGM measurement noises using random seeds 1 through 10 (for the whole 10-patient cohort).The performance of each controller is evaluated by separately considering the scenarios with and without meal announcements. A total of 200 simulations are performed for each controller. The 5%, 25%, 50%, 75% and 95% quartile curves are presented in  FIGS. 3 and 4 . Furthermore, a comparison of the statistics is provided in Tables II-III. 
     The performance comparison of the original zone MPC with the proposed adaptive zone MPC is provided in  FIG. 3  and TABLE II below for the scenario of announced meals. Both controllers achieve satisfactory performance for hypoglycemia prevention measured by percent time &lt;70 mg/dL and percent time &lt;54 mg/dL (severe hypoglycemia). In particular, a comparison of the values of these two performance metrics indicates that the proposed approach does not introduce increased risk for hypoglycemia. In general, with meal announcements, the glucose response is dominated by meal boluses and the effect of closed-loop control on glucose regulation is restricted, particularly given that the original zone MPC already achieved good control performance for announced meals. As a result, the proposed adaptive approach only leads to a small performance improvement in terms of percent time in the euglycemic range of 70-180 mg/dL (91.2% vs. 90.9%; p&lt;0.001), and mean glucose (135.6 mg/dL vs. 136.5 mg/dL; p&lt;0.001). The proposed controller appears to have slightly increased risk of hyperglycemia (percent time &gt;250 mg/dL, 0.1% vs. 0.0%; p=0.526), but the p value indicates that this observation may not have statistical significance. 
     
       
         
           
               
             
               
                 TABLE I 
               
               
                   
               
               
                 Parameters for θ +  and θ −   
               
               
                   
               
             
            
               
                   
               
            
           
           
               
               
               
               
               
               
               
               
               
               
               
               
               
            
               
                   
                 δ +   H   
                 α 1H   +   
                 α 2H   +   
                 b 1H   +   
                 α H   +   
                 δ L   +   
                 α 1L   +   
                 α 2L   +   
                 b 1L   +   
                 α L   +   
                 τ +   
                 η +   
               
               
                   
               
               
                 Value 
                 16,500 
                 0.14 
                 0.32 
                 5500 
                 0.75 
                 15,500 
                 0.11 
                 0.20 
                 2,000 
                 0.75 
                 0.20 
                 130 
               
               
                   
               
            
           
           
               
               
               
               
               
               
               
               
               
               
               
               
               
            
               
                   
                 δ H   −   
                 α 1H   −   
                 α 2H   −   
                 b 1H   −   
                 α H   −   
                 δ L   −   
                 α 1L   −   
                 α 2L   −   
                 b 1L   −   
                 α L   −   
                 τ −   
                 η −   
               
               
                   
               
               
                 Value 
                 1,000,000 
                 0.03 
                 0.02 
                 5,000 
                 1 
                 1,000,000 
                 0.03 
                 0.02 
                 4910 
                 1 
                 0.20 
                 180 
               
               
                   
               
            
           
         
       
     
     
       
         
           
               
             
               
                 TABLE II 
               
             
            
               
                   
               
               
                 Glycemic metrics comparing the proposed method with the original zone MPC (announced meals) 
               
            
           
           
               
               
               
            
               
                   
                 Day and night 
                 Overnight (24:00-06:00 h) 
               
            
           
           
               
               
            
               
                   
                 Metric 
               
            
           
           
               
               
               
               
               
               
               
            
               
                 #Simulations = 100 
                   
                   
                   
                   
                   
                   
               
               
                 % time 
                 Original 
                 Proposed 
                 p value 
                 Original 
                 Proposed 
                 p value 
               
               
                   
               
            
           
           
               
               
               
               
               
               
               
               
               
               
               
               
            
               
                 &lt;54 
                 mg/dL 
                 0 
                 (0) 
                 0 
                 (0) 
                 — 
                 0 
                 (0) 
                 0 
                 (0) 
                 — 
               
               
                 &lt;70 
                 mg/dL 
                 0 
                 (0.2) 
                 0 
                 (0.2) 
                 0.346 
                 0 
                 (0) 
                 0 
                 (0.2) 
                 0.32  
               
               
                 70-180 
                 mg/dL 
                 90.9 
                 (6) 
                 91.2 
                 (5.8) 
                 0.04 
                 100 
                 (0.1) 
                 100 
                 (0.2) 
                 0.811 
               
               
                 &gt;250 
                 mg/dL 
                 0 
                 (0.3) 
                 0.1 
                 (0.3) 
                 0.526 
                 0 
                 (0) 
                 0 
                 (0) 
                 — 
               
            
           
           
               
               
               
               
               
               
               
               
               
               
               
            
               
                 Mean glucose (mg/dL) 
                 136.5 
                 (5.6) 
                 135.6 
                 (5.4) 
                 &lt;0.001 
                 119.4 
                 (5.2) 
                 119.1 
                 (5.1) 
                 0.011 
               
               
                 SD glucose (mg/dL) 
                 28 
                 (5.2) 
                 45.1 
                 (10.2) 
                 &lt;0.001 
                 12.9 
                 (3.1) 
                 13.4 
                 (3.4) 
                 &lt;0.001  
               
               
                 Path length 
                 3597.6 
                 (101.4) 
                 3607.1 
                 (105.9) 
                 &lt;0.001 
                 841 
                 (19.7) 
                 842.9 
                 (20.3) 
                 &lt;0.001  
               
            
           
           
               
               
               
               
               
               
               
               
               
            
               
                 Mean glucose at 07:00 h (mg/dL) 
                 121.1 
                 (8.5) 
                 119.8 
                 (8.9) 
                 &lt;0.001 
                 — 
                 — 
                 — 
               
               
                   
               
               
                 Data in this table are shown as mean (standard deviation). Statistical significance is assessed by paired t-test. 
               
            
           
         
       
     
     
       
         
           
               
             
               
                 TABLE III 
               
             
            
               
                   
               
               
                 Glycemic metrics comparing the proposed method with the original zone MPC (unannounced meals) 
               
            
           
           
               
               
               
            
               
                   
                 Day and night 
                 Overnight (24:00-06:00 h) 
               
            
           
           
               
               
            
               
                   
                 Metric 
               
            
           
           
               
               
               
               
               
               
               
            
               
                 #Simulations = 100 
                   
                   
                   
                   
                   
                   
               
               
                 % time 
                 Original 
                 Proposed 
                 p value 
                 Original 
                 Proposed 
                 p value 
               
               
                   
               
            
           
           
               
               
               
               
               
               
               
               
               
               
               
               
            
               
                 &lt;54 
                 mg/dL 
                 0 
                 (0) 
                 0 
                 (0) 
                 — 
                 0 
                 (0) 
                 0 
                 (0) 
                 — 
               
               
                 &lt;70 
                 mg/dL 
                 0 
                 (0.2) 
                 0 
                 (0.1) 
                 0.788 
                 0 
                 (0.1) 
                 0 
                 (0.1) 
                 0.752 
               
               
                 70-180 
                 mg/dL 
                 67.5 
                 (9.9) 
                 72.7 
                 (8.6) 
                 &lt;0.001 
                 99.7 
                 (0.9) 
                 100 
                 (0.1) 
                 0.015 
               
               
                 &gt;250 
                 mg/dL 
                 6.4 
                 (7.6) 
                 4.5 
                 (5.6) 
                 &lt;0.001 
                 0 
                 (0) 
                 0 
                 (0) 
                 — 
               
            
           
           
               
               
               
               
               
               
               
               
               
               
               
            
               
                 Mean glucose (mg/dL) 
                 160.7 
                 (14.5) 
                 154.2 
                 (12.1) 
                 &lt;0.001 
                 122.3 
                 (6.7) 
                 120.9 
                 (5.4) 
                 &lt;0.001  
               
               
                 SD glucose (mg/dL) 
                 47.9 
                 (10.8) 
                 45.1 
                 (10.2) 
                 &lt;0.001 
                 14.2 
                 (3.3) 
                 13.2 
                 (3.1) 
                 &lt;0.001  
               
               
                 Path length 
                 3859 
                 (251.3) 
                 3863.8 
                 (243.4) 
                 0.114 
                 845.4 
                 (19.9) 
                 843.7 
                 (20.2) 
                 0.001 
               
            
           
           
               
               
               
               
               
               
               
               
               
            
               
                 Mean glucose at 07:00 h (mg/dL) 
                 120.7 
                 (8.6) 
                 119.3 
                 (8.8) 
                 &lt;0.001 
                 — 
                 — 
                 — 
               
               
                   
               
               
                 Data in this table are shown as mean (standard deviation). Statistical significance is assessed by paired t-test. 
               
            
           
         
       
     
     These discussions are consistent with the quartile curves in  FIG. 3 . Finally, both controllers result in satisfactory glycemic control performance for night time (24:00-06:00 h). 
     Comparison of performance for the scenario of unannounced meals is provided in  FIG. 4  and TABLE III (above). For this scenario, the proposed approach is shown to have much enhanced performance for hyperglycemia control compared with the original zone MPC in terms of percent time in the safe range (72.7% vs. 67.5%; p&lt;0.001), percent time &gt;250 mg/dL (4.5% vs. 6.4%; p&lt;0.001), mean glucose (154.2 mg/dL vs. 160.7 mg/dL; p&lt;0.001). Note, this is achieved without causing the risk of hyperglycemia, which is quantified by percent time &lt;70 mg/dL (0.0% vs. 0.0%) and percent time &lt;54 mg/dL (0.0% vs. 0.0%). The explanation, as observed from  FIG. 4 , is that due to the glucose state and velocity dependent choice of R and R, the proposed controller encourages reasonably more active insulin infusion when the glucose concentration is rapidly increasing, and is able to safely turn off insulin infusion when the glucose stops to increase or decreases. As indicated above, both controllers lead to satisfactory glycemic control performance for night time (24:00-06:00 h), which is also reflected in the mean glucose concentration values at 07:00 h (119.3 mg/dL vs. 120.7 mg/dL; p&lt;0.001). 
       FIG. 5  is a graphical illustration of the adaption of the parameters that control infusion of insulin based on the glucose concentration, in accordance with an embodiment of the present embodiment. The performance improvement of the proposed controller is achieved through the adaptation of control penalty parameters.  FIG. 5  specifically plots the trend of {circumflex over (R)}(μ 1   i ,y 1   i ) of in silico Patient 7 in the first 24 hours (which correspond to 288 controller update instants) with unannounced meals, together with the trend of glucose prediction sequence {y 1   i |i=1, . . . , 288}. The superscript i is used to represent the dependence of the variables on time. A comparison with the constant choice of confirms that the proposed parameter adaptation law chooses relatively larger values of {circumflex over (R)}(⋅,⋅) when the glucose predictions are low, or very high, or decreasing, but allows comparably small values only when the glucose predictions are increasing steeply above the nominal glucose range. This further explains how the proposed adaptive approach manages to alleviate hyperglycemia without causing increased risks of hypoglycemia. 
     In this work, an adaptive MPC approach is developed for zone MPC of AP based on the predicted glucose state and its velocity. The obtained controller allows appropriate active insulin infusion when blood glucose is rapidly increasing above the nominal value, but cautiously decreases or suspends insulin infusion when glucose velocity is positively small or negative or when the glucose concentration is low. The safety and effectiveness of the proposed method is evaluated on the 10-patient cohort of the FDA-approved UVA/Padova simulator through comparisons with the original zone MPC. Although the approach is developed for the zone MPC, the idea is general enough to be extended to other MPC formulations (e.g., the enhanced MPC with a hybrid exponential and quadratic cost). 
       FIG. 6  illustrates a process  600  for providing a closed loop adaptive glucose controller. The process is illustrated with reference to components discussed above with respect to  FIGS. 1A and 1B . In step  601 , the glucose sensor receives data that indicates a concentration of glucose in a bloodstream of the patient. The data received is processed to determine a real time glucose concentration. At step  602 , an impeding glycemia protocol is enacted based on the MPC  26  in response to real time glucose concentration. The impeding glycemia protocol includes determining a relationship between predicted glucose concentrations  42 , a rate of change of the predicted glucose concentrations, and a set of control parameters that determine insulin doses above and below a patient-specific basal rate. At step  603 , the set of control parameters is adapted using the relationships determined. At step  604 , a dosage of glucose altering substance to administer is determined  45  using the zone MPC algorithm with the control parameters in real time. At step  605 , a command is sent to a pump  28  to administer the dosage of the glucose altering substance. 
     It should initially be understood that the disclosure herein may be implemented with any type of hardware and/or software, and may be a pre-programmed general purpose computing device. For example, the system may be implemented using a server, a personal computer, a portable computer, a thin client, or any suitable device or devices. The disclosure and/or components thereof may be a single device at a single location, or multiple devices at a single, or multiple, locations that are connected together using any appropriate communication protocols over any communication medium such as electric cable, fiber optic cable, or in a wireless manner. 
     It should also be noted that the disclosure is illustrated and discussed herein as having a plurality of modules which perform particular functions. It should be understood that these modules are merely schematically illustrated based on their function for clarity purposes only, and do not necessary represent specific hardware or software. In this regard, these modules may be hardware and/or software implemented to substantially perform the particular functions discussed. Moreover, the modules may be combined together within the disclosure, or divided into additional modules based on the particular function desired. Thus, the disclosure should not be construed to limit the present invention, but merely be understood to illustrate one example implementation thereof. 
     The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. In some implementations, a server transmits data (e.g., an HTML page) to a client device (e.g., for purposes of displaying data to and receiving user input from a user interacting with the client device). Data generated at the client device (e.g., a result of the user interaction) can be received from the client device at the server. 
     Implementations of the subject matter described in this specification can be implemented in a computing system that includes a back-end component, e.g., as a data server, or that includes a middleware component, e.g., an application server, or that includes a front-end component, e.g., a client computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the subject matter described in this specification, or any combination of one or more such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include a local area network (“LAN”) and a wide area network (“WAN”), an inter-network (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks). 
     Implementations of the subject matter and the operations described in this specification can be implemented in digital electronic circuitry, or in computer software, firmware, or hardware, including the structures disclosed in this specification and their structural equivalents, or in combinations of one or more of them. Implementations of the subject matter described in this specification can be implemented as one or more computer programs, i.e., one or more modules of computer program instructions, encoded on computer storage medium for execution by, or to control the operation of, data processing apparatus. Alternatively, or in addition, the program instructions can be encoded on an artificially-generated propagated signal, e.g., a machine-generated electrical, optical, or electromagnetic signal that is generated to encode information for transmission to suitable receiver apparatus for execution by a data processing apparatus. A computer storage medium can be, or be included in, a computer-readable storage device, a computer-readable storage substrate, a random or serial access memory array or device, or a combination of one or more of them. Moreover, while a computer storage medium is not a propagated signal, a computer storage medium can be a source or destination of computer program instructions encoded in an artificially-generated propagated signal. The computer storage medium can also be, or be included in, one or more separate physical components or media (e.g., multiple CDs, disks, or other storage devices). 
     The operations described in this specification can be implemented as operations performed by a “data processing apparatus” on data stored on one or more computer-readable storage devices or received from other sources. 
     The term “data processing apparatus” encompasses all kinds of apparatus, devices, and machines for processing data, including by way of example a programmable processor, a computer, a system on a chip, or multiple ones, or combinations, of the foregoing The apparatus can include special purpose logic circuitry, e.g., an FPGA (field programmable gate array) or an ASIC (application-specific integrated circuit). The apparatus can also include, in addition to hardware, code that creates an execution environment for the computer program in question, e.g., code that constitutes processor firmware, a protocol stack, a database management system, an operating system, a cross-platform runtime environment, a virtual machine, or a combination of one or more of them. The apparatus and execution environment can realize various different computing model infrastructures, such as web services, distributed computing and grid computing infrastructures. 
     A computer program (also known as a program, software, software application, script, or code) can be written in any form of programming language, including compiled or interpreted languages, declarative or procedural languages, and it can be deployed in any form, including as a stand-alone program or as a module, component, subroutine, object, or other unit suitable for use in a computing environment. A computer program may, but need not, correspond to a file in a file system. A program can be stored in a portion of a file that holds other programs or data (e.g., one or more scripts stored in a markup language document), in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files that store one or more modules, sub-programs, or portions of code). A computer program can be deployed to be executed on one computer or on multiple computers that are located at one site or distributed across multiple sites and interconnected by a communication network. 
     The processes and logic flows described in this specification can be performed by one or more programmable processors executing one or more computer programs to perform actions by operating on input data and generating output. The processes and logic flows can also be performed by, and apparatus can also be implemented as, special purpose logic circuitry, e.g., an FPGA (field programmable gate array) or an ASIC (application-specific integrated circuit). 
     Processors suitable for the execution of a computer program include, by way of example, both general and special purpose microprocessors, and any one or more processors of any kind of digital computer. Generally, a processor will receive instructions and data from a read-only memory or a random access memory or both. The essential elements of a computer are a processor for performing actions in accordance with instructions and one or more memory devices for storing instructions and data. Generally, a computer will also include, or be operatively coupled to receive data from or transfer data to, or both, one or more mass storage devices for storing data, e.g., magnetic, magneto-optical disks, or optical disks. However, a computer need not have such devices. Moreover, a computer can be embedded in another device, e.g., a mobile telephone, a personal digital assistant (PDA), a mobile audio or video player, a game console, a Global Positioning System (GPS) receiver, or a portable storage device (e.g., a universal serial bus (USB) flash drive), to name just a few. Devices suitable for storing computer program instructions and data include all forms of non-volatile memory, media and memory devices, including by way of example semiconductor memory devices, e.g., EPROM, EEPROM, and flash memory devices; magnetic disks, e.g., internal hard disks or removable disks; magneto-optical disks; and CD-ROM and DVD-ROM disks. The processor and the memory can be supplemented by, or incorporated in, special purpose logic circuitry.