There are ways to eliminate the supply frequency or frequency components that have a dominant effect on the signal. This can be achieved using a tracking algorithm like Kalman filter. Some more details are required about your application and why you want to use heuristic based optimizers for your problem.