## 2 Methods
### In-Silico Simulation  
In the simulation scenario used in the paper, the food recommendation is given before the beginning of each exercise session for a virtual patient with no meal boluses associated with the recommended amount of carbohydrates. During the experiments, the basal insulin dose was constant and equal to the optimal value, which means the virtual patient stays at the healthy reference blood glucose concentration \(BG_{ref}=108\) mg/dL in steady-state. Training data was obtained by repeated simulations from the blood glucose simulator under scenarios where a patient with T1D performs physical exercises with the same intensity but consuming a different amount of food. The Physical Activity Guidelines for Americans recommends adults do vigorous enough exercise to raise their heart rate to 50-85% of their maximum heart rate, defined as 220 beats per minute minus their age, during 75 to 150 min a week--values might vary for younger people [28]. The virtual patient used in our simulations is 24 years old, with a maximum heart rate of 196 beats per minute and recommended heart rate during exercise between 98 and 167 beats per minute, based on the guidelines from the American Heart Association. The duration and intensity of physical activities are set to be constant at 50 min and 157 beats per minute (80% of its maximum heart rate), respectively. In absence of carbohydrate intake, a hypoglycemic excursion is induced as a consequence of the exercise session setup. The virtual patient always eats at 15 min before the exercise starts to avoid the hypoglycemic event. The outcome of each exercise is evaluated by measuring the average scores of the blood glucose over the course of four hours starting at 15 min before the exercise (meantime). The blood glucose is sampled every 5 min during the simulations, which is similar to the sampling time of common CGM devices. There exist mainly three physiological models in the T1D research field, namely the Bergman (minimal) model [29], the Hovorka model [30] and the UVA/Padova model [26], see also [31]. The minimal model is a simplified model consisting of two equations describing the internal dynamics of glucose and insulin and does not account for the significant delay involved in subcutaneous insulin infusion. The Hovorka and the UVA/Padova models both include this delay as well as the delay in the subcutaneous glucose measurement. In this work, we used the UVA/Padova model, since this is the only computer simulator of the dynamics of the human metabolic glucose-insulin system which is FDA approved as a substitute for the pre-clinical testing of certain control strategies in T1D [27]. An extension of the UVA/Padova model has been used in this paper where the effect of physical activity is included [25]. The UVA/Padova model consists of seven internal compartments describing the dynamics of glucose kinetics, insulin kinetics, glucagon kinetics and secretion, glucose rate of appearance, endogenous glucose production, glucose utilization and renal excretion, while three external compartments describe subcutaneous glucose, insulin and glucagon kinetics [27]. In addition, a physical activity model was included in the glucose-utilization subsystem, modifying the insulin-dependent utilization component to simulate exercise sessions describing changes in glucose-insulin dynamics [25]. The original UVA/Padova simulator includes ten children patients, ten adolescents patients, and ten adults patients, as well as one average child patient, one average adolescent patient, and one average adult patient. In this work, we used the adult patient number four during our experiments, since this patient presents acute hypoglycemia as a consequence of our physical activity experimental setup. Finally, we use a CGM for glucose measurements during our simulations, where the CGM sensor noise is generated based on the model and the parameters determined by [32].