The protoplanetary discs of T Tauri and Herbig Ae/Be stars have previously been studied using geometric disc models to fit their spectral energy distribution (SED). The simulations provide a means to reproduce the signatures of various circumstellar structures, which are related to different levels of infrared excess. With the aim of improving our previous model, which assumed a simple flat-disc configuration, we adopt here a reprocessing flared-disc model that assumes hydrostatic, radiative equilibrium. We have developed a method to optimize the parameter estimation based on genetic algorithms (GAs). This paper describes the implementation of the new code, which has been applied to Herbig stars from the Pico dos Dias Survey catalogue, in order to illustrate the quality of the fitting for a variety of SED shapes. The star AB Aur was used as a test of the GA parameter estimation, and demonstrates that the new code reproduces successfully a canonical example of the flared-disc model. The GA method gives a good quality of fit, but the range of input parameters must be chosen with caution, as unrealistic disc parameters can be derived. It is confirmed that the flared-disc model fits the flattened SEDs typical of Herbig stars; however, embedded objects (increasing SED slope) and debris discs (steeply decreasing SED slope) are not well fitted with this configuration. Even considering the limitation of the derived parameters, the automatic process of SED fitting provides an interesting tool for the statistical analysis of the circumstellar luminosity of large samples of young stars.