Software-defined networks separate the controlling and data layers in computer networks. It will enable central management and the ability to define policies and apply them to network hardware. Traffic engineering, which measures and manages network traffic, is a major activity in these networks. Data should be monitored when traffic is excessive and traffic should be manipulated. Among the most important issues to consider in a network is monitoring. In this case, the network is based on SDN. Overflows on a network do not allow switches to manipulate the network. As mentioned above, this overflow is aggregation and usually based on broadcasting principles. This article describes how links work at the network level using parameters of flow, link capacity, and the optimal allocation of profits. This paper attempts to reduce congestion, reduce packet losses, and optimize delay through a number of methods. This paper proposes a method (PSOCB) based on SDN. Using the meta-heuristic methods to allocate the cluster switches existing in the network between the source and destination and the method of optimizing, the throughput of particles is increased by 13% in switches, and 8% in links. There is a reduction in delay when compared to the base paper. The proposed method experienced congestion at one time higher than the base paper, and at other times lower. In case of congestion removal, the network returns to its normal state. Overall, this method improves congestion as well.