What sort of 'heap' is it? Is there any sort of enclosure (wooden pallets, chicken mesh, plastic 'dalek' type bin)?.
Personally, I use very large, very heavy duty plastic compost 'makers' which I obtained a few years ago from my local council at an incredible discount. The sides open out completely for ease of emptying and turning. They stand on concrete slabs and the bottoms are lined with a double layer of chicken mesh (top layer slightly offset against the bottom layer to reduce the size of the holes) which extends about 6" up the sides of the bins. These measures seem to provide a barrier to things which can burrow under structures or gnaw their way through wooden ones and I would soon see if anything was trying to gnaw at the bin itself.
I never put cooked food or anything meaty or dairy based into the bin (see Sue's comments above) and actually put very limited kitchen waste in. Tea bags, coffee grounds, citrus peel and some other vegetable peelings are ok - but even with these I wait until I have about a foot of garden waste in the bottom.
If you have an unenclosed, dryish compost heap with food in it or near it (eg bird or chicken food) I'm afraid you have a 5 star rat hotel and you will need to take steps. Making the environment as hostile and difficult to infiltrate as possible is much better than then trying to get rid of the rats - they will just keep coming back if they like the accommodation! Prevention is definitely better than cure in this case.
Meantime I'd get a rat man in!