Moving to smaller libraries via clustering and genetic algorithms