  We propose a method for efficient simulations in extended ensembles, useful,
e.g., for the study of problems with complex energy landscapes and for free
energy calculations. The main difficulty in such simulations is the estimation
of the a priori unknown weight parameters needed to produce flat histograms.
The method combines several complementary techniques, namely, a Gibbs sampler
for the parameter moves, a reweighting procedure to optimize data use, and a
Bayesian update allowing for systematic refinement of the free energy estimate.
In a certain limit the scheme reduces to the 1/t algorithm of B.E. Belardinelli
and V.D. Pereyra [Phys. Rev. E 75, 046701 (2007)]. The performance of the
method is studied on the two-dimensional Ising model, where comparison with the
exact free energy is possible, and on an Ising spin glass.
