Generalized Monte Carlo loop algorithm for two-dimensional frustrated Ising models.