A Learning Strategy for the Autonomous Control of Type 1 Diabetes