Algorithms for NP-hard Optimization Problems and Cluster Analysis