Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee.

19
Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee

Transcript of Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee.

Page 1: Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee.

Hunter Gear Optimization

Team Alt + F4

Michael Barbour; Joshua Law son; Michael Lee

Page 2: Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee.

Formal Statement

Our goal is to maximize damage per second (represented by the variable vi) subject to time, play time, (represented by wi.)

Maximize:

Subject:

• T = all possible subsets

• Xi = Each item

• Vi = Value of Xi

• Wi (Weight or limiting factor) of Xi

Page 3: Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee.

Informal Statement

• Our goal with the chosen project involves looking at a Set of items within World of Warcraft and writing algorithms to select subsets of gear that maximize the DPS (Damage Per Second).

• There are 7 gear slots with 4 or 5 possibilities each.

• Only 1 item will be selected per slot.

Page 4: Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee.

Abstract

• We then treat this problem as a modified 0/1 Knapsack problem. • A 0/1 Knapsack problem is where the number of Xi copies is

restricted to either 0 or 1.

• The modification we made makes it so each item is categorized by slot and only one item per slot can be selected.

• This applies to the in-game system where multiple items can not be used in the same slot.

Page 5: Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee.

Algorithms

• Brute Force: Enumeration through every possible gear combination.• O(an): a = number of items in a slot, n = the number of gear slots.

• BackTracking: An approach that searches through a list based upon a best case step.• O(an)

• Greedy: A naïve approach that chooses the gear set with the highest Vi• O(n2)

Page 6: Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee.

Brute Force Algorithm

• Creates a truth table that has as many entries the number of gear slots that are being tested and that are as deep as the amount of gear in each slot

• The drop chance as well as the value on each gear set is calculated

• O(an) complexity (4 * 5 * 5 * 5 * 5 * 5 * 5 = 233,280 possible gear sets)

Weapon

0

4

Chest

0

5

Legs

0

5

Gloves

0

5

Boots

0

5

Helmet

0

5

Shoulders

0

5

Page 7: Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee.

Brute Force Algorithm

012

0024

0036

0048

0060

0072

0084

0096

00

1080

0

1200

0

1320

0

1440

0

1560

0

1680

0

1800

0

1920

0

2040

0

2160

0

2280

0

2400

0

2520

0

2640

0

2760

0

2880

0

3000

0

3120

0

3240

0

3360

0

3480

0

3600

0

3720

0

3840

0

3960

00.00%

0.50%

1.00%

1.50%

2.00%

2.50%

3.00%

3.50%

4.00%

Brute Force Frequencies

Any Probability

Above 80%

Above 85%

Page 8: Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee.

Brute Force Algorithm

• Pros:• Explores all options and

finds the absolute best outcome

• Cons:• For large data sets, may take

an unreasonably long amount of time.

• If the value calculation takes more than a few milliseconds, runtime may end up taking unreasonably long

Page 9: Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee.

Backtracking: Eight Queens Puzzle

• A classic example of a backtracking problem is the Eight Queens Puzzle.

• In the Eight Queens Puzzle one must place a total of 8 queens on an 8x8 chessboard without one queen threatening another.

Page 10: Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee.

Backtracking Algorithm

• Using this example, the backtracking algorithm we implemented went through a piece of gear and determined whether or not it could meet the constraints that we placed, such as total value or drop percentage. If that piece failed, like the Eight Queens Puzzle we tried every piece in that “row”, in this case the given set for that particular piece, until one fit. Then we moved to the next piece until an obstacle was found, or an optimal set of gear was found.

Page 11: Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee.

Backtracking Algorithm

Pros• Typically simple to

implement

• Can be a quick algorithm depending on constraints given.

Cons• Has a possibility of taking

a long time depending on the constraints given

Page 12: Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee.

Greedy Algorithm

• The greedy algorithm applied to the problem works in two ways.• It looks for either the items with the highest value within the

constraint limit or it looks for the items with the largest weight within the constraint limit.

• It is a naïve approach that tackles the problem by sorting the set based upon either the weight or value.

• It then “picks up” the gear in order while checking to make sure that multiple pieces of the same type are not taken or the constraint limit is not crossed.

Page 13: Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee.

Greedy Algorithm

Pros• Easy to design and

implement.

• Can run quickly because of simplicity.

Cons• Possible to find answers

that are nowhere near optimal.

Page 14: Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee.

Greedy Algorithm

Greed is not always good

Page 15: Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee.

Results

Brute Force• Any Percent

Best value 37726, Mean 26984, Standard Deviation 5144

• Above 80 Percent

Best value 33745, Mean 23912, Standard Deviation 4770

• Above 85 Percent

Best value 29749, Mean 20097, Standard Deviation 4605

Backtracking• Any Percent

Best value 37726

• Above 80 Percent

Best value 33745

• Above 85 Percent

Best value 29749

Greedy• Any Percent

Best value 37726

• Above 80 Percent

Best value 28374

• Above 85 Percent

Best value 24718

Page 16: Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee.

Results

• Runtime Comparison (average over 1000 runs)• Brute Force: 4.45 seconds

• BackTracking: .0000344 seconds (34.4 microseconds)

• Greedy: .0000526 seconds (52.6 microseconds)

Page 17: Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee.

Conclusion

• The Brute Force algorithm searches all values in a set order. It is the most accurate algorithm and examines all possible results, but does so at the cost of having the longest runtime

• The backtracking algorithm searches depth first through the items. It potentially has an exhaustive run-time but can possibly find an optimal set in much less time than exhaustive.

• The greedy algorithm chooses items based on optimizing value, weight, or a ratio of both. While it is capable of finding an optimal result with a low run-time, it can run into issues where the algorithm finds sub-optimal results.

Page 18: Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee.

Expansion

• How could we expand?• Different Classes/Specs

• Increase Number of Items

• Polish and Ease of Use

• Add in Ability to Modify Starting Set

• Reapplying the algorithms• Traveling Salesman Problem, Freight Shipping

Page 19: Hunter Gear Optimization Team Alt + F4 Michael Barbour; Joshua Law son; Michael Lee.

Questions

• Given a set of 7 gear slots, each with 6 different possible item choices for each slot, how many different item sets can be made?• 67 or 279,936 item sets

• When should you use a greedy algorithm?• To get a rough idea of what the optimal set is with a short run-time

• What is a knapsack problem?• Finding a subset of items that maximizes value while staying within a constraint limit.

• What are some real life examples of Knapsack Problems?• Freight Shipping, Theft, Packing for a Hike.

• What are the drawbacks to a brute force algorithm?• It may take a prohibitively long amount of time for more complex problems.