Compartmental models with many nonlinearly and nonhomogeneous distributions of voltage-gated conductances are routinely used to investigate the physiology of complex neurons. However, the number of loosely constrained parameters makes manually constructing the desired model a daunting if not impossible task. Recently, progress has been made using automated parameter search methods, such as genetic algorithms (GAs). However, these methods have been applied to somatically recorded action potentials using relatively simple target functions. Using a genetic minimization algorithm and a reduced compartmental model based on a previously published model of layer 5 neocortical pyramidal neurons we compared the efficacy of five cost functions (based on the waveform of the membrane potential, the interspike interval, trajectory density, and their combinations) to constrain the model. When the model was constrained using somatic recordings only, a combined cost function was found to be the most effective. This combined cost function was then applied to investigate the contribution of dendritic and axonal recordings to the ability of the GA to constrain the model. The more recording locations from the dendrite and the axon that were added to the data set the better was the genetic minimization algorithm able to constrain the compartmental model. Based on these simulations we propose an experimental scheme that, in combination with a genetic minimization algorithm, may be used to constrain compartmental models of neurons.