Pig growth simulation models are used to determine feeding strategies that improve profitability on commercial farms. For a given farm, the number of diets fed, their energy, amino acid content, the quantity fed and the diet period can vary, thus giving a very large number of possible feeding strategies (F, as many as 1050). Adding nonlinear optimisation methods to a growth model allows us to find an Fyielding the maximum for a given objective function, usually the gross margin per pig or per pig place and year. Our simulation program links a linear program for a least-cost diet formulation, a stochastic pig growth model and a genetic algorithm (GA) to find the Fgiving a best solution. When finding Ffor maximum profitability, the gross margin obtained by the GA is higher than that found by random search or by feeding pigs to their maximal lean growth. In the growth model, pig genotypes are characterised by the maximal protein deposition potential (Pdmax), minimum lipid to protein ratio (MinLP) and the energy intake potential (p). In the model, variances and covariances of these quantities are used to grow a population of pigs instead of a single pig. A simulation study was conducted to investigate how different pig genotypes and different relative economic weightings for gross margin and nitrogen excretion affect the nitrogen retention and profitability. It was found that a large increase in nitrogen retention can be achieved through diet optimisation before profitability is compromised and that a lean genotype will have better nitrogen retention. Adding stochasticity to the model for a given population size showed that as the variances increase the variability in gross margin increases and with unchanging variances, the variability in gross margin decreases as the population size increases. Overall, using a feeding schedule which maximises gross margin for a single pig within a population of pigs results in a lower gross margin.