Diffraction models and scatterometry are used to reconstruct a model of a microscopic structure on a substrate. A plurality of candidate structures are defined, each represented by a plurality of parameters (p1, p2, etc.)). A plurality of model
diffraction signals are calculated by simulating illumination of each of the candidate structures. The structure is reconstructed by fitting one or more of the model
diffraction signals to a
signal detected from the structure. In the generation of the candidate structures, a model
recipe is used in which parameters are designated as either fixed or variable. Among the variable parameters, certain parameters are constrained to vary together in accordance with certain constraints, such as linear constraints. An optimized set of constraints, and therefore an optimized model
recipe, is determined by reference to a
user input designating one or more parameters of interest for a measurement, and by simulating the reconstruction process reconstruction. The optimized model
recipe can be determined automatically by a parameter advisor process that simulates reconstruction of a set of reference structures, using a plurality of candidate model recipes. In the generation of the reference structures, restrictions can be applied to exclude unrealistic parameter combinations.