Dwarves & D.Sci: Data Fortress

post by aphyer · 2022-08-06T18:24:21.499Z · LW · GW · 26 comments

Contents

  STORY (skippable)
  DATA & OBJECTIVES
None
29 comments

This is an entry in the 'Dungeons & Data Science' series, a set of puzzles where players are given a dataset to analyze and an objective to pursue using information from that dataset. 

STORY (skippable)

You stare out the window of your office in the dwarven capital of Gildedpeaks, the Hammer of Environs.  

(This would be more interesting if the window gave you a view.  But, like most dwarves, you live underground, and so the window just looks out onto a rock wall.  But the humans have windows, and so no self-respecting dwarf would be without a window themselves, much less be outside like some prissy elf who lives in a tree surrounded by the open air.  At least your window has some suitably menacing spikes on it.)

Gildedpeaks sends out constant expeditions, to establish fortresses across the continent, from the Smooth Swamp of Pride to the Glimmering Peaks of Education.  Recently, you suggested to King Urist McAnvil that perhaps, rather than grabbing a dozen or so dwarves almost at random, you could select better teams using the history of how well various expeditions did.

(More than one expedition in ten heads out with no brewer.  The poor sods!  How can dwarves live like that?)

King McAnvil...may not have been entirely happy with your suggestion.  And so now you've been assigned to the latest expedition, on pain of being Hammered by the Captain of the Guard.  

(Many humans think that dwarves like getting hammered - sadly, in dwarven culture, being Hammered is not a metaphor, and involves no alcohol and a very big hammer.)

At least he's agreed to let you select the workers for your expedition.  And you're sure his mood will improve if your expedition ends with a thriving trade fort.  No dwarf can remain grumpy for long in the presence of heaps of coin and well-crafted goods.  After that, he might be more willing to hear out your ideas.

If you are successful, a new chapter of Dwarven history will begin with your fort!  And either way, this should be Fun! Strike the earth!

DATA & OBJECTIVES

*not actually true.

I'll aim to post the ruleset and results on August 15th (giving one week and one-and-a-half weekends for players).  If you find yourself wanting extra time, comment below and I can push this deadline back.

As usual, working together is allowed, but for the sake of anyone who wants to work alone, please spoiler parts of your answers  that contain information or questions about the dataset.  To spoiler answers on a PC, type a '>' followed by a '!' at the start of a line to open a spoiler block - to spoiler answers on a mobile, type a ':::spoiler' at the start of a line and then a ':::' at the end to spoiler the line.

26 comments

Comments sorted by top scores.

comment by philip_b (crabman) · 2022-08-07T13:12:40.387Z · LW(p) · GW(p)

What role do I, the data scientist dwarf, have?

Replies from: aphyer
comment by aphyer · 2022-08-07T15:09:51.938Z · LW(p) · GW(p)

You have no role and no effect - your fort will behave identically to a fort with the 13 dwarves you select and no-one else. 

This is for game simplicity reasons - if you want a fluff explanation, you can imagine that you have a profession of your choice and are taking the place of one of the dwarves of that profession.  I'll edit the doc to include this.

comment by Yonge · 2022-08-10T19:43:47.572Z · LW(p) · GW(p)

A few observations:

  - There is a weak correlation between expedition size and the probability of the fort surviving, so we should choose 13 dwarves.
   - Farmers and brewers are crucial to the survival of the city. Specialising in one type seems more efficient than having both. 6 farmers or 6 brewers guarantee survivial, but if you have a mixture you need at least 10. Farmers seem slightly better than brewers. 3 farmers give > 99 percent survival, but 4 brewers are needed to do as well. Warriors marginally increase survival odds when there are fewer farmers and brewers, but nothing else seems to have a positive impact.
- Miners seems to generate most of the value
   - Having one woodcutter offers a meaningfull boost, but there doesn't seem to be much benefit in haveing more. The boost is biggest at low coal values
   - Forts with 2 warriors seems to do best, though the gap between 1 and 2 seems to be modest, and maybe due to them haveing fewer lower value types.
   - Haveing 1 smith provides a modest beenfit, though haveing more is counterproductive.
   - Crafters are similar to warriors, except the effect is much smaller.
   - When no smiths or craftsmen are present then the for value is significantly reduced. 
   - Smiths and crafters do better when different resources are present.
 

 Which suggests something like this is needed to maximise value, subject to the constraint of minimising the risk of loseing the fort:
   - 6 farmers
   - 1 warrior
   - 1 crafter
   - 1 smith
   - 4 miners
   
   An alternative strategy which accepted a small risk of fort loss in exchange for makeing much more money would be:
   - 3 farmers
   - 1 warrior
   - 1 woodcutter
   - 1 crafter
   - 1 smith
   - 6 miners

