-3

Here's a simplified version of the problem:

You have a group of five warriors. Each warrior owns between 1 and 10 items, and each can bring 1 of their items to a battle. Given information about the battle (terrain type, time of day, etc.), which weapon should each warrior choose to produce the strongest group?

Items can be a bow, shield, sword, catapult, medical kit, horse, etc. Terrain type can be mountainous, plains, marsh, snow, etc.

Note that the rules cannot be easily codified because they're based on synergies between items and and terrain conditions: for instance, a "sword" is a good weapon, and a "bow" is a good weapon, but five warriors with swords or five warriors with bows is worse than two warriors with bows and three with swords, because five warriors with swords are vulnerable to ranged attacks without cover, and five warriors with bows are rendered useless by shields. There are also complex terrain conditions, for example if the terrain is very difficult to cross or if you're on top of a hill, bows are better. A horse would be great on flat terrain, but if one person has a horse and the other people don't have weapons then the horse is useless.

My naive solution is to (a) train a machine learning regression algorithm to take terrain information and a set of 5 item combinations as input and produce a value, where higher is better, and then (b) produce all combinatoric inputs of items, feed each into the algorithm, and pick the highest value. However, that gets prohibitively expensive every quickly as the combinatorics explode.

Is there a better algorithm for saying "given all of these possibilities, pick the best combination"? Bonus points if it's usable on Amazon's Machine Learning stack.

Eli Brown
  • 63
  • 1
  • 4
  • 1
    Welcome to StackOverflow. Please read and follow the posting guidelines in the help documentation. [on topic](http://stackoverflow.com/help/on-topic) and [how to ask](http://stackoverflow.com/help/how-to-ask) apply here. StackOverflow is not a design, coding, research, or tutorial service. This question is teetering between "too broad" and "asking for an off-site resource". – Prune Apr 10 '17 at 21:31
  • @Prune - point noted about off-site resources, but can you help me understand how this is too broad and how I can fix it if so? I thought this question was pretty specific: given this specific problem and input, what machine learning algorithms take this input and produce an output that I defined. Seems appropriate for SO to me. – Eli Brown Apr 10 '17 at 23:58
  • 1
    Stack Overflow is aimed at specific programming problems. This is a design problem, better suited for some group that works on a more general level. Cross-validation or statistics might be appropriate choices. Note also the, so far, nobody else has commented or voted on your question, so we're talking about my personal opinion, not an overwhelming mandate. :-) – Prune Apr 11 '17 at 00:22

1 Answers1

0

This is not a machine learning problem. This is an search/optimization problem and therefore there is no best "machine learning" algorithm for it. See: https://en.wikipedia.org/wiki/Mathematical_optimization

Given that you already have a cheap way to simulate a battle given a terrain and a combination, the problem you mention in your naive approach is that testing all combinations is too expensive, just don't! There are many search algorithms that will try to prune your search space (see https://en.wikipedia.org/wiki/Beam_search). An easy to implement technique that fits very well in your case (it's precisely one of the typical examples) is the use of genetic algorithms where your genotype is the composition of the warriors. There are plenty of libraries for GA that I bet you can import into AWS.

Josep Valls
  • 5,483
  • 2
  • 33
  • 67