Generally speaking, I've only had rats eat each other when they run short of water OR when they are not on a good diet. I'm sure that overcrowded rats would also kill and eat each other.

I start out trying to catch a loose rat with a live trap, or a bucket(deep bucket). If the rat does get into and out of the bucket, I put water in it so it has to swim. A swimming rat can't jump out.

If these don't work, I start using snap traps and lethal measures. Rats can destroy way too much for me to let them roam about freely.