I suggest that you check out the following connex issue on ResearchGate as guidelines for implementing such bio-inspired algorithms: https://www.researchgate.net/post/Whats_difference_between_k-means_clustering_and_self_organizing_map
You may also have a look to Elastic Maps by A. Gorban :
Gorban et al., " Elastic Principal Graphs and Manifolds and their Practical Applications ", 2005 - http://www.ihes.fr/~zinovyev/papers/elmapComputing.pdf
Related issue on ResearchGate: https://www.researchgate.net/post/Combining_Self_organized_maps_with_Affinity_Propagation_dimension_reduction
L. Besson, " Self-Organizing Maps and DSOM From unsupervised clustering algorithms to models of cortical plasticity ", Research Project Report, 2016 - https://perso.crans.org/besson/publis/mva-2016/MVA_2015-16__Neuro-Sciences__Project__Lilian_Besson__Report.en.pdf
for bio inspired algorithm we need to use library "inspyred".this packages includes examples for specific predetermined functions that are used for bench marking .but we can customized it for it for run for user defined functions.
to find kmeans .in k means takes a criteria and based on that it clusters data. so we basically find optimal distance from a data and try to select data points which are closer to optimal data point. equation i am using for distance calculation in code is
f(x)=(x-1)**2
here is a bio inspired customized PSO algorithm to find optimal data point for k means are: