added likelihood and gradient for contrained model