The proposed approach brings up a manner of cognitiveness that inherits a paradigm in particle swarm optimization to implement a chaotic mapping and enhanced by K-means clustering algorithm. In this work, named KCPSO, chaotic mapping with ergodicity, irregularity and the stochastic properties in PSO contributes to global search while K-means with clustering properties in PSO results in rapid convergence. Numerical results indicated that PSO adopting chaotic features can more easily escape from local optima, and meanwhile PSO incorporating with K-means can evidently improve convergence speed. Unpredictability and grouping principle underlying chaotic mapping and K-means methods often imply diversity maintenance and convergence potential within the swarm which inevitably lead to a desirable optimal solution. As proven in the experiments with multidimensional search space and compared with original PSO, the conclusions reported that the proposed KCPSO algorithm could improve the search performance on the benchmark functions significantly, and show the effectiveness of solving optimization problems.