1. A method of altering a photomask data set, the method comprising: providing a computational model of the patterning process; defining a set of design goals; providing a method of calculating a figure-of-merit indicative of how well any photomask data set meets said design goals according to said computational model, wherein the method uses a functional based on the computational model to map the photomask data set to the figure-of-merit, and wherein the functional is a mathematical map of a topological vector space to a corresponding scalar field; and using a computer to modify the photomask data set in a way that increases its figure-of-merit.