jake5691 / Alfred-2.0

Alfred 2.0 Discord bot to maintain and serve in the RBC server
2 stars 0 forks source link

[BUG] Spec Advice - evaluate combinations takes too long #21

Closed jj-jimjams closed 2 years ago

jj-jimjams commented 2 years ago

Describe the bug Spec advice looks at all possible combinations of the priorities added and evaluates which combination will be the most useful. This works fine when say three priorities are added. However, the longer the list, the list of possible combinations grows exponentially larger and it takes too long to run or times out.

To Reproduce Steps to reproduce the behavior:

  1. at line 30 of main.py, enter: priorities_list = ("Land", "UpgradeBuild", "ExtraTile")
  2. see how nice and quickly it runs (steps are timestamped) 3.at line 30 on main.py, enter: priorities_list = ("Land", "UpgradeBuild", "ExtraTile", "TileHonour", "FWMat") (and that's only 13 million combinations. If you add in "MaxQs" it goes to 25 million and repl.it kills it before it finishes.
  3. go and have a cup of coffee and a nap as this will break the internet in your hour and takes 10 minutes to run

Expected behavior It all happens in seconds

*what i've explored so far

what might be useful

jake5691 commented 2 years ago

well I certainly need some quite moments to understand what you did there...

Can you sketch the idea or correct my assumption:

  1. you define all nodes like we did in DrawTest
  2. have predefined groups which you use as some sort of priority list
  3. go through those groups and create some sort of combinations of the nodes (what exactly you do there I don't understand) -> This uses the given groups but not the given spec points available, right? How do you determine if a node is activate able or not?
  4. you use some machine learning algo to determine which combinations to go for

I haven't really checked all your code but it's kind of hard for me as I'm not much familiar with df, and you seem to always come back to those even when from my perspective some could be avoided and just done in the Spec-Class.

What I think might be a valid option to get this to work (not tested or anything):

  1. define the nodes and give each node a usefulness score (maybe have 2 or 3 different sets of those (for speed, loyalty...) but give each node a score up front)
  2. "just" run an optimisation algo to maximise the usefulness score with skill points as limitation. (I should know stuff about that from my studies but thats a while ago and mostly theoretically with some given cost functions, so not sure if I can get such an approach to work)
jake5691 commented 2 years ago

forget what I wrote, I thought a little and my initial idea seams stupid or better, not feasible...

jj-jimjams commented 2 years ago

So that was my original idea. Assign a usefulness score to each node an then optimize to get the highest usefulness score with the constraint of userSpecPoints. I don't know how to write the algo for that so I'm essentially doing that in a bunch of code...

jj-jimjams commented 2 years ago

image

jj-jimjams commented 2 years ago

I have split it into two lists of three items each. Not a very elegant solution but it works for now