Photomask patterns are represented using contours defined by mask
functions. Given target pattern, contours are optimized such that defined
photomask, when used in photolithographic process, prints wafer pattern
faithful to target pattern. Optimization utilizes "merit function" for
encoding aspects of photolithographic process, preferences relating to
resulting pattern (e.g. restriction to rectilinear patterns), robustness
against process variations, as well as restrictions imposed relating to
practical and economic manufacturability of photomasks. An accurate,
slower merit function may be used to determine adjustment parameters for
a faster, approximate merit function. The faster merit function may be
used for iteration and adjusted based on the adjustment parameters.