Optimal power allocation problem for decentralized detection in a wireless sensor network (WSN) is presented. Our goal is to find a numerical solution for the optimal power allocation scheme that minimizes the total power spent by the wireless sensor network so that the detection error probability is below a desired value. We evaluate and compare the performance of two emerging nature inspired algorithms like the Cat Swarm Optimization (CSO), and the Cuckoo Search (CS). Both are also compared with the popular Particle Swarm Optimization (PSO) algorithm. The results show that PSO provides slightly better solutions when the network consists of a small number of sensors, while CSO outperforms the other algorithms as the number of sensors increases.