Discrete distribution optimization