View Full Version : Question re: new commerce cities


futurehermit
Mar 06, 2008, 11:04 AM
Let's say you build a fresh new commerce city with say 1 food source (e.g, grassland cows/rice) with a river running through the bfc and the city is on the river. The rest of the tiles are grassland. It's a nice commerce city, but doesn't have an abundance of food driving its growth.

Let's say you have the health and happiness to grow easily to size 15 right away.

Would it be better to:

1) Cottage the 19 non-food tiles and grow slowly, adding and working cottages along the way?

2) Farm the river tiles and grow to size 15 asap then cottage over the farms?

3) Add a couple farms to help growth, but then add cottages?

Slow growth with max cottages? Fast growth while delaying cottages? Medium growth with a mix of farms and cottages?

madscientist
Mar 06, 2008, 11:13 AM
I would cottage from the get go.

futurehermit
Mar 06, 2008, 11:33 AM
That's what I usually do, but I wonder if it is optimal?

OTAKUjbski
Mar 06, 2008, 11:35 AM
I think it depends on the tech era.

Early in the game, cottage from the get go.

After Printing Press / Free Speech, work enough farms to give yourself +6 :food: and cottage the rest.

CivMcNut
Mar 06, 2008, 11:41 AM
It seems optimal to me to have a few farms in the mix to aid growth, then cottage over them when you get to your desired size. Farm everything and it will take too long to get some villages and towns that you need. Cottage everything, and you'll have some tiles not getting worked for a long time. So I would say medium.

Diamondeye
Mar 06, 2008, 11:43 AM
I presume that the food city yields 6F1C, other tiles 2F1C unimproved.
growing to size 5 with farms would be
22(?) / 6F (4 from ressource, 2 city center) = 4 turns, 4 overflow, +4C
+ 24(?)-4(overflow) / 7F = 4 turns, 6 overflow, +8C
+ 26(?)-6 / 8F = 3 turns, 4 overflow, +9C
+ 28(?)-4 / 9F = 3 turns, 3 overflow, +12C
+ 30(?)-3 / 10 = 3 turns, 3 overflow, +15C
= 17 turns, totally yielding 48 Commerce without the commerce from city square.

Cottages would be:
22(?) / 6F = 4 turns, 2 overflow, +4C
+ 24(?)-2 / 6F = 4 turns, 2 overflow, +12C
+ 26(?)-2 / 6F = 4 turns, 0 overflow, +20C
+ 28(?) / 6F = 5 turns, 2 overflow, +38 (3 from 1 grown cottage)
+ 30(?)-2 / 6F = 5 turns, 2 overflow, +49 (5 from previously grown cottage, 4 from new grown cottage)
= 22 turns, totally yielding 123 commerce, without the commerce from city square.

the 5 turns in the first example can be converted into 45C (2 from each cottage and 1 from farm), resulting in a total of 93C. Add to this that the cottages in the second example has grown reasonably more than the first.
I don't have the concentration to continue the math to 15, but atleast early on, I think cottages pay out best. Add to this that :science: has a larger impact the earlier they arrive.

futurehermit
Mar 06, 2008, 11:45 AM
Well, I'm talking mid-game I guess since I'm talking enough health and happiness to hit size 15. Perhaps with an expansive leader and access to corn/wheat/rice asap (which I've had sometimes) and on a river you could hit 15 pretty early, when combined with hereditary rule.

So, let's take that as an example. Let's say you are playing an expansive leader and you have corn in your capital, wheat in city #2 and rice in city #3, which is the city in question. It's artificial, I know, but bear with me.

Let's say you beelined monarchy for HR or took it off the oracle or something. So you're in the BC era still, but you have the means to get this #3 city to size 15 asap.

Should you still just work cottages and grow slowly toward that size 15 cap or should you add more food to grow more quickly?

toug
Mar 06, 2008, 11:45 AM
By the time I could grow a new city to size 15 I'd be so sick of micromanaging that I would set the city for auto optimal commerce, queue the workers to cottage spam and be done with it.

Diamondeye
Mar 06, 2008, 11:48 AM
I'd stick with commerce in that case, as exp makes graneries cheaper, so I'd grow a pop, whip a granery, then just grow with the 6F from the corn. It'd take only 2-3 turns per pop. Farms for one extra food will puch the barrier between 2 and 3 turns by one pop only, not worth it.

futurehermit
Mar 06, 2008, 11:51 AM
In the city in question you only have let's say irrigated rice 5F = +3. Is it worth growing on +3 food only, especially as the city grows in size where more food is needed?

Diamondeye
Mar 06, 2008, 11:56 AM
In the city in question you only have let's say irrigated rice 5F = +3. Is it worth growing on +3 food only, especially as the city grows in size where more food is needed?

You forget the free 2f from city square, 5F is definately good to grow on, although adding a farm or two wouldn't bug me.

DaveMcW
Mar 06, 2008, 12:38 PM
My gut feeling is go with +5 and a granary. (Farm 1 grassland if the rice only gives 4f.)

The actual answer depends on how many workers you are able to spare for the city. You want to reach size 15 at the same time the 14th cottage is finished.

futurehermit
Mar 06, 2008, 12:41 PM
You forget the free 2f from city square, 5F is definately good to grow on, although adding a farm or two wouldn't bug me.

Right, that's a good point, I forgot the 2f from the city square. 5F is ok, but I wonder if it's enough to drive the city quickly to working 14 cottages, which is of course the goal?

My gut feeling is farm two grassland to get +5 and a granary.

The actual answer depends on how many workers you are able to spare for the city. You want to reach size 15 at the same time the 14th cottage is finished.

What if we assume infinite amounts of workers? Still 2 farms and a granary?

Diamondeye
Mar 06, 2008, 12:47 PM
Definately a granary, and then, what is the foodreq with granery for size 8 (mid between size 1 and 15, meaning that the entire food required for 1->15 will be dividable with the amount size 8 reqs).
So, if size 8 reqs 18 with granary, 6F surplus constantly would get you to size 15 at (15*18/6) = 45 turns with no overflow. That is if 6F is obtainable with one worker. If only 5, it'll take one turn more, and with 3 surplus.

patagonia
Mar 06, 2008, 12:53 PM
If you've all the workers you could possibly want, my gut feeling would be to have about 8-10 farms, before adding cottages and cottaging over the farms you've built.

Assuming you're running slavery rather than emancipation, you'll want to whip a granary, library, courthouse and university to get what's a low-production city off to a good start, which will likely mean cycling between size 3-6 or 4-8 to get the larger buildings whipped. This means you want to maximise food for that phase of city development, requiring a corresponding number of farms.

DaveMcW
Mar 06, 2008, 01:02 PM
With infinite workers, farm everything and convert everything to cottages when you hit 15. ;)

oyzar
Mar 06, 2008, 01:08 PM
I seriously doubt it is worth to go over the 4 or 5 food you get from the resource for only a size 15 city.. I did some calcs on it some time ago at some different circumstance where we found out it was not worth to farm from 2 to 3 food(although that was only happy cap 7 or something). Going from 4 to 5 is such little gain though that you are prolly not up in commerce by the time you hit the happy cap...

futurehermit
Mar 06, 2008, 01:11 PM
With infinite workers, farm everything and convert everything to cottages when you hit 15. ;)

this is what I was looking for. so, basically, ideally you would want to grow to 15 asap and then swap the farms out for cottages immediately.

the situation that prompted this thread was that I founded this kind of city mid-game. i had a bunch of spare workers at the time and i wasn't sure if it would be better to farm then switch or just grow slowly (most of my other cities were size 15+ at this point and i wanted the new city to join them asap).

thanks all!

silverbullet
Mar 06, 2008, 01:16 PM
What I usually do is to farm only until there is infrastructure in place. I use slavery+forge+organized religion to get max output from whipping buildings.
Typically I would whip granay, forge, courthouse, library and perhaps more buildings later. When the city is new my goal is to get the infrastructure as quickly as possible. Since some buildings will require whipping 3 pop, it is important to get to size 6 fast.
There are exceptions though. A financial leader with grassland would probably make it better to cottage the riverside ASAP and get immediate 3 commerce per tile.
I didn't check the math... but I like whipping so I farm a lot.

oyzar
Mar 06, 2008, 01:19 PM
this is what I was looking for. so, basically, ideally you would want to grow to 15 asap and then swap the farms out for cottages immediately.

the situation that prompted this thread was that I founded this kind of city mid-game. i had a bunch of spare workers at the time and i wasn't sure if it would be better to farm then switch or just grow slowly (most of my other cities were size 15+ at this point and i wanted the new city to join them asap).

thanks all!

Pretty sure this isn't the case... Food does only so much...

GKrause
Mar 06, 2008, 01:24 PM
Something to consider is that if you're at the stage of the game where 15s are easy to obtain on your caps, then you presumably have or will soon have access to watermills and decent workshops (through CS, guilds, and possibly chemistry). CS especially brings up the point that you might not be in slavery anymore. So in addition to balancing pure population growth to get maximum worked tiles vs. time for cottages to mature, where does production fall? Surely if you want to be a great commerce city, you're going to want the science and/or gold multiplying buildings (and especially a granary which you might not be able to whip) in order to maximize your yield for the commerce.

So it would seem to me that with a good food resource, you still may want to not only workshop and/or watermill some tiles, but also farm one or two tiles as well to make up for the potential cut out of the surplus that workshops will incur, taking into consideration Replacable Parts, chemistry, and potentially guilds if not already known) bonuses to production that will come into play down the line.

Krikkitone
Mar 06, 2008, 01:52 PM
One other point is Developing the commerce city, if you are running US then cottages alone is OK, otherwise slavery with farms is probably the ideal before cottaging.

(after all a Riverside Cottage + Library + University= Riverside Hamlet

spoooq
Mar 06, 2008, 01:55 PM
The final :commerce: per turn is exactly the same in both cases, so whoever has the most accumulated commerce at the point when both totals turn parallel wins. Also, by that time, all cottages will have experienced their complete and equal lower-income growth period, so that is irrelevant. Only the number of full town-turns accumulated by the end of all cottage-growth can affect the result. If the city-slickers gain more gold in the early days than the farmers can catch up in the period between the farmers hitting max pop and the city-slickers hitting max pop, they win. This is not a particularly useful observation, but maybe it will help someone come up with an algorithm.

Maestro_Innit
Mar 06, 2008, 01:58 PM
I can't wait for a definitive ansdwer -= I've often pondered this one myself :mischief:

spoooq
Mar 06, 2008, 02:06 PM
I think the answer will have to be in terms of "how many food resources does it take to beat cottages?". My guess is somewhere between zero and infinity (where infinity is equal to or greater than 21). Infinity may not be enough, but I would guess the real answer is less. :D

VoiceOfUnreason
Mar 06, 2008, 02:10 PM
What assumptions do you want to make about other population related concerns (example: trade routes)?

Bleys
Mar 06, 2008, 02:25 PM
I think its a case of how advanced you are. If you have CS, you can build a single riverside farm, then add a chained farm or two (not every tile is by a river, right?), and cottage over the rest of the riverside tiles. I do this often with new commerce Jungle cities. In fact, if possible, I try to chain in a farm from a nearby city instead, leaving all the riverside tiles for immediate cottaging.

I have even started farming over Calendar resources in some cases. I have a game going with Willem, where I only had 2 AH food sources, a couple FPs, and 2 non-jungle, riverside Dye tiles. I didnt want to farm the FPs, then have to cottage over them later, since it was still the beginning of the game and thats a LOT of worker turns, so I farmed the dye tiles first, while I was researching to Pottery, to fuel growth (they function like oasis's, 3 food, 3 commerce, with a FIN leader). This allowed me to put off AH for a while, since there was no real hurry to pasture Plains cows or Grass Hill Pigs.

Artichoker
Mar 06, 2008, 02:31 PM
this is what I was looking for. so, basically, ideally you would want to grow to 15 asap and then swap the farms out for cottages immediately.

the situation that prompted this thread was that I founded this kind of city mid-game. i had a bunch of spare workers at the time and i wasn't sure if it would be better to farm then switch or just grow slowly (most of my other cities were size 15+ at this point and i wanted the new city to join them asap).

thanks all!

I also like the concept of fast city growth...but the one factor that is not considered here is the development of those Cottages into Hamlets, Villages, and Towns.

I'd say go for a compromise and realize that you won't have infinite workers. So the goal would be to minimize the worker turns spent changing farms to cottages, while still allowing fast growth.

You could achieve this goal by building a few cottages at the very beginning, but build farms as well to speed up the growth. The advantage is that after many turns, those cottages will evolve into higher-commerce tiles.

VirusMonster
Mar 06, 2008, 02:49 PM
I could work out the math on this problem, but I don't think it'll be much help without other game variables such as presence of universal suffrage, freespeech, biology, overexpansion, etc.... It is very hard to make overgeneralizations for a question like this.

Intuitively, it makes most sense to work only farms until you grow size 6-8, and only start working more cottages gradually after. Why? Because at size 8, you will start reaching the health and happiness caps and must slowdown city growth. You should not work the cottages early on, because every turn you are wasting valuabe health and happiness cap.

In reality, the happiness and health caps do not jump to 15 instantly. They get there gradually. So what makes most sense, imho, is work only farms until your city size reaches 50% of the health and happiness cap. Then, start assigning the citizens above the 50% happiness and health cap to cottages. It should give you the optimal commerce&growth scenario.

vicawoo
Mar 06, 2008, 03:00 PM
The math is harder than it sounds, because growth is discrete and that recursively affects food and commerce.

Artichoker
Mar 06, 2008, 03:01 PM
I could work out the math on this problem, but I don't think it'll be much help without other game variables such as presence of universal suffrage, freespeech, biology, overexpansion, etc.... It is very hard to make overgeneralizations for a question like this.

Intuitively, it makes most sense to work only farms until you grow size 6-8, and only start working more cottages gradually after. Why? Because at size 8, you will start reaching the health and happiness caps and must slowdown city growth. You should not work the cottages early on, because every turn you are wasting valuabe health and happiness cap.

In reality, the happiness and health caps do not jump to 15 instantly. They get there gradually. So what makes most sense, imho, is work only farms until your city size reaches 50% of the health and happiness cap. Then, start assigning the citizens above the 50% happiness and health cap to cottages. It should give you the optimal commerce&growth scenario.

Not even 1 or 2 cottages at the very beginning? How about a city size of 4 with a cottage?

You mention the value of the health and happiness cap, but what is the main purpose of this? At size 8, you are working 1 Food Resource and 7 Farms (with +1 commerce from River). That's a total of 8 Commerce (including the city tile).

Suppose you had instead 1 Food Resource, 6 Farms, and 1 Cottage. That Cottage will be a Hamlet by then, producing 3 Commerce per turn. So, by having the early Cottage, you will have 10 Commerce (including the city tile).

Or, at size 8, 1 Food Resource, 5 Farms, and 2 Cottages. That will be 12 Commerce per turn, which is 50% more than working 7 Farms.


Here's an idea (I'm not claiming this to be mathematically correct or anything of that sort):

size
1 1 Rice
2 1 Rice, 1 Farm
3 1 Rice, 2 Farms
4 1 Rice, 2 Farms, 1 Cottage
5 1 Rice, 3 Farms, 1 Cottage
6 1 Rice, 4 Farms, 1 Cottage
7 1 Rice, 4 Farms, 2 Cottages
8 1 Rice, 5 Farms, 2 Cottages
9 1 Rice, 6 Farms, 2 Cottages
10 1 Rice, 6 Farms, 3 Cottages
11 1 Rice, 6 Farms, 4 Cottages
12 1 Rice, 5 Farms, 6 Cottages
13 1 Rice, 4 Farms, 8 Cottages
14 1 Rice, 2 Farms, 11 Cottages
15 1 Rice, 14 Cottages

Basically, the idea is to have at least twice as many Farms as Cottages for city sizes 1 to 10.

After city size 10, growth slows down from happiness and health caps. Beginning at city size 12, start to convert the Farms to Cottages.

You will still want to keep at least the Rice at the very end, so you can run specialists.

VirusMonster
Mar 06, 2008, 04:23 PM
Not even 1 or 2 cottages at the very beginning? How about a city size of 4 with a cottage?

You mention the value of the health and happiness cap, but what is the main purpose of this? At size 8, you are working 1 Food Resource and 7 Farms (with +1 commerce from River). That's a total of 8 Commerce (including the city tile).

Suppose you had instead 1 Food Resource, 6 Farms, and 1 Cottage. That Cottage will be a Hamlet by then, producing 3 Commerce per turn. So, by having the early Cottage, you will have 10 Commerce (including the city tile).

Or, at size 8, 1 Food Resource, 5 Farms, and 2 Cottages. That will be 12 Commerce per turn, which is 50% more than working 7 Farms.


Here's an idea (I'm not claiming this to be mathematically correct or anything of that sort):

size
1 1 Rice
2 1 Rice, 1 Farm
3 1 Rice, 2 Farms
4 1 Rice, 2 Farms, 1 Cottage
5 1 Rice, 3 Farms, 1 Cottage
6 1 Rice, 4 Farms, 1 Cottage
7 1 Rice, 4 Farms, 2 Cottages
8 1 Rice, 5 Farms, 2 Cottages
9 1 Rice, 6 Farms, 2 Cottages
10 1 Rice, 6 Farms, 3 Cottages
11 1 Rice, 6 Farms, 4 Cottages
12 1 Rice, 5 Farms, 6 Cottages
13 1 Rice, 4 Farms, 8 Cottages
14 1 Rice, 2 Farms, 11 Cottages
15 1 Rice, 14 Cottages

