The optimal insulin to be delivered by an insulin infusion pump is determined by using a reinforcement learning algorithm aiming to the personalized glucose regulation. The algorithm optimizes the daily basal insulin rate and insulin: carbohydrate ratio for each patient, on the basis of his/her measured glucose profile. The proposed algorithm is able to learn in real-time patient-specific characteristics captured in the daily glucose profile and provide individualised insulin treatment. An automatic and personalised tuning method contributes in the optimisation of the algorithm's performance.