1. A method of designing a mask layout, comprising: representing the mask layout using a plurality of pixels each having a mask transmittance coefficient; initializing a control parameter; generating a representative of the mask layout; determining acceptance of the representative of the mask layout by a cost function and a Boltzmann factor, wherein the cost function is related to the mask layout and a target substrate pattern, and the Boltzmann factor is related to the cost function and the control parameter; repeating the generating the representative and the determining acceptance until the mask layout is stabilized; decreasing the control parameter according to an annealing schedule; and reiterating the generating, the determining, the repeating, and the decreasing until the mask layout is optimized.