• Welcome to SC4 Devotion Forum Archives.

Neighbor Connections - Exact Demand Cap Equation Derived

Started by discozen, December 11, 2017, 01:26:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

discozen

Hello,

Google Sheets Link:
https://docs.google.com/spreadsheets/d/1owj9VmdbtH9wp0E3SfJw3Imw-ARmmFCT1AWn_gbvDtY/edit?usp=sharing

- Here you can find exact equations for finding how much Commercial demand cap relief is provided by neighbor connections.

- Furthermore, some prior information about neighbor connections is proved to be wrong, and some possible bugs were found, which are detailed below.

- Also, I include an optimisation model that you can use to maximise the total demand cap in your city using neighbor connections. Sadly, Google Sheets does not have any add-in for solving non-linear optimisation problems, but you can export to Excel and use a solver supporting non-linear optimisation.




There is a lot of great information on SC4Devotion forums about how everything works in this game; thanks for all that! However, I could not find any solid information on how neighbor connections actually work in raising Commercial demand caps, and some trials I made were inconsistent with available information from the Prima guide and other sources. I am easily obsessed with small details like this, so I spent some time on discovering the exact mechanism used by the game for demand cap relief from neighbor connections.

I tried various model specifications; imagining how the game developers might have been thinking. We know that there is some kind of diminishing returns, so there was somewhere to start from.

I gathered data on actual demand caps by building different types and number of connections in a test city. Then I applied the different potential models on the data using statistical software, trying to find a good fitted equation. Ultimately, I found success with fitting a logarithm based two part model. I refined the coefficients; assuming simpler values were used by the game developers. eg. 1.479 obtained from fitting the model is probably actually 1.5; so I used 1.5.

The resulting equations for each connection type work with less than 1% error on average, which can easily be attributed to noise in the data (eg. rounding errors). I further tested the resulting equations with various combinations of different types of connections. Actual observed values for total demand cap and results from the equations are the same; after some potential bugs I discovered along the way are accounted for (monorails and ground highways).




The general form of the equations is:

Cap Relief = baseCap * ( A + B*ln(c) + C*n/c ), where:

A, B, C = constants for each type of connection
c = total number of connections of this type in the city
n = number of neighbors this type connects to in the city

baseCap = the cap relief you get if this is the very first connection you make in the city.
- Elevated Highway: 160k
- Ground Highway: 100k
- Avenue: 32k
- Road / Rail: 10k
- Subway / Elevated Rail / Monorail: 20k

The first "ln" part of the equation covers the regular diminishing returns from more connections.

The second "n/c" part covers the bonus from making connections to new neighbors, along with again diminishing returns.

- highway/avenue: 0.65 + 0.9*ln(c) + 0.35*n/c

- road/rail/subway/elevated rail: 1.5*ln(c) + n/c

- monorail: 1.5*ln(n)





Some more results from the tests are:

- Some base cap values are actually different from Prima guide values.

- You do not get the full baseCap when you make a first connection to a different neighbor. Prior information about this is incorrect. The cap relief from first connections to different neighbors actually decreases in line with the equations. Still, there is a bonus to the first connection to a neighbor; which is covered by the second part of the equation.

- Number of connections of one type to one neighbor does not matter. Only the first connection made to any neighbor actually has a bonus. So there is no point in trying to make 3 connections of one type to each neighbor for the best bonus.

- Elevated Rail and Subway are counted together; they are the same type. Rail and Elevated Rail are independent.

- Monorail is bugged. Apparently, n is used in place of c, and this makes the second part of the equation useless. As a result, cap relief is obtained only from one Monorail connection to each city; further connections do nothing. Also, the very first Monorail connection in the city does nothing at all, it counts as 0; which is also in line with the equation. Furthermore, if you have another type of connection to a neighbor, making a Monorail connection to that neighbor has no effect at all!

- Ground Highway is similarly bugged. It uses n in place of c. But it still works if other types of connections are present to the neighbor. Still, another issue with Ground Highway is that it uses a baseCap of 100k, instead of 160k on Elevated Highways. Both highways are counted together as one type, and Ground Highways dilute the total cap relief you gain from highways. Thus, Ground Highways are strictly inferior to Elevated Highways in terms of cap relief.

- SimNation counts as one city; which is in line with prior information.

- When highways and avenues are counted as two "connections" per connection, their equations have the same form and coefficients as the rest of the connection types. So everything may actually be in the same form in game code.




Hope this information is useful. Perhaps some of you out there also always wondered how all this actually worked, just like me. :)

matias93

Wow, this is a really genial work on optimisation!  &apls

By any chance, do you know if those formulas are coded on an exemplar or are directly on the executable code? That would give us a hint to find the best route to fix the bugs you researched.

"Lets be scientists and as such, remember always that the purpose of politics is not freedom, nor authority, nor is any principle of abstract character,
but it is to meet the social needs of man and the development of the society"

— Valentín Letelier, 1895

discozen

Thanks!
I scoured the exemplars using ilives reader, but did not find anything about this.
I guess this is why the mechanism for this has been a mystery until now :)

Seaman

That's just great! As a systems engineer/scientist whos dayjob is working with systems analysis and juggling with equations  :-\, I really like your work. I have to admit, I don't know how to use this knowledge, but as you said, that's not the point!

And the best of all: thank you for explaining and sharing with us!