[Freeciv-Dev] [patch #4885] Revised logic for AI improvement consideration and improvement redundancy
Update of patch #4885 (project freeciv): Status: Ready For Test = Done Open/Closed:Open = Closed ___ Reply to this item at: http://gna.org/patch/?4885 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #4885] Revised logic for AI improvement consideration and improvement redundancy
Follow-up Comment #6, patch #4885 (project freeciv): Rebased improve-Ai-inspection-of-effects-requirement-vectors.patch over r25732 (patch #4983), added implementations for VUT_SPECIALIST and VUT_NATIONALITY, and added recursion to the VUT_IMPROVEMENT check to avoid believing an improvement that depends on an unbuildable improvement is buildable. (file #21568) ___ Additional Item Attachment: File name: improve-AI-inspection-of-requirement-vectors.patch Size:13 KB ___ Reply to this item at: http://gna.org/patch/?4885 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #4885] Revised logic for AI improvement consideration and improvement redundancy
Follow-up Comment #7, patch #4885 (project freeciv): Pulled back some of the changes in draft revisions for patch #4987 which would also be applicable to the AI into replace-AI-uses-of-is_improvement_redundant.patch: update attached. (file #21569) ___ Additional Item Attachment: File name: replace-AI-uses-of-is_improvement_redundant+productivity.patch Size:13 KB ___ Reply to this item at: http://gna.org/patch/?4885 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #4885] Revised logic for AI improvement consideration and improvement redundancy
Update of patch #4885 (project freeciv): Status: In Progress = Ready For Test ___ Follow-up Comment #5: And a new pair of patches for this. These patches are independent of each other, but are both required to remove AI reliance on is_effect_prevented(): direct uses are replaced with calls the new dai_can_requirement_be_met_in_city() inside the requirements iterations, which saves duplicate iterations of the requirements vectors, and contains more subtle logic to determine whether it would be impossible to achieve for improvements (techs only look at present circumstances anyway). Indirect uses (through is_improvement_redundant()) are replaced with extension and greater use of building_unwanted() for calls from aicity.c, and the relatively simple check for effects or side_effects in the advisor code. (file #21559, file #21560) ___ Additional Item Attachment: File name: improve-Ai-inspection-of-effects-requirement-vectors.patch Size:12 KB File name: replace-AI-uses-of-is_improvement_redundant.patch Size:11 KB ___ Reply to this item at: http://gna.org/patch/?4885 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #4885] Revised logic for AI improvement consideration and improvement redundancy
Update of patch #4885 (project freeciv): Depends on: = patch #4990 ___ Reply to this item at: http://gna.org/patch/?4885 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #4885] Revised logic for AI improvement consideration and improvement redundancy
Follow-up Comment #4, patch #4885 (project freeciv): New strategy, informed by IRC discussion: 1) AI callers of is_effect_prevented() and is_improvement_redundant() to use new daieffects facility to determine if an improvement provides any currently useful feature (units, extras, disaster protection, action enablement, action prevention, etc.), or could do so in the future given the capabilities of the AI. 2) is_improvement_redundant() to be replaced with function to determine if an improvment is currently useful (based on checking if the improvment affects units, extras, disasters, actions, effects, etc.), which will be used to provide UI guidance in the client, and client strings related to redundant will be adjusted to better fit the new semantics. This ticket now only strives to achieve the first of these: client-facing changes will be in patch #4987. ___ Reply to this item at: http://gna.org/patch/?4885 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #4885] Revised logic for AI improvement consideration and improvement redundancy
Follow-up Comment #3, patch #4885 (project freeciv): I no longer believe this ticket can be split: the manner in which the AI detects whether an improvement is interesting is somewhat semantically bound to how is_improvement_redundant() is implemented. From the client side, the calls to is_improvement_redundant() seem sensible: ask if buildings currently in cities are currently providing a benefit (with no promise that they won't start providing a benefit later). A sensible implementation for this is just to see if the improvement provides value (money, units, extras, disaster protection, action prevention, effects, etc.), which isn't terribly difficult (although a bit tedious, with lots of potential for consolidated logic). Doing this properly will also require some means of deciding whether an additional effect value is actually beneficial (for example, an effect that reduced unit movement by 1 should probably not be considered beneficial). For the AI, things are a bit different. The AI seems to use this in part to decide if a building that isn't currently in a city will ever be interesting to have, so using the same logic above means that many improvements that *will* be interesting later are ignored, reducing the want value for dependencies (e.g. Libraries get built less because they fact that they enable Universities isn't interesting, because the University isn't providing any effect for a city without a Library). Also, the AI immediately sells any improvement that it detects as redundant, so improvements that are only sometimes useful tend to get sold before they are useful when conditions aren't right (e.g. switch from Democracy to Communism: lose Superhighways trade bonus, sell Superhighways, find Democracy less interesting later (and if interesting enough, less beneficial than before)). I'm tempted for the AI to consider building utility differently, selling buildings less often: this may mean keeping buildings that aren't currently useful (e.g. Cathedrals in the presence of Michelangelo's Chapel or Police Stations in the presence of Women's Suffrage), but seems to cause the AI to develop cities more in general. Others opinions on the matter welcomed. ___ Reply to this item at: http://gna.org/patch/?4885 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #4885] Revised logic for AI improvement consideration and improvement redundancy
Follow-up Comment #2, patch #4885 (project freeciv): I decided to try this a different and more general way, but the result doesn't actually work. Barracks III isn't made redundant by Airport anymore (which is good), but now Women's Suffrage isn't making Police Station redundant (which is bad). Any input on a model for considering redundancy that doesn't depend on an nreqs-like concept appreciated. Note that the new redundancy patch depends on patch #4938, patch #4939, and patch #4930. The AI portion is merely rebased: as that seems to have been unchanged as I've thought about this more, and only the redundancy issue being a blocker, I'm considering splitting the ticket. (file #21387, file #21388) ___ Additional Item Attachment: File name: AI-check-missing-improvement-reqs-with-more-care+r25512-rebase.patch Size:7 KB File name: calculate-building-redundancy-more-completely.patch Size:16 KB ___ Reply to this item at: http://gna.org/patch/?4885 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #4885] Revised logic for AI improvement consideration and improvement redundancy
Update of patch #4885 (project freeciv): Status:Works For Me = In Progress ___ Follow-up Comment #1: Seems that this needs better logic for EFT_DEFEND_BONUS, as otherwise Barracks III becomes redundant due to Airport. Looking at the relevant AI code, it seems the AI already thinks this is the case, so perhaps it makes sense to sort the AI first, and then use the same logic the AI will use for redundancy. I presume similar guidance ought apply for EFT_UNIT_RECOVER, EFT_VETERAN_BUILD, EFT_VETERAN_COMBAT, EFT_HP_REGEN, and EFT_UPKEEP_FACTOR, in that an improvement providing any of these effects should only be considered redundant if it fails to provide a bonus for any unit (considering class, type, and flags). If I've missed something here, please correct me, as otherwise I'll be using this list as the set for which unit checking is required. ___ Reply to this item at: http://gna.org/patch/?4885 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev