The demand for spectrum resources has increased dramatically with the advent of modern
wireless applications. Spectrum sharing, considered as a critical mechanism for 5G networks, is envisioned
to address spectrum scarcity issue and achieve high data rate access, and guaranteed the quality of
service (QoS). From the licensed network's perspective, the interference caused by all secondary users (SUs)
should be minimized. From secondary networks point of view, there is a need to assign networks to SUs in
such a way that overall interference is reduced, enabling the accommodation of a growing number of SUs.
This paper presents a network selection and channel allocation mechanism in order to increase revenue by
accommodating more SUs and catering to their preferences, while at the same time, respecting the primary
network operator's policies. An optimization problem is formulated in order to minimize accumulated
interference incurred to licensed users and the amount that SUs have to pay for using the primary network.
The aim is to provide SUs with a specic QoS at a lower price, subject to the interference constraints of
each available network with idle channels. Particle swarm optimization and a modied version of the genetic
algorithm are used to solve the optimization problem. Finally, this paper is supported by extensive simulation
results that illustrate the effectiveness of the proposed methods in nding a near-optimal solution.