Replies from: Yonge
comment by Yonge · 2022-08-11T20:05:18.693Z · LW(p) · GW(p)

Some more observations:

 - Having no farmers, brewers or warriors leads to 100 percent expedition failure. If there is a warrior present there is a small chance of success (Raiding for food?).
- The chances of failure when there are >= 4 farmers present and no brewers/warriors is statistically indistinguishable from about 99.5 percent regardless of the number of farmers. 3 farmers with no warriors/brewers gives a much lower success rate. Adding warriors only makes a distinguishable difference when the number of farmers is small.
 - 4 brewers and no farmers/warriors do about as well as the farmers, but 3 brewers do better, but 1 or 2 do worse. Adding warriors only makes a difference when the numbers of brewers is small.
 - Looking at forts with 4 farmers the additional value of each additional miner decreases, so we shouldn't go too miner heavy. In particular there is a sharp decrease after 5.
 - 3 miners and 1 smith is better on average than 4 miners. 2 miners and a smith is about as good as 3 miners when no crafters are present. A similar pattern holds for crafters.
 - Crafters do better than average when silver or hematite is present, a bit better than average when tin or copper are present, but don't do well with magnetite or gold
 - Smiths do better than average when hematite is present , a bit better than average when tin and copper are present, average when magnetite is present, but worse than average when silver or gold is present.    
 - Warriors do better than average when copper and hematite, about average when hematite, magnetite and silver is present and worse than average when gold is present
- The average for smiths is better than for crafters which is in turn better than warriors.
     
  Which lead me to the following provisional roster
    
    - 4 farmers
    - 5 miners
    - 2 smiths
    - 1 crafter 

    - 1 warrior

-

Replies from: Yonge
comment by Yonge · 2022-08-12T20:05:16.137Z · LW(p) · GW(p)

 After staring at the data a bit more:

  • Woodcutters are only valuable at low coal levels. At coal level 1 an extra miner is consistently more valuable than a woodsman
  • Brewers seem to be actively harmful to fort value.
  • There is a big fall in fort value when no warriors are present.
  • The previously observed drop off in the value of additional miners after 5 seem to occur because it makes it less likely for other valuable types to be present, not because it is intrinsically bad. 6 miners and 2 smiths/crafters seems to be much better than 5 miners and 3 smiths/crafters.

My final selection for the fort of Magh Loduhr is therefore:

  • 4 farmers
  • 6 miners
  • 1 smith
  • 1 crafter
  • 1 warrior
Replies from: GuySrinivasan
comment by SarahNibs (GuySrinivasan) · 2022-08-13T04:27:00.929Z · LW(p) · GW(p)

"The previously observed drop off in the value of additional miners after 5 seem to occur because it makes it less likely for other valuable types to be present, not because it is intrinsically bad."

My go-to check when there's decent data is to compare P(something | N miners, M dwarves) to P(something | N-1 miners, M-1 dwarves).

comment by simon · 2022-08-09T03:33:11.336Z · LW(p) · GW(p)

initial observations and analysis:

Different resources seem anticorrelated, including coal level. 

All non-coal resources seem about equally common.

Coal is skewed so that higher values are much more common.

There is never less than 4 total coal level + quantity of other resources (perhaps due to dwarves not sending expeditions to anything less?). The coal skew is too much to be explained by this, but I haven't checked if it can explain the general anticorrelation.

Expedition size looks like 9+2d4, all professions equally common, didn't notice anything that would suggest non-randomness.

Larger expeditions tend to do a lot better than smaller ones.

Miners are in general by far the best profession for fort value, though not good for survival.

Farmers, Brewers and Warriors are the best professions for survival, especially Farmers.

All other professions look bad in terms of correlations with either measure of success.

However,  high value forts generally don't have a lot of missing professions, suggesting that some value is obtained by keeping around lower-effectiveness professions instead of min-maxing. Even crafters, who on average are by far the worst profession for fort value with our resources.

