Template:Ideal Sex Ratio General
Finds a generally ideal M:F ratio for an animal.
Syntax[edit]
{{Ideal Sex Ratio General|name|metric|max_n|unsimplified|verbose}}
- name = Name of animal. Defaults to the current page name.
- metric = The metric to compare ratios by. One of 'reproduction', 'baby slaughter nutrition' or 'adult slaughter nutrition'. Defaults to 'reproduction'.
- max_n = What population size to check up to. Max value of 60. Defaults to 20.
- unsimplified = Optional. If set, the unsimplified ratio is also returned.
- verbose = Optional. If set, a trace of the calculations is also printed.
Dependencies[edit]
- Template:Ideal Sex Ratio
- Template:Gross Population Nutrition
- Assumption: Butchery efficiency, difficulty etc. modifiers are all the baseline 100%.
- Property:Milking Interval Days
- Property:Milk Name
- Property:Egg Laying Interval
- Property:Unfertilized Egg Name
- Property:Body Size
- Property:Baby Scale
- Template:Meat Leather Curve
- Template:Population Reproduction Rate
- Assumption: All the animals have a synchronized sleep cycle.
- Assumption: They're all sleeping on the floor.
- Assumption: They're all within the 30 tile distance needed to see each other.
- Property:Mate Mtb Hours
- Property:Gestation Period Days or Property:Egg Laying Interval
- Property:Average Offspring Per Birth or Property:Eggs Per Clutch Average
- Property:Can Lay Unfertilized Eggs
- Template:Gross Population Nutrition
Used by[edit]
Examples[edit]
Pig[edit]
{{Ideal Sex Ratio General|Pig}}➔ 1:4
Horse[edit]
{{Ideal Sex Ratio General|Horse}}➔ 3:14
Thrumbo[edit]
{{Ideal Sex Ratio General|Thrumbo}}➔ 1:14
Unsimplified ratio[edit]
The second ratio is the original before simplification. The same ratio at a higher total population will always generally be more slightly efficient per adult, because more males means the interval between mating initiations will be shorter, reducing the average wait time.
{{Ideal Sex Ratio General|Pig|||Y}}➔ 1:4 4:16
Cow[edit]
{{Ideal Sex Ratio General|Cow|reproduction|20|Y}}➔ 3:14 3:14{{Ideal Sex Ratio General|Cow|reproduction|60|Y}}➔ 11:49 11:49{{Ideal Sex Ratio General|Cow|baby slaughter nutrition|60|Y}}➔ 2:9 8:36{{Ideal Sex Ratio General|Cow|adult slaughter nutrition|60|Y}}➔ 11:49 11:49
Observations: The cow's milk production means you want very slightly (0.19%) more females than you would otherwise when doing baby slaughter. The effect is so small because you already only need a small number of bulls to keep the herd fertilized, so the cost to the fertilization rate from deviating even a single bull less than the ideal reproduction ratio usually overwhelms the gain from adding just one more milk producing cow. The impact of the milk is even weaker when adult slaughter is used, as the meat becomes a larger proportion of the nutrition production.
{{Gross Population Nutrition|Cow|8|36|baby|Y}} / 44 ⇒ (17.8537 + 25.2) / 44 = 0.40577 + 0.57273 = 0.97849 nutrition/adult/day
{{Gross Population Nutrition|Cow|11|49|baby|Y}} / 60 ⇒ (24.39434 + 34.3) / 60 = 0.40657 + 0.57167 = 0.97824 nutrition/adult/day
{{Gross Population Nutrition|Cow|8|36|adult|Y}} / 44 ⇒ (89.53497 + 25.2) / 44 = 2.03489 + 0.57273 = 2.60761 nutrition/adult/day
{{Gross Population Nutrition|Cow|11|49|adult|Y}} / 60 ⇒ (122.3358 + 34.3) / 60 = 2.03893 + 0.57167 = 2.6106 nutrition/adult/day
^meat ^milk
Conclusion: the impact of milk on the cow's optimum sex ratio is small enough to be ignored.
Verbose[edit]
Shows the best ratio at each total population size, and the corresponding metric value.
{{Ideal Sex Ratio General|Horse||||Y}}➔ name=Horse, metric=reproduction, max_n=20, return_n=, verbose=Y
n=10, m=2, f=8, v=1.9091969316299
n=11, m=2, f=9, v=1.9525877709851
n=12, m=2, f=10, v=1.9410551549443
n=13, m=3, f=10, v=1.8693680050348
n=14, m=3, f=11, v=1.9094258908569
n=15, m=3, f=12, v=1.9441427252361
n=16, m=3, f=13, v=1.9745199553179
n=17, m=3, f=14, v=2.0013233936254
n=18, m=4, f=14, v=1.9075970150746
n=19, m=4, f=15, v=1.9362826844742
n=20, m=4, f=16, v=1.9620997869339
n=17, m=3, f=14, v=1.9620997869339
3:14
Pseudocode[edit]
def Ideal_Sex_Ratio_General(
name = Ideal Sex Ratio General,
metric: ['reproduction', 'baby slaughter nutrition', 'adult slaughter nutrition'] = 'reproduction',
max_n: 3<int<61 = 20,
unsimplified = False,
verbose = False):
if verbose:
print('name={name}, metric={metric}, return_n={return_n}')
best_v = 0
for n in range(floor(max_n/2), max_n+1)
m = Ideal_Sex_Ratio(name, n, metric, verbose)
f = n - m
if metric == 'reproduction':
v = Population_Reproduction_Rate(name, m, f) / n
else:
v = Gross_Population_Nutrition(name, m, f, metric) / n
if verbose:
print('n={n}, m={m}, f={f}, v={v}')
if v > best_v:
best_v = v
best_n = n
best_m = m
n = best_n
m = best_m
f = n - m
if verbose:
print('n={n}, m={m}, f={f}, v={best_v}')
for d in [2, 2, 2, 2, 3, 3, 3, 5, 5, 7, 11, 13, 17, 19, 23, 29]:
if m % d == 0 and f % d == 0:
m = m/d
f = f/d
if unsimplified:
return '{m}:{f} {best_m}:{n - best_m}'
return '{m}:{f}'
| The above documentation is transcluded from Template:Ideal Sex Ratio General/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |