1. A method for optimizing a lithographic process, comprising: receiving descriptions of an illumination source and a mask, the mask comprising a lithography pattern; and until the source and mask are simultaneously optimized for a process window of the lithographic process, selectively repeating the steps of: forming a cost function as a function of both the illumination source and mask; calculating a gradient of the cost function, and reconfiguring the source and mask descriptions depending on the calculated gradient.