rewrite learning and utility functions, replace optimaization with reinforcement learning.