Optimal Thinking