An iterative control system was designed for compensation of wavefront aberration utilizing a micromachined deformable mirror through simulated annealing algorithm. 37 elements within a deformable mirror are controlled individually in a closed-loop to maximize the output optical intensity collected in a single mode aperture. In this paper, the design of the control system is explained comprehensively. The effect of the parameters involved on the achievable accuracy, computational load and speed of the algorithm are investigated. The shape of the mirror's surface throughout the runtime of the algorithm is also monitored and analyzed.