Easiest way to beat the Macedonians on the battlefield as Rome is to try and ensure your army has numerical superiority over them. I tend to reserve the triarii to counter the Macedonian heavy cavalry, meaning the hastati and principes have to be numerous enough to beat the Macedonian infantry without help from the triarii.

If you can bring some African elephants to the party, that will help a lot, as elephants are devastating against cavalry and phalanxes if used properly.