Is there a general rule or rules that one can use to determine which one of two forbidden activities should be chosen in the event that for whatever reason, it is inevitable one of them must be done on Shabbat?
Better a rabbinic prohibition than a Biblical one. (There's the story in the Soloveichik dynasty of the young man who is to be drafted into the Czar's army. His father said they wouldn't study the Shulchan Aruch codifying the laws of shabbat, as that text simply says "X and Y are prohibited" without telling you that X is Biblical and Y is rabbinic. Instead, they studied Rambam's code. As there would be times when the army would force compromises to be made, and then better to violate something rabbinic than something biblical.)
We have plenty of discussions about "if I have to break shabbat to save a life, what's the best way to do X" (whether for doctors or soldiers). A few rules of thumb:
- Better something rabbinically prohibited than something biblically prohibited. For instance if you bring your child to the ER and they'll only administer a vital medication if you sign an agreement form, sign with your non-dominant hand (e.g. left hand for righties), as non-dominant writing is only a rabbinic prohibition. Operating an electronic device (with the significant exceptions of the incandescent lightbulb and combustion engine) is often a rabbinic prohibition.
- Some rabbinic prohibitions -- e.g. shvus -- are stronger than others (e.g. gezeira.)
- Some acts violate multiple prohibitions, while others violate only one. If I recall correctly Rabbi Moshe Feinstein discusses someone who would have to eat a lot on Yom Kippur (one violation per serving of food) vs. get an IV (one violation when they insert the IV, and none subsequently). Fishing on shabbat, for instance, violates both "trapping" and "slaughtering."