Basically, the idea is to have at least twice as many Farms as Cottages for city sizes 1 to 10.

After city size 10, growth slows down from happiness and health caps. Beginning at city size 12, start to convert the Farms to Cottages.

You will still want to keep at least the Rice at the very end, so you can run specialists.

There could be a golden ratio of farms to cottages that yield the maximum commerce in the long term, and this ratio could be 2:1 as you claim. To be honest, most of my games follow the scenario you explained :)

What I said at the last parapgrah of my previous post, ie assigning the excesss population above the 50% of the happiness and health cap to cottages, would end up assigning 2-3 cottages in the early game. It will result in a very similar 2:1 farms to cottage ratio you suggested. So we are thinking along the same lines. Then as your cities reach the happiness caps, they will still slowly switch from 2:1 farms to cottages ratio to a 1:1 ratio, and eventually to a 1:2 ratio and even lower ratios.

The main purpose of prioritizing farms over cottages at lower city sizes, as you can easily guess, is to have more citizens who work the cottages later. I am sure the early loss of commerce for not working all cottages will balance out later when more citizens start on working the cottages.

Also, Slavery is a very, very, very strong civic to build those infrastructure faster. With 4 :food: surplus and a granary, a size 10 city can grow 2 population every 30 turns on Marathon speed: 126/(2 (granary effect) * 4 (food surplues) = roughly 1 population increase every 15 turns

The poprushing unhappiness penalty disappears every 30 turns on Marathon speed. Thus you can poprush for 2 population every 30 turns or just 1 and grow still by 1 population every 30 turns.

If you had 6 food surplus, then you could grow roughly 126/(2*6)=1 population unit every 10 turns. Then your cities would grow by 3 until the poprushing unhappiness penalty wears off. Then you can poprush again that expensive Courthouse (360 :hammers:), Market, Grocer, etc.. for 3 population :) On marathon, poprushing 1 unit results in 90 hammers.

I agree the math looks ugly, but I was planning to code this stuff out :) Once you have a sample code, you can generate as many test cases as you want and play with the variables. I won't do it, however, since I feel this debate is very intuitive.

Gr8scott
Mar 06, 2008, 06:40 PM
I think a simple metric that captures the gist of the problem would be:

Grow first and then cottage if:

(% extra surplus food from farm) * (pop growth remaining) > 1

This ignores trade routes, pop size costs, and early vs. late science, but I think it is in the spirit of what you are looking for (and it is helpful to realize that starting a cottage two turns early ultimately ends up being two town turns so cottage turns lost/gained equalize over long enough time spans).

Basically, a farm can help you grow a population point faster. Suppose after growing that population, you decided to go all cottage growth from that point forward, was it a good idea to grow first or not?

If you let:

T_F = Turns to grow 1 pop with a farm
T_C = Turns to grow 1 pop with a cottage
N = Number of population growth left to go

Then you want to farm if:

(T_C - T_F) * N > T_F

T_C - T_F is how many turns faster you get the pop growth with the farm. Critically, you want to multiply this speed benefit by the total number of population growth left to go. This is because if you go full cottage growth from this point forward, not only will you get the first population point this many turns sooner, but you will get each additional population point that number of turns sooner. This will let you start working on each future cottage sooner as well.

The question is will this net out to more cottage turns or not. To figure that out, simply compare the number of cottage turns gained to the number of cottage turns lost to going farm first. Namely the first cottage is started later. With the farm first strategy, you only start the first cottage after a pop growth, so you lose T_F cottage turns on the first cottage, but you gain T_C - T_F turns on all other cottages. That is the main comparison.

An example:
Suppose your food surplus is 4 and you are pre biology. You can work a farm or a cottage and you need to add 10 pop worth of cottages to the city. Should you farm or cottage?

taking food from 4->5 is a 25% increase. 10 * 25% = 2.5 >1 ==> farm away.
Suppose you grow. Add a cottage or a farm?
Now you are at 5 surplus and and have 9 pop left to go.
5->6 gives a 20% increase and 9 cottages = 1.8 > 1 ==> add a farm

1/6 * 8 > 1 ==> farm
1/7 * 7 = 1 ==> toss up
1/8 * 6 < 1 ==> cottage

So in this example, this rule of thumb would have you work 3-4 farms before starting to add cottages. As you approached the desired size, you would also go back and cottage over farms that were no longer sufficiently helping your percent growth.

I think that is right anyway :)

GS

VirusMonster
Mar 06, 2008, 07:23 PM
I think a simple metric that captures the gist of the problem would be:

Grow first and then cottage if:

(% extra surplus food from farm) * (pop growth remaining) > 1

This ignores trade routes, pop size costs, and early vs. late science, but I think it is in the spirit of what you are looking for (and it is helpful to realize that starting a cottage two turns early ultimately ends up being two town turns so cottage turns lost/gained equalize over long enough time spans).

Basically, a farm can help you grow a population point faster. Suppose after growing that population, you decided to go all cottage growth from that point forward, was it a good idea to grow first or not?

If you let:

T_F = Turns to grow 1 pop with a farm
T_C = Turns to grow 1 pop with a cottage
N = Number of population growth left to go

Then you want to farm if:

(T_C - T_F) * N > T_F

T_C - T_F is how many turns faster you get the pop growth with the farm. Critically, you want to multiply this speed benefit by the total number of population growth left to go. This is because if you go full cottage growth from this point forward, not only will you get the first population point this many turns sooner, but you will get each additional population point that number of turns sooner. This will let you start working on each future cottage sooner as well.

The question is will this net out to more cottage turns or not. To figure that out, simply compare the number of cottage turns gained to the number of cottage turns lost to going farm first. Namely the first cottage is started later. With the farm first strategy, you only start the first cottage after a pop growth, so you lose T_F cottage turns on the first cottage, but you gain T_C - T_F turns on all other cottages. That is the main comparison.

An example:
Suppose your food surplus is 4 and you are pre biology. You can work a farm or a cottage and you need to add 10 pop worth of cottages to the city. Should you farm or cottage?

taking food from 4->5 is a 25% increase. 10 * 25% = 2.5 >1 ==> farm away.
Suppose you grow. Add a cottage or a farm?
Now you are at 5 surplus and and have 9 pop left to go.
5->6 gives a 20% increase and 9 cottages = 1.8 > 1 ==> add a farm

1/6 * 8 > 1 ==> farm
1/7 * 7 = 1 ==> toss up
1/8 * 6 < 1 ==> cottage

So in this example, this rule of thumb would have you work 3-4 farms before starting to add cottages. As you approached the desired size, you would also go back and cottage over farms that were no longer sufficiently helping your percent growth.

I think that is right anyway :)

GS

Beautifully explained! Bravo :) You simplified the problem at hand into a basic concept.

I suggest you to edit what you have just written here, because it was a difficult read :) oh maybe, it is because I don't have the Nobel prize in math :)

Extending on what you explained in this post, I want to consider the 15 farms or 15 cottages scenario.

Assuming the inital rice resource already gives +4 :food: surplus, increasing this food surplus from 4 to 5 in a pre-biology scenario would mean a 25% :food: output increase. This 25% :food: surplus increase would in return allow our cities to grow %25 faster (I am excluding the fact that cities do get slightly harder to grow with each additional population unit, but for simplicity reasons bear with me) If the city can grow 25% faster, it can work all future cottages 25% sooner. So the investment of working the farm now, translates into working 14 cottages later 25% sooner.

Multiplying this :food: output increase with 14 possible future cottages equals 3.5. Working the farm now has an effective value of working 3.5 cottages. Then, 3.5>1 so build the inital farm.

Why did I compare 3.5 to 1? Because if I build the cottage now instead of the farm, I will get no benefit for future cottages. I will however get a single cottage starting from now on, that is why 1.

Next, you want to go from 5 :food: surplus to 6, a 20% increase. Multiplying with 13 possible future cottages equal 2.6, still greater than 1, so form build the 2nd farm.

Next, you want to go from 6 :food: surplus to 7, a 16% increase. Multiplying with 12 possible future cottages equal to 1.92%. Still greater than 1 so build the 3rd farm.

Next, you want to extend the :food: surplus from 7 to 8, a 14.2% increase. 14,2% * 11 = 1,56 > 1, so build the 4th farm.

Next, 8->9, 1.25%*10=1.25>1 so build the 5th farm.

Next, 9->10, 1.11%*9=1=1, so this is the turning point. After the 5th farm, the benefits of the additional +1 :food: surplus balance out with the benefits of having the cottage mature earlier.

so, build the farm on the rice for the +4 :food: surplus. Then, build and work 5 more farms until working cottages become more feasible at +9 :food: surplus.

This discussion does not take into account the effects of Slavery, but nevertheless, it gives some general idea on how many initial farm must be worked before switching to cottage tiles for optimal commerce yields.

To include Slavery usage into this equations, take the sample game data that it takes 126 :food: to grow from size 10 to 11 on marathon speed. With granary, you need 63 :food: to grow. If you want to poprush 3 citizens every 30 turns on marathon speed right after the poprushing unhappiness penalty wears off, then you need a food surplus of roughly 7. According to our calculations even a food surplus of 9 is feasible to prefer a farm over a cottage tile, so the presence of Slavery usage should not affect much the farms/cottages ratio. Just make sure you are close to the happiness cap when you poprush and the city will grow back in no time with 9 :food: surplus (9 :food: surplus requires 6 citizens to work 5 farms and the initial rice after poprushing) :)

DaveMcW
Mar 06, 2008, 11:06 PM
Bah, too much math.

Just download this game and tell me how much gold you get by 1 AD.

VirusMonster
Mar 07, 2008, 04:20 AM
I am a math guy dude :) You can do the test yourself, farm until you get +9 food surplus, then start cottaging. Can you also post a BTS save?

futurehermit
Mar 07, 2008, 07:04 AM
So, is the conclusion farm until you have a solid food surplus going then cottage the rest then cottage over the farms once you hit the size 15 health/happy caps?

spoooq
Mar 07, 2008, 07:21 AM
I would have thought that if some farms are good, more farms are better. Farm everything, grow till max, then cottage everything. I would also like to have an exact answer, because I have a game with a Fin leader whose capital has 8 gems... do I cram in a couple farms or just mine?

Diamondeye
Mar 07, 2008, 09:25 AM
Thanks for the maths, it makes a lot of sense :)

I would have thought that if some farms are good, more farms are better. Farm everything, grow till max, then cottage everything. I would also like to have an exact answer, because I have a game with a Fin leader whose capital has 8 gems... do I cram in a couple farms or just mine?

Screeenie! :drool:

Artichoker
Mar 07, 2008, 09:27 AM
Beautifully explained! Bravo :) You simplified the problem at hand into a basic concept.

I suggest you to edit what you have just written here, because it was a difficult read :) oh maybe, it is because I don't have the Nobel prize in math :)

Extending on what you explained in this post, I want to consider the 15 farms or 15 cottages scenario.

Assuming the inital rice resource already gives +4 :food: surplus, increasing this food surplus from 4 to 5 in a pre-biology scenario would mean a 25% :food: output increase. This 25% :food: surplus increase would in return allow our cities to grow %25 faster (I am excluding the fact that cities do get slightly harder to grow with each additional population unit, but for simplicity reasons bear with me) If the city can grow 25% faster, it can work all future cottages 25% sooner. So the investment of working the farm now, translates into working 14 cottages later 25% sooner.

Multiplying this :food: output increase with 14 possible future cottages equals 3.5. Working the farm now has an effective value of working 3.5 cottages. Then, 3.5>1 so build the inital farm.

Why did I compare 3.5 to 1? Because if I build the cottage now instead of the farm, I will get no benefit for future cottages. I will however get a single cottage starting from now on, that is why 1.

Next, you want to go from 5 :food: surplus to 6, a 20% increase. Multiplying with 13 possible future cottages equal 2.6, still greater than 1, so form build the 2nd farm.

Next, you want to go from 6 :food: surplus to 7, a 16% increase. Multiplying with 12 possible future cottages equal to 1.92%. Still greater than 1 so build the 3rd farm.

Next, you want to extend the :food: surplus from 7 to 8, a 14.2% increase. 14,2% * 11 = 1,56 > 1, so build the 4th farm.

Next, 8->9, 1.25%*10=1.25>1 so build the 5th farm.

Next, 9->10, 1.11%*9=1=1, so this is the turning point. After the 5th farm, the benefits of the additional +1 :food: surplus balance out with the benefits of having the cottage mature earlier.

so, build the farm on the rice for the +4 :food: surplus. Then, build and work 5 more farms until working cottages become more feasible at +9 :food: surplus.

This discussion does not take into account the effects of Slavery, but nevertheless, it gives some general idea on how many initial farm must be worked before switching to cottage tiles for optimal commerce yields.

To include Slavery usage into this equations, take the sample game data that it takes 126 :food: to grow from size 10 to 11 on marathon speed. With granary, you need 63 :food: to grow. If you want to poprush 3 citizens every 30 turns on marathon speed right after the poprushing unhappiness penalty wears off, then you need a food surplus of roughly 7. According to our calculations even a food surplus of 9 is feasible to prefer a farm over a cottage tile, so the presence of Slavery usage should not affect much the farms/cottages ratio. Just make sure you are close to the happiness cap when you poprush and the city will grow back in no time with 9 :food: surplus (9 :food: surplus requires 6 citizens working farms after poprushing) :)

This all makes sense, but the assumption was that pop growth requirements are constant throughout. What happens when you have variable pop growth requirements?

Let's take an exaggerated example. Suppose, for example, that pop 2->3 required 10 turns without the extra farm, and with a food surplus of +5.

And then suppose that pop 3->4 required 100 turns with the same food surplus.

If, at pop 2, a Cottage were built for the 2nd extra tile (in addition to the initial Food resource), it would be producing commerce for the 100 turns at which the city remained at pop 3. At pop 3, there would be 2 Cottages producing commerce for 100 turns.

Now, if the 2nd extra tile were a Farm instead, there would be just a Food resource + Farm for the 1st and 2nd extra tiles, and a Cottage for the 3rd extra tile. So, at pop 3, there would be just 1 Cottage producing commerce.
Granted, the additional +1 food surplus from the new farm would increase the food surplus from +5 to +6, but it would still take 5/6 of 100 turns, or 83 turns, to grow from pop 3 to pop 4. So, during those 83 turns, there's only 1 Cottage generating commerce, and for the remaining 17 turns, there are 2 Cottages generating commerce.

However, in the first case, the extra Cottage gets a head start in working towards becoming a Hamlet, and then a Village. Whereas in the second case, the extra commerce from the extra Cottage is coming from a newly-built Cottage that has barely started to mature. So the generation of commerce is less for that newly-built cottage.

Of course, this is an exaggerated example, but the increasing costs of pop growth with tend to highlight the effect of Cottage maturity as a reward for building early cottages.

Gr8scott
Mar 07, 2008, 09:38 AM
Bah, too much math.

Relative to most things CIV, I thought the math was pretty easy. If a farm increases your food surplus by 25%, you can justify that if you are in the process of growing 4 or more cottages.

Here is a perhaps an easier metric:

At any point in time, try to adjust your farm/cottage mix until food surplus just equals remaining pop growth. (at least pre-biology)




Just download this game and tell me how much gold you get by 1 AD.

No need to add the randomness of a different player to the mix. Just replay your game, but if you find yourself in a situation where you want to do this:


farm everything and convert everything to cottages when you hit 15.

Use a cottage/farm mix to try and have food surplus = remaining growth. You should be better off.

GS

spoooq
Mar 07, 2008, 09:43 AM
Thanks for the maths, it makes a lot of sense :)



Screeenie! :drool:

Hehe, I will see if I get time to post a screenshot/savegame over the weekend, it's not very likely that I will, being dragged out for a drive in the countryside :P I had to spend a turn moving to get so many gems, FWIW.

Gr8scott
Mar 07, 2008, 09:50 AM
So, is the conclusion farm until you have a solid food surplus going then cottage the rest then cottage over the farms once you hit the size 15 health/happy caps?

Not quite. In the simplified setting I was working with, you are going for a mix of cottages and farms that makes:

(1) Food surplus = remaining growth

As you grow closer to your desired size, you are actually going back and converting previously built farms to cottages to try and ensure (1).

GS

druidravi
Mar 07, 2008, 09:56 AM
Its better to get farms/watermills early on till you reach population cap before cottaging for Granary>courthouse>forge>market>theatre>library etc and later start replacing watermills/farms with cottages /workshops and leave some farms to feed workshops. You should get some 8 to 10 production in the city even if it is a pure commerce city. Later with US you could cottage those farms/workshops.

Gr8scott
Mar 07, 2008, 10:12 AM
This all makes sense, but the assumption was that pop growth requirements are constant throughout. What happens when you have variable pop growth requirements?


I don't think there was any assumption regarding constant growth requirements.

In your example, the farm could take the time to growth down from 100 turns to 83 turns saving 17 turns.

The important thing to realize is that no matter how long it takes to grow each future population, you can achieve all future growth 17 turns faster because you are starting 17 turns earlier. To simplify things assume identical strategies for each approach after the first pop growth and I think this becomes clear.

