Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. Read more...

Feature #839704

CMA max_growth option for optimal food surplus

Added by Zoltán Žarkov almost 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Category:
General
Sprint/Milestone:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

In lt.net rulesets, the max granary size is typically either 40 or 50, meaning with granaries either 20 or 25 food respectively is required to grow. Many players would rather not manually set workers every turn to exactly hit the granary size, ie. for 25 food have surpluses of +13 and +12, or +9 +8 +8. The max_growth cm_parameter will select the food surplus each turn that will grow the city in the fewest number of turns possible without overshooting the granary.


Related issues

Blocks Freeciv - Feature #839703: Server-side CMAClosed

<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>

History

#2 Updated by Zoltán Žarkov almost 3 years ago

  • Sprint/Milestone changed from 3.0.0-beta1 to 2.6.1

The S3_0 patch above applies cleanly to S2_6- might as well apply it there too.

#3 Updated by Jacob Nevins over 2 years ago

  • Sprint/Milestone changed from 2.6.1 to 2.6.2

#4 Updated by Marko Lindqvist over 2 years ago

  • Category set to General
  • Status changed from New to In Progress
  • Sprint/Milestone changed from 2.6.2 to 3.1.0

Zoltán Žarkov wrote:

The S3_0 patch above applies cleanly to S2_6- might as well apply it there too.

I don't think there will be any users for this in the stable branches.

#5 Updated by Marko Lindqvist over 2 years ago

  • Assignee set to Zoltán Žarkov

- Function should be named not that to look like minimum_food_surplus in a generic case, but only in the special case that we want to grow as fast as possible. min_food_surplus_for_fast_growth()?
- Function definition beginning curly brace to a line of its own
- if (!ptile) should be followed by a block despite being just one line
- I think min_turns can end 0 in some special cases, leading to division by zero on the last line

#6 Updated by Marko Lindqvist over 2 years ago

Do you still have plans to build on top of this? If yes, we should get this to acceptable form and merged.

#7 Updated by Zoltán Žarkov over 2 years ago

- Renamed
- Fixed style
- Added comment explaining why min_turns will never be 0

#8 Updated by Marko Lindqvist over 2 years ago

  • Status changed from In Progress to Resolved
  • Assignee changed from Zoltán Žarkov to Marko Lindqvist

#9 Updated by Marko Lindqvist over 2 years ago

  • Status changed from Resolved to In Progress
  • Assignee changed from Marko Lindqvist to Zoltán Žarkov

From an autogame with this (and bunch of other patches I hope do not affect this) I get a lot of:

1: in auto_arrange_workers() [../../../src/server/cityturn.c::408]: assertion 'cmr->found_a_valid' failed.

At its present state patch should not affect worker placement at all, as we should never execute the new code, but I assume unitialized max_growth parameter leads it to execute it anyway. Second issue is that it then fails when executed.

#10 Updated by Zoltán Žarkov over 2 years ago

- Handle max_growth in init, cmp places for cm_parameter struct
- Return negative value from min_surplus function. If a city is unavoidably starving, use this setting to just maximize food output rather than returning a 0 goal that causes cma to not find solution.

#11 Updated by Zoltán Žarkov over 2 years ago

#12 Updated by Marko Lindqvist over 2 years ago

  • Status changed from In Progress to Resolved
  • Assignee changed from Zoltán Žarkov to Marko Lindqvist

Autogame works better now.

#13 Updated by Marko Lindqvist over 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF