Unemployment insurance and training in an equilibrium matching model with heterogeneous agents