  We apply Monte Carlo Markov Chain (MCMC) methods to large-scale simulations
of galaxy formation in a LambdaCDM cosmology in order to explore how star
formation and feedback are constrained by the observed luminosity and stellar
mass functions of galaxies. We build models jointly on the Millennium and
Millennium-II simulations, applying fast sampling techniques which allow
observed galaxy abundances over the ranges 7<log(M*/Msun)<12 and z=0 to z=3 to
be used simultaneously as constraints in the MCMC analysis. When z=0
constraints alone are imposed, we reproduce the results of previous modelling
by Guo et al. (2012), but no single set of parameters can reproduce observed
galaxy abundances at all redshifts simultaneously, reflecting the fact that
low-mass galaxies form too early and thus are overabundant at high redshift in
this model. The data require the efficiency with which galactic wind ejecta are
reaccreted to vary with redshift and halo mass quite differently than
previously assumed, but in a similar way as in some recent hydrodynamic
simulations of galaxy formation. We propose a specific model in which
reincorporation timescales vary inversely with halo mass and are independent of
redshift. This produces an evolving galaxy population which fits observed
abundances as a function of stellar mass, B- and K-band luminosity at all
redshifts simultaneously. It also produces a significant improvement in two
other areas where previous models were deficient. It leads to present day dwarf
galaxy populations which are younger, bluer, more strongly star-forming and
more weakly clustered on small scales than before, although the passive
fraction of faint dwarfs remains too high.