so... GuySrinivasan's proposal looks pretty good.

However:  the highest value forts with our non-coal resource combination in light forest, while they tend to have lots of miners, also tend to have a decent number of smiths. On the other hand, on average miners still get good value, and smiths bad value, even with these resources. Which suggests smiths might have some narrower requirements to get good value out of. Something to look into.

Among expeditions which were the best for their size and resource combinations, while they tend to have a lot of miners,  our resources are correlated with them having less miners, and more smiths. So, the hypothetical smith-based strategy might be especially viable with our specific resources.

Also warriors might be better for value in our biome than farmers, and while I see that several 1/1/1 Farmer/Brewer/Warrior expeditions failed in the Light Forest biome with our non-coal resources (and even with our value of 1 coal), I didn't see any 1/1/2 failures.

Also smiths might have synergy with warriors, both based on priors and based on, among top forts for their resources combos, smiths and warriors being relatively weakly anticorrelated compared with most other profession combos. (Brewers and miners are positively correlated among top forts though! hmm)

So, though I'd like to further analyze the smith strategy (and really, it would be more prudent to go with miners until I understand it) and also what exactly causes failure, I for now will go with:

Miners: 4
Smiths: 3
Woodcutters: 1
Farmers: 1
Brewers: 1
Warriors: 2
Crafters: 1

Edit: meh, looking at general stats (not specifically at these resources), combined with the initial evidence for smiths being really weak, was making me really nervous about smiths even before seeing yonge's report that more than one smith is counterproductive . 

Replies from: simon
comment by simon · 2022-08-12T05:16:51.252Z · LW(p) · GW(p)

A recurring theme to my thoughts on this one:

Entropy. For any criteria we filter the dataset by, the results will tend to be skewed toward high entropy, and low-entropy criteria will reduce the amount of data. Examples:

If at least 3 farmers or at least 3 brewers never fail for size 13 forts as long as there are 4 or fewer miners, but 5 miners requires 4 farmers or brewers and 6 miners requires 5 farmers or brewers to achieve the same result, does this mean that miners eat more food or does it mean that extra miners cause the fort to fail for an unrelated reason (e.g. they delve too greedily and too deep), and requiring more farmers/brewers simply reduces the number of cases to the point that the Balrog simply didn't show up for those combinations in the dataset?

Is a split of <n> brewers and farmers really worse than <n> brewers or <n> farmers alone, or does requiring <n> brewers or <n> farmers just reduce the probability that there are enough miners to summon the Balrog?

partial followup for the above:

For size 13 forts, at least 3 total brewers and farmers is 100% effective against fort failure as long as there are no more than 4 miners.

I was hoping to see some protection from warriors in forts with at least 3 total brewers and farmers and lots of miners (to confirm my guess that the alternative threat, if it exists, might be something that warriors would fight) but the numbers of data points are low, and maybe there's some benefit for 1 warrior over 0, but more warriors than 1 seems likely harmful for some reason (is there something else needed to defeat the Balrog, if it exists, that they are displacing? or are they just displacing farmers and brewers, and there's no Balrog but miners eat more food after all?) (edit: this was specific to size 13 and low data, likely random)

later added remarks: 

Not seeing convincing evidence of anything really affecting failure from the Balrog other than number of miners. 

Food threshold to guarantee no non-Balrog fort failure increases to 4 farmers+brewers for fort sizes 14+.

Balrog miner threshold seems independent of fort size. Fort failure rate for forts with enough food producers for their size is about 1 in 220 for 5 miners, 1 in 13 for 6 miners, 1 in 5 for 7 miners, 1 in 4 for 8 miners, and literally 1 in 3 (only 3 data points) for 9 miners.

Replies from: simon
comment by simon · 2022-08-14T03:55:11.316Z · LW(p) · GW(p)

More on survival:

Farmers/Brewers/Warriors Fail rate, restricting to 4 Miners and below (to avoid the Balrog), and considering size 13 in Light Forest only:

2/0/0 100%

1/1/0 100%

0/2/0 100%

2/0/1 ~35%

1/1/1  ~50%

0/2/1 100%

2/0/2 0%

1/1/2 0%

0/2/2 ~35%

Additional warriors beyond two don't seem to make a difference (at least for this biome and size).

This is all biome related; Tundra at size 13 for instance has quite a small (1/19) fail rate with 2 Farmers, 0 Brewers and 0 Warriors. Size also matters (at least 13 and under vs 14 and over) as previously noted.

I'm confused as to interpretation of this, but there's a practical takeaway that the following should be sufficient for survival for expedition size 13 in Light Forest (sample sizes low but sharpish 100-to-0 cutoffs are giving me (perhaps unjustified) confidence):

At most 4 miners, plus any one of:

2 total Farmers and Brewers, at least one of which is a Farmer, plus at least 2 Warriors, or

At least 3 total Farmers and Brewers (as previously noted).

Replies from: simon
comment by simon · 2022-08-14T16:27:27.314Z · LW(p) · GW(p)

Current proposal:

 (I want to survive, but not devote additional resources to survival than needed, but it seems warriors are useful to value, and I think abstractapplic is probably correct about ore-based and wood-based pathways, but I think ore-based is better) :

Miners: 4

Smiths: 3

Woodcutters: 1

Farmers: 1

Brewers: 1

Warriors: 2

Crafters: 1

Wait, that's exactly what I had before and crossed out, lol.

comment by SarahNibs (GuySrinivasan) · 2022-08-08T05:14:42.371Z · LW(p) · GW(p)

Miners: 5
Smiths: 1
Woodcutters: 1
Farmers: 2
Brewers: 1
Warriors: 2
Crafters: 1

I expect to survive: in the Light Forest, 2 Farmers and 2 Warriors seem necessary for good odds and also sufficient for great odds. I suspect the Brewer is not needed, except that obviously the Brewer is needed. I expect my profits are not maximized without some rearrangement; I didn't try to account for which resources were present much at all.

comment by gammagurke · 2022-08-14T22:21:03.125Z · LW(p) · GW(p)

My selection:
4 miners, 2 smiths, 1 woodcutter, 1 farmer, 1 brewer, 2 warriors, 2 crafters

 

Considerations:

Miners:
Miners are clearly the best at producing value, but, as others have pointed out, some forts seem to inexplicably die if they have a lot of miners. I'm too lazy to do some deeper analysis of whether some combinations of metals make this more or less likely or something, so I'm just gonna cap our miners at 4.

Food:
2 farmers + 2 warriors or 1 farmer + 1 brewer + 2 warriors seems to be (exactly) enough for such a small expedition in all cases, and a single brewer seems to be good for value

Value:
As many miners as possible, at least one crafter and smith.

Fuel:
We should be good with one woodcutter, in light forest at scarce coal.

for the last 2 dwarves, I'm going with one smith and one crafter. I'm not sure the 3rd smith does anything (one smith can make bronze gear, the other iron gear, while the silver goes to the crafters who maybe also get stuff from the woodcutter).

comment by Alexander Ledovsky (alexander-ledovsky) · 2022-08-14T21:49:09.431Z · LW(p) · GW(p)

Used gradient boosting as a surrogate model + genetic search

Miners sent 6

Smiths sent 2

Woodcutters sent 0

Farmers sent 1

Brewers sent 2

Warriors sent 1

Crafters sent 1

https://github.com/alex-ledovsky/my-notebooks/blob/master/Dwarves%20and%20Data%20Science.ipynb

Condition applied - Farmers + Brewers >= 3 (survivability = 99%)

Replies from: alexander-ledovsky
comment by Alexander Ledovsky (alexander-ledovsky) · 2022-08-15T20:30:27.881Z · LW(p) · GW(p)

Hi, guys! I'm kind of new here =)

Did I understand the problem right? I understood the problem as "Build an algorithm which finds the best distribution of 13 dwarves in order to get maximum expected fort value"

I looked through the solutions of others and saw mostly insights from the data. Was I right to apply ML/optimization? I mean, no one else did anything similar and maybe I understood the problem wrong... (maybe the problem is to understand and explain how the game works or smth else)

Replies from: aphyer
comment by aphyer · 2022-08-15T21:02:45.831Z · LW(p) · GW(p)

