A genetic algorithm, including crossover and mutation, has been applied to optimize energy supply systems, considering several energy demand profiles. In the crossover a "quasi-compatibility" condition is introduced, so that the constraints of the system may he taken into account, although certain violations of them are allowed at the expense of a penalty that decreases the fitness of the resulting offsprings. The genetic algorithm applied requires less computation time and provides better results than simulated annealing. (C) 1999 Elsevier Science B.V. All rights reserved.