New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Respec Calculator #224
Comments
You can kind of get something like this using the Skill tree comparison tool (located at the bottom of the builds list). |
I think what he means is more on the lines of calculating the optimal way to respec. It's not always possible to just regret the old nodes and after that skill the new ones. It might need more regret orbs than just the node difference you get from the comparision tool. The feature would output (and maybe visualise) the minimum regrets required for respeccing. This is something I'm interested in doing, but I do have a decently sized backlog of skill tree generator related stuff I'd want to do first and also don't have much time atm. So I'll definetely not start working on it in the near future. |
Alright, that makes more sense actually. Well, no rush really. I have a lot |
Just to confirm: the most optimal path thing is what I meant yes. |
I would very much like to see this, i'm pretty terrible at figuring out optimal pathing myself, any update on where this stands on the list? :) |
A lot of new, more important stuff on my list, so this is still far away, sorry. |
So it's been a while but I started looking into this today. I'll keep using this issue since it's already open. If possible, I'd appreciate if someone could follow through my thoughts in this post to verify my basic assumptions (I found a counterexample to one of my earlier "proofs" and despite many revisions Lemma 6 failed to be what I wanted it to be - things are a lot less trivial than they may seem initially). This should serve partially as documentation and partially as peer review. The problem formally consists of trying to find a transformation from one node set (say, A) to another (B) through a serious of point allocations (including a node adjacent to the set) and deallocations or "unspecs" (removing a node without disconnecting any nodes from the set) over the graph G (the skill "tree") such that the number of deallocations is minimal and the number of nodes in the node set never exceeds a certain limit (N). We will also require A and B to contain at least 1 common node (class start node) that cannot be unspecced (or allocated). I will include the option to have a certain amount of unallocated points u := N - |A|; these can be treated as nodes in A that are unspecced immediately and "for free". I will assume |A| = N from here on. (This also follows from combining the proofs in Lemma 1 and Lemma 3.) Lemma 1: We can assume both node sets to have the same number of nodes N. Lemma 2: We can represent the transformation as a series of "steps", whereby each step consists of one unspec followed by one allocation. Lemma 3: The problem is symmetric in that solving the problem for A -> B immediately solves B -> A. Lemma 4: The amount of necessary steps is bounded by N-1. Lemma 5: The amount of necessary steps is not bounded in any form by the amount of nodes that differ between A and B (it is O(∞) with respect to |A ⊕ B|) Ok, that was the easy stuff. Now, as the first precursor to the next proof, here's a slightly more complex version of the previous proof's example: http://i.imgur.com/m5Soi0v.png However, we may also be able to use graph nodes that are in neither A nor B to get a better solution. Consider the following example from the real skill tree (viability aside): I will represent the available graph nodes that belong to neither A nor B as blue lines in my drawings, for example like this: Now for the thing that took me a while to figure out (and which I'm still not quiet satisfied with): Lemma 6: An optimal solution may involve unspeccing the same node more than once (in the sense that a solution that unspecs a node more than once is not necessarily suboptimal). Overview: Let's start: To flip section A, we unspec the 200 points in section D, as well as 5 points from w (this leaves c ending in nowhere). We build v and a, then unspec the 10000 points on A's red line and allocate them into A's green line. We won't need section a anymore, so we can unspec the 5 points in line a right now. Now we have two choices for acquiring the points needed for b: Unspec 200 more points from w or unspec v.
Longest proof by example I ever gave, I think. I'm also fairly certain this example is way too complicated (I was originally going for showing that the only optimal solution may require a node to be respecced more than once, but I noticed errors in that while writing it down. Again, let me know if you can come up with an easier or more "powerful" example). Lemma 6 is important because it directly impacts how (optimal) solutions can/must be represented. I would very much like to prove that there are cases where every optimal solution involves respeccing at least one node twice but I couldn't get there yet. It feels like it should just be a small step from what I have... In particular, this would mean that we cannot represent the step sequence as some (repetition-less) permutation of nodes or assign each node a number/order for when it is respecced. I don't know if any such examples can even come up in the skill tree in practice, but it seems theoretically possible. |
The first 5 Lemmas look good, I actually put some thoughts into it myself and came up with similar results (though less results, much less in-depth and all in my head). Can't say much about Lemma 6 as I don't have the time at the moment, but I promise to look into it! One thought on 6: because of the symmetry it would also be sufficient to find an optimal solution for an example that allocates (rather than unspecs) one node twice. Maybe it's easier to come up with examples when thinking that way. My few thoughts were more focused on the implementation side, so I'll just leave them here: My idea was to basically solve it as a shortest path problem. Take skill tree configurations as the nodes, the initial tree as start node and the goal tree as end node and try to find the shortest path from start to goal using some kind of heuristic. Edges could be steps (unspec and spec, cost 1 for each step) or both unspec and spec (no idea how the cost would be distributed). Because of the symmetry search tree depth could maybe be halved by starting simultaneously from start and goal and trying to meet in the middle. It might actually not even need a good heuristic to solve medium-sized problems on the skill tree with that. |
Thanks for sharing your thoughts!
True, I've so far focused my efforts on having a blue line be unspecced and then allocated again (which is two allocations and two respecs), but finding an example where a green line would be unspecced (or a red line allocated) at any point would also suffice. I'll think about those some more.
That's a great representation of the search space, leaving us with 2^K nodes (with K being the number of considered nodes) and at least as many edges (although generally many more - at each step we can unspec any leaf node and respec any adjacent one) if we allow any sequence of unspecs and allocations, or K over N (binomial) nodes if we only allow steps. There can be a lot of redundancy in the representations (i.e. the order/interleaving of allocations and unspecs is often meaningless, but not always) so eliminating that could significantly cut down on the search space size. It also seems that the really iffy cases (i.e. what I'm trying to come up with in Lemma 6) tend to be highly artificial (consisting solely of long lines and no spare nodes to unspec) which likely won't be applicable in practice. Another way to think of the problem is "squeezing" a constant volume node "goo" through the graph into a new position (while never disconnecting a part of the goo). I have yet to come up with search terms for literature on this problem though (of which we have a special case because we have at least one fixed node, without which Lemma 4 would not hold). I'm still trying to get a better understanding of the problem before deciding on the method of choice. I mean, establishing NP-completeness of the problem would be a step I suppose :D |
Ok, so I had a look, and I will need sometime on Lemma 6. Lemma 1 through 5 look good. Another point, trees with different starting classes cannot be done. |
So after some googling (starting from this team puzzle I felt reminded of) I found something related: https://en.wikipedia.org/wiki/Pebble_motion_problems The complexity section is interesting, because our pebbles are technically unlabelled and we only seek to minimize the number of moves (up to this point we're in polynomial time) but we have the additional constraint of not losing pebble connectivity (with our moves consequently looking slightly different). I'll keep on digging. |
Hm, that problem moves pebbles edge by edge, so I think it is pretty different from our problem. But yeah, they seem somewhat related. Maybe "graph relocation" is a term both pebble motion and our problem fit under. |
Yes, in the pebble motion problem, pebbles only move to adjacent vertices without being concerned about keeping the subgraph connected. I still haven't found anything that matches our problem very well. It doesn't help that graph pebbling is actually a different problem. A problem field that seems extremely similar to (labelled) pebble motions is the graph relabeling problem, whose general definition fits what we do but the only relevant papers essentially do the above pebble motion (in my understanding). There are graph grammars but I haven't dived deep enough into that to see if they have had their theory specialized in the direction we are concerned with (I got as far as this). There's also graph edit distances but those seem too far off. Maybe I should ask on on stackexchange's math site if anybody can figure out keywords to look for (or knows some papers on this)? I mean, I essentially couldn't find the pebble movement problem by googling (only by exploring Wikipedia's graph theory pages) before I knew how it was called... |
Found some time to look into Lemma 6! On Lemma 4 and 5: |A ⊕ B| is a lower bound of the optimal solution, which could be as useful as upper bounds. The upper bound from Lemma 4 can be improved a bit: Instead of only subtracting the root node (N-1), all nodes that are connected to the root node in the graph with nodes A∩B can be subtracted (deallocate all nodes that are only in A and all nodes that become disconnected by that, allocate all nodes that are only in B and the common nodes previously deallocated). On Lemma 6: I think I improved your solution without the need for unspecing a node twice. Your image does not match your numbers (image has 2 for a, c and 202 for b, text has 5 and 205; image has the 1 black node above D) but my solution works for both variants. I did verify my solution twice, but it might still have errors. (first table is image variant, second is text variant; negative number behind action means deallocation, positive allocation)
My intuition is that at least the stronger variant of the Lemma (all optimal solutions may involve deallocating twice) doesn't hold, but didn't have the time to even try proving that (by converting a solution with deallocating a node twice to a solution of at least the same value that doesn't deallocate a node twice). Also, skill "trees" are planar except for one violating edge for Ascendants, which might make it easier. |
Argh, yeah, I messed around with the graphic after realizing a problem while writing but then failed to update it to match the new text. I see though that you made a step that works in both cases that I didn't think of (put points from red A into completing c+w and then flip C early, I mentally treated e.g. red A -> green A as an atomic operation too much), which certainly ruins my example. |
I was searching for a Respec Calculator and stumbled upon this thread and I'm amazed by how much effort you guys have put into this. Have you given up or made more progress? I didn't understand all but I felt my brain get bigger reading all your elaborations. Cheers |
As far as I'm aware, there hasn't been any progress. At least I haven't spent time on it. |
This one might be kind of hard, but I would love the option to select 2 trees and have a "most optimal respec path" calculated for it. It would give you a quick idea of how many regrets you have to get and it might catch some stuff you didn't think of for respeccing. If you add it I'll make part 2 of this: https://www.youtube.com/watch?v=WEDGBkvbKYI include it ^^
The text was updated successfully, but these errors were encountered: