With everything from one apartment very nearly moved into another, I found some time to work on the ol' talent-luck simulator again.
No new results this time. Instead I modularised and cleaned the code so that it's much easier to modify, and added a bunch more comments so it should be easier to play around with. I also implemented a new method that runs about 100x faster than the old version, though the results are not yet in good enough agreement to be trustworthy. The old method, based on the Pluchino paper, has events as objects that move around the world in a random walk. This means each agent has to check if it's in range of every event, which is slow (500,000 checks per timestep).
For the new method, I ran 10 simulations which output the number of events occuring at each timestep to get an event frequency distribution. The new method approximates this as a Gaussian. So a random number of agents is chosen based on this distribution at each timestep, and for each of them some number of events happen. The luck status of each event is assigned to be random in this case. Hence the agents should have roughly the same rate of good events and bad events occuring. And this is massively faster because there are typically only 40 agents that need to be evaluated.
This nearly works. The basics are there but the details disagree, in particular the fraction of wealth held by the 20% richest is closer to 60% rather than 80%, and the slope of the wealth distribution is a different shape and not a simple power law. I haven't had time to check why this is yet : it could be I'm doing something subtly wrong with the new method (I have some suspicions as to what that might be), or that the event frequency distribution isn't as good an approximation to a Gaussian as it appears on a cursory inspection. Still, I'm hopeful this will allow much larger numbers of simulations and more thought behind the underlying method, rather than just endless comparisons to the original model. That's much easier to do when the thing runs in 30 seconds instead of 8 minutes (most of the time is now taken up by plotting, and I expect that to more or less disappear if I run it offline instead of through repl).
https://repl.it/@RhysTaylor1/TalentVersusLuck
Sister blog of Physicists of the Caribbean in which I babble about non-astronomy stuff, because everyone needs a hobby
Subscribe to:
Post Comments (Atom)
Review : Pagan Britain
Having read a good chunk of the original stories, I turn away slightly from mythological themes and back to something more academical : the ...
-
"To claim that you are being discriminated against because you have lost your right to discriminate against others shows a gross lack o...
-
I've noticed that some people care deeply about the truth, but come up with batshit crazy statements. And I've caught myself rationa...
-
For all that I know the Universe is under no obligation to make intuitive sense, I still don't like quantum mechanics. Just because some...
It sounds like the old way (Pluchino method) reimpacted agents more per event, so that the new model has blunted that, hence the more even wealth distribution.
ReplyDeleteI really can't wait to take a look at your code.
I wrote a similar simulation engine as the backbone for a planned game that was never completed... Very different premise technically, but mechanically similar to what you're describing. Love this stuff.
Jason Nichols Thanks !
ReplyDeleteIn an earlier test, I found that the distance the events move (first two panels on the lower row, incorrectly labelled as "agents move") makes a big difference to the wealth distribution. So as you say, I suspect the agents are getting a few more events than from pure chance. I think I need to measure the mean event frequency per agent and see how much higher that is than chance.
https://lh3.googleusercontent.com/YtNscPxn63fizycZgBhlhuLVgWuBBWIBVy6lazO2ZWWltLgaLVcBU7OJhOOcGD9kWJv6kvR8akpsP9BZFBopQ6neNTBJxGAB6Svn=s0