###### Abstract  
A person's routine is a sequence of activities of daily living patterns recurrently performed. Sticking daily routines is a great tool to support the care of persons with dementia, and older adults in general, who are living in their homes, and also being useful for caregivers. As state-of-the-art tools based on self-reporting are subjective and rely on a person's memory, new tools are needed for objectively detecting such routines from the monitored data coming from wearables or smart home sensors. In this paper, we propose a solution for detecting the daily routines of a person by extracting the sequences of recurrent activities and their duration from the monitored data. A genetic algorithm is defined to extract activity patterns featuring small differences that relate to the day-to-day contextual variations that occur in a person's daily routine. The quality of the solutions is evaluated with a probabilistic-based fitness function, while a tournament-based strategy is employed for the dynamic selection of mutation and crossover operators applied for generating the offspring. The time variability of activities of daily living is addressed using the dispersion of the values of duration of that activity around the average value. The results are showing an accuracy above 80% in detecting the routines, while the optimal values of population size and the number of generations for fitness function evolution and convergence are determined using multiple linear regression analysis. d 27 October 20227 October  
affected by many variables (e.g., time frame, weekday or weekend, chronic condition, etc.) and differentiation factors [6]. Nevertheless, monitoring the person's daily routine using IoT wearable devices is a promising research field [7], insufficiently explored, with applicability in personalizing health and care services. Discovering the person's daily life routine from sensors' data and deviations from it can help in assessing the health status of the person enabling the healthcare personnel to proactively intervene to avoid the person's institutionalization [8]. For example, sleeping more than usual can be a symptom of depression, while frequent going to the toilet can be associated with a urinary tract infection. Most of nowadays research is focused on identifying the activities of daily living (ADL) to observe abnormal data [9; 10; 11; 12]. Only a few research is looking at the activity length and sequence of such activities to detect the person's recurrent behavior patterns that are part of their daily routine and relevant deviations from it. The use of IoT sensors can generate large volumes of data that require efficient algorithms capable of processing this data and associated search space to identify recurrent behavioral patterns [13]. The collected data could be incomplete and inaccurate, and in this case, algorithms capable of handling data quality issues are required [13]. Metaheuristics algorithms could be a viable solution for solving such types of problems since they provide a near-optimal solution for problems with incomplete and inaccurate data or when the computing power is limited, and the execution time must be low [14]. They can provide approximate solutions with lower computational overhead than state-of-the-art solutions such as neural networks or exhaustive search algorithms and better solutions than deterministic and rule-based algorithms [15]. In this paper, we propose the use of a genetic metaheuristic for the detection of recurrent activity sequences that form a person's daily routine. An individual is encoded as a sequence of activities performed by a person in a day while its quality is evaluated using a fitness function that considers four types of probabilities, previously introduced by us in [16]: the probability of transition among activities, the probability that an activity is the first or last in a recurrent pattern of activities, and the pattern length probability.