Energy consumption in detection is a key objective for cognitive sensor network. Therefore, measuring the energy consumption is an important issue for efficient spectrum sensing. In order to compute the consumed energy at sensor nodes, their energy probability density function (PDF) is often required. In this article, the authors study the problem of spectrum sensing in cognitive networks and focus on strategies that can substantially affect the energy efficiency and complexity of such algorithms. In particular, they consider an energy detection mechanism in cooperative spectrum sensing where the knowledge of the energy PDF is the key. Since in practice the true value of such a PDF is unavailable, the authors propose to use non-gradient based optimization algorithms to find the parameters of approximated PDF function. In the proposed method, the corresponding PDF parameters are computed iteratively using Genetic and PSO algorithms. The numerical results show that the proposed technique outperforms prior methods.