Previous approaches to the description of complex diets, based on n-alkanes and optimization techniques, have grouped the plant species to reduce the number of components. Diet estimates have been obtained with least-squares routines by minimizing the discrepancy between faecal alkane concentrations calculated from herbage concentrations and actual faecal alkane concentrations. The effect of diet selection within groups can only be assessed by using sensitivity tests or by giving subjective weights to the individual plants. In the current study, a new optimization algorithm was developed that selects weightings that lead to consistent estimates of group proportions. The diet of the wild rabbit in a southern Portuguese montado was used as a case study. Estimates of the diet composition obtained using the new algorithm were compared with those of a conventional routine. The new algorithm was shown to provide, on average, more accurate estimates of the proportions of the groups in the diet. The effect of grouping plant species according to criteria other than similarity in n-alkane pattern on the accuracy of estimates was shown to be non-significant.