Optimize teached path by data acquisition followed by genetic algorithm