The first farm lets you start your next cottage and all future cottages 17 turns earlier than growing without the farm. You need to know how many future cottages you have to decide if it was a good call or not, but I don't think constant/variable growth requirements matter. (again this is under the long-run assumption that all cottage turns equilibrate in the end)

Hopefully I undersood your question!

GS

VirusMonster
Mar 07, 2008, 10:47 AM
Not quite. In the simplified setting I was working with, you are going for a mix of cottages and farms that makes:

(1) Food surplus = remaining growth

As you grow closer to your desired size, you are actually going back and converting previously built farms to cottages to try and ensure (1).

GS


Yea, I agree that is the most simplified formula :) Make sure:

food surplus = population units to grow until you hit the health or happiness caps.

in other words,

food surplus = remained growth

As your city gets closer to the desired size, you will start switching farms to cottages. so for the 15 cottage or 15 farm scenario, at size size 6 with a :food: surplus of 9 (4 initial + 5 farms), the remaining growth is 9.

Thus, you chould start working a cottage with the 7th citizen. 8 growth remains and your :food: surplus is 9. Thus, you will turn 1 farm into cottage. You will work 2 cottages and 5 farms and the initial +4 :food: rice.

Next, at size 8, 7 growth remains. Work the initial rice and 3 farms, for a total of 7 :food: surplus and start working the 3rd & 4th cottages.

Next at size 9, 6 growth remains. Work the initial rice and 2 farms, for a total of 6 :food: surplus and start working the 5th & 6th cottages.

Next at size 10, 5 growth remains. Work the initial rice and 1 farm, for a total of 5 :food: surplus and start working the 7th & 8th cottages.

Next at size 11, 4 growth remains. Work only the rice for a total of 4 :food: surplus and the 9th & 10th cottages.

For subsequent population growths 11-14, you will work the remaining cottages 11 through 14, switching farms to cottages if you haven't done earlier.

Here it goes :)

Remember that a city with only a 4 :food: surplus rice should work farms until population 7. The 7th citizen starts to work the first cottage.

With a 5 :food: surplus corn, work farms until population 6 for a total of 9 :food: surplus. The 6th citizen starts working the first cottage.

With a 6 :food: surplus pig, work farms until population 5 for a total of 10 :food: surplus. The 5th citizen starts working the first cottage.

With a 6 :food: surplus pig and a 4 :food: surplus rice, for a total of 10 :food: surplus through food resources, the 4th citizen starts working the first cottage.

Beautifully optimized!

PS. I would still work 2-3 farms more than in this scenario because of Slavery usage, to support 2 library specialists and 1 spy specialists, and the slight effect of growing getting more difficult with each new population unit. Artichoker's example was a huge exaggeration with 100 turns. In reality on marathon speed, going from size 10->11 with 5 :food: surplus would take 63/5=12 turns, 1/8 of what Artichoker mentioned.

Artichoker
Mar 07, 2008, 11:33 AM
It all makes sense now...

Taking the extra step of turning a Farm into a Cottage so that the balance between growth and surplus is maintained.

You end up making 2 Cottages for each pop growth, once you hit the threshold.

If the food surplus is S, and the remaining turns is R, the original formula
was to make sure that

((S+1)/S - 1) * R > 1

But this is the same as:

(S+1-S)/S * R > 1

or

(1/S) * R > 1

R > S

when deciding whether to build a Farm.

However, the reverse also applies. Building a Cottage would apply when

S > R

And you could build extra cottages to make S = R. At small pop count, it's sometimes impossible to make S = R, because R is so much higher.

But once you reach the cutoff point, S = R the rest of the way, since you can reduce the unneeded surplus food by building 2 Cottages instead of 1.

VoiceOfUnreason
Mar 07, 2008, 11:39 AM
All of this is assuming that it doesn't matter when you get the commerce; ie that the that the expected value of marginal commerce is constant over the duration of the experiment.

How do people feel about that assumption? Is it true for the circumstances where we would apply these results, or simply convenient for calculation?

Gr8scott
Mar 07, 2008, 11:45 AM
If the food surplus is S, and the remaining turns is R

I like the math :)

I think you meant R is remaining pop growth not remaining turns.

One final point. Post biology, you would look for:

food surplus = 2*(remaining growth)

This accounts for the fact that farms are +2 food post biology instead of +1 food.

GS

Gr8scott
Mar 07, 2008, 11:53 AM
All of this is assuming that it doesn't matter when you get the commerce; ie that the that the expected value of marginal commerce is constant over the duration of the experiment.

How do people feel about that assumption? Is it true for the circumstances where we would apply these results, or simply convenient for calculation?

This is a good point to keep in mind. If we are looking to have a farm/cottage mix to make

Food surplus = remaining growth

We are adding cottages as we get closer to finishing up the growth. Considering the value of early commerce would cause you to err on the side of more cottages / less food surplus.

You are still confident about all the late stage cottaging, but this consideration could cause you to start the cottaging a little bit earlier.

VirusMonkey was also arguing the value of additional pop for slavery, etc, so he wanted to err on the side of more farms.

The true complexities of a particular game would clearly change the exact right answer, but at least the formula gives you a starting point for optimality.

GS

VirusMonster
Mar 07, 2008, 11:57 AM
This is a good point to keep in mind. If we are looking to have a farm/cottage mix to make

Food surplus = remaining growth

We are adding cottages as we get closer to finishing up the growth. Considering the value of early commerce would cause you to err on the side of more cottages / less food surplus.

You are still confident about all the late stage cottaging, but this consideration could cause you to start the cottaging a little bit earlier.

VirusMonkey was also arguing the value of additional pop for slavery, etc, so he wanted to err on the side of more farms.

The true complexities of a particular game would clearly change the exact right answer, but at least the formula gives you a starting point for optimality.

GS

Are you kidding with me? my name is VirusMonster, I eat monkeys alive :) On the other hand, I entirely agree with your last sentence.

Gr8scott
Mar 07, 2008, 12:01 PM
Are you kidding with me? my name is VirusMonster, I eat monkeys alive :) On the other hand, I entirely agree with your last sentence.

Eeek! my bad!

GS

DaveMcW
Mar 07, 2008, 12:45 PM
food surplus = population units to grow until you hit the health or happiness caps.

Thank you for stating it clearly.

VirusMonster
Mar 07, 2008, 12:49 PM
Thank you for stating it clearly.

You are welcome.

Artichoker
Mar 07, 2008, 12:50 PM
A general principle that I think can be derived from this concept is that regardless of whether you're planning to run a CE or an SE, it's wise to be working Farms for your first few pop growths.

The key turning point that determines the potential effectiveness of an SE is whether you can build the Pyramids successfully. If you can, then an SE becomes more attractive because of the option of having Representation as your government civic.

Otherwise, your Farms still provide the advantage of being able to work more Cottages earlier, if you happen to decide to run a CE.

Artichoker
Mar 07, 2008, 01:55 PM
All of this is assuming that it doesn't matter when you get the commerce; ie that the that the expected value of marginal commerce is constant over the duration of the experiment.

How do people feel about that assumption? Is it true for the circumstances where we would apply these results, or simply convenient for calculation?

"Marginal commerce" is indeed an important consideration in the early game.

You would need to have sufficient commerce in order to tech through at least Alphabet, at which point you gain the ability to trade techs, instantly boosting the actual value of your prior commerce.

The Palace gives a free +8 commerce, so there is some margin of error there for lacking early commerce.

The problem caused by low early commerce is why a ME (Military Economy) is so efficient in the early game. Because it allows you to make up for low early commerce by making it less of a drawback.

Even though your neighbors can tech faster in the early game, it takes only the presence of key resources and leader traits to make their tech advantage less relevant.

VoiceOfUnreason
Mar 07, 2008, 03:25 PM
"Marginal commerce" is indeed an important consideration in the early game.

Given the threshold of 15 happy, I think "early game" is already outside the bounds of the experiment....

vicawoo
Mar 07, 2008, 05:01 PM
There's a good chance the debate does not have the intuitive answers described, because of how towns grow. If they changed the parameters a little, there could be a large change in how the answer works.

With a granary, the growth rate is (10+n)/(food_source_bonus+n-1) with grassland farms, 2(n-1) with flood plains or biology, or with a ratio of k farms to 1-k cottages, (10+n)/(FSB+k*(n-1)).

Then we integrate from 1 to N, our target population, to obtain the total number of turns to grow with respect to k:

T_k=((N-1)/k+11*ln((F+k*(N-1))/F)/k)-F/k^2*ln((F+k*(N-1))/F).

Now the total amount of food to grow to size N is F_total=(N-1)/2*(10+1+10+N-1))=(N-1)*(N+20)/2

We can figure out the total number of worked cottage turns until max size C_k by the ratio of non food source farm food to cottage turns,
(F_total-FSB*T_k)/C_k = k/(1-k). This is exact, as long as T_k is exact. In the long run, if you work your size 15 city long enough to be all towns, all your cottages will have to go through the cottage/hamlet/village phase.
So

C_k=(F_total-FSB*T_k)*(1-k)/k
and total commerce up to T turns (assuming T > 40+T_k) is
(town or whatever bonus)*(C_k+N*(T-T_k)), that is, cottage turns until target size then all cottages at that target size.

Therefore the total commerce is bonus*((N+20)*(N-1)/2*(1-k)/k-FSB*T_k*(1-k)/k+N*T-N*T_k) or
bonus*(N*T + T_k*(-FSB*(1-k)/k-N) + (N+20)*(N-1)/2*(1-k)/k)
If we plot this, we find that cottage turns is maximized when you farm everything. This is assuming once you reach size 15 with a (5 food source) you cottage everything, and there is continuous growth. As for the total number of cottage turns till growth, it peaks at k=0.09, something like cottage everything except at size 11. I think I eliminated all the - sign mistakes. So farm to 15.

VirusMonster
Mar 07, 2008, 05:10 PM
wow, someone used integration to attack this problem :) I will try to understand your post later...

define your variables at start of your post plz... what are the axes of your graph? your initial formulas are not intuitive. what is n? what is N? what is k? how the they relate to each other? and start with the most basic scenario, ie all grasslands, attack the other problems later :-/ Why do I have to be the math grader here? :)

ParadigmShifter
Mar 07, 2008, 05:39 PM
I've got a degree in maths but can't be arsed doing it ;)

I could also knock out some LISP or C++ code but I'm too lazy for that as well.

vicawoo
Mar 07, 2008, 06:20 PM
k is farm % (not including special food source)
FSB is food source bonus
N is desired city size, n is current city size
C_k is cottage turns accumulated until reaching size N
T_k is number of turns to reach size N
T is the total number of turns we are considering
F_total is total amount of food (with granary) to reach size N

Basically, we have food needed to grow/food supply, and we integrate that to find total number of turns to reach size N, T_k.

If we know the farm %, since the total amount of food to reach size N is constant, we can calculate the number of grassland farm turns by subtracting our other food source. Knowing grassland farm turns we can calculate cottage turns, C_k.

And then cottage turns from turn 1 to T_k (max size) + cottage turns from turn T_k to T is the total number of cottage turns.

The graph is k vs C_k - N*T_k, whereas the total cottage turns is C_k +N*(T-T_k), so I'm ignoring N*T since it's independent of k.

vicawoo
Mar 07, 2008, 06:41 PM
Gr8scott, I think your formula (T_C-T_F)*R > T_F is using different approaches on each side and may be a little inconsistent.

If we assume that once we choose to run a cottage we will run it to max pop, then if we run the test till a cottage choice would reach max size, that one cottage accumulates T_C*R cottage turns. The farm choice will gain nothing, but we are free to run whatever number of cottages after T_f*R turns, so the inequality would be farm is (T_C-T_f)*R*cottages run at max pop > T_C*R.

If we assume that once we grow once more, then there's no difference between reaching there by an extra cottage or farm, you're arguing in the short run the first T_f turns the cottages extra turns, which kind of makes sense, but i think it might be misleading.

Artichoker
Mar 07, 2008, 09:33 PM
There's a good chance the debate does not have the intuitive answers described, because of how towns grow. If they changed the parameters a little, there could be a large change in how the answer works.

With a granary, the growth rate is (10+n)/(food_source_bonus+n-1) with grassland farms, 2(n-1) with flood plains or biology, or with a ratio of k farms to 1-k cottages, (10+n)/(FSB+k*(n-1)).

Then we integrate from 1 to N, our target population, to obtain the total number of turns to grow with respect to k:

T_k=((N-1)/k+11*ln((F+k*(N-1))/F)/k)-F/k^2*ln((F+k*(N-1))/F).

Now the total amount of food to grow to size N is F_total=(N-1)/2*(10+1+10+N-1))=(N-1)*(N+20)/2

We can figure out the total number of worked cottage turns until max size C_k by the ratio of non food source farm food to cottage turns,
(F_total-FSB*T_k)/C_k = k/(1-k). This is exact, as long as T_k is exact. In the long run, if you work your size 15 city long enough to be all towns, all your cottages will have to go through the cottage/hamlet/village phase.
So

C_k=(F_total-FSB*T_k)*(1-k)/k
and total commerce up to T turns (assuming T > 40+T_k) is
(town or whatever bonus)*(C_k+N*(T-T_k)), that is, cottage turns until target size then all cottages at that target size.

Therefore the total commerce is bonus*((N+20)*(N-1)/2*(1-k)/k-FSB*T_k*(1-k)/k+N*T-N*T_k) or
bonus*(N*T + T_k*(-FSB*(1-k)/k-N) + (N+20)*(N-1)/2*(1-k)/k)
If we plot this, we find that cottage turns is maximized when you farm everything. This is assuming once you reach size 15 with a (5 food source) you cottage everything, and there is continuous growth. As for the total number of cottage turns till growth, it peaks at k=0.09, something like cottage everything except at size 11. I think I eliminated all the - sign mistakes. So farm to 15.



OK, I'm going to answer you with a different example.

For everyone's sake, I'll keep the math to a minimum.

Player A and Player B both farm to city size 14, with the same +5 Rice resource in the original example.

Let's call the turn at which 14 pop is reached Turn 0.

Now, it takes 48 Food total to go from 14 to 15 pop, and only 24 Food with a Granary.
Let's assume both A and B have Granaries.

Player A then builds 13 Cottages and works them, but still works the +5 Rice.

Player B builds another Farm and grows to 15 pop.


A's food surplus remains +5, and B's food surplus is +18.

So B's city grows to 15 in 2 turns (or 1 1/3 turns if you like to keep fractions).

And A's city grows to 15 in 5 turns (or 4 4/5 turns if you like to keep fractions).

After they grow to 15, both build Cottages to have 15 Cottages each (let's assume they don't work the Rice anymore).

Now, let's count cottage turns. But first we must assume when the last Turn is. Let's assume 20 Turns.

Player A
13 Cottages, 20 Turns = 260 cottage turns
2 Cottages, 15 Turns= 30 cottage turns
total = 290 cottage turns

Player B
15 Cottages, 18 Turns = 270 cottage turns


Or, if you want to keep fractions we can count it a different way.

Player A
13 Cottages, 20 Turns = 260 cottage turns
2 Cottages, 15 1/5 Turns = 30.4 cottage turns
total = 290.4 cottage turns

Player B
15 Cottages, 18 2/3 Turns = 280 cottage turns


So Player A has more Cottage turns, both for the non-fraction and fraction case.

Now, what about Commerce?

Player A
13 Cottages, 13 * 10 * 1 + 13 * 10 * 2 = 390 commerce
2 Cottages, 2 * 10 * 1 + 2 * 5 * 2 = 40 commerce
total = 430 commerce

Player B
15 Cottages, 15 * 10 * 1 + 15 * 8 * 2 = 390 commerce

So Player A also generates more commerce than Player B, assuming 20 total turns.

vicawoo
Mar 07, 2008, 11:02 PM
Very interesting. Unfortunately, my calculation assumes a ratio of farms to cottages and growth from size 1 (although the latter can be changed by adjusting integration parameters, and I suspect as long as the growth is large, the results will not change). It also doesn't allow for cottage growth, since in 80 turns, they'll all be towns.

Also the integration is continuous whereas population is not, and I'm assuming it will not affect the numbers greatly.

vicawoo
Mar 07, 2008, 11:13 PM
I tested these numbers more, and assuming we can be flexible with the number of cottages:

Turns to grow T1_n= (10+n)/(FSB+a), where a is the number of farms.
n-1-a is the number of cottages.
Then T1_n*(n-1-a)-T1_n*N is our measure for cottage turns.
T1_n*(n-1-a-N)=-T1_n*(a+(N-n+1))=-(10+n)*(N-n+1+a)/(FSB+a)

The curve changes at the breaking point N-n+1=FSB, so for N=15, FSB=5, n=11, so all cottages (other than food source) is better at n>N+1-FSB, invariant at that number, and all farms is better below. This is similar to artichokes R and S, except it actually doesn't have to do with maintaining a total food surplus, but the initial food bonus.
As for my ratio calculation, the losses due to growing without all farms up to size N+1-FSB probably outweights the gain from going all cottages past it (note artichoke was getting only 10-20 more cottage turns). I'll have to think if this is what gr8scott did.

and with farms getting +2 food, except for 1 size below optimal, you probably want to farm: (N-n+1+a)/(b*(5/b+a)), so it's dependent on whether N-n+1 or 5/b is greater. Once you start running plains, then you subtract each one from the food bonus, and flood plains you add.

Quechua
Mar 08, 2008, 12:36 AM
An example:
Suppose your food surplus is 4 and you are pre biology. You can work a farm or a cottage and you need to add 10 pop worth of cottages to the city. Should you farm or cottage?