The goal is to perform as well as possible on the stated task (in this case maximizing survival odds and fort value) - I'll be posting a wrapup doc this evening where you'll be able to see how well you did (both in comparison to King Urist's existing strategy and in comparison to other players).

You can pursue this goal however you want - manual analysis, machine learning, psychoanalysis of the GM, ouija boards - scoring is based on how well you do on the task, not how you arrive at your answer.

Historically, though, ouija boards have not performed well, and the top performance has come from a mix of 'looking for insights from the data' and 'blindly applying gradient descent models'.

Always glad to see new players, I hope you had fun!

comment by abstractapplic · 2022-08-13T21:14:26.689Z · LW(p) · GW(p)

My allocations:

4x Miner, 2x Woodcutter, 2x Warrior, 2x Crafter, 1x Brewer, 1x Farmer, 1x Smith

The handful of (dubious) insights that no-one seems to have had yet, which motivate the (slight) differences between this setup and everyone else's:

  • We have enough data that it makes sense to filter out everything that isn't Light Forest Biome before doing any analysis.
  • There seems (?) to be a threeway synergy between Warriors, Woodcutters and Crafters in this biome. (Ad hoc explanation: Woodcutters cut down trees, Crafters make things from the wood, Warriors stop the Elves from retaliating).
  • More specifically, it seems like the two sources of income are wood-based goods (per the point above) and ore-based goods (Miners / Smiths / maybe Crafters here too). This is important because ore-based goods need Miners, and we can't have >4 Miners without exposing ourselves to more danger than I'm comfortable with. 
  • Therefore, my strategy is to get as much as possible from ore-based goods (which seem more profitable in general, and don't suffer from diminishing returns w.r.t mandwarfpower), but fill in the gaps with wood-based goods.

The most important detail:

I have decided to call my fort Treeslaughtered.

comment by Noosphere89 (sharmake-farah) · 2022-08-11T23:54:02.075Z · LW(p) · GW(p)

I'll join in this game for the first time! So my strategy is:

4 farmers

5 miners

2 smiths

1 crafter

1 warrior

I haven't tried analyzing the data yet due to being on the phone, but my first strategy is here. I hope I get lucky.

Oh my gods I can't spoiler anything, even with the help given.

Replies from: thomas-kwa, aphyer
comment by Thomas Kwa (thomas-kwa) · 2022-08-11T23:56:07.016Z · LW(p) · GW(p)

Your spoiler is broken!

Replies from: sharmake-farah
comment by Noosphere89 (sharmake-farah) · 2022-08-11T23:59:21.478Z · LW(p) · GW(p)

How so? I don't know how to solve that problem.

comment by aphyer · 2022-08-12T00:09:05.648Z · LW(p) · GW(p)

Welcome! I've had trouble spoilering on mobile too, if nothing else works try copy-pasting some existing spoilers and editing?

Replies from: sharmake-farah
comment by Noosphere89 (sharmake-farah) · 2022-08-12T00:17:14.162Z · LW(p) · GW(p)

How do you do that by copy and pasting spoilers? I have no clue how to spoiler on mobile.

Replies from: aphyer
comment by aphyer · 2022-08-12T00:43:18.780Z · LW(p) · GW(p)

Ah, found it: on mobile type ':::spoiler' before your text and ':::' after your text.

Replies from: sharmake-farah, sharmake-farah
comment by Noosphere89 (sharmake-farah) · 2022-08-12T01:03:11.349Z · LW(p) · GW(p)

Actually, something broken about that spoiler. I'll try again.

comment by Noosphere89 (sharmake-farah) · 2022-08-12T00:58:47.471Z · LW(p) · GW(p)

Can you in the future give these instructions for mobile users in order to avoid confusion?

Also, this is my first time playing D&D Sci.

Replies from: aphyer
comment by aphyer · 2022-08-12T01:20:40.360Z · LW(p) · GW(p)

Yes, I'll add instructions to the doc. It looks to me like the problem is that you're trying to spoiler part of a line, and I think you can only spoiler a whole line at once - type the spoiler text at the start of a line rather than midline.

If that doesn't work don't worry about it, I'll chase around someone from the site who understands the text editor better than me and in the meantime it won't be a problem if your answer is unspoilered.

Sorry for the confusion.

Replies from: sharmake-farah
comment by Noosphere89 (sharmake-farah) · 2022-08-12T01:28:37.740Z · LW(p) · GW(p)

I don't know or it doesn't work, so I'll just not spoiler it.

comment by aphyer · 2022-08-12T00:20:26.110Z · LW(p) · GW(p)
comment by aphyer · 2022-08-12T00:15:28.684Z · LW(p) · GW(p)