Component-based software development has been regarded as one of the newest trends in the software development industry. In some ways, component-based software development focuses on reusability. In fact, high-quality software components refer to components that are highly cohesion internally, and also have the least coupling with other components, or in other words, are independent. Thus, using such components will lead to faster software development. In this way, this study aims to identify reusable components in software. To do this, first, software components were extracted from the source code of software systems. To identify reusable components, an artificial neural network algorithm has been used. On the other hand, the reusable components recognized by the evolutionary particle swarm optimization algorithm have been clustered. In this study, the particle swarm optimization algorithm was modified to apply to clustering problems. Finally, with the help of these clusters, the KNN classifier was trained, and during identifying reused inputs, the cluster to which the input belongs was determined by the classifier. This way, we will have a library of reusable components, where similar components are placed in a cluster. The proposed algorithm was experimentally evaluated on nine open-source software systems belonging to different domains. The results of this study show that the counted software components are potentially reusable and confirm the research findings.