taking food from 4->5 is a 25% increase. 10 * 25% = 2.5 >1 ==> farm away.
Suppose you grow. Add a cottage or a farm?
Now you are at 5 surplus and and have 9 pop left to go.
5->6 gives a 20% increase and 9 cottages = 1.8 > 1 ==> add a farm

1/6 * 8 > 1 ==> farm
1/7 * 7 = 1 ==> toss up
1/8 * 6 < 1 ==> cottage

So in this example, this rule of thumb would have you work 3-4 farms before starting to add cottages. As you approached the desired size, you would also go back and cottage over farms that were no longer sufficiently helping your percent growth.

Very nice approach to this sort of problem, but I think you are making a small mistake in your application of it. (but I could be overlooking something)

When you are making a decision to trade a cottage for a farm you look at how many turns earlier you will get future cottage tiles - this seems valid to me. But then when you grow you only consider the decision for the new tile, and take the farm from the previous decision as given. But that farm is one more potential cottage tile that you want to switch over earlier.

At each population level take all your 'free' population that can work farms or cottages to be working cottages, and consider the benefit of switching to a farm one tile at a time. You'll find you slightly undervalued farms, and (at least for grassland farms/cottages) the shift from farms to cottages happens suddenly, it isn't gradual.

Artichoker
Mar 08, 2008, 04:16 AM
Well, there is another way to solve the problem, and that is by brute force...but I'm not going to do it myself.

Basically, the problem is defined as 15 steps. Each step is defined as the number of each tile improvement

you will be working in the optimal case, at each population count.

If the 15th step is assumed to be defined as:

15: C15, F0, R0

Then the 14th step can be found by calculating the improvements which maximize cottage turns (or commerce) from pop 14 to pop 15. The 13th step can be found from the 14th and 15th steps. The 12th step can be found from the 13th, 14th, and 15th steps. And so on...


If you want to maximize Commerce, you'll need to define the number of turns played after maximum population is attained.

Artichoker
Mar 08, 2008, 04:25 AM
Very nice approach to this sort of problem, but I think you are making a small mistake in your application of it. (but I could be overlooking something)

When you are making a decision to trade a cottage for a farm you look at how many turns earlier you will get future cottage tiles - this seems valid to me. But then when you grow you only consider the decision for the new tile, and take the farm from the previous decision as given. But that farm is one more potential cottage tile that you want to switch over earlier.

At each population level take all your 'free' population that can work farms or cottages to be working cottages, and consider the benefit of switching to a farm one tile at a time. You'll find you slightly undervalued farms, and (at least for grassland farms/cottages) the shift from farms to cottages happens suddenly, it isn't gradual.

However, with Slavery, the value of keeping spare Farms even at high pop count still needs to be recognized, so that population can be grown to replace lost pop count more quickly.

So this exercise may become purely theoretical, I'm afraid...

Artichoker
Mar 08, 2008, 06:41 AM
I tested these numbers more, and assuming we can be flexible with the number of cottages:

Turns to grow T1_n= (10+n)/(FSB+a), where a is the number of farms.
n-1-a is the number of cottages.
Then T1_n*(n-1-a)-T1_n*N is our measure for cottage turns.
T1_n*(n-1-a-N)=-T1_n*(a+(N-n+1))=-(10+n)*(N-n+1+a)/(FSB+a)

The curve changes at the breaking point N-n+1=FSB, so for N=15, FSB=5, n=11, so all cottages (other than food source) is better at n>N+1-FSB, invariant at that number, and all farms is better below. This is similar to artichokes R and S, except it actually doesn't have to do with maintaining a total food surplus, but the initial food bonus.
As for my ratio calculation, the losses due to growing without all farms up to size N+1-FSB probably outweights the gain from going all cottages past it (note artichoke was getting only 10-20 more cottage turns). I'll have to think if this is what gr8scott did.

and with farms getting +2 food, except for 1 size below optimal, you probably want to farm: (N-n+1+a)/(b*(5/b+a)), so it's dependent on whether N-n+1 or 5/b is greater. Once you start running plains, then you subtract each one from the food bonus, and flood plains you add.

Right, because you're trying to balance Food Surplus with Remaining Cottages, not Remaining Pop Count (although they could end up being the same, by coincidence).

Remaining Cottages is:

C - c

where C = final cottage count
c = current cottage count

But this is the same as:

C - (n-f-1)

or

C - n + 1 + f

where n = current pop count
f = current farm count (a 1 is subtracted to account for the Food Resource)

Food Surplus is:

B + f (pre-Biology)

and

B + 2*f (post-Biology)

where B = the Food Yield of the Food Resource (this assumes only 1 Food Resource is used...if k Food Resources are used, then the above '1' should be changed to a 'k', and 2 should be subtracted for each k higher than 1, to account for the -2 Food accrued from eating)

So, without assuming a certain number of farms for pop count n,

C - n + 1 + f = B + f

or

C - n + 1 = B

With C=15, B=5,

15 - n + 1 = 5

n = 15 - 5 + 1 = 11

Or, you could go 14 Cottages and work the Rice...

Then C=14, B=5,

14 - n + 1 = 5

n = 14 - 5 + 1 = 10

Artichoker
Mar 08, 2008, 06:52 AM
Gr8scott, I think your formula (T_C-T_F)*R > T_F is using different approaches on each side and may be a little inconsistent.

If we assume that once we choose to run a cottage we will run it to max pop, then if we run the test till a cottage choice would reach max size, that one cottage accumulates T_C*R cottage turns. The farm choice will gain nothing, but we are free to run whatever number of cottages after T_f*R turns, so the inequality would be farm is (T_C-T_f)*R*cottages run at max pop > T_C*R.

If we assume that once we grow once more, then there's no difference between reaching there by an extra cottage or farm, you're arguing in the short run the first T_f turns the cottages extra turns, which kind of makes sense, but i think it might be misleading.

Would the formula be correct if it were changed to:

(T_c - T_f) * R > T_c

instead of T_f?

Because the number of cottage turns lost is actually 1 times the growth time assuming a cottage is built, not a farm.

OK, I see your point...the extra cottage turns accrued by having the Farm would be independent of the remaining pop growth, but solely dependent on the maximum number of cottages.

So, it would be:

(T_c - T_f) * C > T_c

where C is the max number of cottages.

But, doesn't this make the assumption that there were 0 Cottages at the current pop count?

Because, C should represent the number of remaining cottages, not total cottages.

namliaM
Mar 08, 2008, 07:54 AM
The city
http://img50.imageshack.us/img50/3565/presumedcityaz6.jpg (http://imageshack.us)

Presumed:
BtS
1 Worker for the city
Techs in place (Pottery/Agriculture/Writing/Currency)
Epic speed
Enough Hapiness/Health to reach size 15.
Culture from someplace to pop the borders (no need to rush the lib)
Constant techrate of 70%
Swap the Rice for a Grass cottage at size 15

1) Farm Rice, Cottage the place, Build Library
Needed worker turns:
Farm Rice 8
15 Cottages = 15*6 = 90, total 98.
By turn 200 this city will have:
5332 beakers
1366 gold
A library and 65 hammers left over

2) Farm Rice, Cottage the place, Whip Granary asap, Build Library
Needed worker turns:
Farm Rice 8
15 Cottages = 15*6 = 90, total 98.
By turn 200 this city will have:
5451 Beakers
1381 Gold
A granary, Lib and 65 hammers left over.

Conclusion: Whipping a granary is a good thing

3) Farm Rice, Cottage the place, Whip Granary asap (2 pop), Whip Library asap (2pop)
Needed worker turns:
Farm Rice 8
15 Cottages = 15*6 = 90, total 98.
By turn 200 this city will have:
6301 beakers
950 gold
A Granary, Lib and 155 hammers left

My conclusion:
At the expense of 431 gold we gain 90 hammers and 850 Beakers.
Whipping Granary and Library ASAP is a good thing

4) Add 1 farm, Whip the Granary asap (2 pop), Whip Libary asap (3 pop)
Needed worker turns:
Farm Rice 8
Farm 8 (to be cottaged at size 15)
15 Cottages = 15*6 = 90, total 106.
By turn 200 this city will have:
6078 beakers
904 gold
200 hammers

Conclusion:
Less beakers, less Gold, but more hammers
Not an improvement on anything, but more hammers.... for a Market or University?

5) Add 1 farm, Whip the Granary asap (2 pop), Whip Libary but delay 4 turns compared to 4 (2 pop)
Needed worker turns:
Farm Rice 8
Farm 8 (to be cottaged at size 15)
15 Cottages = 15*6 = 90, total 106.
By turn 200 this city will have:
6198 beakers
932 gold
155 hammers

Conclusion:
Adding a farm is sub obtimal, atleast if you keep it to size 15

6) Add 1 farm, Whip the Granary asap (2 pop), Whip Libary but delay 4 turns compared to 4 (2 pop)
Needed worker turns:
Farm Rice 8
Farm 8 (to be cottaged at size 6 after the Lib whip)
15 Cottages = 15*6 = 90, total 106.
By turn 200 this city will have:
6380 beakers
957 gold
155 hammers

Conclusion:
The best so far, when counting beakers/Gold. And still doable with just 1 worker.

7) Presuming INFINATE Workers. First farm everything to size 15. Then start cottages. Whipping granary for 2 and Lib for 2.
6165 beakers
924 Gold

Conclusion:
Doesnt help

8) Again INFINATE Workers. Farm everything untill whipping the Granary and Library and growing to size 9. Then Cottage everything.
6364 beakers
952 gold

Conclusion:
Doesnt help

For now... option 6 seems to win, and that with only 1 worker...

VirusMonster
Mar 08, 2008, 07:57 AM
can you post your save so we can replicate your results?

Artichoker
Mar 08, 2008, 08:01 AM
(T_c - T_f) * c > T_c

Where T_c is number of turns to grow, if a new cottage is built
T_f is number of turns to grow, if a new farm is built
c is the remaining number of cottages to be built

So, finding the values of T_c and T_f:

T_c = G / (B + f)

T_f = G / (B + f + 1)

Where G is the amount of Food required for growth,
B is the food bonus of the single Food Resource
f is the current number of Farms

So,

(G/(B+f) - G/(B+f+1) ) * (C - (n-f-1-1) ) > G/(B+f)

where n is the current pop count
C is the final number of cottages

Now, divide both sides by G and multiply by (B+f):

(1 - (B+f)/(B+f+1)) * (C-n+f+2) > 1

or

