Cooperation and Optimism in a Social Dilemma