I am trying to calculate a set of items that produce the highest damage output in a video game. There are about 50 different items, of which you can choose 6. There are all sorts of conditions that each item creates. I am writing a small app in javascript that calculates your damage based on the items. Could I utilize a genetic algorithm to find out which item combinations are the strongest? Or is brute force acceptable for this size of a problem? Or is there another way?
|
|
There are 50 items, of which you can have 6 at a time, meaning you have Genetic algorithm seems like overkill here, since I think it'll take too long for it to give you an ideal set compared to brute force. Assuming you can't run it once and store it, I would figure out if there's some way you can optimize the order of the items before running the query and prune out some of the weak combinations, and get that number down a bit before running your algorithm. |
|||||||||||||||||
|
|
IT depends what the items and other variables of your problem are, but you can probably make good use of heuristics here. Basically, there's probably a way to rule out some of the items right away because their stats distribution don't match your character. Then you can probably do stuff like "Most important stat is damage (for example), let's start by calculating the item set that maximizes this stat then see if swapping items from this set with others not previously retained to see if there's improvement in overall performance". There's a lot of ways to approach this sort of problem, but genetic algorithms seem a little overkill here. Want to share more info specific to your problem? Maybe we can help you better then! Actually, the way I would probably approach it would be to precompute a "score" for every item, then sort them and pick the 6 highest scores. I'll still leave the rest of my answer as a reference. |
|||
|
|
|
a GA is one approach, if brute-force isn't practical permutations of heuristics and calculating/simulating the effects may also be viable; there's good precedent for this approach in Doug Lenat's use of Eurisko to design ships for Traveller tournaments |
|||
|
|
|
If a genetic algorithm is suitable depends on the characteristics of the items. If similar items have a similar damage it would be more suitable than if there are items, that suddenly alter your damage, but they are only slightly different to others with much less/higher damage. For example usually STR will increase your damage, than the algorithm would probably start to favor those items with high damage, but it may never find a solution with that funky shiny helm that gives no damage, but adds half of your intelligence multiplied by your dexterity to you strenght. Try to imagine the solution space and how the algorithm would "travel" around there. Im afraid its highly possible to get stuck with a solution thats far from the optimum. |
|||
|
|
