Consider simple game:
- Soldiers beat calvary; mages beat soldiers; calvary beat mages;
- We scouted out enemy and now know enemy number of each kind of troops: $Es, Em, Ec;$
- We can send to march the enemy no more than $Tmax$ troops in total;
- We have limited amount of each troop type: $Ps, Pm, Pc;$
- We cannot send more troops than we have, so following conditions must be satisfied: $Xs <= Ps; Xm <= Pm; Xc <= Pc;$
We have to calcuate amount of troops of each type we should send to march to achieve best result.
$Xs=? Xm=? Xc=?$
PS. One solution (maximizing damage) is known and trivial for the case $Ps=\infty, Pm=\infty, Pc=\infty$ if we have unlimited amount of each troop type:
- total enemy troops $Et = Es+Em+Ec$
- soolder to send to march $Xs = Tmax * Ec/Et$
- mage to send $Xm = Tmax * Es/Et$
- calvary to send $Xc = Tmax * Em/Et$
but how to calculate amount of troops to take minimal damage possible? E.g "if there is no soldiers send only calvary"?
also, we have limited troops, and how to achieve best effort? (for example if enemy has many mages, and we have not enough calvary to satisfy best ratio - we should send extra mages but not soldiers. But if we are not capped by march limit $Tmax$ (i mean $Pc+Pm < Tmax$) then we should send soldiers also as they will assist battle anyway) - how to write it in formulas?