Update optimize.h

Implemented generic simulated annealing.