Mimicking electrostatic interactions with a set of effective charges. A genetic algorithm