By virtue of the maximum entropy principle, we get an Euler–Lagrange equation which is a highly nonlinear differential equation containing the mass function and its derivatives. Solving the equation by a homotopy perturbation method we derive a generalized expression for the mass which is a polynomial function of the radial distance. Using the mass function we find a partially stable configuration and its characteristics. We show that different physical features of the known compact stars, viz. HerX−1, RXJ1856−37, SAX J (SS1), SAX J (SS2), and PSRJ1614−2230, can be explained by the present model