Adding constraint to the parameter

@junpenglao Thanks for help. I got the code running now but results are not making any sense. I am getting the distribution of p with its mean sum much greater than 1.