(1 - (1- 1/(B+f+1) ) * (C-n+f+2) > 1

or

1/(B+f+1) * (C-n+f+2) > 1

or

C - n + f + 2 > B + f + 1

Subtracting (f+1) from both sides gives us:

C - n + 1 > B

or

n < C - B + 1

Resulting in the the same formula arrived at by vicawoo.

So, this means, with C=15, B=5, you should Farm when:

n < 15 - 5 + 1

n < 11


Note that this result is independent of both G (the food cost of pop growth) and f (the current number of farms), even though they were used in the inequality.

futurehermit
Mar 08, 2008, 08:20 AM
So, I should farm my way up to size 10 and then cottage the rest changing farms to cottages as my pop continues to increase? I'm not very math-savvy :lol:

Artichoker
Mar 08, 2008, 08:53 AM
So, I should farm my way up to size 10 and then cottage the rest changing farms to cottages as my pop continues to increase? I'm not very math-savvy :lol:

That seems to be the case. From 1 to 10, Farms look more favorable. At 11 pop count, Farms and Cottages are about equal. From 12 to 15, Cottages look more favorable.

However, using Slavery would easily change the whole picture. This would make extra Farms more useful, even at higher pop count.

Artichoker
Mar 08, 2008, 09:21 AM
Very nice approach to this sort of problem, but I think you are making a small mistake in your application of it. (but I could be overlooking something)

When you are making a decision to trade a cottage for a farm you look at how many turns earlier you will get future cottage tiles - this seems valid to me. But then when you grow you only consider the decision for the new tile, and take the farm from the previous decision as given. But that farm is one more potential cottage tile that you want to switch over earlier.

At each population level take all your 'free' population that can work farms or cottages to be working cottages, and consider the benefit of switching to a farm one tile at a time. You'll find you slightly undervalued farms, and (at least for grassland farms/cottages) the shift from farms to cottages happens suddenly, it isn't gradual.

He assumed that all higher pop counts would adopt an all-cottage strategy.

But that assumption, in itself, is wrong, because it implies that if you Farm at pop count n, you will adopt an all-cottage strategy at pop count n+1...which could result in a sub-optimal result at the final pop count of N.

That is, if the formula says to Farm when pop count = 5, the assumption was that pop counts of 6 and higher would adopt an all-cottage strategy. But that is not necessarily the case for the optimal solution.

krille
Mar 08, 2008, 09:29 AM
I wrote up this Python script.

[see next post]

The result was essentially, it doesn't really matter as long as you farm the food resource.

Now I'm not sure my script is perfect... but it should work. ^^


edit:

Might as well post my findings:
City # Commerce
0: 7644
1: 9143
2: 9302
3: 9418
4: 9458
5: 9484
6: 9515
7: 9522
8: 9518
9: 9505
10: 9514
11: 9508
12: 9502
13: 9502
14: 9502
15: 9502
City # works a maximum of # farms till it's grown to size 15. At size 15, every city replaces every farm tile with a cottage.

I modified simulation() to this to get this output

[see next post]

Like I said, the code isn't perfect. So these are estimates.

edit2: Notes: I'm fixing bGranary right now. And iMode does nothing at the moment.

edit3: Bah, noticing more bugs. But, it does give you a general idea.

edit4: Updated the code. bGranary should work now. See next post. Probably won't bother to add more modes though. Right now it runs till all tiles worked by all Cities are Towns.

krille
Mar 08, 2008, 09:42 AM
iStartSize = 1 # Starting city size
iTargetSize = 15 # Happiness Cap... Target Size for Growth
bGranary = False
bEm = False # Emancipation: +100% Cottage growth rate
bFS = False # Free Speech: +2C from Towns
bBio = False # Farms give +2F instead of +1F
iRivers = 0 # How many tiles are riverside, riverside gives +1C
bPP = False # Printing Press: Towns and Villages +1C
iCot_C = 1
iHam_At = 10
iHam_C = iCot_C + 1
iVil_At = iHam_At + 20
iVil_C = iHam_C + 1
iTow_At = iVil_At + 40
iTow_C = iVil_C + 1
iFarms = 1 # Number of farms
iFoodResources = 1 # Number of food resources
iExtraBaseFood = 1 # Extra base food yield, ie 1 = rice
iExtraFarmFood = 1 # Additional extra food yield with farm, ie 1 = rice
# pBonus[0] "bHasBonus" is Boolean, pBonus[1] "iExtraBaseFood" is Integer, pBonus[2] "iExtraFarmFood" is Integer
iBaseGrowth = 20 # Food required for 1 -> 2
iPopGrowth = 2 # Extra food required to grow per additional pop beyond 1

iMode = 0 # 0 = runs till all Cities have iTargetSize towns,
"""
iMode
0 = Runs till all Cities have iTargetSize number of Towns
>0 = Runs this many turns
-1 = Runs till all Cities have grown to iTargetSize
"""

#simulation()

class Tile:
def __init__(self, bFarm, bRiver, pBonus):
bHasBonus, iExtraBaseFood, iExtraFarmFood = pBonus
self.bHB = bHasBonus
self.iEBF = iExtraBaseFood
self.iEFF = iExtraFarmFood
if bFarm:
self.iCot = -1
else:
self.iCot = 0
self.bRiver = bRiver

def setCot(self):
if self.iCot < 0:
self.iCot = 0

def setFarm(self):
self.iCot = -1

def isFarm(self):
if self.iCot == -1:
return True
else:
return False

def isTown(self):
if self.iCot >= iTow_At:
return True
else:
return False

def getYields(self):
iRet = [0, 0]
iRet[0] = 0 # Food
iRet[1] = 0 # Commerce

if self.bHB:
iRet[0] += self.iEBF

if self.bRiver:
iRet[1] += 1

if self.iCot >= 0:
# is a Cottage
# Now I'm not sure if this is correct:
if self.iCot >= iTow_At:
# Town
iRet[1] += iTow_C
if bPP:
iRet[1] += 1
if bFS:
iRet[1] += 2
elif self.iCot >= iVil_At:
# Village
iRet[1] += iVil_C
if bPP:
iRet[1] += 1
elif self.iCot >= iHam_At:
# Hamlet
iRet[1] += iHam_C
elif self.iCot >= 0:
# Cottage
iRet[1] += iCot_C
else:
# is a Farm (-1)
iRet[0] += 1
if bBio:
iRet[0] += 1
if self.bHB:
iRet[0] += self.iEFF

return iRet

def doTurn(self):
dtRet = self.getYields()
if self.iCot >= 0:
self.iCot += 1
if bEm:
self.iCot += 1
return dtRet


class City:
def __init__(self, iFarms, iFoodResources):
self.iFR = iFoodResources
self.iFarms = iFarms
self.iTotC = 0
self.iSize = iStartSize
self.iFood = 0
self.pTile = []

# Create Bonus Tiles
pBonus = [True, iExtraBaseFood, iExtraFarmFood]
for i in range(0, iFoodResources, 1):
if i < iFarms: #remember, i starts at zero while iFarms = zero means no farms
bFarm = True
else:
bFarm = False
if i < iRivers: #same here
bRiver = True
else:
bRiver = False
self.pTile.append(Tile(bFarm, bRiver, pBonus))
# Create Normal 'Grassland' Tiles
pBonus = [False, 0, 0]
for i in range(iFoodResources, iTargetSize, 1):
if i < iFarms: #remember, i starts at zero while iFarms = zero means no farms
bFarm = True
else:
bFarm = False
if i < iRivers: #same here
bRiver = True
else:
bRiver = False
self.pTile.append(Tile(bFarm, bRiver, pBonus))

def totalFoodToGrow(self): # Returns Integer
return (iBaseGrowth + (self.iSize - 1) * iPopGrowth)

def foodLeftToGrow(self): # Returns Integer
return (self.totalFoodToGrow() - self.iFood)

def doTurn(self):
self.iFood += 2 # City tile gives +2F
for i in range(0, self.iSize, 1):
if self.iSize >= (iTargetSize - 1) and self.foodLeftToGrow() <= 0:
if self.pTile[i].isFarm():
self.pTile[i].setCot()
iRetF, iRetC = self.pTile[i].doTurn()
self.iFood += iRetF
self.iTotC += iRetC

if self.iSize < iTargetSize:
if self.foodLeftToGrow() <= 0:
if bGranary:
self.iFood = (self.totalFoodToGrow() / 2) + (self.iFood - self.totalFoodToGrow())
else:
self.iFood = self.iFood - self.totalFoodToGrow()
self.iSize += 1

if self.iSize >= iTargetSize:
for i in range(0, self.iSize, 1):
if self.pTile[i].isFarm():
self.pTile[i].setCot()

def isAllTowns(self):
for i in range(0, self.iSize, 1):
if self.pTile[i].isTown() == False:
return False
return True

def getSize(self):
return self.iSize

def getCommerce(self):
return self.iTotC


def simulation():
pCity = []
for i in range(0, iTargetSize + 1, 1):
pCity.append(City(i, iFoodResources))

bLoop = True
iTurn = 0
#print repr(iTurn)
while bLoop:
iTurn += 1
bLoop = False
sMsg = "Turn " + repr(iTurn) + ":\t"
for i in range(0, iTargetSize + 1, 1):
pCity[i].doTurn()
sMsg += repr(pCity[i].getSize()) + "\t"
sMsg += repr(pCity[i].iFood) + "\t"
sMsg += repr(pCity[i].getCommerce()) + "\t"
if pCity[i].isAllTowns() == False:
bLoop = True
#print sMsg

iLowestC = pCity[0].getCommerce()
for i in range(1, iTargetSize + 1, 1):
if pCity[i].getCommerce() < iLowestC:
iLowestC = pCity[i].getCommerce()


print "Turn " + repr(iTurn) + ": All tiles worked by all Cities are now Towns."
print "City #\tC.Adv%\tC.Adv\tC.Tot\tC./Trn"
for i in range(0, iTargetSize + 1, 1):
sMsg = repr(i) + ":\t"
iAdv = pCity[i].getCommerce() - iLowestC
fPerc = iAdv * 100.0 / iLowestC
sMsg += "%.2f\t" % fPerc
sMsg += repr(pCity[i].getCommerce() - iLowestC) + "\t"
sMsg += repr(pCity[i].getCommerce()) + "\t"
sMsg += "%.2f" % (pCity[i].getCommerce() * 1.0 / iTurn)
print sMsg



simulation()



Sample Output:
Turn 224: All tiles worked by all Cities are now Towns.
City # C.Adv% C.Adv C.Tot C./Trn
0: 0.00 0 7770 34.69
1: 15.70 1220 8990 40.13
2: 17.50 1360 9130 40.76
3: 18.33 1424 9194 41.04
4: 18.84 1464 9234 41.22
5: 19.10 1484 9254 41.31
6: 19.20 1492 9262 41.35
7: 19.20 1492 9262 41.35
8: 19.15 1488 9258 41.33
9: 19.15 1488 9258 41.33
10: 19.10 1484 9254 41.31
11: 19.00 1476 9246 41.28
12: 18.84 1464 9234 41.22
13: 18.84 1464 9234 41.22
14: 18.84 1464 9234 41.22
15: 18.84 1464 9234 41.22

City # means farms worked during growth.

Quechua
Mar 08, 2008, 01:39 PM
However, with Slavery, the value of keeping spare Farms even at high pop count still needs to be recognized, so that population can be grown to replace lost pop count more quickly.

So this exercise may become purely theoretical, I'm afraid...

It's not any more theoretical than gr8scott's simplifying assumptions. But the examples people have been posting have been incorrectly applying his basic idea. They are losing cottage-turns by forgetting the previous farms.

Example: the city can grow to size 6, it has only farmable grassland tiles. No granary.

By the logic people have been using, at pop 1 and 2 we want farms. At pop 3, we are going from a 4 to 5 surplus and have only 3 pop left so we want to cottage. I will also cottage all of the other farms at this point, even though it was suggested you gradually switch them over as you approach pop 6.

pop food farms turns overflow cottage-turns
1...22...1.....8.....2........0
2...22...2.....6.....2........0
3...24...0.....12....0........36
4...28...0.....14....0........56
5...30...0.....15....0........75

167 cottage-turns after 55 turns

Now I suggest, when your pop remaining is greater than your 'fixed' food surplus, farm all your free tiles, when it is less, cottage all of it.

pop food farms turns overflow cottage-turns
1...22...1.....8.....2........0
2...22...2.....6.....2........0
3...24...3.....5.....1........0
4...27...4.....5.....0........3 (avoiding overflow)
5...30...0.....15....0........75

78 cottage-turns after 39 turns, or 174 cottage-turns after 55.

Like I said, it's a small mistake, but I think it's important conceptually to not forget about the previous farms.

Artichoker
Mar 08, 2008, 06:01 PM
I think Gr8Scott had sound "basic" logic, but his application of the formula to the numbers was incorrect.

You are correct in saying that making the change from Farms to Cottages in a more sudden manner is probably the most efficient way to go.

The logic of the formula:

(T_c - T_f) * c > T_c

which is a variant of Gr8Scott's original formula, uses the parameter 'c' to represent remaining Cottages, instead of Gr8Scott's 'N' parameter for remaining pop growth.

The reason it should be 'c' instead of 'N' is that no assumption has been made regarding the current number of Farms, so there "could have been" Cottages built already at this point.

However, "if" (that's a big "if") Cottages have already been built up to this point in city growth, it would mean that building a new Farm would not contribute to cottage turns for the cottages that have already been built.

So, your general intuition is correct...if you have already built Cottages mixed in with the Farms, but your city is still lacking in growth, the next Farm you build will not increase the cottage turns of the Cottages you already built...it would only help speed up the creation of future cottages.

As for the consideration of multiple Farms, they will actually figure in to the T_c and T_f calculations.
You can assume that your current city already has some number of Farms. That number of Farms will directly affect the values of T_c and T_f.

The number of Farms your current city has will also affect the number of Remaining Cottages, because for each Farm you are working (and also the Food Resource) it means you are not working a Cottage.

In the end, the equation actually becomes independent of the 'f' parameter (the number of Farms).
Thus, when the decision is made to switch from Farms to Cottages, it should not be based on the number of existing Farms. The only remaining parameters are C (the desired number of cottages) and B (the Food bonus of the Food Resource).

Quechua
Mar 08, 2008, 06:33 PM
^ I think of it like this,

(T_c - T_f) * N > T_f

where T_c is the number of turns having the free population working all cottages, and T_f is working one farm, and N is the number of population you have left to grow.

This simplifies to just N > f, where f is simply your 'fixed' food surplus, i.e. the surplus before you add any farms.

To figure out if we want to change additional cottages to farms, our food surplus increases by one (since we have the previous farm) and N also increases by one, because we gain by switching the previous farm to a cottage too.

So if it is right to work a farm instead of cottage for the first tile, it is right for all other tiles, and likewise for cottages to farms.

So there is a fixed population above which you want cottages and below which you want farms. This is given by the extremely simple formula N = f. (which generalizes simply when we are trading other than 1 food for 1 cottage-turn)

MyOtherName
Mar 08, 2008, 06:51 PM
In every (roughly homogeneous) situation I've ever analyzed, it's always best to grow as soon as possible until you hit a magic population number where you can leisurely switch from farms to what you really want, and then once you grow again, you stop working extra farms.


I've found the easiest analysis is in terms of a single population point, Each turn you spend at this population is one turn you are not at your maximum population. Assuming fractional numbers of turns, what you do at this population point is completely independent from what you do with future population points.

So, you simply look at different ways to assign your tiles, and take the one that yields the least "loss". (I've also found this to be an effective way of figuring out during game time when to work farms and when to switch to hills, etc. I simply look at each way to arrange my citizens and compute the loss)


. Here is sample analysis: (assuming we always work the rice until we're full size)

Let N be the current population.
Let F be the number of farms worked, including the rice.

Food to grow: 10 + N (Normal speed with granary)
Food surplus: 5 + (F - 1) (rice = 5, each additional farm adds 1 more)
Cottage turns per turn: N - F
Cottage turns per turn at max size: 15
Cottage turns "lost" per turn: 15 - (N - F)
Turns to grow: (10 + N) / (4 + F)
Total loss: L = (15 - N + F) (10 + N) / (4 + F)

Simplifying, L = (10 + N) (1 + (11 - N) / (4 + F))

Observe:
If N < 11, then increasing F means decreasing loss.
If N = 11, then F is irrelevant
If N > 11, then decreasing F means decreasing loss.

In other words, work all farms below 11 pop, and work all cottages above 11 pop. (Still assuming we keep the rice until we're size 15)


Notice this agrees with Artichoker's analysis. And you may be able to do slightly better if you find a clever scheme to deal with overflow when the city actually grows.

namliaM
Mar 09, 2008, 03:36 AM
can you post your save so we can replicate your results?

No such thing, I just created the map in worldbuilder... but didnt save and/or play it...

I used my spreadsheet that I am trying to build, which should help in situations like this.

namliaM
Mar 09, 2008, 06:52 AM
On a 200 turn timescale (on Epic) as long as you reach size 15 buy 200 - 15 (Cottage) - 30 (Hamlett) - 45 (Village) => 200 - 90 = 110 basicaly any turn you spend working a farm is a turn lost on working a Town.

I think any formula beeing "developed" should take that into account (not that math savy myself, more of a do it kind of guy)

Presumptions
- 8 workers are available on turn 0 (founding of the city) to farm the rice
- Whip the granary ASAP at size 4
- Whip the Library as soon as a 2 pop whip is allowed
- 15 pop max
- Work the rice untill size 15 is reached, then switch to a non-riverside cottage, keeping the rice farm in tact for future growth/whips

The city
http://img50.imageshack.us/img50/3565/presumedcityaz6.jpg (http://imageshack.us)

The results:
http://forums.civfanatics.com/attachment.php?attachmentid=170915&stc=1&d=1205062124

The graps shows everything from working only the Rice farm and cottages (107 - 000, meaning 107 turns working the Rice farm while working 0 turns on additional farms) to working all farms to size 15, thens switching to all cottages (060 - 280).

A farm turn is 1 turn working 1 farm
So at size 4 working Rice + 3 farms, makes for 1 Rice turn, but 3 Farm turns.

There are 3 seperate "bests" for the 3 categories.
Gold
098 - 060
98 turns on the Rice
60 turns other farms
1063 Gold
6777 Beakers
7840 Beakers + Gold

Beakers
092 - 092
87 turns working the Rice
120 turns working additional farms
1032 Gold
6827 Beakers
7860 Beakers + Gold

Beakers + Gold
092 - 092
92 turns working the Rice
92 turns working additional farms
1051 Gold
6824 Beakers
7876 Beakers + Gold

It also shows that 80% of all solutions with or without farms fall within 95% of optimum for Beakers + gold. Which means even if you do it not perfect but, somewhat close to it.... you might lose 52 gold and 341 beakers. Which is not to catastrophic but, can be the reason why you get a (important?) tech one turn earlier than you would otherwize.

I will edit this later to add in what exactly those numbers mean in actual turns/growth etc.

MyOtherName
Mar 09, 2008, 09:03 AM
* deleted *

Maestro_Innit
Mar 09, 2008, 01:16 PM
:crazyeye:

Crikey - nice work fellas! :thumbsup:

So... in summary... we farm like crazy, whipping granary and library and then cottage over everything at about size 10? :confused:

Gr8scott
Mar 09, 2008, 04:41 PM
Go away for a couple days and all hell breaks loose!

So I skimmed the responses, and this one got me thinking:

But that farm is one more potential cottage tile that you want to switch over earlier.

You'll find you slightly undervalued farms, and (at least for grassland farms/cottages) the shift from farms to cottages happens suddenly, it isn't gradual.


When I worked out the original formula, I assumed that the future farm/cottage split was 100% cottages. This assumption seems fine for valuing cottages, but is generally suboptimal for valuing farms. Thus, relative to my original formula, assuming optimal future behavior could result in wanting more farms.

Thinking a bit more about this problem, I realize it is really a dynamic optimization problem. For these types of problems, it is usually a robust solution strategy to start at the end of the problem and work your way “backwards” towards the beginning. It turns out you can make some progress taking this approach with this problem.

If you are not interested in the math/intuition feel free to *skip ahead to the answer*, otherwise, read on!

Let me start by listing what I see as the key assumptions for this problem.

(1) Fractional turns are allowed.

(2) Game length: sufficient turns remain to grow to max size with cottages only and still have time for all cottages to turn to towns

(3) Value function assumption: The thing that is optimized is the total commerce created over the entire game. This coupled with (2) mean we can look only at cottage-turns.

(4) building/multipliers: buildings/multipliers are unchanged throughout the problem

(5) we have access to infinite workers, or equivalently, we can instantly change between farms/cottages without cost.

(6) Finally, a note to self that I am not going to tell the system that working a cottage and then farming over it is a very bad idea. We will need to check our solution to make sure this does not happen. If it does we need to rethink the whole thing to impose this constraint.

(1) just allows me to not deal with surpluses, etc. (2) and (3) mean I can just focus on cottage-turns because all cottages have time to become towns. (4) eliminates all of the slavery/library type considerations. (5) means we don’t have to consider costs associated with changing improvements and (6) is a reminder to check the solution.

Now to backward solve this problem, we need to start at the end. Suppose we focus on the problem described by OP and we want to end with a size 15 city working 15 cottages.

Suppose we arrive at our optimal size (15) and we have N turns left to go in the game. We know at this point it is optimal to have 15 cottages. So the value function associated with arriving at size 15 with N turns left is (recall the value function is just cottage turns)

V_15 = 15*N

Now, suppose we just arrived at size 14 and would like to know our optimal cottage/farm mix. The key question to answer is

How valuable is it to grow to size 15 one turn earlier?

If we get to size 15 one turn earlier, it means we get to work all 15 cottages an extra turn. In other words we get 15 cottage-turns by growing one turn faster.

The cost of growing faster is that our farms are not producing any cottage-turns for us. To figure out what to do at size 14 we need to check all the possible combinations of farms/cottages and figure out which gives us the most cottage turns over the rest of the game.

If we let

V_14_15(i) = cottage turns created while growing from size 14 to size 15 assuming i farms

and

V_15(i) = cottage turns spent at size 15 assuming i farms at size 14

then we just need to pick the number of farms that maximizes:

V_14_15(i) + V_15(i)

In words, we keep adding farms until the loss in cottage-turns growing between size 14 and size 15 exceeds the gain in cottage-turns from arriving at size 15 earlier.

If the terminal number of cottages is 15, then we want to keep adding farms until our surplus food is 15. At this point, another farm is too costly relative to the additional growth (this uses essentially the same logic from the earlier discussion)

Now that we know what to do at size 14, we can attack the problem at size 13. This is where it gets cool! How beneficial is it to grow to size 14 one turn faster? It turns out reaching size 14 one turn earlier improves the total value function by … 15 cottage turns!

Optimal behavior at size 14 didn’t depend on when you got to size 14. You follow the same optimal policy no matter when you get there. That means that getting to size 14 one turn earlier results in getting to size 15 one turn earlier which results in 15 cottage turns.

No matter when you look at the problem, speeding up growth by 1 turn results in 15 cottage turns of improvement! How valuable is it to get to size 7 one turn earlier? Well you are going to follow the same optimal strategy from size 7 to size 15, so you will end up at size 15 one turn earlier resulting in 15 extra cottage turns. How sweet is that!

This implies that the optimal policy doesn’t vary with city size. You always want to add farms if your food surplus is less than the ending number of cottages!

<checking this answer with assumption (6) above, and we are OK. The total number of cottages is always non-decreasing … whew!>

The intuition turned out to be right. The original approach did under value some farms. Given optimal future behavior, we want to add farms until surplus food = target # of cottages.

*Skip to the answer*

Pre-biology, you want to be working farms until:
Surplus food = ending number of cottages

Post-biology, you want to be working farms until:
Surplus food = 2 * (ending number of cottages)

Example #1: OP problem
Target number of cottages: 15
Terrain: All grassland except one food special (5 food surplus at size 1)
Solution:
-Size <12: all farms (10 farms + 1 special).
-Size 12-14: 10 farms / 1 special / rest cottages.
-Size 15: all cottages (including special!).

Example #2:
Target number of cottages: 15
Terrain: irrigated corn, 3 floodplains (9 surplus at size 4 and above)
Solution:
-Size <7: All farms
-Size 7 – 14: 6 farms / rest cottages (15 surplus at all sizes).
-Size 15: all cottages

Looking at some of the latter posts, it seems like people are coming up with similar answers. That's good. Hopefully we are all right :)

GS

MyOtherName
Mar 09, 2008, 06:13 PM
s + 1 special).
-Size 12-14: 10 farms / 1 special / rest cottages.
-Size 15: all cottages (including special!).

This is wrong -- it is suboptimal by 18.667 cottage turns on normal speed, assuming we always work the rice. The optimal strategy works all cottages at sizes 12-14, and all farms under 11. (What mix you use at 11 doesn't matter)

In particular,
If the terminal number of cottages is 15, then we want to keep adding farms until our surplus food is 15. At this point, another farm is too costly relative to the additional growth
this quote is incorrect.


By your scheme:
@ size 12:
Food surplus = 15
Food to grow = 22
Cottage turns per turn = 1
Turns spent: 1.467
Cottage turns produced = 1.467

@ size 13:
Food surplus = 15
Food to grow = 23
Cottage turns per turn = 2
Turns spent: 1.533
Cottage turns produced = 3.066

@ size 14:
Food surplus = 15
Food to grow = 24
Cottage turns per turn = 3
Turns spent: 1.600
Cottage turns produced = 4.800

Net result: 4.6 turns to grow, producing 9.333 cottage turns in the process.


The optimal scheme performs as follows:

@ size 12:
Food surplus = 5
Food to grow = 22
Cottage turns per turn = 11
Turns spent: 4.400
Cottage turns produced = 48.4

@ size 13:
Food surplus = 5
Food to grow = 23
Cottage turns per turn = 12
Turns spent: 4.600
Cottage turns produced = 55.2

@ size 14:
Food surplus = 5
Food to grow = 24
Cottage turns per turn = 13
Turns spent: 4.800
Cottage turns produced = 62.4

Net result: 13.8 turns, producing 166 cottage turns.

Your scheme, after 13.8 turns, produces
9.333 + 15 * (13.8 - 4.6) = 147.333 cottage turns.


Let's look at how much each strategy is 'losing' per turn by not being at full size:

Yours: @ 12, you lose 14 cottage turns per turn (you're making 1, but we make 15 at full size), over 1.467 turns, and so forth. The net loss is
14 * 1.467 + 13 * 1.533 + 12 * 1.600 = 59.667

Best:
4 * 4.4 + 3 * 4.6 + 2 * 4.8 = 41

So we see again that your method underperforms the optimal one by 18.667 cottage turns.

spoooq
Mar 10, 2008, 08:51 AM
Once upon a time I tried to write a program that would calculate the efficient frontier of sets of tiles for a given city to work at any pop. If anyone would like to help me with the maths (definitely not my strong point), Id love to go back and rewrite the code in Python or C++. The original was Ruby, and I was pushing the limits of an unusual coding technique as much as I was trying to solve the problem. Perhaps more inputs can be given, such as happy/health limits. It should be possible to work out the best target size for a city if you can find a reasonable present value calculation.

Edit: I did manage to get to a point where I could display a three-dimensional (gold/hammers/food) surface potential for each pop size, but it was very inefficient for large populations.

Optimal behavior at size 14 didn’t depend on when you got to size 14. You follow the same optimal policy no matter when you get there.

This was one of my key assumptions. Technically, however, its actually incorrect. History does matter because of overflow. Im happy to ignore it, however.

Artichoker
Mar 10, 2008, 11:29 AM
See Post #73 for my correction of Gr8Scott's original formula.

In summary, it agrees with MyOtherName's alternate method of calculation.

Quechua
Mar 10, 2008, 02:41 PM
See Post #73 for my correction of Gr8Scott's original formula.

In summary, it agrees with MyOtherName's alternate method of calculation.

Your correction isn't quite correct. The cottage turns lost in the short term by adopting a farm rather than cottage is the number of turns to grow with that farm. I don't know why you decided to change this.

The reason the form of your answer looks more correct than gr8scott's original one is because you do account for the farms you are currently working in counting the cottages you have remaining to work.

Really, gr8scott had it nearly right at first but he forgot about these farms. If you account for these the math is very simple. I pointed this out a while ago but there has been a lot of clutter in this thread (not a bad thing, some interesting ways to look at this).

Artichoker
Mar 10, 2008, 04:03 PM
Your correction isn't quite correct. The cottage turns lost in the short term by adopting a farm rather than cottage is the number of turns to grow with that farm. I don't know why you decided to change this.

The reason the form of your answer looks more correct than gr8scott's original one is because you do account for the farms you are currently working in counting the cottages you have remaining to work.

Really, gr8scott had it nearly right at first but he forgot about these farms. If you account for these the math is very simple. I pointed this out a while ago but there has been a lot of clutter in this thread (not a bad thing, some interesting ways to look at this).

(T_c - T_f) * c > T_c


Let me explain why I used T_c instead of T_f:

The quantity on either side represents the number of cottages turns gained in T_c turns in comparison to building nothing for that city's new 1 pop count.

In the case of building a new cottage, it's a flat amount applied over T_c turns. With 1 extra cottage, that results in T_c cottage turns.

For the left side, which represents building a new farm, it's a bit more complicated:

After T_f turns, there is no benefit from building a Farm. However, there still remain T_c - T_f turns for that time frame. In the remaining T_c - T_f turns, the city has reached a pop count that is 1 higher.

In the case of building 1 extra Farm, we haven't assumed how many cottages the city will have after gaining the 1 extra pop. But, we do know that after T_c - T_f turns, the city gets a head start in terms of city growth.

We know that for the remaining c cottages that need to be built and worked,
the city will need to reach a certain size to work each cottage. Whatever that city size is for each cottage, the extra growth provided by the farm for that 1 extra pop will speed up the time when those remaining cottages are built and worked. So, the amount of extra time is (T_c - T_f), and it is multiplied by the number of remaining cottages, c.

Artichoker
Mar 10, 2008, 04:30 PM
In every (roughly homogeneous) situation I've ever analyzed, it's always best to grow as soon as possible until you hit a magic population number where you can leisurely switch from farms to what you really want, and then once you grow again, you stop working extra farms.


I've found the easiest analysis is in terms of a single population point, Each turn you spend at this population is one turn you are not at your maximum population. Assuming fractional numbers of turns, what you do at this population point is completely independent from what you do with future population points.

So, you simply look at different ways to assign your tiles, and take the one that yields the least "loss". (I've also found this to be an effective way of figuring out during game time when to work farms and when to switch to hills, etc. I simply look at each way to arrange my citizens and compute the loss)


. Here is sample analysis: (assuming we always work the rice until we're full size)

Let N be the current population.
Let F be the number of farms worked.

Food to grow: 10 + N (Normal speed with granary)
Food surplus: 5 + (F - 1) (rice = 5, each additional farm adds 1 more)
Cottage turns per turn: N - (F + 1)
Cottage turns per turn at max size: 15
Cottage turns "lost" per turn: 15 - (N - F - 1) = 16 - N + F
Turns to grow: (10 + N) / (4 + F)
Total loss: L = (16 - N + F) (10 + N) / (4 + F)

Simplifying, L = (10 + N) (1 + (12 - N) / (4 + F))

Observe:
If N < 12, then increasing F means decreasing loss.
If N = 12, then F is irrelevant
If N < 12, then decreasing F means decreasing loss.

In other words, work all farms below 12 pop, and work all cottages above 12 pop. (Still assuming we keep the rice until we're size 15)


Notice this agrees with Artichoker's analysis. And you may be able to do slightly better if you find a clever scheme to deal with overflow when the city actually grows.


Yes, it seems to agree...

But, according to your math,


Food surplus: 5 + (F - 1) (rice = 5, each additional farm adds 1 more)


Isn't Food Surplus 5 + F, for Rice, assuming an irrigated Rice?

Because each Grassland tile is food-neutral, and the city tile provides another 2 Food.

Each grassland farm provides 3 Food, which results in 1 surplus food.
The Rice tile itself provides 5-2=3 surplus food, but the city tile brings that back to 5.

So the amount of surplus food would be (5+F) instead of (4+F).

This might explain why your answer has N=12 instead of N=11 as the pop count to switch from Farms to Cottages.

VoiceOfUnreason
Mar 10, 2008, 05:05 PM
Isn't Food Surplus 5 + F, for Rice, assuming an irrigated Rice?

I believe that the assumption is that F includes the rice farm....

Quechua
Mar 10, 2008, 05:58 PM
The quantity on either side represents the number of cottages turns gained in T_c turns in comparison to building nothing for that city's new 1 pop count.


Taking Tf on the right in that inequality represents the cottage-turns lost at this population level by choosing a farm over a cottage. You are talking about the cottage turns gained in Tc turns, but that is not a good way to look at it since by choosing a farm we grow before then. If you think in these terms then the left side of your inequality is incorrect.

MyOtherName
Mar 10, 2008, 06:02 PM
I believe that the assumption is that F includes the rice farm....
I wound up double-counting the rice farm. What you said was correct, and what I intended to do in my analysis. But then I brilliantly decided to subtract 1 for the rice farm again when I was computing the number of cottages. :(

I've corrected my original post.

Artichoker
Mar 10, 2008, 06:09 PM
I believe that the assumption is that F includes the rice farm....

Here are two lines from the original calculations:


Food surplus: 5 + (F - 1) (rice = 5, each additional farm adds 1 more)
Cottage turns per turn: N - (F + 1)


If it were taken that way (that F includes the Rice Farm), then the cottage turns per turn should be N - F instead of N - (F + 1). At least that's how I see it.

Artichoker
Mar 10, 2008, 06:10 PM
I wound up double-counting the rice farm. What you said was correct, and what I intended to do in my analysis. But then I brilliantly decided to subtract 1 for the rice farm again when I was computing the number of cottages. :(

I've corrected my original post.


Not trying to be picky or anything, but just trying to prevent disagreement...

Artichoker
Mar 10, 2008, 07:35 PM
Taking Tf on the right in that inequality represents the cottage-turns lost at this population level by choosing a farm over a cottage. You are talking about the cottage turns gained in Tc turns, but that is not a good way to look at it since by choosing a farm we grow before then. If you think in these terms then the left side of your inequality is incorrect.


OK, for the sake of keeping it simple, I'll answer you with a concrete example.

Here was the formula:

(T_c - T_f) * c > T_c

So, the concrete example is that the current city size is 14, and it's about to grow to 15, which is the maximum, at which point we will go with 15 cottages.

We already know that at pop 15, our goal is to be working 15 cottages.

But what if, for some reason, we decided to delay building cottages all the way up to pop 14?

In that case, let's assume a time frame of T_c turns for both sides.

Also, let's break up the timeline into 4 parts:

1) t < 0

2) 0 <= t < T_f

3) T_f <= t < T_c

4) T_c <= t

Now, let's compare two cases:

A) build 1 new cottage

From t=0 to t=T_c, the city accumulates 1 * T_c = T_c cottage turns. After T_c, the city grows to size 15 and works 15 cottages, which accumulate 15 cottage turns per turn.


B) build 1 new farm


From t=0 to t=T_f, the city accumulates 0 cottage turns. After T_f, the city grows to size 15 and works 15 cottages. Therefore, from t=T_f to t=T_c, the city accumulates 15 * (T_c - T_f) cottage turns. After T_c, the city is still at size 15 and works 15 cottages, which accumulate 15 cottage turns per turn.

Now, let's compare the cottage turns in each time frame:

1) t < 0
case A), 0
case B), 0

2) 0 <= t < T_f
case A), T_f
case B), 0

