Software Defined Networks (SDNs) allow a centralized controller to globally plan packets forwarding according to the operator's objectives. The realization of global objectives requires more local forwarding rules. However, the forwarding tables in TCAM-based SDN switches are limited resources. In this paper, we concentrate on satisfying global network objectives, such as maximum flow, with the limitation of forwarding table size. We formulate the problem as the Bounded Forwarding-Rules Maximum Flow (BFR-MF) problem. And then, we improve the updating of particles in Particle Swarm Optimization (PSO) by merging particles and propose the PSO-based Maximum Flow (PSO-MF) algorithm to maximize the overall feasible traffic. We maintain fairness among flows to guarantee a certain level of Quality-of-Service (QoS). Extensive simulations show that PSO-MF algorithm performs well in network utilization both for backbone and data center networks.