【问题标题】:Is there any non-heuristic approach in resolving these types of problems是否有任何非启发式方法来解决这些类型的问题
【发布时间】:2015-12-14 08:29:46
【问题描述】:

我正在尝试解决以下问题。

Given the following:
resources: food, wood, stone, gold
units: peon(requirements: 50 food, town hall, 3 turns to make) which can produce: 10 amount of any resource or 3 building points
       warrior(requirements: 30 food, 20 wood, 4 turns to make, barracks)
       archer(requirements: 30 wood, 25 gold, archery, 3 turns to make)
buildings: town hall(requirements: 500 food, 500 points, 20 building points) required to produce peons, only one peon can be produced at a time
           barracks: 100 wood, 50 stone, 10 building points, required to produce warriors
           archery: 200 wood, 30 gold, 12 building points, at least one barracks, required to produce archers
and the following: starting resources, buildings, units and their quantities
                   final resources, buildings, units and their quantities
output: the minimum required turns to get from starting quantities to final quantities of resources, buildings and units
notes: you start with at least one town hall
       what's the point of having multiple town halls: they can produce peons faster

现在,我的第一个方法是使用启发式方法来解决这个问题,即从最终状态中选择最昂贵的资源/建筑物/单元,并确定我需要什么才能达到该数量。

我的问题是:是否有任何非启发式方法来解决这个问题/这种类型的问题。

【问题讨论】:

    标签: algorithm greedy heuristics


    【解决方案1】:

    好吧,你可以通过一点分析来简化问题......

    战士和弓箭手在提出的问题中没有任何价值,所以你永远不会花费资源来创造它们,因此不需要营房或射箭建筑

    剩下的就是:

    • 单位:苦工(要求:50个食物,市政厅,3回合制作)可生产:10个任意资源或3个建筑点

    • 建筑:市政厅(要求:500食物,500点,20建筑点)需要生产苦工,一次只能生产一个苦工

    如果您只使用现有的 peon 和市政厅,然后您可以评估所需的转弯次数,直到您拥有所需的资源。

    如果创建更多市政厅会对此有所改善,那么您显然希望尽早开始创建市政厅。因此,推测性地分析这样做的影响,并将其与早期的结果进行比较。如果建筑物有帮助,请进行类似的分析,以决定是否在每个建筑物完成后开始另一座建筑物....

    【讨论】:

      【解决方案2】:

      您可以在所有可能移动的搜索树中执行呼吸优先搜索。

      这可能需要很长时间,但保证找到最佳解决方案。
      wikipedia: breath first search

      A* 搜索可以更快,但您需要找到一个永远不会低估解决方案剩余(未知)部分成本的启发式方法。
      wikipedia: A*-search

      【讨论】:

        【解决方案3】:

        似乎唯一的决定是是否建造最终结果中不需要的额外建筑物。我认为可以使用成本效益方法来完成。例如。建造额外的市政厅,成本是已知的,收益取决于它的运营时间。 我认为使用启发式算法是可以的,优化问题的一般解决方案是 NP 困难的。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2021-11-20
          • 2021-12-30
          • 2020-10-29
          • 1970-01-01
          • 2021-11-20
          相关资源
          最近更新 更多