One of the viable solutions for effective spectrum management is cognitive radio. Single sensing systems are prone to interference; thus, the use of cooperative spectrum sensing. This paper aims to determine the required number of cognitive radios that would optimize the performance of a communication network in terms of energy utilization and bandwidth requirement. The cognitive sensing technique used was energy detection due to its reduced energy, computational, and communication resources requirement. The channel noise variance was set to −25 dB. Spectrum sensing was carried out at a frequency of 936 MHz and bandwidth of 200 kHz. Machine learning was first used to enhance the specificity of detection to minimize interference. Genetic Algorithm (GA) and Simulated Annealing (SA) were used to optimize the number of cognitive radios putting into consideration all constraints in the network. Genetic Algorithm gave a better result of two optimization techniques used. It gave an overall reduction of 40.74% in energy conserved without affecting the detection accuracy.