3) T_f <= t < T_c
case A), T_c - T_f
case B), 15 * (T_c - T_f)

4) T_c <= t
case A), 15 * (t - T_c)
case B), 15 * (t - T_c)

So, for time frame 1) and time frame 4), both A) and B) accumulate the same number of cottage turns.

For time frame 2) and time frame 3), case A) accumulates T_f + (T_c - T_f), or T_c cottage turns.

And case B) accumulates 15 * (T_c - T_f) cottage turns.

So, this example is consistent with the formula:

(T_c - T_f) * c > T_c

If the right-hand side is changed to T_f instead, it would be incorrect because it doesn't account for the cottage turns accumulated by A) in time frame 3).

Quechua
Mar 10, 2008, 08:00 PM
So, the concrete example is that the current city size is 14, and it's about to grow to 15, which is the maximum, at which point we will go with 15 cottages.

We already know that at pop 15, our goal is to be working 15 cottages.

But what if, for some reason, we decided to delay building cottages all the way up to pop 14?

13 of those 15 cottage have nothing to do with our decision between a farm and a cottage at pop 14. The only thing that is preventing me from running 15 cottages right now is that I am at pop 14.

I'll also look at a time frame of Tc turns, so I get my point across.

From 0 to Tf the farm option gets no cottage turns beyond those 13, the cottage option gets Tf turns.

From Tf to Tc the cottage option gets (Tc - Tf) turns. The farm option gets 2(Tc - Tf).

So farm is better if 1*(Tc - Tf) > Tf, where 1 is the potential cottages we have left to add.

Which was a formula posted here a few days ago, the mistake came from when there was more than 1 tile in question. The answer is to farm all free tiles when your cottages remaining is greater than your fixed surplus, avoid overflow when it's equal, and have all cottages when it is less.

Truthfully I'm surprised there have been so many posts here.

VirusMonster
Mar 11, 2008, 04:27 AM
Truthfully I'm surprised there have been so many posts here.

Can someone summarize the final result then? :) or tell which post I should look at? :)

spoooq
Mar 11, 2008, 09:38 AM
Can someone summarize the final result then? :) or tell which post I should look at? :)

Farm until you have enough people to do everything you want, then stop.

Edit: Oh, you mean the maths? ;)

MyOtherName
Mar 11, 2008, 12:18 PM
You should read mine, of course. ;)


The method I used generalizes to other situations, such as "Should my production city work its copper mine while it's growing?", and (IMHO) is simple enough to be used in the middle of a game. I'm not sure well the other approaches work (or if they are even different). Of course, that might only be because the method is customized to the way I think!


The answer (unless I've messed up) for this particular problem is:

Size 1-10: work the rice, and all farms
Size 11: work the rice, and any mixture of farms and cottages
Size 12-13: work the rice and all cottages
Size 14: work all cottages

(This is true, even if you cottage over the rice)


I guess I didn't explicitly state how I apply it in game. First, I count how many hammers (or cottages, or specialists, etc) I will produce at full size. Second, I arrange my citizens in each of the ways I'm considering, checking the production deficit (e.g. the difference in the hammers produced at full size versus the current arrangement) and the turns to grow. I then compute net loss as
{net loss} = {deficit} * {turns to grow}
and select the arrangement with the least net loss.

namliaM
Mar 11, 2008, 03:57 PM
The answer (unless I've messed up) for this particular problem is:

Size 1-10: work the rice, and all farms
Size 11: work the rice, and any mixture of farms and cottages
Size 12-13: work the rice and all cottages
Size 14: work all cottages

(This is true, even if you cottage over the rice)


I have different figures, offcourse I am starting from the premise that a granary and Library whipped are good things...
Whipping the Granary at size 4 and the Library for 2 pop as soon as you can. Whipping the Lib for 3 pop ASAP is a BAD thing!

My calculations show, work all farms to size 8 + 2 turns (one turn short of size 9, at turn 39), Then switch to all cottages (not including the rice).
For now this brings (at 70% science) 6794 beakers and 1071 gold over the first 200 turns it excists.

If you build NOTHING in the city and only go for raw commerce... this would max out on just about the same point...
Farm everything untill size 8 + 3 turns (2 turns short of size 9, at turn 42)
Now work 4 cottages for 1 turn, the switch the rest except for the Rice, which gets switched somewhat later.
For now this brings (again at 70% science) 4467 beakers and 1914 gold over the same 200 turns it excists.

But I am not completely confinced yet that this is the best of the best, I am sure it can use a little tweak here and there.
The problem with the formula I think is it doesnt take into account the granary which
1) Needs to be build/whipped
2) Changes everything about growing, but only AFTER beeing build.

The Granary & Lib whip option not only gets MORE beakers, it also gets them sooner (by 3 turns). And that is the weak point of the equation, the addition of buildings... and possibly even an Academy/University/Observatory/Market/Grocer/Bank later on. Possibly even a Forge mixed in if you plan to whip that much.

MyOtherName
Mar 11, 2008, 07:57 PM
I have different figures, offcourse I am starting from the premise that a granary and Library whipped are good things...
Whipping the Granary at size 4 and the Library for 2 pop as soon as you can. Whipping the Lib for 3 pop ASAP is a BAD thing!
I was optimizing the number of cottage turns produced. To convert that into optimizing commerce, I was making the implicit assumption that the granary and library were already created, and that our time limit is sufficient for all cottages to grow into towns.

namliaM
Mar 12, 2008, 01:19 AM
I doubt this magic building scenario will be anything different from my "no building" scenario.... But to make sure I should give it a go...

spoooq
Mar 12, 2008, 05:53 AM
If you build NOTHING in the city and only go for raw commerce...

Does this include building commerce? I doubt it would make much difference, because youre only going to be working farms and cottages, but you would still pick up a little bit from the center tile.

namliaM
Mar 12, 2008, 01:41 PM
You cannot build commerce only Gold or Beakers, and NO it doesnt include building ANYHING, that includes NO gold NO beakers NO building NADA

