The size of cities after map creation. May 30, 2010, 07:24:19 pm The size of cities after map creation should follow Zipf's distribution.http://www2.econ.uu.nl/users/marrewijk/geography/zipf/index.htm,http://www.nslij-genetics.org/wli/zipf/ Quote Selected
Re: The size of cities after map creation. Reply #1 – May 30, 2010, 08:29:07 pm Inkelyad,this looks very interesting, although I haven't had a chance to try it yet as I'm currently away from home. Looking at your patch, it doesn't seem that this is specific to Simutrans-Experimental, and could work equally well in Simutrans-Standard. I'll move the topic to the standard development and bug reports, patch releases folder so that the Standard developers can have a look at this one. I shall also have a look at it when I get the chance, if it hasn't already been slated for inclusion in Standard by then. Edit: May I ask - how does it work for you when you test it? Quote Selected
Re: The size of cities after map creation. Reply #2 – May 30, 2010, 09:43:29 pm The current generation is already 25000*mean_number/(simrand(20000)+100) (the 100 is just to avoid too large towns). Thus this is already close to said distribution. Quote Selected
Re: The size of cities after map creation. Reply #3 – May 30, 2010, 09:53:40 pm Inkelyad,do you notice a major difference in practice between the original version and your version when maps are generated? Quote Selected
Re: The size of cities after map creation. Reply #4 – May 31, 2010, 04:04:19 pm In current implementation there is almost 10% chance city population willbe greater then mean_number * 10. When city number is 22 that means there isonly 10% chance map will have less then 7 such cities. It is way too often.Zipf's distribution don't do that. It creates only one big city. Quote Selected Last Edit: May 31, 2010, 04:37:01 pm by inkelyad
Re: The size of cities after map creation. Reply #5 – May 31, 2010, 04:32:28 pm Inkelyad,can you give some examples of the maps created with and without your patch - either in a table or with screenshots? It's hard to gauge the effect without a little more detail.Prissi - in your opinion, is Inkelyad right about the difference in distribution between the model in this patch and that in Standard; and which do you think is closer to reality? Quote Selected
Re: The size of cities after map creation. Reply #6 – May 31, 2010, 04:41:27 pm Sorry, my math was wrong. But current implementation really too often makes too big cities. Quote Selected
Re: The size of cities after map creation. Reply #7 – May 31, 2010, 06:58:51 pm Quote from: inkelyad – on May 31, 2010, 04:41:27 pmSorry, my math was wrong. But current implementation really too often makes too big cities.The maths in your patch, in your explanation of the patch, or both? Does that mean that we should not use your patch? Quote Selected
Re: The size of cities after map creation. Reply #8 – May 31, 2010, 07:14:17 pm Math in explanation. I am wrong about "When city number is 22 that means there isonly 10% chance map will have less then 7 such cities". Quote Selected
Re: The size of cities after map creation. Reply #9 – May 31, 2010, 08:30:48 pm In you link Zipf distribution is Pn = 1/n (when alpha=1 what should be often the case, according to the text.) That is exactly the code implemented in Simutrans.The only difference is, that Pn is limited between 25*mean_number < generated number < 0.124 * mean_number. There is a 10% chance for a city larger than 1,19 than mean_number, and a 5% chance for 2.27*mean_number, and a 1% chance for 8.333*mean_number. The probability for a city larger than 10x mean_number is actually 0,66%, i.e. you need on average more than 150 cities until one is larger than 10x mean_number.Since those are random numbers, you milage may vary ... Quote Selected
Re: The size of cities after map creation. Reply #10 – June 01, 2010, 10:50:32 am I'm still not clear on how the patch differs in practice from the current Simutrans implementation... Quote Selected
Re: The size of cities after map creation. Reply #11 – June 01, 2010, 12:44:09 pm A short glance at the algorithm would indicate, that you would always have a guranteed Zipf distribution on your map (with some small jittering) compared to the current, more random one (especially for small number of towns). As this is noticeable in practice: just patch and see. Quote Selected
Re: The size of cities after map creation. Reply #12 – June 01, 2010, 04:28:49 pm Quote from: jamespetts – on May 31, 2010, 04:32:28 pmcan you give some examples of the maps created with and without your patch - either in a table or with screenshots? It's hard to gauge the effect without a little more detail.Yes. See attached OpenOffice OpenDocument Spreadsheet Quote Selected
Re: The size of cities after map creation. Reply #13 – June 01, 2010, 09:25:21 pm Actually, standard has a better Zipf distribution, the slope is exactly -1 ... The main difference between the patch and the unpatched version is, that the mean number is effectively 2.5 higher than in the patched version (well, more precisely rising from 2 to 2.8, since the slope differs a little.) All in all the effect of this patch can be achieved by dividing the mean_citicen number by 2.4 before starting creation. Quote Selected
Re: The size of cities after map creation. Reply #14 – June 01, 2010, 10:50:50 pm Prissi,thank you very much for the graphs - most useful! Inkelyad,did you intend for your patch to have the effect that Prissi describes? Quote Selected
Re: The size of cities after map creation. Reply #15 – June 02, 2010, 02:52:34 pm I just plotted Inkelyads data; so the credit should go to him ... Quote Selected
Re: The size of cities after map creation. Reply #16 – June 05, 2010, 02:10:18 am Quote from: prissi – on May 31, 2010, 08:30:48 pm The probability for a city larger than 10x mean_number is actually 0,66%, i.e. you need on average more than 150 cities until one is larger than 10x mean_number.There is something wrong here. See attached data(100 rows 50 cities each). Rank 1 cities larger then 10*mean_number are too common in "Standard".Quote from: prissi – on June 01, 2010, 09:25:21 pmThe main difference between the patch and the unpatched version is, that the mean number is effectively 2.5 higher than in the patched version (well, more precisely rising from 2 to 2.8, since the slope differs a little.)I beliveve main difference is Rank 1 distributions (see images) Quote Selected Last Edit: June 05, 2010, 02:25:45 am by inkelyad
Re: The size of cities after map creation. Reply #17 – June 05, 2010, 02:11:30 am Quote from: jamespetts – on June 01, 2010, 10:50:50 pmdid you intend for your patch to have the effect that Prissi describes?No.It is hard to get proper "city and satellite towns/villages" map in current implementation. Rank 1 sizes are "too random".The goal was to correct it.But it seems to me I was too successful. Now randomness is too small. Quote Selected Last Edit: June 05, 2010, 02:24:43 am by inkelyad
Re: The size of cities after map creation. Reply #18 – June 05, 2010, 12:04:52 pm Quote from: inkelyad – on June 05, 2010, 02:11:30 amNo.It is hard to get proper "city and satellite towns/villages" map in current implementation. Rank 1 sizes are "too random".The goal was to correct it.But it seems to me I was too successful. Now randomness is too small.Hmm - perhaps a happy medium is to be sought...? Quote Selected
Re: The size of cities after map creation. Reply #19 – June 06, 2010, 05:18:22 pm Quote from: jamespetts – on June 05, 2010, 12:04:52 pmHmm - perhaps a happy medium is to be sought...?Ok. New version. Now number of 'big cities' is player configurable.Option is not persistent yet. I don't want break option savefile compatibility. Quote Selected
Re: The size of cities after map creation. Reply #20 – June 06, 2010, 05:23:46 pm Interesting... can you give some worked examples with map generation with various options? Quote Selected
Re: The size of cities after map creation. Reply #21 – June 06, 2010, 07:24:46 pm Map size: 512x512Median population: 5000Number of cities: 50Number of big cities: 1, 5 and 30 Quote Selected
Re: The size of cities after map creation. Reply #22 – June 06, 2010, 07:26:17 pm Map size: 512x512Median population: 3000, 8000 and 16000Number of cities: 50Number of big cities: 3 Quote Selected
Re: The size of cities after map creation. Reply #23 – June 06, 2010, 07:27:58 pm Map size: 128x128Median population: 1600Number of cities: 30Number of big cities: 1, 5 and 20 Quote Selected
Re: The size of cities after map creation. Reply #24 – June 06, 2010, 08:32:34 pm That's very interesting indeed. I do like the customisability of the new system (which adds something to the existing model). I'd be very interested in people's views on whether this is a good idea, as I'm considering incorporating it into Simutrans-Experimental, if it hasn't already been put into Standard. Quote Selected
Re: The size of cities after map creation. Reply #25 – June 06, 2010, 08:54:23 pm I like the idea. Taking a look at the graphics, for me it's clear that standard Simutrans tends to create much more small cities than large ones. It has sense if you want to power the possibilities of the map. Small cities means less developed areas and more margin for the player to expand the game (put more effort into making cities grow). On the other side, Zipfs customizable maps may add some pepper to the initial conditions of the sceneario. The variety that zipfs generates is flexible but also balanced enough to make the initial conditions interesting.Imho, you should include it at STExp and if players like it, I would estimate the inclusion in ST, too. Quote Selected