Hybrid deterministic/stochastic algorithm for large sets of rate equations