Hi all,
I have given quantities 4 resources - food, wood, stone and ore and 3 consumers (troops) - Mounted, Foot, Ranged. Each type of troop consumes different quantities of each of the 4 resources. I would like to find out what numbers of each type of troop are required to leave the wood, stone and ore resources equal (but not the food).
Mounted troops consume: 150 food, 110 wood, 50 stone, 200 ore
Foot troops consume: 150 food, 220 wood, 100 stone, 50 ore
Ranged troops consume: 150 food, 55 wood, 200 stone, 100 ore
For example, I have 1200K food, 1000K wood, 900K stone, 1200K ore (K=thousand). What numbers of Mounted, Foot and ranged troops do I need to consume as much resources as possible yet leave the wood, stone, ore equal? Furthermore, I have a variable, limited number of total troops available at any one time, e.g. 1210 total.
I can work out the troops required if the resources are all equal. Through some trial I have found the ratio of the different types of troops to be Mounted:Foot:Ranged = 11:9:12. I can't it work out if the resources are unequal. I think it is something to do with the proportion of resources available but can't figure out the multiplication factors.
From the ratio of 11:9:12 (m:f:r) total is 11+9+12=32, multiplication factors are 11/32, 9/32, 12/32 = 0.344, 0.281, 0.375
If the resources are equal I can do:
Total number of troops = minimum of: Food/450 or max given number of troops(450 comes from 150+150+150)
Suppose the max number of troops = 8616, then troops required:
mounted = 8616*0.344 = 2962
foot = 8616*0.281 = 2423
ranged = 8616*0.375 = 3231
Resources for the above required:
Mounted: F=150*2962=444300, W=110*2962=325820, S=50*2962=148100, O=200*2962=592400
Foot: F=150*2423=363450, W=220*2423=533060, S=100*2423=242300, O=50*2423=121150
Ranged: F=150*3231=484650, W=55*3231=177705, S=200*3231=646200, O=100*3231=323100
Totals:
Food = 444300+363450+484650=1292000
Wood = 325820+533060+177705=1037000
Stone= 148100+242300+646200=1037000
Ore = 592400+121150+323100=1037000
Desired result is Wood, stone and ore are consumed equally.
The problem is if the resources are not equal - what are the troops numbers required to leave the wood, stone and ore equal? Things are also further complicated if not enough resources are available for the given number of troops. In that situation, the number of possible troops would reduce such that the final number of resources available is always positive and equal.
I have figured out a program to work this out by iteratively changing the values of the troops until the resources are equal by adding or subtracting the troop type numbers such that the total remains the same (i.e. the ratio of troop types changes)
For example, F=1200K, W=1000K, S=900K, O=1200K
Max troops available = 8616
Computed result:
Mounted=4080
Foot=1599
Ranged=2321
Total Troops=8000 (sum of above)
Yields:
Food=0
Wood=71.77K
Stone=71.9K
Ore=71.95K
So, to state the issue again, how do I work out what troops are needed without computing using an iterative loop, but using a formula instead?
Would really appreciate an answer, I have been scratching my head for weeks on this!
Thanks in advance!
I have given quantities 4 resources - food, wood, stone and ore and 3 consumers (troops) - Mounted, Foot, Ranged. Each type of troop consumes different quantities of each of the 4 resources. I would like to find out what numbers of each type of troop are required to leave the wood, stone and ore resources equal (but not the food).
Mounted troops consume: 150 food, 110 wood, 50 stone, 200 ore
Foot troops consume: 150 food, 220 wood, 100 stone, 50 ore
Ranged troops consume: 150 food, 55 wood, 200 stone, 100 ore
For example, I have 1200K food, 1000K wood, 900K stone, 1200K ore (K=thousand). What numbers of Mounted, Foot and ranged troops do I need to consume as much resources as possible yet leave the wood, stone, ore equal? Furthermore, I have a variable, limited number of total troops available at any one time, e.g. 1210 total.
I can work out the troops required if the resources are all equal. Through some trial I have found the ratio of the different types of troops to be Mounted:Foot:Ranged = 11:9:12. I can't it work out if the resources are unequal. I think it is something to do with the proportion of resources available but can't figure out the multiplication factors.
From the ratio of 11:9:12 (m:f:r) total is 11+9+12=32, multiplication factors are 11/32, 9/32, 12/32 = 0.344, 0.281, 0.375
If the resources are equal I can do:
Total number of troops = minimum of: Food/450 or max given number of troops(450 comes from 150+150+150)
Suppose the max number of troops = 8616, then troops required:
mounted = 8616*0.344 = 2962
foot = 8616*0.281 = 2423
ranged = 8616*0.375 = 3231
Resources for the above required:
Mounted: F=150*2962=444300, W=110*2962=325820, S=50*2962=148100, O=200*2962=592400
Foot: F=150*2423=363450, W=220*2423=533060, S=100*2423=242300, O=50*2423=121150
Ranged: F=150*3231=484650, W=55*3231=177705, S=200*3231=646200, O=100*3231=323100
Totals:
Food = 444300+363450+484650=1292000
Wood = 325820+533060+177705=1037000
Stone= 148100+242300+646200=1037000
Ore = 592400+121150+323100=1037000
Desired result is Wood, stone and ore are consumed equally.
The problem is if the resources are not equal - what are the troops numbers required to leave the wood, stone and ore equal? Things are also further complicated if not enough resources are available for the given number of troops. In that situation, the number of possible troops would reduce such that the final number of resources available is always positive and equal.
I have figured out a program to work this out by iteratively changing the values of the troops until the resources are equal by adding or subtracting the troop type numbers such that the total remains the same (i.e. the ratio of troop types changes)
For example, F=1200K, W=1000K, S=900K, O=1200K
Max troops available = 8616
Computed result:
Mounted=4080
Foot=1599
Ranged=2321
Total Troops=8000 (sum of above)
Yields:
Food=0
Wood=71.77K
Stone=71.9K
Ore=71.95K
So, to state the issue again, how do I work out what troops are needed without computing using an iterative loop, but using a formula instead?
Would really appreciate an answer, I have been scratching my head for weeks on this!
Thanks in advance!