Detecting Emotions in Social Media: A Constrained Optimization Approach