A method for determining an insulin therapy for a patient by a device having a processor, the method comprising: • use, by the processor, of a reinforcement learning algorithm to operate an adaptive controller of the device, the reinforcement learning algorithm comprising: a. a critic which evaluates an insulin control policy including at least one of an insulin infusion rate and an insulin to carbohydrate ratio, by computing a cost related to a state of the glucose-regulatory system of the patient for a predetermined period of time, and b. an actor which improves the insulin control policy so as to minimize the expected cost related to a subsequent state of the glucose-regulatory system; • apply, over a predetermined period of time (k-1), a predetermined insulin control policy (S k-1); • collect, over the predetermined period of time (k-1), blood glucose data of the patient; • determine a state of the glucose-regulatory system based on the collected blood glucose data; • evaluate by the critic the predetermined insulin control policy (S k-1) based on the state of the glucose-regulatory system; • update by the actor, the insulin control policy, based on a determined control action, wherein the updated insulin control policy (S k) is intended to apply over a subsequent period of time (k); wherein the determined control action takes into account at least two of the following control actions: - a linear deterministic control action (P a) which updates the insulin control policy by means of a mathematical model that takes into account a linear combination of the glucose-regulatory system's state and a determined policy parameter vector so as to associate the glucose regulatory system's state to the needed change for the subsequent period of time (k); - a supervisory control action (P s), which updates the insulin control policy by means of a mathematical model that takes into account a previous insulin control policy so as to act as safety module against extreme changes of the insulin control policy by the algorithm and/or as guidance of the direction of the update, and - an exploratory control action (P e) which updates the insulin control policy (s) by means of a mathematical model that takes a white noise so as to widen the search space of the algorithm of the glucose-regulatory system's state in order to optimise a performance and a convergence rate. • use, by the processor, of a reinforcement learning algorithm to operate an adaptive controller of the device, the reinforcement learning algorithm comprising: a. a critic which evaluates an insulin control policy including at least one of an insulin infusion rate and an insulin to carbohydrate ratio, by computing a cost related to a state of the glucose-regulatory system of the patient for a predetermined period of time, and b. an actor which improves the insulin control policy so as to minimize the expected cost related to a subsequent state of the glucose-regulatory system; a. a critic which evaluates an insulin control policy including at least one of an insulin infusion rate and an insulin to carbohydrate ratio, by computing a cost related to a state of the glucose-regulatory system of the patient for a predetermined period of time, and b. an actor which improves the insulin control policy so as to minimize the expected cost related to a subsequent state of the glucose-regulatory system; • apply, over a predetermined period of time (k-1), a predetermined insulin control policy (S k-1); • collect, over the predetermined period of time (k-1), blood glucose data of the patient; • determine a state of the glucose-regulatory system based on the collected blood glucose data; • evaluate by the critic the predetermined insulin control policy (S k-1) based on the state of the glucose-regulatory system; • update by the actor, the insulin control policy, based on a determined control action, wherein the updated insulin control policy (S k) is intended to apply over a subsequent period of time (k); - a linear deterministic control action (P a) which updates the insulin control policy by means of a mathematical model that takes into account a linear combination of the glucose-regulatory system's state and a determined policy parameter vector so as to associate the glucose regulatory system's state to the needed change for the subsequent period of time (k); - a supervisory control action (P s), which updates the insulin control policy by means of a mathematical model that takes into account a previous insulin control policy so as to act as safety module against extreme changes of the insulin control policy by the algorithm and/or as guidance of the direction of the update, and - an exploratory control action (P e) which updates the insulin control policy (s) by means of a mathematical model that takes a white noise so as to widen the search space of the algorithm of the glucose-regulatory system's state in order to optimise a performance and a convergence rate.