Fixed issue in __calc_paths and added __calc_path_preference() to the init #53
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
My proposed changes are twofold:
(1) One line we have path = [] # start a new path, meaning the end of a path is reached and the list is reset. However this only gets implemented if the if statement on 291 is true. If this if statmenent is false, the recursive call gives us subpaths, and all the current path+subpaths are added. However, path = [] is never called, even though the for loop in line 287 is about to start a new iteration (to calculate paths through a new candidate). This results in incorrect paths (I have checked). Moving path = [] outside the if statement makes sure that the path is reset before every iteration of the for loop.
(2) __calc_path_preference function is defined but never ran in profile.py. Since this is a static function, it cannot be called from an instance of Profile. This results in profile. path_preference_graph to always be an empty list. We could just copy and paste the same method to our rule, but this would cause a lot of time (and would be repeated every time the method is called). It is much more efficient if this method is called upon initialization, as (I believe) originally intended.