I do wonder whether the actual criteria used in the program is simpler than making a calculation of combat outcome and attacking if a certain %age is exceeded. Most such calculations involving armies would need to cover more than ten combat rounds and could reach 25. Even with use of combination formulae this is a lot of computation. Could one criterion (or part of one) be the number of health points possessed by the defending army?
I'm pretty sure the same outcome calculations are done as with standard units (the latter is referenced in the war academy iirc). This ofc also involves the health points left of the unit/army. Also I don't believe that it's a lot of computation. For each round you have the probability of winning/losing this round, which you have only to calculate once. Then there is some summing up and (1-x)^y involved iirc, but thats done in no time. Also this might not even be done for every unit. Civ3 could calculate the minimum attack value that a unit should have in order to win against the army with a defined % chance (lets say 25%). If this minimum attack value is 10 and the AI has only units with 6 attack, there will be no more calculations for this turn.
Another pointer that roughly same calculations are used I noticed a long time ago, when I went pillaging with a Horsemen army and he attacked them with Medieveal Infantry (even though it was at full health). There are some notable exceptions to this:
- Invading another continent, taking the first city and fortifing this city with an army (we assume it has the highest chance of winning when defending). Then the AI will attack it, even at full HP, no matter the expected losses. They might even go with Archers against it. This should never happen though, as protecting captured Cities with Armies is risky anyway.
- If you somehow got on red HP on your invading army, it might still be the AI doesn't attack it. Assume you can't defend your army with strong defenders until next turn. As long you make sure you place units with lower chance of winning (i.e. low on defense) in reach of their units the AI would attack those units first. This applies even to workers (also referenced in the War Academy, other uses for workers).
- If you have an Army sitting on a continental choke point it might also get attacked when an AI declares war on you "over it", no matter combat caluclations. Haven't seen this yet though (and I don't intend to find out

)