All this doesnt include trade routes either, as they should -approximatly- be the same for all situations.

namliaM
Mar 12, 2008, 02:10 PM
I was optimizing the number of cottage turns produced. To convert that into optimizing commerce, I was making the implicit assumption that the granary and library were already created, and that our time limit is sufficient for all cottages to grow into towns.

Well I have taken your magic buildings to the test... and more or less as I expected you start cottages even sooner than if you need to whip/build the buildings yourself.

I would say it is back to the drawing board for the formula... :sad:

The optimum point with your magic Library and Granary (starting from 1 pop) is to farm to size 6! and switch to cottages.
Even leaving behind the farmed rice at size 10 :eek: allready...

Surprisingly enough I also found in the -more realistic- tests that you leave behind the Rice farm suprisingly early. I was going from the premise that you would want to work the rice to size 15 but that appearently is not true.

MyOtherName
Mar 13, 2008, 12:09 AM
Well I have taken your magic buildings to the test... and more or less as I expected you start cottages even sooner than if you need to whip/build the buildings yourself.

I would say it is back to the drawing board for the formula... :sad:
If I assume a library and granary appear magically on turn 1, then I worked out by hand the results at turn 200: 2343 cottage turns, 6231.75 beakers and 2136.6 gold, for a net beakers + gold of 8368.35.

I tried it in game, and I got comparable results -- I got a 2159 gold in game, but that's because of the extra 1 commerce from the city tile. (I don't know how much science I got, because I don't know what the beaker multiplier was for Future Tech I. But since gold and science come at a constant proportion, if I got the gold right, I should have the science right)


I tried working out your strategy by hand: there were only 2275 cottage turns. Furthermore, the city grew so slowly that some of the cottages did not mature into towns by turn 200.


What exactly is your testing procedure? Are you sure you are getting the global optimum? (And that there were no errors in your calculation?)

namliaM
Mar 13, 2008, 01:26 AM
In my example of the "magic" buildings in 200 turns I got a total of 1142 gold and 7992 beakers => 9135 total.

1 Cottage doesnt make it to Town... the others do...

My test presumes that the optimum is someplace between "farming all" to size 15 and Cottage all from size 2 (working the Ricefarm at size 1).
Then it removes 1 farm from the "end",
i.e.
work 13 farms, 1 cottage at size 14, record the totals
work 12 farms, 2 cottage at size 14, record the totals
work 11 farms, 3 cottage at size 14, record the totals
work 10 farms, 4 cottage at size 14, record the totals

Finaly I found that you need to tweak the number of turns on the rice farm... like I said it appears that it is NOT optimal for commerce to work that all the time.

I am not quite happy with my spreadsheet -yet-... But "someday soon" I will publish it for global use. It should allow people to calculate the "perfect" opening for any city, like the everlasting: Workboat or worker discussions... or even WB/WB/WRKR.... etc.

Edit:
I got 2303 cottage turns

while when I farm to size 11 and switch to cottages I get to 2228 cottage turns
Both of these figures (cottages turns) disturbingly deviate from your figures... I am currently going from Epic speed because that is the speed I most play at... that could make a big difference as on Epic you need 30 + 3/pop food to grow , while on normal 20 + 2/pop food to grow.
Which means with magic buildings
Normal speed, all farms to size 11: Reach size 11 at turn 21
Epic speed, all farms to size 11: Reach size 11 at turn 34

vicawoo
Mar 13, 2008, 04:16 AM
Maximizing cottage/production turns.

Theory: Current city is size n and we have a target city size N. FSB is the total food supply bonus, from terrain and special resources, but not normal farms/windmills. Then we measure cottage turns by (# cottages) * T_i - N * T_i (this will always be a negative number). i is the number of normal farms, T_i is the number of turns it will take to grow 1 size.

T_i = (10 + n) / (FSB + a). normal farms (i) + # worked special resource tiles (s) + # cottages = n, so we are maximizing relative to i
(n - i - s) * (10 + n) / (FSB + i) - N * (10 + n) / (FSB + i)
= - ((N - n + s) + i) * (10 + n) / (FSB + i).
So when (N - n + s) > FSB, this increaases with the number of farms, when N - n + s = FSB, it is invariant to the number of farms, and when N - n + s < FSB, it decreases with the number of farms.

Therefore, when N + s - FSB > n, farm, but then start making cottages and improving as fast as possible.

vicawoo
Mar 13, 2008, 04:17 AM
Application in generalized situations

1. Figure out target size N by food/health constraints. Now figure out the maximum output at that size N. For cottages, presumably this is N, although it may be less if you have to work a food resource to compensate for unhealthiness/bad terrain. For production, this is the maximum number of hammers. Whatever it is, call this N'.
2. Determine the food bonus/penalty, not including windmills or normal farms at size N.
Example: Irrigated rice, clam w/lighthouse, 1 floodplain, 5 grassland, 2 plains, 1 grassland/hill, 1 plain/hill.
FSB = 2 (from city) + (5 - 2) + (5 - 2) + (3 - 2) + 5*(2 - 2) + 2* (1-2)+ (1-2)+(0-2) - unhealthiness.
= 4, assume 0 unhealthiness. Presumably you won't be cottaging plain/hills.
s = number of special resources worked, if we assume we're not cottage/mining/farming over them inapporpriately.
3. For cottages, farm until size n = N' + s - FSB or if you have biology (N'+s-FSB)/2. (Why? since now turns to grow is (10+n)/(FSB + 2i), and the 2 factors out to (10+n)/(2*(FSB/2+i)).) Once you are at size N'+s-FSB-1, make the next improvement a cottage, and convert switch all non special food bonuses to cottages as quickly as possible.

Production is trickier, since you can't just count the number of mines or workshops if there is different terrain. For workshops without state property, since there is -1 food compared to a +1 food farm or +2 food farm, you may have to divide FSB by 3. Edit later.

For great people, (N'-n+s+i)/(FSB-2(n-s-i)+i), so N'-n+s > (FSB-2n+2s)/3, 3N'-3n+3s > FSB -2n+2s, n < 3N'+s-FSB, farm. edit and double check later.

Notes: technically we should be using FSB at size n instead of size N, but presumably you're either cottaging or farming your highest food tiles, so flood plains not withstanding, FSB should either stay the same or decrease as city size increases. It would be somewhat wasteful to farm, then cottage, then have to replace some of the cottages for farms when you're start working too many plains.

MyOtherName
Mar 13, 2008, 10:09 AM
Both of these figures (cottages turns) disturbingly deviate from your figures... I am currently going from Epic speed because that is the speed I most play at... that could make a big difference as on Epic you need 30 + 3/pop food to grow , while on normal 20 + 2/pop food to grow.
The numbers I posted are for epic; I specifically looked up the numbers so I could compare better with yours!

I'll redo the calculation when I get home tonight, and post the resulting timelines to the thread. e.g. a list like: (numbers hypothetical)

Turn 47:
Become size 17.
Food is 45 / 81.
Net cottage turns so far: 3147
Food surplus is 10.
Cottages worked is 11.
Turns spent: at this size: 4

except it would be somewhat condensed, like
47 @17 45/81 (3147) : +10 (11) : 4

Maybe you can post a similar list, and we can see where we differ.

namliaM
Mar 13, 2008, 04:30 PM
Application in generalized situations
I am sorry Vicawoo, I dont seem to follow this at all. Could you please make a sample with the discussion we are having?
That is this city
http://img50.imageshack.us/img50/3565/presumedcityaz6.jpg (http://imageshack.us)

No FPs, no clams no lighthouse etc... just this city please... *ugh* my aching head...

except it would be somewhat condensed, like
47 @17 45/81 (3147) : +10 (11) : 4

Maybe you can post a similar list, and we can see where we differ.
See now we are getting some place. Lets start easy tho... City with NO buildings at all ever.... just produces 1 hammer that disappears into limbo...

The max I seem to get out of it is 6.416 commerce, at 1807 cottage turns.
and keeping the farmed rice in tact... i.e. not cottaging it. And not :eek: even making it to size 15 ??? I will have to look into this...

Work farms to size 7, switching 3 farms to Cottages 1 turn before growing to 7 (turn 33). Size 7 (turn 34) and on work all cottages + the rice farm.
UP to and including turn 66 and the first turn of size 10, then too switching this to a non riverside cottage.

Anyway Stats (starting with turn 0):

Size Start Turn# Turns Food/turn Surplus Commerce/turn
1 7 7 5 2
2 7 6 10 6 3
3 13 6 13 7 4
4 19 5 16 8 5
5 24 5 19 9 6
6 29 5 22 10 7
7 34 10 19 5 14
8 44 11 21 5 16
9 55 11 23 5 24
10 66 29 25 5 26
11 95 31 24 2 36
12 126 33 26 2 45
13 159 35 28 2 49
14 194 7 30 2 49


Cottage turns for now are a bit hard to count for me... will commerce do?

Note: the commerce/turn doesnt add up, due to the growth between growing...

MyOtherName
Mar 13, 2008, 11:51 PM
Commerce is hard for me to count, because I'm doing this by hand. :(

Here are my figures for your strategy:

Size Start Food Surplus Cottages Turns Accumulated cottage turns
6 29 3/48 10 0 4 0
6 33 43/48 7 3 1 0
7 34 2/51 5 6 10 3
8 44 1/54 5 7 11 63
9 55 2/57 5 8 11 140
10 66 0/60 5 9 1 228
10 67 5/60 2 10 28 237
11 95 1/63 2 11 31 517
12 126 0/66 2 12 33 858
13 159 0/69 2 13 35 1254
14 194 1/72 2 14 6 1709
X 200 X X X 14 X 1793

You seem to have run for 201 turns; 1793 + 14 = 1807, as you got.

And for mine:

Size Start Food Surplus Cottages Turns Accumulated cottage turns
1 0 0/33 5 0 7 0
2 7 2/36 6 0 6 0
3 13 2/39 7 0 6 0
4 19 5/42 8 0 5 0
5 24 3/45 9 0 5 0
6 29 3/48 10 0 5 0
7 34 5/51 11 0 5 0
8 39 9/54 12 0 4 0
9 43 3/57 13 0 5 0
10 48 11/60 14 0 4 0
11 52 7/63 14 1 4 0
12 56 0/66 5 11 14 4
13 70 4/69 5 12 13 158
14 83 0/72 2 14 36 314
15 119 X/XX X 15 81 818
XX 200 X/XX X 15 XX 2033

For 2033 cottage turns, or 2048 if you run for one more turn.

When I grew to size 11, I switched one farm to a cottage.
When I grew to size 12, I switched all farms to cottages.
When I grew to size 14, I switched the rice to a cottage.

vicawoo
Mar 14, 2008, 12:21 AM
I'm looking at cottage turns, since in say 125 turns, everything should be towns. This does ignore riverside commerce, however.

Farm until size N+1-FSB. FSB=5, so farm until size N+1-FSB, then switch to cottages as fast as your workers allow. Deviations from that figure will be minor.

namliaM
Mar 14, 2008, 01:55 AM
Quick short reply, have to get to work....

You seem to have run for 201 turns; 1793 + 14 = 1807, as you got.
Yes, I also counted the tiles to be worked on turn 200 :sad: sorry.
Good spot!

When I grew to size 11, I switched one farm to a cottage.
When I grew to size 12, I switched all farms to cottages.
When I grew to size 14, I switched the rice to a cottage.
That is work one cottage at size 11
Work all cottages + Rice at size 12 and 13
Replace Rice by non-river cottage turn 14
Right?

This by my calculations generates 5843 commerce, while my variation nets 6416.
Your variation will take an additional 12 turns to get to 6431 commerce. While making 49 commerce/turn.
For your variation I do also count 2033 cottage turns (not including the last turn ;) )

Farm until size N+1-FSB. FSB=5, so farm until size N+1-FSB
N+1-FSB ??? WTF?
N would be target size (15) ...

15 + 1 - 5 = 11... farm everything untill size 11 then cottage... Yours seems to be simular/identical to MyOtherName.... eventho my variation (within the limits of the 200 turns experiment) returns the most commerce.
This is probably due to the fact that working a town for an extra turn over losing a cottage for 2 turns still results in a net of +2 commerce.

This you do not account for which results in MORE cottage turns on lower yields, resulting in lower commerce.

My conclusion would be:
1) You cannot count cottage turns to optimize this
2) Time is a factor, how many turns are left to grow/live ?
3) Not reaching the maximum pop, can be optimum :crazyeye: (within the # of turns left in the game)

<edit>
*Ugh*

I just found a nice little bug ! *GRMBL* This will probably change everything :sad:
I am glad I found it tho :) I will get back when it is fixed
</edit>

MyOtherName
Mar 14, 2008, 06:20 AM
This by my calculations generates 5843 commerce, while my variation nets 6416.
Your variation will take an additional 12 turns to get to 6431 commerce. While making 49 commerce/turn.
For your variation I do also count 2033 cottage turns (not including the last turn )
This can't be right. On turn 200, mine is working 14 towns and 1 village (9 turns until town). That's 59 commerce... plus the other incidental commerce from tiles that you also seem to be counting.

Anyways, as a sanity check, by your calculation of commerce, what happens if you run both scenarios another 90 turns? (Remember, my claims of optimality did explicitly assume that the time limit was sufficiently long for all cottages to mature into towns... your strategy was cut short!)


As for counting commerce... here are my estimates:
Over 200 turns, you worked 1793 cottage turns.
11 of those cottages were founded before turn 110. The others were founded on 126, 159, and 194.

If I assume each cottage turn = 4 commerce, then to compensate for the time spent maturing, I have to subtract off:
11 * (15*3 + 30*2 + 45*1) for the first 11 cottages
15*3 + 30*2 + 29*1 for the cottage @ 126
15*3 + 26*2 for the cottage @ 159
6*3 for the cottage @ 194
For a net commerce of 5273


Doing the same for mine, I have 2033 cottage turns. 14 were founded before turn 110. One was founded on turn 119. So, I have to subtract
14 * (15*3 + 30*2 + 45*1)
15*3 + 30*2 + 36*1
For a net commerce of 5891


Both methods have the same opportunity to get the extra coin from the city tile... and, my strategy grows faster and works the rice longer, so counting the raw tile yield should actually improve my strategy more than yours.

How did you get your figure of 6416 commerce for your strategy? I can't reproduce it.

namliaM
Mar 14, 2008, 05:18 PM
I can't reproduce it.
Like I said I found a bug... This makes everything different (see below)

MyOtherName's way (as I understand it, atleast the cottage turns match :) )
Work 1 cottage size 11
Work all cottages + Rice size 12 and 13
Work all cottages size 14 and 15

2033 cottage turns, 1 cottage (#15) has 8 turns to get to a town

Total commerce 7.594

My 'new' way
Farm all to size 11 minus 1 turn
Last turn size 10 work only 2 farms ( + Rice + 7 cottages)
First turn size 11 work all cottages
Work rice to Size 15

2040 cottage turns, all cottages make it to towns :)

Total commerce 7.637

Now this is much more looking alike that we did before (stupid bug), there is only 43 commerce difference :)

For all options between Working only the Rice and NO farms to Rice plus all farms to size 15 not farming at all is the worst option at 7.074 commerce (563 commerce missed) .
While overfarming, at all farms to 15 generates 7.304 commerce (330 commerce lacking)

In all there are 410 different options. While working the rice to size 15 and mixing all farms to size x and switching to cottaging.
Of those 410 options your option is 99.44% of my 'optimum', in total 135 (32.9%) of those 410 are within that top 0.56% of total commerce. I.e. losing 43 commerce or less.

So it would seem that the formula brings you atleast very close with no buildings. Presuming 70% science...
What about starting a city from scratch and whipping in a Granary? (cannot be bad IMHO)
What about even adding a Library?
And a University? Is that usefull?
Observatory what about that one? Usefull?
All depends on time available I think...

Granary
Granary Whip (2 pop) at size 4, turn 19 (which seems optimal for growing)
On all farms to size 15 you reach size 15 in turn 54 rather than turn 68, that is an overall gain of 14 turns... which cannot be a bad thing.
Due to the catch up time of the 2 pop whip the whipped city is actually smaller than the non-whipped city during turns 19 - 36, in turn 36 both cities are size 7 and the granary city starts gaining.

This appears to have a optimum at:
Farm everything up to and including size 10
On the first turn of size 11 only work 3 farms ( + Rice + Cottages )
Then switch to all cottages
Switch the rice to a cottage 4 turns before growing to size 15.

2237 Cottage turns for 8.301 commerce. That is 664 commerce gained by whipping the Granary.

Library and University to follow.

MyOtherName
Mar 14, 2008, 07:04 PM
I'm pretty sure that the 7 extra cottage turns cannot explain the 43 commerce difference.

Reviewing my calculations, the suggestion that you don't work the rice at size 14 was based upon cottaging over the rice:

(G = amount of food needed to grow)
Working non-rice cottage = (G / 2) * -1 = -0.5 G cottage turns lost
Working farmed rice = (G / 5) * -2 = -0.4 G cottage turns lost
Working cottaged rice = (G / 3) * -1 = -0.333 G cottage turns lost

Since G = 72, the difference between non-rice cottage and farmed rice should be about 7.2: consistent with what you observed. You should get an extra 4.8 cottage turns beyond what you observed if you did cottage over the rice.

(The formula predicts what happens at size 11 is irrelevant, so the fact you didn't put any overflow into the granary at size 11, and didn't work any farms, should have no contribution to the observed difference)



