1. A method implemented by a computer for obtaining a preferred layout for a lithographic process, the method comprising: identifying an initial layout including plurality of features; performing one or both of splitting certain ones of the features into two or more discrete features and joining two or more of the features into a single feature; reconfiguring the features with a set of changes to the features; and determining if a termination condition is satisfied with the set of changes to the features, thereby obtaining the preferred layout; wherein the determining comprises, using the computer, evaluating a cost function that measures how a lithographic metric is affected by the set of changes to the features for a plurality of lithographic process conditions, and expanding the cost function into a series of terms at least some of which are functions of characteristics of the features.