The library is definitely useful. You will get a library just from the one hammer per turn from the city tile. If watermills are available, then you can "spend" a cottage turn working a watermill instead, to get one hammer. Each hammer makes the library appear one turn earlier. Making the library appear one turn earlier is worth several cottage-turns. Slavery is probably better than watermills. I predict the best strategy gets a library before any cottages are worked, although I haven't tried to reason out how best to do it.

ParadigmShifter
Mar 14, 2008, 07:10 PM
OK, I think, to sum this thread up, we have to quote Barbie

"Math is hard".

namliaM
Mar 15, 2008, 04:55 PM
Offcourse working a cottaged rice over a normal -non river- cottage will be better.
You get an extra commerce AND +1 food. It is only logical....

But, that is only "true" with the hard limit on 15 and 200. I would like the option to work the rice and run a scientist or even grow more/faster over getting some more commerce. BUT presuming hard cap on both size 15 and 200 turns, yes.... working a cottaged rice > Cottaged normal grass...

about the difference in commerce between your and my options...
Because you run no cottages untill size 11 and only run 1 cottage at size 11 (turn 52 - 55) and only at that size 12 work all cottages I get a jump on you. During the last turn of size 10 (turn 51) + the 4 turns at your size 11, I am allready running cottages.

By turn 56 you have put in 4 cottage turns, while my option is allready at 47 cottage turns. From that point on the total commerce switches up and down. I have cottages growing to towns earlier, while you are working more cottages. Also the 12th cottage grows earlier in your scenario vs mine, since you grow to size 12 turn 56 and I grow to size 12 only in turn 65.

This is the overall explenation for the difference of 43 commerce as at turn 56 the 43 is exactly the difference in our two "plans".

MyOtherName
Mar 15, 2008, 06:24 PM
Offcourse working a cottaged rice over a normal -non river- cottage will be better.
You get an extra commerce AND +1 food. It is only logical....

But, that is only "true" with the hard limit on 15 and 200. I would like the option to work the rice and run a scientist or even grow more/faster over getting some more commerce. BUT presuming hard cap on both size 15 and 200 turns, yes.... working a cottaged rice > Cottaged normal grass...

about the difference in commerce between your and my options...
Because you run no cottages untill size 11 and only run 1 cottage at size 11 (turn 52 - 55) and only at that size 12 work all cottages I get a jump on you. During the last turn of size 10 (turn 51) + the 4 turns at your size 11, I am allready running cottages.

By turn 56 you have put in 4 cottage turns, while my option is allready at 47 cottage turns. From that point on the total commerce switches up and down. I have cottages growing to towns earlier, while you are working more cottages. Also the 12th cottage grows earlier in your scenario vs mine, since you grow to size 12 turn 56 and I grow to size 12 only in turn 65.

This is the overall explenation for the difference of 43 commerce as at turn 56 the 43 is exactly the difference in our two "plans".
It doesn't matter how the cottage+ turns are arranged: spending 7 extra turns working towns is a 28 difference in commerce -- and the difference must actually be less, because yours all matured, while mine didn't.

You harvested:
225 cottage turns (= 225 commerce)
450 village turns (=900 commerce)
675 hamlet turns (=2025 commerce)
690 town turns (=2760 commerce)
-----------------------------------
2040 cottage+ turns for 5910 commerce from them

I harvested (using your estimate that one village had 8 turns left until town):
225 cottage turns (= 225 commerce)
450 village turns (=900 commerce)
667 hamlet turns (=2001 commerce)
691 town turns (=2764 commerce)
-----------------------------------
2033 cottage+ turns for 5890 commerce from them


If you insist on looking at it differentially -- then you cannot ignore the fact that my city grows to 12, 13, and 14 faster than yours.


I suggested that the only difference in the net results was due to the fact I spent turn 14 suboptimally (what I called the 'optimal strategy' cottages over the rice; I forgot to recompute the optimal strategy at size 14 if we do not cottage over the rice -- the formula says to work the rice). I've redone my timeline for what I assert is an optimal strategy given the condition we do not cottage over the rice:

The relevant difference is that I now work (rice + cottages) for 14 turns at size 14, and then all cottages for 1 turn.


Size Start Food Surplus Cottages Turns Accumulated cottage turns
1 0 0/33 5 0 7 0
2 7 2/36 6 0 6 0
3 13 2/39 7 0 6 0
4 19 5/42 8 0 5 0
5 24 3/45 9 0 5 0
6 29 3/48 10 0 5 0
7 34 5/51 11 0 5 0
8 39 9/54 12 0 4 0
9 43 3/57 13 0 5 0
10 48 11/60 14 0 4 0
11 52 7/63 14 1 4 0
12 56 0/66 5 11 14 4
13 70 4/69 5 12 13 158
14 83 0/72 5 13 14 314
14 97 70/72 2 14 1 496
15 98 X/XX X 15 102 510
XX 200 X/XX X 15 XXX 2040

Which works out to 2040 cottage turns, all matured into towns.

This jumps to 2045 cottage turns if you permit me to cottage over the rice at size 14.



I speculate that the difference in commerce is accounted by the extra turns you spend working the rice. In fact, if we treat the rice as giving 5 food and 1/4 of a cottage turn, then calculations give, at size 11:

G = food needed to grow
N = number of cottages worked

net loss = { G / (5 + (10 - N)) turns } at {15 - N - 0.25 loss per turn}
= G * (14.75 - N) / (15 - N) = G * (1 - 0.25 / (15 - N))

So minimizing loss means maximizing N -- and so this variation on costing the rice suggests that we do exactly what you did: working rice + all cottages at size 11 is optimal... rather than it being entirely irrelevant what you do as long as you work the rice.

Exercise: replace the river with an alternate source of fresh water (and civil service), such as an oasis next to the BFC. This still lets us farm; I expect that your optimizing will also find that what you do at size 11 is irrelevant.

namliaM
Mar 16, 2008, 06:59 AM
It doesn't matter how the cottage+ turns are arranged
Appearently it does... now lets see...
Turn 51 is where the intresting stuff starts happening....
You work no cottages, while I start with 7 cottages. (i.e. in turn 51 I make 7 extra commerce)
Then turn 52 I add 3 more cottages at size 11, while you run 1 cottage. I still make +9 commerce over you (+16).
Turn 53 +9 commerce (+25), turn 54 (+34), turn 55 (+43)
Turn 56 you grow to size 12 while I am stuck at size 11. You add a cottage, and run all cottages... so at this point you are up one over me (-1). You keep gaining 1 commerce for 9 turns untill turn 65 at wich point I too grow to 12. 43 - 9 = 34
For one turn we work both 11 cottages, and the rice. Then turn 65 I have 7 Hamletts + 7 commerce (41 total difference).
Turn 66 another 3 hamletts, while you get 1 (+9 commerce, 50 overall).
This continues on thru turn 69 where you grow another pop and add a cottage for one extra commerce for you. Total difference at this point 68 commerce.
Turn 70 you too grow to hammlets but in comparison to me you are working one more Hamlett (over a cottage) and one more cottage. So the difference drops by 2 commerce each turn.
Untill I to grow and my cottage matures to a hamlett.... etc etc etc...

This goes on and on, graphic displayed below shows how and when.
http://forums.civfanatics.com/attachment.php?attachmentid=171516&stc=1&d=1205666093

I think this math is sound....

then you cannot ignore the fact that my city grows to 12, 13, and 14 faster than yours. No I cannot, but simularly you cannot ignore that my cottages grow to hamletts/Villages/towns 4 turns earlier than yours do...

The relevant difference is that I now work (rice + cottages) for 14 turns at size 14, and then all cottages for 1 turn.
When you work this out, you will find you come to a total of 2040 cottage turns and a total commerce of 7599 (yes I do count the river commerce and CC! No trade route(s) tho)
I total agree tho, 5910 commerce from the cottages/hamletts/villages/town alone...

While I am getting overall still 9 extra commerce....
http://forums.civfanatics.com/attachment.php?attachmentid=171517&stc=1&d=1205667323

This jumps to 2045 cottage turns if you permit me to cottage over the rice at size 14.
I think this doesnt matter as I am not using the cottaged rice either. I do think with a hard cap at 15 and 200 turns cottaging the rice at -some point- is optimum, more food = more commerce...
Tho it is a few commerce... 5 in your calcs... but still... it is more.

I speculate that the difference in commerce is accounted by the extra turns you spend working the rice. In fact, if we treat the rice as giving 5 food and 1/4 of a cottage turn, then calculations give, at size 11:

G = food needed to grow
N = number of cottages worked

net loss = { G / (5 + (10 - N)) turns } at {15 - N - 0.25 loss per turn}
= G * (14.75 - N) / (15 - N) = G * (1 - 0.25 / (15 - N))

So minimizing loss means maximizing N -- and so this variation on costing the rice suggests that we do exactly what you did: working rice + all cottages at size 11 is optimal... rather than it being entirely irrelevant what you do as long as you work the rice.
:crazyeye: :eek: :cry:
Totaly losing me, to much formula... not enough facts...
All I get is that you now seem to agree with me that working cottages at size 11 is optimal?

I highly doubt if having a river or not will make much difference. Weather you are working a 3/0/1 farm or 3/0/0 or simularly a 2/0/2 cottage vs 2/0/1 cottages will offcourse make a difference in total commerce, but not for optimum strategy?? The +1 commerce is there no matter farm or cottage...

Some day soon I hope to publish my spreadsheet :)

MyOtherName
Mar 16, 2008, 11:26 AM
No I cannot, but simularly you cannot ignore that my cottages grow to hamletts/Villages/towns 4 turns earlier than yours do...
I didn't ignore it. I separated the cottage+ turns into cottage turns, hamlet turns, village turns, and town turns.

No matter how you worked them, if they all matured into towns, then for each of them, you spent 15 turns working it as a cottage, 30 turns working it as a hamlet, 45 turns working it as a village.

The same for me, except one of them I only spent 37 turns working it as a village. (Becuase you said it had 8 turns left to mature) I worked 8 fewer village turns, but 1 extra town turn, for a commerce difference of 20.

Tho it is a few commerce... 5 in your calcs... but still... it is more.
5 cottage+ turns, when everything is a town, is 20 commerce, not 5.

I highly doubt if having a river or not will make much difference. Weather you are working a 3/0/1 farm or 3/0/0 or simularly a 2/0/2 cottage vs 2/0/1 cottages will offcourse make a difference in total commerce, but not for optimum strategy?? The +1 commerce is there no matter farm or cottage...
The +1 commerce is not there when we're considering the difference between a farmed rice and an off-river cottage. I suppose you could achieve the same effect by simply moving the rice away from the river. (But put it next to the city tile, so you still get the fresh water bonus immediately)

namliaM
Mar 16, 2008, 11:34 AM
I didn't ignore it.

So tell me what is wrong with below math??

Appearently it does... now lets see...
Turn 51 is where the intresting stuff starts happening....
You work no cottages, while I start with 7 cottages. (i.e. in turn 51 I make 7 extra commerce)
Then turn 52 I add 3 more cottages at size 11, while you run 1 cottage. I still make +9 commerce over you (+16).
Turn 53 +9 commerce (+25), turn 54 (+34), turn 55 (+43)
Turn 56 you grow to size 12 while I am stuck at size 11. You add a cottage, and run all cottages... so at this point you are up one over me (-1). You keep gaining 1 commerce for 9 turns untill turn 65 at wich point I too grow to 12. 43 - 9 = 34
For one turn we work both 11 cottages, and the rice. Then turn 65 I have 7 Hamletts + 7 commerce (41 total difference).
Turn 66 another 3 hamletts, while you get 1 (+9 commerce, 50 overall).
This continues on thru turn 69 where you grow another pop and add a cottage for one extra commerce for you. Total difference at this point 68 commerce.
Turn 70 you too grow to hammlets but in comparison to me you are working one more Hamlett (over a cottage) and one more cottage. So the difference drops by 2 commerce each turn.
Untill I to grow and my cottage matures to a hamlett.... etc etc etc...

This goes on and on, graphic displayed below shows how and when.
<Graph removed>
I think this math is sound....

jason77024
Aug 09, 2008, 02:15 AM
OK, I think, to sum this thread up, we have to quote Barbie

"Math is hard".

A possible generalization for us mid-level* Civ players not currently under consideration for a Fields medal:

After the Machinery/Calendar improvements and before Railroad, your workers aren't doing as much (except for lumbermills, but even that is a good way off). Cottage over all your non-resource farms (other than irrigation), start with the big (double-digit) cities. Ignore the GP farm, and the military city/-ies of course, and leave 2-3 farms in cities with only one food special.

NB. Whether or not you in fact change civics from Slavery to Serfdom, I am guessing Firaxis put Serfdom there for a reason. (It's not just for building plantations, is it? Especially if you chopped the jungle in advance.) And it's not for railroads - Steam Power is for that.

Especially for part- or full-time wonder-mongers, this gets towns (or villages at least) in place in time for Astronomy, SciMeth, and Corporation. It's admittedly not quite in time for Liberalism, so maybe run Bureaucracy longer (how terrible is that?), but Printing Press and Democracy should be fine.

I am certain that this is not mathematically perfect, but if nothing else it's a good jumping-off point for those mediocre players (like myself) who tend to

(a) stay stuck in an SE and hit the research wall with Industrial techs (losing the Colossus, GLib, and GLH along the way); or
(b) get frustrated with the early CE, especially if we get jumped and have to whip archers from slow-growing size 3 cities.

Note for the math guys here: your calcs are indeed very cool, but some of us would prefer to overthink other aspects of the game. :) Seriously, this does piggyback off the many posts above, just in a way that hopefully the non-number-crunchers can benefit. So I hope you don't mind me putting your math in a non-math format. I have been playing SE games lately that have not ended in the usual "knights and spies FTW,"** and have been thinking about this transition economy question the last couple weeks - usually as my civ tries to grind out the path to Advanced Flight after losing the Great Lighthouse.

* not including you in "mid-level," PS

** I have nothing against late-game domination wins. My -computer-, on the other hand...

sugerdady87
Feb 10, 2009, 05:26 PM
The optimal strategy is always to grow your city fastest, no matter you need it for cottage or production, then specialize it. Many exceptions... and yes I didn't read past the first post of this thread.

noto2
Feb 10, 2009, 09:14 PM
The question is a silly one anyway. Why would you want to cottage every tile? For me, I'd farm the food resource, maybe build 1 more farm, build a few watermills, and cottage the rest. That way the city grows quickly, gets hammers quickly so it can build its own infrastructure (if not running slavery) and then gets commerce going.

Skallagrimson
Feb 11, 2009, 02:49 PM
Let's say you build a fresh new commerce city with say 1 food source (e.g, grassland cows/rice) with a river running through the bfc and the city is on the river. The rest of the tiles are grassland. It's a nice commerce city, but doesn't have an abundance of food driving its growth.

Let's say you have the health and happiness to grow easily to size 15 right away.

Would it be better to:

1) Cottage the 19 non-food tiles and grow slowly, adding and working cottages along the way?

2) Farm the river tiles and grow to size 15 asap then cottage over the farms?

3) Add a couple farms to help growth, but then add cottages?

Slow growth with max cottages? Fast growth while delaying cottages? Medium growth with a mix of farms and cottages?

In that theoretical commerce city I would put it through three phases:

a) Farm up initially for growth to near the caps. Whip moderately for infrastructure. Run specialists.
b) At Machinery, water wheel the river tiles for faster infrastructure builds (them universities ain't CHEAP!)
c) At Universal Sufferage, infrastructure should be laid down for the most part and towns become more powerful. Switch the w/wheels to cottages. Supplement with farms or windmills as needed to tweak up the food yield. Towns don't take long to mature, especially in that phase of the game.

In a sense it's a conversion from SE commerce, to semi-prod, to CE commerce, over the course of the game.

noto2
Feb 11, 2009, 03:28 PM
except that you want to work the cottages as early as possible or else they are useless late game. That's why I mix it up. First 2 citizens, work farms, next one works a mine, next works a cottage, next works a watermill, cottages after that, for example.

UWHabs
Feb 11, 2009, 03:37 PM
You also have to think if you have a few jump points. I haven't gone through the thread, but if you're doing this post-printing press, then you want to grow the cottages into villages to get the extra +1 commerce. And if running free speech, then again, you want to rush to get your towns up and running.

My gut feeling is that if you're working more than 2-3 farms more than the food resource (ie getting a net higher than +6-+8 a turn of food), you're not working enough cottages. Getting even 1 or 2 towns up early will help you long-term more than waiting until you've made it to size 15 and cottaging.

futurehermit
Feb 11, 2009, 03:43 PM
Funny to see an old thread of mine brought back from the great beyond :lol:

Bleys
Feb 11, 2009, 04:04 PM
except that you want to work the cottages as early as possible or else they are useless late game.
Its not too bad, they grow pretty quickly under Emancipation. Sure, its best to have a decent amount of established Towns as fast as you can, especially if you plan to convert to a full-blown CE later in the game, but I have often built a pile of newish cottages just after Constitution and had them up and running in a reasonable timeframe.

As for the OP, I play em half and half. A couple farms, a couple cottages, and work what I wish too, build what I need next. I usually whip new cities a couple times, so the cottages dont get worked so much early on, but eventually, they pop a coin, and eventually I let em grow ASAP, build a fast Granary, Courthouse, Library, and away we go.